From 46242f499f97cd4e479ee52f68bbecc0b786a5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Br=C3=A4mer?= <22003767+robinbraemer@users.noreply.github.com> Date: Fri, 11 Sep 2026 15:48:36 +0200 Subject: [PATCH] fix(contract): accept system-managed machine responses Rationale: System-managed machines intentionally have no compute configuration, so the generated CLI contract must accept their normal public list response without weakening validation of any present fields. Tested: bun run vitest run test/generated-command.test.ts --testNamePattern='machines.list accepts a system-managed machine without a compute config'; bun run test; mise run generate:check; mise run check. --- openapi/public.json | 4 ++-- src/generated/openapi-api.gen.ts | 8 +++---- test/generated-command.test.ts | 37 ++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/openapi/public.json b/openapi/public.json index 3e67ff2..a279e9c 100644 --- a/openapi/public.json +++ b/openapi/public.json @@ -12417,7 +12417,8 @@ "compute_config_id": { "type": "string", "minLength": 1, - "maxLength": 54 + "maxLength": 54, + "description": "Compute config the machine runs against. Absent for Akua system-managed machines." }, "provider_id": { "type": "string", @@ -12829,7 +12830,6 @@ "id", "workspace_id", "cluster_id", - "compute_config_id", "provider_id", "provider_resource", "node_name", diff --git a/src/generated/openapi-api.gen.ts b/src/generated/openapi-api.gen.ts index a4083d0..002a53e 100644 --- a/src/generated/openapi-api.gen.ts +++ b/src/generated/openapi-api.gen.ts @@ -59,12 +59,12 @@ export type ClusterComputeSettings = { readonly "auto_scaling": "active" | "paus export const ClusterComputeSettings = Schema.Struct({ "auto_scaling": Schema.Literals(["active", "paused"]), "machines": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "max_machines": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "updated_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "etag": Schema.String }).annotate({ "identifier": "ClusterComputeSettings" }) export type UpdateClusterComputeSettingsBody = { readonly "auto_scaling_enabled": boolean, readonly "max_machines"?: number } | { readonly "auto_scaling_enabled"?: boolean, readonly "max_machines": number } export const UpdateClusterComputeSettingsBody = Schema.Union([Schema.Struct({ "auto_scaling_enabled": Schema.Boolean, "max_machines": Schema.optionalKey(Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(100).annotate({ "expected": "a value less than or equal to 100" }))) }), Schema.Struct({ "auto_scaling_enabled": Schema.optionalKey(Schema.Boolean), "max_machines": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(100).annotate({ "expected": "a value less than or equal to 100" })) })]).annotate({ "identifier": "UpdateClusterComputeSettingsBody" }) -export type MachineList = { readonly "data": ReadonlyArray<{ readonly "id": string, readonly "workspace_id": string, readonly "cluster_id": string, readonly "compute_config_id": string, readonly "provider_id": string, readonly "provider_resource": { readonly "identity_kind": "recyclable" | "persistent", readonly "public_ip": string | null, readonly "floating_ip"?: { readonly "id": string, readonly "ipv4": string } }, readonly "name"?: string, readonly "node_name": string | null, readonly "state": "ACTIVE" | "PROVISIONING" | "SUSPENDING" | "SUSPENDED" | "RESUMING" | "DELETING", readonly "reconciling": boolean, readonly "current_suspension"?: { readonly "event_id": string, readonly "snapshot_ref": { readonly "provider": "hcloud", readonly "snapshot_id": number, readonly "size_gb": number }, readonly "expires_at": number, readonly "monthly_cost_cents": number, readonly "reason": "manual" | "downgrade" }, readonly "created_at": number, readonly "updated_at": number, readonly "etag": string }>, readonly "has_more": boolean, readonly "next_cursor": string | null } -export const MachineList = Schema.Struct({ "data": Schema.Array(Schema.Struct({ "id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "compute_config_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "provider_id": Schema.String.annotate({ "description": "Provider URI identifier in canonical form (for example, compute://hcloud/server-1234)." }), "provider_resource": Schema.Struct({ "identity_kind": Schema.Literals(["recyclable", "persistent"]), "public_ip": Schema.Union([Schema.String, Schema.Null]), "floating_ip": Schema.optionalKey(Schema.Struct({ "id": Schema.String, "ipv4": Schema.String })) }), "name": Schema.optionalKey(Schema.String), "node_name": Schema.Union([Schema.String, Schema.Null]), "state": Schema.Literals(["ACTIVE", "PROVISIONING", "SUSPENDING", "SUSPENDED", "RESUMING", "DELETING"]).annotate({ "description": "Machine lifecycle state." }), "reconciling": Schema.Boolean, "current_suspension": Schema.optionalKey(Schema.Struct({ "event_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "snapshot_ref": Schema.Struct({ "provider": Schema.Literal("hcloud"), "snapshot_id": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })), "size_gb": Schema.Number.check(Schema.isFinite().annotate({ "expected": "a finite number" })) }), "expires_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "monthly_cost_cents": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })), "reason": Schema.Literals(["manual", "downgrade"]) })), "created_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "updated_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "etag": Schema.String })), "has_more": Schema.Boolean.annotate({ "description": "True if more items exist after this page." }), "next_cursor": Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Opaque cursor for the next page, or null if no more pages." }) }).annotate({ "identifier": "MachineList" }) +export type MachineList = { readonly "data": ReadonlyArray<{ readonly "id": string, readonly "workspace_id": string, readonly "cluster_id": string, readonly "compute_config_id"?: string, readonly "provider_id": string, readonly "provider_resource": { readonly "identity_kind": "recyclable" | "persistent", readonly "public_ip": string | null, readonly "floating_ip"?: { readonly "id": string, readonly "ipv4": string } }, readonly "name"?: string, readonly "node_name": string | null, readonly "state": "ACTIVE" | "PROVISIONING" | "SUSPENDING" | "SUSPENDED" | "RESUMING" | "DELETING", readonly "reconciling": boolean, readonly "current_suspension"?: { readonly "event_id": string, readonly "snapshot_ref": { readonly "provider": "hcloud", readonly "snapshot_id": number, readonly "size_gb": number }, readonly "expires_at": number, readonly "monthly_cost_cents": number, readonly "reason": "manual" | "downgrade" }, readonly "created_at": number, readonly "updated_at": number, readonly "etag": string }>, readonly "has_more": boolean, readonly "next_cursor": string | null } +export const MachineList = Schema.Struct({ "data": Schema.Array(Schema.Struct({ "id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "compute_config_id": Schema.optionalKey(Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" }))), "provider_id": Schema.String.annotate({ "description": "Provider URI identifier in canonical form (for example, compute://hcloud/server-1234)." }), "provider_resource": Schema.Struct({ "identity_kind": Schema.Literals(["recyclable", "persistent"]), "public_ip": Schema.Union([Schema.String, Schema.Null]), "floating_ip": Schema.optionalKey(Schema.Struct({ "id": Schema.String, "ipv4": Schema.String })) }), "name": Schema.optionalKey(Schema.String), "node_name": Schema.Union([Schema.String, Schema.Null]), "state": Schema.Literals(["ACTIVE", "PROVISIONING", "SUSPENDING", "SUSPENDED", "RESUMING", "DELETING"]).annotate({ "description": "Machine lifecycle state." }), "reconciling": Schema.Boolean, "current_suspension": Schema.optionalKey(Schema.Struct({ "event_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "snapshot_ref": Schema.Struct({ "provider": Schema.Literal("hcloud"), "snapshot_id": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })), "size_gb": Schema.Number.check(Schema.isFinite().annotate({ "expected": "a finite number" })) }), "expires_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "monthly_cost_cents": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })), "reason": Schema.Literals(["manual", "downgrade"]) })), "created_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "updated_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "etag": Schema.String })), "has_more": Schema.Boolean.annotate({ "description": "True if more items exist after this page." }), "next_cursor": Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Opaque cursor for the next page, or null if no more pages." }) }).annotate({ "identifier": "MachineList" }) export type MachineOperation = { readonly "id": string, readonly "workspace_id": string | null, readonly "organization_id": string | null, readonly "owner_type": "install" | "repository_change_request" | "repository" | "workspace" | "machine" | "cluster" | "package", readonly "owner_id": string, readonly "parent_operation_id": string | null, readonly "state": "RUNNING" | "SUCCEEDED" | "FAILED" | "CANCELLED", readonly "done": boolean, readonly "html_url": string, readonly "metadata": { readonly "type": "machine.create", readonly "workspace_id": string, readonly "cluster_id": string, readonly "compute_config_id"?: string, readonly "instance_type": string, readonly "managed": boolean, readonly "request_fingerprint": string } | { readonly "type": "machine.delete", readonly "workspace_id": string, readonly "machine_id": string, readonly "request_fingerprint": string } | { readonly "type": "machine.suspend", readonly "workspace_id": string, readonly "machine_id": string, readonly "request_fingerprint": string } | { readonly "type": "machine.resume", readonly "workspace_id": string, readonly "machine_id": string, readonly "request_fingerprint": string } | { readonly "type": "cluster.delete", readonly "cluster_id": string } | { readonly "type": "cluster.create", readonly "workspace_id": string, readonly "region_id": string, readonly "name": string } | { readonly "type": "cluster.suspend", readonly "cluster_id": string } | { readonly "type": "cluster.resume", readonly "cluster_id": string } | { readonly "type": "cluster.capabilities.refresh", readonly "cluster_id": string } | { readonly "type": "cluster.capability.ensure", readonly "cluster_id": string, readonly "capability": string } | { readonly "type": "cluster.worker_bootstrap.revoke", readonly "cluster_id": string, readonly "worker_bootstrap_id": string } | { readonly "type": "install.create", readonly "idempotency_key": string, readonly "workspace_id": string, readonly "product_id"?: string } | { readonly "type": "install.render", readonly "install_id": string, readonly "trigger_commit_sha"?: string } | { readonly "type": "install.delete", readonly "install_id": string } | { readonly "type": "preview_hostname.bind_pinned", readonly "install_id": string, readonly "render_id": string, readonly "protocol": "http" | "websocket" | "grpc", readonly "routing_mode": "through_dispatcher" | "bypass_dispatcher", readonly "idempotency_key": string } | { readonly "type": "preview_hostname.bind_floating", readonly "install_id": string, readonly "track": string, readonly "render_id": string, readonly "protocol": "http" | "websocket" | "grpc", readonly "routing_mode": "through_dispatcher" | "bypass_dispatcher", readonly "idempotency_key": string } | { readonly "type": "preview_hostname.delete", readonly "install_id": string, readonly "preview_hostname_id": string, readonly "if_match": string, readonly "idempotency_key": string } | { readonly "type": "workspace.delete", readonly "workspace_id": string } | { readonly "type": "workspace.subscription.cancel", readonly "workspace_id": string, readonly "mode": "period_end" } | { readonly "type": "workspace.subdomain.set_name", readonly "workspace_id": string, readonly "name": string, readonly "idempotency_key": string } | { readonly "type": "custom_domain.create", readonly "workspace_id": string, readonly "hostname": string, readonly "target": { readonly "kind": "install", readonly "install_id": string } | { readonly "kind": "cluster", readonly "cluster_id": string } | { readonly "kind": "external", readonly "endpoint": string, readonly "mtls_secret_id"?: string }, readonly "protocol": "http" | "websocket" | "grpc", readonly "routing_mode": "through_dispatcher" | "bypass_dispatcher", readonly "idempotency_key": string } | { readonly "type": "custom_domain.update", readonly "workspace_id": string, readonly "custom_domain_id": string, readonly "target"?: { readonly "kind": "install", readonly "install_id": string } | { readonly "kind": "cluster", readonly "cluster_id": string } | { readonly "kind": "external", readonly "endpoint": string, readonly "mtls_secret_id"?: string }, readonly "protocol"?: "http" | "websocket" | "grpc", readonly "routing_mode"?: "through_dispatcher" | "bypass_dispatcher", readonly "if_match": string, readonly "idempotency_key": string } | { readonly "type": "custom_domain.delete", readonly "workspace_id": string, readonly "custom_domain_id": string, readonly "if_match": string, readonly "idempotency_key": string } | { readonly "type": "cloudflare.private_origin_route.prepare", readonly "workspace_id": string, readonly "cluster_id": string, readonly "route_intent_id": string } | { readonly "type": "cloudflare.private_origin_route.release", readonly "workspace_id": string, readonly "route_intent_id": string } | { readonly "type": "package.create", readonly "idempotency_key": string, readonly "workspace_id": string, readonly "name": string } | { readonly "type": "repository_change_request.create", readonly "workspace_id": string, readonly "parent_repository_id": string, readonly "created_by_kind": "agent" | "wizard" | "user" } | { readonly "type": "repository_change_request.accept", readonly "repository_change_request_id": string, readonly "user_id": string } | { readonly "type": "repository_change_request.reject", readonly "repository_change_request_id": string, readonly "user_id": string, readonly "reason": string } | { readonly "type": "repository_change_request.withdraw", readonly "repository_change_request_id": string, readonly "user_id": string } | { readonly "type": "repository_change_request.expire", readonly "repository_change_request_id": string } | { readonly "type": "repository.delete", readonly "repository_id": string }, readonly "response": { readonly "type": "machine.create", readonly "machine_id": string, readonly "provider_id": string } | { readonly "type": "machine.delete", readonly "machine_id": string } | { readonly "type": "machine.suspend", readonly "machine_id": string, readonly "suspension_id": string } | { readonly "type": "machine.resume", readonly "machine_id": string } | { readonly "type": "cluster.delete", readonly "cluster_id": string } | { readonly "type": "cluster.create", readonly "cluster_id": string } | { readonly "type": "cluster.suspend", readonly "cluster_id": string } | { readonly "type": "cluster.resume", readonly "cluster_id": string } | { readonly "type": "cluster.capabilities.refresh", readonly "cluster_id": string } | { readonly "type": "cluster.capability.ensure", readonly "cluster_id": string, readonly "capability": string } | { readonly "type": "cluster.worker_bootstrap.revoke", readonly "note"?: string } | { readonly "type": "install.create", readonly "install_id": string, readonly "argo_app_name": string, readonly "argo_app_namespace": string } | { readonly "type": "install.create", readonly "install_id": string, readonly "sandbox_skipped": true } | { readonly "type": "install.render", readonly "install_render_id": string, readonly "repository_id": string, readonly "commit_sha"?: string, readonly "render_hash": string, readonly "skipped": boolean } | { readonly "type": "install.delete", readonly "argo_app_deleted": boolean, readonly "repo_purged": boolean } | { readonly "type": "preview_hostname.bind_pinned", readonly "install_id": string, readonly "preview_hostname_id": string, readonly "hostname": string } | { readonly "type": "preview_hostname.bind_floating", readonly "install_id": string, readonly "preview_hostname_id": string, readonly "hostname": string } | { readonly "type": "preview_hostname.delete", readonly "install_id": string, readonly "preview_hostname_id": string, readonly "hostname": string } | { readonly "type": "workspace.delete", readonly "workspace_id": string } | { readonly "type": "workspace.subscription.cancel", readonly "subscription_id": string, readonly "cancel_at": number } | { readonly "type": "workspace.subdomain.set_name", readonly "workspace_id": string, readonly "workspace_subdomain_id": string, readonly "fqdn": string } | { readonly "type": "custom_domain.create", readonly "workspace_id": string, readonly "custom_domain_id": string, readonly "hostname": string } | { readonly "type": "custom_domain.update", readonly "workspace_id": string, readonly "custom_domain_id": string, readonly "hostname": string } | { readonly "type": "custom_domain.delete", readonly "workspace_id": string, readonly "custom_domain_id": string, readonly "hostname": string } | { readonly "type": "cloudflare.private_origin_route.prepare", readonly "origin_route_id": string } | { readonly "type": "cloudflare.private_origin_route.release", readonly "route_intent_id": string } | { readonly "type": "package.create", readonly "package_id": string, readonly "package_version_id": string, readonly "repository_id": string } | { readonly "type": "repository_change_request.create", readonly "repository_change_request_id": string, readonly "fork_repository_id": string, readonly "expires_at": number } | { readonly "type": "repository_change_request.accept", readonly "merged_at": number, readonly "triggered_install_render": boolean } | { readonly "type": "repository_change_request.reject", readonly "rejected_at": number } | { readonly "type": "repository_change_request.withdraw", readonly "withdrawn_at": number } | { readonly "type": "repository_change_request.expire", readonly "expired": boolean } | { readonly "type": "repository.delete", readonly "purged_at": number } | null, readonly "error": { readonly "message": string, readonly [x: string]: Schema.Json } | null, readonly "last_error": { readonly "message": string, readonly "step_name"?: string, readonly [x: string]: Schema.Json | undefined } | null, readonly "started_at": number, readonly "completed_at": number | null, readonly "steps"?: ReadonlyArray<{ readonly "name": string, readonly "status": "pending" | "running" | "completed" | "failed" | "skipped", readonly "execution_type": "system" | "user" | "approval" | "skipped", readonly "started_at": number, readonly "completed_at": number | null, readonly "error_message": string | null, readonly "retryable": boolean, readonly "skippable": boolean }>, readonly "operation_id": string } export const MachineOperation = Schema.Struct({ "id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "workspace_id": Schema.Union([Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), Schema.Null]), "organization_id": Schema.Union([Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), Schema.Null]), "owner_type": Schema.Literals(["install", "repository_change_request", "repository", "workspace", "machine", "cluster", "package"]).annotate({ "description": "Domain entity collection the operation acts on." }), "owner_id": Schema.String.annotate({ "description": "Prefixed ID of the entity this operation acts on. Prefix matches `owner_type` (`ws_`, `mch_`, `clu_`, `pkg_`, `inst_`, `rcr_`, `repo_`)." }), "parent_operation_id": Schema.Union([Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), Schema.Null]).annotate({ "description": "ID of the chained parent operation, when present." }), "state": Schema.Literals(["RUNNING", "SUCCEEDED", "FAILED", "CANCELLED"]).annotate({ "description": "Lifecycle state. Past-participle terminal states per AIP-216." }), "done": Schema.Boolean.annotate({ "description": "True iff state is a terminal value." }), "html_url": Schema.String.annotate({ "description": "Deep link to the dashboard view of this operation's owning resource when available, otherwise the operation detail page.", "format": "uri" }).check(Schema.isMaxLength(2048).annotate({ "expected": "a value with a length of at most 2048" })), "metadata": Schema.Union([Schema.Struct({ "type": Schema.Literal("machine.create"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "compute_config_id": Schema.optionalKey(Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" }))), "instance_type": Schema.String, "managed": Schema.Boolean, "request_fingerprint": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })) }), Schema.Struct({ "type": Schema.Literal("machine.delete"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "machine_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "request_fingerprint": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })) }), Schema.Struct({ "type": Schema.Literal("machine.suspend"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "machine_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "request_fingerprint": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })) }), Schema.Struct({ "type": Schema.Literal("machine.resume"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "machine_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "request_fingerprint": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })) }), Schema.Struct({ "type": Schema.Literal("cluster.delete"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cluster.create"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "region_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "name": Schema.String }), Schema.Struct({ "type": Schema.Literal("cluster.suspend"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cluster.resume"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cluster.capabilities.refresh"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cluster.capability.ensure"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "capability": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })) }), Schema.Struct({ "type": Schema.Literal("cluster.worker_bootstrap.revoke"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "worker_bootstrap_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("install.create"), "idempotency_key": Schema.String, "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "product_id": Schema.optionalKey(Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" }))) }), Schema.Struct({ "type": Schema.Literal("install.render"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "trigger_commit_sha": Schema.optionalKey(Schema.String) }), Schema.Struct({ "type": Schema.Literal("install.delete"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })) }), Schema.Struct({ "type": Schema.Literal("preview_hostname.bind_pinned"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "render_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "protocol": Schema.Literals(["http", "websocket", "grpc"]), "routing_mode": Schema.Literals(["through_dispatcher", "bypass_dispatcher"]), "idempotency_key": Schema.String }), Schema.Struct({ "type": Schema.Literal("preview_hostname.bind_floating"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "track": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(100).annotate({ "expected": "a value with a length of at most 100" })), "render_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "protocol": Schema.Literals(["http", "websocket", "grpc"]), "routing_mode": Schema.Literals(["through_dispatcher", "bypass_dispatcher"]), "idempotency_key": Schema.String }), Schema.Struct({ "type": Schema.Literal("preview_hostname.delete"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "preview_hostname_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "if_match": Schema.String, "idempotency_key": Schema.String }), Schema.Struct({ "type": Schema.Literal("workspace.delete"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })) }), Schema.Struct({ "type": Schema.Literal("workspace.subscription.cancel"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "mode": Schema.Literal("period_end") }), Schema.Struct({ "type": Schema.Literal("workspace.subdomain.set_name"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "name": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(63).annotate({ "expected": "a value with a length of at most 63" })), "idempotency_key": Schema.String }), Schema.Struct({ "type": Schema.Literal("custom_domain.create"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "hostname": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(253).annotate({ "expected": "a value with a length of at most 253" })), "target": Schema.Union([Schema.Struct({ "kind": Schema.Literal("install"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })) }), Schema.Struct({ "kind": Schema.Literal("cluster"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "kind": Schema.Literal("external"), "endpoint": Schema.String.annotate({ "format": "uri" }), "mtls_secret_id": Schema.optionalKey(Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" }))) })], { mode: "oneOf" }), "protocol": Schema.Literals(["http", "websocket", "grpc"]), "routing_mode": Schema.Literals(["through_dispatcher", "bypass_dispatcher"]), "idempotency_key": Schema.String }), Schema.Struct({ "type": Schema.Literal("custom_domain.update"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "custom_domain_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "target": Schema.optionalKey(Schema.Union([Schema.Struct({ "kind": Schema.Literal("install"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })) }), Schema.Struct({ "kind": Schema.Literal("cluster"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "kind": Schema.Literal("external"), "endpoint": Schema.String.annotate({ "format": "uri" }), "mtls_secret_id": Schema.optionalKey(Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" }))) })], { mode: "oneOf" })), "protocol": Schema.optionalKey(Schema.Literals(["http", "websocket", "grpc"])), "routing_mode": Schema.optionalKey(Schema.Literals(["through_dispatcher", "bypass_dispatcher"])), "if_match": Schema.String, "idempotency_key": Schema.String }), Schema.Struct({ "type": Schema.Literal("custom_domain.delete"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "custom_domain_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "if_match": Schema.String, "idempotency_key": Schema.String }), Schema.Struct({ "type": Schema.Literal("cloudflare.private_origin_route.prepare"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "route_intent_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cloudflare.private_origin_route.release"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "route_intent_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("package.create"), "idempotency_key": Schema.String, "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "name": Schema.String }), Schema.Struct({ "type": Schema.Literal("repository_change_request.create"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "parent_repository_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "created_by_kind": Schema.Literals(["agent", "wizard", "user"]) }), Schema.Struct({ "type": Schema.Literal("repository_change_request.accept"), "repository_change_request_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "user_id": Schema.String }), Schema.Struct({ "type": Schema.Literal("repository_change_request.reject"), "repository_change_request_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "user_id": Schema.String, "reason": Schema.String }), Schema.Struct({ "type": Schema.Literal("repository_change_request.withdraw"), "repository_change_request_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "user_id": Schema.String }), Schema.Struct({ "type": Schema.Literal("repository_change_request.expire"), "repository_change_request_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("repository.delete"), "repository_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })) })], { mode: "oneOf" }), "response": Schema.Union([Schema.Struct({ "type": Schema.Literal("machine.create"), "machine_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "provider_id": Schema.String }), Schema.Struct({ "type": Schema.Literal("machine.delete"), "machine_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("machine.suspend"), "machine_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "suspension_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("machine.resume"), "machine_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cluster.delete"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cluster.create"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cluster.suspend"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cluster.resume"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cluster.capabilities.refresh"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cluster.capability.ensure"), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "capability": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })) }), Schema.Struct({ "type": Schema.Literal("cluster.worker_bootstrap.revoke"), "note": Schema.optionalKey(Schema.String) }), Schema.Struct({ "type": Schema.Literal("install.create"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "argo_app_name": Schema.String, "argo_app_namespace": Schema.String }), Schema.Struct({ "type": Schema.Literal("install.create"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "sandbox_skipped": Schema.Literal(true) }), Schema.Struct({ "type": Schema.Literal("install.render"), "install_render_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "repository_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "commit_sha": Schema.optionalKey(Schema.String), "render_hash": Schema.String, "skipped": Schema.Boolean }), Schema.Struct({ "type": Schema.Literal("install.delete"), "argo_app_deleted": Schema.Boolean, "repo_purged": Schema.Boolean }), Schema.Struct({ "type": Schema.Literal("preview_hostname.bind_pinned"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "preview_hostname_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "hostname": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(253).annotate({ "expected": "a value with a length of at most 253" })) }), Schema.Struct({ "type": Schema.Literal("preview_hostname.bind_floating"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "preview_hostname_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "hostname": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(253).annotate({ "expected": "a value with a length of at most 253" })) }), Schema.Struct({ "type": Schema.Literal("preview_hostname.delete"), "install_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "preview_hostname_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "hostname": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(253).annotate({ "expected": "a value with a length of at most 253" })) }), Schema.Struct({ "type": Schema.Literal("workspace.delete"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })) }), Schema.Struct({ "type": Schema.Literal("workspace.subscription.cancel"), "subscription_id": Schema.String, "cancel_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })) }), Schema.Struct({ "type": Schema.Literal("workspace.subdomain.set_name"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "workspace_subdomain_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "fqdn": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(253).annotate({ "expected": "a value with a length of at most 253" })) }), Schema.Struct({ "type": Schema.Literal("custom_domain.create"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "custom_domain_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "hostname": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(253).annotate({ "expected": "a value with a length of at most 253" })) }), Schema.Struct({ "type": Schema.Literal("custom_domain.update"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "custom_domain_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "hostname": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(253).annotate({ "expected": "a value with a length of at most 253" })) }), Schema.Struct({ "type": Schema.Literal("custom_domain.delete"), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "custom_domain_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "hostname": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(253).annotate({ "expected": "a value with a length of at most 253" })) }), Schema.Struct({ "type": Schema.Literal("cloudflare.private_origin_route.prepare"), "origin_route_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("cloudflare.private_origin_route.release"), "route_intent_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })) }), Schema.Struct({ "type": Schema.Literal("package.create"), "package_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "package_version_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "repository_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })) }), Schema.Struct({ "type": Schema.Literal("repository_change_request.create"), "repository_change_request_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "fork_repository_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(55).annotate({ "expected": "a value with a length of at most 55" })), "expires_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })) }), Schema.Struct({ "type": Schema.Literal("repository_change_request.accept"), "merged_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "triggered_install_render": Schema.Boolean }), Schema.Struct({ "type": Schema.Literal("repository_change_request.reject"), "rejected_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })) }), Schema.Struct({ "type": Schema.Literal("repository_change_request.withdraw"), "withdrawn_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })) }), Schema.Struct({ "type": Schema.Literal("repository_change_request.expire"), "expired": Schema.Boolean }), Schema.Struct({ "type": Schema.Literal("repository.delete"), "purged_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })) }), Schema.Null]).annotate({ "description": "Populated only when `done && state === \"SUCCEEDED\"`. Discriminated by `type`." }), "error": Schema.Union([Schema.StructWithRest(Schema.Struct({ "message": Schema.String }), [Schema.Record(Schema.String, Schema.Json.annotate({ "expected": "JSON value" }))]), Schema.Null]).annotate({ "description": "Populated when `state` is `FAILED` or `CANCELLED`." }), "last_error": Schema.Union([Schema.StructWithRest(Schema.Struct({ "message": Schema.String, "step_name": Schema.optionalKey(Schema.String) }), [Schema.Record(Schema.String, Schema.Json.annotate({ "expected": "JSON value" }))]), Schema.Null]).annotate({ "description": "Latest error from any failed step. Populated even mid-flight; cleared when the step succeeds on retry." }), "started_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "completed_at": Schema.Union([Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), Schema.Null]).annotate({ "description": "Unix timestamp (seconds)" }), "steps": Schema.optionalKey(Schema.Array(Schema.Struct({ "name": Schema.String.annotate({ "description": "User-visible milestone name." }), "status": Schema.Literals(["pending", "running", "completed", "failed", "skipped"]).annotate({ "description": "Step lifecycle state." }), "execution_type": Schema.Literals(["system", "user", "approval", "skipped"]).annotate({ "description": "Step execution kind. `user`/`approval` mean the workflow is blocked on a human action. Internal bookkeeping steps are filtered from public responses." }), "started_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "completed_at": Schema.Union([Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), Schema.Null]).annotate({ "description": "Unix timestamp (seconds)" }), "error_message": Schema.Union([Schema.String, Schema.Null]), "retryable": Schema.Boolean, "skippable": Schema.Boolean }))), "operation_id": Schema.String.annotate({ "description": "Compatibility alias for `id`." }).check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })) }).annotate({ "identifier": "MachineOperation" }) -export type Machine = { readonly "id": string, readonly "workspace_id": string, readonly "cluster_id": string, readonly "compute_config_id": string, readonly "provider_id": string, readonly "provider_resource": { readonly "identity_kind": "recyclable" | "persistent", readonly "public_ip": string | null, readonly "floating_ip"?: { readonly "id": string, readonly "ipv4": string } }, readonly "name"?: string, readonly "node_name": string | null, readonly "state": "ACTIVE" | "PROVISIONING" | "SUSPENDING" | "SUSPENDED" | "RESUMING" | "DELETING", readonly "reconciling": boolean, readonly "current_suspension"?: { readonly "event_id": string, readonly "snapshot_ref": { readonly "provider": "hcloud", readonly "snapshot_id": number, readonly "size_gb": number }, readonly "expires_at": number, readonly "monthly_cost_cents": number, readonly "reason": "manual" | "downgrade" }, readonly "created_at": number, readonly "updated_at": number, readonly "etag": string } -export const Machine = Schema.Struct({ "id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "compute_config_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "provider_id": Schema.String.annotate({ "description": "Provider URI identifier in canonical form (for example, compute://hcloud/server-1234)." }), "provider_resource": Schema.Struct({ "identity_kind": Schema.Literals(["recyclable", "persistent"]), "public_ip": Schema.Union([Schema.String, Schema.Null]), "floating_ip": Schema.optionalKey(Schema.Struct({ "id": Schema.String, "ipv4": Schema.String })) }), "name": Schema.optionalKey(Schema.String), "node_name": Schema.Union([Schema.String, Schema.Null]), "state": Schema.Literals(["ACTIVE", "PROVISIONING", "SUSPENDING", "SUSPENDED", "RESUMING", "DELETING"]).annotate({ "description": "Machine lifecycle state." }), "reconciling": Schema.Boolean, "current_suspension": Schema.optionalKey(Schema.Struct({ "event_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "snapshot_ref": Schema.Struct({ "provider": Schema.Literal("hcloud"), "snapshot_id": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })), "size_gb": Schema.Number.check(Schema.isFinite().annotate({ "expected": "a finite number" })) }), "expires_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "monthly_cost_cents": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })), "reason": Schema.Literals(["manual", "downgrade"]) })), "created_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "updated_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "etag": Schema.String }).annotate({ "identifier": "Machine" }) +export type Machine = { readonly "id": string, readonly "workspace_id": string, readonly "cluster_id": string, readonly "compute_config_id"?: string, readonly "provider_id": string, readonly "provider_resource": { readonly "identity_kind": "recyclable" | "persistent", readonly "public_ip": string | null, readonly "floating_ip"?: { readonly "id": string, readonly "ipv4": string } }, readonly "name"?: string, readonly "node_name": string | null, readonly "state": "ACTIVE" | "PROVISIONING" | "SUSPENDING" | "SUSPENDED" | "RESUMING" | "DELETING", readonly "reconciling": boolean, readonly "current_suspension"?: { readonly "event_id": string, readonly "snapshot_ref": { readonly "provider": "hcloud", readonly "snapshot_id": number, readonly "size_gb": number }, readonly "expires_at": number, readonly "monthly_cost_cents": number, readonly "reason": "manual" | "downgrade" }, readonly "created_at": number, readonly "updated_at": number, readonly "etag": string } +export const Machine = Schema.Struct({ "id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "workspace_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(53).annotate({ "expected": "a value with a length of at most 53" })), "cluster_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "compute_config_id": Schema.optionalKey(Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" }))), "provider_id": Schema.String.annotate({ "description": "Provider URI identifier in canonical form (for example, compute://hcloud/server-1234)." }), "provider_resource": Schema.Struct({ "identity_kind": Schema.Literals(["recyclable", "persistent"]), "public_ip": Schema.Union([Schema.String, Schema.Null]), "floating_ip": Schema.optionalKey(Schema.Struct({ "id": Schema.String, "ipv4": Schema.String })) }), "name": Schema.optionalKey(Schema.String), "node_name": Schema.Union([Schema.String, Schema.Null]), "state": Schema.Literals(["ACTIVE", "PROVISIONING", "SUSPENDING", "SUSPENDED", "RESUMING", "DELETING"]).annotate({ "description": "Machine lifecycle state." }), "reconciling": Schema.Boolean, "current_suspension": Schema.optionalKey(Schema.Struct({ "event_id": Schema.String.check(Schema.isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(Schema.isMaxLength(54).annotate({ "expected": "a value with a length of at most 54" })), "snapshot_ref": Schema.Struct({ "provider": Schema.Literal("hcloud"), "snapshot_id": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })), "size_gb": Schema.Number.check(Schema.isFinite().annotate({ "expected": "a finite number" })) }), "expires_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "monthly_cost_cents": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })), "reason": Schema.Literals(["manual", "downgrade"]) })), "created_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "updated_at": Schema.Number.annotate({ "description": "Unix timestamp (seconds)" }).check(Schema.isInt().annotate({ "expected": "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })), "etag": Schema.String }).annotate({ "identifier": "Machine" }) export type SuspendMachineBody = { readonly "reason"?: "manual" | "downgrade" } export const SuspendMachineBody = Schema.Struct({ "reason": Schema.optionalKey(Schema.Literals(["manual", "downgrade"])) }).annotate({ "identifier": "SuspendMachineBody" }) export type ResumeMachineBody = { } diff --git a/test/generated-command.test.ts b/test/generated-command.test.ts index bc580c7..ced2091 100644 --- a/test/generated-command.test.ts +++ b/test/generated-command.test.ts @@ -140,6 +140,43 @@ describe("generated public commands", () => { expect(await received?.json()).toEqual(body); }); + test("machines.list accepts a system-managed machine without a compute config", async () => { + const machines = { + data: [ + { + id: "mch_system-managed", + workspace_id: "ws_123", + cluster_id: "clu_123", + provider_id: "compute://hcloud/server-1234", + provider_resource: { + identity_kind: "recyclable", + public_ip: null, + }, + node_name: null, + state: "PROVISIONING", + reconciling: true, + created_at: 1_789_133_184, + updated_at: 1_789_133_184, + etag: "0", + }, + ], + has_more: false, + next_cursor: null, + }; + + const result = await runGenerated( + "machines.list", + ["--input", "-"], + JSON.stringify({ + headers: { "akua-context": "ws_123" }, + query: { cluster_id: "clu_123" }, + }), + () => Promise.resolve(Response.json(machines)), + ); + + expect(result.data).toEqual(machines); + }); + test("operations.list forwards the workspace context header", async () => { let received: Request | undefined; const result = await runGenerated(