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 }; /** Type of the resource. */ export type ApplyFirewallToResourcesRequestApplyToItemType = "server" | "label_selector"; /** [Server](#tag/servers) the [Firewall](#tag/firewalls) is applied to. Only set for `type` `server`, otherwise `null`. */ export interface ApplyFirewallToResourcesRequestApplyToItemServer { /** ID of the [Server](#tag/servers). */ id: number; } /** [Label Selector](#description/label-selector) the [Firewall](#tag/firewalls) is applied to. Only set for `type` `label_selector`, otherwise `null`. */ export interface ApplyFirewallToResourcesRequestApplyToItemLabelSelector { /** The selector. */ selector: string; } export interface ApplyFirewallToResourcesRequestApplyToItem { /** Type of the resource. */ type: ApplyFirewallToResourcesRequestApplyToItemType | (string & {}); /** [Server](#tag/servers) the [Firewall](#tag/firewalls) is applied to. Only set for `type` `server`, otherwise `null`. */ server?: ApplyFirewallToResourcesRequestApplyToItemServer; /** [Label Selector](#description/label-selector) the [Firewall](#tag/firewalls) is applied to. Only set for `type` `label_selector`, otherwise `null`. */ label_selector?: ApplyFirewallToResourcesRequestApplyToItemLabelSelector; } /** Resources to apply the [Firewall](#tag/firewalls) to. Extends existing resources. */ export type ApplyFirewallToResourcesRequestApplyToList = Array; export interface ApplyFirewallToResourcesRequest { /** ID of the Firewall. */ id: number; /** Resources to apply the [Firewall](#tag/firewalls) to. Extends existing resources. */ apply_to: ApplyFirewallToResourcesRequestApplyToList; } /** Status of the Action. */ export type ApplyFirewallToResourcesResponseActionsItemStatus = "running" | "success" | "error"; export interface ApplyFirewallToResourcesResponseActionsItemResourcesItem { /** ID of the Resource. */ id: number; /** Type of the Resource. */ type: string; } /** Resources the Action relates to. */ export type ApplyFirewallToResourcesResponseActionsItemResourcesList = Array; /** Error message for the Action if an error occurred, otherwise null. */ export interface ApplyFirewallToResourcesResponseActionsItemError { /** Fixed error code for machines. */ code: string; /** Error message for humans. */ message: string; } export interface ApplyFirewallToResourcesResponseActionsItem { /** ID of the [Action](#description/actions). */ id: number; /** Command executed in the Action. */ command: string; /** Status of the Action. */ status: ApplyFirewallToResourcesResponseActionsItemStatus; /** Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). */ started: string; /** Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. */ finished: string | null; /** Progress of the Action in percent. */ progress: number; /** Resources the Action relates to. */ resources: ApplyFirewallToResourcesResponseActionsItemResourcesList; /** Error message for the Action if an error occurred, otherwise null. */ error: ApplyFirewallToResourcesResponseActionsItemError | null; } export type ApplyFirewallToResourcesResponseActionsList = Array; export interface ApplyFirewallToResourcesResponse { actions: ApplyFirewallToResourcesResponseActionsList; } export interface GetFirewallsActionRequest { /** ID of the Action. */ id: number; } /** Status of the Action. */ export type GetFirewallsActionResponseActionStatus = "running" | "success" | "error"; export type GetFirewallsActionResponseActionResourcesItem = ApplyFirewallToResourcesResponseActionsItemResourcesItem; /** Resources the Action relates to. */ export type GetFirewallsActionResponseActionResourcesList = Array; /** Error message for the Action if an error occurred, otherwise null. */ export type GetFirewallsActionResponseActionError = ApplyFirewallToResourcesResponseActionsItemError; export interface GetFirewallsActionResponseAction { /** ID of the [Action](#description/actions). */ id: number; /** Command executed in the Action. */ command: string; /** Status of the Action. */ status: GetFirewallsActionResponseActionStatus; /** Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). */ started: string; /** Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. */ finished: string | null; /** Progress of the Action in percent. */ progress: number; /** Resources the Action relates to. */ resources: GetFirewallsActionResponseActionResourcesList; /** Error message for the Action if an error occurred, otherwise null. */ error: ApplyFirewallToResourcesResponseActionsItemError | null; } export interface GetFirewallsActionResponse { action: GetFirewallsActionResponseAction; } export type ListFirewallActionsRequestSortItem = | "id" | "id:asc" | "id:desc" | "command" | "command:asc" | "command:desc" | "status" | "status:asc" | "status:desc" | "started" | "started:asc" | "started:desc" | "finished" | "finished:asc" | "finished:desc"; export type ListFirewallActionsRequestSortList = Array< ListFirewallActionsRequestSortItem | (string & {}) >; /** Status of the Action. */ export type ListFirewallActionsRequestStatusItem = "running" | "success" | "error"; export type ListFirewallActionsRequestStatusList = Array< ListFirewallActionsRequestStatusItem | (string & {}) >; export interface ListFirewallActionsRequest { /** ID of the Firewall. */ id: number; /** Sort actions by field and direction. May be used multiple times. For more information, see "[Sorting](#description/sorting)". */ sort?: ListFirewallActionsRequestSortList; /** Filter the actions by status. May be used multiple times. The response will only contain actions matching the specified statuses. */ status?: ListFirewallActionsRequestStatusList; /** 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; } /** Status of the Action. */ export type ListFirewallActionsResponseActionsItemStatus = "running" | "success" | "error"; export type ListFirewallActionsResponseActionsItemResourcesItem = ApplyFirewallToResourcesResponseActionsItemResourcesItem; /** Resources the Action relates to. */ export type ListFirewallActionsResponseActionsItemResourcesList = Array; /** Error message for the Action if an error occurred, otherwise null. */ export type ListFirewallActionsResponseActionsItemError = ApplyFirewallToResourcesResponseActionsItemError; export interface ListFirewallActionsResponseActionsItem { /** ID of the [Action](#description/actions). */ id: number; /** Command executed in the Action. */ command: string; /** Status of the Action. */ status: ListFirewallActionsResponseActionsItemStatus; /** Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). */ started: string; /** Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. */ finished: string | null; /** Progress of the Action in percent. */ progress: number; /** Resources the Action relates to. */ resources: ListFirewallActionsResponseActionsItemResourcesList; /** Error message for the Action if an error occurred, otherwise null. */ error: ApplyFirewallToResourcesResponseActionsItemError | null; } export type ListFirewallActionsResponseActionsList = Array; /** See "[Pagination](#description/pagination)" for more information. */ export interface ListFirewallActionsResponseMetaPagination { /** 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 ListFirewallActionsResponseMeta { /** See "[Pagination](#description/pagination)" for more information. */ pagination: ListFirewallActionsResponseMetaPagination; } export interface ListFirewallActionsResponse { actions: ListFirewallActionsResponseActionsList; meta: ListFirewallActionsResponseMeta; } export type ListFirewallsActionsRequestIdList = Array; export type ListFirewallsActionsRequestSortItem = | "id" | "id:asc" | "id:desc" | "command" | "command:asc" | "command:desc" | "status" | "status:asc" | "status:desc" | "started" | "started:asc" | "started:desc" | "finished" | "finished:asc" | "finished:desc"; export type ListFirewallsActionsRequestSortList = Array< ListFirewallsActionsRequestSortItem | (string & {}) >; /** Status of the Action. */ export type ListFirewallsActionsRequestStatusItem = "running" | "success" | "error"; export type ListFirewallsActionsRequestStatusList = Array< ListFirewallsActionsRequestStatusItem | (string & {}) >; export interface ListFirewallsActionsRequest { /** Filter the actions by ID. May be used multiple times. The response will only contain actions matching the specified IDs. */ id?: ListFirewallsActionsRequestIdList; /** Sort actions by field and direction. May be used multiple times. For more information, see "[Sorting](#description/sorting)". */ sort?: ListFirewallsActionsRequestSortList; /** Filter the actions by status. May be used multiple times. The response will only contain actions matching the specified statuses. */ status?: ListFirewallsActionsRequestStatusList; /** 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; } /** Status of the Action. */ export type ListFirewallsActionsResponseActionsItemStatus = "running" | "success" | "error"; export type ListFirewallsActionsResponseActionsItemResourcesItem = ApplyFirewallToResourcesResponseActionsItemResourcesItem; /** Resources the Action relates to. */ export type ListFirewallsActionsResponseActionsItemResourcesList = Array; /** Error message for the Action if an error occurred, otherwise null. */ export type ListFirewallsActionsResponseActionsItemError = ApplyFirewallToResourcesResponseActionsItemError; export interface ListFirewallsActionsResponseActionsItem { /** ID of the [Action](#description/actions). */ id: number; /** Command executed in the Action. */ command: string; /** Status of the Action. */ status: ListFirewallsActionsResponseActionsItemStatus; /** Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). */ started: string; /** Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. */ finished: string | null; /** Progress of the Action in percent. */ progress: number; /** Resources the Action relates to. */ resources: ListFirewallsActionsResponseActionsItemResourcesList; /** Error message for the Action if an error occurred, otherwise null. */ error: ApplyFirewallToResourcesResponseActionsItemError | null; } export type ListFirewallsActionsResponseActionsList = Array; /** See "[Pagination](#description/pagination)" for more information. */ export type ListFirewallsActionsResponseMetaPagination = ListFirewallActionsResponseMetaPagination; export type ListFirewallsActionsResponseMeta = ListFirewallActionsResponseMeta; export interface ListFirewallsActionsResponse { actions: ListFirewallsActionsResponseActionsList; meta: ListFirewallActionsResponseMeta; } /** Type of the resource. */ export type RemoveFirewallFromResourcesRequestRemoveFromItemType = "server" | "label_selector"; /** [Server](#tag/servers) the [Firewall](#tag/firewalls) is applied to. Only set for `type` `server`, otherwise `null`. */ export type RemoveFirewallFromResourcesRequestRemoveFromItemServer = ApplyFirewallToResourcesRequestApplyToItemServer; /** [Label Selector](#description/label-selector) the [Firewall](#tag/firewalls) is applied to. Only set for `type` `label_selector`, otherwise `null`. */ export type RemoveFirewallFromResourcesRequestRemoveFromItemLabelSelector = ApplyFirewallToResourcesRequestApplyToItemLabelSelector; export interface RemoveFirewallFromResourcesRequestRemoveFromItem { /** Type of the resource. */ type: RemoveFirewallFromResourcesRequestRemoveFromItemType | (string & {}); /** [Server](#tag/servers) the [Firewall](#tag/firewalls) is applied to. Only set for `type` `server`, otherwise `null`. */ server?: ApplyFirewallToResourcesRequestApplyToItemServer; /** [Label Selector](#description/label-selector) the [Firewall](#tag/firewalls) is applied to. Only set for `type` `label_selector`, otherwise `null`. */ label_selector?: ApplyFirewallToResourcesRequestApplyToItemLabelSelector; } /** Resources to remove the [Firewall](#tag/firewalls) from. */ export type RemoveFirewallFromResourcesRequestRemoveFromList = Array; export interface RemoveFirewallFromResourcesRequest { /** ID of the Firewall. */ id: number; /** Resources to remove the [Firewall](#tag/firewalls) from. */ remove_from: RemoveFirewallFromResourcesRequestRemoveFromList; } /** Status of the Action. */ export type RemoveFirewallFromResourcesResponseActionsItemStatus = "running" | "success" | "error"; export type RemoveFirewallFromResourcesResponseActionsItemResourcesItem = ApplyFirewallToResourcesResponseActionsItemResourcesItem; /** Resources the Action relates to. */ export type RemoveFirewallFromResourcesResponseActionsItemResourcesList = Array; /** Error message for the Action if an error occurred, otherwise null. */ export type RemoveFirewallFromResourcesResponseActionsItemError = ApplyFirewallToResourcesResponseActionsItemError; export interface RemoveFirewallFromResourcesResponseActionsItem { /** ID of the [Action](#description/actions). */ id: number; /** Command executed in the Action. */ command: string; /** Status of the Action. */ status: RemoveFirewallFromResourcesResponseActionsItemStatus; /** Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). */ started: string; /** Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. */ finished: string | null; /** Progress of the Action in percent. */ progress: number; /** Resources the Action relates to. */ resources: RemoveFirewallFromResourcesResponseActionsItemResourcesList; /** Error message for the Action if an error occurred, otherwise null. */ error: ApplyFirewallToResourcesResponseActionsItemError | null; } export type RemoveFirewallFromResourcesResponseActionsList = Array; export interface RemoveFirewallFromResourcesResponse { actions: RemoveFirewallFromResourcesResponseActionsList; } /** Traffic direction in which the rule should be applied to. Use `source_ips` for direction `in` and `destination_ips` for direction `out` to specify IPs. */ export type SetFirewallRulesRequestRulesItemDirection = "in" | "out"; /** List of permitted IPv4/IPv6 addresses for incoming traffic. The `direction` must be set to `in`. IPs must be provided in [CIDR block notation](https://wikipedia.org/wiki/CIDR). You can specify 100 CIDR blocks at most. The CIDR blocks may refer to networks (with empty host bits) or single hosts. For example, a network could be defined with `10.0.1.0/24` or `2001:db8:ff00:42::/64`, and a single host with `10.0.1.1/32` or `2001:db8:ff00:42::8329/128`. Use `0.0.0.0/0` to allow any IPv4 addresses and `::/0` to allow any IPv6 addresses. IPv6 CIDRs will be transformed to their canonical form according to [RFC5952](https://datatracker.ietf.org/doc/html/rfc5952#section-4). */ export type SetFirewallRulesRequestRulesItemSourceIpsList = Array; /** List of permitted IPv4/IPv6 addresses for outgoing traffic. The `direction` must be set to `out`. IPs must be in [CIDR block notation](https://wikipedia.org/wiki/CIDR). You can specify 100 CIDR blocks at most. The CIDR blocks may refer to networks (with empty host bits) or single hosts. For example, a network could be defined with `10.0.1.0/24` or `2001:db8:ff00:42::/64`, and a single host with `10.0.1.1/32` or `2001:db8:ff00:42::8329/128`. Use `0.0.0.0/0` to allow any IPv4 addresses and `::/0` to allow any IPv6 addresses. IPv6 CIDRs will be transformed to their canonical form according to [RFC5952](https://datatracker.ietf.org/doc/html/rfc5952#section-4). */ export type SetFirewallRulesRequestRulesItemDestinationIpsList = Array; /** Network protocol to apply the rule for. */ export type SetFirewallRulesRequestRulesItemProtocol = "tcp" | "udp" | "icmp" | "esp" | "gre"; export interface SetFirewallRulesRequestRulesItem { /** Description of the rule. */ description?: string | null; /** Traffic direction in which the rule should be applied to. Use `source_ips` for direction `in` and `destination_ips` for direction `out` to specify IPs. */ direction: SetFirewallRulesRequestRulesItemDirection | (string & {}); /** List of permitted IPv4/IPv6 addresses for incoming traffic. The `direction` must be set to `in`. IPs must be provided in [CIDR block notation](https://wikipedia.org/wiki/CIDR). You can specify 100 CIDR blocks at most. The CIDR blocks may refer to networks (with empty host bits) or single hosts. For example, a network could be defined with `10.0.1.0/24` or `2001:db8:ff00:42::/64`, and a single host with `10.0.1.1/32` or `2001:db8:ff00:42::8329/128`. Use `0.0.0.0/0` to allow any IPv4 addresses and `::/0` to allow any IPv6 addresses. IPv6 CIDRs will be transformed to their canonical form according to [RFC5952](https://datatracker.ietf.org/doc/html/rfc5952#section-4). */ source_ips?: SetFirewallRulesRequestRulesItemSourceIpsList; /** List of permitted IPv4/IPv6 addresses for outgoing traffic. The `direction` must be set to `out`. IPs must be in [CIDR block notation](https://wikipedia.org/wiki/CIDR). You can specify 100 CIDR blocks at most. The CIDR blocks may refer to networks (with empty host bits) or single hosts. For example, a network could be defined with `10.0.1.0/24` or `2001:db8:ff00:42::/64`, and a single host with `10.0.1.1/32` or `2001:db8:ff00:42::8329/128`. Use `0.0.0.0/0` to allow any IPv4 addresses and `::/0` to allow any IPv6 addresses. IPv6 CIDRs will be transformed to their canonical form according to [RFC5952](https://datatracker.ietf.org/doc/html/rfc5952#section-4). */ destination_ips?: SetFirewallRulesRequestRulesItemDestinationIpsList; /** Network protocol to apply the rule for. */ protocol: SetFirewallRulesRequestRulesItemProtocol | (string & {}); /** Port or port range to apply the rule for. Only applicable for protocols `tcp` and `udp`. A port range can be specified by separating lower and upper bounds with a dash. `1024-5000` will include all ports starting from 1024 up to port 5000. */ port?: string; } /** Array of rules. Rules are limited to 50 entries per [Firewall](#tag/firewalls) and [500 effective rules](https://docs.hetzner.com/cloud/firewalls/overview#limits). Existing rules will be replaced. */ export type SetFirewallRulesRequestRulesList = Array; export interface SetFirewallRulesRequest { /** ID of the Firewall. */ id: number; /** Array of rules. Rules are limited to 50 entries per [Firewall](#tag/firewalls) and [500 effective rules](https://docs.hetzner.com/cloud/firewalls/overview#limits). Existing rules will be replaced. */ rules: SetFirewallRulesRequestRulesList; } /** Status of the Action. */ export type SetFirewallRulesResponseActionsItemStatus = "running" | "success" | "error"; export type SetFirewallRulesResponseActionsItemResourcesItem = ApplyFirewallToResourcesResponseActionsItemResourcesItem; /** Resources the Action relates to. */ export type SetFirewallRulesResponseActionsItemResourcesList = Array; /** Error message for the Action if an error occurred, otherwise null. */ export type SetFirewallRulesResponseActionsItemError = ApplyFirewallToResourcesResponseActionsItemError; export interface SetFirewallRulesResponseActionsItem { /** ID of the [Action](#description/actions). */ id: number; /** Command executed in the Action. */ command: string; /** Status of the Action. */ status: SetFirewallRulesResponseActionsItemStatus; /** Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). */ started: string; /** Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. */ finished: string | null; /** Progress of the Action in percent. */ progress: number; /** Resources the Action relates to. */ resources: SetFirewallRulesResponseActionsItemResourcesList; /** Error message for the Action if an error occurred, otherwise null. */ error: ApplyFirewallToResourcesResponseActionsItemError | null; } export type SetFirewallRulesResponseActionsList = Array; export interface SetFirewallRulesResponse { actions: SetFirewallRulesResponseActionsList; } export type ApplyFirewallToResourcesError = HetznerOpError; /** Apply to Resources Applies a [Firewall](#tag/firewalls) to multiple resources. Supported resources: - [Servers](#tag/servers) (with a public network interface) - [Label Selectors](#description/label-selector) A [Server](#tag/servers) can be applied to [a maximum of 5 Firewalls](https://docs.hetzner.com/cloud/firewalls/overview#limits). This limit applies to [Servers](#tag/servers) applied via a matching [Label Selector](#description/label-selector) as well. Updates to resources matching or no longer matching a [Label Selector](#description/label-selector) can take up to a few seconds to be processed. A [Firewall](#tag/firewalls) is applied to a resource once the related [Action](#tag/actions) with command `apply_firewall` successfully finished. #### Operation specific errors */ export const applyFirewallToResources: API.OperationMethod< ApplyFirewallToResourcesRequest, ApplyFirewallToResourcesResponse, ApplyFirewallToResourcesError, HetznerOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(0, __c0, 0) as any as S.Schema, output: __S(16, __c4, 0) as any as S.Schema, errors: [UnknownHetznerError], protocol: HetznerProtocol, retry: Retry.Retry, })); export type GetFirewallsActionError = HetznerOpError; /** Get an Action Returns the specific [Action](#tag/actions). */ export const getFirewallsAction: API.OperationMethod< GetFirewallsActionRequest, GetFirewallsActionResponse, GetFirewallsActionError, HetznerOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(20, __c5, 0) as any as S.Schema, output: __S(21, __c5, 1) as any as S.Schema, errors: [UnknownHetznerError], protocol: HetznerProtocol, retry: Retry.Retry, })); export type ListFirewallActionsError = HetznerOpError; /** List Actions for a Firewall Returns all [Actions](#tag/actions) for the [Firewall](#tag/firewalls). Use the provided URI parameters to modify the result. */ export const listFirewallActions: API.PaginatedOperationMethod< ListFirewallActionsRequest, ListFirewallActionsResponse, ListFirewallActionsError, HetznerOpContext, ListFirewallActionsResponseActionsItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: __S(24, __c6, 0) as any as S.Schema, output: __S(31, __c7, 3) as any as S.Schema, errors: [UnknownHetznerError], protocol: HetznerProtocol, retry: Retry.Retry, pagination: { mode: "page", inputToken: "page", outputToken: "meta.pagination.next_page", items: "actions", pageSize: "per_page", } as const, }), paginatePageNumber, ) as any; export type ListFirewallsActionsError = HetznerOpError; /** List Actions Returns all [Actions](#tag/actions) for [Firewalls](#tag/firewalls). Use the provided URI parameters to modify the result. */ export const listFirewallsActions: API.PaginatedOperationMethod< ListFirewallsActionsRequest, ListFirewallsActionsResponse, ListFirewallsActionsError, HetznerOpContext, ListFirewallsActionsResponseActionsItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: __S(33, __c8, 1) as any as S.Schema, output: __S(31, __c7, 3) as any as S.Schema, errors: [UnknownHetznerError], protocol: HetznerProtocol, retry: Retry.Retry, pagination: { mode: "page", inputToken: "page", outputToken: "meta.pagination.next_page", items: "actions", pageSize: "per_page", } as const, }), paginatePageNumber, ) as any; export type RemoveFirewallFromResourcesError = HetznerOpError; /** Remove from Resources Removes a [Firewall](#tag/firewalls) from multiple resources. Supported resources: - [Servers](#tag/servers) (with a public network interface) A [Firewall](#tag/firewalls) is removed from a resource once the related [Action](#tag/actions) with command `remove_firewall` successfully finished. #### Operation specific errors */ export const removeFirewallFromResources: API.OperationMethod< RemoveFirewallFromResourcesRequest, RemoveFirewallFromResourcesResponse, RemoveFirewallFromResourcesError, HetznerOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(36, __c9, 0) as any as S.Schema, output: __S(16, __c4, 0) as any as S.Schema, errors: [UnknownHetznerError], protocol: HetznerProtocol, retry: Retry.Retry, })); export type SetFirewallRulesError = HetznerOpError; /** Set Rules Set the rules of a [Firewall](#tag/firewalls). Overwrites the existing rules with the given ones. Pass an empty array to remove all rules. Rules are limited to 50 entries per [Firewall](#tag/firewalls) and [500 effective rules](https://docs.hetzner.com/cloud/firewalls/overview#limits). */ export const setFirewallRules: API.OperationMethod< SetFirewallRulesRequest, SetFirewallRulesResponse, SetFirewallRulesError, HetznerOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(43, __c10, 3) as any as S.Schema, output: __S(16, __c4, 0) as any as S.Schema, errors: [UnknownHetznerError], protocol: HetznerProtocol, retry: Retry.Retry, })); // 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()), apply_to: __S(15, __c3, 3), }).pipe( T.Http({ method: "POST", uri: "/firewalls/{id}/actions/apply_to_resources", code: 200 }), ), ).annotate({ identifier: "ApplyFirewallToResourcesRequest" }); } } function __c1(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ id: S.Number, type: S.String, }), ).annotate({ identifier: "ApplyFirewallToResourcesResponseActionsItemResourcesItem" }); case 1: return S.Array(__S(4, __c1, 0)); case 2: return S.suspend(() => S.Struct({ code: S.String, message: S.String, }), ).annotate({ identifier: "ApplyFirewallToResourcesResponseActionsItemError" }); case 3: return S.suspend(() => S.Struct({ id: S.Number, command: S.String, status: S.String, started: S.String, finished: S.NullOr(S.String), progress: S.Number, resources: __S(5, __c1, 1), error: S.NullOr(__S(6, __c1, 2)), }), ).annotate({ identifier: "ApplyFirewallToResourcesResponseActionsItem" }); } } function __c2(j: number): any { switch (j) { case 0: return S.Array(__S(7, __c1, 3)); } } function __c3(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ id: S.Number, }), ).annotate({ identifier: "ApplyFirewallToResourcesRequestApplyToItemServer" }); case 1: return S.suspend(() => S.Struct({ selector: S.String, }), ).annotate({ identifier: "ApplyFirewallToResourcesRequestApplyToItemLabelSelector" }); case 2: return S.suspend(() => S.Struct({ type: S.String, server: S.optional(__S(12, __c3, 0)), label_selector: S.optional(__S(13, __c3, 1)), }), ).annotate({ identifier: "ApplyFirewallToResourcesRequestApplyToItem" }); case 3: return S.Array(__S(14, __c3, 2)); } } function __c4(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ actions: __S(8, __c2, 0), }), ).annotate({ identifier: "ApplyFirewallToResourcesResponse" }); } } function __c5(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ id: S.Number.pipe(T.Label()), }).pipe(T.Http({ method: "GET", uri: "/firewalls/actions/{id}", code: 200 })), ).annotate({ identifier: "GetFirewallsActionRequest" }); case 1: return S.suspend(() => S.Struct({ action: __S(7, __c1, 3), }), ).annotate({ identifier: "GetFirewallsActionResponse" }); } } function __c6(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ id: S.Number.pipe(T.Label()), sort: S.optional(__S(28, __c7, 0).pipe(T.Query())), status: S.optional(__S(28, __c7, 0).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: "/firewalls/{id}/actions", code: 200 })), ).annotate({ identifier: "ListFirewallActionsRequest" }); } } function __c7(j: number): any { switch (j) { case 0: return S.Array(S.String); case 1: 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: "ListFirewallActionsResponseMetaPagination" }); case 2: return S.suspend(() => S.Struct({ pagination: __S(29, __c7, 1), }), ).annotate({ identifier: "ListFirewallActionsResponseMeta" }); case 3: return S.suspend(() => S.Struct({ actions: __S(8, __c2, 0), meta: __S(30, __c7, 2), }), ).annotate({ identifier: "ListFirewallActionsResponse" }); } } function __c8(j: number): any { switch (j) { case 0: return S.Array(S.Number); case 1: return S.suspend(() => S.Struct({ id: S.optional(__S(32, __c8, 0).pipe(T.Query())), sort: S.optional(__S(28, __c7, 0).pipe(T.Query())), status: S.optional(__S(28, __c7, 0).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: "/firewalls/actions", code: 200 })), ).annotate({ identifier: "ListFirewallsActionsRequest" }); } } function __c9(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ id: S.Number.pipe(T.Label()), remove_from: __S(15, __c3, 3), }).pipe( T.Http({ method: "POST", uri: "/firewalls/{id}/actions/remove_from_resources", code: 200, }), ), ).annotate({ identifier: "RemoveFirewallFromResourcesRequest" }); } } function __c10(j: number): any { switch (j) { case 0: return S.Array(S.String); case 1: return S.suspend(() => S.Struct({ description: S.optional(S.NullOr(S.String)), direction: S.String, source_ips: S.optional(__S(40, __c10, 0)), destination_ips: S.optional(__S(40, __c10, 0)), protocol: S.String, port: S.optional(S.String), }), ).annotate({ identifier: "SetFirewallRulesRequestRulesItem" }); case 2: return S.Array(__S(41, __c10, 1)); case 3: return S.suspend(() => S.Struct({ id: S.Number.pipe(T.Label()), rules: __S(42, __c10, 2), }).pipe(T.Http({ method: "POST", uri: "/firewalls/{id}/actions/set_rules", code: 200 })), ).annotate({ identifier: "SetFirewallRulesRequest" }); } } // 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)); }