export type ChangeRequestSettings = {Type?: ('ServiceNow' | 'JiraServiceManagement') | undefined}; export type RunRunbookCommandV1 = {ChangeRequestSettings?: Array | undefined, Comments?: string | undefined, DebugMode?: string | undefined, EnvironmentId?: string | undefined, EnvironmentIds?: Array | undefined, ExcludedMachineIds?: Array | undefined, ExcludedTargetTagIds?: Array | undefined, FailTargetDiscovery?: boolean | undefined, ForcePackageDownload?: boolean | undefined, FormValues?: {[key: string]: string} | undefined, Priority?: string | undefined, ProjectId?: string | undefined, QueueTime?: string | undefined, QueueTimeExpiry?: string | undefined, RunbookId: string, RunbookSnapshotNameOrId?: string | undefined, SkipActions?: Array | undefined, SpaceId: string, SpecificMachineIds?: Array | undefined, SpecificTargetTagIds?: Array | undefined, TenantId?: string | undefined, TenantIds?: Array | undefined, TenantTagNames?: Array | undefined, UseDefaultSnapshot?: boolean | undefined, UseGuidedFailure?: boolean | undefined}; export type CreateApiRunbooksRunbookIdRunArgs = {runbookId: string, body: RunRunbookCommandV1}; export type CreateApiRunbooksRunbookIdRunOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Run the published version of this Runbook * * POST /runbooks/{runbookId}/run * * Also accepts auth: APIKeyQuery, NugetApiKeyHeader */ export const createApiRunbooksRunbookIdRun = async (args: CreateApiRunbooksRunbookIdRunArgs, options?: CreateApiRunbooksRunbookIdRunOptions) => { const {baseUrl = "https://demo.octopus.app/api", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKeyHeader !== undefined) headers.set("X-Octopus-ApiKey", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/runbooks/${encodeURIComponent(String(args.runbookId))}/run${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 };