// 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> = { certificateAuthority: "certificate_authority", expiresOn: "expires_on", perPage: "per_page", resultInfo: "result_info", totalCount: "total_count", updatedAt: "updated_at", uploadedOn: "uploaded_on", validityPeriod: "validity_period", }; export class AdvancedCertificateManagerRequired extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "AdvancedCertificateManagerRequired", { code: S.Number, message: S.String, }, ), [{ code: 1450 }], ) {} export class CustomTrustStoreNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "CustomTrustStoreNotFound", { code: S.Number, message: S.String, }, ), [{ status: 404 }], ) {} export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, }), [{ status: 403 }], ) {} export class InvalidObjectIdentifier extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "InvalidObjectIdentifier", { code: S.Number, message: S.String, }, ), [{ code: 7003 }], ) {} export class NoStateChange extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("NoStateChange", { code: S.Number, message: S.String, }), [{ code: 1467 }], ) {} export class PreviousJobInProgress extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "PreviousJobInProgress", { code: S.Number, message: S.String, }, ), [{ code: 1482 }], ) {} export interface CreateCustomTrustStoreRequest { /** Identifier. */ zoneId: string; /** The root CA certificate in PEM format. Only root CA certificates are accepted; intermediate and leaf certificates are not supported. */ certificate: string; } export const CreateCustomTrustStoreRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), certificate: S.String, }) .pipe( T.Http({ method: "POST", uri: "/zones/{zone_id}/acm/custom_trust_store", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateCustomTrustStoreRequest", }) as any as S.Schema; export type CustomTrustStoreCreateResponseStatus = | "initializing" | "pending_deployment" | "active" | "pending_deletion" | "deleted" | "expired"; export const CustomTrustStoreCreateResponseStatus = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateCustomTrustStoreResponse { /** Identifier. */ id: string; /** The root CA certificate in PEM format. Only root CA certificates are accepted; intermediate and leaf certificates are not supported. */ certificate: string; /** When the certificate expires. */ expiresOn: string; /** The certificate authority that issued the certificate. */ issuer: string; /** The type of hash used for the certificate. */ signature: string; /** Status of the zone's custom SSL. */ status: CustomTrustStoreCreateResponseStatus; /** When the certificate was last modified. */ updatedAt: string; /** When the certificate was uploaded to Cloudflare. */ uploadedOn: string; } export const CreateCustomTrustStoreResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, certificate: S.String, expiresOn: S.String.pipe(T.Body("expires_on")), issuer: S.String, signature: S.String, status: CustomTrustStoreCreateResponseStatus, updatedAt: S.String.pipe(T.Body("updated_at")), uploadedOn: S.String.pipe(T.Body("uploaded_on")), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateCustomTrustStoreResponse", }) as any as S.Schema; export interface DeleteCustomTrustStoreRequest { /** Identifier. */ zoneId: string; /** Identifier. */ customOriginTrustStoreId: string; } export const DeleteCustomTrustStoreRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), customOriginTrustStoreId: S.String.pipe( T.Label("custom_origin_trust_store_id"), ), }) .pipe( T.Http({ method: "DELETE", uri: "/zones/{zone_id}/acm/custom_trust_store/{custom_origin_trust_store_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteCustomTrustStoreRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DeleteCustomTrustStoreResponse { /** Identifier. */ id?: string | null; } export const DeleteCustomTrustStoreResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteCustomTrustStoreResponse", }) as any as S.Schema; export interface GetCustomTrustStoreRequest { /** Identifier. */ zoneId: string; /** Identifier. */ customOriginTrustStoreId: string; } export const GetCustomTrustStoreRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), customOriginTrustStoreId: S.String.pipe( T.Label("custom_origin_trust_store_id"), ), }) .pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/acm/custom_trust_store/{custom_origin_trust_store_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetCustomTrustStoreRequest", }) as any as S.Schema; export type CustomTrustStoreGetResponseStatus = | "initializing" | "pending_deployment" | "active" | "pending_deletion" | "deleted" | "expired"; export const CustomTrustStoreGetResponseStatus = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetCustomTrustStoreResponse { /** Identifier. */ id: string; /** The root CA certificate in PEM format. Only root CA certificates are accepted; intermediate and leaf certificates are not supported. */ certificate: string; /** When the certificate expires. */ expiresOn: string; /** The certificate authority that issued the certificate. */ issuer: string; /** The type of hash used for the certificate. */ signature: string; /** Status of the zone's custom SSL. */ status: CustomTrustStoreGetResponseStatus; /** When the certificate was last modified. */ updatedAt: string; /** When the certificate was uploaded to Cloudflare. */ uploadedOn: string; } export const GetCustomTrustStoreResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, certificate: S.String, expiresOn: S.String.pipe(T.Body("expires_on")), issuer: S.String, signature: S.String, status: CustomTrustStoreGetResponseStatus, updatedAt: S.String.pipe(T.Body("updated_at")), uploadedOn: S.String.pipe(T.Body("uploaded_on")), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetCustomTrustStoreResponse", }) as any as S.Schema; export interface GetTotalTlRequest { /** Identifier. */ zoneId: string; } export const GetTotalTlRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), }) .pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/acm/total_tls", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetTotalTlRequest", }) as any as S.Schema; export type TotalTlsGetResponseCertificateAuthority = | "google" | "lets_encrypt" | "ssl_com"; export const TotalTlsGetResponseCertificateAuthority = /*@__PURE__*/ S.String; export type TotalTlsGetResponseValidityPeriod = 90; export const TotalTlsGetResponseValidityPeriod = /*@__PURE__*/ S.Number; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetTotalTlResponse { /** The Certificate Authority that Total TLS certificates will be issued through. */ certificateAuthority?: TotalTlsGetResponseCertificateAuthority | null; /** If enabled, Total TLS will order a hostname specific TLS certificate for any proxied A, AAAA, or CNAME record in your zone. */ enabled?: boolean | null; /** The validity period in days for the certificates ordered via Total TLS. */ validityPeriod?: TotalTlsGetResponseValidityPeriod | null; } export const GetTotalTlResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ certificateAuthority: S.optional( S.NullOr(TotalTlsGetResponseCertificateAuthority).pipe( T.Body("certificate_authority"), ), ), enabled: S.optional(S.NullOr(S.Boolean)), validityPeriod: S.optional( S.NullOr(TotalTlsGetResponseValidityPeriod).pipe( T.Body("validity_period"), ), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetTotalTlResponse", }) as any as S.Schema; export interface ListCustomTrustStoresRequest { /** Identifier. */ zoneId: string; /** Limit to the number of records returned. */ limit?: number; /** Offset the results. */ offset?: number; /** Page number of paginated results. */ page?: number; /** Number of records per page. */ perPage?: number; } export const ListCustomTrustStoresRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), limit: S.optional(S.Number.pipe(T.Query())), offset: S.optional(S.Number.pipe(T.Query())), page: S.optional(S.Number.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), }) .pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/acm/custom_trust_store", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListCustomTrustStoresRequest", }) as any as S.Schema; export type CustomTrustStoreListResultItemStatus = | "initializing" | "pending_deployment" | "active" | "pending_deletion" | "deleted" | "expired"; export const CustomTrustStoreListResultItemStatus = /*@__PURE__*/ S.String; export interface CustomTrustStoreListResultItem { /** Identifier. */ id: string; /** The root CA certificate in PEM format. Only root CA certificates are accepted; intermediate and leaf certificates are not supported. */ certificate: string; /** When the certificate expires. */ expiresOn: string; /** The certificate authority that issued the certificate. */ issuer: string; /** The type of hash used for the certificate. */ signature: string; /** Status of the zone's custom SSL. */ status: CustomTrustStoreListResultItemStatus; /** When the certificate was last modified. */ updatedAt: string; /** When the certificate was uploaded to Cloudflare. */ uploadedOn: string; } export const CustomTrustStoreListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, certificate: S.String, expiresOn: S.String.pipe(T.Body("expires_on")), issuer: S.String, signature: S.String, status: CustomTrustStoreListResultItemStatus, updatedAt: S.String.pipe(T.Body("updated_at")), uploadedOn: S.String.pipe(T.Body("uploaded_on")), }), ).annotate({ identifier: "CustomTrustStoreListResultItem", }) as any as S.Schema; export type CustomTrustStoreListResultList = Array; export const CustomTrustStoreListResultList = /*@__PURE__*/ S.Array( CustomTrustStoreListResultItem, ) as any as S.Schema; export interface ListCustomTrustStoresResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: CustomTrustStoreListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListCustomTrustStoresResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: CustomTrustStoreListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListCustomTrustStoresResponse", }) as any as S.Schema; export type TotalTlsEditRequestCertificateAuthority = | "google" | "lets_encrypt" | "ssl_com"; export const TotalTlsEditRequestCertificateAuthority = /*@__PURE__*/ S.String; export interface UpdateTotalTlRequest { /** Identifier. */ zoneId: string; /** If enabled, Total TLS will order a hostname specific TLS certificate for any proxied A, AAAA, or CNAME record in your zone. */ enabled: boolean; /** The Certificate Authority that Total TLS certificates will be issued through. */ certificateAuthority?: | TotalTlsEditRequestCertificateAuthority | (string & {}); } export const UpdateTotalTlRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), enabled: S.Boolean, certificateAuthority: S.optional( TotalTlsEditRequestCertificateAuthority.pipe( T.Body("certificate_authority"), ), ), }) .pipe( T.Http({ method: "POST", uri: "/zones/{zone_id}/acm/total_tls", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateTotalTlRequest", }) as any as S.Schema; export type TotalTlsEditResponseCertificateAuthority = | "google" | "lets_encrypt" | "ssl_com"; export const TotalTlsEditResponseCertificateAuthority = /*@__PURE__*/ S.String; export type TotalTlsEditResponseValidityPeriod = 90; export const TotalTlsEditResponseValidityPeriod = /*@__PURE__*/ S.Number; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateTotalTlResponse { /** The Certificate Authority that Total TLS certificates will be issued through. */ certificateAuthority?: TotalTlsEditResponseCertificateAuthority | null; /** If enabled, Total TLS will order a hostname specific TLS certificate for any proxied A, AAAA, or CNAME record in your zone. */ enabled?: boolean | null; /** The validity period in days for the certificates ordered via Total TLS. */ validityPeriod?: TotalTlsEditResponseValidityPeriod | null; } export const UpdateTotalTlResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ certificateAuthority: S.optional( S.NullOr(TotalTlsEditResponseCertificateAuthority).pipe( T.Body("certificate_authority"), ), ), enabled: S.optional(S.NullOr(S.Boolean)), validityPeriod: S.optional( S.NullOr(TotalTlsEditResponseValidityPeriod).pipe( T.Body("validity_period"), ), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateTotalTlResponse", }) as any as S.Schema; export type UpdateTotalTlsRequestCertificateAuthority = | "google" | "lets_encrypt" | "ssl_com"; export const UpdateTotalTlsRequestCertificateAuthority = /*@__PURE__*/ S.String; export interface UpdateTotalTlsRequest { /** Identifier. */ zoneId: string; /** If enabled, Total TLS will order a hostname specific TLS certificate for any proxied A, AAAA, or CNAME record in your zone. */ enabled: boolean; /** The Certificate Authority that Total TLS certificates will be issued through. */ certificateAuthority?: | UpdateTotalTlsRequestCertificateAuthority | (string & {}); } export const UpdateTotalTlsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), enabled: S.Boolean, certificateAuthority: S.optional( UpdateTotalTlsRequestCertificateAuthority.pipe( T.Body("certificate_authority"), ), ), }) .pipe( T.Http({ method: "POST", uri: "/zones/{zone_id}/acm/total_tls", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateTotalTlsRequest", }) as any as S.Schema; export type UpdateTotalTlsResponseCertificateAuthority = | "google" | "lets_encrypt" | "ssl_com"; export const UpdateTotalTlsResponseCertificateAuthority = /*@__PURE__*/ S.String; export type UpdateTotalTlsResponseValidityPeriod = 90; export const UpdateTotalTlsResponseValidityPeriod = /*@__PURE__*/ S.Number; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateTotalTlsResponse { /** The Certificate Authority that Total TLS certificates will be issued through. */ certificateAuthority?: UpdateTotalTlsResponseCertificateAuthority | null; /** If enabled, Total TLS will order a hostname specific TLS certificate for any proxied A, AAAA, or CNAME record in your zone. */ enabled?: boolean | null; /** The validity period in days for the certificates ordered via Total TLS. */ validityPeriod?: UpdateTotalTlsResponseValidityPeriod | null; } export const UpdateTotalTlsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ certificateAuthority: S.optional( S.NullOr(UpdateTotalTlsResponseCertificateAuthority).pipe( T.Body("certificate_authority"), ), ), enabled: S.optional(S.NullOr(S.Boolean)), validityPeriod: S.optional( S.NullOr(UpdateTotalTlsResponseValidityPeriod).pipe( T.Body("validity_period"), ), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateTotalTlsResponse", }) as any as S.Schema; export type CreateCustomTrustStoreError = | InvalidObjectIdentifier | AdvancedCertificateManagerRequired | Forbidden | CloudflareOpError; /** Upload a root CA certificate to the Custom Origin Trust Store for a Zone. Only root CA certificates are accepted. */ export const createCustomTrustStore: API.OperationMethod< CreateCustomTrustStoreRequest, CreateCustomTrustStoreResponse, CreateCustomTrustStoreError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateCustomTrustStoreRequest, output: CreateCustomTrustStoreResponse, errors: [ InvalidObjectIdentifier, AdvancedCertificateManagerRequired, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteCustomTrustStoreError = | InvalidObjectIdentifier | AdvancedCertificateManagerRequired | CustomTrustStoreNotFound | Forbidden | CloudflareOpError; /** Removes a root CA certificate from the custom origin trust store. Origins using certificates signed by this CA will no longer be trusted. */ export const deleteCustomTrustStore: API.OperationMethod< DeleteCustomTrustStoreRequest, DeleteCustomTrustStoreResponse, DeleteCustomTrustStoreError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteCustomTrustStoreRequest, output: DeleteCustomTrustStoreResponse, errors: [ InvalidObjectIdentifier, AdvancedCertificateManagerRequired, CustomTrustStoreNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetCustomTrustStoreError = | InvalidObjectIdentifier | AdvancedCertificateManagerRequired | CustomTrustStoreNotFound | Forbidden | CloudflareOpError; /** Retrieves details about a specific root CA certificate in the custom origin trust store, including expiration and subject information. */ export const getCustomTrustStore: API.OperationMethod< GetCustomTrustStoreRequest, GetCustomTrustStoreResponse, GetCustomTrustStoreError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetCustomTrustStoreRequest, output: GetCustomTrustStoreResponse, errors: [ InvalidObjectIdentifier, AdvancedCertificateManagerRequired, CustomTrustStoreNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetTotalTlError = | InvalidObjectIdentifier | AdvancedCertificateManagerRequired | Forbidden | CloudflareOpError; /** Get Total TLS Settings for a Zone. */ export const getTotalTl: API.OperationMethod< GetTotalTlRequest, GetTotalTlResponse, GetTotalTlError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetTotalTlRequest, output: GetTotalTlResponse, errors: [ InvalidObjectIdentifier, AdvancedCertificateManagerRequired, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListCustomTrustStoresError = | AdvancedCertificateManagerRequired | Forbidden | CloudflareOpError; /** Get Custom Origin Trust Store for a Zone. */ export const listCustomTrustStores: API.PaginatedOperationMethod< ListCustomTrustStoresRequest, ListCustomTrustStoresResponse, ListCustomTrustStoresError, CloudflareOpContext, CustomTrustStoreListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListCustomTrustStoresRequest, output: ListCustomTrustStoresResponse, errors: [ AdvancedCertificateManagerRequired, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "page", inputToken: "page", outputToken: "resultInfo.page", items: "result", pageSize: "perPage", } as const, }), cloudflarePaginate, ) as any; export type UpdateTotalTlError = | InvalidObjectIdentifier | AdvancedCertificateManagerRequired | NoStateChange | PreviousJobInProgress | Forbidden | CloudflareOpError; /** Set Total TLS Settings or disable the feature for a Zone. */ export const updateTotalTl: API.OperationMethod< UpdateTotalTlRequest, UpdateTotalTlResponse, UpdateTotalTlError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateTotalTlRequest, output: UpdateTotalTlResponse, errors: [ InvalidObjectIdentifier, AdvancedCertificateManagerRequired, NoStateChange, PreviousJobInProgress, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type UpdateTotalTlsError = | InvalidObjectIdentifier | AdvancedCertificateManagerRequired | NoStateChange | PreviousJobInProgress | Forbidden | CloudflareOpError; /** Set Total TLS Settings or disable the feature for a Zone. */ export const updateTotalTls: API.OperationMethod< UpdateTotalTlsRequest, UpdateTotalTlsResponse, UpdateTotalTlsError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateTotalTlsRequest, output: UpdateTotalTlsResponse, errors: [ InvalidObjectIdentifier, AdvancedCertificateManagerRequired, NoStateChange, PreviousJobInProgress, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); // Alias of updateTotalTl (same route, alternate export name upstream). export const editTotalTl = updateTotalTl; export type EditTotalTlRequest = UpdateTotalTlRequest; export type EditTotalTlResponse = UpdateTotalTlResponse; export type EditTotalTlError = UpdateTotalTlError;