export type CreateApiPipelinePipelineIdSinkArgs = {pipeline_id: string, body: {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', deploy_type?: ('saas' | 'local') | undefined, title?: (string | null) | undefined, description?: (string | null) | undefined, user_config: Record, inputs?: Array | undefined}}; export type CreateApiPipelinePipelineIdSinkOptions = {baseUrl?: string | undefined, PipelineServiceKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add a sink to a pipeline * * POST /pipeline/{pipeline_id}/sink */ export const createApiPipelinePipelineIdSink = async (args: CreateApiPipelinePipelineIdSinkArgs, options?: CreateApiPipelinePipelineIdSinkOptions) => { 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/${encodeURIComponent(String(args.pipeline_id))}/sink${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 };