import * as API from "@distilled.cloud/core/api"; // AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-hetzner/specs/cloud.spec.json). Do not edit. import * as S from "@distilled.cloud/core/schema-lite"; import * as __L from "@distilled.cloud/core/schema-lite"; import { UnknownHetznerError } from "../errors.ts"; import { paginatePageNumber } from "../pagination.ts"; import { HetznerProtocol, type HetznerOpError, type HetznerOpContext } from "../protocol.ts"; import * as Retry from "../retry.ts"; import * as T from "../traits.ts"; // Schema table, filled on first reach (see __S at the end). const __s: any[] = []; export type { HetznerOpError, HetznerOpContext }; export interface GetLoadBalancerTypeRequest { /** ID of the Load Balancer Type. */ id: number; } /** Describes if, when and how the resource is deprecated. If this field is set to `null` the resource is not deprecated. If a value is set, it is considered deprecated. */ export interface GetLoadBalancerTypeResponseLoadBalancerTypeDeprecation { /** Date of the deprecated resource removal. Once this date is reached, the resource will not be returned by resource type "list" endpoint, and the resource can not be used to create new resources. For example, if this is an image, you can not create new servers with this image after the mentioned date. */ unavailable_after: string; /** Date of the deprecation announcement. */ announced: string; } /** Hourly price in this [Location](#tag/locations). */ export interface GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceHourly { /** Price without VAT. */ net: string; /** Price with VAT added. */ gross: string; } /** Monthly price in this [Location](#tag/locations). */ export type GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceMonthly = GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceHourly; /** Additional traffic price per TB in this [Location](#tag/locations). */ export type GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPricePerTbTraffic = GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceHourly; export interface GetLoadBalancerTypeResponseLoadBalancerTypePricesItem { /** Name of the [Location](#tag/locations) the price is for. */ location: string; /** Hourly price in this [Location](#tag/locations). */ price_hourly: GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceHourly; /** Monthly price in this [Location](#tag/locations). */ price_monthly: GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceHourly; /** Free traffic per month in bytes in this [Location](#tag/locations). */ included_traffic: number; /** Additional traffic price per TB in this [Location](#tag/locations). */ price_per_tb_traffic: GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceHourly; } /** Price per [Location](#tag/locations). */ export type GetLoadBalancerTypeResponseLoadBalancerTypePricesList = Array; export interface GetLoadBalancerTypeResponseLoadBalancerType { /** ID of the Load Balancer type. */ id: number; /** Unique identifier of the Load Balancer type. */ name: string; /** Description of the Load Balancer type. */ description: string; /** Number of maximum simultaneous open connections. */ max_connections: number; /** Number of services a Load Balancer of this type can have. */ max_services: number; /** Number of targets a single Load Balancer can have. */ max_targets: number; /** Number of SSL Certificates that can be assigned to a single Load Balancer. */ max_assigned_certificates: number; /** **Deprecated:** This field is deprecated. Use the `deprecation` object instead. Point in time when the Load Balancer type is deprecated (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). */ deprecated: string | null; /** Describes if, when and how the resource is deprecated. If this field is set to `null` the resource is not deprecated. If a value is set, it is considered deprecated. */ deprecation: GetLoadBalancerTypeResponseLoadBalancerTypeDeprecation | null; /** Price per [Location](#tag/locations). */ prices: GetLoadBalancerTypeResponseLoadBalancerTypePricesList; } export interface GetLoadBalancerTypeResponse { load_balancer_type: GetLoadBalancerTypeResponseLoadBalancerType; } export interface ListLoadBalancerTypesRequest { /** Filter resources by their name. The response will only contain the resources matching exactly the specified name. */ name?: string; /** Page number to return. For more information, see "[Pagination](#description/pagination)". */ page?: number; /** Maximum number of entries returned per page. For more information, see "[Pagination](#description/pagination)". */ per_page?: number; } /** Describes if, when and how the resource is deprecated. If this field is set to `null` the resource is not deprecated. If a value is set, it is considered deprecated. */ export type ListLoadBalancerTypesResponseLoadBalancerTypesItemDeprecation = GetLoadBalancerTypeResponseLoadBalancerTypeDeprecation; /** Hourly price in this [Location](#tag/locations). */ export type ListLoadBalancerTypesResponseLoadBalancerTypesItemPricesItemPriceHourly = GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceHourly; /** Monthly price in this [Location](#tag/locations). */ export type ListLoadBalancerTypesResponseLoadBalancerTypesItemPricesItemPriceMonthly = GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceHourly; /** Additional traffic price per TB in this [Location](#tag/locations). */ export type ListLoadBalancerTypesResponseLoadBalancerTypesItemPricesItemPricePerTbTraffic = GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceHourly; export type ListLoadBalancerTypesResponseLoadBalancerTypesItemPricesItem = GetLoadBalancerTypeResponseLoadBalancerTypePricesItem; /** Price per [Location](#tag/locations). */ export type ListLoadBalancerTypesResponseLoadBalancerTypesItemPricesList = Array; export interface ListLoadBalancerTypesResponseLoadBalancerTypesItem { /** ID of the Load Balancer type. */ id: number; /** Unique identifier of the Load Balancer type. */ name: string; /** Description of the Load Balancer type. */ description: string; /** Number of maximum simultaneous open connections. */ max_connections: number; /** Number of services a Load Balancer of this type can have. */ max_services: number; /** Number of targets a single Load Balancer can have. */ max_targets: number; /** Number of SSL Certificates that can be assigned to a single Load Balancer. */ max_assigned_certificates: number; /** **Deprecated:** This field is deprecated. Use the `deprecation` object instead. Point in time when the Load Balancer type is deprecated (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). */ deprecated: string | null; /** Describes if, when and how the resource is deprecated. If this field is set to `null` the resource is not deprecated. If a value is set, it is considered deprecated. */ deprecation: GetLoadBalancerTypeResponseLoadBalancerTypeDeprecation | null; /** Price per [Location](#tag/locations). */ prices: ListLoadBalancerTypesResponseLoadBalancerTypesItemPricesList; } export type ListLoadBalancerTypesResponseLoadBalancerTypesList = Array; /** See "[Pagination](#description/pagination)" for more information. */ export interface ListLoadBalancerTypesResponseMetaPagination { /** Current page number. */ page: number; /** Maximum number of entries returned per page. */ per_page: number; /** Page number of the previous page. Can be null if the current page is the first one. */ previous_page: number | null; /** Page number of the next page. Can be null if the current page is the last one. */ next_page: number | null; /** Page number of the last page available. Can be null if the current page is the last one. */ last_page: number | null; /** Total number of entries that exist for this query. Can be null if unknown. */ total_entries: number | null; } export interface ListLoadBalancerTypesResponseMeta { /** See "[Pagination](#description/pagination)" for more information. */ pagination: ListLoadBalancerTypesResponseMetaPagination; } export interface ListLoadBalancerTypesResponse { load_balancer_types: ListLoadBalancerTypesResponseLoadBalancerTypesList; meta: ListLoadBalancerTypesResponseMeta; } export type GetLoadBalancerTypeError = HetznerOpError; /** Get a Load Balancer Type Gets a specific Load Balancer type object. */ export const getLoadBalancerType: API.OperationMethod< GetLoadBalancerTypeRequest, GetLoadBalancerTypeResponse, GetLoadBalancerTypeError, HetznerOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(0, __c0, 0) as any as S.Schema, output: __S(1, __c0, 1) as any as S.Schema, errors: [UnknownHetznerError], protocol: HetznerProtocol, retry: Retry.Retry, })); export type ListLoadBalancerTypesError = HetznerOpError; /** List Load Balancer Types Gets all Load Balancer type objects. */ export const listLoadBalancerTypes: API.PaginatedOperationMethod< ListLoadBalancerTypesRequest, ListLoadBalancerTypesResponse, ListLoadBalancerTypesError, HetznerOpContext, ListLoadBalancerTypesResponseLoadBalancerTypesItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: __S(16, __c2, 0) as any as S.Schema, output: __S(20, __c2, 4) as any as S.Schema, errors: [UnknownHetznerError], protocol: HetznerProtocol, retry: Retry.Retry, pagination: { mode: "page", inputToken: "page", outputToken: "meta.pagination.next_page", items: "load_balancer_types", pageSize: "per_page", } as const, }), paginatePageNumber, ) as any; // Schema builders: each runs one schema initializer, on that schema's first use. function __c0(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ id: S.Number.pipe(T.Label()), }).pipe(T.Http({ method: "GET", uri: "/load_balancer_types/{id}", code: 200 })), ).annotate({ identifier: "GetLoadBalancerTypeRequest" }); case 1: return S.suspend(() => S.Struct({ load_balancer_type: __S(12, __c1, 4), }), ).annotate({ identifier: "GetLoadBalancerTypeResponse" }); } } function __c1(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ unavailable_after: S.String, announced: S.String, }), ).annotate({ identifier: "GetLoadBalancerTypeResponseLoadBalancerTypeDeprecation" }); case 1: return S.suspend(() => S.Struct({ net: S.String, gross: S.String, }), ).annotate({ identifier: "GetLoadBalancerTypeResponseLoadBalancerTypePricesItemPriceHourly", }); case 2: return S.suspend(() => S.Struct({ location: S.String, price_hourly: __S(9, __c1, 1), price_monthly: __S(9, __c1, 1), included_traffic: S.Number, price_per_tb_traffic: __S(9, __c1, 1), }), ).annotate({ identifier: "GetLoadBalancerTypeResponseLoadBalancerTypePricesItem" }); case 3: return S.Array(__S(10, __c1, 2)); case 4: return S.suspend(() => S.Struct({ id: S.Number, name: S.String, description: S.String, max_connections: S.Number, max_services: S.Number, max_targets: S.Number, max_assigned_certificates: S.Number, deprecated: S.NullOr(S.String), deprecation: S.NullOr(__S(8, __c1, 0)), prices: __S(11, __c1, 3), }), ).annotate({ identifier: "GetLoadBalancerTypeResponseLoadBalancerType" }); } } function __c2(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ name: S.optional(S.String.pipe(T.Query())), page: S.optional(S.Number.pipe(T.Query())), per_page: S.optional(S.Number.pipe(T.Query())), }).pipe(T.Http({ method: "GET", uri: "/load_balancer_types", code: 200 })), ).annotate({ identifier: "ListLoadBalancerTypesRequest" }); case 1: return S.Array(__S(12, __c1, 4)); case 2: return S.suspend(() => S.Struct({ page: S.Number, per_page: S.Number, previous_page: S.NullOr(S.Number), next_page: S.NullOr(S.Number), last_page: S.NullOr(S.Number), total_entries: S.NullOr(S.Number), }), ).annotate({ identifier: "ListLoadBalancerTypesResponseMetaPagination" }); case 3: return S.suspend(() => S.Struct({ pagination: __S(18, __c2, 2), }), ).annotate({ identifier: "ListLoadBalancerTypesResponseMeta" }); case 4: return S.suspend(() => S.Struct({ load_balancer_types: __S(17, __c2, 1), meta: __S(19, __c2, 3), }), ).annotate({ identifier: "ListLoadBalancerTypesResponse" }); } } // Schema table: entry i is schema j of builder f, made on first reach. function __S(i: number, f: (j: number) => unknown, j: number): any { return (__s[i] ??= __L.at(f, j)); }