export type WorkspaceRunStatusEnum = '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 RunnerTypeEnum = 'github-actions' | 'gitlab-pipelines' | 'bitbucket-pipelines' | 'azure-pipelines' | 'jenkins' | 'semaphore' | 'atlantis' | 'env0' | 'firefly' | 'unrecognized'; export type VcsTypeEnum = 'github' | 'gitlab' | 'bitbucket' | 'codecommit' | 'azuredevops'; export type TaskTypeEnum = 'post-plan' | 'post-apply'; export type Task = {id?: string | undefined, accountId?: string | undefined, createdAt?: string | undefined, updatedAt?: string | undefined, contentKeys?: {[key: string]: string} | undefined, status?: string | undefined, resultStatus?: string | undefined, type?: TaskTypeEnum | undefined, guardrailsSummary?: ({total?: number | undefined, passed?: number | undefined, failed?: number | undefined, violations?: (Array<{id?: string | undefined, severity?: ('high' | 'medium' | 'low') | undefined, message?: string | undefined}>) | undefined, description?: string | undefined}) | undefined, backendSummary?: ({type?: ('s3' | 'azurerm' | 'gcs' | 'consul') | undefined, config?: {[key: string]: unknown} | undefined, resources?: number | undefined, description?: string | undefined}) | undefined, changedFilesCodeSummary?: ({total?: number | undefined, added?: number | undefined, modified?: number | undefined, deleted?: number | undefined, files?: (Array<{path?: string | undefined, type?: ('added' | 'modified' | 'deleted') | undefined}>) | undefined, description?: string | undefined}) | undefined, vcsType?: VcsTypeEnum | undefined, runnerType?: RunnerTypeEnum | undefined}; export type WorkspaceRunError = {type: string, description: string, activity?: string | undefined, temporalWorkflowId: string, cause?: string | undefined}; export type WorkspaceRun = {id?: string | undefined, accountId?: string | undefined, createdAt?: string | undefined, updatedAt?: string | undefined, workspaceId?: string | undefined, workspaceName?: string | undefined, runId?: string | undefined, runName?: string | undefined, status?: WorkspaceRunStatusEnum | undefined, pullRequestId?: string | undefined, pullRequestUrl?: string | undefined, branch?: string | undefined, commitId?: string | undefined, commitUrl?: string | undefined, runnerType?: RunnerTypeEnum | undefined, buildId?: string | undefined, buildUrl?: string | undefined, buildName?: string | undefined, vcsType?: VcsTypeEnum | undefined, repo?: string | undefined, repoUrl?: string | undefined, ownerSummary?: ({email?: string | undefined, name?: string | undefined, initials?: string | undefined, customColor?: string | undefined}) | undefined, title?: string | undefined, terraformVersion?: string | undefined, iacType?: ('terraform' | 'opentofu' | 'k8s') | undefined, backendSummary?: ({backendType?: string | undefined, backendConfig?: {[key: string]: unknown} | undefined, iacStackId?: string | undefined, managedResourceCount?: number | undefined}) | undefined, planTaskId?: string | undefined, applyTaskId?: string | undefined, plan?: Array | undefined, apply?: Array | undefined, error?: WorkspaceRunError | undefined}; export type AddWorkspaceRunRequest = {workspaceRun: WorkspaceRun}; export type CreateApiSelfHostedAccountIdWorkspacesWorkspaceIdRunsArgs = {accountId: string, workspaceId: string, body: AddWorkspaceRunRequest}; export type CreateApiSelfHostedAccountIdWorkspacesWorkspaceIdRunsOptions = {baseUrl?: string | undefined, RunnerPoolAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add a workspace run (self-hosted) * * POST /self-hosted/{accountId}/workspaces/{workspaceId}/runs */ export const createApiSelfHostedAccountIdWorkspacesWorkspaceIdRuns = async (args: CreateApiSelfHostedAccountIdWorkspacesWorkspaceIdRunsArgs, options?: CreateApiSelfHostedAccountIdWorkspacesWorkspaceIdRunsOptions) => { 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))}/runs${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 };