// AUTO-GENERATED by scripts/generate.ts from .generated-specs. Do not edit. import * as S from "@distilled.cloud/core/schema"; import * as API from "@distilled.cloud/core/api"; import * as T from "../traits.ts"; import { CloudflareProtocol, type CloudflareOpError, type CloudflareOpContext, } from "../protocol.ts"; import { CloudflareError, CloudflareRateLimited } from "../errors.ts"; import * as Retry from "../retry.ts"; export type { CloudflareOpError, CloudflareOpContext }; export class ContainerApplicationNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "ContainerApplicationNotFound", { code: S.Number, message: S.String, }, ), [ { code: 1609, message: { includes: "Container application not found" } }, { code: 1609, message: { includes: "APPLICATION_NOT_FOUND" } }, ], ) {} export class DurableObjectAlreadyHasApplication extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "DurableObjectAlreadyHasApplication", { code: S.Number, message: S.String, }, ), [ { code: 1608, message: { includes: "DURABLE_OBJECT_ALREADY_HAS_APPLICATION" }, }, ], ) {} export class DurableObjectCheckError extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "DurableObjectCheckError", { code: S.Number, message: S.String, }, ), [ { code: 1000, message: { includes: "checking the application durable object" }, }, ], ) {} export class DurableObjectNotContainerEnabled extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "DurableObjectNotContainerEnabled", { code: S.Number, message: S.String, }, ), [ { code: 1607, message: { includes: "DURABLE_OBJECT_NOT_CONTAINER_ENABLED" }, }, ], ) {} export class InvalidRoute extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("InvalidRoute", { code: S.Number, message: S.String, }), [{ code: 7003, message: { includes: "Could not route" } }], ) {} export interface EnvironmentVariable { name: string; value: string; } export const EnvironmentVariable = /*@__PURE__*/ S.suspend(() => S.Struct({ name: S.String, value: S.String, }), ).annotate({ identifier: "EnvironmentVariable", }) as any as S.Schema; export type EnvironmentVariableList = Array; export const EnvironmentVariableList = /*@__PURE__*/ S.Array( EnvironmentVariable, ) as any as S.Schema; export type DocumentList = Array; export const DocumentList = /*@__PURE__*/ S.Array( S.Unknown, ) as any as S.Schema; export type StringList = Array; export const StringList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface ContainerConfiguration { image: string; instanceType?: string | null; vcpu?: number | null; memory?: string | null; memoryMib?: number | null; disk?: unknown | null; environmentVariables?: EnvironmentVariableList | null; secrets?: DocumentList | null; labels?: DocumentList | null; ports?: DocumentList | null; network?: unknown | null; command?: StringList | null; entrypoint?: StringList | null; observability?: unknown | null; checks?: DocumentList | null; dns?: unknown | null; sshPublicKeyIds?: StringList | null; } export const ContainerConfiguration = /*@__PURE__*/ S.suspend(() => S.Struct({ image: S.String, instanceType: S.optional(S.NullOr(S.String).pipe(T.Body("instance_type"))), vcpu: S.optional(S.NullOr(S.Number)), memory: S.optional(S.NullOr(S.String)), memoryMib: S.optional(S.NullOr(S.Number).pipe(T.Body("memory_mib"))), disk: S.optional(S.NullOr(S.Unknown)), environmentVariables: S.optional( S.NullOr(EnvironmentVariableList).pipe(T.Body("environment_variables")), ), secrets: S.optional(S.NullOr(DocumentList)), labels: S.optional(S.NullOr(DocumentList)), ports: S.optional(S.NullOr(DocumentList)), network: S.optional(S.NullOr(S.Unknown)), command: S.optional(S.NullOr(StringList)), entrypoint: S.optional(S.NullOr(StringList)), observability: S.optional(S.NullOr(S.Unknown)), checks: S.optional(S.NullOr(DocumentList)), dns: S.optional(S.NullOr(S.Unknown)), sshPublicKeyIds: S.optional( S.NullOr(StringList).pipe(T.Body("ssh_public_key_ids")), ), }), ).annotate({ identifier: "ContainerConfiguration", }) as any as S.Schema; export interface DurableObjectsRef { namespaceId: string; } export const DurableObjectsRef = /*@__PURE__*/ S.suspend(() => S.Struct({ namespaceId: S.String.pipe(T.Body("namespace_id")), }), ).annotate({ identifier: "DurableObjectsRef", }) as any as S.Schema; export interface CreateContainerApplicationRequest { accountId: string; name: string; maxInstances: number; configuration: ContainerConfiguration; durableObjects?: DurableObjectsRef; instances?: number; schedulingPolicy?: string; constraints?: unknown; affinities?: unknown; jobs?: boolean; } export const CreateContainerApplicationRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), name: S.String, maxInstances: S.Number.pipe(T.Body("max_instances")), configuration: ContainerConfiguration, durableObjects: S.optional( DurableObjectsRef.pipe(T.Body("durable_objects")), ), instances: S.optional(S.Number), schedulingPolicy: S.optional(S.String.pipe(T.Body("scheduling_policy"))), constraints: S.optional(S.Unknown), affinities: S.optional(S.Unknown), jobs: S.optional(S.Boolean), }).pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/containers/applications", code: 200, }), ), ).annotate({ identifier: "CreateContainerApplicationRequest", }) as any as S.Schema; export interface ContainerApplicationItem { id: string; name: string; accountId: string; schedulingPolicy: string; instances: number; maxInstances: number; constraints?: unknown | null; affinities?: unknown | null; configuration: ContainerConfiguration; durableObjects?: DurableObjectsRef | null; createdAt: string; version: number; } export const ContainerApplicationItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, name: S.String, accountId: S.String.pipe(T.Body("account_id")), schedulingPolicy: S.String.pipe(T.Body("scheduling_policy")), instances: S.Number, maxInstances: S.Number.pipe(T.Body("max_instances")), constraints: S.optional(S.NullOr(S.Unknown)), affinities: S.optional(S.NullOr(S.Unknown)), configuration: ContainerConfiguration, durableObjects: S.optional( S.NullOr(DurableObjectsRef).pipe(T.Body("durable_objects")), ), createdAt: S.String.pipe(T.Body("created_at")), version: S.Number, }), ).annotate({ identifier: "ContainerApplicationItem", }) as any as S.Schema; export type CreateContainerApplicationResponse = ContainerApplicationItem; export const CreateContainerApplicationResponse = /*@__PURE__*/ S.suspend(() => ContainerApplicationItem.pipe(T.EnvelopePayloadRoot()), ).annotate({ identifier: "CreateContainerApplicationResponse", }) as any as S.Schema; export interface CreateContainerApplicationRolloutRequest { accountId: string; applicationId: string; description: string; strategy: string; kind?: string; stepPercentage?: number; targetConfiguration?: ContainerConfiguration; } export const CreateContainerApplicationRolloutRequest = /*@__PURE__*/ S.suspend( () => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), applicationId: S.String.pipe(T.Label("application_id")), description: S.String, strategy: S.String, kind: S.optional(S.String), stepPercentage: S.optional(S.Number.pipe(T.Body("step_percentage"))), targetConfiguration: S.optional( ContainerConfiguration.pipe(T.Body("target_configuration")), ), }).pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/containers/applications/{application_id}/rollouts", code: 200, }), ), ).annotate({ identifier: "CreateContainerApplicationRolloutRequest", }) as any as S.Schema; export type CreateContainerApplicationRolloutResponse = ContainerApplicationItem; export const CreateContainerApplicationRolloutResponse = /*@__PURE__*/ S.suspend(() => ContainerApplicationItem.pipe(T.EnvelopePayloadRoot()), ).annotate({ identifier: "CreateContainerApplicationRolloutResponse", }) as any as S.Schema; export interface CreateContainerRegistryCredentialsRequest { accountId: string; registryId: string; permissions: StringList; expirationMinutes: number; } export const CreateContainerRegistryCredentialsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), registryId: S.String.pipe(T.Label("registry_id")), permissions: StringList, expirationMinutes: S.Number.pipe(T.Body("expiration_minutes")), }).pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/containers/registries/{registry_id}/credentials", code: 200, }), ), ).annotate({ identifier: "CreateContainerRegistryCredentialsRequest", }) as any as S.Schema; /** Registry credentials (transcribed from the distilled SDK — endpoint is docs-absent). */ export interface CreateContainerRegistryCredentialsResult { user?: string | null; username?: string | null; password: string; } export const CreateContainerRegistryCredentialsResult = /*@__PURE__*/ S.suspend( () => S.Struct({ user: S.optional(S.NullOr(S.String)), username: S.optional(S.NullOr(S.String)), password: S.String, }), ).annotate({ identifier: "CreateContainerRegistryCredentialsResult", }) as any as S.Schema; export type CreateContainerRegistryCredentialsResponse = CreateContainerRegistryCredentialsResult; export const CreateContainerRegistryCredentialsResponse = /*@__PURE__*/ S.suspend(() => CreateContainerRegistryCredentialsResult.pipe(T.EnvelopePayloadRoot()), ).annotate({ identifier: "CreateContainerRegistryCredentialsResponse", }) as any as S.Schema; export interface DeleteContainerApplicationRequest { accountId: string; applicationId: string; } export const DeleteContainerApplicationRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), applicationId: S.String.pipe(T.Label("application_id")), }).pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/containers/applications/{application_id}", code: 200, }), ), ).annotate({ identifier: "DeleteContainerApplicationRequest", }) as any as S.Schema; export type DeleteContainerApplicationResponse = unknown; export const DeleteContainerApplicationResponse = /*@__PURE__*/ S.suspend(() => S.Unknown.pipe(T.EnvelopePayloadRoot()), ).annotate({ identifier: "DeleteContainerApplicationResponse", }) as any as S.Schema; export interface GetContainerApplicationRequest { accountId: string; applicationId: string; } export const GetContainerApplicationRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), applicationId: S.String.pipe(T.Label("application_id")), }).pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/containers/applications/{application_id}", code: 200, }), ), ).annotate({ identifier: "GetContainerApplicationRequest", }) as any as S.Schema; export type GetContainerApplicationResponse = ContainerApplicationItem; export const GetContainerApplicationResponse = /*@__PURE__*/ S.suspend(() => ContainerApplicationItem.pipe(T.EnvelopePayloadRoot()), ).annotate({ identifier: "GetContainerApplicationResponse", }) as any as S.Schema; export interface GetContainerIdentityRequest { accountId: string; } export const GetContainerIdentityRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }).pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/containers/me", code: 200, }), ), ).annotate({ identifier: "GetContainerIdentityRequest", }) as any as S.Schema; export type GetContainerIdentityResponse = unknown; export const GetContainerIdentityResponse = /*@__PURE__*/ S.suspend(() => S.Unknown.pipe(T.EnvelopePayloadRoot()), ).annotate({ identifier: "GetContainerIdentityResponse", }) as any as S.Schema; export interface ListContainerApplicationsRequest { accountId: string; } export const ListContainerApplicationsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }).pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/containers/applications", code: 200, }), ), ).annotate({ identifier: "ListContainerApplicationsRequest", }) as any as S.Schema; export type ContainerApplicationItemList = Array; export const ContainerApplicationItemList = /*@__PURE__*/ S.Array( ContainerApplicationItem, ) as any as S.Schema; export type ListContainerApplicationsResponse = ContainerApplicationItemList; export const ListContainerApplicationsResponse = /*@__PURE__*/ S.suspend(() => ContainerApplicationItemList.pipe(T.EnvelopePayloadRoot()), ).annotate({ identifier: "ListContainerApplicationsResponse", }) as any as S.Schema; export interface UpdateContainerApplicationRequest { accountId: string; applicationId: string; maxInstances?: number; configuration?: ContainerConfiguration; instances?: number; schedulingPolicy?: string; constraints?: unknown; affinities?: unknown; } export const UpdateContainerApplicationRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), applicationId: S.String.pipe(T.Label("application_id")), maxInstances: S.optional(S.Number.pipe(T.Body("max_instances"))), configuration: S.optional(ContainerConfiguration), instances: S.optional(S.Number), schedulingPolicy: S.optional(S.String.pipe(T.Body("scheduling_policy"))), constraints: S.optional(S.Unknown), affinities: S.optional(S.Unknown), }).pipe( T.Http({ method: "PATCH", uri: "/accounts/{account_id}/containers/applications/{application_id}", code: 200, }), ), ).annotate({ identifier: "UpdateContainerApplicationRequest", }) as any as S.Schema; export type UpdateContainerApplicationResponse = ContainerApplicationItem; export const UpdateContainerApplicationResponse = /*@__PURE__*/ S.suspend(() => ContainerApplicationItem.pipe(T.EnvelopePayloadRoot()), ).annotate({ identifier: "UpdateContainerApplicationResponse", }) as any as S.Schema; export type CreateContainerApplicationError = | InvalidRoute | DurableObjectAlreadyHasApplication | DurableObjectNotContainerEnabled | DurableObjectCheckError | CloudflareOpError; export const createContainerApplication: API.OperationMethod< CreateContainerApplicationRequest, CreateContainerApplicationResponse, CreateContainerApplicationError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateContainerApplicationRequest, output: CreateContainerApplicationResponse, errors: [ InvalidRoute, DurableObjectAlreadyHasApplication, DurableObjectNotContainerEnabled, DurableObjectCheckError, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreateContainerApplicationRolloutError = | InvalidRoute | ContainerApplicationNotFound | CloudflareOpError; export const createContainerApplicationRollout: API.OperationMethod< CreateContainerApplicationRolloutRequest, CreateContainerApplicationRolloutResponse, CreateContainerApplicationRolloutError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateContainerApplicationRolloutRequest, output: CreateContainerApplicationRolloutResponse, errors: [ InvalidRoute, ContainerApplicationNotFound, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreateContainerRegistryCredentialsError = | InvalidRoute | CloudflareOpError; export const createContainerRegistryCredentials: API.OperationMethod< CreateContainerRegistryCredentialsRequest, CreateContainerRegistryCredentialsResponse, CreateContainerRegistryCredentialsError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateContainerRegistryCredentialsRequest, output: CreateContainerRegistryCredentialsResponse, errors: [InvalidRoute, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteContainerApplicationError = | InvalidRoute | ContainerApplicationNotFound | CloudflareOpError; export const deleteContainerApplication: API.OperationMethod< DeleteContainerApplicationRequest, DeleteContainerApplicationResponse, DeleteContainerApplicationError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteContainerApplicationRequest, output: DeleteContainerApplicationResponse, errors: [ InvalidRoute, ContainerApplicationNotFound, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetContainerApplicationError = | InvalidRoute | ContainerApplicationNotFound | CloudflareOpError; export const getContainerApplication: API.OperationMethod< GetContainerApplicationRequest, GetContainerApplicationResponse, GetContainerApplicationError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetContainerApplicationRequest, output: GetContainerApplicationResponse, errors: [ InvalidRoute, ContainerApplicationNotFound, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetContainerIdentityError = InvalidRoute | CloudflareOpError; export const getContainerIdentity: API.OperationMethod< GetContainerIdentityRequest, GetContainerIdentityResponse, GetContainerIdentityError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetContainerIdentityRequest, output: GetContainerIdentityResponse, errors: [InvalidRoute, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListContainerApplicationsError = InvalidRoute | CloudflareOpError; export const listContainerApplications: API.OperationMethod< ListContainerApplicationsRequest, ListContainerApplicationsResponse, ListContainerApplicationsError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: ListContainerApplicationsRequest, output: ListContainerApplicationsResponse, errors: [InvalidRoute, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type UpdateContainerApplicationError = | InvalidRoute | ContainerApplicationNotFound | CloudflareOpError; export const updateContainerApplication: API.OperationMethod< UpdateContainerApplicationRequest, UpdateContainerApplicationResponse, UpdateContainerApplicationError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateContainerApplicationRequest, output: UpdateContainerApplicationResponse, errors: [ InvalidRoute, ContainerApplicationNotFound, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, }));