diff --git a/apps/webservice/src/app/api/v1/release-channels/openapi.ts b/apps/webservice/src/app/api/v1/channels/openapi.ts similarity index 87% rename from apps/webservice/src/app/api/v1/release-channels/openapi.ts rename to apps/webservice/src/app/api/v1/channels/openapi.ts index d743ac385..9780a7a3c 100644 --- a/apps/webservice/src/app/api/v1/release-channels/openapi.ts +++ b/apps/webservice/src/app/api/v1/channels/openapi.ts @@ -7,22 +7,22 @@ export const openapi: Swagger.SwaggerV3 = { version: "1.0.0", }, paths: { - "/v1/release-channels": { + "/v1/channels": { post: { - summary: "Create a release channel", - operationId: "createReleaseChannel", + summary: "Create a channel", + operationId: "createChannel", requestBody: { required: true, content: { "application/json": { schema: { type: "object", - required: ["deploymentId", "name", "releaseFilter"], + required: ["deploymentId", "name", "versionSelector"], properties: { deploymentId: { type: "string" }, name: { type: "string" }, description: { type: "string", nullable: true }, - releaseFilter: { + versionSelector: { type: "object", additionalProperties: true, }, @@ -33,7 +33,7 @@ export const openapi: Swagger.SwaggerV3 = { }, responses: { "200": { - description: "Release channel created successfully", + description: "Channel created successfully", content: { "application/json": { schema: { @@ -44,7 +44,7 @@ export const openapi: Swagger.SwaggerV3 = { name: { type: "string" }, description: { type: "string", nullable: true }, createdAt: { type: "string", format: "date-time" }, - releaseFilter: { + versionSelector: { type: "object", additionalProperties: true, }, @@ -55,7 +55,7 @@ export const openapi: Swagger.SwaggerV3 = { }, }, "409": { - description: "Release channel already exists", + description: "Channel already exists", content: { "application/json": { schema: { @@ -70,7 +70,7 @@ export const openapi: Swagger.SwaggerV3 = { }, }, "500": { - description: "Failed to create release channel", + description: "Failed to create channel", content: { "application/json": { schema: { diff --git a/apps/webservice/src/app/api/v1/channels/route.ts b/apps/webservice/src/app/api/v1/channels/route.ts new file mode 100644 index 000000000..c3c509102 --- /dev/null +++ b/apps/webservice/src/app/api/v1/channels/route.ts @@ -0,0 +1,43 @@ +import type { z } from "zod"; +import { NextResponse } from "next/server"; + +import { buildConflictUpdateColumns, takeFirst } from "@ctrlplane/db"; +import { createDeploymentVersionChannel } from "@ctrlplane/db/schema"; +import * as SCHEMA from "@ctrlplane/db/schema"; +import { Permission } from "@ctrlplane/validators/auth"; + +import { authn, authz } from "../auth"; +import { parseBody } from "../body-parser"; +import { request } from "../middleware"; + +export const POST = request() + .use(authn) + .use(parseBody(createDeploymentVersionChannel)) + .use( + authz(({ ctx, can }) => + can + .perform(Permission.DeploymentVersionChannelCreate) + .on({ type: "deployment", id: ctx.body.deploymentId }), + ), + ) + .handle<{ body: z.infer }>( + ({ db, body }) => + db + .insert(SCHEMA.deploymentVersionChannel) + .values(body) + .onConflictDoUpdate({ + target: [ + SCHEMA.deploymentVersionChannel.deploymentId, + SCHEMA.deploymentVersionChannel.name, + ], + set: buildConflictUpdateColumns(SCHEMA.deploymentVersionChannel, [ + "versionSelector", + ]), + }) + .returning() + .then(takeFirst) + .then((deploymentVersionChannel) => + NextResponse.json(deploymentVersionChannel), + ) + .catch((error) => NextResponse.json({ error }, { status: 500 })), + ); diff --git a/apps/webservice/src/app/api/v1/config/route.ts b/apps/webservice/src/app/api/v1/config/route.ts index 580b9d712..72d9ea21b 100644 --- a/apps/webservice/src/app/api/v1/config/route.ts +++ b/apps/webservice/src/app/api/v1/config/route.ts @@ -188,10 +188,10 @@ const upsertVersions = async (db: Tx, config: CacV1, userId: string) => { d.deployment.slug === deploymentSlug && d.system.slug === systemSlug, ); if (deployment == null) return false; - const existingRelease = deployment.versions.find( + const existingVersion = deployment.versions.find( (r) => r.tag === version.tag, ); - return existingRelease == null; + return existingVersion == null; }, ); diff --git a/apps/webservice/src/app/api/v1/deployments/[deploymentId]/release-channels/name/[name]/openapi.ts b/apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/openapi.ts similarity index 85% rename from apps/webservice/src/app/api/v1/deployments/[deploymentId]/release-channels/name/[name]/openapi.ts rename to apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/openapi.ts index edfec830f..8cd1bbdd6 100644 --- a/apps/webservice/src/app/api/v1/deployments/[deploymentId]/release-channels/name/[name]/openapi.ts +++ b/apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/openapi.ts @@ -7,10 +7,10 @@ export const openapi: Swagger.SwaggerV3 = { version: "1.0.0", }, paths: { - "/v1/deployments/{deploymentId}/release-channels/name/{name}": { + "/v1/deployments/{deploymentId}/channels/name/{name}": { delete: { - summary: "Delete a release channel", - operationId: "deleteReleaseChannel", + summary: "Delete a channel", + operationId: "deleteChannel", parameters: [ { name: "deploymentId", @@ -27,7 +27,7 @@ export const openapi: Swagger.SwaggerV3 = { ], responses: { "200": { - description: "Release channel deleted", + description: "Channel deleted", content: { "application/json": { schema: { @@ -51,7 +51,7 @@ export const openapi: Swagger.SwaggerV3 = { }, }, "404": { - description: "Release channel not found", + description: "Channel not found", content: { "application/json": { schema: { @@ -63,7 +63,7 @@ export const openapi: Swagger.SwaggerV3 = { }, }, "500": { - description: "Failed to delete release channel", + description: "Failed to delete channel", content: { "application/json": { schema: { diff --git a/apps/webservice/src/app/api/v1/deployments/[deploymentId]/release-channels/name/[name]/route.ts b/apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/route.ts similarity index 91% rename from apps/webservice/src/app/api/v1/deployments/[deploymentId]/release-channels/name/[name]/route.ts rename to apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/route.ts index 18d18e713..d136e237f 100644 --- a/apps/webservice/src/app/api/v1/deployments/[deploymentId]/release-channels/name/[name]/route.ts +++ b/apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/route.ts @@ -32,12 +32,12 @@ export const DELETE = request() ); return NextResponse.json( - { message: "Release channel deleted" }, + { message: "Channel deleted" }, { status: 200 }, ); } catch { return NextResponse.json( - { error: "Failed to delete release channel" }, + { error: "Failed to delete channel" }, { status: 500 }, ); } diff --git a/apps/webservice/src/app/api/v1/deployments/[deploymentId]/route.ts b/apps/webservice/src/app/api/v1/deployments/[deploymentId]/route.ts index 59eeeaa47..e167d87e9 100644 --- a/apps/webservice/src/app/api/v1/deployments/[deploymentId]/route.ts +++ b/apps/webservice/src/app/api/v1/deployments/[deploymentId]/route.ts @@ -7,8 +7,8 @@ import * as SCHEMA from "@ctrlplane/db/schema"; import { logger } from "@ctrlplane/logger"; import { Permission } from "@ctrlplane/validators/auth"; -import { authn, authz } from "../../auth"; -import { request } from "../../middleware"; +import { authn, authz } from "~/app/api/v1/auth"; +import { request } from "~/app/api/v1/middleware"; export const GET = request() .use(authn) diff --git a/apps/webservice/src/app/api/v1/releases/[releaseId]/openapi.ts b/apps/webservice/src/app/api/v1/deployments/versions/[versionId]/openapi.ts similarity index 82% rename from apps/webservice/src/app/api/v1/releases/[releaseId]/openapi.ts rename to apps/webservice/src/app/api/v1/deployments/versions/[versionId]/openapi.ts index 328cc2626..c62258da0 100644 --- a/apps/webservice/src/app/api/v1/releases/[releaseId]/openapi.ts +++ b/apps/webservice/src/app/api/v1/deployments/versions/[versionId]/openapi.ts @@ -6,17 +6,17 @@ export const openapi: Swagger.SwaggerV3 = { openapi: "3.0.0", info: { title: "Ctrlplane API", version: "1.0.0" }, paths: { - "/v1/releases/{releaseId}": { + "/v1/deployments/versions/{versionId}": { patch: { - summary: "Updates a release", - operationId: "updateRelease", + summary: "Updates a deployment version", + operationId: "updateDeploymentVersion", parameters: [ { - name: "releaseId", + name: "versionId", in: "path", required: true, schema: { type: "string" }, - description: "The release ID", + description: "The ID of the deployment version", }, ], requestBody: { @@ -26,7 +26,7 @@ export const openapi: Swagger.SwaggerV3 = { schema: { type: "object", properties: { - version: { type: "string" }, + tag: { type: "string" }, deploymentId: { type: "string" }, createdAt: { type: "string", format: "date-time" }, name: { type: "string" }, @@ -54,7 +54,7 @@ export const openapi: Swagger.SwaggerV3 = { description: "OK", content: { "application/json": { - schema: { $ref: "#/components/schemas/Release" }, + schema: { $ref: "#/components/schemas/DeploymentVersion" }, }, }, }, diff --git a/apps/webservice/src/app/api/v1/releases/[releaseId]/route.ts b/apps/webservice/src/app/api/v1/deployments/versions/[versionId]/route.ts similarity index 84% rename from apps/webservice/src/app/api/v1/releases/[releaseId]/route.ts rename to apps/webservice/src/app/api/v1/deployments/versions/[versionId]/route.ts index 5756652fb..82a696bb9 100644 --- a/apps/webservice/src/app/api/v1/releases/[releaseId]/route.ts +++ b/apps/webservice/src/app/api/v1/deployments/versions/[versionId]/route.ts @@ -15,9 +15,9 @@ import { import { logger } from "@ctrlplane/logger"; import { Permission } from "@ctrlplane/validators/auth"; -import { authn, authz } from "../../auth"; -import { parseBody } from "../../body-parser"; -import { request } from "../../middleware"; +import { authn, authz } from "~/app/api/v1/auth"; +import { parseBody } from "~/app/api/v1/body-parser"; +import { request } from "~/app/api/v1/middleware"; const patchSchema = SCHEMA.updateDeploymentVersion.and( z.object({ metadata: z.record(z.string()).optional() }), @@ -30,18 +30,18 @@ export const PATCH = request() authz(({ can, extra: { params } }) => can .perform(Permission.DeploymentVersionUpdate) - .on({ type: "deploymentVersion", id: params.releaseId }), + .on({ type: "deploymentVersion", id: params.versionId }), ), ) .handle< { body: z.infer; user: SCHEMA.User }, - { params: { releaseId: string } } + { params: { versionId: string } } >(async (ctx, { params }) => { - const { releaseId: versionId } = params; + const { versionId } = params; const { body, user, req } = ctx; try { - const release = await ctx.db + const deploymentVersion = await ctx.db .update(SCHEMA.deploymentVersion) .set(body) .where(eq(SCHEMA.deploymentVersion.id, versionId)) @@ -83,12 +83,12 @@ export const PATCH = request() }) .then(() => logger.info( - `Version for ${versionId} job triggers created and dispatched.`, + `Jobs for deployment version ${versionId} created and dispatched.`, req, ), ); - return NextResponse.json(release); + return NextResponse.json(deploymentVersion); } catch (error) { logger.error(error); return NextResponse.json( diff --git a/apps/webservice/src/app/api/v1/releases/openapi.ts b/apps/webservice/src/app/api/v1/deployments/versions/openapi.ts similarity index 83% rename from apps/webservice/src/app/api/v1/releases/openapi.ts rename to apps/webservice/src/app/api/v1/deployments/versions/openapi.ts index 36b22e045..a9cfada90 100644 --- a/apps/webservice/src/app/api/v1/releases/openapi.ts +++ b/apps/webservice/src/app/api/v1/deployments/versions/openapi.ts @@ -9,10 +9,10 @@ export const openapi: Swagger.SwaggerV3 = { version: "1.0.0", }, paths: { - "/v1/releases": { + "/v1/deployments/versions": { post: { - summary: "Upserts a release", - operationId: "upsertRelease", + summary: "Upserts a deployment version", + operationId: "upsertDeploymentVersion", requestBody: { required: true, content: { @@ -20,7 +20,7 @@ export const openapi: Swagger.SwaggerV3 = { schema: { type: "object", properties: { - version: { type: "string" }, + tag: { type: "string" }, deploymentId: { type: "string" }, createdAt: { type: "string", format: "date-time" }, name: { type: "string" }, @@ -39,7 +39,7 @@ export const openapi: Swagger.SwaggerV3 = { additionalProperties: { type: "string" }, }, }, - required: ["version", "deploymentId"], + required: ["tag", "deploymentId"], }, }, }, @@ -49,12 +49,12 @@ export const openapi: Swagger.SwaggerV3 = { description: "OK", content: { "application/json": { - schema: { $ref: "#/components/schemas/Release" }, + schema: { $ref: "#/components/schemas/DeploymentVersion" }, }, }, }, "409": { - description: "Release already exists", + description: "Deployment version already exists", content: { "application/json": { schema: { diff --git a/apps/webservice/src/app/api/v1/releases/route.ts b/apps/webservice/src/app/api/v1/deployments/versions/route.ts similarity index 73% rename from apps/webservice/src/app/api/v1/releases/route.ts rename to apps/webservice/src/app/api/v1/deployments/versions/route.ts index 53f4aa7d3..dfd7275e5 100644 --- a/apps/webservice/src/app/api/v1/releases/route.ts +++ b/apps/webservice/src/app/api/v1/deployments/versions/route.ts @@ -23,16 +23,14 @@ import { logger } from "@ctrlplane/logger"; import { Permission } from "@ctrlplane/validators/auth"; import { DeploymentVersionStatus } from "@ctrlplane/validators/releases"; -import { authn, authz } from "../auth"; -import { parseBody } from "../body-parser"; -import { request } from "../middleware"; +import { authn, authz } from "~/app/api/v1/auth"; +import { parseBody } from "~/app/api/v1/body-parser"; +import { request } from "~/app/api/v1/middleware"; -const bodySchema = schema.createDeploymentVersion.omit({ tag: true }).and( +const bodySchema = schema.createDeploymentVersion.and( z.object({ metadata: z.record(z.string()).optional(), status: z.nativeEnum(DeploymentVersionStatus).optional(), - tag: z.string().optional(), - version: z.string().optional(), }), ); @@ -49,33 +47,9 @@ export const POST = request() .handle<{ user: schema.User; body: z.infer }>( async (ctx) => { const { req, body } = ctx; - const { name, version, tag, metadata = {} } = body; - const getVersionName = () => { - if (name != null && name !== "") return name; - if (tag != null && tag !== "") return tag; - if (version != null && version !== "") return version; - return null; - }; + const { name, tag, metadata = {} } = body; - const versionName = getVersionName(); - if (versionName == null) - return NextResponse.json( - { error: "Invalid version name" }, - { status: httpStatus.BAD_REQUEST }, - ); - - const getVersionTag = () => { - if (tag != null && tag !== "") return tag; - if (version != null && version !== "") return version; - return null; - }; - - const versionTag = getVersionTag(); - if (versionTag == null) - return NextResponse.json( - { error: "Invalid version tag" }, - { status: httpStatus.BAD_REQUEST }, - ); + const versionName = name ?? tag; try { const prevVersion = await db @@ -84,14 +58,14 @@ export const POST = request() .where( and( eq(schema.deploymentVersion.deploymentId, body.deploymentId), - eq(schema.deploymentVersion.tag, versionTag), + eq(schema.deploymentVersion.tag, tag), ), ) .then(takeFirstOrNull); const depVersion = await db .insert(schema.deploymentVersion) - .values({ ...body, name: versionName, tag: versionTag }) + .values({ ...body, name: versionName, tag }) .onConflictDoUpdate({ target: [ schema.deploymentVersion.deploymentId, @@ -150,7 +124,7 @@ export const POST = request() }) .then(() => logger.info( - `Release for ${depVersion.id} job triggers created and dispatched.`, + `Jobs for deployment version ${depVersion.id} created and dispatched.`, req, ), ); @@ -166,7 +140,7 @@ export const POST = request() { status: httpStatus.BAD_REQUEST }, ); - logger.error("Error creating release:", error); + logger.error("Error creating deployment version:", error); return NextResponse.json( { error: "Internal Server Error" }, { status: httpStatus.INTERNAL_SERVER_ERROR }, diff --git a/apps/webservice/src/app/api/v1/environments/openapi.ts b/apps/webservice/src/app/api/v1/environments/openapi.ts index 895142753..5d0535ea6 100644 --- a/apps/webservice/src/app/api/v1/environments/openapi.ts +++ b/apps/webservice/src/app/api/v1/environments/openapi.ts @@ -41,7 +41,7 @@ export const openapi: Swagger.SwaggerV3 = { policyId: { type: "string", }, - releaseChannels: { + channels: { type: "array", items: { type: "string", diff --git a/apps/webservice/src/app/api/v1/environments/route.ts b/apps/webservice/src/app/api/v1/environments/route.ts index 12f57ac7b..826b2d34c 100644 --- a/apps/webservice/src/app/api/v1/environments/route.ts +++ b/apps/webservice/src/app/api/v1/environments/route.ts @@ -15,7 +15,7 @@ import { parseBody } from "../body-parser"; import { request } from "../middleware"; const body = schema.createEnvironment.extend({ - releaseChannels: z.array(z.string()), + channels: z.array(z.string()), expiresAt: z.coerce .date() .min(new Date(), "Expires at must be in the future") @@ -48,21 +48,12 @@ export const POST = request() try { return ctx.db.transaction(async (tx) => { - const { - releaseChannels: deploymentVersionChannels, - metadata, - ...rest - } = ctx.body; + const { channels, metadata, ...rest } = ctx.body; - const channels = await tx + const depVersionChannels = await tx .select() .from(schema.deploymentVersionChannel) - .where( - inArray( - schema.deploymentVersionChannel.id, - deploymentVersionChannels, - ), - ) + .where(inArray(schema.deploymentVersionChannel.id, channels)) .then((rows) => _.uniqBy(rows, (r) => r.deploymentId).map((r) => ({ channelId: r.id, @@ -73,7 +64,7 @@ export const POST = request() const environment = await createEnv(tx, { ...rest, metadata, - versionChannels: channels, + versionChannels: depVersionChannels, }); await createJobsForNewEnvironment(tx, environment); diff --git a/apps/webservice/src/app/api/v1/job-agents/[agentId]/jobs/running/route.ts b/apps/webservice/src/app/api/v1/job-agents/[agentId]/jobs/running/route.ts index 3f4e75dcb..c247e1453 100644 --- a/apps/webservice/src/app/api/v1/job-agents/[agentId]/jobs/running/route.ts +++ b/apps/webservice/src/app/api/v1/job-agents/[agentId]/jobs/running/route.ts @@ -71,15 +71,6 @@ export const GET = async ( environment: jobRows[0]!.environment, target: jobRows[0]!.resource, deployment: jobRows[0]!.deployment, - release: - jobRows[0]!.deployment_version != null - ? { - ...jobRows[0]!.deployment_version, - metadata: jobRows - .map((r) => r.deployment_version_metadata) - .filter(isPresent), - } - : null, version: jobRows[0]!.deployment_version != null ? { diff --git a/apps/webservice/src/app/api/v1/jobs/[jobId]/acknowledge/openapi.ts b/apps/webservice/src/app/api/v1/jobs/[jobId]/acknowledge/openapi.ts index ea677ab83..947bc2faf 100644 --- a/apps/webservice/src/app/api/v1/jobs/[jobId]/acknowledge/openapi.ts +++ b/apps/webservice/src/app/api/v1/jobs/[jobId]/acknowledge/openapi.ts @@ -34,7 +34,7 @@ export const openapi: Swagger.SwaggerV3 = { type: "boolean", }, }, - required: ["sucess"], + required: ["success"], }, }, }, diff --git a/apps/webservice/src/app/api/v1/jobs/[jobId]/openapi.ts b/apps/webservice/src/app/api/v1/jobs/[jobId]/openapi.ts index dc2f99912..94b1d13e5 100644 --- a/apps/webservice/src/app/api/v1/jobs/[jobId]/openapi.ts +++ b/apps/webservice/src/app/api/v1/jobs/[jobId]/openapi.ts @@ -14,7 +14,9 @@ export const openapi: Swagger.SwaggerV3 = { { type: "object", properties: { - release: { $ref: "#/components/schemas/Release" }, + deploymentVersion: { + $ref: "#/components/schemas/DeploymentVersion", + }, deployment: { $ref: "#/components/schemas/Deployment" }, runbook: { $ref: "#/components/schemas/Runbook" }, resource: { $ref: "#/components/schemas/Resource" }, diff --git a/apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts b/apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts index 02f82c2fb..358a5b541 100644 --- a/apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts +++ b/apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts @@ -58,7 +58,7 @@ export const GET = request() }), ) .handle(async ({ db }, { params }) => { - const rows = await db + const row = await db .select() .from(schema.job) .leftJoin( @@ -91,9 +91,8 @@ export const GET = request() ) .where( and(eq(schema.job.id, params.jobId), isNull(schema.resource.deletedAt)), - ); - - const row = rows.at(0); + ) + .then(takeFirstOrNull); if (row == null) return NextResponse.json( @@ -101,9 +100,25 @@ export const GET = request() { status: 404 }, ); - const version = + const deploymentVersionMetadata = + row.deployment_version != null + ? await db + .select() + .from(schema.deploymentVersionMetadata) + .where( + eq( + schema.deploymentVersionMetadata.versionId, + row.deployment_version.id, + ), + ) + .then((rows) => + Object.fromEntries(rows.map((m) => [m.key, m.value])), + ) + : {}; + + const deploymentVersion = row.deployment_version != null - ? { ...row.deployment_version, metadata: {} } + ? { ...row.deployment_version, metadata: deploymentVersionMetadata } : null; const je = { @@ -112,14 +127,14 @@ export const GET = request() environment: row.environment, resource: row.resource, deployment: row.deployment, - version, + deploymentVersion, }; const policyId = je.environment?.policyId; const approval = - je.version?.id && policyId - ? await getApprovalDetails(je.version.id, policyId) + je.deploymentVersion?.id && policyId + ? await getApprovalDetails(je.deploymentVersion.id, policyId) : undefined; const jobVariableRows = await db @@ -138,10 +153,6 @@ export const GET = request() const jobWithVariables = { ...je, variables, - release: - je.version != null - ? { ...je.version, version: je.version.tag } - : { version: undefined }, }; if (je.resource == null) return NextResponse.json(jobWithVariables); diff --git a/apps/webservice/src/app/api/v1/openapi.ts b/apps/webservice/src/app/api/v1/openapi.ts index 23aa91e39..abaf4ae9c 100644 --- a/apps/webservice/src/app/api/v1/openapi.ts +++ b/apps/webservice/src/app/api/v1/openapi.ts @@ -97,12 +97,12 @@ export const openapi: Swagger.SwaggerV3 = { required: ["id"], additionalProperties: true, }, - Release: { + DeploymentVersion: { type: "object", properties: { id: { type: "string", format: "uuid" }, name: { type: "string" }, - version: { type: "string" }, + tag: { type: "string" }, config: { type: "object", additionalProperties: true }, jobAgentConfig: { type: "object", additionalProperties: true }, deploymentId: { type: "string", format: "uuid" }, @@ -112,7 +112,7 @@ export const openapi: Swagger.SwaggerV3 = { required: [ "id", "name", - "version", + "tag", "config", "deploymentId", "createdAt", @@ -143,18 +143,18 @@ export const openapi: Swagger.SwaggerV3 = { type: "string", enum: ["some", "all", "optional"], description: - "If a policy depends on an environment, whether or not the policy requires all, some, or optional successful releases in the environment", + "If a policy depends on an environment, whether or not the policy requires all, some, or no successful jobs in the environment", }, successMinimum: { type: "number", description: - "If a policy depends on an environment, the minimum number of successful releases in the environment", + "If a policy depends on an environment, the minimum number of successful deployments to resources in the environment", }, concurrencyLimit: { type: "number", nullable: true, description: - "The maximum number of concurrent releases in the environment", + "The maximum number of concurrent deployment pipeline runs in environments using this policy", }, rolloutDuration: { type: "number", @@ -163,13 +163,13 @@ export const openapi: Swagger.SwaggerV3 = { minimumReleaseInterval: { type: "number", description: - "The minimum interval between releases in milliseconds", + "The minimum interval between version deployments in milliseconds", }, releaseSequencing: { type: "string", enum: ["wait", "cancel"], description: - "If a new release is created, whether it will wait for the current release to finish before starting, or cancel the current release", + "If a new deployment version is created, whether it will wait for the current deployment to finish before starting, or cancel the current deployment", }, }, required: [ diff --git a/apps/webservice/src/app/api/v1/release-channels/route.ts b/apps/webservice/src/app/api/v1/release-channels/route.ts deleted file mode 100644 index 64f1cc938..000000000 --- a/apps/webservice/src/app/api/v1/release-channels/route.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type { z } from "zod"; -import { NextResponse } from "next/server"; - -import { buildConflictUpdateColumns, takeFirst } from "@ctrlplane/db"; -import { createDeploymentVersionChannel } from "@ctrlplane/db/schema"; -import * as SCHEMA from "@ctrlplane/db/schema"; -import { Permission } from "@ctrlplane/validators/auth"; -import { deploymentVersionCondition } from "@ctrlplane/validators/releases"; - -import { authn, authz } from "../auth"; -import { parseBody } from "../body-parser"; -import { request } from "../middleware"; - -const schema = createDeploymentVersionChannel.extend({ - releaseFilter: deploymentVersionCondition.optional(), -}); - -export const POST = request() - .use(authn) - .use(parseBody(schema)) - .use( - authz(({ ctx, can }) => - can - .perform(Permission.DeploymentVersionChannelCreate) - .on({ type: "deployment", id: ctx.body.deploymentId }), - ), - ) - .handle<{ body: z.infer }>(({ db, body }) => { - const versionSelector = body.versionSelector ?? body.releaseFilter; - - return db - .insert(SCHEMA.deploymentVersionChannel) - .values({ ...body, versionSelector }) - .onConflictDoUpdate({ - target: [ - SCHEMA.deploymentVersionChannel.deploymentId, - SCHEMA.deploymentVersionChannel.name, - ], - set: buildConflictUpdateColumns(SCHEMA.deploymentVersionChannel, [ - "versionSelector", - ]), - }) - .returning() - .then(takeFirst) - .then((deploymentVersionChannel) => - NextResponse.json(deploymentVersionChannel), - ) - .catch((error) => NextResponse.json({ error }, { status: 500 })); - }); diff --git a/github/get-job-inputs/index.js b/github/get-job-inputs/index.js index 79c8d038b..76eaf40e5 100644 --- a/github/get-job-inputs/index.js +++ b/github/get-job-inputs/index.js @@ -28168,7 +28168,7 @@ async function run() { core.error(`Invalid Job data`); return; } - const { variables, resource, release, environment, runbook, deployment, approval, } = data; + const { variables, resource, environment, runbook, deployment, deploymentVersion, approval, } = data; setOutputAndLog("base_url", baseUrl); setOutputAndLog("resource", resource); setOutputAndLog("resource_id", resource?.id); @@ -28181,10 +28181,10 @@ async function run() { setOutputAndLog("workspace_id", resource?.workspaceId); setOutputAndLog("environment_id", environment?.id); setOutputAndLog("environment_name", environment?.name); - setOutputAndLog("release_id", release?.id); - setOutputAndLog("release_version", release?.version); - setOutputsRecursively("release_config", release?.config); - setOutputsRecursively("release_metadata", release?.metadata); + setOutputAndLog("deployment_version_id", deploymentVersion?.id); + setOutputAndLog("deployment_version_tag", deploymentVersion?.tag); + setOutputsRecursively("deployment_version_config", deploymentVersion?.config); + setOutputsRecursively("deployment_version_metadata", deploymentVersion?.metadata); if (approval?.approver != null) { setOutputAndLog("approval_approver_id", approval.approver.id); setOutputAndLog("approval_approver_name", approval.approver.name); diff --git a/integrations/github-get-job-inputs/src/index.ts b/integrations/github-get-job-inputs/src/index.ts index f73ce6839..2390f7cff 100644 --- a/integrations/github-get-job-inputs/src/index.ts +++ b/integrations/github-get-job-inputs/src/index.ts @@ -52,10 +52,10 @@ async function run() { const { variables, resource, - release, environment, runbook, deployment, + deploymentVersion, approval, } = data; @@ -75,10 +75,16 @@ async function run() { setOutputAndLog("environment_id", environment?.id); setOutputAndLog("environment_name", environment?.name); - setOutputAndLog("release_id", release?.id); - setOutputAndLog("release_version", release?.version); - setOutputsRecursively("release_config", release?.config); - setOutputsRecursively("release_metadata", release?.metadata); + setOutputAndLog("deployment_version_id", deploymentVersion?.id); + setOutputAndLog("deployment_version_tag", deploymentVersion?.tag); + setOutputsRecursively( + "deployment_version_config", + deploymentVersion?.config, + ); + setOutputsRecursively( + "deployment_version_metadata", + deploymentVersion?.metadata, + ); if (approval?.approver != null) { setOutputAndLog("approval_approver_id", approval.approver.id); diff --git a/openapi.v1.json b/openapi.v1.json index fe6e0a788..fbcacc21b 100644 --- a/openapi.v1.json +++ b/openapi.v1.json @@ -1,11 +1,169 @@ { "openapi": "3.0.3", "info": { - "title": "Cloud Regions Geo API", - "description": "API to get geographic data for cloud provider regions", + "title": "Ctrlplane API", "version": "1.0.0" }, "paths": { + "/v1/channels": { + "post": { + "summary": "Create a channel", + "operationId": "createChannel", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "deploymentId", + "name", + "versionSelector" + ], + "properties": { + "deploymentId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + }, + "versionSelector": { + "type": "object", + "additionalProperties": true + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Channel created successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deploymentId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "versionSelector": { + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "id", + "deploymentId", + "name", + "createdAt" + ] + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + } + }, + "required": [ + "error" + ] + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + } + }, + "required": [ + "error" + ] + } + } + } + }, + "409": { + "description": "Channel already exists", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "id": { + "type": "string" + } + }, + "required": [ + "error", + "id" + ] + } + } + } + }, + "500": { + "description": "Failed to create channel", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + } + }, + "required": [ + "error" + ] + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, "/api/v1/cloud-locations/{provider}": { "get": { "summary": "Get all regions for a specific cloud provider", @@ -60,6 +218,104 @@ } } }, + "/v1/deployments/{deploymentId}/channels/name/{name}": { + "delete": { + "summary": "Delete a channel", + "operationId": "deleteChannel", + "parameters": [ + { + "name": "deploymentId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "name", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Channel deleted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + }, + "403": { + "description": "Permission denied", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + } + }, + "required": [ + "error" + ] + } + } + } + }, + "404": { + "description": "Channel not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + } + }, + "required": [ + "error" + ] + } + } + } + }, + "500": { + "description": "Failed to delete channel", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + } + }, + "required": [ + "error" + ] + } + } + } + } + } + } + }, "/v1/deployments/{deploymentId}": { "get": { "summary": "Get a deployment", @@ -243,104 +499,6 @@ } } }, - "/v1/deployments/{deploymentId}/release-channels/name/{name}": { - "delete": { - "summary": "Delete a release channel", - "operationId": "deleteReleaseChannel", - "parameters": [ - { - "name": "deploymentId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Release channel deleted", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ] - } - } - } - }, - "403": { - "description": "Permission denied", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - }, - "required": [ - "error" - ] - } - } - } - }, - "404": { - "description": "Release channel not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - }, - "required": [ - "error" - ] - } - } - } - }, - "500": { - "description": "Failed to delete release channel", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - }, - "required": [ - "error" - ] - } - } - } - } - } - } - }, "/v1/deployments": { "post": { "summary": "Create a deployment", @@ -467,6 +625,175 @@ } } }, + "/v1/deployments/versions/{versionId}": { + "patch": { + "summary": "Updates a deployment version", + "operationId": "updateDeploymentVersion", + "parameters": [ + { + "name": "versionId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the deployment version" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "tag": { + "type": "string" + }, + "deploymentId": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "name": { + "type": "string" + }, + "config": { + "type": "object", + "additionalProperties": true + }, + "jobAgentConfig": { + "type": "object", + "additionalProperties": true + }, + "status": { + "type": "string", + "enum": [ + "ready", + "building", + "failed" + ] + }, + "message": { + "type": "string" + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeploymentVersion" + } + } + } + } + } + } + }, + "/v1/deployments/versions": { + "post": { + "summary": "Upserts a deployment version", + "operationId": "upsertDeploymentVersion", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "tag": { + "type": "string" + }, + "deploymentId": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "name": { + "type": "string" + }, + "config": { + "type": "object", + "additionalProperties": true + }, + "jobAgentConfig": { + "type": "object", + "additionalProperties": true + }, + "status": { + "type": "string", + "enum": [ + "ready", + "building", + "failed" + ] + }, + "message": { + "type": "string" + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "tag", + "deploymentId" + ] + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeploymentVersion" + } + } + } + }, + "409": { + "description": "Deployment version already exists", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "id": { + "type": "string" + } + } + } + } + } + } + } + } + }, "/v1/environments/{environmentId}": { "get": { "summary": "Get an environment", @@ -572,7 +899,7 @@ "policyId": { "type": "string" }, - "releaseChannels": { + "channels": { "type": "array", "items": { "type": "string" @@ -866,7 +1193,7 @@ } }, "required": [ - "sucess" + "success" ] } } @@ -1029,394 +1356,101 @@ } } } - }, - "responses": { - "200": { - "description": "Relationship created successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Relationship created successfully" - } - } - } - } - } - }, - "400": { - "description": "Invalid request body", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Invalid jobId format" - } - } - } - } - } - }, - "404": { - "description": "Job or resource not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Job with specified ID not found" - } - } - } - } - } - }, - "409": { - "description": "Relationship already exists", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Relationship between job and resource already exists" - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Internal server error occurred" - } - } - } - } - } - } - } - } - }, - "/v1/relationship/resource-to-resource": { - "post": { - "summary": "Create a relationship between two resources", - "operationId": "createResourceToResourceRelationship", - "tags": [ - "Resource Relationships" - ], - "security": [ - { - "bearerAuth": [] - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "workspaceId": { - "type": "string", - "format": "uuid", - "description": "The workspace ID", - "example": "123e4567-e89b-12d3-a456-426614174000" - }, - "fromIdentifier": { - "type": "string", - "description": "The identifier of the resource to connect", - "example": "my-resource" - }, - "toIdentifier": { - "type": "string", - "description": "The identifier of the resource to connect to", - "example": "my-resource" - }, - "type": { - "type": "string", - "description": "The type of relationship", - "example": "depends_on" - } - }, - "required": [ - "workspaceId", - "fromIdentifier", - "toIdentifier", - "type" - ] - } - } - } - }, - "responses": { - "200": { - "description": "Relationship created", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Relationship created successfully" - } - } - } - } - } - }, - "400": { - "description": "Invalid request body", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - } - } - }, - "404": { - "description": "Resource not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - } - } - }, - "409": { - "description": "Relationship already exists", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - } - } - } - } - } - }, - "/v1/release-channels": { - "post": { - "summary": "Create a release channel", - "operationId": "createReleaseChannel", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "deploymentId", - "name", - "releaseFilter" - ], - "properties": { - "deploymentId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string", - "nullable": true - }, - "releaseFilter": { - "type": "object", - "additionalProperties": true - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Release channel created successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "deploymentId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string", - "nullable": true - }, - "createdAt": { + }, + "responses": { + "200": { + "description": "Relationship created successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { "type": "string", - "format": "date-time" - }, - "releaseFilter": { - "type": "object", - "additionalProperties": true + "example": "Relationship created successfully" } - }, - "required": [ - "id", - "deploymentId", - "name", - "createdAt" - ] + } } } } }, - "401": { - "description": "Unauthorized", + "400": { + "description": "Invalid request body", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { - "type": "string" + "type": "string", + "example": "Invalid jobId format" } - }, - "required": [ - "error" - ] + } } } } }, - "403": { - "description": "Forbidden", + "404": { + "description": "Job or resource not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { - "type": "string" + "type": "string", + "example": "Job with specified ID not found" } - }, - "required": [ - "error" - ] + } } } } }, "409": { - "description": "Release channel already exists", + "description": "Relationship already exists", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { - "type": "string" - }, - "id": { - "type": "string" + "type": "string", + "example": "Relationship between job and resource already exists" } - }, - "required": [ - "error", - "id" - ] + } } } } }, "500": { - "description": "Failed to create release channel", + "description": "Internal server error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { - "type": "string" + "type": "string", + "example": "Internal server error occurred" } - }, - "required": [ - "error" - ] + } } } } } - }, - "security": [ - { - "bearerAuth": [] - } - ] + } } }, - "/v1/releases/{releaseId}": { - "patch": { - "summary": "Updates a release", - "operationId": "updateRelease", - "parameters": [ + "/v1/relationship/resource-to-resource": { + "post": { + "summary": "Create a relationship between two resources", + "operationId": "createResourceToResourceRelationship", + "tags": [ + "Resource Relationships" + ], + "security": [ { - "name": "releaseId", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "The release ID" + "bearerAuth": [] } ], "requestBody": { @@ -1426,134 +1460,87 @@ "schema": { "type": "object", "properties": { - "version": { - "type": "string" - }, - "deploymentId": { - "type": "string" - }, - "createdAt": { + "workspaceId": { "type": "string", - "format": "date-time" - }, - "name": { - "type": "string" - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "jobAgentConfig": { - "type": "object", - "additionalProperties": true + "format": "uuid", + "description": "The workspace ID", + "example": "123e4567-e89b-12d3-a456-426614174000" }, - "status": { + "fromIdentifier": { "type": "string", - "enum": [ - "ready", - "building", - "failed" - ] + "description": "The identifier of the resource to connect", + "example": "my-resource" }, - "message": { - "type": "string" + "toIdentifier": { + "type": "string", + "description": "The identifier of the resource to connect to", + "example": "my-resource" }, - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } + "type": { + "type": "string", + "description": "The type of relationship", + "example": "depends_on" } - } + }, + "required": [ + "workspaceId", + "fromIdentifier", + "toIdentifier", + "type" + ] } } } }, "responses": { "200": { - "description": "OK", + "description": "Relationship created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Release" + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "Relationship created successfully" + } + } } } } - } - } - } - }, - "/v1/releases": { - "post": { - "summary": "Upserts a release", - "operationId": "upsertRelease", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "version": { - "type": "string" - }, - "deploymentId": { - "type": "string" - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "name": { - "type": "string" - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "jobAgentConfig": { - "type": "object", - "additionalProperties": true - }, - "status": { - "type": "string", - "enum": [ - "ready", - "building", - "failed" - ] - }, - "message": { - "type": "string" - }, - "metadata": { - "type": "object", - "additionalProperties": { + }, + "400": { + "description": "Invalid request body", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { "type": "string" } } - }, - "required": [ - "version", - "deploymentId" - ] + } } } - } - }, - "responses": { - "200": { - "description": "OK", + }, + "404": { + "description": "Resource not found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Release" + "type": "object", + "properties": { + "error": { + "type": "string" + } + } } } } }, "409": { - "description": "Release already exists", + "description": "Relationship already exists", "content": { "application/json": { "schema": { @@ -1561,8 +1548,20 @@ "properties": { "error": { "type": "string" - }, - "id": { + } + } + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { "type": "string" } } @@ -2998,6 +2997,12 @@ } }, "components": { + "securitySchemes": { + "bearerAuth": { + "type": "http", + "scheme": "bearer" + } + }, "schemas": { "CloudRegionGeoData": { "type": "object", @@ -3034,8 +3039,8 @@ { "type": "object", "properties": { - "release": { - "$ref": "#/components/schemas/Release" + "deploymentVersion": { + "$ref": "#/components/schemas/DeploymentVersion" }, "deployment": { "$ref": "#/components/schemas/Deployment" @@ -3228,7 +3233,7 @@ ], "additionalProperties": true }, - "Release": { + "DeploymentVersion": { "type": "object", "properties": { "id": { @@ -3238,7 +3243,7 @@ "name": { "type": "string" }, - "version": { + "tag": { "type": "string" }, "config": { @@ -3265,7 +3270,7 @@ "required": [ "id", "name", - "version", + "tag", "config", "deploymentId", "createdAt", @@ -3309,16 +3314,16 @@ "all", "optional" ], - "description": "If a policy depends on an environment, whether or not the policy requires all, some, or optional successful releases in the environment" + "description": "If a policy depends on an environment, whether or not the policy requires all, some, or no successful jobs in the environment" }, "successMinimum": { "type": "number", - "description": "If a policy depends on an environment, the minimum number of successful releases in the environment" + "description": "If a policy depends on an environment, the minimum number of successful deployments to resources in the environment" }, "concurrencyLimit": { "type": "number", "nullable": true, - "description": "The maximum number of concurrent releases in the environment" + "description": "The maximum number of concurrent deployment pipeline runs in environments using this policy" }, "rolloutDuration": { "type": "number", @@ -3326,7 +3331,7 @@ }, "minimumReleaseInterval": { "type": "number", - "description": "The minimum interval between releases in milliseconds" + "description": "The minimum interval between version deployments in milliseconds" }, "releaseSequencing": { "type": "string", @@ -3334,7 +3339,7 @@ "wait", "cancel" ], - "description": "If a new release is created, whether it will wait for the current release to finish before starting, or cancel the current release" + "description": "If a new deployment version is created, whether it will wait for the current deployment to finish before starting, or cancel the current deployment" } }, "required": [ @@ -3584,13 +3589,6 @@ } } } - }, - "securitySchemes": { - "apiKey": { - "type": "apiKey", - "in": "header", - "name": "x-api-key" - } } } } \ No newline at end of file diff --git a/packages/node-sdk/src/schema.ts b/packages/node-sdk/src/schema.ts index a1af126f9..052a799d3 100644 --- a/packages/node-sdk/src/schema.ts +++ b/packages/node-sdk/src/schema.ts @@ -4,2824 +4,2814 @@ */ export interface paths { - "/api/v1/cloud-locations/{provider}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get all regions for a specific cloud provider - * @description Returns geographic data for all regions of a specific cloud provider - */ - get: operations["getCloudProviderRegions"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/deployments/{deploymentId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get a deployment */ - get: operations["getDeployment"]; - put?: never; - post?: never; - /** Delete a deployment */ - delete: operations["deleteDeployment"]; - options?: never; - head?: never; - /** Update a deployment */ - patch: operations["updateDeployment"]; - trace?: never; - }; - "/v1/deployments/{deploymentId}/release-channels/name/{name}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - post?: never; - /** Delete a release channel */ - delete: operations["deleteReleaseChannel"]; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/deployments": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Create a deployment */ - post: operations["createDeployment"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/environments/{environmentId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get an environment */ - get: operations["getEnvironment"]; - put?: never; - post?: never; - /** Delete an environment */ - delete: operations["deleteEnvironment"]; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/environments": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Create an environment */ - post: operations["createEnvironment"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/job-agents/{agentId}/jobs/running": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get a agents running jobs */ - get: operations["getAgentRunningJobs"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/job-agents/{agentId}/queue/acknowledge": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Acknowledge a job for an agent - * @description Marks a job as acknowledged by the agent - */ - post: operations["acknowledgeAgentJob"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/job-agents/{agentId}/queue/next": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get the next jobs */ - get: operations["getNextJobs"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/job-agents/name": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - /** Upserts the agent */ - patch: operations["upsertJobAgent"]; - trace?: never; - }; - "/v1/jobs/{jobId}/acknowledge": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Acknowledge a job */ - post: operations["acknowledgeJob"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/jobs/{jobId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get a Job */ - get: operations["getJob"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - /** Update a job */ - patch: operations["updateJob"]; - trace?: never; - }; - "/v1/relationship/job-to-resource": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Create a relationship between a job and a resource */ - post: operations["createJobToResourceRelationship"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/relationship/resource-to-resource": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Create a relationship between two resources */ - post: operations["createResourceToResourceRelationship"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/release-channels": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Create a release channel */ - post: operations["createReleaseChannel"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/releases/{releaseId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - /** Updates a release */ - patch: operations["updateRelease"]; - trace?: never; - }; - "/v1/releases": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Upserts a release */ - post: operations["upsertRelease"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/resource-providers/{providerId}/set": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - /** Sets the resource for a provider. */ - patch: operations["setResourceProvidersResources"]; - trace?: never; - }; - "/v1/resources/{resourceId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get a resource */ - get: operations["getResource"]; - put?: never; - post?: never; - /** Delete a resource */ - delete: operations["deleteResource"]; - options?: never; - head?: never; - /** Update a resource */ - patch: operations["updateResource"]; - trace?: never; - }; - "/v1/resources": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Create or update multiple resources */ - post: operations["upsertResources"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/systems/{systemId}/environments/{name}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - post?: never; - /** Delete an environment */ - delete: operations["deleteEnvironmentByName"]; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/systems/{systemId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get a system */ - get: operations["getSystem"]; - put?: never; - post?: never; - /** Delete a system */ - delete: operations["deleteSystem"]; - options?: never; - head?: never; - /** Update a system */ - patch: operations["updateSystem"]; - trace?: never; - }; - "/v1/systems": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Create a system */ - post: operations["createSystem"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/workspaces/{workspaceId}/deployments": { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the workspace */ - workspaceId: string; - }; - cookie?: never; - }; - /** List all deployments */ - get: operations["listDeployments"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/workspaces/{workspaceId}/environments": { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the workspace */ - workspaceId: string; - }; - cookie?: never; - }; - /** List all environments */ - get: operations["listEnvironments"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/workspaces/{workspaceId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get a workspace */ - get: operations["getWorkspace"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/workspaces/{workspaceId}/resource-providers/name/{name}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Upserts a resource provider. */ - get: operations["upsertResourceProvider"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/workspaces/{workspaceId}/resources/{filter}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get resources by filter */ - get: operations["getResourcesByFilter"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/workspaces/{workspaceId}/resources/identifier/{identifier}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get a resource by identifier */ - get: operations["getResourceByIdentifier"]; - put?: never; - post?: never; - /** Delete a resource by identifier */ - delete: operations["deleteResourceByIdentifier"]; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/workspaces/{workspaceId}/resources": { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the workspace */ - workspaceId: string; - }; - cookie?: never; - }; - /** List all resources */ - get: operations["listResources"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/workspaces/{workspaceId}/systems": { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the workspace */ - workspaceId: string; - }; - cookie?: never; - }; - /** List all systems */ - get: operations["listSystems"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/workspaces/slug/{workspaceSlug}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Get a workspace by slug */ - get: operations["getWorkspaceBySlug"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; + "/v1/channels": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Create a channel */ + post: operations["createChannel"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/api/v1/cloud-locations/{provider}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get all regions for a specific cloud provider + * @description Returns geographic data for all regions of a specific cloud provider + */ + get: operations["getCloudProviderRegions"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/deployments/{deploymentId}/channels/name/{name}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** Delete a channel */ + delete: operations["deleteChannel"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/deployments/{deploymentId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a deployment */ + get: operations["getDeployment"]; + put?: never; + post?: never; + /** Delete a deployment */ + delete: operations["deleteDeployment"]; + options?: never; + head?: never; + /** Update a deployment */ + patch: operations["updateDeployment"]; + trace?: never; + }; + "/v1/deployments": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Create a deployment */ + post: operations["createDeployment"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/deployments/versions/{versionId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + /** Updates a deployment version */ + patch: operations["updateDeploymentVersion"]; + trace?: never; + }; + "/v1/deployments/versions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Upserts a deployment version */ + post: operations["upsertDeploymentVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/environments/{environmentId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get an environment */ + get: operations["getEnvironment"]; + put?: never; + post?: never; + /** Delete an environment */ + delete: operations["deleteEnvironment"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/environments": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Create an environment */ + post: operations["createEnvironment"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/job-agents/{agentId}/jobs/running": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a agents running jobs */ + get: operations["getAgentRunningJobs"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/job-agents/{agentId}/queue/acknowledge": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Acknowledge a job for an agent + * @description Marks a job as acknowledged by the agent + */ + post: operations["acknowledgeAgentJob"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/job-agents/{agentId}/queue/next": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get the next jobs */ + get: operations["getNextJobs"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/job-agents/name": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + /** Upserts the agent */ + patch: operations["upsertJobAgent"]; + trace?: never; + }; + "/v1/jobs/{jobId}/acknowledge": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Acknowledge a job */ + post: operations["acknowledgeJob"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/jobs/{jobId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a Job */ + get: operations["getJob"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + /** Update a job */ + patch: operations["updateJob"]; + trace?: never; + }; + "/v1/relationship/job-to-resource": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Create a relationship between a job and a resource */ + post: operations["createJobToResourceRelationship"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/relationship/resource-to-resource": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Create a relationship between two resources */ + post: operations["createResourceToResourceRelationship"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/resource-providers/{providerId}/set": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + /** Sets the resource for a provider. */ + patch: operations["setResourceProvidersResources"]; + trace?: never; + }; + "/v1/resources/{resourceId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a resource */ + get: operations["getResource"]; + put?: never; + post?: never; + /** Delete a resource */ + delete: operations["deleteResource"]; + options?: never; + head?: never; + /** Update a resource */ + patch: operations["updateResource"]; + trace?: never; + }; + "/v1/resources": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Create or update multiple resources */ + post: operations["upsertResources"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/systems/{systemId}/environments/{name}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** Delete an environment */ + delete: operations["deleteEnvironmentByName"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/systems/{systemId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a system */ + get: operations["getSystem"]; + put?: never; + post?: never; + /** Delete a system */ + delete: operations["deleteSystem"]; + options?: never; + head?: never; + /** Update a system */ + patch: operations["updateSystem"]; + trace?: never; + }; + "/v1/systems": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Create a system */ + post: operations["createSystem"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}/deployments": { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + /** List all deployments */ + get: operations["listDeployments"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}/environments": { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + /** List all environments */ + get: operations["listEnvironments"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a workspace */ + get: operations["getWorkspace"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}/resource-providers/name/{name}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Upserts a resource provider. */ + get: operations["upsertResourceProvider"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}/resources/{filter}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get resources by filter */ + get: operations["getResourcesByFilter"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}/resources/identifier/{identifier}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a resource by identifier */ + get: operations["getResourceByIdentifier"]; + put?: never; + post?: never; + /** Delete a resource by identifier */ + delete: operations["deleteResourceByIdentifier"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}/resources": { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + /** List all resources */ + get: operations["listResources"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}/systems": { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + /** List all systems */ + get: operations["listSystems"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/slug/{workspaceSlug}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a workspace by slug */ + get: operations["getWorkspaceBySlug"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; } export type webhooks = Record; export interface components { - schemas: { - CloudRegionGeoData: { - /** - * @description Timezone of the region in UTC format - * @example UTC+1 - */ - timezone: string; - /** - * Format: float - * @description Latitude coordinate for the region - * @example 50.1109 - */ - latitude: number; - /** - * Format: float - * @description Longitude coordinate for the region - * @example 8.6821 - */ - longitude: number; - }; - JobWithTrigger: components["schemas"]["Job"] & { - release?: components["schemas"]["Release"]; - deployment?: components["schemas"]["Deployment"]; - runbook?: components["schemas"]["Runbook"]; - resource?: components["schemas"]["Resource"]; - environment?: components["schemas"]["Environment"]; - variables: Record; - approval?: { - id: string; - /** @enum {string} */ - status: "pending" | "approved" | "rejected"; - /** @description Null when status is pending, contains approver details when approved or rejected */ - approver?: { - id: string; - name: string; - } | null; - } | null; - }; - Workspace: { - /** - * Format: uuid - * @description The workspace ID - */ - id: string; - /** @description The name of the workspace */ - name: string; - /** @description The slug of the workspace */ - slug: string; - /** - * @description The email of the Google service account attached to the workspace - * @example ctrlplane@ctrlplane-workspace.iam.gserviceaccount.com - */ - googleServiceAccountEmail?: string | null; - /** - * @description The ARN of the AWS role attached to the workspace - * @example arn:aws:iam::123456789012:role/ctrlplane-workspace-role - */ - awsRoleArn?: string | null; - }; - System: { - /** - * Format: uuid - * @description The system ID - */ - id: string; - /** - * Format: uuid - * @description The workspace ID of the system - */ - workspaceId: string; - /** @description The name of the system */ - name: string; - /** @description The slug of the system */ - slug: string; - /** @description The description of the system */ - description?: string; - }; - Deployment: { - /** Format: uuid */ - id: string; - name: string; - slug: string; - description: string; - /** Format: uuid */ - systemId: string; - /** Format: uuid */ - jobAgentId?: string | null; - jobAgentConfig: { - [key: string]: unknown; - }; - retryCount?: number; - timeout?: number | null; - }; - /** @description Schema for updating a deployment (all fields optional) */ - UpdateDeployment: { - [key: string]: unknown; - } & (WithRequired & { - [key: string]: unknown; - }); - Release: { - /** Format: uuid */ - id: string; - name: string; - version: string; - config: { - [key: string]: unknown; - }; - jobAgentConfig: { - [key: string]: unknown; - }; - /** Format: uuid */ - deploymentId: string; - /** Format: date-time */ - createdAt: string; - metadata?: { - [key: string]: unknown; - }; - }; - Policy: { - /** - * Format: uuid - * @description The policy ID - */ - id: string; - /** - * Format: uuid - * @description The system ID - */ - systemId: string; - /** @description The name of the policy */ - name: string; - /** @description The description of the policy */ - description?: string | null; - /** - * @description The approval requirement of the policy - * @enum {string} - */ - approvalRequirement: "manual" | "automatic"; - /** - * @description If a policy depends on an environment, whether or not the policy requires all, some, or optional successful releases in the environment - * @enum {string} - */ - successType: "some" | "all" | "optional"; - /** @description If a policy depends on an environment, the minimum number of successful releases in the environment */ - successMinimum: number; - /** @description The maximum number of concurrent releases in the environment */ - concurrencyLimit?: number | null; - /** @description The duration of the rollout in milliseconds */ - rolloutDuration: number; - /** @description The minimum interval between releases in milliseconds */ - minimumReleaseInterval: number; - /** - * @description If a new release is created, whether it will wait for the current release to finish before starting, or cancel the current release - * @enum {string} - */ - releaseSequencing: "wait" | "cancel"; - }; - Environment: { - /** Format: uuid */ - id: string; - /** Format: uuid */ - systemId: string; - name: string; - description?: string; - /** Format: uuid */ - policyId?: string | null; - resourceFilter?: { - [key: string]: unknown; - } | null; - /** - * @description The directory path of the environment - * @default - * @example my/env/path - */ - directory: string; - /** Format: date-time */ - createdAt: string; - metadata?: { - [key: string]: string; - }; - policy?: components["schemas"]["Policy"]; - }; - Runbook: { - /** Format: uuid */ - id: string; - name: string; - /** Format: uuid */ - systemId: string; - /** Format: uuid */ - jobAgentId: string; - }; - Resource: { - /** Format: uuid */ - id: string; - name: string; - version: string; - kind: string; - identifier: string; - config: { - [key: string]: unknown; - }; - metadata: { - [key: string]: unknown; - }; - /** Format: date-time */ - createdAt: string; - /** Format: date-time */ - updatedAt: string; - /** Format: uuid */ - workspaceId: string; - }; - /** @enum {string} */ - JobStatus: - | "successful" - | "cancelled" - | "skipped" - | "in_progress" - | "action_required" - | "pending" - | "failure" - | "invalid_job_agent" - | "invalid_integration" - | "external_run_not_found"; - Job: { - /** Format: uuid */ - id: string; - status: components["schemas"]["JobStatus"]; - /** @description External job identifier (e.g. GitHub workflow run ID) */ - externalId?: string | null; - /** Format: date-time */ - createdAt: string; - /** Format: date-time */ - updatedAt: string; - /** Format: date-time */ - startedAt?: string | null; - /** Format: date-time */ - completedAt?: string | null; - /** Format: uuid */ - jobAgentId?: string; - /** @description Configuration for the Job Agent */ - jobAgentConfig: { - [key: string]: unknown; - }; - message?: string; - reason?: string; - }; - Variable: { - key: string; - value: string | number | boolean; - sensitive?: boolean; - }; - }; - responses: never; - parameters: never; - requestBodies: never; - headers: never; - pathItems: never; -} -export type $defs = Record; -export interface operations { - getCloudProviderRegions: { - parameters: { - query?: never; - header?: never; - path: { - /** @description Cloud provider (aws, gcp, azure) */ - provider: "aws" | "gcp" | "azure"; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Successfully returned geographic data for cloud provider regions */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - [key: string]: components["schemas"]["CloudRegionGeoData"]; - }; - }; - }; - /** @description Cloud provider not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Cloud provider 'unknown' not found */ - error?: string; - }; - }; - }; - }; - }; - getDeployment: { - parameters: { - query?: never; - header?: never; - path: { - deploymentId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Deployment found */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Deployment"]; - }; - }; - /** @description Deployment not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - }; - }; - deleteDeployment: { - parameters: { - query?: never; - header?: never; - path: { - deploymentId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Deployment deleted */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Deployment"]; - }; - }; - /** @description Deployment not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - /** @description Failed to delete deployment */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - }; - }; - updateDeployment: { - parameters: { - query?: never; - header?: never; - path: { - deploymentId: string; - }; - cookie?: never; - }; - requestBody: { - content: { - "application/json": components["schemas"]["UpdateDeployment"]; - }; - }; - responses: { - /** @description Deployment updated */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Deployment"]; - }; - }; - /** @description Deployment not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - /** @description Failed to update deployment */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - }; - }; - deleteReleaseChannel: { - parameters: { - query?: never; - header?: never; - path: { - deploymentId: string; - name: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Release channel deleted */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - message: string; - }; - }; - }; - /** @description Permission denied */ - 403: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - /** @description Release channel not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - /** @description Failed to delete release channel */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - }; - }; - createDeployment: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: { - content: { - "application/json": { - /** - * Format: uuid - * @description The ID of the system to create the deployment for - * @example 123e4567-e89b-12d3-a456-426614174000 - */ - systemId: string; - /** - * @description The name of the deployment - * @example My Deployment - */ - name: string; - /** - * @description The slug of the deployment - * @example my-deployment - */ - slug: string; - /** - * @description The description of the deployment - * @example This is a deployment for my system - */ - description?: string; - /** - * Format: uuid - * @description The ID of the job agent to use for the deployment - * @example 123e4567-e89b-12d3-a456-426614174000 - */ - jobAgentId?: string; - /** - * @description The configuration for the job agent - * @example { - * "key": "value" - * } - */ - jobAgentConfig?: Record; - /** - * @description The number of times to retry the deployment - * @example 3 - */ - retryCount?: number; - /** - * @description The timeout for the deployment - * @example 60 - */ - timeout?: number; - /** - * @description The resource filter for the deployment - * @example { - * "key": "value" - * } - */ - resourceFilter?: Record; - }; - }; - }; - responses: { - /** @description Deployment created */ - 201: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Deployment"]; - }; - }; - /** @description Deployment already exists */ - 409: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - /** Format: uuid */ - id: string; - }; - }; - }; - /** @description Failed to create deployment */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - }; - }; - getEnvironment: { - parameters: { - query?: never; - header?: never; - path: { - /** @description UUID of the environment */ - environmentId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Successful response */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Environment"]; - }; - }; - /** @description Environment not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Environment not found */ - error: string; - }; - }; - }; - }; - }; - deleteEnvironment: { - parameters: { - query?: never; - header?: never; - path: { - /** @description UUID of the environment */ - environmentId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Environment deleted successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; - createEnvironment: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - /** - * @description The directory path of the environment - * @default - * @example my/env/path - */ - directory?: string; - systemId: string; - name: string; - description?: string; - resourceFilter?: { - [key: string]: unknown; - }; - policyId?: string; - releaseChannels?: string[]; - metadata?: { - [key: string]: string; - }; - }; - }; - }; - responses: { - /** @description Environment created successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Environment"]; - }; - }; - /** @description Environment already exists */ - 409: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - id?: string; - }; - }; - }; - /** @description Failed to create environment */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - }; - }; - getAgentRunningJobs: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The execution ID */ - agentId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Job"][]; - }; - }; - }; - }; - acknowledgeAgentJob: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the job agent */ - agentId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Successfully acknowledged job */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - job?: components["schemas"]["Job"]; - }; - }; - }; - /** @description Unauthorized */ - 401: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - /** @description Workspace not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - }; - }; - getNextJobs: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The agent ID */ - agentId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - jobs?: components["schemas"]["Job"][]; - }; - }; - }; - }; - }; - upsertJobAgent: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - workspaceId: string; - name: string; - type: string; - }; - }; - }; - responses: { - /** @description Successfully retrieved or created the agent */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { + schemas: { + CloudRegionGeoData: { + /** + * @description Timezone of the region in UTC format + * @example UTC+1 + */ + timezone: string; + /** + * Format: float + * @description Latitude coordinate for the region + * @example 50.1109 + */ + latitude: number; + /** + * Format: float + * @description Longitude coordinate for the region + * @example 8.6821 + */ + longitude: number; + }; + JobWithTrigger: components["schemas"]["Job"] & { + deploymentVersion?: components["schemas"]["DeploymentVersion"]; + deployment?: components["schemas"]["Deployment"]; + runbook?: components["schemas"]["Runbook"]; + resource?: components["schemas"]["Resource"]; + environment?: components["schemas"]["Environment"]; + variables: Record; + approval?: { + id: string; + /** @enum {string} */ + status: "pending" | "approved" | "rejected"; + /** @description Null when status is pending, contains approver details when approved or rejected */ + approver?: { + id: string; + name: string; + } | null; + } | null; + }; + Workspace: { + /** + * Format: uuid + * @description The workspace ID + */ id: string; + /** @description The name of the workspace */ name: string; - workspaceId: string; - }; - }; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; - acknowledgeJob: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The job ID */ - jobId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - sucess: boolean; - }; - }; - }; - /** @description Unauthorized */ - 401: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - }; - }; - getJob: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The job ID */ - jobId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["JobWithTrigger"]; - }; - }; - /** @description Not Found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Job not found. */ - error?: string; - }; - }; - }; - }; - }; - updateJob: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The execution ID */ - jobId: string; - }; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - status?: components["schemas"]["JobStatus"]; - message?: string | null; - externalId?: string | null; - }; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { + /** @description The slug of the workspace */ + slug: string; + /** + * @description The email of the Google service account attached to the workspace + * @example ctrlplane@ctrlplane-workspace.iam.gserviceaccount.com + */ + googleServiceAccountEmail?: string | null; + /** + * @description The ARN of the AWS role attached to the workspace + * @example arn:aws:iam::123456789012:role/ctrlplane-workspace-role + */ + awsRoleArn?: string | null; + }; + System: { + /** + * Format: uuid + * @description The system ID + */ id: string; - }; - }; - }; - }; - }; - createJobToResourceRelationship: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - /** - * Format: uuid - * @description Unique identifier of the job - * @example 123e4567-e89b-12d3-a456-426614174000 - */ - jobId: string; - /** - * @description Unique identifier of the resource - * @example resource-123 - */ - resourceIdentifier: string; - }; - }; - }; - responses: { - /** @description Relationship created successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Relationship created successfully */ - message?: string; - }; - }; - }; - /** @description Invalid request body */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Invalid jobId format */ - error?: string; - }; - }; - }; - /** @description Job or resource not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Job with specified ID not found */ - error?: string; - }; - }; - }; - /** @description Relationship already exists */ - 409: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Relationship between job and resource already exists */ - error?: string; - }; - }; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Internal server error occurred */ - error?: string; - }; - }; - }; - }; - }; - createResourceToResourceRelationship: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - /** - * Format: uuid - * @description The workspace ID - * @example 123e4567-e89b-12d3-a456-426614174000 - */ - workspaceId: string; - /** - * @description The identifier of the resource to connect - * @example my-resource - */ - fromIdentifier: string; - /** - * @description The identifier of the resource to connect to - * @example my-resource - */ - toIdentifier: string; - /** - * @description The type of relationship - * @example depends_on - */ - type: string; - }; - }; - }; - responses: { - /** @description Relationship created */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Relationship created successfully */ - message?: string; - }; - }; - }; - /** @description Invalid request body */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - /** @description Resource not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - /** @description Relationship already exists */ - 409: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - }; - }; - createReleaseChannel: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - deploymentId: string; - name: string; - description?: string | null; - releaseFilter: { - [key: string]: unknown; - }; + /** + * Format: uuid + * @description The workspace ID of the system + */ + workspaceId: string; + /** @description The name of the system */ + name: string; + /** @description The slug of the system */ + slug: string; + /** @description The description of the system */ + description?: string; }; - }; - }; - responses: { - /** @description Release channel created successfully */ - 200: { - headers: { - [name: string]: unknown; + Deployment: { + /** Format: uuid */ + id: string; + name: string; + slug: string; + description: string; + /** Format: uuid */ + systemId: string; + /** Format: uuid */ + jobAgentId?: string | null; + jobAgentConfig: { + [key: string]: unknown; + }; + retryCount?: number; + timeout?: number | null; }; - content: { - "application/json": { + /** @description Schema for updating a deployment (all fields optional) */ + UpdateDeployment: { + [key: string]: unknown; + } & (WithRequired & { + [key: string]: unknown; + }); + DeploymentVersion: { + /** Format: uuid */ id: string; + name: string; + tag: string; + config: { + [key: string]: unknown; + }; + jobAgentConfig: { + [key: string]: unknown; + }; + /** Format: uuid */ deploymentId: string; + /** Format: date-time */ + createdAt: string; + metadata?: { + [key: string]: unknown; + }; + }; + Policy: { + /** + * Format: uuid + * @description The policy ID + */ + id: string; + /** + * Format: uuid + * @description The system ID + */ + systemId: string; + /** @description The name of the policy */ name: string; + /** @description The description of the policy */ description?: string | null; + /** + * @description The approval requirement of the policy + * @enum {string} + */ + approvalRequirement: "manual" | "automatic"; + /** + * @description If a policy depends on an environment, whether or not the policy requires all, some, or no successful jobs in the environment + * @enum {string} + */ + successType: "some" | "all" | "optional"; + /** @description If a policy depends on an environment, the minimum number of successful deployments to resources in the environment */ + successMinimum: number; + /** @description The maximum number of concurrent deployment pipeline runs in environments using this policy */ + concurrencyLimit?: number | null; + /** @description The duration of the rollout in milliseconds */ + rolloutDuration: number; + /** @description The minimum interval between version deployments in milliseconds */ + minimumReleaseInterval: number; + /** + * @description If a new deployment version is created, whether it will wait for the current deployment to finish before starting, or cancel the current deployment + * @enum {string} + */ + releaseSequencing: "wait" | "cancel"; + }; + Environment: { + /** Format: uuid */ + id: string; + /** Format: uuid */ + systemId: string; + name: string; + description?: string; + /** Format: uuid */ + policyId?: string | null; + resourceFilter?: { + [key: string]: unknown; + } | null; + /** + * @description The directory path of the environment + * @default + * @example my/env/path + */ + directory: string; /** Format: date-time */ createdAt: string; - releaseFilter?: { - [key: string]: unknown; - }; - }; - }; - }; - /** @description Unauthorized */ - 401: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - /** @description Forbidden */ - 403: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - /** @description Release channel already exists */ - 409: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; + metadata?: { + [key: string]: string; + }; + policy?: components["schemas"]["Policy"]; + }; + Runbook: { + /** Format: uuid */ id: string; - }; - }; - }; - /** @description Failed to create release channel */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - }; - }; - updateRelease: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The release ID */ - releaseId: string; - }; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - version?: string; - deploymentId?: string; - /** Format: date-time */ - createdAt?: string; - name?: string; - config?: { - [key: string]: unknown; - }; - jobAgentConfig?: { - [key: string]: unknown; - }; - /** @enum {string} */ - status?: "ready" | "building" | "failed"; - message?: string; - metadata?: { - [key: string]: string; - }; - }; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Release"]; - }; - }; - }; - }; - upsertRelease: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - version: string; - deploymentId: string; - /** Format: date-time */ - createdAt?: string; - name?: string; - config?: { - [key: string]: unknown; - }; - jobAgentConfig?: { - [key: string]: unknown; - }; - /** @enum {string} */ - status?: "ready" | "building" | "failed"; - message?: string; - metadata?: { - [key: string]: string; - }; - }; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Release"]; - }; - }; - /** @description Release already exists */ - 409: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - id?: string; - }; - }; - }; - }; - }; - setResourceProvidersResources: { - parameters: { - query?: never; - header?: never; - path: { - /** @description UUID of the scanner */ - providerId: string; - }; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - resources: { - identifier: string; name: string; - version: string; - kind: string; - config: { - [key: string]: unknown; - }; - metadata: { - [key: string]: string; - }; - }[]; - }; - }; - }; - responses: { - /** @description Successfully updated the deployment resources */ - 200: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Invalid request */ - 400: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Deployment resources not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; - getResource: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The resource ID */ - resourceId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { + /** Format: uuid */ + systemId: string; + /** Format: uuid */ + jobAgentId: string; + }; + Resource: { + /** Format: uuid */ id: string; name: string; - workspaceId: string; + version: string; kind: string; identifier: string; - version: string; config: { - [key: string]: unknown; + [key: string]: unknown; + }; + metadata: { + [key: string]: unknown; }; /** Format: date-time */ - lockedAt?: string | null; + createdAt: string; /** Format: date-time */ updatedAt: string; - provider?: { - id?: string; - name?: string; - } | null; - metadata: { - [key: string]: string; - }; - variable: { - [key: string]: string; - }; - }; - }; - }; - /** @description Unauthorized */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Permission denied */ - 403: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Resource not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Resource not found */ - error: string; - }; - }; - }; - }; - }; - deleteResource: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The resource ID */ - resourceId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Resource deleted successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - success: boolean; - }; - }; - }; - /** @description Unauthorized */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Permission denied */ - 403: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Resource not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - }; - }; - updateResource: { - parameters: { - query?: never; - header?: never; - path: { - resourceId: string; - }; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - name?: string; - version?: string; - kind?: string; - identifier?: string; - workspaceId?: string; - metadata?: { - [key: string]: string; - }; - variables?: components["schemas"]["Variable"][]; - }; - }; - }; - responses: { - /** @description Resource updated successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - id: string; - name: string; + /** Format: uuid */ workspaceId: string; - kind: string; - identifier: string; - version: string; - config: { - [key: string]: unknown; + }; + /** @enum {string} */ + JobStatus: "successful" | "cancelled" | "skipped" | "in_progress" | "action_required" | "pending" | "failure" | "invalid_job_agent" | "invalid_integration" | "external_run_not_found"; + Job: { + /** Format: uuid */ + id: string; + status: components["schemas"]["JobStatus"]; + /** @description External job identifier (e.g. GitHub workflow run ID) */ + externalId?: string | null; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + updatedAt: string; + /** Format: date-time */ + startedAt?: string | null; + /** Format: date-time */ + completedAt?: string | null; + /** Format: uuid */ + jobAgentId?: string; + /** @description Configuration for the Job Agent */ + jobAgentConfig: { + [key: string]: unknown; }; - metadata: { - [key: string]: string; - }; - }; - }; - }; - /** @description Unauthorized */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Permission denied */ - 403: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Resource not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error: string; - }; - }; - }; - }; - }; - upsertResources: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - /** Format: uuid */ - workspaceId: string; - resources: { - name: string; - kind: string; - identifier: string; - version: string; - config: Record; - metadata?: { - [key: string]: string; - }; - variables?: components["schemas"]["Variable"][]; - }[]; - }; - }; - }; - responses: { - /** @description All of the cats */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - count?: number; - }; - }; - }; - }; - }; - deleteEnvironmentByName: { - parameters: { - query?: never; - header?: never; - path: { - /** @description UUID of the system */ - systemId: string; - /** @description Name of the environment */ - name: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Environment deleted successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; - getSystem: { - parameters: { - query?: never; - header?: never; - path: { - /** @description UUID of the system */ - systemId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description System retrieved successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["System"] & { - environments?: components["schemas"]["Environment"][]; - deployments?: components["schemas"]["Deployment"][]; - }; - }; - }; - }; - }; - deleteSystem: { - parameters: { - query?: never; - header?: never; - path: { - systemId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description System deleted successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example System deleted */ message?: string; - }; - }; - }; - /** @description System not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example System not found */ - error?: string; - }; - }; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Internal server error */ - error?: string; - }; - }; - }; - }; - }; - updateSystem: { - parameters: { - query?: never; - header?: never; - path: { - /** @description UUID of the system */ - systemId: string; - }; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - /** @description Name of the system */ - name?: string; - /** @description Slug of the system */ - slug?: string; - /** @description Description of the system */ - description?: string; - /** - * Format: uuid - * @description UUID of the workspace - */ - workspaceId?: string; - }; - }; - }; - responses: { - /** @description System updated successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["System"]; - }; - }; - /** @description System not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example System not found */ - error?: string; - }; - }; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Internal server error */ - error?: string; - }; - }; - }; - }; - }; - createSystem: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: { - content: { - "application/json": { - /** - * Format: uuid - * @description The workspace ID of the system - */ - workspaceId: string; - /** @description The name of the system */ - name: string; - /** @description The slug of the system */ - slug: string; - /** @description The description of the system */ - description?: string; - }; - }; - }; - responses: { - /** @description System created successfully */ - 201: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["System"]; - }; - }; - /** @description Bad request */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: { - /** @enum {string} */ - code: "invalid_type" | "invalid_literal" | "custom"; - message: string; - path: (string | number)[]; - }[]; - }; - }; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Internal Server Error */ - error?: string; - }; - }; - }; - }; - }; - listDeployments: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the workspace */ - workspaceId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description All deployments */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - data?: components["schemas"]["Deployment"][]; - }; - }; - }; - }; - }; - listEnvironments: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the workspace */ - workspaceId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description All environments */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - data?: components["schemas"]["Environment"][]; - }; - }; - }; - }; - }; - getWorkspace: { - parameters: { - query?: never; - header?: never; - path: { - workspaceId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Workspace found */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Workspace"]; - }; - }; - /** @description Workspace not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - }; - }; - upsertResourceProvider: { - parameters: { - query?: never; - header?: never; - path: { - /** @description Name of the workspace */ - workspaceId: string; - /** @description Name of the resource provider */ - name: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Successfully retrieved or created the resource provider */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - id: string; - name: string; - workspaceId: string; - }; - }; - }; - /** @description Unauthorized */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Permission denied */ - 403: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Workspace not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; - getResourcesByFilter: { - parameters: { - query?: never; - header?: never; - path: { - /** @description ID of the workspace */ - workspaceId: string; - /** @description Filter to apply to the resources */ - filter: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Resources */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Resource"][]; - }; - }; - /** @description Invalid filter */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - }; - }; - getResourceByIdentifier: { - parameters: { - query?: never; - header?: never; - path: { - /** @description ID of the workspace */ - workspaceId: string; - /** @description Identifier of the resource */ - identifier: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Successfully retrieved the resource */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - id: string; - identifier: string; - workspaceId: string; - providerId: string; - provider?: { - id?: string; - name?: string; - workspaceId?: string; - }; - variables?: { - id?: string; - key?: string; - value?: string; - }[]; - metadata?: { - [key: string]: string; - }; - }; - }; - }; - /** @description Unauthorized */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Permission denied */ - 403: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Resource not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Resource not found */ - error?: string; - }; - }; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; - deleteResourceByIdentifier: { - parameters: { - query?: never; - header?: never; - path: { - /** @description ID of the workspace */ - workspaceId: string; - /** @description Identifier of the resource */ - identifier: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Successfully deleted the resource */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example true */ - success?: boolean; - }; - }; - }; - /** @description Unauthorized */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Permission denied */ - 403: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Resource not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example Resource not found */ - error?: string; - }; - }; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; - listResources: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the workspace */ - workspaceId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description All resources */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - data?: components["schemas"]["Resource"][]; - }; - }; - }; - }; - }; - listSystems: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the workspace */ - workspaceId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description All systems */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - data?: components["schemas"]["System"][]; - }; - }; - }; - }; - }; - getWorkspaceBySlug: { - parameters: { - query?: never; - header?: never; - path: { - workspaceSlug: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Workspace found */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Workspace"]; - }; - }; - /** @description Workspace not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - error?: string; - }; - }; - }; - }; - }; + reason?: string; + }; + Variable: { + key: string; + value: string | number | boolean; + sensitive?: boolean; + }; + }; + responses: never; + parameters: never; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + createChannel: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + deploymentId: string; + name: string; + description?: string | null; + versionSelector: { + [key: string]: unknown; + }; + }; + }; + }; + responses: { + /** @description Channel created successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + id: string; + deploymentId: string; + name: string; + description?: string | null; + /** Format: date-time */ + createdAt: string; + versionSelector?: { + [key: string]: unknown; + }; + }; + }; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + /** @description Channel already exists */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + id: string; + }; + }; + }; + /** @description Failed to create channel */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + getCloudProviderRegions: { + parameters: { + query?: never; + header?: never; + path: { + /** @description Cloud provider (aws, gcp, azure) */ + provider: "aws" | "gcp" | "azure"; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successfully returned geographic data for cloud provider regions */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + [key: string]: components["schemas"]["CloudRegionGeoData"]; + }; + }; + }; + /** @description Cloud provider not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Cloud provider 'unknown' not found */ + error?: string; + }; + }; + }; + }; + }; + deleteChannel: { + parameters: { + query?: never; + header?: never; + path: { + deploymentId: string; + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Channel deleted */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Permission denied */ + 403: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + /** @description Channel not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + /** @description Failed to delete channel */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + getDeployment: { + parameters: { + query?: never; + header?: never; + path: { + deploymentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Deployment found */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Deployment"]; + }; + }; + /** @description Deployment not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + deleteDeployment: { + parameters: { + query?: never; + header?: never; + path: { + deploymentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Deployment deleted */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Deployment"]; + }; + }; + /** @description Deployment not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + /** @description Failed to delete deployment */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + updateDeployment: { + parameters: { + query?: never; + header?: never; + path: { + deploymentId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["UpdateDeployment"]; + }; + }; + responses: { + /** @description Deployment updated */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Deployment"]; + }; + }; + /** @description Deployment not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + /** @description Failed to update deployment */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + createDeployment: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** + * Format: uuid + * @description The ID of the system to create the deployment for + * @example 123e4567-e89b-12d3-a456-426614174000 + */ + systemId: string; + /** + * @description The name of the deployment + * @example My Deployment + */ + name: string; + /** + * @description The slug of the deployment + * @example my-deployment + */ + slug: string; + /** + * @description The description of the deployment + * @example This is a deployment for my system + */ + description?: string; + /** + * Format: uuid + * @description The ID of the job agent to use for the deployment + * @example 123e4567-e89b-12d3-a456-426614174000 + */ + jobAgentId?: string; + /** + * @description The configuration for the job agent + * @example { + * "key": "value" + * } + */ + jobAgentConfig?: Record; + /** + * @description The number of times to retry the deployment + * @example 3 + */ + retryCount?: number; + /** + * @description The timeout for the deployment + * @example 60 + */ + timeout?: number; + /** + * @description The resource filter for the deployment + * @example { + * "key": "value" + * } + */ + resourceFilter?: Record; + }; + }; + }; + responses: { + /** @description Deployment created */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Deployment"]; + }; + }; + /** @description Deployment already exists */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + /** Format: uuid */ + id: string; + }; + }; + }; + /** @description Failed to create deployment */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + updateDeploymentVersion: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the deployment version */ + versionId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + tag?: string; + deploymentId?: string; + /** Format: date-time */ + createdAt?: string; + name?: string; + config?: { + [key: string]: unknown; + }; + jobAgentConfig?: { + [key: string]: unknown; + }; + /** @enum {string} */ + status?: "ready" | "building" | "failed"; + message?: string; + metadata?: { + [key: string]: string; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["DeploymentVersion"]; + }; + }; + }; + }; + upsertDeploymentVersion: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + tag: string; + deploymentId: string; + /** Format: date-time */ + createdAt?: string; + name?: string; + config?: { + [key: string]: unknown; + }; + jobAgentConfig?: { + [key: string]: unknown; + }; + /** @enum {string} */ + status?: "ready" | "building" | "failed"; + message?: string; + metadata?: { + [key: string]: string; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["DeploymentVersion"]; + }; + }; + /** @description Deployment version already exists */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + id?: string; + }; + }; + }; + }; + }; + getEnvironment: { + parameters: { + query?: never; + header?: never; + path: { + /** @description UUID of the environment */ + environmentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Environment"]; + }; + }; + /** @description Environment not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Environment not found */ + error: string; + }; + }; + }; + }; + }; + deleteEnvironment: { + parameters: { + query?: never; + header?: never; + path: { + /** @description UUID of the environment */ + environmentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Environment deleted successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + createEnvironment: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * @description The directory path of the environment + * @default + * @example my/env/path + */ + directory?: string; + systemId: string; + name: string; + description?: string; + resourceFilter?: { + [key: string]: unknown; + }; + policyId?: string; + channels?: string[]; + metadata?: { + [key: string]: string; + }; + }; + }; + }; + responses: { + /** @description Environment created successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Environment"]; + }; + }; + /** @description Environment already exists */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + id?: string; + }; + }; + }; + /** @description Failed to create environment */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + getAgentRunningJobs: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The execution ID */ + agentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Job"][]; + }; + }; + }; + }; + acknowledgeAgentJob: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the job agent */ + agentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successfully acknowledged job */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + job?: components["schemas"]["Job"]; + }; + }; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + /** @description Workspace not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + }; + }; + getNextJobs: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The agent ID */ + agentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + jobs?: components["schemas"]["Job"][]; + }; + }; + }; + }; + }; + upsertJobAgent: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + workspaceId: string; + name: string; + type: string; + }; + }; + }; + responses: { + /** @description Successfully retrieved or created the agent */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + id: string; + name: string; + workspaceId: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + acknowledgeJob: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The job ID */ + jobId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + sucess?: boolean; + }; + }; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + getJob: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The job ID */ + jobId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["JobWithTrigger"]; + }; + }; + /** @description Not Found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Job not found. */ + error?: string; + }; + }; + }; + }; + }; + updateJob: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The execution ID */ + jobId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + status?: components["schemas"]["JobStatus"]; + message?: string | null; + externalId?: string | null; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + id: string; + }; + }; + }; + }; + }; + createJobToResourceRelationship: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description Unique identifier of the job + * @example 123e4567-e89b-12d3-a456-426614174000 + */ + jobId: string; + /** + * @description Unique identifier of the resource + * @example resource-123 + */ + resourceIdentifier: string; + }; + }; + }; + responses: { + /** @description Relationship created successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Relationship created successfully */ + message?: string; + }; + }; + }; + /** @description Invalid request body */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Invalid jobId format */ + error?: string; + }; + }; + }; + /** @description Job or resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Job with specified ID not found */ + error?: string; + }; + }; + }; + /** @description Relationship already exists */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Relationship between job and resource already exists */ + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Internal server error occurred */ + error?: string; + }; + }; + }; + }; + }; + createResourceToResourceRelationship: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description The workspace ID + * @example 123e4567-e89b-12d3-a456-426614174000 + */ + workspaceId: string; + /** + * @description The identifier of the resource to connect + * @example my-resource + */ + fromIdentifier: string; + /** + * @description The identifier of the resource to connect to + * @example my-resource + */ + toIdentifier: string; + /** + * @description The type of relationship + * @example depends_on + */ + type: string; + }; + }; + }; + responses: { + /** @description Relationship created */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Relationship created successfully */ + message?: string; + }; + }; + }; + /** @description Invalid request body */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + /** @description Relationship already exists */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + }; + }; + setResourceProvidersResources: { + parameters: { + query?: never; + header?: never; + path: { + /** @description UUID of the scanner */ + providerId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + resources: { + identifier: string; + name: string; + version: string; + kind: string; + config: { + [key: string]: unknown; + }; + metadata: { + [key: string]: string; + }; + }[]; + }; + }; + }; + responses: { + /** @description Successfully updated the deployment resources */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Deployment resources not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + getResource: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The resource ID */ + resourceId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + id: string; + name: string; + workspaceId: string; + kind: string; + identifier: string; + version: string; + config: { + [key: string]: unknown; + }; + /** Format: date-time */ + lockedAt?: string | null; + /** Format: date-time */ + updatedAt: string; + provider?: { + id?: string; + name?: string; + } | null; + metadata: { + [key: string]: string; + }; + variable: { + [key: string]: string; + }; + }; + }; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Permission denied */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Resource not found */ + error: string; + }; + }; + }; + }; + }; + deleteResource: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The resource ID */ + resourceId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Resource deleted successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + success: boolean; + }; + }; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Permission denied */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + updateResource: { + parameters: { + query?: never; + header?: never; + path: { + resourceId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + name?: string; + version?: string; + kind?: string; + identifier?: string; + workspaceId?: string; + metadata?: { + [key: string]: string; + }; + variables?: components["schemas"]["Variable"][]; + }; + }; + }; + responses: { + /** @description Resource updated successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + id: string; + name: string; + workspaceId: string; + kind: string; + identifier: string; + version: string; + config: { + [key: string]: unknown; + }; + metadata: { + [key: string]: string; + }; + }; + }; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Permission denied */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + upsertResources: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** Format: uuid */ + workspaceId: string; + resources: { + name: string; + kind: string; + identifier: string; + version: string; + config: Record; + metadata?: { + [key: string]: string; + }; + variables?: components["schemas"]["Variable"][]; + }[]; + }; + }; + }; + responses: { + /** @description All of the cats */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + count?: number; + }; + }; + }; + }; + }; + deleteEnvironmentByName: { + parameters: { + query?: never; + header?: never; + path: { + /** @description UUID of the system */ + systemId: string; + /** @description Name of the environment */ + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Environment deleted successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + getSystem: { + parameters: { + query?: never; + header?: never; + path: { + /** @description UUID of the system */ + systemId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description System retrieved successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["System"] & { + environments?: components["schemas"]["Environment"][]; + deployments?: components["schemas"]["Deployment"][]; + }; + }; + }; + }; + }; + deleteSystem: { + parameters: { + query?: never; + header?: never; + path: { + systemId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description System deleted successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example System deleted */ + message?: string; + }; + }; + }; + /** @description System not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example System not found */ + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Internal server error */ + error?: string; + }; + }; + }; + }; + }; + updateSystem: { + parameters: { + query?: never; + header?: never; + path: { + /** @description UUID of the system */ + systemId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description Name of the system */ + name?: string; + /** @description Slug of the system */ + slug?: string; + /** @description Description of the system */ + description?: string; + /** + * Format: uuid + * @description UUID of the workspace + */ + workspaceId?: string; + }; + }; + }; + responses: { + /** @description System updated successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["System"]; + }; + }; + /** @description System not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example System not found */ + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Internal server error */ + error?: string; + }; + }; + }; + }; + }; + createSystem: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** + * Format: uuid + * @description The workspace ID of the system + */ + workspaceId: string; + /** @description The name of the system */ + name: string; + /** @description The slug of the system */ + slug: string; + /** @description The description of the system */ + description?: string; + }; + }; + }; + responses: { + /** @description System created successfully */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["System"]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: { + /** @enum {string} */ + code: "invalid_type" | "invalid_literal" | "custom"; + message: string; + path: (string | number)[]; + }[]; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Internal Server Error */ + error?: string; + }; + }; + }; + }; + }; + listDeployments: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description All deployments */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + data?: components["schemas"]["Deployment"][]; + }; + }; + }; + }; + }; + listEnvironments: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description All environments */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + data?: components["schemas"]["Environment"][]; + }; + }; + }; + }; + }; + getWorkspace: { + parameters: { + query?: never; + header?: never; + path: { + workspaceId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Workspace found */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Workspace"]; + }; + }; + /** @description Workspace not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + }; + }; + upsertResourceProvider: { + parameters: { + query?: never; + header?: never; + path: { + /** @description Name of the workspace */ + workspaceId: string; + /** @description Name of the resource provider */ + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successfully retrieved or created the resource provider */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + id: string; + name: string; + workspaceId: string; + }; + }; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Permission denied */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Workspace not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + getResourcesByFilter: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + /** @description Filter to apply to the resources */ + filter: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Resources */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Resource"][]; + }; + }; + /** @description Invalid filter */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + }; + }; + getResourceByIdentifier: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + /** @description Identifier of the resource */ + identifier: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successfully retrieved the resource */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + id: string; + identifier: string; + workspaceId: string; + providerId: string; + provider?: { + id?: string; + name?: string; + workspaceId?: string; + }; + variables?: { + id?: string; + key?: string; + value?: string; + }[]; + metadata?: { + [key: string]: string; + }; + }; + }; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Permission denied */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Resource not found */ + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + deleteResourceByIdentifier: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + /** @description Identifier of the resource */ + identifier: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successfully deleted the resource */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example true */ + success?: boolean; + }; + }; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Permission denied */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Resource not found */ + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + listResources: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description All resources */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + data?: components["schemas"]["Resource"][]; + }; + }; + }; + }; + }; + listSystems: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description All systems */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + data?: components["schemas"]["System"][]; + }; + }; + }; + }; + }; + getWorkspaceBySlug: { + parameters: { + query?: never; + header?: never; + path: { + workspaceSlug: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Workspace found */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Workspace"]; + }; + }; + /** @description Workspace not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + }; + }; } type WithRequired = T & { - [P in K]-?: T[P]; + [P in K]-?: T[P]; };