export type CreateApiPipelineWithComponentsArgs = {body: {origin?: ('ui' | 'system') | undefined, pipeline?: ({id?: string | undefined, title?: (string | null) | undefined} | null) | undefined, sources: Array<{title?: (string | null) | undefined, description?: (string | null) | undefined, type?: ('http' | 'splunk-hec' | 's3' | 'sqs' | 'demo-logs' | 'kinesis-firehose' | 'fluent' | 'log-analysis' | 'log-analysis-ingestion' | 'logstash' | 'mezmo-agent' | 'mezmo-datadog-source' | 'pipeline-data-restoration' | 'webhook' | 'kafka' | 'azure-event-hub' | 'prometheus-remote-write' | 'open-telemetry-metrics' | 'open-telemetry-logs' | 'open-telemetry-traces') | undefined, user_config: Record}>, transforms: Array<{title?: (string | null) | undefined, description?: (string | null) | undefined, type?: ('filter' | 'sample' | 'drop-fields' | 'parse' | 'parse-sequentially' | 'route' | 'stringify' | 'compact-fields' | 'flatten-fields' | 'dedupe' | 'encrypt-fields' | 'decrypt-fields' | 'js-script' | 'unroll' | 'vrl' | 'reduce' | 'map-fields' | 'metrics-tag-cardinality-limit' | 'aggregate' | 'event-to-metric' | 'clustering' | 'redact' | 'throttle' | 'set-timestamp' | 'data-profiler' | 'replace' | 'trace-sampling') | undefined, user_config: Record}>, sinks: Array<{title?: (string | null) | undefined, description?: (string | null) | undefined, type?: ('mezmo' | 'mezmo-archive' | 'http' | 'cloudwatch-logs' | 'cloudwatch-metrics' | 'sqs' | 'notification-channel' | 'azure-blob-storage' | 'kinesis-firehose' | 'kinesis-streams' | 'elasticsearch' | 'gcp-cloud-monitoring' | 'gcp-cloud-storage' | 'gcp-cloud-operations' | 'gcp-cloud-pubsub' | 'honeycomb-logs' | 'indexed-search' | 'kafka' | 'loki' | 'new-relic' | 'prometheus-remote-write' | 'pulsar' | 'redis' | 'splunk-hec-logs' | 'sumo-logic-logs' | 'sumo-logic-metrics' | 'vector' | 's3' | 'blackhole' | 'datadog-logs' | 'datadog-metrics' | 'clickhouse' | 'opentelemetry') | undefined, user_config: Record}>}}; export type CreateApiPipelineWithComponentsOptions = {baseUrl?: string | undefined, PipelineServiceKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Initialize a pipeline with provided components. All sources, transforms, and sinks are linked. * * POST /pipeline/with-components */ export const createApiPipelineWithComponents = async (args: CreateApiPipelineWithComponentsArgs, options?: CreateApiPipelineWithComponentsOptions) => { const {baseUrl = "https://api.mezmo.com/v3", fetch: fetchFn = fetch, PipelineServiceKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (PipelineServiceKey !== undefined) headers.set("Authorization", PipelineServiceKey) const url = `${baseUrl.replace(/\/+$/, '')}/pipeline/with-components${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };