// 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, CloudflarePaginatedProtocol, type CloudflareOpError, type CloudflareOpContext, } from "../protocol.ts"; import { cloudflarePaginate, ResultInfo } from "../pagination.ts"; import { CloudflareError, CloudflareRateLimited } from "../errors.ts"; import * as Retry from "../retry.ts"; export type { CloudflareOpError, CloudflareOpContext }; /** Fallback camelCase→wire mapping for opaque content (mined from the distilled SDK). */ const KEY_DICTIONARY: Record> = { createdOn: "created_on", documentationUrl: "documentation_url", modifiedOn: "modified_on", perPage: "per_page", prefixId: "prefix_id", regionKey: "region_key", resultInfo: "result_info", versionCreatedOn: "version_created_on", }; export interface CreateRegionalServicePrefixBindingRequest { /** Identifier of a Cloudflare account. */ accountId: string; /** IP prefix in CIDR notation to bind. */ cidr: string; /** The ID of the parent IP prefix that contains the CIDR. */ prefixId: string; /** Region key from managed regions (e.g., "us", "eu"). */ regionKey: string; } export const CreateRegionalServicePrefixBindingRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), cidr: S.String, prefixId: S.String.pipe(T.Body("prefix_id")), regionKey: S.String.pipe(T.Body("region_key")), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/dls/regional_services/prefix_bindings", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateRegionalServicePrefixBindingRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateRegionalServicePrefixBindingResponse { /** The ID of the binding. */ id: string; /** The CIDR that is bound. */ cidr: string; /** The ID of the parent prefix. */ prefixId: string; /** The region key used for the binding. */ regionKey: string; } export const CreateRegionalServicePrefixBindingResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, cidr: S.String, prefixId: S.String.pipe(T.Body("prefix_id")), regionKey: S.String.pipe(T.Body("region_key")), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateRegionalServicePrefixBindingResponse", }) as any as S.Schema; export interface DeleteRegionalServicePrefixBindingRequest { /** Identifier of a Cloudflare account. */ accountId: string; /** Unique identifier for the prefix binding. */ bindingId: string; } export const DeleteRegionalServicePrefixBindingRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), bindingId: S.String.pipe(T.Label("binding_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/dls/regional_services/prefix_bindings/{binding_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteRegionalServicePrefixBindingRequest", }) as any as S.Schema; export interface DeleteRegionalServicePrefixBindingResponse {} export const DeleteRegionalServicePrefixBindingResponse = /*@__PURE__*/ S.suspend(() => S.Struct({}).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteRegionalServicePrefixBindingResponse", }) as any as S.Schema; export interface GetRegionRequest { /** Identifier of a Cloudflare account. */ accountId: string; /** UUID of the region (custom or managed) or region_key of a managed region. */ regionId: string; } export const GetRegionRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), regionId: S.String.pipe(T.Label("region_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/dls/regions/{region_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRegionRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetRegionResponse { id: string; createdOn: string; modifiedOn: string; name: string; regionKey: string; version: number; versionCreatedOn: string; } export const GetRegionResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, createdOn: S.String.pipe(T.Body("created_on")), modifiedOn: S.String.pipe(T.Body("modified_on")), name: S.String, regionKey: S.String.pipe(T.Body("region_key")), version: S.Number, versionCreatedOn: S.String.pipe(T.Body("version_created_on")), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRegionResponse", }) as any as S.Schema; export interface GetRegionalServicePrefixBindingRequest { /** Identifier of a Cloudflare account. */ accountId: string; /** Unique identifier for the prefix binding. */ bindingId: string; } export const GetRegionalServicePrefixBindingRequest = /*@__PURE__*/ S.suspend( () => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), bindingId: S.String.pipe(T.Label("binding_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/dls/regional_services/prefix_bindings/{binding_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRegionalServicePrefixBindingRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetRegionalServicePrefixBindingResponse { /** The ID of the binding. */ id: string; /** The CIDR that is bound. */ cidr: string; /** The ID of the parent prefix. */ prefixId: string; /** The region key used for the binding. */ regionKey: string; } export const GetRegionalServicePrefixBindingResponse = /*@__PURE__*/ S.suspend( () => S.Struct({ id: S.String, cidr: S.String, prefixId: S.String.pipe(T.Body("prefix_id")), regionKey: S.String.pipe(T.Body("region_key")), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRegionalServicePrefixBindingResponse", }) as any as S.Schema; export interface ListRegionalServicePrefixBindingsRequest { /** Identifier of a Cloudflare account. */ accountId: string; /** Opaque token for cursor-based pagination. Omit for the first page. Pass the value from a previous response to fetch the next page. */ cursor?: string; perPage?: number; } export const ListRegionalServicePrefixBindingsRequest = /*@__PURE__*/ S.suspend( () => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), cursor: S.optional(S.String.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/dls/regional_services/prefix_bindings", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListRegionalServicePrefixBindingsRequest", }) as any as S.Schema; export interface RegionalServicesPrefixBindingsListResultItem { /** The ID of the binding. */ id: string; /** The CIDR that is bound. */ cidr: string; /** The ID of the parent prefix. */ prefixId: string; /** The region key used for the binding. */ regionKey: string; } export const RegionalServicesPrefixBindingsListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, cidr: S.String, prefixId: S.String.pipe(T.Body("prefix_id")), regionKey: S.String.pipe(T.Body("region_key")), }), ).annotate({ identifier: "RegionalServicesPrefixBindingsListResultItem", }) as any as S.Schema; export type RegionalServicesPrefixBindingsListResultList = Array; export const RegionalServicesPrefixBindingsListResultList = /*@__PURE__*/ S.Array( RegionalServicesPrefixBindingsListResultItem, ) as any as S.Schema; export interface ListRegionalServicePrefixBindingsResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: RegionalServicesPrefixBindingsListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListRegionalServicePrefixBindingsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: RegionalServicesPrefixBindingsListResultList.pipe( T.EnvelopePayload(), ), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListRegionalServicePrefixBindingsResponse", }) as any as S.Schema; export type RegionsListRequestType = "managed" | "custom"; export const RegionsListRequestType = /*@__PURE__*/ S.String; export interface ListRegionsRequest { /** Identifier of a Cloudflare account. */ accountId: string; /** Opaque token for cursor-based pagination. Omit for the first page. Pass the value from a previous response to fetch the next page. */ cursor?: string; perPage?: number; /** Filter regions by type. Omit to return all regions. */ type?: RegionsListRequestType | (string & {}); } export const ListRegionsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), cursor: S.optional(S.String.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), type: S.optional(RegionsListRequestType.pipe(T.Query())), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/dls/regions", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListRegionsRequest", }) as any as S.Schema; export interface RegionsListResultItem { id: string; createdOn: string; modifiedOn: string; name: string; regionKey: string; version: number; versionCreatedOn: string; } export const RegionsListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, createdOn: S.String.pipe(T.Body("created_on")), modifiedOn: S.String.pipe(T.Body("modified_on")), name: S.String, regionKey: S.String.pipe(T.Body("region_key")), version: S.Number, versionCreatedOn: S.String.pipe(T.Body("version_created_on")), }), ).annotate({ identifier: "RegionsListResultItem", }) as any as S.Schema; export type RegionsListResultList = Array; export const RegionsListResultList = /*@__PURE__*/ S.Array( RegionsListResultItem, ) as any as S.Schema; export interface ListRegionsResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: RegionsListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListRegionsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: RegionsListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListRegionsResponse", }) as any as S.Schema; export interface PatchRegionalServicePrefixBindingRequest { /** Identifier of a Cloudflare account. */ accountId: string; /** Unique identifier for the prefix binding. */ bindingId: string; /** New region key to assign (e.g., "us", "eu", "cfcanary"). */ regionKey: string; } export const PatchRegionalServicePrefixBindingRequest = /*@__PURE__*/ S.suspend( () => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), bindingId: S.String.pipe(T.Label("binding_id")), regionKey: S.String.pipe(T.Body("region_key")), }) .pipe( T.Http({ method: "PATCH", uri: "/accounts/{account_id}/dls/regional_services/prefix_bindings/{binding_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchRegionalServicePrefixBindingRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface PatchRegionalServicePrefixBindingResponse { /** The ID of the binding. */ id: string; /** The CIDR that is bound. */ cidr: string; /** The ID of the parent prefix. */ prefixId: string; /** The region key used for the binding. */ regionKey: string; } export const PatchRegionalServicePrefixBindingResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, cidr: S.String, prefixId: S.String.pipe(T.Body("prefix_id")), regionKey: S.String.pipe(T.Body("region_key")), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchRegionalServicePrefixBindingResponse", }) as any as S.Schema; export type CreateRegionalServicePrefixBindingError = CloudflareOpError; /** Create a DLS prefix binding */ export const createRegionalServicePrefixBinding: API.OperationMethod< CreateRegionalServicePrefixBindingRequest, CreateRegionalServicePrefixBindingResponse, CreateRegionalServicePrefixBindingError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateRegionalServicePrefixBindingRequest, output: CreateRegionalServicePrefixBindingResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteRegionalServicePrefixBindingError = CloudflareOpError; /** Delete a DLS prefix binding */ export const deleteRegionalServicePrefixBinding: API.OperationMethod< DeleteRegionalServicePrefixBindingRequest, DeleteRegionalServicePrefixBindingResponse, DeleteRegionalServicePrefixBindingError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteRegionalServicePrefixBindingRequest, output: DeleteRegionalServicePrefixBindingResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetRegionError = CloudflareOpError; /** Get a DLS region */ export const getRegion: API.OperationMethod< GetRegionRequest, GetRegionResponse, GetRegionError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetRegionRequest, output: GetRegionResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetRegionalServicePrefixBindingError = CloudflareOpError; /** Get a DLS prefix binding */ export const getRegionalServicePrefixBinding: API.OperationMethod< GetRegionalServicePrefixBindingRequest, GetRegionalServicePrefixBindingResponse, GetRegionalServicePrefixBindingError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetRegionalServicePrefixBindingRequest, output: GetRegionalServicePrefixBindingResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListRegionalServicePrefixBindingsError = CloudflareOpError; /** List DLS prefix bindings for an account */ export const listRegionalServicePrefixBindings: API.PaginatedOperationMethod< ListRegionalServicePrefixBindingsRequest, ListRegionalServicePrefixBindingsResponse, ListRegionalServicePrefixBindingsError, CloudflareOpContext, RegionalServicesPrefixBindingsListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListRegionalServicePrefixBindingsRequest, output: ListRegionalServicePrefixBindingsResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "cursor", inputToken: "cursor", outputToken: "resultInfo.cursor", items: "result", pageSize: "perPage", } as const, }), cloudflarePaginate, ) as any; export type ListRegionsError = CloudflareOpError; /** List DLS regions for an account */ export const listRegions: API.PaginatedOperationMethod< ListRegionsRequest, ListRegionsResponse, ListRegionsError, CloudflareOpContext, RegionsListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListRegionsRequest, output: ListRegionsResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "cursor", inputToken: "cursor", outputToken: "resultInfo.cursor", items: "result", pageSize: "perPage", } as const, }), cloudflarePaginate, ) as any; export type PatchRegionalServicePrefixBindingError = CloudflareOpError; /** Update a DLS prefix binding */ export const patchRegionalServicePrefixBinding: API.OperationMethod< PatchRegionalServicePrefixBindingRequest, PatchRegionalServicePrefixBindingResponse, PatchRegionalServicePrefixBindingError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PatchRegionalServicePrefixBindingRequest, output: PatchRegionalServicePrefixBindingResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, }));