export type UpdateApiSelfHostedTerraformPlansKeyOutputArgs = {key: string, body: BodyInit}; export type UpdateApiSelfHostedTerraformPlansKeyOutputOptions = {baseUrl?: string | undefined, RunnerPoolAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload Terraform plan output (self-hosted) * * PUT /self-hosted/terraform/plans/{key}/output */ export const updateApiSelfHostedTerraformPlansKeyOutput = async (args: UpdateApiSelfHostedTerraformPlansKeyOutputArgs, options?: UpdateApiSelfHostedTerraformPlansKeyOutputOptions) => { const {baseUrl = "https://api.firefly.ai/v2", fetch: fetchFn = fetch, RunnerPoolAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/octet-stream") if (RunnerPoolAuth !== undefined) headers.set('authorization', `Bearer ${RunnerPoolAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/self-hosted/terraform/plans/${encodeURIComponent(String(args.key))}/output${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };