import type { UnknownToClient } from '../../../../types/utils.types.js'; import type { AuditLogDrain, LogDrain, LogDrainExecutionStatus, LogDrainKind, LogDrainProbeResult, LogDrainProbeType, LogDrainStatus, LogDrainTarget, LogDrainTlsVerification } from './log-drain.types.js'; interface ApiLogDrainPayload { id: string; /** Left out for an AUDITLOG drain, which is attached to the organisation rather than to a resource. */ resourceId?: string | null; status: { date: string; status: LogDrainStatus; authorId?: string; errorReason?: string; }; kind?: LogDrainKind; recipient: ApiRecipientPayload; execution: { status: LogDrainExecutionStatus; lastError?: string; attempt?: number; maxAttempt?: number; lastAttemptAt?: string; nextAttemptAt?: string; retryingSince?: string; }; backlog?: { msgRateOut: number; msgThroughputOut: number; msgBacklog: number; }; } interface ApiRecipientPayload { /** The protocols the client knows, and whatever else the API grows. */ type: 'RAW_HTTP' | 'SYSLOG_TCP' | 'SYSLOG_UDP' | 'OVH_TCP' | 'DATADOG' | 'ELASTICSEARCH' | 'NEWRELIC' | 'BETTERSTACK' | 'SPLUNK' | (string & {}); url: string; username?: string; password?: string; apiKey?: string; index?: string; rfc5424StructuredDataParameters?: string; token?: string; sourceToken?: string; sourcetype?: string; tlsVerification?: LogDrainTlsVerification; } interface ApiProbeResultPayload { ok: boolean; code: string; message: string; type?: LogDrainProbeType | (string & {}) | null; durationMs?: number | null; http?: ApiProbeHttpDetailPayload | null; tcp?: ApiProbeTcpDetailPayload | null; } interface ApiProbeHttpDetailPayload { request: { method: string; url: string; headers: Record; body?: string | null; }; response?: { statusCode: number; headers: Record>; body?: string | null; } | null; } interface ApiProbeTcpDetailPayload { connected: boolean; host: string; port: number; } /** * Transform API v4 log drain payload to client format. * The drain is attached to an application or an add-on, so the payload always names the resource it ships the * logs of. */ export declare function transformLogDrain(payload: ApiLogDrainPayload): LogDrain; /** * Transform API v4 audit log drain payload to client format. * An audit log drain is attached to the organisation itself, so the payload names no resource. */ export declare function transformAuditLogDrain(payload: ApiLogDrainPayload): AuditLogDrain; /** * Build the API v4 request body to create a log drain */ export declare function buildLogDrainCreatePayload(kind: LogDrainKind, target: LogDrainTarget): { kind: LogDrainKind; recipient: ApiRecipientPayload; }; /** * Transform API v4 recipient payload to client drain target format */ export declare function transformLogDrainTarget(payload: ApiRecipientPayload): LogDrainTarget | UnknownToClient; /** * Transform API v4 drain probe payload to client format. * The variant is picked from the transport the probe reports, and a probe that reached none of them, which the * API answers by leaving the field out, becomes the transport-less variant. */ export declare function transformLogDrainProbeResult(payload: ApiProbeResultPayload): LogDrainProbeResult; export {}; //# sourceMappingURL=log-drain-transform.d.ts.map