export type GetApiEnvironmentEnvironmentIdTerraformExportArgs = {environmentId: string, exportSecrets?: boolean | undefined}; export type GetApiEnvironmentEnvironmentIdTerraformExportOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export full environment and its resources into Terraform manifests * * GET /environment/{environmentId}/terraformExport * * Also accepts auth: bearerAuth */ export const getApiEnvironmentEnvironmentIdTerraformExport = async (args: GetApiEnvironmentEnvironmentIdTerraformExportArgs, options?: GetApiEnvironmentEnvironmentIdTerraformExportOptions) => { const {baseUrl = "https://api.qovery.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.exportSecrets != null) query.append("exportSecrets", String(args.exportSecrets)) if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/environment/${encodeURIComponent(String(args.environmentId))}/terraformExport${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };