diff --git a/packages/clients/src/api/vpcgw/index.gen.ts b/packages/clients/src/api/vpcgw/index.gen.ts index a86d42c0b..bfc9cec79 100644 --- a/packages/clients/src/api/vpcgw/index.gen.ts +++ b/packages/clients/src/api/vpcgw/index.gen.ts @@ -4,3 +4,4 @@ */ export * as v1 from './v1/index.gen' +export * as v2 from './v2/index.gen' diff --git a/packages/clients/src/api/vpcgw/v2/api.gen.ts b/packages/clients/src/api/vpcgw/v2/api.gen.ts new file mode 100644 index 000000000..03f4cf9d8 --- /dev/null +++ b/packages/clients/src/api/vpcgw/v2/api.gen.ts @@ -0,0 +1,662 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import { + API as ParentAPI, + enrichForPagination, + urlParams, + validatePathParam, + waitForResource, +} from '../../../bridge' +import type { WaitForOptions, Zone } from '../../../bridge' +import { + GATEWAY_NETWORK_TRANSIENT_STATUSES, + GATEWAY_TRANSIENT_STATUSES, +} from './content.gen' +import { + marshalCreateGatewayNetworkRequest, + marshalCreateGatewayRequest, + marshalCreateIPRequest, + marshalCreatePatRuleRequest, + marshalSetPatRulesRequest, + marshalUpdateGatewayNetworkRequest, + marshalUpdateGatewayRequest, + marshalUpdateIPRequest, + marshalUpdatePatRuleRequest, + marshalUpgradeGatewayRequest, + unmarshalGateway, + unmarshalGatewayNetwork, + unmarshalIP, + unmarshalListGatewayNetworksResponse, + unmarshalListGatewayTypesResponse, + unmarshalListGatewaysResponse, + unmarshalListIPsResponse, + unmarshalListPatRulesResponse, + unmarshalPatRule, + unmarshalSetPatRulesResponse, +} from './marshalling.gen' +import type { + CreateGatewayNetworkRequest, + CreateGatewayRequest, + CreateIPRequest, + CreatePatRuleRequest, + DeleteGatewayNetworkRequest, + DeleteGatewayRequest, + DeleteIPRequest, + DeletePatRuleRequest, + Gateway, + GatewayNetwork, + GetGatewayNetworkRequest, + GetGatewayRequest, + GetIPRequest, + GetPatRuleRequest, + IP, + ListGatewayNetworksRequest, + ListGatewayNetworksResponse, + ListGatewayTypesRequest, + ListGatewayTypesResponse, + ListGatewaysRequest, + ListGatewaysResponse, + ListIPsRequest, + ListIPsResponse, + ListPatRulesRequest, + ListPatRulesResponse, + PatRule, + RefreshSSHKeysRequest, + SetPatRulesRequest, + SetPatRulesResponse, + UpdateGatewayNetworkRequest, + UpdateGatewayRequest, + UpdateIPRequest, + UpdatePatRuleRequest, + UpgradeGatewayRequest, +} from './types.gen' + +const jsonContentHeaders = { + 'Content-Type': 'application/json; charset=utf-8', +} + +/** + * Public Gateways API. + * + * This API allows you to manage your Public Gateways. + */ +export class API extends ParentAPI { + /** Lists the available zones of the API. */ + public static readonly LOCALITIES: Zone[] = [ + 'fr-par-1', + 'fr-par-2', + 'nl-ams-1', + 'nl-ams-2', + 'nl-ams-3', + 'pl-waw-1', + 'pl-waw-2', + 'pl-waw-3', + ] + + protected pageOfListGateways = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways`, + urlParams: urlParams( + ['include_legacy', request.includeLegacy], + ['name', request.name], + ['order_by', request.orderBy], + ['organization_id', request.organizationId], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['private_network_ids', request.privateNetworkIds], + ['project_id', request.projectId], + ['status', request.status], + ['tags', request.tags], + ['types', request.types], + ), + }, + unmarshalListGatewaysResponse, + ) + + /** + * List Public Gateways. List Public Gateways in a given Scaleway Organization + * or Project. By default, results are displayed in ascending order of + * creation date. + * + * @param request - The request {@link ListGatewaysRequest} + * @returns A Promise of ListGatewaysResponse + */ + listGateways = (request: Readonly = {}) => + enrichForPagination('gateways', this.pageOfListGateways, request) + + /** + * Get a Public Gateway. Get details of a Public Gateway, specified by its + * gateway ID. The response object contains full details of the gateway, + * including its **name**, **type**, **status** and more. + * + * @param request - The request {@link GetGatewayRequest} + * @returns A Promise of Gateway + */ + getGateway = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}`, + }, + unmarshalGateway, + ) + + /** + * Waits for {@link Gateway} to be in a final state. + * + * @param request - The request {@link GetGatewayRequest} + * @param options - The waiting options + * @returns A Promise of Gateway + */ + waitForGateway = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve(!GATEWAY_TRANSIENT_STATUSES.includes(res.status))), + this.getGateway, + request, + options, + ) + + /** + * Create a Public Gateway. Create a new Public Gateway in the specified + * Scaleway Project, defining its **name**, **type** and other configuration + * details such as whether to enable SSH bastion. + * + * @param request - The request {@link CreateGatewayRequest} + * @returns A Promise of Gateway + */ + createGateway = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateGatewayRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways`, + }, + unmarshalGateway, + ) + + /** + * Update a Public Gateway. Update the parameters of an existing Public + * Gateway, for example, its **name**, **tags**, **SSH bastion + * configuration**, and **DNS servers**. + * + * @param request - The request {@link UpdateGatewayRequest} + * @returns A Promise of Gateway + */ + updateGateway = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateGatewayRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}`, + }, + unmarshalGateway, + ) + + /** + * Delete a Public Gateway. Delete an existing Public Gateway, specified by + * its gateway ID. This action is irreversible. + * + * @param request - The request {@link DeleteGatewayRequest} + * @returns A Promise of Gateway + */ + deleteGateway = (request: Readonly) => + this.client.fetch( + { + method: 'DELETE', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}`, + }, + unmarshalGateway, + ) + + /** + * Upgrade a Public Gateway to the latest version and/or to a different + * commercial offer type. Upgrade a given Public Gateway to the newest + * software version or to a different commercial offer type. This applies the + * latest bugfixes and features to your Public Gateway. Note that gateway + * service will be interrupted during the update. + * + * @param request - The request {@link UpgradeGatewayRequest} + * @returns A Promise of Gateway + */ + upgradeGateway = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpgradeGatewayRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}/upgrade`, + }, + unmarshalGateway, + ) + + protected pageOfListGatewayNetworks = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateway-networks`, + urlParams: urlParams( + ['gateway_ids', request.gatewayIds], + ['masquerade_enabled', request.masqueradeEnabled], + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['private_network_ids', request.privateNetworkIds], + ['status', request.status], + ), + }, + unmarshalListGatewayNetworksResponse, + ) + + /** + * List Public Gateway connections to Private Networks. List the connections + * between Public Gateways and Private Networks (a connection = a + * GatewayNetwork). You can choose to filter by `gateway-id` to list all + * Private Networks attached to the specified Public Gateway, or by + * `private_network_id` to list all Public Gateways attached to the specified + * Private Network. Other query parameters are also available. The result is + * an array of GatewayNetwork objects, each giving details of the connection + * between a given Public Gateway and a given Private Network. + * + * @param request - The request {@link ListGatewayNetworksRequest} + * @returns A Promise of ListGatewayNetworksResponse + */ + listGatewayNetworks = (request: Readonly = {}) => + enrichForPagination( + 'gatewayNetworks', + this.pageOfListGatewayNetworks, + request, + ) + + /** + * Get a Public Gateway connection to a Private Network. Get details of a + * given connection between a Public Gateway and a Private Network (this + * connection = a GatewayNetwork), specified by its `gateway_network_id`. The + * response object contains details of the connection including the IDs of the + * Public Gateway and Private Network, the dates the connection was + * created/updated and its configuration settings. + * + * @param request - The request {@link GetGatewayNetworkRequest} + * @returns A Promise of GatewayNetwork + */ + getGatewayNetwork = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateway-networks/${validatePathParam('gatewayNetworkId', request.gatewayNetworkId)}`, + }, + unmarshalGatewayNetwork, + ) + + /** + * Waits for {@link GatewayNetwork} to be in a final state. + * + * @param request - The request {@link GetGatewayNetworkRequest} + * @param options - The waiting options + * @returns A Promise of GatewayNetwork + */ + waitForGatewayNetwork = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve( + !GATEWAY_NETWORK_TRANSIENT_STATUSES.includes(res.status), + )), + this.getGatewayNetwork, + request, + options, + ) + + /** + * Attach a Public Gateway to a Private Network. Attach a specific Public + * Gateway to a specific Private Network (create a GatewayNetwork). You can + * configure parameters for the connection including whether to enable + * masquerade (dynamic NAT), and more. + * + * @param request - The request {@link CreateGatewayNetworkRequest} + * @returns A Promise of GatewayNetwork + */ + createGatewayNetwork = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateGatewayNetworkRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateway-networks`, + }, + unmarshalGatewayNetwork, + ) + + /** + * Update a Public Gateway's connection to a Private Network. Update the + * configuration parameters of a connection between a given Public Gateway and + * Private Network (the connection = a GatewayNetwork). Updatable parameters + * include whether to enable traffic masquerade (dynamic NAT). + * + * @param request - The request {@link UpdateGatewayNetworkRequest} + * @returns A Promise of GatewayNetwork + */ + updateGatewayNetwork = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateGatewayNetworkRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateway-networks/${validatePathParam('gatewayNetworkId', request.gatewayNetworkId)}`, + }, + unmarshalGatewayNetwork, + ) + + /** + * Detach a Public Gateway from a Private Network. Detach a given Public + * Gateway from a given Private Network, i.e. delete a GatewayNetwork + * specified by a gateway_network_id. + * + * @param request - The request {@link DeleteGatewayNetworkRequest} + * @returns A Promise of GatewayNetwork + */ + deleteGatewayNetwork = (request: Readonly) => + this.client.fetch( + { + method: 'DELETE', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateway-networks/${validatePathParam('gatewayNetworkId', request.gatewayNetworkId)}`, + }, + unmarshalGatewayNetwork, + ) + + protected pageOfListPatRules = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules`, + urlParams: urlParams( + ['gateway_ids', request.gatewayIds], + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['private_ips', request.privateIps], + ['protocol', request.protocol], + ), + }, + unmarshalListPatRulesResponse, + ) + + /** + * List PAT rules. List PAT rules. You can filter by gateway ID to list all + * PAT rules for a particular gateway, or filter for PAT rules targeting a + * specific IP address or using a specific protocol. + * + * @param request - The request {@link ListPatRulesRequest} + * @returns A Promise of ListPatRulesResponse + */ + listPatRules = (request: Readonly = {}) => + enrichForPagination('patRules', this.pageOfListPatRules, request) + + /** + * Get a PAT rule. Get a PAT rule, specified by its PAT rule ID. The response + * object gives full details of the PAT rule, including the Public Gateway it + * belongs to and the configuration settings in terms of public / private + * ports, private IP and protocol. + * + * @param request - The request {@link GetPatRuleRequest} + * @returns A Promise of PatRule + */ + getPatRule = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules/${validatePathParam('patRuleId', request.patRuleId)}`, + }, + unmarshalPatRule, + ) + + /** + * Create a PAT rule. Create a new PAT rule on a specified Public Gateway, + * defining the protocol to use, public port to listen on, and private port / + * IP address to map to. + * + * @param request - The request {@link CreatePatRuleRequest} + * @returns A Promise of PatRule + */ + createPatRule = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreatePatRuleRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules`, + }, + unmarshalPatRule, + ) + + /** + * Update a PAT rule. Update a PAT rule, specified by its PAT rule ID. + * Configuration settings including private/public port, private IP address + * and protocol can all be updated. + * + * @param request - The request {@link UpdatePatRuleRequest} + * @returns A Promise of PatRule + */ + updatePatRule = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdatePatRuleRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules/${validatePathParam('patRuleId', request.patRuleId)}`, + }, + unmarshalPatRule, + ) + + /** + * Set all PAT rules. Set a definitive list of PAT rules attached to a Public + * Gateway. Each rule is identified by its public port and protocol. This will + * sync the current PAT rule list on the gateway with the new list, creating, + * updating or deleting PAT rules accordingly. + * + * @param request - The request {@link SetPatRulesRequest} + * @returns A Promise of SetPatRulesResponse + */ + setPatRules = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalSetPatRulesRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PUT', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules`, + }, + unmarshalSetPatRulesResponse, + ) + + /** + * Delete a PAT rule. Delete a PAT rule, identified by its PAT rule ID. This + * action is irreversible. + * + * @param request - The request {@link DeletePatRuleRequest} + */ + deletePatRule = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules/${validatePathParam('patRuleId', request.patRuleId)}`, + }) + + /** + * List Public Gateway types. List the different Public Gateway commercial + * offer types available at Scaleway. The response is an array of objects + * describing the name and technical details of each available gateway type. + * + * @param request - The request {@link ListGatewayTypesRequest} + * @returns A Promise of ListGatewayTypesResponse + */ + listGatewayTypes = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateway-types`, + }, + unmarshalListGatewayTypesResponse, + ) + + protected pageOfListIPs = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/ips`, + urlParams: urlParams( + ['is_free', request.isFree], + ['order_by', request.orderBy], + ['organization_id', request.organizationId], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ['reverse', request.reverse], + ['tags', request.tags], + ), + }, + unmarshalListIPsResponse, + ) + + /** + * List IPs. List Public Gateway flexible IP addresses. A number of filter + * options are available for limiting results in the response. + * + * @param request - The request {@link ListIPsRequest} + * @returns A Promise of ListIPsResponse + */ + listIPs = (request: Readonly = {}) => + enrichForPagination('ips', this.pageOfListIPs, request) + + /** + * Get an IP. Get details of a Public Gateway flexible IP address, identified + * by its IP ID. The response object contains information including which (if + * any) Public Gateway using this IP address, the reverse and various other + * metadata. + * + * @param request - The request {@link GetIPRequest} + * @returns A Promise of IP + */ + getIP = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam('ipId', request.ipId)}`, + }, + unmarshalIP, + ) + + /** + * Reserve an IP. Create (reserve) a new flexible IP address that can be used + * for a Public Gateway in a specified Scaleway Project. + * + * @param request - The request {@link CreateIPRequest} + * @returns A Promise of IP + */ + createIP = (request: Readonly = {}) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateIPRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/ips`, + }, + unmarshalIP, + ) + + /** + * Update an IP. Update details of an existing flexible IP address, including + * its tags, reverse and the Public Gateway it is assigned to. + * + * @param request - The request {@link UpdateIPRequest} + * @returns A Promise of IP + */ + updateIP = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateIPRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam('ipId', request.ipId)}`, + }, + unmarshalIP, + ) + + /** + * Delete an IP. Delete a flexible IP address from your account. This action + * is irreversible. + * + * @param request - The request {@link DeleteIPRequest} + */ + deleteIP = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam('ipId', request.ipId)}`, + }) + + /** + * Refresh a Public Gateway's SSH keys. Refresh the SSH keys of a given Public + * Gateway, specified by its gateway ID. This adds any new SSH keys in the + * gateway's Scaleway Project to the gateway itself. + * + * @param request - The request {@link RefreshSSHKeysRequest} + * @returns A Promise of Gateway + */ + refreshSSHKeys = (request: Readonly) => + this.client.fetch( + { + body: '{}', + headers: jsonContentHeaders, + method: 'POST', + path: `/vpc-gw/v2/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}/refresh-ssh-keys`, + }, + unmarshalGateway, + ) +} diff --git a/packages/clients/src/api/vpcgw/v2/content.gen.ts b/packages/clients/src/api/vpcgw/v2/content.gen.ts new file mode 100644 index 000000000..dac6b7029 --- /dev/null +++ b/packages/clients/src/api/vpcgw/v2/content.gen.ts @@ -0,0 +1,18 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import type { GatewayNetworkStatus, GatewayStatus } from './types.gen' + +/** Lists transient statutes of the enum {@link GatewayNetworkStatus}. */ +export const GATEWAY_NETWORK_TRANSIENT_STATUSES: GatewayNetworkStatus[] = [ + 'attaching', + 'configuring', + 'detaching', +] + +/** Lists transient statutes of the enum {@link GatewayStatus}. */ +export const GATEWAY_TRANSIENT_STATUSES: GatewayStatus[] = [ + 'allocating', + 'configuring', + 'stopping', + 'deleting', +] diff --git a/packages/clients/src/api/vpcgw/v2/index.gen.ts b/packages/clients/src/api/vpcgw/v2/index.gen.ts new file mode 100644 index 000000000..b0270c213 --- /dev/null +++ b/packages/clients/src/api/vpcgw/v2/index.gen.ts @@ -0,0 +1,49 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +export { API } from './api.gen' +export * from './content.gen' +export type { + CreateGatewayNetworkRequest, + CreateGatewayRequest, + CreateIPRequest, + CreatePatRuleRequest, + DeleteGatewayNetworkRequest, + DeleteGatewayRequest, + DeleteIPRequest, + DeletePatRuleRequest, + Gateway, + GatewayNetwork, + GatewayNetworkStatus, + GatewayStatus, + GatewayType, + GetGatewayNetworkRequest, + GetGatewayRequest, + GetIPRequest, + GetPatRuleRequest, + IP, + ListGatewayNetworksRequest, + ListGatewayNetworksRequestOrderBy, + ListGatewayNetworksResponse, + ListGatewayTypesRequest, + ListGatewayTypesResponse, + ListGatewaysRequest, + ListGatewaysRequestOrderBy, + ListGatewaysResponse, + ListIPsRequest, + ListIPsRequestOrderBy, + ListIPsResponse, + ListPatRulesRequest, + ListPatRulesRequestOrderBy, + ListPatRulesResponse, + PatRule, + PatRuleProtocol, + RefreshSSHKeysRequest, + SetPatRulesRequest, + SetPatRulesRequestRule, + SetPatRulesResponse, + UpdateGatewayNetworkRequest, + UpdateGatewayRequest, + UpdateIPRequest, + UpdatePatRuleRequest, + UpgradeGatewayRequest, +} from './types.gen' diff --git a/packages/clients/src/api/vpcgw/v2/marshalling.gen.ts b/packages/clients/src/api/vpcgw/v2/marshalling.gen.ts new file mode 100644 index 000000000..a02ec2db5 --- /dev/null +++ b/packages/clients/src/api/vpcgw/v2/marshalling.gen.ts @@ -0,0 +1,342 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import randomName from '@scaleway/random-name' +import { + isJSONObject, + unmarshalArrayOfObject, + unmarshalDate, +} from '../../../bridge' +import type { DefaultValues } from '../../../bridge' +import type { + CreateGatewayNetworkRequest, + CreateGatewayRequest, + CreateIPRequest, + CreatePatRuleRequest, + Gateway, + GatewayNetwork, + GatewayType, + IP, + ListGatewayNetworksResponse, + ListGatewayTypesResponse, + ListGatewaysResponse, + ListIPsResponse, + ListPatRulesResponse, + PatRule, + SetPatRulesRequest, + SetPatRulesRequestRule, + SetPatRulesResponse, + UpdateGatewayNetworkRequest, + UpdateGatewayRequest, + UpdateIPRequest, + UpdatePatRuleRequest, + UpgradeGatewayRequest, +} from './types.gen' + +export const unmarshalGatewayNetwork = (data: unknown): GatewayNetwork => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GatewayNetwork' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + gatewayId: data.gateway_id, + id: data.id, + ipamIpId: data.ipam_ip_id, + macAddress: data.mac_address, + masqueradeEnabled: data.masquerade_enabled, + privateNetworkId: data.private_network_id, + pushDefaultRoute: data.push_default_route, + status: data.status, + updatedAt: unmarshalDate(data.updated_at), + zone: data.zone, + } as GatewayNetwork +} + +export const unmarshalIP = (data: unknown): IP => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'IP' failed as data isn't a dictionary.`, + ) + } + + return { + address: data.address, + createdAt: unmarshalDate(data.created_at), + gatewayId: data.gateway_id, + id: data.id, + organizationId: data.organization_id, + projectId: data.project_id, + reverse: data.reverse, + tags: data.tags, + updatedAt: unmarshalDate(data.updated_at), + zone: data.zone, + } as IP +} + +export const unmarshalGateway = (data: unknown): Gateway => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Gateway' failed as data isn't a dictionary.`, + ) + } + + return { + bandwidth: data.bandwidth, + bastionEnabled: data.bastion_enabled, + bastionPort: data.bastion_port, + canUpgradeTo: data.can_upgrade_to, + createdAt: unmarshalDate(data.created_at), + gatewayNetworks: unmarshalArrayOfObject( + data.gateway_networks, + unmarshalGatewayNetwork, + ), + id: data.id, + ipv4: data.ipv4 ? unmarshalIP(data.ipv4) : undefined, + isLegacy: data.is_legacy, + name: data.name, + organizationId: data.organization_id, + projectId: data.project_id, + smtpEnabled: data.smtp_enabled, + status: data.status, + tags: data.tags, + type: data.type, + updatedAt: unmarshalDate(data.updated_at), + version: data.version, + zone: data.zone, + } as Gateway +} + +export const unmarshalPatRule = (data: unknown): PatRule => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'PatRule' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + gatewayId: data.gateway_id, + id: data.id, + privateIp: data.private_ip, + privatePort: data.private_port, + protocol: data.protocol, + publicPort: data.public_port, + updatedAt: unmarshalDate(data.updated_at), + zone: data.zone, + } as PatRule +} + +export const unmarshalListGatewayNetworksResponse = ( + data: unknown, +): ListGatewayNetworksResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListGatewayNetworksResponse' failed as data isn't a dictionary.`, + ) + } + + return { + gatewayNetworks: unmarshalArrayOfObject( + data.gateway_networks, + unmarshalGatewayNetwork, + ), + totalCount: data.total_count, + } as ListGatewayNetworksResponse +} + +const unmarshalGatewayType = (data: unknown): GatewayType => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GatewayType' failed as data isn't a dictionary.`, + ) + } + + return { + bandwidth: data.bandwidth, + name: data.name, + zone: data.zone, + } as GatewayType +} + +export const unmarshalListGatewayTypesResponse = ( + data: unknown, +): ListGatewayTypesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListGatewayTypesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + types: unmarshalArrayOfObject(data.types, unmarshalGatewayType), + } as ListGatewayTypesResponse +} + +export const unmarshalListGatewaysResponse = ( + data: unknown, +): ListGatewaysResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListGatewaysResponse' failed as data isn't a dictionary.`, + ) + } + + return { + gateways: unmarshalArrayOfObject(data.gateways, unmarshalGateway), + totalCount: data.total_count, + } as ListGatewaysResponse +} + +export const unmarshalListIPsResponse = (data: unknown): ListIPsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + ips: unmarshalArrayOfObject(data.ips, unmarshalIP), + totalCount: data.total_count, + } as ListIPsResponse +} + +export const unmarshalListPatRulesResponse = ( + data: unknown, +): ListPatRulesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListPatRulesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + patRules: unmarshalArrayOfObject(data.pat_rules, unmarshalPatRule), + totalCount: data.total_count, + } as ListPatRulesResponse +} + +export const unmarshalSetPatRulesResponse = ( + data: unknown, +): SetPatRulesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'SetPatRulesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + patRules: unmarshalArrayOfObject(data.pat_rules, unmarshalPatRule), + } as SetPatRulesResponse +} + +export const marshalCreateGatewayNetworkRequest = ( + request: CreateGatewayNetworkRequest, + defaults: DefaultValues, +): Record => ({ + enable_masquerade: request.enableMasquerade, + gateway_id: request.gatewayId, + ipam_ip_id: request.ipamIpId, + private_network_id: request.privateNetworkId, + push_default_route: request.pushDefaultRoute, +}) + +export const marshalCreateGatewayRequest = ( + request: CreateGatewayRequest, + defaults: DefaultValues, +): Record => ({ + bastion_port: request.bastionPort, + enable_bastion: request.enableBastion, + enable_smtp: request.enableSmtp, + ip_id: request.ipId, + name: request.name || randomName('gw'), + project_id: request.projectId ?? defaults.defaultProjectId, + tags: request.tags, + type: request.type, +}) + +export const marshalCreateIPRequest = ( + request: CreateIPRequest, + defaults: DefaultValues, +): Record => ({ + project_id: request.projectId ?? defaults.defaultProjectId, + tags: request.tags, +}) + +export const marshalCreatePatRuleRequest = ( + request: CreatePatRuleRequest, + defaults: DefaultValues, +): Record => ({ + gateway_id: request.gatewayId, + private_ip: request.privateIp, + private_port: request.privatePort, + protocol: request.protocol, + public_port: request.publicPort, +}) + +const marshalSetPatRulesRequestRule = ( + request: SetPatRulesRequestRule, + defaults: DefaultValues, +): Record => ({ + private_ip: request.privateIp, + private_port: request.privatePort, + protocol: request.protocol, + public_port: request.publicPort, +}) + +export const marshalSetPatRulesRequest = ( + request: SetPatRulesRequest, + defaults: DefaultValues, +): Record => ({ + gateway_id: request.gatewayId, + pat_rules: request.patRules.map(elt => + marshalSetPatRulesRequestRule(elt, defaults), + ), +}) + +export const marshalUpdateGatewayNetworkRequest = ( + request: UpdateGatewayNetworkRequest, + defaults: DefaultValues, +): Record => ({ + enable_masquerade: request.enableMasquerade, + ipam_ip_id: request.ipamIpId, + push_default_route: request.pushDefaultRoute, +}) + +export const marshalUpdateGatewayRequest = ( + request: UpdateGatewayRequest, + defaults: DefaultValues, +): Record => ({ + bastion_port: request.bastionPort, + enable_bastion: request.enableBastion, + enable_smtp: request.enableSmtp, + name: request.name, + tags: request.tags, +}) + +export const marshalUpdateIPRequest = ( + request: UpdateIPRequest, + defaults: DefaultValues, +): Record => ({ + gateway_id: request.gatewayId, + reverse: request.reverse, + tags: request.tags, +}) + +export const marshalUpdatePatRuleRequest = ( + request: UpdatePatRuleRequest, + defaults: DefaultValues, +): Record => ({ + private_ip: request.privateIp, + private_port: request.privatePort, + protocol: request.protocol, + public_port: request.publicPort, +}) + +export const marshalUpgradeGatewayRequest = ( + request: UpgradeGatewayRequest, + defaults: DefaultValues, +): Record => ({ + type: request.type, +}) diff --git a/packages/clients/src/api/vpcgw/v2/types.gen.ts b/packages/clients/src/api/vpcgw/v2/types.gen.ts new file mode 100644 index 000000000..cd68222c7 --- /dev/null +++ b/packages/clients/src/api/vpcgw/v2/types.gen.ts @@ -0,0 +1,532 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import type { Zone } from '../../../bridge' + +export type GatewayNetworkStatus = + | 'unknown_status' + | 'created' + | 'attaching' + | 'configuring' + | 'ready' + | 'detaching' + +export type GatewayStatus = + | 'unknown_status' + | 'stopped' + | 'allocating' + | 'configuring' + | 'running' + | 'stopping' + | 'failed' + | 'deleting' + | 'locked' + +export type ListGatewayNetworksRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'status_asc' + | 'status_desc' + +export type ListGatewaysRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'name_asc' + | 'name_desc' + | 'type_asc' + | 'type_desc' + | 'status_asc' + | 'status_desc' + +export type ListIPsRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'address_asc' + | 'address_desc' + | 'reverse_asc' + | 'reverse_desc' + +export type ListPatRulesRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'public_port_asc' + | 'public_port_desc' + +export type PatRuleProtocol = 'unknown_protocol' | 'both' | 'tcp' | 'udp' + +export interface GatewayNetwork { + /** ID of the Public Gateway-Private Network connection. */ + id: string + /** Connection creation date. */ + createdAt?: Date + /** Connection last modification date. */ + updatedAt?: Date + /** ID of the connected Public Gateway. */ + gatewayId: string + /** ID of the connected Private Network. */ + privateNetworkId: string + /** + * MAC address of the gateway in the Private Network (if the gateway is up and + * running). + */ + macAddress?: string + /** + * Defines whether the gateway masquerades traffic for this Private Network + * (Dynamic NAT). + */ + masqueradeEnabled: boolean + /** Current status of the Public Gateway's connection to the Private Network. */ + status: GatewayNetworkStatus + /** Enabling the default route also enables masquerading. */ + pushDefaultRoute: boolean + /** Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. */ + ipamIpId: string + /** Zone of the GatewayNetwork connection. */ + zone: Zone +} + +export interface IP { + /** IP address ID. */ + id: string + /** Owning Organization. */ + organizationId: string + /** Owning Project. */ + projectId: string + /** IP address creation date. */ + createdAt?: Date + /** IP address last modification date. */ + updatedAt?: Date + /** Tags associated with the IP address. */ + tags: string[] + /** The IP address itself. */ + address: string + /** Reverse domain name for the IP address. */ + reverse?: string + /** Public Gateway associated with the IP address. */ + gatewayId?: string + /** Zone of the IP address. */ + zone: Zone +} + +export interface GatewayType { + /** Public Gateway type name. */ + name: string + /** + * Bandwidth, in bps, of the Public Gateway. This is the public bandwidth to + * the outer Internet, and the internal bandwidth to each connected Private + * Networks. + */ + bandwidth: number + /** Zone the Public Gateway type is available in. */ + zone: Zone +} + +export interface Gateway { + /** ID of the gateway. */ + id: string + /** Owning Organization. */ + organizationId: string + /** Owning Project. */ + projectId: string + /** Gateway creation date. */ + createdAt?: Date + /** Gateway last modification date. */ + updatedAt?: Date + /** Gateway type name (commercial offer). */ + type: string + /** Bandwidth available of the gateway. */ + bandwidth: number + /** Current status of the gateway. */ + status: GatewayStatus + /** Name of the gateway. */ + name: string + /** Tags associated with the gateway. */ + tags: string[] + /** Public IPv4 address of the gateway. */ + ipv4?: IP + /** + * GatewayNetwork objects attached to the gateway (each one represents a + * connection to a Private Network). + */ + gatewayNetworks: GatewayNetwork[] + /** Version of the running gateway software. */ + version?: string + /** Newly available gateway software version that can be updated to. */ + canUpgradeTo?: string + /** Defines whether SSH bastion is enabled on the gateway. */ + bastionEnabled: boolean + /** Port of the SSH bastion. */ + bastionPort: number + /** Defines whether SMTP traffic is allowed to pass through the gateway. */ + smtpEnabled: boolean + /** Defines whether the gateway uses non-IPAM IP configurations. */ + isLegacy: boolean + /** Zone of the gateway. */ + zone: Zone +} + +export interface PatRule { + /** PAT rule ID. */ + id: string + /** Gateway the PAT rule applies to. */ + gatewayId: string + /** PAT rule creation date. */ + createdAt?: Date + /** PAT rule last modification date. */ + updatedAt?: Date + /** Public port to listen on. */ + publicPort: number + /** Private IP address to forward data to. */ + privateIp: string + /** Private port to translate to. */ + privatePort: number + /** Protocol the rule applies to. */ + protocol: PatRuleProtocol + /** Zone of the PAT rule. */ + zone: Zone +} + +export interface SetPatRulesRequestRule { + /** + * Public port to listen on. Uniquely identifies the rule, and a matching rule + * will be updated with the new parameters. + */ + publicPort: number + /** Private IP to forward data to. */ + privateIp: string + /** Private port to translate to. */ + privatePort: number + /** Protocol the rule should apply to. */ + protocol: PatRuleProtocol +} + +export type CreateGatewayNetworkRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Public Gateway to connect. */ + gatewayId: string + /** Private Network to connect. */ + privateNetworkId: string + /** Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork. */ + enableMasquerade: boolean + /** Enabling the default route also enables masquerading. */ + pushDefaultRoute: boolean + /** Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. */ + ipamIpId?: string +} + +export type CreateGatewayRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Scaleway Project to create the gateway in. */ + projectId?: string + /** Name for the gateway. */ + name?: string + /** Tags for the gateway. */ + tags?: string[] + /** Gateway type (commercial offer type). */ + type: string + /** Existing IP address to attach to the gateway. */ + ipId?: string + /** Defines whether SMTP traffic should be allowed pass through the gateway. */ + enableSmtp: boolean + /** Defines whether SSH bastion should be enabled the gateway. */ + enableBastion: boolean + /** Port of the SSH bastion. */ + bastionPort?: number +} + +export type CreateIPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Project to create the IP address in. */ + projectId?: string + /** Tags to give to the IP address. */ + tags?: string[] +} + +export type CreatePatRuleRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the Gateway on which to create the rule. */ + gatewayId: string + /** Public port to listen on. */ + publicPort: number + /** Private IP to forward data to. */ + privateIp: string + /** Private port to translate to. */ + privatePort: number + /** Protocol the rule should apply to. */ + protocol?: PatRuleProtocol +} + +export type DeleteGatewayNetworkRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the GatewayNetwork to delete. */ + gatewayNetworkId: string +} + +export type DeleteGatewayRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the gateway to delete. */ + gatewayId: string +} + +export type DeleteIPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the IP address to delete. */ + ipId: string +} + +export type DeletePatRuleRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the PAT rule to delete. */ + patRuleId: string +} + +export type GetGatewayNetworkRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the GatewayNetwork to fetch. */ + gatewayNetworkId: string +} + +export type GetGatewayRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the gateway to fetch. */ + gatewayId: string +} + +export type GetIPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the IP address to get. */ + ipId: string +} + +export type GetPatRuleRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the PAT rule to get. */ + patRuleId: string +} + +export type ListGatewayNetworksRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Order in which to return results. */ + orderBy?: ListGatewayNetworksRequestOrderBy + /** Page number. */ + page?: number + /** GatewayNetworks per page. */ + pageSize?: number + /** + * Filter for GatewayNetworks with these status. Use `unknown` to include all + * statuses. + */ + status?: GatewayNetworkStatus[] + /** Filter for GatewayNetworks connected to these gateways. */ + gatewayIds?: string[] + /** Filter for GatewayNetworks connected to these Private Networks. */ + privateNetworkIds?: string[] + /** Filter for GatewayNetworks with this `enable_masquerade` setting. */ + masqueradeEnabled?: boolean +} + +export interface ListGatewayNetworksResponse { + /** GatewayNetworks on this page. */ + gatewayNetworks: GatewayNetwork[] + /** Total GatewayNetworks count matching the filter. */ + totalCount: number +} + +export type ListGatewayTypesRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone +} + +export interface ListGatewayTypesResponse { + /** Available types of Public Gateway. */ + types: GatewayType[] +} + +export type ListGatewaysRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Order in which to return results. */ + orderBy?: ListGatewaysRequestOrderBy + /** Page number to return. */ + page?: number + /** Gateways per page. */ + pageSize?: number + /** Include only gateways in this Organization. */ + organizationId?: string + /** Include only gateways in this Project. */ + projectId?: string + /** Filter for gateways which have this search term in their name. */ + name?: string + /** Filter for gateways with these tags. */ + tags?: string[] + /** Filter for gateways of these types. */ + types?: string[] + /** + * Filter for gateways with these status. Use `unknown` to include all + * statuses. + */ + status?: GatewayStatus[] + /** Filter for gateways attached to these Private Networks. */ + privateNetworkIds?: string[] + /** Include also legacy gateways. */ + includeLegacy?: boolean +} + +export interface ListGatewaysResponse { + /** Gateways on this page. */ + gateways: Gateway[] + /** Total count of gateways matching the filter. */ + totalCount: number +} + +export type ListIPsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Order in which to return results. */ + orderBy?: ListIPsRequestOrderBy + /** Page number. */ + page?: number + /** IP addresses per page. */ + pageSize?: number + /** Include only gateways in this Organization. */ + organizationId?: string + /** Filter for IP addresses in this Project. */ + projectId?: string + /** Filter for IP addresses with these tags. */ + tags?: string[] + /** Filter for IP addresses that have a reverse containing this string. */ + reverse?: string + /** Filter based on whether the IP is attached to a gateway or not. */ + isFree?: boolean +} + +export interface ListIPsResponse { + /** IP addresses on this page. */ + ips: IP[] + /** Total count of IP addresses matching the filter. */ + totalCount: number +} + +export type ListPatRulesRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Order in which to return results. */ + orderBy?: ListPatRulesRequestOrderBy + /** Page number. */ + page?: number + /** PAT rules per page. */ + pageSize?: number + /** Filter for PAT rules on these gateways. */ + gatewayIds?: string[] + /** Filter for PAT rules targeting these private ips. */ + privateIps?: string[] + /** Filter for PAT rules with this protocol. */ + protocol?: PatRuleProtocol +} + +export interface ListPatRulesResponse { + /** Array of PAT rules matching the filter. */ + patRules: PatRule[] + /** Total count of PAT rules matching the filter. */ + totalCount: number +} + +export type RefreshSSHKeysRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the gateway to refresh SSH keys on. */ + gatewayId: string +} + +export type SetPatRulesRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the gateway on which to set the PAT rules. */ + gatewayId: string + /** New list of PAT rules. */ + patRules: SetPatRulesRequestRule[] +} + +export interface SetPatRulesResponse { + /** List of PAT rules. */ + patRules: PatRule[] +} + +export type UpdateGatewayNetworkRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the GatewayNetwork to update. */ + gatewayNetworkId: string + /** Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork. */ + enableMasquerade?: boolean + /** Enabling the default route also enables masquerading. */ + pushDefaultRoute?: boolean + /** Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. */ + ipamIpId?: string +} + +export type UpdateGatewayRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the gateway to update. */ + gatewayId: string + /** Name for the gateway. */ + name?: string + /** Tags for the gateway. */ + tags?: string[] + /** Defines whether SSH bastion should be enabled the gateway. */ + enableBastion?: boolean + /** Port of the SSH bastion. */ + bastionPort?: number + /** Defines whether SMTP traffic should be allowed to pass through the gateway. */ + enableSmtp?: boolean +} + +export type UpdateIPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the IP address to update. */ + ipId: string + /** Tags to give to the IP address. */ + tags?: string[] + /** Reverse to set on the address. Empty string to unset. */ + reverse?: string + /** Gateway to attach the IP address to. Empty string to detach. */ + gatewayId?: string +} + +export type UpdatePatRuleRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the PAT rule to update. */ + patRuleId: string + /** Public port to listen on. */ + publicPort?: number + /** Private IP to forward data to. */ + privateIp?: string + /** Private port to translate to. */ + privatePort?: number + /** Protocol the rule should apply to. */ + protocol?: PatRuleProtocol +} + +export type UpgradeGatewayRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the gateway to upgrade. */ + gatewayId: string + /** Gateway type (commercial offer). */ + type?: string +}