// 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> = { accessClientId: "access_client_id", accessClientSecret: "access_client_secret", caCertificateId: "ca_certificate_id", createdOn: "created_on", maxAge: "max_age", modifiedOn: "modified_on", mtlsCertificateId: "mtls_certificate_id", originConnectionLimit: "origin_connection_limit", serviceId: "service_id", staleWhileRevalidate: "stale_while_revalidate", }; export class HyperdriveConfigNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "HyperdriveConfigNotFound", { code: S.Number, message: S.String, }, ), [{ code: 2006 }, { status: 404 }], ) {} export class InvalidHyperdriveConfig extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "InvalidHyperdriveConfig", { code: S.Number, message: S.String, }, ), [{ code: 2007 }], ) {} export class InvalidObjectIdentifier extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "InvalidObjectIdentifier", { code: S.Number, message: S.String, }, ), [{ code: 7003 }], ) {} export class MethodNotAllowed extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("MethodNotAllowed", { code: S.Number, message: S.String, }), [ { code: 10000, message: { includes: "method not allowed" } }, { code: 10405, message: { includes: "Method not allowed" } }, ], ) {} export class PrivateHostNotAllowed extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "PrivateHostNotAllowed", { code: S.Number, message: S.String, }, ), [{ code: 2009 }], ) {} export type ConfigsCreateRequestOriginPublicDatabaseScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsCreateRequestOriginPublicDatabaseScheme = /*@__PURE__*/ S.String; export interface ConfigsCreateRequestOriginPublicDatabase { /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Set the password needed to access your origin database. The API never returns this write-only value. */ password: string; /** Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. */ port: number; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsCreateRequestOriginPublicDatabaseScheme | (string & {}); /** Set the user of your origin database. */ user: string; } export const ConfigsCreateRequestOriginPublicDatabase = /*@__PURE__*/ S.suspend( () => S.Struct({ database: S.String, host: S.String, password: S.String, port: S.Number, scheme: ConfigsCreateRequestOriginPublicDatabaseScheme, user: S.String, }), ).annotate({ identifier: "ConfigsCreateRequestOriginPublicDatabase", }) as any as S.Schema; export type ConfigsCreateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsCreateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = /*@__PURE__*/ S.String; export interface ConfigsCreateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnel { /** Defines the Client ID of the Access token to use when connecting to the origin database. */ accessClientId: string; /** Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. */ accessClientSecret: string; /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Set the password needed to access your origin database. The API never returns this write-only value. */ password: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: | ConfigsCreateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme | (string & {}); /** Set the user of your origin database. */ user: string; } export const ConfigsCreateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnel = /*@__PURE__*/ S.suspend(() => S.Struct({ accessClientId: S.String.pipe(T.Body("access_client_id")), accessClientSecret: S.String.pipe(T.Body("access_client_secret")), database: S.String, host: S.String, password: S.String, scheme: ConfigsCreateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme, user: S.String, }), ).annotate({ identifier: "ConfigsCreateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnel", }) as any as S.Schema; export type ConfigsCreateRequestOriginDatabaseReachableThroughAWorkersVPCScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsCreateRequestOriginDatabaseReachableThroughAWorkersVPCScheme = /*@__PURE__*/ S.String; export interface ConfigsCreateRequestOriginDatabaseReachableThroughAWorkersVPC { /** Set the name of your origin database. */ database: string; /** Set the password needed to access your origin database. The API never returns this write-only value. */ password: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: | ConfigsCreateRequestOriginDatabaseReachableThroughAWorkersVPCScheme | (string & {}); /** The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. */ serviceId: string; /** Set the user of your origin database. */ user: string; } export const ConfigsCreateRequestOriginDatabaseReachableThroughAWorkersVPC = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.String, password: S.String, scheme: ConfigsCreateRequestOriginDatabaseReachableThroughAWorkersVPCScheme, serviceId: S.String.pipe(T.Body("service_id")), user: S.String, }), ).annotate({ identifier: "ConfigsCreateRequestOriginDatabaseReachableThroughAWorkersVPC", }) as any as S.Schema; export type ConfigsCreateRequestOrigin = | ConfigsCreateRequestOriginPublicDatabase | ConfigsCreateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnel | ConfigsCreateRequestOriginDatabaseReachableThroughAWorkersVPC; export const ConfigsCreateRequestOrigin = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([ ["database", "host", "password", "port", "scheme", "user"], [ "accessClientId", "accessClientSecret", "database", "host", "password", "scheme", "user", ], ["database", "password", "scheme", "serviceId", "user"], ]), ); export interface ConfigsCreateRequestCachingHyperdriveHyperdriveCachingCommon { /** Set to true to disable caching of SQL responses. Default is false. */ disabled?: boolean; } export const ConfigsCreateRequestCachingHyperdriveHyperdriveCachingCommon = /*@__PURE__*/ S.suspend(() => S.Struct({ disabled: S.optional(S.Boolean), }), ).annotate({ identifier: "ConfigsCreateRequestCachingHyperdriveHyperdriveCachingCommon", }) as any as S.Schema; export interface ConfigsCreateRequestCachingHyperdriveHyperdriveCachingEnabled { /** Set to true to disable caching of SQL responses. Default is false. */ disabled?: boolean; /** Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. */ maxAge?: number; /** Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. */ staleWhileRevalidate?: number; } export const ConfigsCreateRequestCachingHyperdriveHyperdriveCachingEnabled = /*@__PURE__*/ S.suspend(() => S.Struct({ disabled: S.optional(S.Boolean), maxAge: S.optional(S.Number.pipe(T.Body("max_age"))), staleWhileRevalidate: S.optional( S.Number.pipe(T.Body("stale_while_revalidate")), ), }), ).annotate({ identifier: "ConfigsCreateRequestCachingHyperdriveHyperdriveCachingEnabled", }) as any as S.Schema; export type ConfigsCreateRequestCaching = | ConfigsCreateRequestCachingHyperdriveHyperdriveCachingCommon | ConfigsCreateRequestCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsCreateRequestCaching = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([["disabled"], ["disabled", "maxAge", "staleWhileRevalidate"]]), ); export interface ConfigsCreateRequestMtls { /** Define CA certificate ID obtained after uploading CA cert. */ caCertificateId?: string; /** Define mTLS certificate ID obtained after uploading client cert. */ mtlsCertificateId?: string; /** Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. */ sslmode?: string; } export const ConfigsCreateRequestMtls = /*@__PURE__*/ S.suspend(() => S.Struct({ caCertificateId: S.optional(S.String.pipe(T.Body("ca_certificate_id"))), mtlsCertificateId: S.optional(S.String.pipe(T.Body("mtls_certificate_id"))), sslmode: S.optional(S.String), }), ).annotate({ identifier: "ConfigsCreateRequestMtls", }) as any as S.Schema; export interface CreateConfigRequest { /** Define configurations using a unique string identifier. */ accountId: string; /** The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. */ name: string; origin: ConfigsCreateRequestOrigin; caching?: ConfigsCreateRequestCaching; /** mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. */ mtls?: ConfigsCreateRequestMtls; /** The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. */ originConnectionLimit?: number; } export const CreateConfigRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), name: S.String, origin: ConfigsCreateRequestOrigin, caching: S.optional(ConfigsCreateRequestCaching), mtls: S.optional(ConfigsCreateRequestMtls), originConnectionLimit: S.optional( S.Number.pipe(T.Body("origin_connection_limit")), ), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/hyperdrive/configs", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateConfigRequest", }) as any as S.Schema; export type ConfigsCreateResponseOriginPublicDatabaseScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsCreateResponseOriginPublicDatabaseScheme = /*@__PURE__*/ S.String; export interface ConfigsCreateResponseOriginPublicDatabase { /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. */ port: number; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsCreateResponseOriginPublicDatabaseScheme; /** Set the user of your origin database. */ user: string; } export const ConfigsCreateResponseOriginPublicDatabase = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.String, host: S.String, port: S.Number, scheme: ConfigsCreateResponseOriginPublicDatabaseScheme, user: S.String, }), ).annotate({ identifier: "ConfigsCreateResponseOriginPublicDatabase", }) as any as S.Schema; export type ConfigsCreateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsCreateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = /*@__PURE__*/ S.String; export interface ConfigsCreateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel { /** Defines the Client ID of the Access token to use when connecting to the origin database. */ accessClientId: string; /** Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. */ accessClientSecret: string; /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsCreateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme; /** Set the user of your origin database. */ user: string; } export const ConfigsCreateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel = /*@__PURE__*/ S.suspend(() => S.Struct({ accessClientId: S.String.pipe(T.Body("access_client_id")), accessClientSecret: S.String.pipe(T.Body("access_client_secret")), database: S.String, host: S.String, scheme: ConfigsCreateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme, user: S.String, }), ).annotate({ identifier: "ConfigsCreateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel", }) as any as S.Schema; export type ConfigsCreateResponseOriginDatabaseReachableThroughAWorkersVPCScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsCreateResponseOriginDatabaseReachableThroughAWorkersVPCScheme = /*@__PURE__*/ S.String; export interface ConfigsCreateResponseOriginDatabaseReachableThroughAWorkersVPC { /** Set the name of your origin database. */ database: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsCreateResponseOriginDatabaseReachableThroughAWorkersVPCScheme; /** The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. */ serviceId: string; /** Set the user of your origin database. */ user: string; } export const ConfigsCreateResponseOriginDatabaseReachableThroughAWorkersVPC = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.String, scheme: ConfigsCreateResponseOriginDatabaseReachableThroughAWorkersVPCScheme, serviceId: S.String.pipe(T.Body("service_id")), user: S.String, }), ).annotate({ identifier: "ConfigsCreateResponseOriginDatabaseReachableThroughAWorkersVPC", }) as any as S.Schema; export type ConfigsCreateResponseOrigin = | ConfigsCreateResponseOriginPublicDatabase | ConfigsCreateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel | ConfigsCreateResponseOriginDatabaseReachableThroughAWorkersVPC; export const ConfigsCreateResponseOrigin = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([ ["database", "host", "port", "scheme", "user"], [ "accessClientId", "accessClientSecret", "database", "host", "scheme", "user", ], ["database", "scheme", "serviceId", "user"], ]), ); export interface ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon { /** Set to true to disable caching of SQL responses. Default is false. */ disabled?: boolean | null; } export const ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon = /*@__PURE__*/ S.suspend(() => S.Struct({ disabled: S.optional(S.NullOr(S.Boolean)), }), ).annotate({ identifier: "ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon", }) as any as S.Schema; export interface ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled { /** Set to true to disable caching of SQL responses. Default is false. */ disabled?: boolean | null; /** Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. */ maxAge?: number | null; /** Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. */ staleWhileRevalidate?: number | null; } export const ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled = /*@__PURE__*/ S.suspend(() => S.Struct({ disabled: S.optional(S.NullOr(S.Boolean)), maxAge: S.optional(S.NullOr(S.Number).pipe(T.Body("max_age"))), staleWhileRevalidate: S.optional( S.NullOr(S.Number).pipe(T.Body("stale_while_revalidate")), ), }), ).annotate({ identifier: "ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled", }) as any as S.Schema; export type ConfigsCreateResponseCaching = | ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon | ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsCreateResponseCaching = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([["disabled"], ["disabled", "maxAge", "staleWhileRevalidate"]]), ); export interface ConfigsCreateResponseMtls { /** Define CA certificate ID obtained after uploading CA cert. */ caCertificateId?: string | null; /** Define mTLS certificate ID obtained after uploading client cert. */ mtlsCertificateId?: string | null; /** Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. */ sslmode?: string | null; } export const ConfigsCreateResponseMtls = /*@__PURE__*/ S.suspend(() => S.Struct({ caCertificateId: S.optional( S.NullOr(S.String).pipe(T.Body("ca_certificate_id")), ), mtlsCertificateId: S.optional( S.NullOr(S.String).pipe(T.Body("mtls_certificate_id")), ), sslmode: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "ConfigsCreateResponseMtls", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateConfigResponse { /** Define configurations using a unique string identifier. */ id: string; /** The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. */ name: string; origin: ConfigsCreateResponseOrigin; caching?: ConfigsCreateResponseCaching | null; /** Defines the creation time of the Hyperdrive configuration. */ createdOn?: string | null; /** Defines the last modified time of the Hyperdrive configuration. */ modifiedOn?: string | null; /** mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. */ mtls?: ConfigsCreateResponseMtls | null; /** The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. */ originConnectionLimit?: number | null; } export const CreateConfigResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, name: S.String, origin: ConfigsCreateResponseOrigin, caching: S.optional(S.NullOr(ConfigsCreateResponseCaching)), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), mtls: S.optional(S.NullOr(ConfigsCreateResponseMtls)), originConnectionLimit: S.optional( S.NullOr(S.Number).pipe(T.Body("origin_connection_limit")), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateConfigResponse", }) as any as S.Schema; export interface DeleteConfigRequest { /** Define configurations using a unique string identifier. */ accountId: string; /** Define configurations using a unique string identifier. */ hyperdriveId: string; } export const DeleteConfigRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), hyperdriveId: S.String.pipe(T.Label("hyperdrive_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteConfigRequest", }) as any as S.Schema; export type DeleteConfigResponse = unknown; export const DeleteConfigResponse = /*@__PURE__*/ S.suspend(() => S.Unknown.pipe(T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteConfigResponse", }) as any as S.Schema; export interface GetConfigRequest { /** Define configurations using a unique string identifier. */ accountId: string; /** Define configurations using a unique string identifier. */ hyperdriveId: string; } export const GetConfigRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), hyperdriveId: S.String.pipe(T.Label("hyperdrive_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetConfigRequest", }) as any as S.Schema; export type ConfigsGetResponseOriginPublicDatabaseScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsGetResponseOriginPublicDatabaseScheme = /*@__PURE__*/ S.String; export interface ConfigsGetResponseOriginPublicDatabase { /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. */ port: number; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsGetResponseOriginPublicDatabaseScheme; /** Set the user of your origin database. */ user: string; } export const ConfigsGetResponseOriginPublicDatabase = /*@__PURE__*/ S.suspend( () => S.Struct({ database: S.String, host: S.String, port: S.Number, scheme: ConfigsGetResponseOriginPublicDatabaseScheme, user: S.String, }), ).annotate({ identifier: "ConfigsGetResponseOriginPublicDatabase", }) as any as S.Schema; export type ConfigsGetResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsGetResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = /*@__PURE__*/ S.String; export interface ConfigsGetResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel { /** Defines the Client ID of the Access token to use when connecting to the origin database. */ accessClientId: string; /** Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. */ accessClientSecret: string; /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsGetResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme; /** Set the user of your origin database. */ user: string; } export const ConfigsGetResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel = /*@__PURE__*/ S.suspend(() => S.Struct({ accessClientId: S.String.pipe(T.Body("access_client_id")), accessClientSecret: S.String.pipe(T.Body("access_client_secret")), database: S.String, host: S.String, scheme: ConfigsGetResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme, user: S.String, }), ).annotate({ identifier: "ConfigsGetResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel", }) as any as S.Schema; export type ConfigsGetResponseOriginDatabaseReachableThroughAWorkersVPCScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsGetResponseOriginDatabaseReachableThroughAWorkersVPCScheme = /*@__PURE__*/ S.String; export interface ConfigsGetResponseOriginDatabaseReachableThroughAWorkersVPC { /** Set the name of your origin database. */ database: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsGetResponseOriginDatabaseReachableThroughAWorkersVPCScheme; /** The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. */ serviceId: string; /** Set the user of your origin database. */ user: string; } export const ConfigsGetResponseOriginDatabaseReachableThroughAWorkersVPC = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.String, scheme: ConfigsGetResponseOriginDatabaseReachableThroughAWorkersVPCScheme, serviceId: S.String.pipe(T.Body("service_id")), user: S.String, }), ).annotate({ identifier: "ConfigsGetResponseOriginDatabaseReachableThroughAWorkersVPC", }) as any as S.Schema; export type ConfigsGetResponseOrigin = | ConfigsGetResponseOriginPublicDatabase | ConfigsGetResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel | ConfigsGetResponseOriginDatabaseReachableThroughAWorkersVPC; export const ConfigsGetResponseOrigin = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([ ["database", "host", "port", "scheme", "user"], [ "accessClientId", "accessClientSecret", "database", "host", "scheme", "user", ], ["database", "scheme", "serviceId", "user"], ]), ); export type ConfigsGetResponseCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon; export const ConfigsGetResponseCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon; export type ConfigsGetResponseCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsGetResponseCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export type ConfigsGetResponseCaching = | ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon | ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsGetResponseCaching = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([["disabled"], ["disabled", "maxAge", "staleWhileRevalidate"]]), ); export type ConfigsGetResponseMtls = ConfigsCreateResponseMtls; export const ConfigsGetResponseMtls = ConfigsCreateResponseMtls; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetConfigResponse { /** Define configurations using a unique string identifier. */ id: string; /** The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. */ name: string; origin: ConfigsGetResponseOrigin; caching?: ConfigsGetResponseCaching | null; /** Defines the creation time of the Hyperdrive configuration. */ createdOn?: string | null; /** Defines the last modified time of the Hyperdrive configuration. */ modifiedOn?: string | null; /** mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. */ mtls?: ConfigsCreateResponseMtls | null; /** The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. */ originConnectionLimit?: number | null; } export const GetConfigResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, name: S.String, origin: ConfigsGetResponseOrigin, caching: S.optional(S.NullOr(ConfigsGetResponseCaching)), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), mtls: S.optional(S.NullOr(ConfigsCreateResponseMtls)), originConnectionLimit: S.optional( S.NullOr(S.Number).pipe(T.Body("origin_connection_limit")), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetConfigResponse", }) as any as S.Schema; export interface ListConfigsRequest { /** Define configurations using a unique string identifier. */ accountId: string; } export const ListConfigsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/hyperdrive/configs", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListConfigsRequest", }) as any as S.Schema; export type ConfigsListResultItemOriginPublicDatabaseScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsListResultItemOriginPublicDatabaseScheme = /*@__PURE__*/ S.String; export interface ConfigsListResultItemOriginPublicDatabase { /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. */ port: number; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsListResultItemOriginPublicDatabaseScheme; /** Set the user of your origin database. */ user: string; } export const ConfigsListResultItemOriginPublicDatabase = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.String, host: S.String, port: S.Number, scheme: ConfigsListResultItemOriginPublicDatabaseScheme, user: S.String, }), ).annotate({ identifier: "ConfigsListResultItemOriginPublicDatabase", }) as any as S.Schema; export type ConfigsListResultItemOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsListResultItemOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = /*@__PURE__*/ S.String; export interface ConfigsListResultItemOriginAccessProtectedDatabaseBehindCloudflareTunnel { /** Defines the Client ID of the Access token to use when connecting to the origin database. */ accessClientId: string; /** Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. */ accessClientSecret: string; /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsListResultItemOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme; /** Set the user of your origin database. */ user: string; } export const ConfigsListResultItemOriginAccessProtectedDatabaseBehindCloudflareTunnel = /*@__PURE__*/ S.suspend(() => S.Struct({ accessClientId: S.String.pipe(T.Body("access_client_id")), accessClientSecret: S.String.pipe(T.Body("access_client_secret")), database: S.String, host: S.String, scheme: ConfigsListResultItemOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme, user: S.String, }), ).annotate({ identifier: "ConfigsListResultItemOriginAccessProtectedDatabaseBehindCloudflareTunnel", }) as any as S.Schema; export type ConfigsListResultItemOriginDatabaseReachableThroughAWorkersVPCScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsListResultItemOriginDatabaseReachableThroughAWorkersVPCScheme = /*@__PURE__*/ S.String; export interface ConfigsListResultItemOriginDatabaseReachableThroughAWorkersVPC { /** Set the name of your origin database. */ database: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsListResultItemOriginDatabaseReachableThroughAWorkersVPCScheme; /** The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. */ serviceId: string; /** Set the user of your origin database. */ user: string; } export const ConfigsListResultItemOriginDatabaseReachableThroughAWorkersVPC = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.String, scheme: ConfigsListResultItemOriginDatabaseReachableThroughAWorkersVPCScheme, serviceId: S.String.pipe(T.Body("service_id")), user: S.String, }), ).annotate({ identifier: "ConfigsListResultItemOriginDatabaseReachableThroughAWorkersVPC", }) as any as S.Schema; export type ConfigsListResultItemOrigin = | ConfigsListResultItemOriginPublicDatabase | ConfigsListResultItemOriginAccessProtectedDatabaseBehindCloudflareTunnel | ConfigsListResultItemOriginDatabaseReachableThroughAWorkersVPC; export const ConfigsListResultItemOrigin = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([ ["database", "host", "port", "scheme", "user"], [ "accessClientId", "accessClientSecret", "database", "host", "scheme", "user", ], ["database", "scheme", "serviceId", "user"], ]), ); export type ConfigsListResultItemCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon; export const ConfigsListResultItemCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon; export type ConfigsListResultItemCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsListResultItemCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export type ConfigsListResultItemCaching = | ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon | ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsListResultItemCaching = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([["disabled"], ["disabled", "maxAge", "staleWhileRevalidate"]]), ); export type ConfigsListResultItemMtls = ConfigsCreateResponseMtls; export const ConfigsListResultItemMtls = ConfigsCreateResponseMtls; export interface ConfigsListResultItem { /** Define configurations using a unique string identifier. */ id: string; /** The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. */ name: string; origin: ConfigsListResultItemOrigin; caching?: ConfigsListResultItemCaching | null; /** Defines the creation time of the Hyperdrive configuration. */ createdOn?: string | null; /** Defines the last modified time of the Hyperdrive configuration. */ modifiedOn?: string | null; /** mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. */ mtls?: ConfigsCreateResponseMtls | null; /** The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. */ originConnectionLimit?: number | null; } export const ConfigsListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, name: S.String, origin: ConfigsListResultItemOrigin, caching: S.optional(S.NullOr(ConfigsListResultItemCaching)), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), mtls: S.optional(S.NullOr(ConfigsCreateResponseMtls)), originConnectionLimit: S.optional( S.NullOr(S.Number).pipe(T.Body("origin_connection_limit")), ), }), ).annotate({ identifier: "ConfigsListResultItem", }) as any as S.Schema; export type ConfigsListResultList = Array; export const ConfigsListResultList = /*@__PURE__*/ S.Array( ConfigsListResultItem, ) as any as S.Schema; export interface ListConfigsResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: ConfigsListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListConfigsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: ConfigsListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListConfigsResponse", }) as any as S.Schema; export type ConfigsEditRequestCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateRequestCachingHyperdriveHyperdriveCachingCommon; export const ConfigsEditRequestCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateRequestCachingHyperdriveHyperdriveCachingCommon; export type ConfigsEditRequestCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateRequestCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsEditRequestCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateRequestCachingHyperdriveHyperdriveCachingEnabled; export type ConfigsEditRequestCaching = | ConfigsCreateRequestCachingHyperdriveHyperdriveCachingCommon | ConfigsCreateRequestCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsEditRequestCaching = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([["disabled"], ["disabled", "maxAge", "staleWhileRevalidate"]]), ); export type ConfigsEditRequestMtls = ConfigsCreateRequestMtls; export const ConfigsEditRequestMtls = ConfigsCreateRequestMtls; export type ConfigsEditRequestOriginHyperdriveHyperdriveDatabaseScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsEditRequestOriginHyperdriveHyperdriveDatabaseScheme = /*@__PURE__*/ S.String; export interface ConfigsEditRequestOriginHyperdriveHyperdriveDatabase { /** Set the name of your origin database. */ database?: string; /** Set the password needed to access your origin database. The API never returns this write-only value. */ password?: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme?: | ConfigsEditRequestOriginHyperdriveHyperdriveDatabaseScheme | (string & {}); /** Set the user of your origin database. */ user?: string; } export const ConfigsEditRequestOriginHyperdriveHyperdriveDatabase = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.optional(S.String), password: S.optional(S.String), scheme: S.optional( ConfigsEditRequestOriginHyperdriveHyperdriveDatabaseScheme, ), user: S.optional(S.String), }), ).annotate({ identifier: "ConfigsEditRequestOriginHyperdriveHyperdriveDatabase", }) as any as S.Schema; export interface ConfigsEditRequestOriginHyperdriveInternetOrigin { /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. */ port: number; } export const ConfigsEditRequestOriginHyperdriveInternetOrigin = /*@__PURE__*/ S.suspend(() => S.Struct({ host: S.String, port: S.Number, }), ).annotate({ identifier: "ConfigsEditRequestOriginHyperdriveInternetOrigin", }) as any as S.Schema; export interface ConfigsEditRequestOriginHyperdriveOverAccessOrigin { /** Defines the Client ID of the Access token to use when connecting to the origin database. */ accessClientId: string; /** Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. */ accessClientSecret: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; } export const ConfigsEditRequestOriginHyperdriveOverAccessOrigin = /*@__PURE__*/ S.suspend(() => S.Struct({ accessClientId: S.String.pipe(T.Body("access_client_id")), accessClientSecret: S.String.pipe(T.Body("access_client_secret")), host: S.String, }), ).annotate({ identifier: "ConfigsEditRequestOriginHyperdriveOverAccessOrigin", }) as any as S.Schema; export interface ConfigsEditRequestOriginHyperdriveVPCServiceOrigin { /** The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. */ serviceId: string; } export const ConfigsEditRequestOriginHyperdriveVPCServiceOrigin = /*@__PURE__*/ S.suspend(() => S.Struct({ serviceId: S.String.pipe(T.Body("service_id")), }), ).annotate({ identifier: "ConfigsEditRequestOriginHyperdriveVPCServiceOrigin", }) as any as S.Schema; export type ConfigsEditRequestOrigin = | ConfigsEditRequestOriginHyperdriveHyperdriveDatabase | ConfigsEditRequestOriginHyperdriveInternetOrigin | ConfigsEditRequestOriginHyperdriveOverAccessOrigin | ConfigsEditRequestOriginHyperdriveVPCServiceOrigin; export const ConfigsEditRequestOrigin = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([ ["database", "password", "scheme", "user"], ["host", "port"], ["accessClientId", "accessClientSecret", "host"], ["serviceId"], ]), ); export interface PatchConfigRequest { /** Define configurations using a unique string identifier. */ accountId: string; /** Define configurations using a unique string identifier. */ hyperdriveId: string; caching?: ConfigsEditRequestCaching; /** mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. */ mtls?: ConfigsCreateRequestMtls; /** The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. */ name?: string; /** Connect to a database through a Workers VPC Service. TLS settings (mTLS, sslmode) cannot be configured on the Hyperdrive when using a VPC Service origin; TLS must be managed on the VPC Service itself. */ origin?: ConfigsEditRequestOrigin; /** The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. */ originConnectionLimit?: number; } export const PatchConfigRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), hyperdriveId: S.String.pipe(T.Label("hyperdrive_id")), caching: S.optional(ConfigsEditRequestCaching), mtls: S.optional(ConfigsCreateRequestMtls), name: S.optional(S.String), origin: S.optional(ConfigsEditRequestOrigin), originConnectionLimit: S.optional( S.Number.pipe(T.Body("origin_connection_limit")), ), }) .pipe( T.Http({ method: "PATCH", uri: "/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchConfigRequest", }) as any as S.Schema; export type ConfigsEditResponseOriginPublicDatabaseScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsEditResponseOriginPublicDatabaseScheme = /*@__PURE__*/ S.String; export interface ConfigsEditResponseOriginPublicDatabase { /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. */ port: number; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsEditResponseOriginPublicDatabaseScheme; /** Set the user of your origin database. */ user: string; } export const ConfigsEditResponseOriginPublicDatabase = /*@__PURE__*/ S.suspend( () => S.Struct({ database: S.String, host: S.String, port: S.Number, scheme: ConfigsEditResponseOriginPublicDatabaseScheme, user: S.String, }), ).annotate({ identifier: "ConfigsEditResponseOriginPublicDatabase", }) as any as S.Schema; export type ConfigsEditResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsEditResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = /*@__PURE__*/ S.String; export interface ConfigsEditResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel { /** Defines the Client ID of the Access token to use when connecting to the origin database. */ accessClientId: string; /** Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. */ accessClientSecret: string; /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsEditResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme; /** Set the user of your origin database. */ user: string; } export const ConfigsEditResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel = /*@__PURE__*/ S.suspend(() => S.Struct({ accessClientId: S.String.pipe(T.Body("access_client_id")), accessClientSecret: S.String.pipe(T.Body("access_client_secret")), database: S.String, host: S.String, scheme: ConfigsEditResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme, user: S.String, }), ).annotate({ identifier: "ConfigsEditResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel", }) as any as S.Schema; export type ConfigsEditResponseOriginDatabaseReachableThroughAWorkersVPCScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsEditResponseOriginDatabaseReachableThroughAWorkersVPCScheme = /*@__PURE__*/ S.String; export interface ConfigsEditResponseOriginDatabaseReachableThroughAWorkersVPC { /** Set the name of your origin database. */ database: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsEditResponseOriginDatabaseReachableThroughAWorkersVPCScheme; /** The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. */ serviceId: string; /** Set the user of your origin database. */ user: string; } export const ConfigsEditResponseOriginDatabaseReachableThroughAWorkersVPC = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.String, scheme: ConfigsEditResponseOriginDatabaseReachableThroughAWorkersVPCScheme, serviceId: S.String.pipe(T.Body("service_id")), user: S.String, }), ).annotate({ identifier: "ConfigsEditResponseOriginDatabaseReachableThroughAWorkersVPC", }) as any as S.Schema; export type ConfigsEditResponseOrigin = | ConfigsEditResponseOriginPublicDatabase | ConfigsEditResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel | ConfigsEditResponseOriginDatabaseReachableThroughAWorkersVPC; export const ConfigsEditResponseOrigin = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([ ["database", "host", "port", "scheme", "user"], [ "accessClientId", "accessClientSecret", "database", "host", "scheme", "user", ], ["database", "scheme", "serviceId", "user"], ]), ); export type ConfigsEditResponseCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon; export const ConfigsEditResponseCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon; export type ConfigsEditResponseCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsEditResponseCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export type ConfigsEditResponseCaching = | ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon | ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsEditResponseCaching = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([["disabled"], ["disabled", "maxAge", "staleWhileRevalidate"]]), ); export type ConfigsEditResponseMtls = ConfigsCreateResponseMtls; export const ConfigsEditResponseMtls = ConfigsCreateResponseMtls; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface PatchConfigResponse { /** Define configurations using a unique string identifier. */ id: string; /** The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. */ name: string; origin: ConfigsEditResponseOrigin; caching?: ConfigsEditResponseCaching | null; /** Defines the creation time of the Hyperdrive configuration. */ createdOn?: string | null; /** Defines the last modified time of the Hyperdrive configuration. */ modifiedOn?: string | null; /** mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. */ mtls?: ConfigsCreateResponseMtls | null; /** The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. */ originConnectionLimit?: number | null; } export const PatchConfigResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, name: S.String, origin: ConfigsEditResponseOrigin, caching: S.optional(S.NullOr(ConfigsEditResponseCaching)), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), mtls: S.optional(S.NullOr(ConfigsCreateResponseMtls)), originConnectionLimit: S.optional( S.NullOr(S.Number).pipe(T.Body("origin_connection_limit")), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchConfigResponse", }) as any as S.Schema; export type ConfigsUpdateRequestOriginPublicDatabaseScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsUpdateRequestOriginPublicDatabaseScheme = /*@__PURE__*/ S.String; export interface ConfigsUpdateRequestOriginPublicDatabase { /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Set the password needed to access your origin database. The API never returns this write-only value. */ password: string; /** Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. */ port: number; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsUpdateRequestOriginPublicDatabaseScheme | (string & {}); /** Set the user of your origin database. */ user: string; } export const ConfigsUpdateRequestOriginPublicDatabase = /*@__PURE__*/ S.suspend( () => S.Struct({ database: S.String, host: S.String, password: S.String, port: S.Number, scheme: ConfigsUpdateRequestOriginPublicDatabaseScheme, user: S.String, }), ).annotate({ identifier: "ConfigsUpdateRequestOriginPublicDatabase", }) as any as S.Schema; export type ConfigsUpdateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsUpdateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = /*@__PURE__*/ S.String; export interface ConfigsUpdateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnel { /** Defines the Client ID of the Access token to use when connecting to the origin database. */ accessClientId: string; /** Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. */ accessClientSecret: string; /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Set the password needed to access your origin database. The API never returns this write-only value. */ password: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: | ConfigsUpdateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme | (string & {}); /** Set the user of your origin database. */ user: string; } export const ConfigsUpdateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnel = /*@__PURE__*/ S.suspend(() => S.Struct({ accessClientId: S.String.pipe(T.Body("access_client_id")), accessClientSecret: S.String.pipe(T.Body("access_client_secret")), database: S.String, host: S.String, password: S.String, scheme: ConfigsUpdateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme, user: S.String, }), ).annotate({ identifier: "ConfigsUpdateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnel", }) as any as S.Schema; export type ConfigsUpdateRequestOriginDatabaseReachableThroughAWorkersVPCScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsUpdateRequestOriginDatabaseReachableThroughAWorkersVPCScheme = /*@__PURE__*/ S.String; export interface ConfigsUpdateRequestOriginDatabaseReachableThroughAWorkersVPC { /** Set the name of your origin database. */ database: string; /** Set the password needed to access your origin database. The API never returns this write-only value. */ password: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: | ConfigsUpdateRequestOriginDatabaseReachableThroughAWorkersVPCScheme | (string & {}); /** The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. */ serviceId: string; /** Set the user of your origin database. */ user: string; } export const ConfigsUpdateRequestOriginDatabaseReachableThroughAWorkersVPC = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.String, password: S.String, scheme: ConfigsUpdateRequestOriginDatabaseReachableThroughAWorkersVPCScheme, serviceId: S.String.pipe(T.Body("service_id")), user: S.String, }), ).annotate({ identifier: "ConfigsUpdateRequestOriginDatabaseReachableThroughAWorkersVPC", }) as any as S.Schema; export type ConfigsUpdateRequestOrigin = | ConfigsUpdateRequestOriginPublicDatabase | ConfigsUpdateRequestOriginAccessProtectedDatabaseBehindCloudflareTunnel | ConfigsUpdateRequestOriginDatabaseReachableThroughAWorkersVPC; export const ConfigsUpdateRequestOrigin = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([ ["database", "host", "password", "port", "scheme", "user"], [ "accessClientId", "accessClientSecret", "database", "host", "password", "scheme", "user", ], ["database", "password", "scheme", "serviceId", "user"], ]), ); export type ConfigsUpdateRequestCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateRequestCachingHyperdriveHyperdriveCachingCommon; export const ConfigsUpdateRequestCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateRequestCachingHyperdriveHyperdriveCachingCommon; export type ConfigsUpdateRequestCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateRequestCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsUpdateRequestCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateRequestCachingHyperdriveHyperdriveCachingEnabled; export type ConfigsUpdateRequestCaching = | ConfigsCreateRequestCachingHyperdriveHyperdriveCachingCommon | ConfigsCreateRequestCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsUpdateRequestCaching = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([["disabled"], ["disabled", "maxAge", "staleWhileRevalidate"]]), ); export type ConfigsUpdateRequestMtls = ConfigsCreateRequestMtls; export const ConfigsUpdateRequestMtls = ConfigsCreateRequestMtls; export interface UpdateConfigRequest { /** Define configurations using a unique string identifier. */ accountId: string; /** Define configurations using a unique string identifier. */ hyperdriveId: string; /** The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. */ name: string; origin: ConfigsUpdateRequestOrigin; caching?: ConfigsUpdateRequestCaching; /** mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. */ mtls?: ConfigsCreateRequestMtls; /** The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. */ originConnectionLimit?: number; } export const UpdateConfigRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), hyperdriveId: S.String.pipe(T.Label("hyperdrive_id")), name: S.String, origin: ConfigsUpdateRequestOrigin, caching: S.optional(ConfigsUpdateRequestCaching), mtls: S.optional(ConfigsCreateRequestMtls), originConnectionLimit: S.optional( S.Number.pipe(T.Body("origin_connection_limit")), ), }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateConfigRequest", }) as any as S.Schema; export type ConfigsUpdateResponseOriginPublicDatabaseScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsUpdateResponseOriginPublicDatabaseScheme = /*@__PURE__*/ S.String; export interface ConfigsUpdateResponseOriginPublicDatabase { /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified. */ port: number; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsUpdateResponseOriginPublicDatabaseScheme; /** Set the user of your origin database. */ user: string; } export const ConfigsUpdateResponseOriginPublicDatabase = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.String, host: S.String, port: S.Number, scheme: ConfigsUpdateResponseOriginPublicDatabaseScheme, user: S.String, }), ).annotate({ identifier: "ConfigsUpdateResponseOriginPublicDatabase", }) as any as S.Schema; export type ConfigsUpdateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsUpdateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme = /*@__PURE__*/ S.String; export interface ConfigsUpdateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel { /** Defines the Client ID of the Access token to use when connecting to the origin database. */ accessClientId: string; /** Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value. */ accessClientSecret: string; /** Set the name of your origin database. */ database: string; /** Defines the host (hostname or IP) of your origin database. */ host: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsUpdateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme; /** Set the user of your origin database. */ user: string; } export const ConfigsUpdateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel = /*@__PURE__*/ S.suspend(() => S.Struct({ accessClientId: S.String.pipe(T.Body("access_client_id")), accessClientSecret: S.String.pipe(T.Body("access_client_secret")), database: S.String, host: S.String, scheme: ConfigsUpdateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnelScheme, user: S.String, }), ).annotate({ identifier: "ConfigsUpdateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel", }) as any as S.Schema; export type ConfigsUpdateResponseOriginDatabaseReachableThroughAWorkersVPCScheme = | "postgres" | "postgresql" | "mysql"; export const ConfigsUpdateResponseOriginDatabaseReachableThroughAWorkersVPCScheme = /*@__PURE__*/ S.String; export interface ConfigsUpdateResponseOriginDatabaseReachableThroughAWorkersVPC { /** Set the name of your origin database. */ database: string; /** Specifies the URL scheme used to connect to your origin database. */ scheme: ConfigsUpdateResponseOriginDatabaseReachableThroughAWorkersVPCScheme; /** The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. */ serviceId: string; /** Set the user of your origin database. */ user: string; } export const ConfigsUpdateResponseOriginDatabaseReachableThroughAWorkersVPC = /*@__PURE__*/ S.suspend(() => S.Struct({ database: S.String, scheme: ConfigsUpdateResponseOriginDatabaseReachableThroughAWorkersVPCScheme, serviceId: S.String.pipe(T.Body("service_id")), user: S.String, }), ).annotate({ identifier: "ConfigsUpdateResponseOriginDatabaseReachableThroughAWorkersVPC", }) as any as S.Schema; export type ConfigsUpdateResponseOrigin = | ConfigsUpdateResponseOriginPublicDatabase | ConfigsUpdateResponseOriginAccessProtectedDatabaseBehindCloudflareTunnel | ConfigsUpdateResponseOriginDatabaseReachableThroughAWorkersVPC; export const ConfigsUpdateResponseOrigin = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([ ["database", "host", "port", "scheme", "user"], [ "accessClientId", "accessClientSecret", "database", "host", "scheme", "user", ], ["database", "scheme", "serviceId", "user"], ]), ); export type ConfigsUpdateResponseCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon; export const ConfigsUpdateResponseCachingHyperdriveHyperdriveCachingCommon = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon; export type ConfigsUpdateResponseCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsUpdateResponseCachingHyperdriveHyperdriveCachingEnabled = ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export type ConfigsUpdateResponseCaching = | ConfigsCreateResponseCachingHyperdriveHyperdriveCachingCommon | ConfigsCreateResponseCachingHyperdriveHyperdriveCachingEnabled; export const ConfigsUpdateResponseCaching = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([["disabled"], ["disabled", "maxAge", "staleWhileRevalidate"]]), ); export type ConfigsUpdateResponseMtls = ConfigsCreateResponseMtls; export const ConfigsUpdateResponseMtls = ConfigsCreateResponseMtls; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateConfigResponse { /** Define configurations using a unique string identifier. */ id: string; /** The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. */ name: string; origin: ConfigsUpdateResponseOrigin; caching?: ConfigsUpdateResponseCaching | null; /** Defines the creation time of the Hyperdrive configuration. */ createdOn?: string | null; /** Defines the last modified time of the Hyperdrive configuration. */ modifiedOn?: string | null; /** mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. */ mtls?: ConfigsCreateResponseMtls | null; /** The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database. */ originConnectionLimit?: number | null; } export const UpdateConfigResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, name: S.String, origin: ConfigsUpdateResponseOrigin, caching: S.optional(S.NullOr(ConfigsUpdateResponseCaching)), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), mtls: S.optional(S.NullOr(ConfigsCreateResponseMtls)), originConnectionLimit: S.optional( S.NullOr(S.Number).pipe(T.Body("origin_connection_limit")), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateConfigResponse", }) as any as S.Schema; export type CreateConfigError = | PrivateHostNotAllowed | InvalidHyperdriveConfig | InvalidObjectIdentifier | CloudflareOpError; /** Creates and returns a new Hyperdrive configuration. */ export const createConfig: API.OperationMethod< CreateConfigRequest, CreateConfigResponse, CreateConfigError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateConfigRequest, output: CreateConfigResponse, errors: [ PrivateHostNotAllowed, InvalidHyperdriveConfig, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteConfigError = | PrivateHostNotAllowed | HyperdriveConfigNotFound | InvalidObjectIdentifier | MethodNotAllowed | CloudflareOpError; /** Deletes the specified Hyperdrive. */ export const deleteConfig: API.OperationMethod< DeleteConfigRequest, DeleteConfigResponse, DeleteConfigError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteConfigRequest, output: DeleteConfigResponse, errors: [ PrivateHostNotAllowed, HyperdriveConfigNotFound, InvalidObjectIdentifier, MethodNotAllowed, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetConfigError = | PrivateHostNotAllowed | HyperdriveConfigNotFound | InvalidObjectIdentifier | CloudflareOpError; /** Returns the specified Hyperdrive configuration. */ export const getConfig: API.OperationMethod< GetConfigRequest, GetConfigResponse, GetConfigError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetConfigRequest, output: GetConfigResponse, errors: [ PrivateHostNotAllowed, HyperdriveConfigNotFound, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListConfigsError = | PrivateHostNotAllowed | InvalidObjectIdentifier | CloudflareOpError; /** Returns a list of Hyperdrives. */ export const listConfigs: API.PaginatedOperationMethod< ListConfigsRequest, ListConfigsResponse, ListConfigsError, CloudflareOpContext, ConfigsListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListConfigsRequest, output: ListConfigsResponse, errors: [ PrivateHostNotAllowed, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type PatchConfigError = | PrivateHostNotAllowed | HyperdriveConfigNotFound | InvalidObjectIdentifier | MethodNotAllowed | CloudflareOpError; /** Patches and returns the specified Hyperdrive configuration. Custom caching settings are not kept if caching is disabled. */ export const patchConfig: API.OperationMethod< PatchConfigRequest, PatchConfigResponse, PatchConfigError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PatchConfigRequest, output: PatchConfigResponse, errors: [ PrivateHostNotAllowed, HyperdriveConfigNotFound, InvalidObjectIdentifier, MethodNotAllowed, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type UpdateConfigError = | PrivateHostNotAllowed | HyperdriveConfigNotFound | InvalidObjectIdentifier | MethodNotAllowed | CloudflareOpError; /** Updates and returns the specified Hyperdrive configuration. */ export const updateConfig: API.OperationMethod< UpdateConfigRequest, UpdateConfigResponse, UpdateConfigError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateConfigRequest, output: UpdateConfigResponse, errors: [ PrivateHostNotAllowed, HyperdriveConfigNotFound, InvalidObjectIdentifier, MethodNotAllowed, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, }));