export type IacProvisioner = {type: 'terraform' | 'opentofu', version: string}; export type MultiEnvProvisioner = {type: 'terragrunt', version: string, applyAll?: boolean | undefined, stopOnError?: boolean | undefined}; export type WorkspaceRunStatus = 'pending' | 'running' | 'success' | 'failed' | 'canceled' | 'initializing' | 'queued' | 'planning' | 'planning_destroy' | 'applying' | 'destroying' | 'ready_for_apply' | 'ready_for_destroy' | 'destroyed' | 'destroy_plan_completed' | 'destroy_plan_failed' | 'destroy_failed' | 'discarded' | 'canceling_init' | 'canceling_plan' | 'canceling_planning_destroy' | 'canceling_apply' | 'canceling_destroy' | 'canceled_init' | 'canceled_plan' | 'canceled_planning_destroy' | 'canceled_apply' | 'canceled_destroy' | 'init_error' | 'plan_success' | 'plan_error' | 'apply_error' | 'apply_success' | 'blocked' | 'Acknowledged' | 'plan_no_changes' | 'apply_no_changes' | 'runner_failure'; export type BackendSummary = {type?: ('s3' | 'azurerm' | 'gcs' | 'consul') | undefined, config?: {[key: string]: unknown} | undefined, resources?: number | undefined}; export type WorkspaceTriggerConfig = {runOnPullRequest?: boolean | undefined, runOnPush?: boolean | undefined, autoApply?: boolean | undefined}; export type UpdateWorkspaceRequest = {description?: string | undefined, labels?: Array | undefined, cronExecutionPattern?: string | undefined, iacProvisioner?: IacProvisioner | undefined, multiEnvProvisioner?: MultiEnvProvisioner | undefined, repositoryUrl?: string | undefined, runsCount?: number | undefined, isWorkflowManaged?: boolean | undefined, lastRunStatus?: WorkspaceRunStatus | undefined, lastApplyTime?: string | undefined, lastPlanTime?: string | undefined, lastDestroyTime?: string | undefined, lastRunTime?: string | undefined, backendSummary?: BackendSummary | undefined, backends?: {[key: string]: BackendSummary} | undefined, triggerConfig?: WorkspaceTriggerConfig | undefined, poolId?: string | undefined, oidcAuthentication?: (boolean | null) | undefined}; export type PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdArgs = {accountId: string, workspaceId: string, body: UpdateWorkspaceRequest}; export type PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdOptions = {baseUrl?: string | undefined, RunnerPoolAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a workspace (self-hosted) * * PATCH /self-hosted/{accountId}/workspaces/{workspaceId} */ export const patchApiSelfHostedAccountIdWorkspacesWorkspaceId = async (args: PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdArgs, options?: PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdOptions) => { 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/json") if (RunnerPoolAuth !== undefined) headers.set('authorization', `Bearer ${RunnerPoolAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/self-hosted/${encodeURIComponent(String(args.accountId))}/workspaces/${encodeURIComponent(String(args.workspaceId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };