From 0d7ed7771ac79057ddd4ade63126582d38438851 Mon Sep 17 00:00:00 2001 From: Nathanael DEMACON Date: Wed, 4 Oct 2023 10:56:25 +0200 Subject: [PATCH 01/10] feat: v2 feat: don't export private types chore(release): publish - @scaleway/sdk@2.0.0-alpha.0 chore(release): publish - @scaleway/sdk@2.0.0-alpha.1 feat: all optional messages should be optional chore(release): publish - @scaleway/sdk@2.0.0-alpha.2 feat: update apis feat: add line jumps Signed-off-by: Nathanael DEMACON chore(release): publish - @scaleway/sdk@2.0.0-alpha.3 feat: update generation feat: add deprecated fields chore(release): publish - @scaleway/sdk@2.0.0-alpha.4 feat: don't default to undefined for native types feat: update generation feat: update generation Signed-off-by: Nathanael DEMACON chore(release): publish - @scaleway/sdk@2.0.0-alpha.5 feat: update generation feat: update generation chore(release): publish - @scaleway/sdk@2.0.0-alpha.6 feat: explicit marshallers return type chore(release): publish - @scaleway/sdk@2.0.0-alpha.7 feat: update generation Signed-off-by: Nathanael DEMACON feat: update generation Signed-off-by: Nathanael DEMACON chore(release): publish - @scaleway/sdk@2.0.0-alpha.8 chore(release): publish - @scaleway/sdk@2.0.0-alpha.9 feat: add new generation and fix utils feat: adjust generation chore(release): publish - @scaleway/sdk@2.0.0-alpha.10 feat: all messages are optional Signed-off-by: Nathanael DEMACON chore(release): publish - @scaleway/sdk@2.0.0-alpha.11 feat: revert utils changes chore(release): publish - @scaleway/sdk@2.0.0-alpha.12 chore(release): publish - @scaleway/sdk@2.0.0-alpha.13 chore(release): publish - @scaleway/sdk@2.0.0-alpha.14 fix: required optional type chore(release): publish - @scaleway/sdk@2.0.0-alpha.15 --- packages/clients/package.json | 2 +- .../clients/src/api/account/v2/api.gen.ts | 2 +- .../src/api/account/v2/marshalling.gen.ts | 6 +- .../clients/src/api/account/v2/types.gen.ts | 32 +- .../clients/src/api/account/v3/api.gen.ts | 2 +- .../src/api/account/v3/marshalling.gen.ts | 6 +- .../clients/src/api/account/v3/types.gen.ts | 36 +- .../src/api/applesilicon/v1alpha1/api.gen.ts | 2 +- .../applesilicon/v1alpha1/marshalling.gen.ts | 81 +- .../api/applesilicon/v1alpha1/types.gen.ts | 175 +- .../clients/src/api/baremetal/v1/api.gen.ts | 15 +- .../src/api/baremetal/v1/marshalling.gen.ts | 346 +- .../clients/src/api/baremetal/v1/types.gen.ts | 735 ++-- .../src/api/billing/v2alpha1/api.gen.ts | 8 +- .../clients/src/api/block/v1alpha1/api.gen.ts | 7 +- .../src/api/block/v1alpha1/marshalling.gen.ts | 140 +- .../src/api/block/v1alpha1/types.gen.ts | 337 +- .../block/v1alpha1/validation-rules.gen.ts | 6 + .../src/api/cockpit/v1beta1/api.gen.ts | 10 +- .../api/cockpit/v1beta1/marshalling.gen.ts | 218 +- .../src/api/container/v1beta1/api.gen.ts | 34 +- .../src/api/container/v1beta1/index.gen.ts | 1 - .../src/api/document_db/v1beta1/api.gen.ts | 12 +- .../document_db/v1beta1/marshalling.gen.ts | 809 ++-- .../src/api/document_db/v1beta1/types.gen.ts | 1376 +++--- .../clients/src/api/domain/v2beta1/api.gen.ts | 34 +- .../src/api/domain/v2beta1/index.gen.ts | 1 - .../src/api/domain/v2beta1/marshalling.gen.ts | 2046 ++++----- .../src/api/domain/v2beta1/types.gen.ts | 1360 +++--- .../src/api/flexibleip/v1alpha1/api.gen.ts | 2 +- .../flexibleip/v1alpha1/marshalling.gen.ts | 16 +- .../src/api/flexibleip/v1alpha1/types.gen.ts | 203 +- .../src/api/function/v1beta1/api.gen.ts | 34 +- .../src/api/function/v1beta1/index.gen.ts | 1 - .../clients/src/api/iam/v1alpha1/api.gen.ts | 40 +- .../clients/src/api/instance/v1/api.gen.ts | 6 +- .../clients/src/api/instance/v1/api.utils.ts | 4 +- .../clients/src/api/instance/v1/index.gen.ts | 3 + .../src/api/instance/v1/marshalling.utils.ts | 2 +- .../src/api/instance/v1/types.private.gen.ts | 235 +- .../src/api/instance/v1/types.utils.ts | 5 - packages/clients/src/api/iot/v1/api.gen.ts | 14 +- packages/clients/src/api/iot/v1/index.gen.ts | 1 - .../clients/src/api/iot/v1/marshalling.gen.ts | 509 ++- packages/clients/src/api/iot/v1/types.gen.ts | 967 +++-- packages/clients/src/api/ipam/v1/api.gen.ts | 16 +- .../src/api/ipam/v1/marshalling.gen.ts | 27 +- packages/clients/src/api/ipam/v1/types.gen.ts | 134 +- .../clients/src/api/ipfs/v1alpha1/api.gen.ts | 10 +- packages/clients/src/api/k8s/v1/api.gen.ts | 14 +- packages/clients/src/api/k8s/v1/index.gen.ts | 1 + packages/clients/src/api/k8s/v1/index.ts | 1 - .../clients/src/api/k8s/v1/marshalling.gen.ts | 490 ++- packages/clients/src/api/k8s/v1/types.gen.ts | 1002 +++-- packages/clients/src/api/lb/v1/api.gen.ts | 1855 ++++---- .../clients/src/api/lb/v1/marshalling.gen.ts | 1072 ++--- packages/clients/src/api/lb/v1/types.gen.ts | 3720 ++++++++--------- .../src/api/marketplace/v1/marshalling.gen.ts | 27 +- .../src/api/marketplace/v1/types.gen.ts | 93 +- .../clients/src/api/marketplace/v2/api.gen.ts | 25 +- .../src/api/marketplace/v2/marshalling.gen.ts | 24 +- .../src/api/marketplace/v2/types.gen.ts | 92 +- .../clients/src/api/mnq/v1alpha1/api.gen.ts | 5 +- .../src/api/mnq/v1alpha1/marshalling.gen.ts | 106 +- .../clients/src/api/mnq/v1alpha1/types.gen.ts | 199 +- .../clients/src/api/mnq/v1beta1/api.gen.ts | 15 +- .../src/api/mnq/v1beta1/marshalling.gen.ts | 167 +- .../clients/src/api/mnq/v1beta1/types.gen.ts | 341 +- .../api/mnq/v1beta1/validation-rules.gen.ts | 34 + packages/clients/src/api/rdb/v1/api.gen.ts | 14 +- packages/clients/src/api/redis/v1/api.gen.ts | 2 +- .../src/api/redis/v1/marshalling.gen.ts | 358 +- .../clients/src/api/redis/v1/types.gen.ts | 510 ++- .../clients/src/api/registry/v1/api.gen.ts | 6 +- .../src/api/registry/v1/marshalling.gen.ts | 28 +- .../clients/src/api/registry/v1/types.gen.ts | 207 +- .../src/api/secret/v1alpha1/api.gen.ts | 4 +- .../api/secret/v1alpha1/marshalling.gen.ts | 102 +- .../src/api/secret/v1alpha1/types.gen.ts | 585 ++- packages/clients/src/api/std/index.gen.ts | 3 + packages/clients/src/api/std/types.gen.ts | 4 + .../clients/src/api/tem/v1alpha1/api.gen.ts | 2 +- packages/clients/src/api/test/v1/api.gen.ts | 15 +- .../src/api/test/v1/marshalling.gen.ts | 22 +- packages/clients/src/api/test/v1/types.gen.ts | 90 +- packages/clients/src/api/vpc/v1/api.gen.ts | 2 +- .../clients/src/api/vpc/v1/marshalling.gen.ts | 6 +- packages/clients/src/api/vpc/v1/types.gen.ts | 61 +- packages/clients/src/api/vpc/v2/api.gen.ts | 4 +- .../clients/src/api/vpc/v2/marshalling.gen.ts | 46 +- packages/clients/src/api/vpc/v2/types.gen.ts | 249 +- packages/clients/src/api/vpcgw/v1/api.gen.ts | 20 +- .../src/api/webhosting/v1alpha1/api.gen.ts | 4 +- .../webhosting/v1alpha1/marshalling.gen.ts | 123 +- .../src/api/webhosting/v1alpha1/types.gen.ts | 245 +- packages/clients/src/scw/constants.ts | 2 +- 96 files changed, 11041 insertions(+), 11024 deletions(-) create mode 100644 packages/clients/src/api/std/index.gen.ts create mode 100644 packages/clients/src/api/std/types.gen.ts diff --git a/packages/clients/package.json b/packages/clients/package.json index b74432756..fcce5b63b 100644 --- a/packages/clients/package.json +++ b/packages/clients/package.json @@ -1,6 +1,6 @@ { "name": "@scaleway/sdk", - "version": "1.42.0", + "version": "2.0.0-alpha.15", "license": "Apache-2.0", "description": "Scaleway SDK.", "keywords": [ diff --git a/packages/clients/src/api/account/v2/api.gen.ts b/packages/clients/src/api/account/v2/api.gen.ts index 16c4f03a4..8d9d1d12d 100644 --- a/packages/clients/src/api/account/v2/api.gen.ts +++ b/packages/clients/src/api/account/v2/api.gen.ts @@ -63,7 +63,7 @@ export class API extends ParentAPI { path: `/account/v2/projects`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], [ 'organization_id', request.organizationId ?? diff --git a/packages/clients/src/api/account/v2/marshalling.gen.ts b/packages/clients/src/api/account/v2/marshalling.gen.ts index af11ba771..1b059d025 100644 --- a/packages/clients/src/api/account/v2/marshalling.gen.ts +++ b/packages/clients/src/api/account/v2/marshalling.gen.ts @@ -14,7 +14,7 @@ import type { UpdateProjectRequest, } from './types.gen' -export const unmarshalProject = (data: unknown) => { +export const unmarshalProject = (data: unknown): Project => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Project' failed as data isn't a dictionary.`, @@ -31,7 +31,9 @@ export const unmarshalProject = (data: unknown) => { } as Project } -export const unmarshalListProjectsResponse = (data: unknown) => { +export const unmarshalListProjectsResponse = ( + data: unknown, +): ListProjectsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary.`, diff --git a/packages/clients/src/api/account/v2/types.gen.ts b/packages/clients/src/api/account/v2/types.gen.ts index a1df7031b..7342aaecb 100644 --- a/packages/clients/src/api/account/v2/types.gen.ts +++ b/packages/clients/src/api/account/v2/types.gen.ts @@ -7,15 +7,6 @@ export type ListProjectsRequestOrderBy = | 'name_asc' | 'name_desc' -/** List projects response. */ -export interface ListProjectsResponse { - /** Total number of Projects. */ - totalCount: number - /** Paginated returned Projects. */ - projects: Project[] -} - -/** Project. */ export interface Project { /** ID of the Project. */ id: string @@ -40,6 +31,16 @@ export type CreateProjectRequest = { description?: string } +export type DeleteProjectRequest = { + /** Project ID of the Project. */ + projectId?: string +} + +export type GetProjectRequest = { + /** Project ID of the Project. */ + projectId?: string +} + export type ListProjectsRequest = { /** Organization ID of the Project. */ organizationId?: string @@ -58,14 +59,11 @@ export type ListProjectsRequest = { projectIds?: string[] } -export type GetProjectRequest = { - /** Project ID of the Project. */ - projectId?: string -} - -export type DeleteProjectRequest = { - /** Project ID of the Project. */ - projectId?: string +export interface ListProjectsResponse { + /** Total number of Projects. */ + totalCount: number + /** Paginated returned Projects. */ + projects: Project[] } export type UpdateProjectRequest = { diff --git a/packages/clients/src/api/account/v3/api.gen.ts b/packages/clients/src/api/account/v3/api.gen.ts index 05fb498e6..1d501a32b 100644 --- a/packages/clients/src/api/account/v3/api.gen.ts +++ b/packages/clients/src/api/account/v3/api.gen.ts @@ -61,7 +61,7 @@ export class ProjectAPI extends ParentAPI { path: `/account/v3/projects`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], [ 'organization_id', request.organizationId ?? diff --git a/packages/clients/src/api/account/v3/marshalling.gen.ts b/packages/clients/src/api/account/v3/marshalling.gen.ts index 151eb0a5c..619dbb9dc 100644 --- a/packages/clients/src/api/account/v3/marshalling.gen.ts +++ b/packages/clients/src/api/account/v3/marshalling.gen.ts @@ -14,7 +14,7 @@ import type { ProjectApiUpdateProjectRequest, } from './types.gen' -export const unmarshalProject = (data: unknown) => { +export const unmarshalProject = (data: unknown): Project => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Project' failed as data isn't a dictionary.`, @@ -31,7 +31,9 @@ export const unmarshalProject = (data: unknown) => { } as Project } -export const unmarshalListProjectsResponse = (data: unknown) => { +export const unmarshalListProjectsResponse = ( + data: unknown, +): ListProjectsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary.`, diff --git a/packages/clients/src/api/account/v3/types.gen.ts b/packages/clients/src/api/account/v3/types.gen.ts index d35012ac5..b86955ac0 100644 --- a/packages/clients/src/api/account/v3/types.gen.ts +++ b/packages/clients/src/api/account/v3/types.gen.ts @@ -7,15 +7,6 @@ export type ListProjectsRequestOrderBy = | 'name_asc' | 'name_desc' -/** List projects response. */ -export interface ListProjectsResponse { - /** Total number of Projects. */ - totalCount: number - /** Paginated returned Projects. */ - projects: Project[] -} - -/** Project. */ export interface Project { /** ID of the Project. */ id: string @@ -31,6 +22,13 @@ export interface Project { description: string } +export interface ListProjectsResponse { + /** Total number of Projects. */ + totalCount: number + /** Paginated returned Projects. */ + projects: Project[] +} + export type ProjectApiCreateProjectRequest = { /** Name of the Project. */ name?: string @@ -40,6 +38,16 @@ export type ProjectApiCreateProjectRequest = { description: string } +export type ProjectApiDeleteProjectRequest = { + /** Project ID of the Project. */ + projectId?: string +} + +export type ProjectApiGetProjectRequest = { + /** Project ID of the Project. */ + projectId?: string +} + export type ProjectApiListProjectsRequest = { /** Organization ID of the Project. */ organizationId?: string @@ -58,16 +66,6 @@ export type ProjectApiListProjectsRequest = { projectIds?: string[] } -export type ProjectApiGetProjectRequest = { - /** Project ID of the Project. */ - projectId?: string -} - -export type ProjectApiDeleteProjectRequest = { - /** Project ID of the Project. */ - projectId?: string -} - export type ProjectApiUpdateProjectRequest = { /** Project ID of the Project. */ projectId?: string diff --git a/packages/clients/src/api/applesilicon/v1alpha1/api.gen.ts b/packages/clients/src/api/applesilicon/v1alpha1/api.gen.ts index b17d2b087..5b43aa887 100644 --- a/packages/clients/src/api/applesilicon/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/applesilicon/v1alpha1/api.gen.ts @@ -119,7 +119,7 @@ export class API extends ParentAPI { request.zone ?? this.client.settings.defaultZone, )}/servers`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/applesilicon/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/applesilicon/v1alpha1/marshalling.gen.ts index 491760f1c..ae5e7c656 100644 --- a/packages/clients/src/api/applesilicon/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/applesilicon/v1alpha1/marshalling.gen.ts @@ -21,53 +21,79 @@ import type { UpdateServerRequest, } from './types.gen' -const unmarshalServerTypeCPU = (data: unknown) => { +export const unmarshalOS = (data: unknown): OS => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OS' failed as data isn't a dictionary.`, + ) + } + + return { + compatibleServerTypes: data.compatible_server_types, + id: data.id, + imageUrl: data.image_url, + label: data.label, + name: data.name, + } as OS +} + +const unmarshalServerTypeCPU = (data: unknown): ServerTypeCPU => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ServerTypeCPU' failed as data isn't a dictionary.`, ) } - return { coreCount: data.core_count, name: data.name } as ServerTypeCPU + return { + coreCount: data.core_count, + name: data.name, + } as ServerTypeCPU } -const unmarshalServerTypeDisk = (data: unknown) => { +const unmarshalServerTypeDisk = (data: unknown): ServerTypeDisk => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ServerTypeDisk' failed as data isn't a dictionary.`, ) } - return { capacity: data.capacity, type: data.type } as ServerTypeDisk + return { + capacity: data.capacity, + type: data.type, + } as ServerTypeDisk } -const unmarshalServerTypeMemory = (data: unknown) => { +const unmarshalServerTypeMemory = (data: unknown): ServerTypeMemory => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ServerTypeMemory' failed as data isn't a dictionary.`, ) } - return { capacity: data.capacity, type: data.type } as ServerTypeMemory + return { + capacity: data.capacity, + type: data.type, + } as ServerTypeMemory } -export const unmarshalOS = (data: unknown) => { +export const unmarshalServerType = (data: unknown): ServerType => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'OS' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`, ) } return { - compatibleServerTypes: data.compatible_server_types, - id: data.id, - imageUrl: data.image_url, - label: data.label, + cpu: data.cpu ? unmarshalServerTypeCPU(data.cpu) : undefined, + disk: data.disk ? unmarshalServerTypeDisk(data.disk) : undefined, + memory: data.memory ? unmarshalServerTypeMemory(data.memory) : undefined, + minimumLeaseDuration: data.minimum_lease_duration, name: data.name, - } as OS + stock: data.stock, + } as ServerType } -export const unmarshalServer = (data: unknown) => { +export const unmarshalServer = (data: unknown): Server => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Server' failed as data isn't a dictionary.`, @@ -90,24 +116,7 @@ export const unmarshalServer = (data: unknown) => { } as Server } -export const unmarshalServerType = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`, - ) - } - - return { - cpu: data.cpu ? unmarshalServerTypeCPU(data.cpu) : undefined, - disk: data.disk ? unmarshalServerTypeDisk(data.disk) : undefined, - memory: data.memory ? unmarshalServerTypeMemory(data.memory) : undefined, - minimumLeaseDuration: data.minimum_lease_duration, - name: data.name, - stock: data.stock, - } as ServerType -} - -export const unmarshalListOSResponse = (data: unknown) => { +export const unmarshalListOSResponse = (data: unknown): ListOSResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`, @@ -120,7 +129,9 @@ export const unmarshalListOSResponse = (data: unknown) => { } as ListOSResponse } -export const unmarshalListServerTypesResponse = (data: unknown) => { +export const unmarshalListServerTypesResponse = ( + data: unknown, +): ListServerTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListServerTypesResponse' failed as data isn't a dictionary.`, @@ -132,7 +143,9 @@ export const unmarshalListServerTypesResponse = (data: unknown) => { } as ListServerTypesResponse } -export const unmarshalListServersResponse = (data: unknown) => { +export const unmarshalListServersResponse = ( + data: unknown, +): ListServersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`, diff --git a/packages/clients/src/api/applesilicon/v1alpha1/types.gen.ts b/packages/clients/src/api/applesilicon/v1alpha1/types.gen.ts index ae409d75e..79d7ac633 100644 --- a/packages/clients/src/api/applesilicon/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/applesilicon/v1alpha1/types.gen.ts @@ -22,29 +22,21 @@ export type ServerTypeStock = | 'low_stock' | 'high_stock' -/** List os response. */ -export interface ListOSResponse { - /** Total number of OS. */ - totalCount: number - /** List of OS. */ - os: OS[] +export interface ServerTypeCPU { + name: string + coreCount: number } -/** List server types response. */ -export interface ListServerTypesResponse { - /** Available server types. */ - serverTypes: ServerType[] +export interface ServerTypeDisk { + capacity: number + type: string } -/** List servers response. */ -export interface ListServersResponse { - /** Total number of servers. */ - totalCount: number - /** Paginated returned servers. */ - servers: Server[] +export interface ServerTypeMemory { + capacity: number + type: string } -/** Os. */ export interface OS { /** Unique ID of the OS. */ id: string @@ -58,7 +50,21 @@ export interface OS { compatibleServerTypes: string[] } -/** Server. */ +export interface ServerType { + /** CPU description. */ + cpu?: ServerTypeCPU + /** Size of the local disk of the server. */ + disk?: ServerTypeDisk + /** Name of the type. */ + name: string + /** Size of memory available. */ + memory?: ServerTypeMemory + /** Current stock. */ + stock: ServerTypeStock + /** Minimum duration of the lease in seconds (example. 3.4s). */ + minimumLeaseDuration?: string +} + export interface Server { /** UUID of the server. */ id: string @@ -86,79 +92,43 @@ export interface Server { zone: Zone } -/** Server type. */ -export interface ServerType { - /** CPU description. */ - cpu?: ServerTypeCPU - /** Size of the local disk of the server. */ - disk?: ServerTypeDisk - /** Name of the type. */ - name: string - /** Size of memory available. */ - memory?: ServerTypeMemory - /** Current stock. */ - stock: ServerTypeStock - /** - * Minimum duration of the lease in seconds. Minimum duration of the lease in - * seconds (example. 3.4s). - */ - minimumLeaseDuration?: string -} - -export interface ServerTypeCPU { - name: string - coreCount: number -} - -export interface ServerTypeDisk { - capacity: number - type: string -} - -export interface ServerTypeMemory { - capacity: number +export type CreateServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Create a server with this given name. */ + name?: string + /** Create a server in the given project ID. */ + projectId?: string + /** Create a server of the given type. */ type: string } -export type ListServerTypesRequest = { +export type DeleteServerRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone + /** UUID of the server you want to delete. */ + serverId: string } -export type GetServerTypeRequest = { +export type GetOSRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Server type identifier. */ - serverType: string + /** UUID of the OS you want to get. */ + osId: string } -export type CreateServerRequest = { +export type GetServerRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Create a server with this given name. */ - name?: string - /** Create a server in the given project ID. */ - projectId?: string - /** Create a server of the given type. */ - type: string + /** UUID of the server you want to get. */ + serverId: string } -export type ListServersRequest = { +export type GetServerTypeRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Sort order of the returned servers. */ - orderBy?: ListServersRequestOrderBy - /** Only list servers of this project ID. */ - projectId?: string - /** Only list servers of this Organization ID. */ - organizationId?: string - /** Positive integer to choose the page to return. */ - page?: number - /** - * Positive integer lower or equal to 100 to select the number of items to - * return. - */ - pageSize?: number + /** Server type identifier. */ + serverType: string } export type ListOSRequest = { @@ -180,34 +150,46 @@ export type ListOSRequest = { name?: string } -export type GetOSRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the OS you want to get. */ - osId: string +export interface ListOSResponse { + /** Total number of OS. */ + totalCount: number + /** List of OS. */ + os: OS[] } -export type GetServerRequest = { +export type ListServerTypesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the server you want to get. */ - serverId: string } -export type UpdateServerRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the server you want to update. */ - serverId: string - /** Updated name for your server. */ - name: string +export interface ListServerTypesResponse { + /** Available server types. */ + serverTypes: ServerType[] } -export type DeleteServerRequest = { +export type ListServersRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the server you want to delete. */ - serverId: string + /** Sort order of the returned servers. */ + orderBy?: ListServersRequestOrderBy + /** Only list servers of this project ID. */ + projectId?: string + /** Only list servers of this Organization ID. */ + organizationId?: string + /** Positive integer to choose the page to return. */ + page?: number + /** + * Positive integer lower or equal to 100 to select the number of items to + * return. + */ + pageSize?: number +} + +export interface ListServersResponse { + /** Total number of servers. */ + totalCount: number + /** Paginated returned servers. */ + servers: Server[] } export type RebootServerRequest = { @@ -223,3 +205,12 @@ export type ReinstallServerRequest = { /** UUID of the server you want to reinstall. */ serverId: string } + +export type UpdateServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the server you want to update. */ + serverId: string + /** Updated name for your server. */ + name?: string +} diff --git a/packages/clients/src/api/baremetal/v1/api.gen.ts b/packages/clients/src/api/baremetal/v1/api.gen.ts index 5e8664aee..89557f740 100644 --- a/packages/clients/src/api/baremetal/v1/api.gen.ts +++ b/packages/clients/src/api/baremetal/v1/api.gen.ts @@ -95,7 +95,7 @@ const jsonContentHeaders = { /** * Elastic Metal API. * - * This API allows to manage your Elastic Metal server. Elastic Metal API. + * This API allows to manage your Elastic Metal server. */ export class API extends ParentAPI { /** Lists the available zones of the API. */ @@ -117,7 +117,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['name', request.name], ['option_id', request.optionId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -367,7 +367,7 @@ export class API extends ParentAPI { request.zone ?? this.client.settings.defaultZone, )}/servers/${validatePathParam('serverId', request.serverId)}/events`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -549,10 +549,7 @@ export class API extends ParentAPI { 'page_size', request.pageSize ?? this.client.settings.defaultPageSize, ], - [ - 'subscription_period', - request.subscriptionPeriod ?? 'unknown_subscription_period', - ], + ['subscription_period', request.subscriptionPeriod], ), }, unmarshalListOffersResponse, @@ -644,7 +641,7 @@ export class API extends ParentAPI { request.zone ?? this.client.settings.defaultZone, )}/settings`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -817,7 +814,7 @@ export class PrivateNetworkAPI extends ParentAPI { request.zone ?? this.client.settings.defaultZone, )}/server-private-networks`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/baremetal/v1/marshalling.gen.ts b/packages/clients/src/api/baremetal/v1/marshalling.gen.ts index 66210f492..fe23d4309 100644 --- a/packages/clients/src/api/baremetal/v1/marshalling.gen.ts +++ b/packages/clients/src/api/baremetal/v1/marshalling.gen.ts @@ -52,33 +52,7 @@ import type { UpdateSettingRequest, } from './types.gen' -const unmarshalCPU = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'CPU' failed as data isn't a dictionary.`, - ) - } - - return { - benchmark: data.benchmark, - coreCount: data.core_count, - frequency: data.frequency, - name: data.name, - threadCount: data.thread_count, - } as CPU -} - -const unmarshalDisk = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Disk' failed as data isn't a dictionary.`, - ) - } - - return { capacity: data.capacity, type: data.type } as Disk -} - -export const unmarshalIP = (data: unknown) => { +export const unmarshalIP = (data: unknown): IP => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'IP' failed as data isn't a dictionary.`, @@ -95,22 +69,7 @@ export const unmarshalIP = (data: unknown) => { } as IP } -const unmarshalMemory = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Memory' failed as data isn't a dictionary.`, - ) - } - - return { - capacity: data.capacity, - frequency: data.frequency, - isEcc: data.is_ecc, - type: data.type, - } as Memory -} - -const unmarshalOSOSField = (data: unknown) => { +const unmarshalOSOSField = (data: unknown): OSOSField => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'OSOSField' failed as data isn't a dictionary.`, @@ -124,120 +83,123 @@ const unmarshalOSOSField = (data: unknown) => { } as OSOSField } -const unmarshalOfferOptionOffer = (data: unknown) => { +export const unmarshalOS = (data: unknown): OS => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'OfferOptionOffer' failed as data isn't a dictionary.`, + `Unmarshalling the type 'OS' failed as data isn't a dictionary.`, ) } return { + allowed: data.allowed, enabled: data.enabled, id: data.id, - manageable: data.manageable, + licenseRequired: data.license_required, + logoUrl: data.logo_url, name: data.name, - osId: data.os_id, - price: data.price ? unmarshalMoney(data.price) : undefined, - subscriptionPeriod: data.subscription_period, - } as OfferOptionOffer + password: data.password ? unmarshalOSOSField(data.password) : undefined, + servicePassword: data.service_password + ? unmarshalOSOSField(data.service_password) + : undefined, + serviceUser: data.service_user + ? unmarshalOSOSField(data.service_user) + : undefined, + ssh: data.ssh ? unmarshalOSOSField(data.ssh) : undefined, + user: data.user ? unmarshalOSOSField(data.user) : undefined, + version: data.version, + } as OS } -const unmarshalPersistentMemory = (data: unknown) => { +const unmarshalCPU = (data: unknown): CPU => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'PersistentMemory' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CPU' failed as data isn't a dictionary.`, ) } return { - capacity: data.capacity, + benchmark: data.benchmark, + coreCount: data.core_count, frequency: data.frequency, - type: data.type, - } as PersistentMemory + name: data.name, + threadCount: data.thread_count, + } as CPU } -const unmarshalRaidController = (data: unknown) => { +const unmarshalDisk = (data: unknown): Disk => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RaidController' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Disk' failed as data isn't a dictionary.`, ) } - return { model: data.model, raidLevel: data.raid_level } as RaidController + return { + capacity: data.capacity, + type: data.type, + } as Disk } -const unmarshalServerInstall = (data: unknown) => { +const unmarshalMemory = (data: unknown): Memory => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerInstall' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Memory' failed as data isn't a dictionary.`, ) } return { - hostname: data.hostname, - osId: data.os_id, - serviceUrl: data.service_url, - serviceUser: data.service_user, - sshKeyIds: data.ssh_key_ids, - status: data.status, - user: data.user, - } as ServerInstall + capacity: data.capacity, + frequency: data.frequency, + isEcc: data.is_ecc, + type: data.type, + } as Memory } -const unmarshalServerOption = (data: unknown) => { +const unmarshalOfferOptionOffer = (data: unknown): OfferOptionOffer => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerOption' failed as data isn't a dictionary.`, + `Unmarshalling the type 'OfferOptionOffer' failed as data isn't a dictionary.`, ) } return { - expiresAt: unmarshalDate(data.expires_at), + enabled: data.enabled, id: data.id, manageable: data.manageable, name: data.name, - status: data.status, - } as ServerOption + osId: data.os_id, + price: data.price ? unmarshalMoney(data.price) : undefined, + subscriptionPeriod: data.subscription_period, + } as OfferOptionOffer } -const unmarshalServerRescueServer = (data: unknown) => { +const unmarshalPersistentMemory = (data: unknown): PersistentMemory => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerRescueServer' failed as data isn't a dictionary.`, + `Unmarshalling the type 'PersistentMemory' failed as data isn't a dictionary.`, ) } - return { password: data.password, user: data.user } as ServerRescueServer + return { + capacity: data.capacity, + frequency: data.frequency, + type: data.type, + } as PersistentMemory } -export const unmarshalOS = (data: unknown) => { +const unmarshalRaidController = (data: unknown): RaidController => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'OS' failed as data isn't a dictionary.`, + `Unmarshalling the type 'RaidController' failed as data isn't a dictionary.`, ) } return { - allowed: data.allowed, - enabled: data.enabled, - id: data.id, - licenseRequired: data.license_required, - logoUrl: data.logo_url, - name: data.name, - password: data.password ? unmarshalOSOSField(data.password) : undefined, - servicePassword: data.service_password - ? unmarshalOSOSField(data.service_password) - : undefined, - serviceUser: data.service_user - ? unmarshalOSOSField(data.service_user) - : undefined, - ssh: data.ssh ? unmarshalOSOSField(data.ssh) : undefined, - user: data.user ? unmarshalOSOSField(data.user) : undefined, - version: data.version, - } as OS + model: data.model, + raidLevel: data.raid_level, + } as RaidController } -export const unmarshalOffer = (data: unknown) => { +export const unmarshalOffer = (data: unknown): Offer => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Offer' failed as data isn't a dictionary.`, @@ -280,83 +242,121 @@ export const unmarshalOffer = (data: unknown) => { } as Offer } -export const unmarshalOption = (data: unknown) => { +export const unmarshalOption = (data: unknown): Option => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Option' failed as data isn't a dictionary.`, ) } - return { id: data.id, manageable: data.manageable, name: data.name } as Option + return { + id: data.id, + manageable: data.manageable, + name: data.name, + } as Option } -export const unmarshalServer = (data: unknown) => { +export const unmarshalServerPrivateNetwork = ( + data: unknown, +): ServerPrivateNetwork => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Server' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ServerPrivateNetwork' failed as data isn't a dictionary.`, ) } return { - bootType: data.boot_type, createdAt: unmarshalDate(data.created_at), - description: data.description, - domain: data.domain, id: data.id, - install: data.install ? unmarshalServerInstall(data.install) : undefined, - ips: unmarshalArrayOfObject(data.ips, unmarshalIP), - name: data.name, - offerId: data.offer_id, - offerName: data.offer_name, - options: unmarshalArrayOfObject(data.options, unmarshalServerOption), - organizationId: data.organization_id, - pingStatus: data.ping_status, + privateNetworkId: data.private_network_id, projectId: data.project_id, - rescueServer: data.rescue_server - ? unmarshalServerRescueServer(data.rescue_server) - : undefined, + serverId: data.server_id, status: data.status, - tags: data.tags, updatedAt: unmarshalDate(data.updated_at), - zone: data.zone, - } as Server + vlan: data.vlan, + } as ServerPrivateNetwork } -const unmarshalServerEvent = (data: unknown) => { +const unmarshalServerInstall = (data: unknown): ServerInstall => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerEvent' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ServerInstall' failed as data isn't a dictionary.`, ) } return { - action: data.action, - createdAt: unmarshalDate(data.created_at), + hostname: data.hostname, + osId: data.os_id, + serviceUrl: data.service_url, + serviceUser: data.service_user, + sshKeyIds: data.ssh_key_ids, + status: data.status, + user: data.user, + } as ServerInstall +} + +const unmarshalServerOption = (data: unknown): ServerOption => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerOption' failed as data isn't a dictionary.`, + ) + } + + return { + expiresAt: unmarshalDate(data.expires_at), id: data.id, - updatedAt: unmarshalDate(data.updated_at), - } as ServerEvent + manageable: data.manageable, + name: data.name, + status: data.status, + } as ServerOption } -export const unmarshalServerPrivateNetwork = (data: unknown) => { +const unmarshalServerRescueServer = (data: unknown): ServerRescueServer => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerPrivateNetwork' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ServerRescueServer' failed as data isn't a dictionary.`, + ) + } + + return { + password: data.password, + user: data.user, + } as ServerRescueServer +} + +export const unmarshalServer = (data: unknown): Server => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Server' failed as data isn't a dictionary.`, ) } return { + bootType: data.boot_type, createdAt: unmarshalDate(data.created_at), + description: data.description, + domain: data.domain, id: data.id, - privateNetworkId: data.private_network_id, + install: data.install ? unmarshalServerInstall(data.install) : undefined, + ips: unmarshalArrayOfObject(data.ips, unmarshalIP), + name: data.name, + offerId: data.offer_id, + offerName: data.offer_name, + options: unmarshalArrayOfObject(data.options, unmarshalServerOption), + organizationId: data.organization_id, + pingStatus: data.ping_status, projectId: data.project_id, - serverId: data.server_id, + rescueServer: data.rescue_server + ? unmarshalServerRescueServer(data.rescue_server) + : undefined, status: data.status, + tags: data.tags, updatedAt: unmarshalDate(data.updated_at), - vlan: data.vlan, - } as ServerPrivateNetwork + zone: data.zone, + } as Server } -export const unmarshalSetting = (data: unknown) => { +export const unmarshalSetting = (data: unknown): Setting => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Setting' failed as data isn't a dictionary.`, @@ -371,7 +371,7 @@ export const unmarshalSetting = (data: unknown) => { } as Setting } -export const unmarshalBMCAccess = (data: unknown) => { +export const unmarshalBMCAccess = (data: unknown): BMCAccess => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'BMCAccess' failed as data isn't a dictionary.`, @@ -386,7 +386,9 @@ export const unmarshalBMCAccess = (data: unknown) => { } as BMCAccess } -export const unmarshalGetServerMetricsResponse = (data: unknown) => { +export const unmarshalGetServerMetricsResponse = ( + data: unknown, +): GetServerMetricsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetServerMetricsResponse' failed as data isn't a dictionary.`, @@ -398,7 +400,7 @@ export const unmarshalGetServerMetricsResponse = (data: unknown) => { } as GetServerMetricsResponse } -export const unmarshalListOSResponse = (data: unknown) => { +export const unmarshalListOSResponse = (data: unknown): ListOSResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`, @@ -411,7 +413,9 @@ export const unmarshalListOSResponse = (data: unknown) => { } as ListOSResponse } -export const unmarshalListOffersResponse = (data: unknown) => { +export const unmarshalListOffersResponse = ( + data: unknown, +): ListOffersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListOffersResponse' failed as data isn't a dictionary.`, @@ -424,7 +428,9 @@ export const unmarshalListOffersResponse = (data: unknown) => { } as ListOffersResponse } -export const unmarshalListOptionsResponse = (data: unknown) => { +export const unmarshalListOptionsResponse = ( + data: unknown, +): ListOptionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListOptionsResponse' failed as data isn't a dictionary.`, @@ -437,7 +443,24 @@ export const unmarshalListOptionsResponse = (data: unknown) => { } as ListOptionsResponse } -export const unmarshalListServerEventsResponse = (data: unknown) => { +const unmarshalServerEvent = (data: unknown): ServerEvent => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerEvent' failed as data isn't a dictionary.`, + ) + } + + return { + action: data.action, + createdAt: unmarshalDate(data.created_at), + id: data.id, + updatedAt: unmarshalDate(data.updated_at), + } as ServerEvent +} + +export const unmarshalListServerEventsResponse = ( + data: unknown, +): ListServerEventsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListServerEventsResponse' failed as data isn't a dictionary.`, @@ -450,7 +473,9 @@ export const unmarshalListServerEventsResponse = (data: unknown) => { } as ListServerEventsResponse } -export const unmarshalListServerPrivateNetworksResponse = (data: unknown) => { +export const unmarshalListServerPrivateNetworksResponse = ( + data: unknown, +): ListServerPrivateNetworksResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListServerPrivateNetworksResponse' failed as data isn't a dictionary.`, @@ -466,7 +491,9 @@ export const unmarshalListServerPrivateNetworksResponse = (data: unknown) => { } as ListServerPrivateNetworksResponse } -export const unmarshalListServersResponse = (data: unknown) => { +export const unmarshalListServersResponse = ( + data: unknown, +): ListServersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`, @@ -479,7 +506,9 @@ export const unmarshalListServersResponse = (data: unknown) => { } as ListServersResponse } -export const unmarshalListSettingsResponse = (data: unknown) => { +export const unmarshalListSettingsResponse = ( + data: unknown, +): ListSettingsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSettingsResponse' failed as data isn't a dictionary.`, @@ -492,7 +521,9 @@ export const unmarshalListSettingsResponse = (data: unknown) => { } as ListSettingsResponse } -export const unmarshalSetServerPrivateNetworksResponse = (data: unknown) => { +export const unmarshalSetServerPrivateNetworksResponse = ( + data: unknown, +): SetServerPrivateNetworksResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetServerPrivateNetworksResponse' failed as data isn't a dictionary.`, @@ -507,6 +538,13 @@ export const unmarshalSetServerPrivateNetworksResponse = (data: unknown) => { } as SetServerPrivateNetworksResponse } +export const marshalAddOptionServerRequest = ( + request: AddOptionServerRequest, + defaults: DefaultValues, +): Record => ({ + expires_at: request.expiresAt, +}) + const marshalCreateServerRequestInstall = ( request: CreateServerRequestInstall, defaults: DefaultValues, @@ -520,36 +558,30 @@ const marshalCreateServerRequestInstall = ( user: request.user, }) -export const marshalAddOptionServerRequest = ( - request: AddOptionServerRequest, - defaults: DefaultValues, -): Record => ({ - expires_at: request.expiresAt, -}) - export const marshalCreateServerRequest = ( request: CreateServerRequest, defaults: DefaultValues, ): Record => ({ description: request.description, - install: request.install - ? marshalCreateServerRequestInstall(request.install, defaults) - : undefined, + install: + request.install !== undefined + ? marshalCreateServerRequestInstall(request.install, defaults) + : undefined, name: request.name, offer_id: request.offerId, option_ids: request.optionIds, tags: request.tags, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, ]), }) @@ -584,7 +616,7 @@ export const marshalRebootServerRequest = ( request: RebootServerRequest, defaults: DefaultValues, ): Record => ({ - boot_type: request.bootType ?? 'unknown_boot_type', + boot_type: request.bootType, }) export const marshalStartBMCAccessRequest = ( @@ -598,7 +630,7 @@ export const marshalStartServerRequest = ( request: StartServerRequest, defaults: DefaultValues, ): Record => ({ - boot_type: request.bootType ?? 'unknown_boot_type', + boot_type: request.bootType, }) export const marshalUpdateIPRequest = ( diff --git a/packages/clients/src/api/baremetal/v1/types.gen.ts b/packages/clients/src/api/baremetal/v1/types.gen.ts index ae412d1a5..046ae63a7 100644 --- a/packages/clients/src/api/baremetal/v1/types.gen.ts +++ b/packages/clients/src/api/baremetal/v1/types.gen.ts @@ -72,28 +72,12 @@ export type ServerStatus = export type SettingType = 'unknown' | 'smtp' -/** Bmc access. */ -export interface BMCAccess { - /** URL to access to the server console. */ - url: string - /** - * The login to use for the BMC (Baseboard Management Controller) access - * authentification. - */ - login: string - /** - * The password to use for the BMC (Baseboard Management Controller) access - * authentification. - */ - password: string - /** - * The date after which the BMC (Baseboard Management Controller) access will - * be closed. - */ - expiresAt?: Date +export interface OSOSField { + editable: boolean + required: boolean + defaultValue?: string } -/** Cpu. */ export interface CPU { /** Name of the CPU. */ name: string @@ -107,25 +91,6 @@ export interface CPU { benchmark: string } -/** Create server request. install. */ -export interface CreateServerRequestInstall { - /** ID of the OS to installation on the server. */ - osId: string - /** Hostname of the server. */ - hostname: string - /** SSH key IDs authorized on the server. */ - sshKeyIds: string[] - /** User for the installation. */ - user?: string - /** Password for the installation. */ - password?: string - /** Regular user that runs the service to be installed on the server. */ - serviceUser?: string - /** Password used for the service to install. */ - servicePassword?: string -} - -/** Disk. */ export interface Disk { /** Capacity of the disk in bytes. */ capacity: number @@ -133,13 +98,51 @@ export interface Disk { type: string } -/** Get server metrics response. */ -export interface GetServerMetricsResponse { - /** Timeseries object representing pings on the server. */ - pings?: TimeSeries +export interface Memory { + /** Capacity of the memory in bytes. */ + capacity: number + /** Type of the memory. */ + type: string + /** Frequency of the memory in MHz. */ + frequency: number + /** True if the memory is an error-correcting code memory. */ + isEcc: boolean +} + +export interface OfferOptionOffer { + /** ID of the option. */ + id: string + /** Name of the option. */ + name: string + /** + * If true the option is enabled and included by default in the offer If false + * the option is available for the offer but not included by default. + */ + enabled: boolean + /** Period of subscription for the offer. */ + subscriptionPeriod: OfferSubscriptionPeriod + /** Price of the option. */ + price?: Money + /** Boolean to know if option could be managed. */ + manageable: boolean + /** ID of the OS linked to the option. */ + osId?: string +} + +export interface PersistentMemory { + /** Capacity of the memory in bytes. */ + capacity: number + /** Type of the memory. */ + type: string + /** Frequency of the memory in MHz. */ + frequency: number +} + +export interface RaidController { + model: string + raidLevel: string[] } -/** Ip. */ export interface IP { /** ID of the IP. */ id: string @@ -155,72 +158,66 @@ export interface IP { reverseStatusMessage: string } -/** List os response. */ -export interface ListOSResponse { - /** Total count of matching OS. */ - totalCount: number - /** OS that match filters. */ - os: OS[] -} - -/** List offers response. */ -export interface ListOffersResponse { - /** Total count of matching offers. */ - totalCount: number - /** Offers that match filters. */ - offers: Offer[] -} - -/** List options response. */ -export interface ListOptionsResponse { - /** Total count of matching options. */ - totalCount: number - /** Options that match filters. */ - options: Option[] -} - -/** List server events response. */ -export interface ListServerEventsResponse { - /** Total count of matching events. */ - totalCount: number - /** Server events that match filters. */ - events: ServerEvent[] -} - -export interface ListServerPrivateNetworksResponse { - serverPrivateNetworks: ServerPrivateNetwork[] - totalCount: number +export interface ServerInstall { + /** ID of the OS. */ + osId: string + /** Host defined during the server installation. */ + hostname: string + /** SSH public key IDs defined during server installation. */ + sshKeyIds: string[] + /** Status of the server installation. */ + status: ServerInstallStatus + /** + * User defined in the server installation, or the default user if none were + * specified. + */ + user: string + /** + * Service user defined in the server installation, or the default user if + * none were specified. + */ + serviceUser: string + /** Address of the installed service. */ + serviceUrl: string } -/** List servers response. */ -export interface ListServersResponse { - /** Total count of matching servers. */ - totalCount: number - /** Array of Elastic Metal server objects matching the filters in the request. */ - servers: Server[] +export interface ServerOption { + /** ID of the option. */ + id: string + /** Name of the option. */ + name: string + /** Status of the option on this server. */ + status: ServerOptionOptionStatus + /** Defines whether the option can be managed (added or removed). */ + manageable: boolean + /** Auto expiration date for compatible options. */ + expiresAt?: Date } -/** List settings response. */ -export interface ListSettingsResponse { - /** Total count of matching settings. */ - totalCount: number - /** Settings that match filters. */ - settings: Setting[] +export interface ServerRescueServer { + /** Rescue user name. */ + user: string + /** Rescue password. */ + password: string } -/** Memory. */ -export interface Memory { - /** Capacity of the memory in bytes. */ - capacity: number - /** Type of the memory. */ - type: string - /** Frequency of the memory in MHz. */ - frequency: number - /** True if the memory is an error-correcting code memory. */ - isEcc: boolean +export interface CreateServerRequestInstall { + /** ID of the OS to installation on the server. */ + osId: string + /** Hostname of the server. */ + hostname: string + /** SSH key IDs authorized on the server. */ + sshKeyIds: string[] + /** User for the installation. */ + user?: string + /** Password for the installation. */ + password?: string + /** Regular user that runs the service to be installed on the server. */ + serviceUser?: string + /** Password used for the service to install. */ + servicePassword?: string } -/** Os. */ export interface OS { /** ID of the OS. */ id: string @@ -248,13 +245,6 @@ export interface OS { allowed: boolean } -export interface OSOSField { - editable: boolean - required: boolean - defaultValue?: string -} - -/** Offer. */ export interface Offer { /** ID of the offer. */ id: string @@ -308,28 +298,6 @@ export interface Offer { tags: string[] } -/** Offer. option offer. */ -export interface OfferOptionOffer { - /** ID of the option. */ - id: string - /** Name of the option. */ - name: string - /** - * If true the option is enabled and included by default in the offer. If - * false the option is available for the offer but not included by default. - */ - enabled: boolean - /** Period of subscription for the offer. */ - subscriptionPeriod: OfferSubscriptionPeriod - /** Price of the option. */ - price?: Money - /** Boolean to know if option could be managed. */ - manageable: boolean - /** ID of the OS linked to the option. */ - osId?: string -} - -/** Option. */ export interface Option { /** ID of the option. */ id: string @@ -339,22 +307,36 @@ export interface Option { manageable: boolean } -/** Persistent memory. */ -export interface PersistentMemory { - /** Capacity of the memory in bytes. */ - capacity: number - /** Type of the memory. */ - type: string - /** Frequency of the memory in MHz. */ - frequency: number +export interface ServerEvent { + /** ID of the server to which the action will be applied. */ + id: string + /** The action that will be applied to the server. */ + action: string + /** Date of last modification of the action. */ + updatedAt?: Date + /** Date of creation of the action. */ + createdAt?: Date } -export interface RaidController { - model: string - raidLevel: string[] +export interface ServerPrivateNetwork { + /** The Private Network ID. */ + id: string + /** The Private Network Project ID. */ + projectId: string + /** The server ID. */ + serverId: string + /** The Private Network ID. */ + privateNetworkId: string + /** The VLAN ID associated to the Private Network. */ + vlan?: number + /** The configuration status of the Private Network. */ + status: ServerPrivateNetworkStatus + /** The Private Network creation date. */ + createdAt?: Date + /** The date the Private Network was last modified. */ + updatedAt?: Date } -/** Server. */ export interface Server { /** ID of the server. */ id: string @@ -396,91 +378,8 @@ export interface Server { rescueServer?: ServerRescueServer } -/** Server event. */ -export interface ServerEvent { - /** ID of the server to which the action will be applied. */ - id: string - /** The action that will be applied to the server. */ - action: string - /** Date of last modification of the action. */ - updatedAt?: Date - /** Date of creation of the action. */ - createdAt?: Date -} - -/** Server. install. */ -export interface ServerInstall { - /** ID of the OS. */ - osId: string - /** Host defined during the server installation. */ - hostname: string - /** SSH public key IDs defined during server installation. */ - sshKeyIds: string[] - /** Status of the server installation. */ - status: ServerInstallStatus - /** - * User defined in the server installation, or the default user if none were - * specified. - */ - user: string - /** - * Service user defined in the server installation, or the default user if - * none were specified. - */ - serviceUser: string - /** Address of the installed service. */ - serviceUrl: string -} - -/** Server. option. */ -export interface ServerOption { - /** ID of the option. */ - id: string - /** Name of the option. */ - name: string - /** Status of the option on this server. */ - status: ServerOptionOptionStatus - /** Defines whether the option can be managed (added or removed). */ - manageable: boolean - /** Auto expiration date for compatible options. */ - expiresAt?: Date -} - -/** Server private network. */ -export interface ServerPrivateNetwork { - /** The Private Network ID. */ - id: string - /** The Private Network Project ID. */ - projectId: string - /** The server ID. */ - serverId: string - /** The Private Network ID. */ - privateNetworkId: string - /** The VLAN ID associated to the Private Network. */ - vlan?: number - /** The configuration status of the Private Network. */ - status: ServerPrivateNetworkStatus - /** The Private Network creation date. */ - createdAt?: Date - /** The date the Private Network was last modified. */ - updatedAt?: Date -} - -/** Server. rescue server. */ -export interface ServerRescueServer { - /** Rescue user name. */ - user: string - /** Rescue password. */ - password: string -} - -export interface SetServerPrivateNetworksResponse { - serverPrivateNetworks: ServerPrivateNetwork[] -} - -/** Setting. */ -export interface Setting { - /** ID of the setting. */ +export interface Setting { + /** ID of the setting. */ id: string /** Type of the setting. */ type: SettingType @@ -490,34 +389,35 @@ export interface Setting { enabled: boolean } -export type ListServersRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Page number. */ - page?: number - /** Number of servers per page. */ - pageSize?: number - /** Order of the servers. */ - orderBy?: ListServersRequestOrderBy - /** Tags to filter for. */ - tags?: string[] - /** Status to filter for. */ - status?: string[] - /** Names to filter for. */ - name?: string - /** Organization ID to filter for. */ - organizationId?: string - /** Project ID to filter for. */ - projectId?: string - /** Option ID to filter for. */ - optionId?: string -} - -export type GetServerRequest = { +export type AddOptionServerRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone /** ID of the server. */ serverId: string + /** ID of the option to add. */ + optionId: string + /** Auto expire the option after this date. */ + expiresAt?: Date +} + +export interface BMCAccess { + /** URL to access to the server console. */ + url: string + /** + * The login to use for the BMC (Baseboard Management Controller) access + * authentification. + */ + login: string + /** + * The password to use for the BMC (Baseboard Management Controller) access + * authentification. + */ + password: string + /** + * The date after which the BMC (Baseboard Management Controller) access will + * be closed. + */ + expiresAt?: Date } export type CreateServerRequest = { @@ -554,48 +454,13 @@ export type CreateServerRequest = { optionIds?: string[] } -export type UpdateServerRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the server to update. */ - serverId: string - /** Name of the server (≠hostname), not updated if null. */ - name?: string - /** - * Description associated with the server, max 255 characters, not updated if - * null. - */ - description?: string - /** Tags associated with the server, not updated if null. */ - tags?: string[] -} - -export type InstallServerRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Server ID to install. */ - serverId: string - /** ID of the OS to installation on the server. */ - osId: string - /** Hostname of the server. */ - hostname: string - /** SSH key IDs authorized on the server. */ - sshKeyIds: string[] - /** User used for the installation. */ - user?: string - /** Password used for the installation. */ - password?: string - /** User used for the service to install. */ - serviceUser?: string - /** Password used for the service to install. */ - servicePassword?: string -} - -export type GetServerMetricsRequest = { +export type DeleteOptionServerRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Server ID to get the metrics. */ + /** ID of the server. */ serverId: string + /** ID of the option to delete. */ + optionId: string } export type DeleteServerRequest = { @@ -605,96 +470,90 @@ export type DeleteServerRequest = { serverId: string } -export type RebootServerRequest = { +export type GetBMCAccessRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the server to reboot. */ + /** ID of the server. */ serverId: string - /** The type of boot. */ - bootType?: ServerBootType } -export type StartServerRequest = { +export type GetOSRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the server to start. */ - serverId: string - /** The type of boot. */ - bootType?: ServerBootType + /** ID of the OS. */ + osId: string } -export type StopServerRequest = { +export type GetOfferRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the server to stop. */ - serverId: string + /** ID of the researched Offer. */ + offerId: string } -export type ListServerEventsRequest = { +export type GetOptionRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the server events searched. */ - serverId: string - /** Page number. */ - page?: number - /** Number of server events per page. */ - pageSize?: number - /** Order of the server events. */ - orderBy?: ListServerEventsRequestOrderBy + /** ID of the option. */ + optionId: string } -export type StartBMCAccessRequest = { +export type GetServerMetricsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the server. */ + /** Server ID to get the metrics. */ serverId: string - /** The IP authorized to connect to the server. */ - ip: string } -export type GetBMCAccessRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the server. */ - serverId: string +export interface GetServerMetricsResponse { + /** Timeseries object representing pings on the server. */ + pings?: TimeSeries } -export type StopBMCAccessRequest = { +export type GetServerRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone /** ID of the server. */ serverId: string } -export type UpdateIPRequest = { +export type InstallServerRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the server. */ + /** Server ID to install. */ serverId: string - /** ID of the IP to update. */ - ipId: string - /** New reverse IP to update, not updated if null. */ - reverse?: string + /** ID of the OS to installation on the server. */ + osId: string + /** Hostname of the server. */ + hostname: string + /** SSH key IDs authorized on the server. */ + sshKeyIds: string[] + /** User used for the installation. */ + user?: string + /** Password used for the installation. */ + password?: string + /** User used for the service to install. */ + serviceUser?: string + /** Password used for the service to install. */ + servicePassword?: string } -export type AddOptionServerRequest = { +export type ListOSRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the server. */ - serverId: string - /** ID of the option to add. */ - optionId: string - /** Auto expire the option after this date. */ - expiresAt?: Date + /** Page number. */ + page?: number + /** Number of OS per page. */ + pageSize?: number + /** Offer IDs to filter OSes for. */ + offerId?: string } -export type DeleteOptionServerRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the server. */ - serverId: string - /** ID of the option to delete. */ - optionId: string +export interface ListOSResponse { + /** Total count of matching OS. */ + totalCount: number + /** OS that match filters. */ + os: OS[] } export type ListOffersRequest = { @@ -708,18 +567,11 @@ export type ListOffersRequest = { subscriptionPeriod?: OfferSubscriptionPeriod } -export type GetOfferRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the researched Offer. */ - offerId: string -} - -export type GetOptionRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the option. */ - optionId: string +export interface ListOffersResponse { + /** Total count of matching offers. */ + totalCount: number + /** Offers that match filters. */ + offers: Offer[] } export type ListOptionsRequest = { @@ -735,44 +587,86 @@ export type ListOptionsRequest = { name?: string } -export type ListSettingsRequest = { +export interface ListOptionsResponse { + /** Total count of matching options. */ + totalCount: number + /** Options that match filters. */ + options: Option[] +} + +export type ListServerEventsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone + /** ID of the server events searched. */ + serverId: string /** Page number. */ page?: number - /** Set the maximum list size. */ + /** Number of server events per page. */ pageSize?: number - /** Sort order for items in the response. */ - orderBy?: ListSettingsRequestOrderBy - /** ID of the Project. */ - projectId?: string + /** Order of the server events. */ + orderBy?: ListServerEventsRequestOrderBy } -export type UpdateSettingRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the setting. */ - settingId: string - /** Defines whether the setting is enabled. */ - enabled?: boolean +export interface ListServerEventsResponse { + /** Total count of matching events. */ + totalCount: number + /** Server events that match filters. */ + events: ServerEvent[] } -export type ListOSRequest = { +export interface ListServerPrivateNetworksResponse { + serverPrivateNetworks: ServerPrivateNetwork[] + totalCount: number +} + +export type ListServersRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone /** Page number. */ page?: number - /** Number of OS per page. */ + /** Number of servers per page. */ pageSize?: number - /** Offer IDs to filter OSes for. */ - offerId?: string + /** Order of the servers. */ + orderBy?: ListServersRequestOrderBy + /** Tags to filter for. */ + tags?: string[] + /** Status to filter for. */ + status?: string[] + /** Names to filter for. */ + name?: string + /** Organization ID to filter for. */ + organizationId?: string + /** Project ID to filter for. */ + projectId?: string + /** Option ID to filter for. */ + optionId?: string } -export type GetOSRequest = { +export interface ListServersResponse { + /** Total count of matching servers. */ + totalCount: number + /** Array of Elastic Metal server objects matching the filters in the request. */ + servers: Server[] +} + +export type ListSettingsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the OS. */ - osId: string + /** Page number. */ + page?: number + /** Set the maximum list size. */ + pageSize?: number + /** Sort order for items in the response. */ + orderBy?: ListSettingsRequestOrderBy + /** ID of the Project. */ + projectId?: string +} + +export interface ListSettingsResponse { + /** Total count of matching settings. */ + totalCount: number + /** Settings that match filters. */ + settings: Setting[] } export type PrivateNetworkApiAddServerPrivateNetworkRequest = { @@ -784,13 +678,13 @@ export type PrivateNetworkApiAddServerPrivateNetworkRequest = { privateNetworkId: string } -export type PrivateNetworkApiSetServerPrivateNetworksRequest = { +export type PrivateNetworkApiDeleteServerPrivateNetworkRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone /** The ID of the server. */ serverId: string - /** The IDs of the Private Networks. */ - privateNetworkIds: string[] + /** The ID of the Private Network. */ + privateNetworkId: string } export type PrivateNetworkApiListServerPrivateNetworksRequest = { @@ -812,11 +706,92 @@ export type PrivateNetworkApiListServerPrivateNetworksRequest = { projectId?: string } -export type PrivateNetworkApiDeleteServerPrivateNetworkRequest = { +export type PrivateNetworkApiSetServerPrivateNetworksRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone /** The ID of the server. */ serverId: string - /** The ID of the Private Network. */ - privateNetworkId: string + /** The IDs of the Private Networks. */ + privateNetworkIds: string[] +} + +export type RebootServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server to reboot. */ + serverId: string + /** The type of boot. */ + bootType?: ServerBootType +} + +export interface SetServerPrivateNetworksResponse { + serverPrivateNetworks: ServerPrivateNetwork[] +} + +export type StartBMCAccessRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server. */ + serverId: string + /** The IP authorized to connect to the server. */ + ip: string +} + +export type StartServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server to start. */ + serverId: string + /** The type of boot. */ + bootType?: ServerBootType +} + +export type StopBMCAccessRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server. */ + serverId: string +} + +export type StopServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server to stop. */ + serverId: string +} + +export type UpdateIPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server. */ + serverId: string + /** ID of the IP to update. */ + ipId: string + /** New reverse IP to update, not updated if null. */ + reverse?: string +} + +export type UpdateServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server to update. */ + serverId: string + /** Name of the server (≠hostname), not updated if null. */ + name?: string + /** + * Description associated with the server, max 255 characters, not updated if + * null. + */ + description?: string + /** Tags associated with the server, not updated if null. */ + tags?: string[] +} + +export type UpdateSettingRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the setting. */ + settingId: string + /** Defines whether the setting is enabled. */ + enabled?: boolean } diff --git a/packages/clients/src/api/billing/v2alpha1/api.gen.ts b/packages/clients/src/api/billing/v2alpha1/api.gen.ts index 454ba126a..c4de6f1e4 100644 --- a/packages/clients/src/api/billing/v2alpha1/api.gen.ts +++ b/packages/clients/src/api/billing/v2alpha1/api.gen.ts @@ -24,7 +24,7 @@ import type { /** * Billing API. * - * This API allows you to query your consumption. Billing API. + * This API allows you to query your consumption. */ export class API extends ParentAPI { /** @@ -56,8 +56,8 @@ export class API extends ParentAPI { method: 'GET', path: `/billing/v2alpha1/invoices`, urlParams: urlParams( - ['invoice_type', request.invoiceType ?? 'unknown_type'], - ['order_by', request.orderBy ?? 'invoice_number_desc'], + ['invoice_type', request.invoiceType], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -94,7 +94,7 @@ export class API extends ParentAPI { 'invoiceId', request.invoiceId, )}/download`, - urlParams: urlParams(['dl', 1], ['file_type', request.fileType ?? 'pdf']), + urlParams: urlParams(['dl', 1], ['file_type', request.fileType]), responseType: 'blob', }) diff --git a/packages/clients/src/api/block/v1alpha1/api.gen.ts b/packages/clients/src/api/block/v1alpha1/api.gen.ts index d9bd6e7f1..65c177a5c 100644 --- a/packages/clients/src/api/block/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/block/v1alpha1/api.gen.ts @@ -51,8 +51,7 @@ const jsonContentHeaders = { /** * Scaleway Block Storage API. * - * This API allows you to use and manage your Block Storage volumes. Scaleway - * Block Storage API. + * This API allows you to use and manage your Block Storage volumes. */ export class API extends ParentAPI { /** Lists the available zones of the API. */ @@ -99,7 +98,7 @@ export class API extends ParentAPI { )}/volumes`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -241,7 +240,7 @@ export class API extends ParentAPI { )}/snapshots`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', diff --git a/packages/clients/src/api/block/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/block/v1alpha1/marshalling.gen.ts index d4c7626a2..9ba57f1e4 100644 --- a/packages/clients/src/api/block/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/block/v1alpha1/marshalling.gen.ts @@ -28,7 +28,7 @@ import type { VolumeType, } from './types.gen' -const unmarshalReference = (data: unknown) => { +export const unmarshalReference = (data: unknown): Reference => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Reference' failed as data isn't a dictionary.`, @@ -45,32 +45,59 @@ const unmarshalReference = (data: unknown) => { } as Reference } -const unmarshalSnapshotParentVolume = (data: unknown) => { +const unmarshalVolumeSpecifications = (data: unknown): VolumeSpecifications => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`, + `Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`, ) } return { + class: data.class, + perfIops: data.perf_iops, + } as VolumeSpecifications +} + +export const unmarshalVolume = (data: unknown): Volume => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), id: data.id, name: data.name, + parentSnapshotId: data.parent_snapshot_id, + projectId: data.project_id, + references: unmarshalArrayOfObject(data.references, unmarshalReference), + size: data.size, + specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : undefined, status: data.status, + tags: data.tags, type: data.type, - } as SnapshotParentVolume + updatedAt: unmarshalDate(data.updated_at), + zone: data.zone, + } as Volume } -const unmarshalVolumeSpecifications = (data: unknown) => { +const unmarshalSnapshotParentVolume = (data: unknown): SnapshotParentVolume => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`, + `Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`, ) } - return { class: data.class, perfIops: data.perf_iops } as VolumeSpecifications + return { + id: data.id, + name: data.name, + status: data.status, + type: data.type, + } as SnapshotParentVolume } -const unmarshalSnapshotSummary = (data: unknown) => { +const unmarshalSnapshotSummary = (data: unknown): SnapshotSummary => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SnapshotSummary' failed as data isn't a dictionary.`, @@ -94,31 +121,22 @@ const unmarshalSnapshotSummary = (data: unknown) => { } as SnapshotSummary } -export const unmarshalVolume = (data: unknown) => { +export const unmarshalListSnapshotsResponse = ( + data: unknown, +): ListSnapshotsResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`, ) } return { - createdAt: unmarshalDate(data.created_at), - id: data.id, - name: data.name, - parentSnapshotId: data.parent_snapshot_id, - projectId: data.project_id, - references: unmarshalArrayOfObject(data.references, unmarshalReference), - size: data.size, - specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : undefined, - status: data.status, - tags: data.tags, - type: data.type, - updatedAt: unmarshalDate(data.updated_at), - zone: data.zone, - } as Volume + snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshotSummary), + totalCount: data.total_count, + } as ListSnapshotsResponse } -const unmarshalVolumeType = (data: unknown) => { +const unmarshalVolumeType = (data: unknown): VolumeType => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`, @@ -135,20 +153,9 @@ const unmarshalVolumeType = (data: unknown) => { } as VolumeType } -export const unmarshalListSnapshotsResponse = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`, - ) - } - - return { - snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshotSummary), - totalCount: data.total_count, - } as ListSnapshotsResponse -} - -export const unmarshalListVolumeTypesResponse = (data: unknown) => { +export const unmarshalListVolumeTypesResponse = ( + data: unknown, +): ListVolumeTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListVolumeTypesResponse' failed as data isn't a dictionary.`, @@ -161,7 +168,9 @@ export const unmarshalListVolumeTypesResponse = (data: unknown) => { } as ListVolumeTypesResponse } -export const unmarshalListVolumesResponse = (data: unknown) => { +export const unmarshalListVolumesResponse = ( + data: unknown, +): ListVolumesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`, @@ -174,7 +183,7 @@ export const unmarshalListVolumesResponse = (data: unknown) => { } as ListVolumesResponse } -export const unmarshalSnapshot = (data: unknown) => { +export const unmarshalSnapshot = (data: unknown): Snapshot => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`, @@ -199,6 +208,16 @@ export const unmarshalSnapshot = (data: unknown) => { } as Snapshot } +export const marshalCreateSnapshotRequest = ( + request: CreateSnapshotRequest, + defaults: DefaultValues, +): Record => ({ + name: request.name, + project_id: request.projectId ?? defaults.defaultProjectId, + tags: request.tags, + volume_id: request.volumeId, +}) + const marshalCreateVolumeRequestFromEmpty = ( request: CreateVolumeRequestFromEmpty, defaults: DefaultValues, @@ -214,16 +233,6 @@ const marshalCreateVolumeRequestFromSnapshot = ( snapshot_id: request.snapshotId, }) -export const marshalCreateSnapshotRequest = ( - request: CreateSnapshotRequest, - defaults: DefaultValues, -): Record => ({ - name: request.name, - project_id: request.projectId ?? defaults.defaultProjectId, - tags: request.tags, - volume_id: request.volumeId, -}) - export const marshalCreateVolumeRequest = ( request: CreateVolumeRequest, defaults: DefaultValues, @@ -231,29 +240,26 @@ export const marshalCreateVolumeRequest = ( name: request.name, project_id: request.projectId ?? defaults.defaultProjectId, tags: request.tags, - ...resolveOneOf([ + ...resolveOneOf([ { param: 'from_empty', - value: request.fromEmpty - ? marshalCreateVolumeRequestFromEmpty(request.fromEmpty, defaults) - : undefined, + value: + request.fromEmpty !== undefined + ? marshalCreateVolumeRequestFromEmpty(request.fromEmpty, defaults) + : undefined, }, { param: 'from_snapshot', - value: request.fromSnapshot - ? marshalCreateVolumeRequestFromSnapshot(request.fromSnapshot, defaults) - : undefined, + value: + request.fromSnapshot !== undefined + ? marshalCreateVolumeRequestFromSnapshot( + request.fromSnapshot, + defaults, + ) + : undefined, }, ]), - ...resolveOneOf( - [ - { - param: 'perf_iops', - value: request.perfIops, - }, - ], - true, - ), + ...resolveOneOf([{ param: 'perf_iops', value: request.perfIops }]), }) export const marshalImportSnapshotFromS3Request = ( diff --git a/packages/clients/src/api/block/v1alpha1/types.gen.ts b/packages/clients/src/api/block/v1alpha1/types.gen.ts index acf3f6e2d..7b80a879d 100644 --- a/packages/clients/src/api/block/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/block/v1alpha1/types.gen.ts @@ -53,53 +53,27 @@ export type VolumeStatus = | 'snapshotting' | 'locked' -/** Create volume request. from empty. */ -export interface CreateVolumeRequestFromEmpty { - /** - * Volume size in bytes, with a granularity of 1 GB (10^9 bytes). Must be - * compliant with the minimum (1 GB) and maximum (10 TB) allowed size. - */ - size: number +export interface SnapshotParentVolume { + /** Parent volume UUID (volume from which the snapshot originates). */ + id: string + /** Name of the parent volume. */ + name: string + /** Volume type of the parent volume. */ + type: string + /** Current status the parent volume. */ + status: VolumeStatus } -/** Create volume request. from snapshot. */ -export interface CreateVolumeRequestFromSnapshot { +export interface VolumeSpecifications { /** - * Volume size in bytes, with a granularity of 1 GB (10^9 bytes). Must be - * compliant with the minimum (1 GB) and maximum (10 TB) allowed size. Size is - * optional and is used only if a resize of the volume is requested, otherwise - * original snapshot size will be used. + * The maximum IO/s expected, according to the different options available in + * stock (`5000 | 15000`). */ - size?: number - /** Source snapshot from which volume will be created. */ - snapshotId: string -} - -/** List snapshots response. */ -export interface ListSnapshotsResponse { - /** Paginated returned list of snapshots. */ - snapshots: SnapshotSummary[] - /** Total number of snpashots in the project. */ - totalCount: number -} - -/** List volume types response. */ -export interface ListVolumeTypesResponse { - /** Returns paginated list of volume-types. */ - volumeTypes: VolumeType[] - /** Total number of volume-types currently available in stock. */ - totalCount: number -} - -/** List volumes response. */ -export interface ListVolumesResponse { - /** Paginated returned list of volumes. */ - volumes: Volume[] - /** Total number of volumes in the project. */ - totalCount: number + perfIops?: number + /** The storage class of the volume. */ + class: StorageClass } -/** Reference. */ export interface Reference { /** UUID of the reference. */ id: string @@ -118,59 +92,28 @@ export interface Reference { status: ReferenceStatus } -/** Snapshot. */ -export interface Snapshot { - /** UUID of the snapshot. */ - id: string - /** Name of the snapshot. */ - name: string - /** - * Information about the parent volume. If the parent volume was deleted, - * value is null. - */ - parentVolume?: SnapshotParentVolume - /** Size in bytes of the snapshot. */ +export interface CreateVolumeRequestFromEmpty { + /** Must be compliant with the minimum (1 GB) and maximum (10 TB) allowed size. */ size: number - /** UUID of the project the snapshot belongs to. */ - projectId: string - /** Creation date of the snapshot. */ - createdAt?: Date - /** Last modification date of the properties of a snapshot. */ - updatedAt?: Date - /** List of the references to the snapshot. */ - references: Reference[] - /** Current status of the snapshot (available, in_use, ...). */ - status: SnapshotStatus - /** List of tags assigned to the volume. */ - tags: string[] - /** Snapshot zone. */ - zone: Zone - /** Storage class of the snapshot. */ - class: StorageClass } -/** Snapshot. parent volume. */ -export interface SnapshotParentVolume { - /** Parent volume UUID (volume from which the snapshot originates). */ - id: string - /** Name of the parent volume. */ - name: string - /** Volume type of the parent volume. */ - type: string - /** Current status the parent volume. */ - status: VolumeStatus +export interface CreateVolumeRequestFromSnapshot { + /** + * Must be compliant with the minimum (1 GB) and maximum (10 TB) allowed size. + * Size is optional and is used only if a resize of the volume is requested, + * otherwise original snapshot size will be used. + */ + size?: number + /** Source snapshot from which volume will be created. */ + snapshotId: string } -/** Snapshot summary. */ export interface SnapshotSummary { /** UUID of the snapshot. */ id: string /** Name of the snapshot. */ name: string - /** - * Information about the parent volume. If the parent volume has been deleted, - * value is null. - */ + /** If the parent volume has been deleted, value is null. */ parentVolume?: SnapshotParentVolume /** Size of the snapshot in bytes. */ size: number @@ -190,7 +133,17 @@ export interface SnapshotSummary { class: StorageClass } -/** Volume. */ +export interface VolumeType { + /** Volume type. */ + type: string + /** Price of the volume billed in GB/hour. */ + pricing?: Money + /** Price of the snapshot billed in GB/hour. */ + snapshotPricing?: Money + /** Volume specifications of the volume type. */ + specs?: VolumeSpecifications +} + export interface Volume { /** UUID of the volume. */ id: string @@ -223,62 +176,17 @@ export interface Volume { specs?: VolumeSpecifications } -/** Volume specifications. */ -export interface VolumeSpecifications { - /** - * The maximum IO/s expected, according to the different options available in - * stock (`5000 | 15000`). - */ - perfIops?: number - /** The storage class of the volume. */ - class: StorageClass -} - -/** Volume type. */ -export interface VolumeType { - /** Volume type. */ - type: string - /** Price of the volume billed in GB/hour. */ - pricing?: Money - /** Price of the snapshot billed in GB/hour. */ - snapshotPricing?: Money - /** Volume specifications of the volume type. */ - specs?: VolumeSpecifications -} - -export type ListVolumeTypesRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Page number. */ - page?: number - /** - * Page size, defines how many entries are returned in one page, must be lower - * or equal to 100. - */ - pageSize?: number -} - -export type ListVolumesRequest = { +export type CreateSnapshotRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Criteria to use when ordering the list. */ - orderBy?: ListVolumesRequestOrderBy - /** Filter by Project ID. */ + /** UUID of the volume to snapshot. */ + volumeId: string + /** Name of the snapshot. */ + name: string + /** UUID of the project to which the volume and the snapshot belong. */ projectId?: string - /** Page number. */ - page?: number - /** - * Page size, defines how many entries are returned in one page, must be lower - * or equal to 100. - */ - pageSize?: number - /** Filter the return volumes by their names. */ - name?: string - /** - * Filter by a product resource ID linked to this volume (such as an Instance - * ID). - */ - productResourceId?: string + /** List of tags assigned to the snapshot. */ + tags?: string[] } export type CreateVolumeRequest = { @@ -311,11 +219,11 @@ export type CreateVolumeRequest = { tags?: string[] } -export type GetVolumeRequest = { +export type DeleteSnapshotRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the volume. */ - volumeId: string + /** UUID of the snapshot. */ + snapshotId: string } export type DeleteVolumeRequest = { @@ -325,28 +233,28 @@ export type DeleteVolumeRequest = { volumeId: string } -export type UpdateVolumeRequest = { +export type GetSnapshotRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the snapshot. */ + snapshotId: string +} + +export type GetVolumeRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone /** UUID of the volume. */ volumeId: string - /** When defined, is the new name of the volume. */ - name?: string - /** - * Optional field for increasing the size of a volume (size must be equal or - * larger than the current one). Size in bytes of the volume, with a - * granularity of 1 GB (10^9 bytes). Must be compliant with the minimum (1GB) - * and maximum (10TB) allowed size. - */ - size?: number - /** List of tags assigned to the volume. */ +} + +export type ImportSnapshotFromS3Request = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + bucket: string + key: string + name: string + projectId?: string tags?: string[] - /** - * The maximum IO/s expected, according to the different options available in - * stock (`5000 | 15000`). The selected value must be available for the - * volume's current storage class. - */ - perfIops?: number } export type ListSnapshotsRequest = { @@ -369,41 +277,87 @@ export type ListSnapshotsRequest = { name?: string } -export type GetSnapshotRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the snapshot. */ - snapshotId: string +export interface ListSnapshotsResponse { + /** Paginated returned list of snapshots. */ + snapshots: SnapshotSummary[] + /** Total number of snpashots in the project. */ + totalCount: number } -export type CreateSnapshotRequest = { +export type ListVolumeTypesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the volume to snapshot. */ - volumeId: string - /** Name of the snapshot. */ - name: string - /** UUID of the project to which the volume and the snapshot belong. */ - projectId?: string - /** List of tags assigned to the snapshot. */ - tags?: string[] + /** Page number. */ + page?: number + /** + * Page size, defines how many entries are returned in one page, must be lower + * or equal to 100. + */ + pageSize?: number } -export type ImportSnapshotFromS3Request = { +export interface ListVolumeTypesResponse { + /** Returns paginated list of volume-types. */ + volumeTypes: VolumeType[] + /** Total number of volume-types currently available in stock. */ + totalCount: number +} + +export type ListVolumesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - bucket: string - key: string - name: string + /** Criteria to use when ordering the list. */ + orderBy?: ListVolumesRequestOrderBy + /** Filter by Project ID. */ projectId?: string - tags?: string[] + /** Page number. */ + page?: number + /** + * Page size, defines how many entries are returned in one page, must be lower + * or equal to 100. + */ + pageSize?: number + /** Filter the return volumes by their names. */ + name?: string + /** + * Filter by a product resource ID linked to this volume (such as an Instance + * ID). + */ + productResourceId?: string } -export type DeleteSnapshotRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone +export interface ListVolumesResponse { + /** Paginated returned list of volumes. */ + volumes: Volume[] + /** Total number of volumes in the project. */ + totalCount: number +} + +export interface Snapshot { /** UUID of the snapshot. */ - snapshotId: string + id: string + /** Name of the snapshot. */ + name: string + /** If the parent volume was deleted, value is null. */ + parentVolume?: SnapshotParentVolume + /** Size in bytes of the snapshot. */ + size: number + /** UUID of the project the snapshot belongs to. */ + projectId: string + /** Creation date of the snapshot. */ + createdAt?: Date + /** Last modification date of the properties of a snapshot. */ + updatedAt?: Date + /** List of the references to the snapshot. */ + references: Reference[] + /** Current status of the snapshot (available, in_use, ...). */ + status: SnapshotStatus + /** List of tags assigned to the volume. */ + tags: string[] + /** Snapshot zone. */ + zone: Zone + /** Storage class of the snapshot. */ + class: StorageClass } export type UpdateSnapshotRequest = { @@ -416,3 +370,24 @@ export type UpdateSnapshotRequest = { /** List of tags assigned to the snapshot. */ tags?: string[] } + +export type UpdateVolumeRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the volume. */ + volumeId: string + /** When defined, is the new name of the volume. */ + name?: string + /** + * Size in bytes of the volume, with a granularity of 1 GB (10^9 bytes). Must + * be compliant with the minimum (1GB) and maximum (10TB) allowed size. + */ + size?: number + /** List of tags assigned to the volume. */ + tags?: string[] + /** + * The selected value must be available for the volume's current storage + * class. + */ + perfIops?: number +} diff --git a/packages/clients/src/api/block/v1alpha1/validation-rules.gen.ts b/packages/clients/src/api/block/v1alpha1/validation-rules.gen.ts index 4a7c34b60..13c581d8d 100644 --- a/packages/clients/src/api/block/v1alpha1/validation-rules.gen.ts +++ b/packages/clients/src/api/block/v1alpha1/validation-rules.gen.ts @@ -48,3 +48,9 @@ export const ListVolumesRequest = { lessThanOrEqual: 100, }, } + +export const Reference = { + productResourceType: { + minLength: 1, + }, +} diff --git a/packages/clients/src/api/cockpit/v1beta1/api.gen.ts b/packages/clients/src/api/cockpit/v1beta1/api.gen.ts index 8619259d6..d0ca9743f 100644 --- a/packages/clients/src/api/cockpit/v1beta1/api.gen.ts +++ b/packages/clients/src/api/cockpit/v1beta1/api.gen.ts @@ -90,7 +90,7 @@ const jsonContentHeaders = { * * Cockpit's API allows you to activate your Cockpit on your Projects. * Scaleway's Cockpit stores metrics and logs and provides a dedicated Grafana - * for dashboarding to visualize them. Cockpit API. + * for dashboarding to visualize them. */ export class API extends ParentAPI { /** @@ -240,7 +240,7 @@ export class API extends ParentAPI { method: 'GET', path: `/cockpit/v1beta1/datasources`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -290,7 +290,7 @@ export class API extends ParentAPI { method: 'GET', path: `/cockpit/v1beta1/tokens`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -487,7 +487,7 @@ export class API extends ParentAPI { method: 'GET', path: `/cockpit/v1beta1/grafana-users`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'login_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -562,7 +562,7 @@ export class API extends ParentAPI { method: 'GET', path: `/cockpit/v1beta1/plans`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', diff --git a/packages/clients/src/api/cockpit/v1beta1/marshalling.gen.ts b/packages/clients/src/api/cockpit/v1beta1/marshalling.gen.ts index 89eec540d..fcffecd30 100644 --- a/packages/clients/src/api/cockpit/v1beta1/marshalling.gen.ts +++ b/packages/clients/src/api/cockpit/v1beta1/marshalling.gen.ts @@ -44,53 +44,19 @@ import type { TriggerTestAlertRequest, } from './types.gen' -const unmarshalContactPointEmail = (data: unknown) => { +const unmarshalContactPointEmail = (data: unknown): ContactPointEmail => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactPointEmail' failed as data isn't a dictionary.`, ) } - return { to: data.to } as ContactPointEmail -} - -const unmarshalTokenScopes = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'TokenScopes' failed as data isn't a dictionary.`, - ) - } - - return { - queryLogs: data.query_logs, - queryMetrics: data.query_metrics, - queryTraces: data.query_traces, - setupAlerts: data.setup_alerts, - setupLogsRules: data.setup_logs_rules, - setupMetricsRules: data.setup_metrics_rules, - writeLogs: data.write_logs, - writeMetrics: data.write_metrics, - writeTraces: data.write_traces, - } as TokenScopes -} - -const unmarshalCockpitEndpoints = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'CockpitEndpoints' failed as data isn't a dictionary.`, - ) - } - return { - alertmanagerUrl: data.alertmanager_url, - grafanaUrl: data.grafana_url, - logsUrl: data.logs_url, - metricsUrl: data.metrics_url, - tracesUrl: data.traces_url, - } as CockpitEndpoints + to: data.to, + } as ContactPointEmail } -export const unmarshalContactPoint = (data: unknown) => { +export const unmarshalContactPoint = (data: unknown): ContactPoint => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactPoint' failed as data isn't a dictionary.`, @@ -102,7 +68,7 @@ export const unmarshalContactPoint = (data: unknown) => { } as ContactPoint } -export const unmarshalDatasource = (data: unknown) => { +export const unmarshalDatasource = (data: unknown): Datasource => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Datasource' failed as data isn't a dictionary.`, @@ -118,7 +84,9 @@ export const unmarshalDatasource = (data: unknown) => { } as Datasource } -export const unmarshalGrafanaProductDashboard = (data: unknown) => { +export const unmarshalGrafanaProductDashboard = ( + data: unknown, +): GrafanaProductDashboard => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GrafanaProductDashboard' failed as data isn't a dictionary.`, @@ -134,7 +102,7 @@ export const unmarshalGrafanaProductDashboard = (data: unknown) => { } as GrafanaProductDashboard } -export const unmarshalGrafanaUser = (data: unknown) => { +export const unmarshalGrafanaUser = (data: unknown): GrafanaUser => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GrafanaUser' failed as data isn't a dictionary.`, @@ -149,27 +117,27 @@ export const unmarshalGrafanaUser = (data: unknown) => { } as GrafanaUser } -const unmarshalPlan = (data: unknown) => { +const unmarshalTokenScopes = (data: unknown): TokenScopes => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Plan' failed as data isn't a dictionary.`, + `Unmarshalling the type 'TokenScopes' failed as data isn't a dictionary.`, ) } return { - id: data.id, - logsIngestionPrice: data.logs_ingestion_price, - name: data.name, - retentionLogsInterval: data.retention_logs_interval, - retentionMetricsInterval: data.retention_metrics_interval, - retentionPrice: data.retention_price, - retentionTracesInterval: data.retention_traces_interval, - sampleIngestionPrice: data.sample_ingestion_price, - tracesIngestionPrice: data.traces_ingestion_price, - } as Plan + queryLogs: data.query_logs, + queryMetrics: data.query_metrics, + queryTraces: data.query_traces, + setupAlerts: data.setup_alerts, + setupLogsRules: data.setup_logs_rules, + setupMetricsRules: data.setup_metrics_rules, + writeLogs: data.write_logs, + writeMetrics: data.write_metrics, + writeTraces: data.write_traces, + } as TokenScopes } -export const unmarshalToken = (data: unknown) => { +export const unmarshalToken = (data: unknown): Token => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Token' failed as data isn't a dictionary.`, @@ -187,7 +155,43 @@ export const unmarshalToken = (data: unknown) => { } as Token } -export const unmarshalCockpit = (data: unknown) => { +const unmarshalCockpitEndpoints = (data: unknown): CockpitEndpoints => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'CockpitEndpoints' failed as data isn't a dictionary.`, + ) + } + + return { + alertmanagerUrl: data.alertmanager_url, + grafanaUrl: data.grafana_url, + logsUrl: data.logs_url, + metricsUrl: data.metrics_url, + tracesUrl: data.traces_url, + } as CockpitEndpoints +} + +const unmarshalPlan = (data: unknown): Plan => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Plan' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + logsIngestionPrice: data.logs_ingestion_price, + name: data.name, + retentionLogsInterval: data.retention_logs_interval, + retentionMetricsInterval: data.retention_metrics_interval, + retentionPrice: data.retention_price, + retentionTracesInterval: data.retention_traces_interval, + sampleIngestionPrice: data.sample_ingestion_price, + tracesIngestionPrice: data.traces_ingestion_price, + } as Plan +} + +export const unmarshalCockpit = (data: unknown): Cockpit => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Cockpit' failed as data isn't a dictionary.`, @@ -207,7 +211,7 @@ export const unmarshalCockpit = (data: unknown) => { } as Cockpit } -export const unmarshalCockpitMetrics = (data: unknown) => { +export const unmarshalCockpitMetrics = (data: unknown): CockpitMetrics => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'CockpitMetrics' failed as data isn't a dictionary.`, @@ -219,7 +223,9 @@ export const unmarshalCockpitMetrics = (data: unknown) => { } as CockpitMetrics } -export const unmarshalListContactPointsResponse = (data: unknown) => { +export const unmarshalListContactPointsResponse = ( + data: unknown, +): ListContactPointsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListContactPointsResponse' failed as data isn't a dictionary.`, @@ -237,7 +243,9 @@ export const unmarshalListContactPointsResponse = (data: unknown) => { } as ListContactPointsResponse } -export const unmarshalListDatasourcesResponse = (data: unknown) => { +export const unmarshalListDatasourcesResponse = ( + data: unknown, +): ListDatasourcesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDatasourcesResponse' failed as data isn't a dictionary.`, @@ -252,7 +260,7 @@ export const unmarshalListDatasourcesResponse = (data: unknown) => { export const unmarshalListGrafanaProductDashboardsResponse = ( data: unknown, -) => { +): ListGrafanaProductDashboardsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListGrafanaProductDashboardsResponse' failed as data isn't a dictionary.`, @@ -268,7 +276,9 @@ export const unmarshalListGrafanaProductDashboardsResponse = ( } as ListGrafanaProductDashboardsResponse } -export const unmarshalListGrafanaUsersResponse = (data: unknown) => { +export const unmarshalListGrafanaUsersResponse = ( + data: unknown, +): ListGrafanaUsersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListGrafanaUsersResponse' failed as data isn't a dictionary.`, @@ -284,7 +294,9 @@ export const unmarshalListGrafanaUsersResponse = (data: unknown) => { } as ListGrafanaUsersResponse } -export const unmarshalListPlansResponse = (data: unknown) => { +export const unmarshalListPlansResponse = ( + data: unknown, +): ListPlansResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPlansResponse' failed as data isn't a dictionary.`, @@ -297,7 +309,9 @@ export const unmarshalListPlansResponse = (data: unknown) => { } as ListPlansResponse } -export const unmarshalListTokensResponse = (data: unknown) => { +export const unmarshalListTokensResponse = ( + data: unknown, +): ListTokensResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListTokensResponse' failed as data isn't a dictionary.`, @@ -310,7 +324,9 @@ export const unmarshalListTokensResponse = (data: unknown) => { } as ListTokensResponse } -export const unmarshalSelectPlanResponse = (data: unknown) => { +export const unmarshalSelectPlanResponse = ( + data: unknown, +): SelectPlanResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SelectPlanResponse' failed as data isn't a dictionary.`, @@ -320,6 +336,13 @@ export const unmarshalSelectPlanResponse = (data: unknown) => { return {} as SelectPlanResponse } +export const marshalActivateCockpitRequest = ( + request: ActivateCockpitRequest, + defaults: DefaultValues, +): Record => ({ + project_id: request.projectId ?? defaults.defaultProjectId, +}) + const marshalContactPointEmail = ( request: ContactPointEmail, defaults: DefaultValues, @@ -334,42 +357,22 @@ const marshalContactPoint = ( ...resolveOneOf([ { param: 'email', - value: request.email - ? marshalContactPointEmail(request.email, defaults) - : undefined, + value: + request.email !== undefined + ? marshalContactPointEmail(request.email, defaults) + : undefined, }, ]), }) -const marshalTokenScopes = ( - request: TokenScopes, - defaults: DefaultValues, -): Record => ({ - query_logs: request.queryLogs, - query_metrics: request.queryMetrics, - query_traces: request.queryTraces, - setup_alerts: request.setupAlerts, - setup_logs_rules: request.setupLogsRules, - setup_metrics_rules: request.setupMetricsRules, - write_logs: request.writeLogs, - write_metrics: request.writeMetrics, - write_traces: request.writeTraces, -}) - -export const marshalActivateCockpitRequest = ( - request: ActivateCockpitRequest, - defaults: DefaultValues, -): Record => ({ - project_id: request.projectId ?? defaults.defaultProjectId, -}) - export const marshalCreateContactPointRequest = ( request: CreateContactPointRequest, defaults: DefaultValues, ): Record => ({ - contact_point: request.contactPoint - ? marshalContactPoint(request.contactPoint, defaults) - : undefined, + contact_point: + request.contactPoint !== undefined + ? marshalContactPoint(request.contactPoint, defaults) + : undefined, project_id: request.projectId ?? defaults.defaultProjectId, }) @@ -379,7 +382,7 @@ export const marshalCreateDatasourceRequest = ( ): Record => ({ name: request.name, project_id: request.projectId ?? defaults.defaultProjectId, - type: request.type ?? 'unknown_datasource_type', + type: request.type, }) export const marshalCreateGrafanaUserRequest = ( @@ -388,7 +391,22 @@ export const marshalCreateGrafanaUserRequest = ( ): Record => ({ login: request.login, project_id: request.projectId ?? defaults.defaultProjectId, - role: request.role ?? 'unknown_role', + role: request.role, +}) + +const marshalTokenScopes = ( + request: TokenScopes, + defaults: DefaultValues, +): Record => ({ + query_logs: request.queryLogs, + query_metrics: request.queryMetrics, + query_traces: request.queryTraces, + setup_alerts: request.setupAlerts, + setup_logs_rules: request.setupLogsRules, + setup_metrics_rules: request.setupMetricsRules, + write_logs: request.writeLogs, + write_metrics: request.writeMetrics, + write_traces: request.writeTraces, }) export const marshalCreateTokenRequest = ( @@ -397,9 +415,10 @@ export const marshalCreateTokenRequest = ( ): Record => ({ name: request.name || randomName('token'), project_id: request.projectId ?? defaults.defaultProjectId, - scopes: request.scopes - ? marshalTokenScopes(request.scopes, defaults) - : undefined, + scopes: + request.scopes !== undefined + ? marshalTokenScopes(request.scopes, defaults) + : undefined, }) export const marshalDeactivateCockpitRequest = ( @@ -413,9 +432,10 @@ export const marshalDeleteContactPointRequest = ( request: DeleteContactPointRequest, defaults: DefaultValues, ): Record => ({ - contact_point: request.contactPoint - ? marshalContactPoint(request.contactPoint, defaults) - : undefined, + contact_point: + request.contactPoint !== undefined + ? marshalContactPoint(request.contactPoint, defaults) + : undefined, project_id: request.projectId ?? defaults.defaultProjectId, }) diff --git a/packages/clients/src/api/container/v1beta1/api.gen.ts b/packages/clients/src/api/container/v1beta1/api.gen.ts index c2d3a1c23..186e4551c 100644 --- a/packages/clients/src/api/container/v1beta1/api.gen.ts +++ b/packages/clients/src/api/container/v1beta1/api.gen.ts @@ -110,7 +110,7 @@ export class API extends ParentAPI { )}/namespaces`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -245,7 +245,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['name', request.name], ['namespace_id', request.namespaceId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -401,7 +401,7 @@ export class API extends ParentAPI { )}/crons`, urlParams: urlParams( ['container_id', request.containerId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -532,7 +532,7 @@ export class API extends ParentAPI { request.containerId, )}/logs`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'timestamp_desc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -563,7 +563,7 @@ export class API extends ParentAPI { )}/domains`, urlParams: urlParams( ['container_id', request.containerId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -682,14 +682,8 @@ export class API extends ParentAPI { ['expires_at', request.expiresAt], ...Object.entries( resolveOneOf([ - { - param: 'container_id', - value: request.containerId, - }, - { - param: 'namespace_id', - value: request.namespaceId, - }, + { param: 'container_id', value: request.containerId }, + { param: 'namespace_id', value: request.namespaceId }, ]), ), ), @@ -768,7 +762,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['container_id', request.containerId], ['namespace_id', request.namespaceId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -878,7 +872,7 @@ export class API extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/triggers`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -886,19 +880,13 @@ export class API extends ParentAPI { ], ...Object.entries( resolveOneOf([ + { param: 'container_id', value: request.containerId }, + { param: 'namespace_id', value: request.namespaceId }, { default: this.client.settings.defaultProjectId, param: 'project_id', value: request.projectId, }, - { - param: 'container_id', - value: request.containerId, - }, - { - param: 'namespace_id', - value: request.namespaceId, - }, ]), ), ), diff --git a/packages/clients/src/api/container/v1beta1/index.gen.ts b/packages/clients/src/api/container/v1beta1/index.gen.ts index 8fb02afe6..2ad548924 100644 --- a/packages/clients/src/api/container/v1beta1/index.gen.ts +++ b/packages/clients/src/api/container/v1beta1/index.gen.ts @@ -60,7 +60,6 @@ export type { LogStream, Namespace, NamespaceStatus, - NullValue, Secret, SecretHashedValue, Token, diff --git a/packages/clients/src/api/document_db/v1beta1/api.gen.ts b/packages/clients/src/api/document_db/v1beta1/api.gen.ts index afeef8ac4..f0df6e236 100644 --- a/packages/clients/src/api/document_db/v1beta1/api.gen.ts +++ b/packages/clients/src/api/document_db/v1beta1/api.gen.ts @@ -253,7 +253,7 @@ export class API extends ParentAPI { )}/instances`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -716,7 +716,7 @@ export class API extends ParentAPI { 'instanceId', request.instanceId, )}/logs`, - urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc']), + urlParams: urlParams(['order_by', request.orderBy]), }, unmarshalListInstanceLogsResponse, ) @@ -1020,7 +1020,7 @@ export class API extends ParentAPI { )}/users`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -1130,7 +1130,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['managed', request.managed], ['name', request.name], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['owner', request.owner], ['page', request.page], [ @@ -1213,7 +1213,7 @@ export class API extends ParentAPI { )}/privileges`, urlParams: urlParams( ['database_name', request.databaseName], - ['order_by', request.orderBy ?? 'user_name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -1278,7 +1278,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['instance_id', request.instanceId], ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/document_db/v1beta1/marshalling.gen.ts b/packages/clients/src/api/document_db/v1beta1/marshalling.gen.ts index 76b53dc8d..246c8e448 100644 --- a/packages/clients/src/api/document_db/v1beta1/marshalling.gen.ts +++ b/packages/clients/src/api/document_db/v1beta1/marshalling.gen.ts @@ -85,7 +85,9 @@ import type { Volume, } from './types.gen' -const unmarshalEndpointDirectAccessDetails = (data: unknown) => { +const unmarshalEndpointDirectAccessDetails = ( + data: unknown, +): EndpointDirectAccessDetails => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'EndpointDirectAccessDetails' failed as data isn't a dictionary.`, @@ -95,7 +97,9 @@ const unmarshalEndpointDirectAccessDetails = (data: unknown) => { return {} as EndpointDirectAccessDetails } -const unmarshalEndpointLoadBalancerDetails = (data: unknown) => { +const unmarshalEndpointLoadBalancerDetails = ( + data: unknown, +): EndpointLoadBalancerDetails => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'EndpointLoadBalancerDetails' failed as data isn't a dictionary.`, @@ -105,7 +109,9 @@ const unmarshalEndpointLoadBalancerDetails = (data: unknown) => { return {} as EndpointLoadBalancerDetails } -const unmarshalEndpointPrivateNetworkDetails = (data: unknown) => { +const unmarshalEndpointPrivateNetworkDetails = ( + data: unknown, +): EndpointPrivateNetworkDetails => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`, @@ -119,7 +125,7 @@ const unmarshalEndpointPrivateNetworkDetails = (data: unknown) => { } as EndpointPrivateNetworkDetails } -export const unmarshalEndpoint = (data: unknown) => { +export const unmarshalEndpoint = (data: unknown): Endpoint => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`, @@ -144,78 +150,84 @@ export const unmarshalEndpoint = (data: unknown) => { } as Endpoint } -const unmarshalEngineSetting = (data: unknown) => { +export const unmarshalReadReplica = (data: unknown): ReadReplica => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'EngineSetting' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ReadReplica' failed as data isn't a dictionary.`, ) } return { - defaultValue: data.default_value, - description: data.description, - floatMax: data.float_max, - floatMin: data.float_min, - hotConfigurable: data.hot_configurable, - intMax: data.int_max, - intMin: data.int_min, + endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint), + id: data.id, + region: data.region, + sameZone: data.same_zone, + status: data.status, + } as ReadReplica +} + +export const unmarshalDatabase = (data: unknown): Database => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Database' failed as data isn't a dictionary.`, + ) + } + + return { + managed: data.managed, name: data.name, - propertyType: data.property_type, - stringConstraint: data.string_constraint, - unit: data.unit, - } as EngineSetting + owner: data.owner, + size: data.size, + } as Database } -const unmarshalBackupSchedule = (data: unknown) => { +export const unmarshalInstanceLog = (data: unknown): InstanceLog => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'BackupSchedule' failed as data isn't a dictionary.`, + `Unmarshalling the type 'InstanceLog' failed as data isn't a dictionary.`, ) } return { - disabled: data.disabled, - frequency: data.frequency, - nextRunAt: unmarshalDate(data.next_run_at), - retention: data.retention, - } as BackupSchedule + createdAt: unmarshalDate(data.created_at), + downloadUrl: data.download_url, + expiresAt: unmarshalDate(data.expires_at), + id: data.id, + nodeName: data.node_name, + region: data.region, + status: data.status, + } as InstanceLog } -const unmarshalEngineVersion = (data: unknown) => { +const unmarshalBackupSchedule = (data: unknown): BackupSchedule => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'EngineVersion' failed as data isn't a dictionary.`, + `Unmarshalling the type 'BackupSchedule' failed as data isn't a dictionary.`, ) } return { - availableInitSettings: unmarshalArrayOfObject( - data.available_init_settings, - unmarshalEngineSetting, - ), - availableSettings: unmarshalArrayOfObject( - data.available_settings, - unmarshalEngineSetting, - ), - beta: data.beta, disabled: data.disabled, - endOfLife: unmarshalDate(data.end_of_life), - name: data.name, - version: data.version, - } as EngineVersion + frequency: data.frequency, + nextRunAt: unmarshalDate(data.next_run_at), + retention: data.retention, + } as BackupSchedule } -const unmarshalInstanceSetting = (data: unknown) => { +const unmarshalInstanceSetting = (data: unknown): InstanceSetting => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'InstanceSetting' failed as data isn't a dictionary.`, ) } - return { name: data.name, value: data.value } as InstanceSetting + return { + name: data.name, + value: data.value, + } as InstanceSetting } -const unmarshalLogsPolicy = (data: unknown) => { +const unmarshalLogsPolicy = (data: unknown): LogsPolicy => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'LogsPolicy' failed as data isn't a dictionary.`, @@ -228,7 +240,7 @@ const unmarshalLogsPolicy = (data: unknown) => { } as LogsPolicy } -const unmarshalMaintenance = (data: unknown) => { +const unmarshalMaintenance = (data: unknown): Maintenance => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Maintenance' failed as data isn't a dictionary.`, @@ -244,52 +256,7 @@ const unmarshalMaintenance = (data: unknown) => { } as Maintenance } -const unmarshalNodeTypeVolumeConstraintSizes = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'NodeTypeVolumeConstraintSizes' failed as data isn't a dictionary.`, - ) - } - - return { - maxSize: data.max_size, - minSize: data.min_size, - } as NodeTypeVolumeConstraintSizes -} - -const unmarshalNodeTypeVolumeType = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`, - ) - } - - return { - chunkSize: data.chunk_size, - description: data.description, - maxSize: data.max_size, - minSize: data.min_size, - type: data.type, - } as NodeTypeVolumeType -} - -export const unmarshalReadReplica = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ReadReplica' failed as data isn't a dictionary.`, - ) - } - - return { - endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint), - id: data.id, - region: data.region, - sameZone: data.same_zone, - status: data.status, - } as ReadReplica -} - -const unmarshalUpgradableVersion = (data: unknown) => { +const unmarshalUpgradableVersion = (data: unknown): UpgradableVersion => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'UpgradableVersion' failed as data isn't a dictionary.`, @@ -304,64 +271,20 @@ const unmarshalUpgradableVersion = (data: unknown) => { } as UpgradableVersion } -const unmarshalVolume = (data: unknown) => { +const unmarshalVolume = (data: unknown): Volume => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`, ) } - return { size: data.size, type: data.type } as Volume -} - -const unmarshalACLRule = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`, - ) - } - - return { - action: data.action, - description: data.description, - direction: data.direction, - ip: data.ip, - port: data.port, - protocol: data.protocol, - } as ACLRule -} - -export const unmarshalDatabase = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Database' failed as data isn't a dictionary.`, - ) - } - return { - managed: data.managed, - name: data.name, - owner: data.owner, size: data.size, - } as Database -} - -const unmarshalDatabaseEngine = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DatabaseEngine' failed as data isn't a dictionary.`, - ) - } - - return { - logoUrl: data.logo_url, - name: data.name, - region: data.region, - versions: unmarshalArrayOfObject(data.versions, unmarshalEngineVersion), - } as DatabaseEngine + type: data.type, + } as Volume } -export const unmarshalInstance = (data: unknown) => { +export const unmarshalInstance = (data: unknown): Instance => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Instance' failed as data isn't a dictionary.`, @@ -410,70 +333,7 @@ export const unmarshalInstance = (data: unknown) => { } as Instance } -export const unmarshalInstanceLog = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'InstanceLog' failed as data isn't a dictionary.`, - ) - } - - return { - createdAt: unmarshalDate(data.created_at), - downloadUrl: data.download_url, - expiresAt: unmarshalDate(data.expires_at), - id: data.id, - nodeName: data.node_name, - region: data.region, - status: data.status, - } as InstanceLog -} - -const unmarshalListInstanceLogsDetailsResponseInstanceLogDetail = ( - data: unknown, -) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ListInstanceLogsDetailsResponseInstanceLogDetail' failed as data isn't a dictionary.`, - ) - } - - return { - logName: data.log_name, - size: data.size, - } as ListInstanceLogsDetailsResponseInstanceLogDetail -} - -const unmarshalNodeType = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`, - ) - } - - return { - availableVolumeTypes: unmarshalArrayOfObject( - data.available_volume_types, - unmarshalNodeTypeVolumeType, - ), - beta: data.beta, - description: data.description, - disabled: data.disabled, - generation: data.generation, - instanceRange: data.instance_range, - isBssdCompatible: data.is_bssd_compatible, - isHaRequired: data.is_ha_required, - memory: data.memory, - name: data.name, - region: data.region, - stockStatus: data.stock_status, - vcpus: data.vcpus, - volumeConstraint: data.volume_constraint - ? unmarshalNodeTypeVolumeConstraintSizes(data.volume_constraint) - : undefined, - } as NodeType -} - -export const unmarshalPrivilege = (data: unknown) => { +export const unmarshalPrivilege = (data: unknown): Privilege => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Privilege' failed as data isn't a dictionary.`, @@ -487,7 +347,7 @@ export const unmarshalPrivilege = (data: unknown) => { } as Privilege } -export const unmarshalSnapshot = (data: unknown) => { +export const unmarshalSnapshot = (data: unknown): Snapshot => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`, @@ -509,17 +369,39 @@ export const unmarshalSnapshot = (data: unknown) => { } as Snapshot } -export const unmarshalUser = (data: unknown) => { +export const unmarshalUser = (data: unknown): User => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'User' failed as data isn't a dictionary.`, ) } - return { isAdmin: data.is_admin, name: data.name } as User + return { + isAdmin: data.is_admin, + name: data.name, + } as User +} + +const unmarshalACLRule = (data: unknown): ACLRule => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`, + ) + } + + return { + action: data.action, + description: data.description, + direction: data.direction, + ip: data.ip, + port: data.port, + protocol: data.protocol, + } as ACLRule } -export const unmarshalAddInstanceACLRulesResponse = (data: unknown) => { +export const unmarshalAddInstanceACLRulesResponse = ( + data: unknown, +): AddInstanceACLRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'AddInstanceACLRulesResponse' failed as data isn't a dictionary.`, @@ -531,7 +413,9 @@ export const unmarshalAddInstanceACLRulesResponse = (data: unknown) => { } as AddInstanceACLRulesResponse } -export const unmarshalAddInstanceSettingsResponse = (data: unknown) => { +export const unmarshalAddInstanceSettingsResponse = ( + data: unknown, +): AddInstanceSettingsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'AddInstanceSettingsResponse' failed as data isn't a dictionary.`, @@ -543,7 +427,9 @@ export const unmarshalAddInstanceSettingsResponse = (data: unknown) => { } as AddInstanceSettingsResponse } -export const unmarshalDeleteInstanceACLRulesResponse = (data: unknown) => { +export const unmarshalDeleteInstanceACLRulesResponse = ( + data: unknown, +): DeleteInstanceACLRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DeleteInstanceACLRulesResponse' failed as data isn't a dictionary.`, @@ -555,7 +441,9 @@ export const unmarshalDeleteInstanceACLRulesResponse = (data: unknown) => { } as DeleteInstanceACLRulesResponse } -export const unmarshalDeleteInstanceSettingsResponse = (data: unknown) => { +export const unmarshalDeleteInstanceSettingsResponse = ( + data: unknown, +): DeleteInstanceSettingsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DeleteInstanceSettingsResponse' failed as data isn't a dictionary.`, @@ -567,7 +455,7 @@ export const unmarshalDeleteInstanceSettingsResponse = (data: unknown) => { } as DeleteInstanceSettingsResponse } -export const unmarshalInstanceMetrics = (data: unknown) => { +export const unmarshalInstanceMetrics = (data: unknown): InstanceMetrics => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'InstanceMetrics' failed as data isn't a dictionary.`, @@ -579,7 +467,70 @@ export const unmarshalInstanceMetrics = (data: unknown) => { } as InstanceMetrics } -export const unmarshalListDatabaseEnginesResponse = (data: unknown) => { +const unmarshalEngineSetting = (data: unknown): EngineSetting => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'EngineSetting' failed as data isn't a dictionary.`, + ) + } + + return { + defaultValue: data.default_value, + description: data.description, + floatMax: data.float_max, + floatMin: data.float_min, + hotConfigurable: data.hot_configurable, + intMax: data.int_max, + intMin: data.int_min, + name: data.name, + propertyType: data.property_type, + stringConstraint: data.string_constraint, + unit: data.unit, + } as EngineSetting +} + +const unmarshalEngineVersion = (data: unknown): EngineVersion => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'EngineVersion' failed as data isn't a dictionary.`, + ) + } + + return { + availableInitSettings: unmarshalArrayOfObject( + data.available_init_settings, + unmarshalEngineSetting, + ), + availableSettings: unmarshalArrayOfObject( + data.available_settings, + unmarshalEngineSetting, + ), + beta: data.beta, + disabled: data.disabled, + endOfLife: unmarshalDate(data.end_of_life), + name: data.name, + version: data.version, + } as EngineVersion +} + +const unmarshalDatabaseEngine = (data: unknown): DatabaseEngine => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'DatabaseEngine' failed as data isn't a dictionary.`, + ) + } + + return { + logoUrl: data.logo_url, + name: data.name, + region: data.region, + versions: unmarshalArrayOfObject(data.versions, unmarshalEngineVersion), + } as DatabaseEngine +} + +export const unmarshalListDatabaseEnginesResponse = ( + data: unknown, +): ListDatabaseEnginesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDatabaseEnginesResponse' failed as data isn't a dictionary.`, @@ -592,7 +543,9 @@ export const unmarshalListDatabaseEnginesResponse = (data: unknown) => { } as ListDatabaseEnginesResponse } -export const unmarshalListDatabasesResponse = (data: unknown) => { +export const unmarshalListDatabasesResponse = ( + data: unknown, +): ListDatabasesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDatabasesResponse' failed as data isn't a dictionary.`, @@ -605,7 +558,9 @@ export const unmarshalListDatabasesResponse = (data: unknown) => { } as ListDatabasesResponse } -export const unmarshalListInstanceACLRulesResponse = (data: unknown) => { +export const unmarshalListInstanceACLRulesResponse = ( + data: unknown, +): ListInstanceACLRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListInstanceACLRulesResponse' failed as data isn't a dictionary.`, @@ -618,7 +573,24 @@ export const unmarshalListInstanceACLRulesResponse = (data: unknown) => { } as ListInstanceACLRulesResponse } -export const unmarshalListInstanceLogsDetailsResponse = (data: unknown) => { +const unmarshalListInstanceLogsDetailsResponseInstanceLogDetail = ( + data: unknown, +): ListInstanceLogsDetailsResponseInstanceLogDetail => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListInstanceLogsDetailsResponseInstanceLogDetail' failed as data isn't a dictionary.`, + ) + } + + return { + logName: data.log_name, + size: data.size, + } as ListInstanceLogsDetailsResponseInstanceLogDetail +} + +export const unmarshalListInstanceLogsDetailsResponse = ( + data: unknown, +): ListInstanceLogsDetailsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListInstanceLogsDetailsResponse' failed as data isn't a dictionary.`, @@ -633,7 +605,9 @@ export const unmarshalListInstanceLogsDetailsResponse = (data: unknown) => { } as ListInstanceLogsDetailsResponse } -export const unmarshalListInstanceLogsResponse = (data: unknown) => { +export const unmarshalListInstanceLogsResponse = ( + data: unknown, +): ListInstanceLogsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListInstanceLogsResponse' failed as data isn't a dictionary.`, @@ -648,7 +622,9 @@ export const unmarshalListInstanceLogsResponse = (data: unknown) => { } as ListInstanceLogsResponse } -export const unmarshalListInstancesResponse = (data: unknown) => { +export const unmarshalListInstancesResponse = ( + data: unknown, +): ListInstancesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`, @@ -661,7 +637,70 @@ export const unmarshalListInstancesResponse = (data: unknown) => { } as ListInstancesResponse } -export const unmarshalListNodeTypesResponse = (data: unknown) => { +const unmarshalNodeTypeVolumeConstraintSizes = ( + data: unknown, +): NodeTypeVolumeConstraintSizes => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'NodeTypeVolumeConstraintSizes' failed as data isn't a dictionary.`, + ) + } + + return { + maxSize: data.max_size, + minSize: data.min_size, + } as NodeTypeVolumeConstraintSizes +} + +const unmarshalNodeTypeVolumeType = (data: unknown): NodeTypeVolumeType => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`, + ) + } + + return { + chunkSize: data.chunk_size, + description: data.description, + maxSize: data.max_size, + minSize: data.min_size, + type: data.type, + } as NodeTypeVolumeType +} + +const unmarshalNodeType = (data: unknown): NodeType => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`, + ) + } + + return { + availableVolumeTypes: unmarshalArrayOfObject( + data.available_volume_types, + unmarshalNodeTypeVolumeType, + ), + beta: data.beta, + description: data.description, + disabled: data.disabled, + generation: data.generation, + instanceRange: data.instance_range, + isBssdCompatible: data.is_bssd_compatible, + isHaRequired: data.is_ha_required, + memory: data.memory, + name: data.name, + region: data.region, + stockStatus: data.stock_status, + vcpus: data.vcpus, + volumeConstraint: data.volume_constraint + ? unmarshalNodeTypeVolumeConstraintSizes(data.volume_constraint) + : undefined, + } as NodeType +} + +export const unmarshalListNodeTypesResponse = ( + data: unknown, +): ListNodeTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`, @@ -674,7 +713,9 @@ export const unmarshalListNodeTypesResponse = (data: unknown) => { } as ListNodeTypesResponse } -export const unmarshalListPrivilegesResponse = (data: unknown) => { +export const unmarshalListPrivilegesResponse = ( + data: unknown, +): ListPrivilegesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPrivilegesResponse' failed as data isn't a dictionary.`, @@ -687,7 +728,9 @@ export const unmarshalListPrivilegesResponse = (data: unknown) => { } as ListPrivilegesResponse } -export const unmarshalListSnapshotsResponse = (data: unknown) => { +export const unmarshalListSnapshotsResponse = ( + data: unknown, +): ListSnapshotsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`, @@ -700,7 +743,9 @@ export const unmarshalListSnapshotsResponse = (data: unknown) => { } as ListSnapshotsResponse } -export const unmarshalListUsersResponse = (data: unknown) => { +export const unmarshalListUsersResponse = ( + data: unknown, +): ListUsersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`, @@ -713,7 +758,9 @@ export const unmarshalListUsersResponse = (data: unknown) => { } as ListUsersResponse } -export const unmarshalSetInstanceACLRulesResponse = (data: unknown) => { +export const unmarshalSetInstanceACLRulesResponse = ( + data: unknown, +): SetInstanceACLRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetInstanceACLRulesResponse' failed as data isn't a dictionary.`, @@ -725,7 +772,9 @@ export const unmarshalSetInstanceACLRulesResponse = (data: unknown) => { } as SetInstanceACLRulesResponse } -export const unmarshalSetInstanceSettingsResponse = (data: unknown) => { +export const unmarshalSetInstanceSettingsResponse = ( + data: unknown, +): SetInstanceSettingsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetInstanceSettingsResponse' failed as data isn't a dictionary.`, @@ -737,70 +786,6 @@ export const unmarshalSetInstanceSettingsResponse = (data: unknown) => { } as SetInstanceSettingsResponse } -const marshalEndpointSpecPrivateNetworkIpamConfig = ( - request: EndpointSpecPrivateNetworkIpamConfig, - defaults: DefaultValues, -): Record => ({}) - -const marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig = ( - request: ReadReplicaEndpointSpecPrivateNetworkIpamConfig, - defaults: DefaultValues, -): Record => ({}) - -const marshalEndpointSpecLoadBalancer = ( - request: EndpointSpecLoadBalancer, - defaults: DefaultValues, -): Record => ({}) - -const marshalEndpointSpecPrivateNetwork = ( - request: EndpointSpecPrivateNetwork, - defaults: DefaultValues, -): Record => ({ - private_network_id: request.privateNetworkId, - ...resolveOneOf([ - { - param: 'service_ip', - value: request.serviceIp, - }, - { - param: 'ipam_config', - value: request.ipamConfig - ? marshalEndpointSpecPrivateNetworkIpamConfig( - request.ipamConfig, - defaults, - ) - : undefined, - }, - ]), -}) - -const marshalReadReplicaEndpointSpecDirectAccess = ( - request: ReadReplicaEndpointSpecDirectAccess, - defaults: DefaultValues, -): Record => ({}) - -const marshalReadReplicaEndpointSpecPrivateNetwork = ( - request: ReadReplicaEndpointSpecPrivateNetwork, - defaults: DefaultValues, -): Record => ({ - private_network_id: request.privateNetworkId, - ...resolveOneOf([ - { - param: 'service_ip', - value: request.serviceIp, - }, - { - param: 'ipam_config', - value: request.ipamConfig - ? marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig( - request.ipamConfig, - defaults, - ) - : undefined, - }, - ]), -}) - const marshalACLRuleRequest = ( request: ACLRuleRequest, defaults: DefaultValues, @@ -809,24 +794,11 @@ const marshalACLRuleRequest = ( ip: request.ip, }) -const marshalEndpointSpec = ( - request: EndpointSpec, +export const marshalAddInstanceACLRulesRequest = ( + request: AddInstanceACLRulesRequest, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ - { - param: 'load_balancer', - value: request.loadBalancer - ? marshalEndpointSpecLoadBalancer(request.loadBalancer, defaults) - : undefined, - }, - { - param: 'private_network', - value: request.privateNetwork - ? marshalEndpointSpecPrivateNetwork(request.privateNetwork, defaults) - : undefined, - }, - ]), + rules: request.rules.map(elt => marshalACLRuleRequest(elt, defaults)), }) const marshalInstanceSetting = ( @@ -837,47 +809,6 @@ const marshalInstanceSetting = ( value: request.value, }) -const marshalLogsPolicy = ( - request: LogsPolicy, - defaults: DefaultValues, -): Record => ({ - max_age_retention: request.maxAgeRetention, - total_disk_retention: request.totalDiskRetention, -}) - -const marshalReadReplicaEndpointSpec = ( - request: ReadReplicaEndpointSpec, - defaults: DefaultValues, -): Record => ({ - ...resolveOneOf([ - { - param: 'direct_access', - value: request.directAccess - ? marshalReadReplicaEndpointSpecDirectAccess( - request.directAccess, - defaults, - ) - : undefined, - }, - { - param: 'private_network', - value: request.privateNetwork - ? marshalReadReplicaEndpointSpecPrivateNetwork( - request.privateNetwork, - defaults, - ) - : undefined, - }, - ]), -}) - -export const marshalAddInstanceACLRulesRequest = ( - request: AddInstanceACLRulesRequest, - defaults: DefaultValues, -): Record => ({ - rules: request.rules.map(elt => marshalACLRuleRequest(elt, defaults)), -}) - export const marshalAddInstanceSettingsRequest = ( request: AddInstanceSettingsRequest, defaults: DefaultValues, @@ -900,13 +831,66 @@ export const marshalCreateDatabaseRequest = ( name: request.name, }) +const marshalEndpointSpecPrivateNetworkIpamConfig = ( + request: EndpointSpecPrivateNetworkIpamConfig, + defaults: DefaultValues, +): Record => ({}) + +const marshalEndpointSpecLoadBalancer = ( + request: EndpointSpecLoadBalancer, + defaults: DefaultValues, +): Record => ({}) + +const marshalEndpointSpecPrivateNetwork = ( + request: EndpointSpecPrivateNetwork, + defaults: DefaultValues, +): Record => ({ + private_network_id: request.privateNetworkId, + ...resolveOneOf>([ + { param: 'service_ip', value: request.serviceIp }, + { + param: 'ipam_config', + value: + request.ipamConfig !== undefined + ? marshalEndpointSpecPrivateNetworkIpamConfig( + request.ipamConfig, + defaults, + ) + : undefined, + }, + ]), +}) + +const marshalEndpointSpec = ( + request: EndpointSpec, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf([ + { + param: 'load_balancer', + value: + request.loadBalancer !== undefined + ? marshalEndpointSpecLoadBalancer(request.loadBalancer, defaults) + : undefined, + }, + { + param: 'private_network', + value: + request.privateNetwork !== undefined + ? marshalEndpointSpecPrivateNetwork(request.privateNetwork, defaults) + : undefined, + }, + ]), +}) + export const marshalCreateEndpointRequest = ( request: CreateEndpointRequest, defaults: DefaultValues, ): Record => ({ - endpoint_spec: request.endpointSpec - ? marshalEndpointSpec(request.endpointSpec, defaults) - : undefined, + endpoint_spec: + request.endpointSpec !== undefined + ? marshalEndpointSpec(request.endpointSpec, defaults) + : undefined, }) export const marshalCreateInstanceFromSnapshotRequest = ( @@ -925,12 +909,14 @@ export const marshalCreateInstanceRequest = ( backup_same_region: request.backupSameRegion, disable_backup: request.disableBackup, engine: request.engine, - init_endpoints: request.initEndpoints - ? request.initEndpoints.map(elt => marshalEndpointSpec(elt, defaults)) - : undefined, - init_settings: request.initSettings - ? request.initSettings.map(elt => marshalInstanceSetting(elt, defaults)) - : undefined, + init_endpoints: + request.initEndpoints !== undefined + ? request.initEndpoints.map(elt => marshalEndpointSpec(elt, defaults)) + : undefined, + init_settings: + request.initSettings !== undefined + ? request.initSettings.map(elt => marshalInstanceSetting(elt, defaults)) + : undefined, is_ha_cluster: request.isHaCluster, name: request.name || randomName('ins'), node_type: request.nodeType, @@ -938,17 +924,75 @@ export const marshalCreateInstanceRequest = ( tags: request.tags, user_name: request.userName, volume_size: request.volumeSize, - volume_type: request.volumeType ?? 'lssd', + volume_type: request.volumeType, ...resolveOneOf([ + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + ]), +}) + +const marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig = ( + request: ReadReplicaEndpointSpecPrivateNetworkIpamConfig, + defaults: DefaultValues, +): Record => ({}) + +const marshalReadReplicaEndpointSpecDirectAccess = ( + request: ReadReplicaEndpointSpecDirectAccess, + defaults: DefaultValues, +): Record => ({}) + +const marshalReadReplicaEndpointSpecPrivateNetwork = ( + request: ReadReplicaEndpointSpecPrivateNetwork, + defaults: DefaultValues, +): Record => ({ + private_network_id: request.privateNetworkId, + ...resolveOneOf>([ + { param: 'service_ip', value: request.serviceIp }, { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, + param: 'ipam_config', + value: + request.ipamConfig !== undefined + ? marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig( + request.ipamConfig, + defaults, + ) + : undefined, + }, + ]), +}) + +const marshalReadReplicaEndpointSpec = ( + request: ReadReplicaEndpointSpec, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf([ + { + param: 'direct_access', + value: + request.directAccess !== undefined + ? marshalReadReplicaEndpointSpecDirectAccess( + request.directAccess, + defaults, + ) + : undefined, + }, + { + param: 'private_network', + value: + request.privateNetwork !== undefined + ? marshalReadReplicaEndpointSpecPrivateNetwork( + request.privateNetwork, + defaults, + ) + : undefined, }, ]), }) @@ -966,11 +1010,12 @@ export const marshalCreateReadReplicaRequest = ( request: CreateReadReplicaRequest, defaults: DefaultValues, ): Record => ({ - endpoint_spec: request.endpointSpec - ? request.endpointSpec.map(elt => - marshalReadReplicaEndpointSpec(elt, defaults), - ) - : undefined, + endpoint_spec: + request.endpointSpec !== undefined + ? request.endpointSpec.map(elt => + marshalReadReplicaEndpointSpec(elt, defaults), + ) + : undefined, instance_id: request.instanceId, same_zone: request.sameZone, }) @@ -1039,10 +1084,18 @@ export const marshalSetPrivilegeRequest = ( defaults: DefaultValues, ): Record => ({ database_name: request.databaseName, - permission: request.permission ?? 'readonly', + permission: request.permission, user_name: request.userName, }) +const marshalLogsPolicy = ( + request: LogsPolicy, + defaults: DefaultValues, +): Record => ({ + max_age_retention: request.maxAgeRetention, + total_disk_retention: request.totalDiskRetention, +}) + export const marshalUpdateInstanceRequest = ( request: UpdateInstanceRequest, defaults: DefaultValues, @@ -1052,9 +1105,10 @@ export const marshalUpdateInstanceRequest = ( backup_schedule_retention: request.backupScheduleRetention, backup_schedule_start_hour: request.backupScheduleStartHour, is_backup_schedule_disabled: request.isBackupScheduleDisabled, - logs_policy: request.logsPolicy - ? marshalLogsPolicy(request.logsPolicy, defaults) - : undefined, + logs_policy: + request.logsPolicy !== undefined + ? marshalLogsPolicy(request.logsPolicy, defaults) + : undefined, name: request.name, tags: request.tags, }) @@ -1079,26 +1133,11 @@ export const marshalUpgradeInstanceRequest = ( request: UpgradeInstanceRequest, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ - { - param: 'node_type', - value: request.nodeType, - }, - { - param: 'enable_ha', - value: request.enableHa, - }, - { - param: 'volume_size', - value: request.volumeSize, - }, - { - param: 'volume_type', - value: request.volumeType, - }, - { - param: 'upgradable_version_id', - value: request.upgradableVersionId, - }, + ...resolveOneOf([ + { param: 'node_type', value: request.nodeType }, + { param: 'enable_ha', value: request.enableHa }, + { param: 'volume_size', value: request.volumeSize }, + { param: 'volume_type', value: request.volumeType }, + { param: 'upgradable_version_id', value: request.upgradableVersionId }, ]), }) diff --git a/packages/clients/src/api/document_db/v1beta1/types.gen.ts b/packages/clients/src/api/document_db/v1beta1/types.gen.ts index 8e07852ce..0f401b59a 100644 --- a/packages/clients/src/api/document_db/v1beta1/types.gen.ts +++ b/packages/clients/src/api/document_db/v1beta1/types.gen.ts @@ -81,7 +81,6 @@ export type NodeTypeStock = export type Permission = 'readonly' | 'readwrite' | 'all' | 'custom' | 'none' -/** Read replica. status. */ export type ReadReplicaStatus = | 'unknown' | 'provisioning' @@ -104,82 +103,48 @@ export type SnapshotStatus = export type VolumeType = 'lssd' | 'bssd' -export interface ACLRule { - ip: string - /** @deprecated */ - port?: number - protocol: ACLRuleProtocol - direction: ACLRuleDirection - action: ACLRuleAction - description: string -} - -export interface ACLRuleRequest { - ip: string - description: string -} +export interface EndpointDirectAccessDetails {} -/** Add instance acl rules response. */ -export interface AddInstanceACLRulesResponse { - /** ACL Rules enabled for the Database Instance. */ - rules: ACLRule[] -} +export interface EndpointLoadBalancerDetails {} -/** Add instance settings response. */ -export interface AddInstanceSettingsResponse { - /** Settings available on the Database Instance. */ - settings: InstanceSetting[] +export interface EndpointPrivateNetworkDetails { + /** UUID of the Private Network. */ + privateNetworkId: string + /** CIDR notation of the endpoint IPv4 address. */ + serviceIp: string + /** Private network zone. */ + zone: Zone } -/** Backup schedule. */ -export interface BackupSchedule { - /** Frequency of the backup schedule (in hours). */ - frequency: number - /** Default retention period of backups (in days). */ - retention: number - /** Defines whether the backup schedule feature is disabled. */ - disabled: boolean - /** Next run of the backup schedule (accurate to 10 minutes). */ - nextRunAt?: Date -} +export interface EndpointSpecPrivateNetworkIpamConfig {} -/** Database. */ -export interface Database { - /** Name of the database. */ - name: string - /** Name of the database owner. */ - owner: string - /** Defines whether the database is managed or not. */ - managed: boolean - /** Size of the database. */ - size: number -} +export interface ReadReplicaEndpointSpecPrivateNetworkIpamConfig {} -/** Database engine. */ -export interface DatabaseEngine { - /** Engine name. */ +export interface EngineSetting { + /** Setting name from the database engine. */ name: string - /** Engine logo URL. */ - logoUrl: string - /** Available versions. */ - versions: EngineVersion[] - /** Region of this Database Instance. */ - region: Region -} - -/** Delete instance acl rules response. */ -export interface DeleteInstanceACLRulesResponse { - /** IP addresses defined in the ACL rules of the Database Instance. */ - rules: ACLRule[] -} - -/** Delete instance settings response. */ -export interface DeleteInstanceSettingsResponse { - /** Settings names to delete from the Database Instance. */ - settings: InstanceSetting[] + /** Value set when not specified. */ + defaultValue: string + /** Setting can be applied without restarting. */ + hotConfigurable: boolean + /** Setting description. */ + description: string + /** Setting type. */ + propertyType: EngineSettingPropertyType + /** Setting base unit. */ + unit?: string + /** Validation regex for string type settings. */ + stringConstraint?: string + /** Minimum value for int types. */ + intMin?: number + /** Maximum value for int types. */ + intMax?: number + /** Minimum value for float types. */ + floatMin?: number + /** Maximum value for float types. */ + floatMax?: number } -/** Endpoint. */ export interface Endpoint { /** UUID of the endpoint. */ id: string @@ -226,48 +191,33 @@ export interface Endpoint { hostname?: string } -export interface EndpointDirectAccessDetails {} - -export interface EndpointLoadBalancerDetails {} +export interface EndpointSpecLoadBalancer {} -/** Endpoint. private network details. */ -export interface EndpointPrivateNetworkDetails { - /** UUID of the Private Network. */ +export interface EndpointSpecPrivateNetwork { + /** UUID of the Private Network to be connected to the Database Instance. */ privateNetworkId: string - /** CIDR notation of the endpoint IPv4 address. */ - serviceIp: string - /** Private network zone. */ - zone: Zone -} - -/** Endpoint spec. */ -export interface EndpointSpec { /** - * Load Balancer endpoint specifications. Public endpoint for Database - * Instance which is systematically present. One per Document Database - * Instance. + * Endpoint IPv4 address with a CIDR notation. Refer to the official Scaleway + * documentation to learn more about IP and subnet limitations. * - * One-of ('spec'): at most one of 'loadBalancer', 'privateNetwork' could be - * set. + * One-of ('config'): at most one of 'serviceIp', 'ipamConfig' could be set. */ - loadBalancer?: EndpointSpecLoadBalancer + serviceIp?: string /** - * Private Network endpoint specifications. One maximum per Database Instance - * or Read Replica (a Database Instance and its Read Replica can have - * different Private Networks). Cannot be updated (has to be deleted and - * recreated). + * Automated configuration of your Private Network endpoint with Scaleway IPAM + * service. One at the most per Database Instance or Read Replica (a Database + * Instance and its Read Replica can have different Private Networks). Cannot + * be updated (has to be deleted and recreated). * - * One-of ('spec'): at most one of 'loadBalancer', 'privateNetwork' could be - * set. + * One-of ('config'): at most one of 'serviceIp', 'ipamConfig' could be set. */ - privateNetwork?: EndpointSpecPrivateNetwork + ipamConfig?: EndpointSpecPrivateNetworkIpamConfig } -export interface EndpointSpecLoadBalancer {} +export interface ReadReplicaEndpointSpecDirectAccess {} -/** Endpoint spec. private network. */ -export interface EndpointSpecPrivateNetwork { - /** UUID of the Private Network to be connected to the Database Instance. */ +export interface ReadReplicaEndpointSpecPrivateNetwork { + /** UUID of the Private Network to be connected to the Read Replica. */ privateNetworkId: string /** * Endpoint IPv4 address with a CIDR notation. Refer to the official Scaleway @@ -279,43 +229,14 @@ export interface EndpointSpecPrivateNetwork { /** * Automated configuration of your Private Network endpoint with Scaleway IPAM * service. One at the most per Database Instance or Read Replica (a Database - * Instance and its Read Replica can have different Private Networks). Cannot + * Instance and its Read Replica can have different private networks). Cannot * be updated (has to be deleted and recreated). * * One-of ('config'): at most one of 'serviceIp', 'ipamConfig' could be set. */ - ipamConfig?: EndpointSpecPrivateNetworkIpamConfig -} - -export interface EndpointSpecPrivateNetworkIpamConfig {} - -/** Engine setting. */ -export interface EngineSetting { - /** Setting name from the database engine. */ - name: string - /** Value set when not specified. */ - defaultValue: string - /** Setting can be applied without restarting. */ - hotConfigurable: boolean - /** Setting description. */ - description: string - /** Setting type. */ - propertyType: EngineSettingPropertyType - /** Setting base unit. */ - unit?: string - /** Validation regex for string type settings. */ - stringConstraint?: string - /** Minimum value for int types. */ - intMin?: number - /** Maximum value for int types. */ - intMax?: number - /** Minimum value for float types. */ - floatMin?: number - /** Maximum value for float types. */ - floatMax?: number + ipamConfig?: ReadReplicaEndpointSpecPrivateNetworkIpamConfig } -/** Engine version. */ export interface EngineVersion { /** Database engine version. */ version: string @@ -333,76 +254,15 @@ export interface EngineVersion { availableInitSettings: EngineSetting[] } -/** Instance. */ -export interface Instance { - /** Creation date (must follow the ISO 8601 format). */ - createdAt?: Date - /** Volumes of the Database Instance. */ - volume?: Volume - /** Region the Database Instance is in. */ - region: Region - /** UUID of the Database Instance. */ - id: string - /** Name of the Database Instance. */ - name: string - /** Organization ID the Database Instance belongs to. */ - organizationId: string - /** Project ID the Database Instance belongs to. */ - projectId: string - /** Status of the Database Instance. */ - status: InstanceStatus - /** Database engine of the database. */ - engine: string - /** Available database engine versions for upgrade. */ - upgradableVersion: UpgradableVersion[] - /** @deprecated Endpoint of the Database Instance. */ - endpoint?: Endpoint - /** List of tags applied to the Database Instance. */ - tags: string[] - /** Advanced settings of the Database Instance. */ - settings: InstanceSetting[] - /** Backup schedule of the Database Instance. */ - backupSchedule?: BackupSchedule - /** Defines whether or not High-Availability is enabled. */ - isHaCluster: boolean - /** Read Replicas of the Database Instance. */ - readReplicas: ReadReplica[] - /** Node type of the Database Instance. */ - nodeType: string - /** List of engine settings to be set at Database Instance initialization. */ - initSettings: InstanceSetting[] - /** List of Database Instance endpoints. */ - endpoints: Endpoint[] - /** Logs policy of the Database Instance. */ - logsPolicy?: LogsPolicy - /** Store logical backups in the same region as the Database Instance. */ - backupSameRegion: boolean - /** List of Database Instance maintenance events. */ - maintenances: Maintenance[] -} - -/** Instance log. */ -export interface InstanceLog { - /** Presigned S3 URL to download your log file. */ - downloadUrl?: string - /** UUID of the Database Instance log. */ - id: string - /** Status of the logs in a Database Instance. */ - status: InstanceLogStatus - /** Name of the underlying node. */ - nodeName: string - /** Expiration date (must follow the ISO 8601 format). */ - expiresAt?: Date - /** Creation date (must follow the ISO 8601 format). */ - createdAt?: Date - /** Region the Database Instance is in. */ - region: Region -} - -/** Instance metrics. */ -export interface InstanceMetrics { - /** Time series of metrics of a Database Instance. */ - timeseries: TimeSeries[] +export interface BackupSchedule { + /** Frequency of the backup schedule (in hours). */ + frequency: number + /** Default retention period of backups (in days). */ + retention: number + /** Defines whether the backup schedule feature is disabled. */ + disabled: boolean + /** Next run of the backup schedule (accurate to 10 minutes). */ + nextRunAt?: Date } export interface InstanceSetting { @@ -410,96 +270,13 @@ export interface InstanceSetting { value: string } -/** List database engines response. */ -export interface ListDatabaseEnginesResponse { - /** List of the available database engines. */ - engines: DatabaseEngine[] - /** Total count of database engines available. */ - totalCount: number +export interface LogsPolicy { + /** Max age (in days) of remote logs to keep on the Database Instance. */ + maxAgeRetention?: number + /** Max disk size of remote logs to keep on the Database Instance. */ + totalDiskRetention?: number } -/** List databases response. */ -export interface ListDatabasesResponse { - /** List of the databases. */ - databases: Database[] - /** Total count of databases present on a Database Instance. */ - totalCount: number -} - -/** List instance acl rules response. */ -export interface ListInstanceACLRulesResponse { - /** List of ACL rules present on a Database Instance. */ - rules: ACLRule[] - /** Total count of ACL rules present on a Database Instance. */ - totalCount: number -} - -/** List instance logs details response. */ -export interface ListInstanceLogsDetailsResponse { - /** Remote Database Instance logs details. */ - details: ListInstanceLogsDetailsResponseInstanceLogDetail[] -} - -export interface ListInstanceLogsDetailsResponseInstanceLogDetail { - logName: string - size: number -} - -/** List instance logs response. */ -export interface ListInstanceLogsResponse { - /** Available logs in a Database Instance. */ - instanceLogs: InstanceLog[] -} - -/** List instances response. */ -export interface ListInstancesResponse { - /** List of all Database Instances available in an Organization or Project. */ - instances: Instance[] - /** Total count of Database Instances available in a Organization or Project. */ - totalCount: number -} - -/** List node types response. */ -export interface ListNodeTypesResponse { - /** Types of the node. */ - nodeTypes: NodeType[] - /** Total count of node-types available. */ - totalCount: number -} - -/** List privileges response. */ -export interface ListPrivilegesResponse { - /** Privileges of a user in a database in a Database Instance. */ - privileges: Privilege[] - /** Total count of privileges present on a database. */ - totalCount: number -} - -/** List snapshots response. */ -export interface ListSnapshotsResponse { - /** List of snapshots. */ - snapshots: Snapshot[] - /** Total count of snapshots available. */ - totalCount: number -} - -/** List users response. */ -export interface ListUsersResponse { - /** List of users in a Database Instance. */ - users: User[] - /** Total count of users present on a Database Instance. */ - totalCount: number -} - -/** Logs policy. */ -export interface LogsPolicy { - /** Max age (in days) of remote logs to keep on the Database Instance. */ - maxAgeRetention?: number - /** Max disk size of remote logs to keep on the Database Instance. */ - totalDiskRetention?: number -} - -/** Maintenance. */ export interface Maintenance { /** Start date of the maintenance window. */ startsAt?: Date @@ -513,39 +290,34 @@ export interface Maintenance { status: MaintenanceStatus } -/** Node type. */ -export interface NodeType { - /** Node Type name identifier. */ - name: string - /** Current stock status for the Node Type. */ - stockStatus: NodeTypeStock - /** Current specs of the offer. */ - description: string - /** Number of virtual CPUs. */ - vcpus: number - /** Quantity of RAM. */ - memory: number - /** @deprecated {undefined} Deprecated Node Type volume constraints. */ - volumeConstraint?: NodeTypeVolumeConstraintSizes - /** @deprecated The Node Type is compliant with Block Storage. */ - isBssdCompatible?: boolean - /** The Node Type is currently disabled. */ - disabled: boolean - /** The Node Type is currently in beta. */ - beta: boolean - /** Available storage options for the Node Type. */ - availableVolumeTypes: NodeTypeVolumeType[] - /** The Node Type can be used only with the High Availability option. */ - isHaRequired: boolean - /** Generation associated the NodeType offer. */ - generation: NodeTypeGeneration - /** Instance range associated with the NodeType offer. */ - instanceRange: string - /** Region the Node Type is in. */ +export interface ReadReplica { + /** UUID of the Read Replica. */ + id: string + /** Display Read Replica connection information. */ + endpoints: Endpoint[] + /** Read replica status. */ + status: ReadReplicaStatus + /** Region the Read Replica is in. */ region: Region + /** + * Whether the replica is in the same Availability Zone as the main Database + * Instance nodes or not. + */ + sameZone: boolean +} + +export interface UpgradableVersion { + id: string + name: string + version: string + minorVersion: string +} + +export interface Volume { + type: VolumeType + size: number } -/** Node type. volume constraint sizes. */ export interface NodeTypeVolumeConstraintSizes { /** [deprecated] Mimimum size required for the Volume. */ minSize: number @@ -553,7 +325,6 @@ export interface NodeTypeVolumeConstraintSizes { maxSize: number } -/** Node type. volume type. */ export interface NodeTypeVolumeType { /** Volume Type. */ type: VolumeType @@ -567,34 +338,43 @@ export interface NodeTypeVolumeType { chunkSize: number } -/** Privilege. */ -export interface Privilege { - /** Permission (Read, Read/Write, All, Custom). */ - permission: Permission - /** Name of the database. */ - databaseName: string - /** Name of the user. */ - userName: string +export interface ACLRuleRequest { + ip: string + description: string } -/** Read replica. */ -export interface ReadReplica { - /** UUID of the Read Replica. */ - id: string - /** Display Read Replica connection information. */ - endpoints: Endpoint[] - /** Read replica status. */ - status: ReadReplicaStatus - /** Region the Read Replica is in. */ - region: Region +export interface ACLRule { + ip: string + /** @deprecated */ + port?: number + protocol: ACLRuleProtocol + direction: ACLRuleDirection + action: ACLRuleAction + description: string +} + +export interface EndpointSpec { /** - * Whether the replica is in the same Availability Zone as the main Database - * Instance nodes or not. + * Load Balancer endpoint specifications. Public endpoint for Database + * Instance which is systematically present. One per Document Database + * Instance. + * + * One-of ('spec'): at most one of 'loadBalancer', 'privateNetwork' could be + * set. */ - sameZone: boolean + loadBalancer?: EndpointSpecLoadBalancer + /** + * Private Network endpoint specifications. One maximum per Database Instance + * or Read Replica (a Database Instance and its Read Replica can have + * different Private Networks). Cannot be updated (has to be deleted and + * recreated). + * + * One-of ('spec'): at most one of 'loadBalancer', 'privateNetwork' could be + * set. + */ + privateNetwork?: EndpointSpecPrivateNetwork } -/** Read replica endpoint spec. */ export interface ReadReplicaEndpointSpec { /** * Direct access endpoint specifications. Public endpoint reserved for Read @@ -614,45 +394,137 @@ export interface ReadReplicaEndpointSpec { privateNetwork?: ReadReplicaEndpointSpecPrivateNetwork } -export interface ReadReplicaEndpointSpecDirectAccess {} +export interface DatabaseEngine { + /** Engine name. */ + name: string + /** Engine logo URL. */ + logoUrl: string + /** Available versions. */ + versions: EngineVersion[] + /** Region of this Database Instance. */ + region: Region +} -/** Read replica endpoint spec. private network. */ -export interface ReadReplicaEndpointSpecPrivateNetwork { - /** UUID of the Private Network to be connected to the Read Replica. */ - privateNetworkId: string - /** - * Endpoint IPv4 address with a CIDR notation. Refer to the official Scaleway - * documentation to learn more about IP and subnet limitations. - * - * One-of ('config'): at most one of 'serviceIp', 'ipamConfig' could be set. - */ - serviceIp?: string - /** - * Automated configuration of your Private Network endpoint with Scaleway IPAM - * service. One at the most per Database Instance or Read Replica (a Database - * Instance and its Read Replica can have different private networks). Cannot - * be updated (has to be deleted and recreated). - * - * One-of ('config'): at most one of 'serviceIp', 'ipamConfig' could be set. - */ - ipamConfig?: ReadReplicaEndpointSpecPrivateNetworkIpamConfig +export interface Database { + /** Name of the database. */ + name: string + /** Name of the database owner. */ + owner: string + /** Defines whether the database is managed or not. */ + managed: boolean + /** Size of the database. */ + size: number } -export interface ReadReplicaEndpointSpecPrivateNetworkIpamConfig {} +export interface ListInstanceLogsDetailsResponseInstanceLogDetail { + logName: string + size: number +} -/** Set instance acl rules response. */ -export interface SetInstanceACLRulesResponse { - /** ACLs rules configured for a Database Instance. */ - rules: ACLRule[] +export interface InstanceLog { + /** Presigned S3 URL to download your log file. */ + downloadUrl?: string + /** UUID of the Database Instance log. */ + id: string + /** Status of the logs in a Database Instance. */ + status: InstanceLogStatus + /** Name of the underlying node. */ + nodeName: string + /** Expiration date (must follow the ISO 8601 format). */ + expiresAt?: Date + /** Creation date (must follow the ISO 8601 format). */ + createdAt?: Date + /** Region the Database Instance is in. */ + region: Region +} + +export interface Instance { + /** Creation date (must follow the ISO 8601 format). */ + createdAt?: Date + /** Volumes of the Database Instance. */ + volume?: Volume + /** Region the Database Instance is in. */ + region: Region + /** UUID of the Database Instance. */ + id: string + /** Name of the Database Instance. */ + name: string + /** Organization ID the Database Instance belongs to. */ + organizationId: string + /** Project ID the Database Instance belongs to. */ + projectId: string + /** Status of the Database Instance. */ + status: InstanceStatus + /** Database engine of the database. */ + engine: string + /** Available database engine versions for upgrade. */ + upgradableVersion: UpgradableVersion[] + /** @deprecated Endpoint of the Database Instance. */ + endpoint?: Endpoint + /** List of tags applied to the Database Instance. */ + tags: string[] + /** Advanced settings of the Database Instance. */ + settings: InstanceSetting[] + /** Backup schedule of the Database Instance. */ + backupSchedule?: BackupSchedule + /** Defines whether or not High-Availability is enabled. */ + isHaCluster: boolean + /** Read Replicas of the Database Instance. */ + readReplicas: ReadReplica[] + /** Node type of the Database Instance. */ + nodeType: string + /** List of engine settings to be set at Database Instance initialization. */ + initSettings: InstanceSetting[] + /** List of Database Instance endpoints. */ + endpoints: Endpoint[] + /** Logs policy of the Database Instance. */ + logsPolicy?: LogsPolicy + /** Store logical backups in the same region as the Database Instance. */ + backupSameRegion: boolean + /** List of Database Instance maintenance events. */ + maintenances: Maintenance[] +} + +export interface NodeType { + /** Node Type name identifier. */ + name: string + /** Current stock status for the Node Type. */ + stockStatus: NodeTypeStock + /** Current specs of the offer. */ + description: string + /** Number of virtual CPUs. */ + vcpus: number + /** Quantity of RAM. */ + memory: number + /** @deprecated {undefined} Deprecated Node Type volume constraints. */ + volumeConstraint?: NodeTypeVolumeConstraintSizes + /** @deprecated The Node Type is compliant with Block Storage. */ + isBssdCompatible?: boolean + /** The Node Type is currently disabled. */ + disabled: boolean + /** The Node Type is currently in beta. */ + beta: boolean + /** Available storage options for the Node Type. */ + availableVolumeTypes: NodeTypeVolumeType[] + /** The Node Type can be used only with the High Availability option. */ + isHaRequired: boolean + /** Generation associated the NodeType offer. */ + generation: NodeTypeGeneration + /** Instance range associated with the NodeType offer. */ + instanceRange: string + /** Region the Node Type is in. */ + region: Region } -/** Set instance settings response. */ -export interface SetInstanceSettingsResponse { - /** Settings configured for a Database Instance. */ - settings: InstanceSetting[] +export interface Privilege { + /** Permission (Read, Read/Write, All, Custom). */ + permission: Permission + /** Name of the database. */ + databaseName: string + /** Name of the user. */ + userName: string } -/** Snapshot. */ export interface Snapshot { /** UUID of the snapshot. */ id: string @@ -678,14 +550,6 @@ export interface Snapshot { region: Region } -export interface UpgradableVersion { - id: string - name: string - version: string - minorVersion: string -} - -/** User. */ export interface User { /** * Name of the user (Length must be between 1 and 63 characters. First @@ -700,113 +564,95 @@ export interface User { isAdmin: boolean } -export interface Volume { - type: VolumeType - size: number -} - -export type ListDatabaseEnginesRequest = { +export type AddInstanceACLRulesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Name of the database engine. */ - name?: string - /** Version of the database engine. */ - version?: string - page?: number - pageSize?: number + /** UUID of the Database Instance you want to add ACL rules to. */ + instanceId: string + /** ACL rules to add to the Database Instance. */ + rules: ACLRuleRequest[] } -export type ListNodeTypesRequest = { +export interface AddInstanceACLRulesResponse { + /** ACL Rules enabled for the Database Instance. */ + rules: ACLRule[] +} + +export type AddInstanceSettingsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Defines whether or not to include disabled types. */ - includeDisabledTypes: boolean - page?: number - pageSize?: number + /** UUID of the Database Instance you want to add settings to. */ + instanceId: string + /** Settings to add to the Database Instance. */ + settings: InstanceSetting[] } -export type UpgradeInstanceRequest = { +export interface AddInstanceSettingsResponse { + /** Settings available on the Database Instance. */ + settings: InstanceSetting[] +} + +export type CloneInstanceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to upgrade. */ + /** UUID of the Database Instance you want to clone. */ instanceId: string - /** - * Node type of the Database Instance you want to upgrade to. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. - */ + /** Name of the Database Instance clone. */ + name: string + /** Node type of the clone. */ nodeType?: string +} + +export type CreateDatabaseRequest = { /** - * Defines whether or not High Availability should be enabled on the Database - * Instance. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. - */ - enableHa?: boolean - /** - * Increase your Block volume size. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. - */ - volumeSize?: number - /** - * Change your Database Instance storage type. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. - */ - volumeType?: VolumeType - /** - * Update your database engine to a newer version. This will create a new - * Database Instance with same specifications as the current one and perform a - * Database Engine upgrade. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. + * Region to target. If none is passed will use default region from the + * config. */ - upgradableVersionId?: string + region?: Region + /** UUID of the Database Instance where to create the database. */ + instanceId: string + /** Name of the database. */ + name: string } -export type ListInstancesRequest = { +export type CreateEndpointRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** List Database Instances that have a given tag. */ - tags?: string[] - /** Lists Database Instances that match a name pattern. */ - name?: string - /** Criteria to use when ordering Database Instance listings. */ - orderBy?: ListInstancesRequestOrderBy - /** Please use project_id instead. */ - organizationId?: string - /** Project ID to list the Database Instance of. */ - projectId?: string - page?: number - pageSize?: number + /** UUID of the Database Instance you to which you want to add an endpoint. */ + instanceId: string + /** Specification of the endpoint you want to create. */ + endpointSpec?: EndpointSpec } -export type GetInstanceRequest = { +export type CreateInstanceFromSnapshotRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance. */ - instanceId: string + /** Block snapshot of the Database Instance. */ + snapshotId: string + /** Name of the Database Instance created with the snapshot. */ + instanceName: string + /** + * Defines whether or not High Availability is enabled on the new Database + * Instance. + */ + isHaCluster?: boolean + /** The node type used to restore the snapshot. */ + nodeType?: string } export type CreateInstanceRequest = { @@ -860,67 +706,174 @@ export type CreateInstanceRequest = { * Defines whether to or not to store logical backups in the same region as * the Database Instance. */ - backupSameRegion: boolean + backupSameRegion: boolean +} + +export type CreateReadReplicaEndpointRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Read Replica. */ + readReplicaId: string + /** Specification of the endpoint you want to create. */ + endpointSpec: ReadReplicaEndpointSpec[] +} + +export type CreateReadReplicaRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Database Instance you want to create a Read Replica from. */ + instanceId: string + /** Specification of the endpoint you want to create. */ + endpointSpec?: ReadReplicaEndpointSpec[] + /** + * Defines whether or not to create the replica in the same Availability Zone + * as the main Database Instance nodes. + */ + sameZone?: boolean +} + +export type CreateSnapshotRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Database Instance. */ + instanceId: string + /** Name of the snapshot. */ + name?: string + /** Expiration date (must follow the ISO 8601 format). */ + expiresAt?: Date +} + +export type CreateUserRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Database Instance in which you want to create a user. */ + instanceId: string + /** Name of the user you want to create. */ + name: string + /** Password of the user you want to create. */ + password: string + /** Defines whether the user will have administrative privileges. */ + isAdmin: boolean +} + +export type DeleteDatabaseRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Database Instance where to delete the database. */ + instanceId: string + /** Name of the database to delete. */ + name: string +} + +export type DeleteEndpointRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** This endpoint can also be used to delete a Read Replica endpoint. */ + endpointId: string +} + +export type DeleteInstanceACLRulesRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Database Instance you want to delete an ACL rule from. */ + instanceId: string + /** IP addresses defined in the ACL rules of the Database Instance. */ + aclRuleIps: string[] +} + +export interface DeleteInstanceACLRulesResponse { + /** IP addresses defined in the ACL rules of the Database Instance. */ + rules: ACLRule[] +} + +export type DeleteInstanceRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Database Instance to delete. */ + instanceId: string +} + +export type DeleteInstanceSettingsRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Database Instance to delete settings from. */ + instanceId: string + /** Settings names to delete. */ + settingNames: string[] } -export type UpdateInstanceRequest = { +export interface DeleteInstanceSettingsResponse { + /** Settings names to delete from the Database Instance. */ + settings: InstanceSetting[] +} + +export type DeleteReadReplicaRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance to update. */ - instanceId: string - /** In hours. */ - backupScheduleFrequency?: number - /** In days. */ - backupScheduleRetention?: number - /** Defines whether or not the backup schedule is disabled. */ - isBackupScheduleDisabled?: boolean - /** Name of the Database Instance. */ - name?: string - /** Tags of a Database Instance. */ - tags?: string[] - /** Logs policy of the Database Instance. */ - logsPolicy?: LogsPolicy - /** Store logical backups in the same region as the Database Instance. */ - backupSameRegion?: boolean - /** Defines the start time of the autobackup. */ - backupScheduleStartHour?: number + /** UUID of the Read Replica. */ + readReplicaId: string } -export type DeleteInstanceRequest = { +export type DeleteSnapshotRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance to delete. */ - instanceId: string + /** UUID of the snapshot to delete. */ + snapshotId: string } -export type CloneInstanceRequest = { +export type DeleteUserRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to clone. */ + /** UUID of the Database Instance to delete the user from. */ instanceId: string - /** Name of the Database Instance clone. */ + /** Name of the user. */ name: string - /** Node type of the clone. */ - nodeType?: string } -export type RestartInstanceRequest = { +export type GetEndpointRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to restart. */ - instanceId: string + /** UUID of the endpoint you want to get. */ + endpointId: string } export type GetInstanceCertificateRequest = { @@ -933,14 +886,14 @@ export type GetInstanceCertificateRequest = { instanceId: string } -export type RenewInstanceCertificateRequest = { +export type GetInstanceLogRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want logs of. */ - instanceId: string + /** UUID of the instance_log you want. */ + instanceLogId: string } export type GetInstanceMetricsRequest = { @@ -959,21 +912,14 @@ export type GetInstanceMetricsRequest = { metricName?: string } -export type CreateReadReplicaRequest = { +export type GetInstanceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to create a Read Replica from. */ + /** UUID of the Database Instance. */ instanceId: string - /** Specification of the endpoint you want to create. */ - endpointSpec?: ReadReplicaEndpointSpec[] - /** - * Defines whether or not to create the replica in the same Availability Zone - * as the main Database Instance nodes. - */ - sameZone?: boolean } export type GetReadReplicaRequest = { @@ -986,80 +932,86 @@ export type GetReadReplicaRequest = { readReplicaId: string } -export type DeleteReadReplicaRequest = { +export type GetSnapshotRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Read Replica. */ - readReplicaId: string + /** UUID of the snapshot. */ + snapshotId: string } -export type ResetReadReplicaRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the Read Replica. */ - readReplicaId: string +export interface InstanceMetrics { + /** Time series of metrics of a Database Instance. */ + timeseries: TimeSeries[] } -export type PromoteReadReplicaRequest = { +export type ListDatabaseEnginesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Read Replica. */ - readReplicaId: string + /** Name of the database engine. */ + name?: string + /** Version of the database engine. */ + version?: string + page?: number + pageSize?: number } -export type CreateReadReplicaEndpointRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the Read Replica. */ - readReplicaId: string - /** Specification of the endpoint you want to create. */ - endpointSpec: ReadReplicaEndpointSpec[] +export interface ListDatabaseEnginesResponse { + /** List of the available database engines. */ + engines: DatabaseEngine[] + /** Total count of database engines available. */ + totalCount: number } -export type ListInstanceLogsRequest = { +export type ListDatabasesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want logs of. */ + /** UUID of the Database Instance to list the databases of. */ instanceId: string - /** Criteria to use when ordering Database Instance logs listing. */ - orderBy?: ListInstanceLogsRequestOrderBy + /** Name of the database. */ + name?: string + /** Defines whether or not the database is managed. */ + managed?: boolean + /** User that owns this database. */ + owner?: string + /** Criteria to use when ordering database listing. */ + orderBy?: ListDatabasesRequestOrderBy + page?: number + pageSize?: number } -export type GetInstanceLogRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the instance_log you want. */ - instanceLogId: string +export interface ListDatabasesResponse { + /** List of the databases. */ + databases: Database[] + /** Total count of databases present on a Database Instance. */ + totalCount: number } -export type PurgeInstanceLogsRequest = { +export type ListInstanceACLRulesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want logs of. */ + /** UUID of the Database Instance. */ instanceId: string - /** Given log name to purge. */ - logName?: string + page?: number + pageSize?: number +} + +export interface ListInstanceACLRulesResponse { + /** List of ACL rules present on a Database Instance. */ + rules: ACLRule[] + /** Total count of ACL rules present on a Database Instance. */ + totalCount: number } export type ListInstanceLogsDetailsRequest = { @@ -1072,43 +1024,75 @@ export type ListInstanceLogsDetailsRequest = { instanceId: string } -export type AddInstanceSettingsRequest = { +export interface ListInstanceLogsDetailsResponse { + /** Remote Database Instance logs details. */ + details: ListInstanceLogsDetailsResponseInstanceLogDetail[] +} + +export type ListInstanceLogsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to add settings to. */ + /** UUID of the Database Instance you want logs of. */ instanceId: string - /** Settings to add to the Database Instance. */ - settings: InstanceSetting[] + /** Criteria to use when ordering Database Instance logs listing. */ + orderBy?: ListInstanceLogsRequestOrderBy } -export type DeleteInstanceSettingsRequest = { +export interface ListInstanceLogsResponse { + /** Available logs in a Database Instance. */ + instanceLogs: InstanceLog[] +} + +export type ListInstancesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance to delete settings from. */ - instanceId: string - /** Settings names to delete. */ - settingNames: string[] + /** List Database Instances that have a given tag. */ + tags?: string[] + /** Lists Database Instances that match a name pattern. */ + name?: string + /** Criteria to use when ordering Database Instance listings. */ + orderBy?: ListInstancesRequestOrderBy + /** Please use project_id instead. */ + organizationId?: string + /** Project ID to list the Database Instance of. */ + projectId?: string + page?: number + pageSize?: number } -export type SetInstanceSettingsRequest = { +export interface ListInstancesResponse { + /** List of all Database Instances available in an Organization or Project. */ + instances: Instance[] + /** Total count of Database Instances available in a Organization or Project. */ + totalCount: number +} + +export type ListNodeTypesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance where the settings must be set. */ - instanceId: string - /** Settings to define for the Database Instance. */ - settings: InstanceSetting[] + /** Defines whether or not to include disabled types. */ + includeDisabledTypes: boolean + page?: number + pageSize?: number } -export type ListInstanceACLRulesRequest = { +export interface ListNodeTypesResponse { + /** Types of the node. */ + nodeTypes: NodeType[] + /** Total count of node-types available. */ + totalCount: number +} + +export type ListPrivilegesRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -1116,44 +1100,48 @@ export type ListInstanceACLRulesRequest = { region?: Region /** UUID of the Database Instance. */ instanceId: string + /** Criteria to use when ordering privileges listing. */ + orderBy?: ListPrivilegesRequestOrderBy page?: number pageSize?: number + /** Name of the database. */ + databaseName?: string + /** Name of the user. */ + userName?: string } -export type AddInstanceACLRulesRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the Database Instance you want to add ACL rules to. */ - instanceId: string - /** ACL rules to add to the Database Instance. */ - rules: ACLRuleRequest[] +export interface ListPrivilegesResponse { + /** Privileges of a user in a database in a Database Instance. */ + privileges: Privilege[] + /** Total count of privileges present on a database. */ + totalCount: number } -export type SetInstanceACLRulesRequest = { +export type ListSnapshotsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance where the ACL rules must be set. */ - instanceId: string - /** ACL rules to define for the Database Instance. */ - rules: ACLRuleRequest[] + /** Name of the snapshot. */ + name?: string + /** Criteria to use when ordering snapshot listing. */ + orderBy?: ListSnapshotsRequestOrderBy + /** UUID of the Database Instance. */ + instanceId?: string + /** Organization ID the snapshots belongs to. */ + organizationId?: string + /** Project ID the snapshots belongs to. */ + projectId?: string + page?: number + pageSize?: number } -export type DeleteInstanceACLRulesRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the Database Instance you want to delete an ACL rule from. */ - instanceId: string - /** IP addresses defined in the ACL rules of the Database Instance. */ - aclRuleIps: string[] +export interface ListSnapshotsResponse { + /** List of snapshots. */ + snapshots: Snapshot[] + /** Total count of snapshots available. */ + totalCount: number } export type ListUsersRequest = { @@ -1172,170 +1160,151 @@ export type ListUsersRequest = { pageSize?: number } -export type CreateUserRequest = { +export interface ListUsersResponse { + /** List of users in a Database Instance. */ + users: User[] + /** Total count of users present on a Database Instance. */ + totalCount: number +} + +export type MigrateEndpointRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance in which you want to create a user. */ + /** UUID of the endpoint you want to migrate. */ + endpointId: string + /** UUID of the instance you want to attach the endpoint to. */ instanceId: string - /** Name of the user you want to create. */ - name: string - /** Password of the user you want to create. */ - password: string - /** Defines whether the user will have administrative privileges. */ - isAdmin: boolean } -export type UpdateUserRequest = { +export type PromoteReadReplicaRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance the user belongs to. */ - instanceId: string - /** Name of the database user. */ - name: string - /** Password of the database user. */ - password?: string - /** Defines whether or not this user got administrative privileges. */ - isAdmin?: boolean + /** UUID of the Read Replica. */ + readReplicaId: string } -export type DeleteUserRequest = { +export type PurgeInstanceLogsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance to delete the user from. */ + /** UUID of the Database Instance you want logs of. */ instanceId: string - /** Name of the user. */ - name: string + /** Given log name to purge. */ + logName?: string } -export type ListDatabasesRequest = { +export type RenewInstanceCertificateRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance to list the databases of. */ + /** UUID of the Database Instance you want logs of. */ instanceId: string - /** Name of the database. */ - name?: string - /** Defines whether or not the database is managed. */ - managed?: boolean - /** User that owns this database. */ - owner?: string - /** Criteria to use when ordering database listing. */ - orderBy?: ListDatabasesRequestOrderBy - page?: number - pageSize?: number } -export type CreateDatabaseRequest = { +export type ResetReadReplicaRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance where to create the database. */ - instanceId: string - /** Name of the database. */ - name: string + /** UUID of the Read Replica. */ + readReplicaId: string } -export type DeleteDatabaseRequest = { +export type RestartInstanceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance where to delete the database. */ + /** UUID of the Database Instance you want to restart. */ instanceId: string - /** Name of the database to delete. */ - name: string } -export type ListPrivilegesRequest = { +export type SetInstanceACLRulesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance. */ + /** UUID of the Database Instance where the ACL rules must be set. */ instanceId: string - /** Criteria to use when ordering privileges listing. */ - orderBy?: ListPrivilegesRequestOrderBy - page?: number - pageSize?: number - /** Name of the database. */ - databaseName?: string - /** Name of the user. */ - userName?: string + /** ACL rules to define for the Database Instance. */ + rules: ACLRuleRequest[] } -export type SetPrivilegeRequest = { +export interface SetInstanceACLRulesResponse { + /** ACLs rules configured for a Database Instance. */ + rules: ACLRule[] +} + +export type SetInstanceSettingsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance. */ + /** UUID of the Database Instance where the settings must be set. */ instanceId: string - /** Name of the database. */ - databaseName: string - /** Name of the user. */ - userName: string - /** Permission to set (Read, Read/Write, All, Custom). */ - permission?: Permission + /** Settings to define for the Database Instance. */ + settings: InstanceSetting[] } -export type ListSnapshotsRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Name of the snapshot. */ - name?: string - /** Criteria to use when ordering snapshot listing. */ - orderBy?: ListSnapshotsRequestOrderBy - /** UUID of the Database Instance. */ - instanceId?: string - /** Organization ID the snapshots belongs to. */ - organizationId?: string - /** Project ID the snapshots belongs to. */ - projectId?: string - page?: number - pageSize?: number +export interface SetInstanceSettingsResponse { + /** Settings configured for a Database Instance. */ + settings: InstanceSetting[] } -export type GetSnapshotRequest = { +export type SetPrivilegeRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the snapshot. */ - snapshotId: string + /** UUID of the Database Instance. */ + instanceId: string + /** Name of the database. */ + databaseName: string + /** Name of the user. */ + userName: string + /** Permission to set (Read, Read/Write, All, Custom). */ + permission?: Permission } -export type CreateSnapshotRequest = { +export type UpdateInstanceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance. */ + /** UUID of the Database Instance to update. */ instanceId: string - /** Name of the snapshot. */ + /** In hours. */ + backupScheduleFrequency?: number + /** In days. */ + backupScheduleRetention?: number + /** Defines whether or not the backup schedule is disabled. */ + isBackupScheduleDisabled?: boolean + /** Name of the Database Instance. */ name?: string - /** Expiration date (must follow the ISO 8601 format). */ - expiresAt?: Date + /** Tags of a Database Instance. */ + tags?: string[] + /** Logs policy of the Database Instance. */ + logsPolicy?: LogsPolicy + /** Store logical backups in the same region as the Database Instance. */ + backupSameRegion?: boolean + /** Defines the start time of the autobackup. */ + backupScheduleStartHour?: number } export type UpdateSnapshotRequest = { @@ -1352,78 +1321,65 @@ export type UpdateSnapshotRequest = { expiresAt?: Date } -export type DeleteSnapshotRequest = { +export type UpdateUserRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the snapshot to delete. */ - snapshotId: string + /** UUID of the Database Instance the user belongs to. */ + instanceId: string + /** Name of the database user. */ + name: string + /** Password of the database user. */ + password?: string + /** Defines whether or not this user got administrative privileges. */ + isAdmin?: boolean } -export type CreateInstanceFromSnapshotRequest = { +export type UpgradeInstanceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Block snapshot of the Database Instance. */ - snapshotId: string - /** Name of the Database Instance created with the snapshot. */ - instanceName: string + /** UUID of the Database Instance you want to upgrade. */ + instanceId: string /** - * Defines whether or not High Availability is enabled on the new Database - * Instance. + * Node type of the Database Instance you want to upgrade to. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. */ - isHaCluster?: boolean - /** The node type used to restore the snapshot. */ nodeType?: string -} - -export type CreateEndpointRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the Database Instance you to which you want to add an endpoint. */ - instanceId: string - /** Specification of the endpoint you want to create. */ - endpointSpec?: EndpointSpec -} - -export type DeleteEndpointRequest = { /** - * Region to target. If none is passed will use default region from the - * config. + * Defines whether or not High Availability should be enabled on the Database + * Instance. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. */ - region?: Region + enableHa?: boolean /** - * UUID of the endpoint you want to delete. This endpoint can also be used to - * delete a Read Replica endpoint. + * Increase your Block volume size. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. */ - endpointId: string -} - -export type GetEndpointRequest = { + volumeSize?: number /** - * Region to target. If none is passed will use default region from the - * config. + * Change your Database Instance storage type. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. */ - region?: Region - /** UUID of the endpoint you want to get. */ - endpointId: string -} - -export type MigrateEndpointRequest = { + volumeType?: VolumeType /** - * Region to target. If none is passed will use default region from the - * config. + * This will create a new Database Instance with same specifications as the + * current one and perform a Database Engine upgrade. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. */ - region?: Region - /** UUID of the endpoint you want to migrate. */ - endpointId: string - /** UUID of the instance you want to attach the endpoint to. */ - instanceId: string + upgradableVersionId?: string } diff --git a/packages/clients/src/api/domain/v2beta1/api.gen.ts b/packages/clients/src/api/domain/v2beta1/api.gen.ts index e5ffb2002..2896ea287 100644 --- a/packages/clients/src/api/domain/v2beta1/api.gen.ts +++ b/packages/clients/src/api/domain/v2beta1/api.gen.ts @@ -164,8 +164,7 @@ const jsonContentHeaders = { /** * Domains and DNS API. * - * Domains and DNS API. Manage your domains, DNS zones and records with the - * Domains and DNS API. + * Manage your domains, DNS zones and records with the Domains and DNS API. */ export class API extends ParentAPI { protected pageOfListDNSZones = (request: Readonly) => @@ -179,7 +178,7 @@ export class API extends ParentAPI { ['dns_zone', request.dnsZone], ['dns_zones', request.dnsZones], ['domain', request.domain], - ['order_by', request.orderBy ?? 'domain_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -304,14 +303,14 @@ export class API extends ParentAPI { urlParams: urlParams( ['id', request.id], ['name', request.name], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', request.pageSize ?? this.client.settings.defaultPageSize, ], ['project_id', request.projectId], - ['type', request.type ?? 'unknown'], + ['type', request.type], ), }, unmarshalListDNSZoneRecordsResponse, @@ -441,10 +440,7 @@ export class API extends ParentAPI { 'dnsZone', request.dnsZone, )}/raw`, - urlParams: urlParams( - ['dl', 1], - ['format', request.format ?? 'unknown_raw_format'], - ), + urlParams: urlParams(['dl', 1], ['format', request.format]), responseType: 'blob', }) @@ -776,7 +772,7 @@ export class API extends ParentAPI { /** * Domains and DNS - Registrar API. * - * Domains and DNS - Registrar API. Manage your domains and contacts. + * Manage your domains and contacts. */ export class RegistrarAPI extends ParentAPI { protected pageOfListTasks = ( @@ -788,7 +784,7 @@ export class RegistrarAPI extends ParentAPI { path: `/domain/v2beta1/tasks`, urlParams: urlParams( ['domain', request.domain], - ['order_by', request.orderBy ?? 'domain_desc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -987,7 +983,7 @@ export class RegistrarAPI extends ParentAPI { path: `/domain/v2beta1/contacts`, urlParams: urlParams( ['domain', request.domain], - ['email_status', request.emailStatus ?? 'email_status_unknown'], + ['email_status', request.emailStatus], ['organization_id', request.organizationId], ['page', request.page], [ @@ -995,7 +991,7 @@ export class RegistrarAPI extends ParentAPI { request.pageSize ?? this.client.settings.defaultPageSize, ], ['project_id', request.projectId], - ['role', request.role ?? 'unknown_role'], + ['role', request.role], ), }, unmarshalListContactsResponse, @@ -1065,7 +1061,7 @@ export class RegistrarAPI extends ParentAPI { urlParams: urlParams( ['domain', request.domain], ['is_external', request.isExternal], - ['order_by', request.orderBy ?? 'domain_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -1074,7 +1070,7 @@ export class RegistrarAPI extends ParentAPI { ], ['project_id', request.projectId], ['registrar', request.registrar], - ['status', request.status ?? 'status_unknown'], + ['status', request.status], ), }, unmarshalListDomainsResponse, @@ -1097,7 +1093,7 @@ export class RegistrarAPI extends ParentAPI { method: 'GET', path: `/domain/v2beta1/renewable-domains`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'domain_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -1144,7 +1140,7 @@ export class RegistrarAPI extends ParentAPI { /** * Waits for {@link Domain} to be in a final state. * - * @param request - The request {@link GetDomainRequest} + * @param request - The request {@link RegistrarApiGetDomainRequest} * @param options - The waiting options * @returns A Promise of Domain */ @@ -1391,7 +1387,7 @@ export class RegistrarAPI extends ParentAPI { method: 'GET', path: `/domain/v2beta1/tlds`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -1494,7 +1490,7 @@ export class RegistrarAPI extends ParentAPI { ) /** - * Delete a domain's hostname. Delete a domain's hostname. + * Delete a domain's hostname. * * @param request - The request {@link RegistrarApiDeleteDomainHostRequest} * @returns A Promise of Host diff --git a/packages/clients/src/api/domain/v2beta1/index.gen.ts b/packages/clients/src/api/domain/v2beta1/index.gen.ts index 69ef0fb81..11d1c7ab8 100644 --- a/packages/clients/src/api/domain/v2beta1/index.gen.ts +++ b/packages/clients/src/api/domain/v2beta1/index.gen.ts @@ -76,7 +76,6 @@ export type { ImportRawDNSZoneRequestBindSource, ImportRawDNSZoneRequestTsigKey, ImportRawDNSZoneResponse, - LanguageCode, ListContactsRequestRole, ListContactsResponse, ListDNSZoneNameserversRequest, diff --git a/packages/clients/src/api/domain/v2beta1/marshalling.gen.ts b/packages/clients/src/api/domain/v2beta1/marshalling.gen.ts index 62066e738..a6ec9e2cd 100644 --- a/packages/clients/src/api/domain/v2beta1/marshalling.gen.ts +++ b/packages/clients/src/api/domain/v2beta1/marshalling.gen.ts @@ -113,44 +113,9 @@ import type { UpdateDNSZoneRequest, } from './types.gen' -const unmarshalDomainRecordGeoIPConfigMatch = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DomainRecordGeoIPConfigMatch' failed as data isn't a dictionary.`, - ) - } - - return { - continents: data.continents, - countries: data.countries, - data: data.data, - } as DomainRecordGeoIPConfigMatch -} - -const unmarshalDomainRecordViewConfigView = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DomainRecordViewConfigView' failed as data isn't a dictionary.`, - ) - } - - return { data: data.data, subnet: data.subnet } as DomainRecordViewConfigView -} - -const unmarshalDomainRecordWeightedConfigWeightedIP = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DomainRecordWeightedConfigWeightedIP' failed as data isn't a dictionary.`, - ) - } - - return { - ip: data.ip, - weight: data.weight, - } as DomainRecordWeightedConfigWeightedIP -} - -const unmarshalContactExtensionFRAssociationInfo = (data: unknown) => { +const unmarshalContactExtensionFRAssociationInfo = ( + data: unknown, +): ContactExtensionFRAssociationInfo => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactExtensionFRAssociationInfo' failed as data isn't a dictionary.`, @@ -163,7 +128,9 @@ const unmarshalContactExtensionFRAssociationInfo = (data: unknown) => { } as ContactExtensionFRAssociationInfo } -const unmarshalContactExtensionFRCodeAuthAfnicInfo = (data: unknown) => { +const unmarshalContactExtensionFRCodeAuthAfnicInfo = ( + data: unknown, +): ContactExtensionFRCodeAuthAfnicInfo => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactExtensionFRCodeAuthAfnicInfo' failed as data isn't a dictionary.`, @@ -175,7 +142,9 @@ const unmarshalContactExtensionFRCodeAuthAfnicInfo = (data: unknown) => { } as ContactExtensionFRCodeAuthAfnicInfo } -const unmarshalContactExtensionFRDunsInfo = (data: unknown) => { +const unmarshalContactExtensionFRDunsInfo = ( + data: unknown, +): ContactExtensionFRDunsInfo => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactExtensionFRDunsInfo' failed as data isn't a dictionary.`, @@ -188,17 +157,23 @@ const unmarshalContactExtensionFRDunsInfo = (data: unknown) => { } as ContactExtensionFRDunsInfo } -const unmarshalContactExtensionFRIndividualInfo = (data: unknown) => { +const unmarshalContactExtensionFRIndividualInfo = ( + data: unknown, +): ContactExtensionFRIndividualInfo => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactExtensionFRIndividualInfo' failed as data isn't a dictionary.`, ) } - return { whoisOptIn: data.whois_opt_in } as ContactExtensionFRIndividualInfo + return { + whoisOptIn: data.whois_opt_in, + } as ContactExtensionFRIndividualInfo } -const unmarshalContactExtensionFRTrademarkInfo = (data: unknown) => { +const unmarshalContactExtensionFRTrademarkInfo = ( + data: unknown, +): ContactExtensionFRTrademarkInfo => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactExtensionFRTrademarkInfo' failed as data isn't a dictionary.`, @@ -210,79 +185,7 @@ const unmarshalContactExtensionFRTrademarkInfo = (data: unknown) => { } as ContactExtensionFRTrademarkInfo } -const unmarshalDSRecordPublicKey = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DSRecordPublicKey' failed as data isn't a dictionary.`, - ) - } - - return { key: data.key } as DSRecordPublicKey -} - -const unmarshalDomainRecordGeoIPConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DomainRecordGeoIPConfig' failed as data isn't a dictionary.`, - ) - } - - return { - default: data.default, - matches: unmarshalArrayOfObject( - data.matches, - unmarshalDomainRecordGeoIPConfigMatch, - ), - } as DomainRecordGeoIPConfig -} - -const unmarshalDomainRecordHTTPServiceConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DomainRecordHTTPServiceConfig' failed as data isn't a dictionary.`, - ) - } - - return { - ips: data.ips, - mustContain: data.must_contain, - strategy: data.strategy, - url: data.url, - userAgent: data.user_agent, - } as DomainRecordHTTPServiceConfig -} - -const unmarshalDomainRecordViewConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DomainRecordViewConfig' failed as data isn't a dictionary.`, - ) - } - - return { - views: unmarshalArrayOfObject( - data.views, - unmarshalDomainRecordViewConfigView, - ), - } as DomainRecordViewConfig -} - -const unmarshalDomainRecordWeightedConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DomainRecordWeightedConfig' failed as data isn't a dictionary.`, - ) - } - - return { - weightedIps: unmarshalArrayOfObject( - data.weighted_ips, - unmarshalDomainRecordWeightedConfigWeightedIP, - ), - } as DomainRecordWeightedConfig -} - -const unmarshalContactExtensionEU = (data: unknown) => { +const unmarshalContactExtensionEU = (data: unknown): ContactExtensionEU => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactExtensionEU' failed as data isn't a dictionary.`, @@ -294,7 +197,7 @@ const unmarshalContactExtensionEU = (data: unknown) => { } as ContactExtensionEU } -const unmarshalContactExtensionFR = (data: unknown) => { +const unmarshalContactExtensionFR = (data: unknown): ContactExtensionFR => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactExtensionFR' failed as data isn't a dictionary.`, @@ -321,7 +224,7 @@ const unmarshalContactExtensionFR = (data: unknown) => { } as ContactExtensionFR } -const unmarshalContactExtensionNL = (data: unknown) => { +const unmarshalContactExtensionNL = (data: unknown): ContactExtensionNL => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactExtensionNL' failed as data isn't a dictionary.`, @@ -334,92 +237,20 @@ const unmarshalContactExtensionNL = (data: unknown) => { } as ContactExtensionNL } -const unmarshalContactQuestion = (data: unknown) => { +const unmarshalContactQuestion = (data: unknown): ContactQuestion => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ContactQuestion' failed as data isn't a dictionary.`, ) } - return { answer: data.answer, question: data.question } as ContactQuestion -} - -const unmarshalDSRecordDigest = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DSRecordDigest' failed as data isn't a dictionary.`, - ) - } - - return { - digest: data.digest, - publicKey: data.public_key - ? unmarshalDSRecordPublicKey(data.public_key) - : undefined, - type: data.type, - } as DSRecordDigest -} - -const unmarshalDomainRecord = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DomainRecord' failed as data isn't a dictionary.`, - ) - } - - return { - comment: data.comment, - data: data.data, - geoIpConfig: data.geo_ip_config - ? unmarshalDomainRecordGeoIPConfig(data.geo_ip_config) - : undefined, - httpServiceConfig: data.http_service_config - ? unmarshalDomainRecordHTTPServiceConfig(data.http_service_config) - : undefined, - id: data.id, - name: data.name, - priority: data.priority, - ttl: data.ttl, - type: data.type, - viewConfig: data.view_config - ? unmarshalDomainRecordViewConfig(data.view_config) - : undefined, - weightedConfig: data.weighted_config - ? unmarshalDomainRecordWeightedConfig(data.weighted_config) - : undefined, - } as DomainRecord -} - -const unmarshalRecordIdentifier = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'RecordIdentifier' failed as data isn't a dictionary.`, - ) - } - - return { - data: data.data, - name: data.name, - ttl: data.ttl, - type: data.type, - } as RecordIdentifier -} - -const unmarshalTldOffer = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'TldOffer' failed as data isn't a dictionary.`, - ) - } - return { - action: data.action, - operationPath: data.operation_path, - price: data.price ? unmarshalMoney(data.price) : undefined, - } as TldOffer + answer: data.answer, + question: data.question, + } as ContactQuestion } -export const unmarshalContact = (data: unknown) => { +export const unmarshalContact = (data: unknown): Contact => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Contact' failed as data isn't a dictionary.`, @@ -452,11 +283,9 @@ export const unmarshalContact = (data: unknown) => { lastname: data.lastname, legalForm: data.legal_form, phoneNumber: data.phone_number, - questions: unmarshalArrayOfObject( - data.questions, - unmarshalContactQuestion, - false, - ), + questions: data.questions + ? unmarshalArrayOfObject(data.questions, unmarshalContactQuestion) + : undefined, resale: data.resale, state: data.state, vatIdentificationCode: data.vat_identification_code, @@ -465,232 +294,285 @@ export const unmarshalContact = (data: unknown) => { } as Contact } -const unmarshalContactRolesRoles = (data: unknown) => { +export const unmarshalDNSZone = (data: unknown): DNSZone => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ContactRolesRoles' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DNSZone' failed as data isn't a dictionary.`, ) } return { - isAdministrative: data.is_administrative, - isOwner: data.is_owner, - isTechnical: data.is_technical, - } as ContactRolesRoles + domain: data.domain, + message: data.message, + ns: data.ns, + nsDefault: data.ns_default, + nsMaster: data.ns_master, + projectId: data.project_id, + status: data.status, + subdomain: data.subdomain, + updatedAt: unmarshalDate(data.updated_at), + } as DNSZone } -const unmarshalDSRecord = (data: unknown) => { +export const unmarshalHost = (data: unknown): Host => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DSRecord' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Host' failed as data isn't a dictionary.`, ) } return { - algorithm: data.algorithm, - digest: data.digest ? unmarshalDSRecordDigest(data.digest) : undefined, - keyId: data.key_id, - publicKey: data.public_key - ? unmarshalDSRecordPublicKey(data.public_key) - : undefined, - } as DSRecord + domain: data.domain, + ips: data.ips, + name: data.name, + status: data.status, + } as Host } -const unmarshalDomainRegistrationStatusExternalDomain = (data: unknown) => { +export const unmarshalSSLCertificate = (data: unknown): SSLCertificate => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DomainRegistrationStatusExternalDomain' failed as data isn't a dictionary.`, + `Unmarshalling the type 'SSLCertificate' failed as data isn't a dictionary.`, ) } return { - validationToken: data.validation_token, - } as DomainRegistrationStatusExternalDomain + alternativeDnsZones: data.alternative_dns_zones, + certificateChain: data.certificate_chain, + createdAt: unmarshalDate(data.created_at), + dnsZone: data.dns_zone, + expiredAt: unmarshalDate(data.expired_at), + privateKey: data.private_key, + status: data.status, + } as SSLCertificate } -const unmarshalDomainRegistrationStatusTransfer = (data: unknown) => { +const unmarshalCheckContactsCompatibilityResponseContactCheckResult = ( + data: unknown, +): CheckContactsCompatibilityResponseContactCheckResult => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DomainRegistrationStatusTransfer' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CheckContactsCompatibilityResponseContactCheckResult' failed as data isn't a dictionary.`, ) } return { - status: data.status, - voteCurrentOwner: data.vote_current_owner, - voteNewOwner: data.vote_new_owner, - } as DomainRegistrationStatusTransfer + compatible: data.compatible, + errorMessage: data.error_message, + } as CheckContactsCompatibilityResponseContactCheckResult } -const unmarshalRecordChangeAdd = (data: unknown) => { +export const unmarshalCheckContactsCompatibilityResponse = ( + data: unknown, +): CheckContactsCompatibilityResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RecordChangeAdd' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CheckContactsCompatibilityResponse' failed as data isn't a dictionary.`, ) } return { - records: unmarshalArrayOfObject(data.records, unmarshalDomainRecord), - } as RecordChangeAdd + administrativeCheckResult: data.administrative_check_result + ? unmarshalCheckContactsCompatibilityResponseContactCheckResult( + data.administrative_check_result, + ) + : undefined, + compatible: data.compatible, + ownerCheckResult: data.owner_check_result + ? unmarshalCheckContactsCompatibilityResponseContactCheckResult( + data.owner_check_result, + ) + : undefined, + technicalCheckResult: data.technical_check_result + ? unmarshalCheckContactsCompatibilityResponseContactCheckResult( + data.technical_check_result, + ) + : undefined, + } as CheckContactsCompatibilityResponse } -const unmarshalRecordChangeClear = (data: unknown) => { +export const unmarshalClearDNSZoneRecordsResponse = ( + data: unknown, +): ClearDNSZoneRecordsResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RecordChangeClear' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ClearDNSZoneRecordsResponse' failed as data isn't a dictionary.`, ) } - return {} as RecordChangeClear + return {} as ClearDNSZoneRecordsResponse } -const unmarshalRecordChangeDelete = (data: unknown) => { +export const unmarshalDeleteDNSZoneResponse = ( + data: unknown, +): DeleteDNSZoneResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RecordChangeDelete' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DeleteDNSZoneResponse' failed as data isn't a dictionary.`, ) } - return { - id: data.id, - idFields: data.id_fields - ? unmarshalRecordIdentifier(data.id_fields) - : undefined, - } as RecordChangeDelete + return {} as DeleteDNSZoneResponse } -const unmarshalRecordChangeSet = (data: unknown) => { +export const unmarshalDeleteExternalDomainResponse = ( + data: unknown, +): DeleteExternalDomainResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RecordChangeSet' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DeleteExternalDomainResponse' failed as data isn't a dictionary.`, ) } - return { - id: data.id, - idFields: data.id_fields - ? unmarshalRecordIdentifier(data.id_fields) - : undefined, - records: unmarshalArrayOfObject(data.records, unmarshalDomainRecord), - } as RecordChangeSet + return {} as DeleteExternalDomainResponse } -const unmarshalTld = (data: unknown) => { +export const unmarshalDeleteSSLCertificateResponse = ( + data: unknown, +): DeleteSSLCertificateResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Tld' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DeleteSSLCertificateResponse' failed as data isn't a dictionary.`, + ) + } + + return {} as DeleteSSLCertificateResponse +} + +const unmarshalDSRecordPublicKey = (data: unknown): DSRecordPublicKey => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'DSRecordPublicKey' failed as data isn't a dictionary.`, ) } return { - dnssecSupport: data.dnssec_support, - durationInYearsMax: data.duration_in_years_max, - durationInYearsMin: data.duration_in_years_min, - idnSupport: data.idn_support, - name: data.name, - offers: unmarshalMapOfObject(data.offers, unmarshalTldOffer), - specifications: data.specifications, - } as Tld + key: data.key, + } as DSRecordPublicKey } -const unmarshalAvailableDomain = (data: unknown) => { +const unmarshalDSRecordDigest = (data: unknown): DSRecordDigest => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'AvailableDomain' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DSRecordDigest' failed as data isn't a dictionary.`, ) } return { - available: data.available, - domain: data.domain, - tld: data.tld ? unmarshalTld(data.tld) : undefined, - } as AvailableDomain + digest: data.digest, + publicKey: data.public_key + ? unmarshalDSRecordPublicKey(data.public_key) + : undefined, + type: data.type, + } as DSRecordDigest } -const unmarshalCheckContactsCompatibilityResponseContactCheckResult = ( - data: unknown, -) => { +export const unmarshalDSRecord = (data: unknown): DSRecord => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CheckContactsCompatibilityResponseContactCheckResult' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DSRecord' failed as data isn't a dictionary.`, ) } return { - compatible: data.compatible, - errorMessage: data.error_message, - } as CheckContactsCompatibilityResponseContactCheckResult + algorithm: data.algorithm, + digest: data.digest ? unmarshalDSRecordDigest(data.digest) : undefined, + keyId: data.key_id, + publicKey: data.public_key + ? unmarshalDSRecordPublicKey(data.public_key) + : undefined, + } as DSRecord } -const unmarshalContactRoles = (data: unknown) => { +const unmarshalTldOffer = (data: unknown): TldOffer => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ContactRoles' failed as data isn't a dictionary.`, + `Unmarshalling the type 'TldOffer' failed as data isn't a dictionary.`, ) } return { - contact: data.contact ? unmarshalContact(data.contact) : undefined, - roles: unmarshalMapOfObject(data.roles, unmarshalContactRolesRoles), - } as ContactRoles + action: data.action, + operationPath: data.operation_path, + price: data.price ? unmarshalMoney(data.price) : undefined, + } as TldOffer } -export const unmarshalDNSZone = (data: unknown) => { +const unmarshalDomainDNSSEC = (data: unknown): DomainDNSSEC => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DNSZone' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainDNSSEC' failed as data isn't a dictionary.`, ) } return { - domain: data.domain, - message: data.message, - ns: data.ns, - nsDefault: data.ns_default, - nsMaster: data.ns_master, - projectId: data.project_id, + dsRecords: unmarshalArrayOfObject(data.ds_records, unmarshalDSRecord), status: data.status, - subdomain: data.subdomain, - updatedAt: unmarshalDate(data.updated_at), - } as DNSZone + } as DomainDNSSEC } -const unmarshalDNSZoneVersion = (data: unknown) => { +const unmarshalDomainRegistrationStatusExternalDomain = ( + data: unknown, +): DomainRegistrationStatusExternalDomain => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DNSZoneVersion' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainRegistrationStatusExternalDomain' failed as data isn't a dictionary.`, ) } return { - createdAt: unmarshalDate(data.created_at), - id: data.id, - } as DNSZoneVersion + validationToken: data.validation_token, + } as DomainRegistrationStatusExternalDomain } -const unmarshalDomainDNSSEC = (data: unknown) => { +const unmarshalDomainRegistrationStatusTransfer = ( + data: unknown, +): DomainRegistrationStatusTransfer => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DomainDNSSEC' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainRegistrationStatusTransfer' failed as data isn't a dictionary.`, ) } return { - dsRecords: unmarshalArrayOfObject(data.ds_records, unmarshalDSRecord), status: data.status, - } as DomainDNSSEC + voteCurrentOwner: data.vote_current_owner, + voteNewOwner: data.vote_new_owner, + } as DomainRegistrationStatusTransfer } -const unmarshalDomainSummary = (data: unknown) => { +const unmarshalTld = (data: unknown): Tld => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DomainSummary' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Tld' failed as data isn't a dictionary.`, + ) + } + + return { + dnssecSupport: data.dnssec_support, + durationInYearsMax: data.duration_in_years_max, + durationInYearsMin: data.duration_in_years_min, + idnSupport: data.idn_support, + name: data.name, + offers: unmarshalMapOfObject(data.offers, unmarshalTldOffer), + specifications: data.specifications, + } as Tld +} + +export const unmarshalDomain = (data: unknown): Domain => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Domain' failed as data isn't a dictionary.`, ) } return { + administrativeContact: data.administrative_contact + ? unmarshalContact(data.administrative_contact) + : undefined, autoRenewStatus: data.auto_renew_status, - dnssecStatus: data.dnssec_status, + dnsZones: unmarshalArrayOfObject(data.dns_zones, unmarshalDNSZone), + dnssec: data.dnssec ? unmarshalDomainDNSSEC(data.dnssec) : undefined, domain: data.domain, eppCode: data.epp_code, expiredAt: unmarshalDate(data.expired_at), @@ -701,242 +583,273 @@ const unmarshalDomainSummary = (data: unknown) => { : undefined, isExternal: data.is_external, organizationId: data.organization_id, + ownerContact: data.owner_contact + ? unmarshalContact(data.owner_contact) + : undefined, projectId: data.project_id, registrar: data.registrar, status: data.status, + technicalContact: data.technical_contact + ? unmarshalContact(data.technical_contact) + : undefined, + tld: data.tld ? unmarshalTld(data.tld) : undefined, transferRegistrationStatus: data.transfer_registration_status ? unmarshalDomainRegistrationStatusTransfer( data.transfer_registration_status, ) : undefined, updatedAt: unmarshalDate(data.updated_at), - } as DomainSummary + } as Domain } -export const unmarshalHost = (data: unknown) => { +export const unmarshalGetDNSZoneTsigKeyResponse = ( + data: unknown, +): GetDNSZoneTsigKeyResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Host' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetDNSZoneTsigKeyResponse' failed as data isn't a dictionary.`, ) } return { - domain: data.domain, - ips: data.ips, + algorithm: data.algorithm, + key: data.key, name: data.name, - status: data.status, - } as Host + } as GetDNSZoneTsigKeyResponse } -const unmarshalNameserver = (data: unknown) => { +const unmarshalDomainRecordGeoIPConfigMatch = ( + data: unknown, +): DomainRecordGeoIPConfigMatch => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Nameserver' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainRecordGeoIPConfigMatch' failed as data isn't a dictionary.`, ) } - return { ip: data.ip, name: data.name } as Nameserver + return { + continents: data.continents, + countries: data.countries, + data: data.data, + } as DomainRecordGeoIPConfigMatch } -const unmarshalRecordChange = (data: unknown) => { +const unmarshalDomainRecordViewConfigView = ( + data: unknown, +): DomainRecordViewConfigView => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RecordChange' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainRecordViewConfigView' failed as data isn't a dictionary.`, ) } return { - add: data.add ? unmarshalRecordChangeAdd(data.add) : undefined, - clear: data.clear ? unmarshalRecordChangeClear(data.clear) : undefined, - delete: data.delete ? unmarshalRecordChangeDelete(data.delete) : undefined, - set: data.set ? unmarshalRecordChangeSet(data.set) : undefined, - } as RecordChange + data: data.data, + subnet: data.subnet, + } as DomainRecordViewConfigView } -const unmarshalRenewableDomain = (data: unknown) => { +const unmarshalDomainRecordWeightedConfigWeightedIP = ( + data: unknown, +): DomainRecordWeightedConfigWeightedIP => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RenewableDomain' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainRecordWeightedConfigWeightedIP' failed as data isn't a dictionary.`, ) } return { - domain: data.domain, - estimatedDeleteAt: unmarshalDate(data.estimated_delete_at), - expiredAt: unmarshalDate(data.expired_at), - limitRedemptionAt: unmarshalDate(data.limit_redemption_at), - limitRenewAt: unmarshalDate(data.limit_renew_at), - organizationId: data.organization_id, - projectId: data.project_id, - renewableDurationInYears: data.renewable_duration_in_years, - status: data.status, - tld: data.tld ? unmarshalTld(data.tld) : undefined, - } as RenewableDomain + ip: data.ip, + weight: data.weight, + } as DomainRecordWeightedConfigWeightedIP } -export const unmarshalSSLCertificate = (data: unknown) => { +const unmarshalDomainRecordGeoIPConfig = ( + data: unknown, +): DomainRecordGeoIPConfig => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'SSLCertificate' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainRecordGeoIPConfig' failed as data isn't a dictionary.`, ) } return { - alternativeDnsZones: data.alternative_dns_zones, - certificateChain: data.certificate_chain, - createdAt: unmarshalDate(data.created_at), - dnsZone: data.dns_zone, - expiredAt: unmarshalDate(data.expired_at), - privateKey: data.private_key, - status: data.status, - } as SSLCertificate + default: data.default, + matches: unmarshalArrayOfObject( + data.matches, + unmarshalDomainRecordGeoIPConfigMatch, + ), + } as DomainRecordGeoIPConfig } -const unmarshalTask = (data: unknown) => { +const unmarshalDomainRecordHTTPServiceConfig = ( + data: unknown, +): DomainRecordHTTPServiceConfig => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Task' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainRecordHTTPServiceConfig' failed as data isn't a dictionary.`, ) } return { - domain: data.domain, - id: data.id, - message: data.message, - organizationId: data.organization_id, - projectId: data.project_id, - startedAt: unmarshalDate(data.started_at), - status: data.status, - type: data.type, - updatedAt: unmarshalDate(data.updated_at), - } as Task + ips: data.ips, + mustContain: data.must_contain, + strategy: data.strategy, + url: data.url, + userAgent: data.user_agent, + } as DomainRecordHTTPServiceConfig } -export const unmarshalCheckContactsCompatibilityResponse = (data: unknown) => { +const unmarshalDomainRecordViewConfig = ( + data: unknown, +): DomainRecordViewConfig => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CheckContactsCompatibilityResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainRecordViewConfig' failed as data isn't a dictionary.`, ) } return { - administrativeCheckResult: data.administrative_check_result - ? unmarshalCheckContactsCompatibilityResponseContactCheckResult( - data.administrative_check_result, - ) - : undefined, - compatible: data.compatible, - ownerCheckResult: data.owner_check_result - ? unmarshalCheckContactsCompatibilityResponseContactCheckResult( - data.owner_check_result, - ) - : undefined, - technicalCheckResult: data.technical_check_result - ? unmarshalCheckContactsCompatibilityResponseContactCheckResult( - data.technical_check_result, - ) - : undefined, - } as CheckContactsCompatibilityResponse + views: unmarshalArrayOfObject( + data.views, + unmarshalDomainRecordViewConfigView, + ), + } as DomainRecordViewConfig } -export const unmarshalClearDNSZoneRecordsResponse = (data: unknown) => { +const unmarshalDomainRecordWeightedConfig = ( + data: unknown, +): DomainRecordWeightedConfig => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ClearDNSZoneRecordsResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainRecordWeightedConfig' failed as data isn't a dictionary.`, ) } - return {} as ClearDNSZoneRecordsResponse -} - -export const unmarshalDeleteDNSZoneResponse = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DeleteDNSZoneResponse' failed as data isn't a dictionary.`, + return { + weightedIps: unmarshalArrayOfObject( + data.weighted_ips, + unmarshalDomainRecordWeightedConfigWeightedIP, + ), + } as DomainRecordWeightedConfig +} + +const unmarshalDomainRecord = (data: unknown): DomainRecord => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'DomainRecord' failed as data isn't a dictionary.`, ) } - return {} as DeleteDNSZoneResponse + return { + comment: data.comment, + data: data.data, + geoIpConfig: data.geo_ip_config + ? unmarshalDomainRecordGeoIPConfig(data.geo_ip_config) + : undefined, + httpServiceConfig: data.http_service_config + ? unmarshalDomainRecordHTTPServiceConfig(data.http_service_config) + : undefined, + id: data.id, + name: data.name, + priority: data.priority, + ttl: data.ttl, + type: data.type, + viewConfig: data.view_config + ? unmarshalDomainRecordViewConfig(data.view_config) + : undefined, + weightedConfig: data.weighted_config + ? unmarshalDomainRecordWeightedConfig(data.weighted_config) + : undefined, + } as DomainRecord } -export const unmarshalDeleteExternalDomainResponse = (data: unknown) => { +const unmarshalRecordIdentifier = (data: unknown): RecordIdentifier => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DeleteExternalDomainResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'RecordIdentifier' failed as data isn't a dictionary.`, ) } - return {} as DeleteExternalDomainResponse + return { + data: data.data, + name: data.name, + ttl: data.ttl, + type: data.type, + } as RecordIdentifier } -export const unmarshalDeleteSSLCertificateResponse = (data: unknown) => { +const unmarshalRecordChangeAdd = (data: unknown): RecordChangeAdd => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DeleteSSLCertificateResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'RecordChangeAdd' failed as data isn't a dictionary.`, ) } - return {} as DeleteSSLCertificateResponse + return { + records: unmarshalArrayOfObject(data.records, unmarshalDomainRecord), + } as RecordChangeAdd } -export const unmarshalDomain = (data: unknown) => { +const unmarshalRecordChangeClear = (data: unknown): RecordChangeClear => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Domain' failed as data isn't a dictionary.`, + `Unmarshalling the type 'RecordChangeClear' failed as data isn't a dictionary.`, + ) + } + + return {} as RecordChangeClear +} + +const unmarshalRecordChangeDelete = (data: unknown): RecordChangeDelete => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RecordChangeDelete' failed as data isn't a dictionary.`, ) } return { - administrativeContact: data.administrative_contact - ? unmarshalContact(data.administrative_contact) - : undefined, - autoRenewStatus: data.auto_renew_status, - dnssec: data.dnssec ? unmarshalDomainDNSSEC(data.dnssec) : undefined, - dnsZones: unmarshalArrayOfObject(data.dns_zones, unmarshalDNSZone), - domain: data.domain, - eppCode: data.epp_code, - expiredAt: unmarshalDate(data.expired_at), - externalDomainRegistrationStatus: data.external_domain_registration_status - ? unmarshalDomainRegistrationStatusExternalDomain( - data.external_domain_registration_status, - ) - : undefined, - isExternal: data.is_external, - organizationId: data.organization_id, - ownerContact: data.owner_contact - ? unmarshalContact(data.owner_contact) - : undefined, - projectId: data.project_id, - registrar: data.registrar, - status: data.status, - technicalContact: data.technical_contact - ? unmarshalContact(data.technical_contact) + id: data.id, + idFields: data.id_fields + ? unmarshalRecordIdentifier(data.id_fields) : undefined, - tld: data.tld ? unmarshalTld(data.tld) : undefined, - transferRegistrationStatus: data.transfer_registration_status - ? unmarshalDomainRegistrationStatusTransfer( - data.transfer_registration_status, - ) + } as RecordChangeDelete +} + +const unmarshalRecordChangeSet = (data: unknown): RecordChangeSet => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RecordChangeSet' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + idFields: data.id_fields + ? unmarshalRecordIdentifier(data.id_fields) : undefined, - updatedAt: unmarshalDate(data.updated_at), - } as Domain + records: unmarshalArrayOfObject(data.records, unmarshalDomainRecord), + } as RecordChangeSet } -export const unmarshalGetDNSZoneTsigKeyResponse = (data: unknown) => { +const unmarshalRecordChange = (data: unknown): RecordChange => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'GetDNSZoneTsigKeyResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'RecordChange' failed as data isn't a dictionary.`, ) } return { - algorithm: data.algorithm, - key: data.key, - name: data.name, - } as GetDNSZoneTsigKeyResponse + add: data.add ? unmarshalRecordChangeAdd(data.add) : undefined, + clear: data.clear ? unmarshalRecordChangeClear(data.clear) : undefined, + delete: data.delete ? unmarshalRecordChangeDelete(data.delete) : undefined, + set: data.set ? unmarshalRecordChangeSet(data.set) : undefined, + } as RecordChange } -export const unmarshalGetDNSZoneVersionDiffResponse = (data: unknown) => { +export const unmarshalGetDNSZoneVersionDiffResponse = ( + data: unknown, +): GetDNSZoneVersionDiffResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetDNSZoneVersionDiffResponse' failed as data isn't a dictionary.`, @@ -948,17 +861,23 @@ export const unmarshalGetDNSZoneVersionDiffResponse = (data: unknown) => { } as GetDNSZoneVersionDiffResponse } -export const unmarshalGetDomainAuthCodeResponse = (data: unknown) => { +export const unmarshalGetDomainAuthCodeResponse = ( + data: unknown, +): GetDomainAuthCodeResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetDomainAuthCodeResponse' failed as data isn't a dictionary.`, ) } - return { authCode: data.auth_code } as GetDomainAuthCodeResponse + return { + authCode: data.auth_code, + } as GetDomainAuthCodeResponse } -export const unmarshalImportProviderDNSZoneResponse = (data: unknown) => { +export const unmarshalImportProviderDNSZoneResponse = ( + data: unknown, +): ImportProviderDNSZoneResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ImportProviderDNSZoneResponse' failed as data isn't a dictionary.`, @@ -970,7 +889,9 @@ export const unmarshalImportProviderDNSZoneResponse = (data: unknown) => { } as ImportProviderDNSZoneResponse } -export const unmarshalImportRawDNSZoneResponse = (data: unknown) => { +export const unmarshalImportRawDNSZoneResponse = ( + data: unknown, +): ImportRawDNSZoneResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ImportRawDNSZoneResponse' failed as data isn't a dictionary.`, @@ -982,7 +903,36 @@ export const unmarshalImportRawDNSZoneResponse = (data: unknown) => { } as ImportRawDNSZoneResponse } -export const unmarshalListContactsResponse = (data: unknown) => { +const unmarshalContactRolesRoles = (data: unknown): ContactRolesRoles => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ContactRolesRoles' failed as data isn't a dictionary.`, + ) + } + + return { + isAdministrative: data.is_administrative, + isOwner: data.is_owner, + isTechnical: data.is_technical, + } as ContactRolesRoles +} + +const unmarshalContactRoles = (data: unknown): ContactRoles => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ContactRoles' failed as data isn't a dictionary.`, + ) + } + + return { + contact: data.contact ? unmarshalContact(data.contact) : undefined, + roles: unmarshalMapOfObject(data.roles, unmarshalContactRolesRoles), + } as ContactRoles +} + +export const unmarshalListContactsResponse = ( + data: unknown, +): ListContactsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListContactsResponse' failed as data isn't a dictionary.`, @@ -995,7 +945,22 @@ export const unmarshalListContactsResponse = (data: unknown) => { } as ListContactsResponse } -export const unmarshalListDNSZoneNameserversResponse = (data: unknown) => { +const unmarshalNameserver = (data: unknown): Nameserver => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Nameserver' failed as data isn't a dictionary.`, + ) + } + + return { + ip: data.ip, + name: data.name, + } as Nameserver +} + +export const unmarshalListDNSZoneNameserversResponse = ( + data: unknown, +): ListDNSZoneNameserversResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDNSZoneNameserversResponse' failed as data isn't a dictionary.`, @@ -1007,7 +972,9 @@ export const unmarshalListDNSZoneNameserversResponse = (data: unknown) => { } as ListDNSZoneNameserversResponse } -export const unmarshalListDNSZoneRecordsResponse = (data: unknown) => { +export const unmarshalListDNSZoneRecordsResponse = ( + data: unknown, +): ListDNSZoneRecordsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDNSZoneRecordsResponse' failed as data isn't a dictionary.`, @@ -1020,7 +987,9 @@ export const unmarshalListDNSZoneRecordsResponse = (data: unknown) => { } as ListDNSZoneRecordsResponse } -export const unmarshalListDNSZoneVersionRecordsResponse = (data: unknown) => { +export const unmarshalListDNSZoneVersionRecordsResponse = ( + data: unknown, +): ListDNSZoneVersionRecordsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDNSZoneVersionRecordsResponse' failed as data isn't a dictionary.`, @@ -1033,7 +1002,22 @@ export const unmarshalListDNSZoneVersionRecordsResponse = (data: unknown) => { } as ListDNSZoneVersionRecordsResponse } -export const unmarshalListDNSZoneVersionsResponse = (data: unknown) => { +const unmarshalDNSZoneVersion = (data: unknown): DNSZoneVersion => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'DNSZoneVersion' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + id: data.id, + } as DNSZoneVersion +} + +export const unmarshalListDNSZoneVersionsResponse = ( + data: unknown, +): ListDNSZoneVersionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDNSZoneVersionsResponse' failed as data isn't a dictionary.`, @@ -1046,7 +1030,9 @@ export const unmarshalListDNSZoneVersionsResponse = (data: unknown) => { } as ListDNSZoneVersionsResponse } -export const unmarshalListDNSZonesResponse = (data: unknown) => { +export const unmarshalListDNSZonesResponse = ( + data: unknown, +): ListDNSZonesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDNSZonesResponse' failed as data isn't a dictionary.`, @@ -1059,7 +1045,9 @@ export const unmarshalListDNSZonesResponse = (data: unknown) => { } as ListDNSZonesResponse } -export const unmarshalListDomainHostsResponse = (data: unknown) => { +export const unmarshalListDomainHostsResponse = ( + data: unknown, +): ListDomainHostsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDomainHostsResponse' failed as data isn't a dictionary.`, @@ -1072,7 +1060,41 @@ export const unmarshalListDomainHostsResponse = (data: unknown) => { } as ListDomainHostsResponse } -export const unmarshalListDomainsResponse = (data: unknown) => { +const unmarshalDomainSummary = (data: unknown): DomainSummary => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'DomainSummary' failed as data isn't a dictionary.`, + ) + } + + return { + autoRenewStatus: data.auto_renew_status, + dnssecStatus: data.dnssec_status, + domain: data.domain, + eppCode: data.epp_code, + expiredAt: unmarshalDate(data.expired_at), + externalDomainRegistrationStatus: data.external_domain_registration_status + ? unmarshalDomainRegistrationStatusExternalDomain( + data.external_domain_registration_status, + ) + : undefined, + isExternal: data.is_external, + organizationId: data.organization_id, + projectId: data.project_id, + registrar: data.registrar, + status: data.status, + transferRegistrationStatus: data.transfer_registration_status + ? unmarshalDomainRegistrationStatusTransfer( + data.transfer_registration_status, + ) + : undefined, + updatedAt: unmarshalDate(data.updated_at), + } as DomainSummary +} + +export const unmarshalListDomainsResponse = ( + data: unknown, +): ListDomainsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDomainsResponse' failed as data isn't a dictionary.`, @@ -1085,7 +1107,30 @@ export const unmarshalListDomainsResponse = (data: unknown) => { } as ListDomainsResponse } -export const unmarshalListRenewableDomainsResponse = (data: unknown) => { +const unmarshalRenewableDomain = (data: unknown): RenewableDomain => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RenewableDomain' failed as data isn't a dictionary.`, + ) + } + + return { + domain: data.domain, + estimatedDeleteAt: unmarshalDate(data.estimated_delete_at), + expiredAt: unmarshalDate(data.expired_at), + limitRedemptionAt: unmarshalDate(data.limit_redemption_at), + limitRenewAt: unmarshalDate(data.limit_renew_at), + organizationId: data.organization_id, + projectId: data.project_id, + renewableDurationInYears: data.renewable_duration_in_years, + status: data.status, + tld: data.tld ? unmarshalTld(data.tld) : undefined, + } as RenewableDomain +} + +export const unmarshalListRenewableDomainsResponse = ( + data: unknown, +): ListRenewableDomainsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListRenewableDomainsResponse' failed as data isn't a dictionary.`, @@ -1098,7 +1143,9 @@ export const unmarshalListRenewableDomainsResponse = (data: unknown) => { } as ListRenewableDomainsResponse } -export const unmarshalListSSLCertificatesResponse = (data: unknown) => { +export const unmarshalListSSLCertificatesResponse = ( + data: unknown, +): ListSSLCertificatesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSSLCertificatesResponse' failed as data isn't a dictionary.`, @@ -1114,7 +1161,29 @@ export const unmarshalListSSLCertificatesResponse = (data: unknown) => { } as ListSSLCertificatesResponse } -export const unmarshalListTasksResponse = (data: unknown) => { +export const unmarshalTask = (data: unknown): Task => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Task' failed as data isn't a dictionary.`, + ) + } + + return { + domain: data.domain, + id: data.id, + message: data.message, + organizationId: data.organization_id, + projectId: data.project_id, + startedAt: unmarshalDate(data.started_at), + status: data.status, + type: data.type, + updatedAt: unmarshalDate(data.updated_at), + } as Task +} + +export const unmarshalListTasksResponse = ( + data: unknown, +): ListTasksResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListTasksResponse' failed as data isn't a dictionary.`, @@ -1127,7 +1196,7 @@ export const unmarshalListTasksResponse = (data: unknown) => { } as ListTasksResponse } -export const unmarshalListTldsResponse = (data: unknown) => { +export const unmarshalListTldsResponse = (data: unknown): ListTldsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListTldsResponse' failed as data isn't a dictionary.`, @@ -1140,7 +1209,7 @@ export const unmarshalListTldsResponse = (data: unknown) => { } as ListTldsResponse } -export const unmarshalOrderResponse = (data: unknown) => { +export const unmarshalOrderResponse = (data: unknown): OrderResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'OrderResponse' failed as data isn't a dictionary.`, @@ -1156,7 +1225,9 @@ export const unmarshalOrderResponse = (data: unknown) => { } as OrderResponse } -export const unmarshalRefreshDNSZoneResponse = (data: unknown) => { +export const unmarshalRefreshDNSZoneResponse = ( + data: unknown, +): RefreshDNSZoneResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'RefreshDNSZoneResponse' failed as data isn't a dictionary.`, @@ -1168,7 +1239,9 @@ export const unmarshalRefreshDNSZoneResponse = (data: unknown) => { } as RefreshDNSZoneResponse } -export const unmarshalRegisterExternalDomainResponse = (data: unknown) => { +export const unmarshalRegisterExternalDomainResponse = ( + data: unknown, +): RegisterExternalDomainResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'RegisterExternalDomainResponse' failed as data isn't a dictionary.`, @@ -1184,7 +1257,9 @@ export const unmarshalRegisterExternalDomainResponse = (data: unknown) => { } as RegisterExternalDomainResponse } -export const unmarshalRestoreDNSZoneVersionResponse = (data: unknown) => { +export const unmarshalRestoreDNSZoneVersionResponse = ( + data: unknown, +): RestoreDNSZoneVersionResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'RestoreDNSZoneVersionResponse' failed as data isn't a dictionary.`, @@ -1194,7 +1269,23 @@ export const unmarshalRestoreDNSZoneVersionResponse = (data: unknown) => { return {} as RestoreDNSZoneVersionResponse } -export const unmarshalSearchAvailableDomainsResponse = (data: unknown) => { +const unmarshalAvailableDomain = (data: unknown): AvailableDomain => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'AvailableDomain' failed as data isn't a dictionary.`, + ) + } + + return { + available: data.available, + domain: data.domain, + tld: data.tld ? unmarshalTld(data.tld) : undefined, + } as AvailableDomain +} + +export const unmarshalSearchAvailableDomainsResponse = ( + data: unknown, +): SearchAvailableDomainsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SearchAvailableDomainsResponse' failed as data isn't a dictionary.`, @@ -1209,7 +1300,9 @@ export const unmarshalSearchAvailableDomainsResponse = (data: unknown) => { } as SearchAvailableDomainsResponse } -export const unmarshalUpdateDNSZoneNameserversResponse = (data: unknown) => { +export const unmarshalUpdateDNSZoneNameserversResponse = ( + data: unknown, +): UpdateDNSZoneNameserversResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'UpdateDNSZoneNameserversResponse' failed as data isn't a dictionary.`, @@ -1221,7 +1314,9 @@ export const unmarshalUpdateDNSZoneNameserversResponse = (data: unknown) => { } as UpdateDNSZoneNameserversResponse } -export const unmarshalUpdateDNSZoneRecordsResponse = (data: unknown) => { +export const unmarshalUpdateDNSZoneRecordsResponse = ( + data: unknown, +): UpdateDNSZoneRecordsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'UpdateDNSZoneRecordsResponse' failed as data isn't a dictionary.`, @@ -1233,68 +1328,121 @@ export const unmarshalUpdateDNSZoneRecordsResponse = (data: unknown) => { } as UpdateDNSZoneRecordsResponse } -const marshalDomainRecordGeoIPConfigMatch = ( - request: DomainRecordGeoIPConfigMatch, +export const marshalCloneDNSZoneRequest = ( + request: CloneDNSZoneRequest, defaults: DefaultValues, ): Record => ({ - continents: request.continents, - countries: request.countries, - data: request.data, + dest_dns_zone: request.destDnsZone, + overwrite: request.overwrite, + project_id: request.projectId ?? defaults.defaultProjectId, }) -const marshalDomainRecordViewConfigView = ( - request: DomainRecordViewConfigView, +export const marshalCreateDNSZoneRequest = ( + request: CreateDNSZoneRequest, defaults: DefaultValues, ): Record => ({ - data: request.data, - subnet: request.subnet, + domain: request.domain, + project_id: request.projectId ?? defaults.defaultProjectId, + subdomain: request.subdomain, }) -const marshalDomainRecordWeightedConfigWeightedIP = ( - request: DomainRecordWeightedConfigWeightedIP, +export const marshalCreateSSLCertificateRequest = ( + request: CreateSSLCertificateRequest, defaults: DefaultValues, ): Record => ({ - ip: request.ip, - weight: request.weight, + alternative_dns_zones: request.alternativeDnsZones, + dns_zone: request.dnsZone, }) -const marshalDomainRecordGeoIPConfig = ( - request: DomainRecordGeoIPConfig, +const marshalImportProviderDNSZoneRequestOnlineV1 = ( + request: ImportProviderDNSZoneRequestOnlineV1, defaults: DefaultValues, ): Record => ({ - default: request.default, - matches: request.matches.map(elt => - marshalDomainRecordGeoIPConfigMatch(elt, defaults), - ), + token: request.token, }) -const marshalDomainRecordHTTPServiceConfig = ( - request: DomainRecordHTTPServiceConfig, +export const marshalImportProviderDNSZoneRequest = ( + request: ImportProviderDNSZoneRequest, defaults: DefaultValues, ): Record => ({ - ips: request.ips, - must_contain: request.mustContain, - strategy: request.strategy, - url: request.url, - user_agent: request.userAgent, + ...resolveOneOf([ + { + param: 'online_v1', + value: + request.onlineV1 !== undefined + ? marshalImportProviderDNSZoneRequestOnlineV1( + request.onlineV1, + defaults, + ) + : undefined, + }, + ]), }) -const marshalDomainRecordViewConfig = ( - request: DomainRecordViewConfig, +const marshalImportRawDNSZoneRequestTsigKey = ( + request: ImportRawDNSZoneRequestTsigKey, defaults: DefaultValues, ): Record => ({ - views: request.views.map(elt => - marshalDomainRecordViewConfigView(elt, defaults), - ), + algorithm: request.algorithm, + key: request.key, + name: request.name, }) -const marshalDomainRecordWeightedConfig = ( - request: DomainRecordWeightedConfig, +const marshalImportRawDNSZoneRequestAXFRSource = ( + request: ImportRawDNSZoneRequestAXFRSource, defaults: DefaultValues, ): Record => ({ - weighted_ips: request.weightedIps.map(elt => - marshalDomainRecordWeightedConfigWeightedIP(elt, defaults), - ), + name_server: request.nameServer, + tsig_key: + request.tsigKey !== undefined + ? marshalImportRawDNSZoneRequestTsigKey(request.tsigKey, defaults) + : undefined, +}) + +const marshalImportRawDNSZoneRequestBindSource = ( + request: ImportRawDNSZoneRequestBindSource, + defaults: DefaultValues, +): Record => ({ + content: request.content, +}) + +export const marshalImportRawDNSZoneRequest = ( + request: ImportRawDNSZoneRequest, + defaults: DefaultValues, +): Record => ({ + content: request.content, + format: request.format, + project_id: request.projectId ?? defaults.defaultProjectId, + ...resolveOneOf([ + { + param: 'bind_source', + value: + request.bindSource !== undefined + ? marshalImportRawDNSZoneRequestBindSource( + request.bindSource, + defaults, + ) + : undefined, + }, + { + param: 'axfr_source', + value: + request.axfrSource !== undefined + ? marshalImportRawDNSZoneRequestAXFRSource( + request.axfrSource, + defaults, + ) + : undefined, + }, + ]), +}) + +export const marshalRefreshDNSZoneRequest = ( + request: RefreshDNSZoneRequest, + defaults: DefaultValues, +): Record => ({ + recreate_dns_zone: request.recreateDnsZone, + recreate_sub_dns_zone: request.recreateSubDnsZone, }) const marshalContactExtensionFRAssociationInfo = ( @@ -1334,65 +1482,6 @@ const marshalContactExtensionFRTrademarkInfo = ( trademark_inpi: request.trademarkInpi, }) -const marshalDSRecordPublicKey = ( - request: DSRecordPublicKey, - defaults: DefaultValues, -): Record => ({ - key: request.key, -}) - -const marshalDomainRecord = ( - request: DomainRecord, - defaults: DefaultValues, -): Record => ({ - comment: request.comment, - data: request.data, - id: request.id, - name: request.name, - priority: request.priority, - ttl: request.ttl, - type: request.type, - ...resolveOneOf([ - { - param: 'geo_ip_config', - value: request.geoIpConfig - ? marshalDomainRecordGeoIPConfig(request.geoIpConfig, defaults) - : undefined, - }, - { - param: 'http_service_config', - value: request.httpServiceConfig - ? marshalDomainRecordHTTPServiceConfig( - request.httpServiceConfig, - defaults, - ) - : undefined, - }, - { - param: 'weighted_config', - value: request.weightedConfig - ? marshalDomainRecordWeightedConfig(request.weightedConfig, defaults) - : undefined, - }, - { - param: 'view_config', - value: request.viewConfig - ? marshalDomainRecordViewConfig(request.viewConfig, defaults) - : undefined, - }, - ]), -}) - -const marshalRecordIdentifier = ( - request: RecordIdentifier, - defaults: DefaultValues, -): Record => ({ - data: request.data, - name: request.name, - ttl: request.ttl, - type: request.type, -}) - const marshalContactExtensionEU = ( request: ContactExtensionEU, defaults: DefaultValues, @@ -1405,48 +1494,53 @@ const marshalContactExtensionFR = ( defaults: DefaultValues, ): Record => ({ mode: request.mode, - ...resolveOneOf([ + ...resolveOneOf([ { param: 'individual_info', - value: request.individualInfo - ? marshalContactExtensionFRIndividualInfo( - request.individualInfo, - defaults, - ) - : undefined, + value: + request.individualInfo !== undefined + ? marshalContactExtensionFRIndividualInfo( + request.individualInfo, + defaults, + ) + : undefined, }, { param: 'duns_info', - value: request.dunsInfo - ? marshalContactExtensionFRDunsInfo(request.dunsInfo, defaults) - : undefined, + value: + request.dunsInfo !== undefined + ? marshalContactExtensionFRDunsInfo(request.dunsInfo, defaults) + : undefined, }, { param: 'association_info', - value: request.associationInfo - ? marshalContactExtensionFRAssociationInfo( - request.associationInfo, - defaults, - ) - : undefined, + value: + request.associationInfo !== undefined + ? marshalContactExtensionFRAssociationInfo( + request.associationInfo, + defaults, + ) + : undefined, }, { param: 'trademark_info', - value: request.trademarkInfo - ? marshalContactExtensionFRTrademarkInfo( - request.trademarkInfo, - defaults, - ) - : undefined, + value: + request.trademarkInfo !== undefined + ? marshalContactExtensionFRTrademarkInfo( + request.trademarkInfo, + defaults, + ) + : undefined, }, { param: 'code_auth_afnic_info', - value: request.codeAuthAfnicInfo - ? marshalContactExtensionFRCodeAuthAfnicInfo( - request.codeAuthAfnicInfo, - defaults, - ) - : undefined, + value: + request.codeAuthAfnicInfo !== undefined + ? marshalContactExtensionFRCodeAuthAfnicInfo( + request.codeAuthAfnicInfo, + defaults, + ) + : undefined, }, ]), }) @@ -1467,567 +1561,585 @@ const marshalContactQuestion = ( question: request.question, }) -const marshalDSRecordDigest = ( - request: DSRecordDigest, - defaults: DefaultValues, -): Record => ({ - digest: request.digest, - public_key: request.publicKey - ? marshalDSRecordPublicKey(request.publicKey, defaults) - : undefined, - type: request.type, -}) - -const marshalImportRawDNSZoneRequestTsigKey = ( - request: ImportRawDNSZoneRequestTsigKey, - defaults: DefaultValues, -): Record => ({ - algorithm: request.algorithm, - key: request.key, - name: request.name, -}) - -const marshalRecordChangeAdd = ( - request: RecordChangeAdd, +const marshalNewContact = ( + request: NewContact, defaults: DefaultValues, ): Record => ({ - records: request.records.map(elt => marshalDomainRecord(elt, defaults)), + address_line_1: request.addressLine1, + address_line_2: request.addressLine2, + city: request.city, + company_identification_code: request.companyIdentificationCode, + company_name: request.companyName, + country: request.country, + email: request.email, + email_alt: request.emailAlt, + extension_eu: + request.extensionEu !== undefined + ? marshalContactExtensionEU(request.extensionEu, defaults) + : undefined, + extension_fr: + request.extensionFr !== undefined + ? marshalContactExtensionFR(request.extensionFr, defaults) + : undefined, + extension_nl: + request.extensionNl !== undefined + ? marshalContactExtensionNL(request.extensionNl, defaults) + : undefined, + fax_number: request.faxNumber, + firstname: request.firstname, + lang: request.lang, + lastname: request.lastname, + legal_form: request.legalForm, + phone_number: request.phoneNumber, + questions: + request.questions !== undefined + ? request.questions.map(elt => marshalContactQuestion(elt, defaults)) + : undefined, + resale: request.resale, + state: request.state, + vat_identification_code: request.vatIdentificationCode, + whois_opt_in: request.whoisOptIn, + zip: request.zip, }) -const marshalRecordChangeClear = ( - request: RecordChangeClear, - defaults: DefaultValues, -): Record => ({}) - -const marshalRecordChangeDelete = ( - request: RecordChangeDelete, +export const marshalRegistrarApiBuyDomainsRequest = ( + request: RegistrarApiBuyDomainsRequest, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ + domains: request.domains, + duration_in_years: request.durationInYears, + project_id: request.projectId ?? defaults.defaultProjectId, + ...resolveOneOf>([ + { param: 'owner_contact_id', value: request.ownerContactId }, { - param: 'id', - value: request.id, + param: 'owner_contact', + value: + request.ownerContact !== undefined + ? marshalNewContact(request.ownerContact, defaults) + : undefined, }, + ]), + ...resolveOneOf>([ { - param: 'id_fields', - value: request.idFields - ? marshalRecordIdentifier(request.idFields, defaults) - : undefined, + param: 'administrative_contact_id', + value: request.administrativeContactId, }, - ]), -}) - -const marshalRecordChangeSet = ( - request: RecordChangeSet, - defaults: DefaultValues, -): Record => ({ - records: request.records.map(elt => marshalDomainRecord(elt, defaults)), - ...resolveOneOf([ { - param: 'id', - value: request.id, + param: 'administrative_contact', + value: + request.administrativeContact !== undefined + ? marshalNewContact(request.administrativeContact, defaults) + : undefined, }, + ]), + ...resolveOneOf>([ + { param: 'technical_contact_id', value: request.technicalContactId }, { - param: 'id_fields', - value: request.idFields - ? marshalRecordIdentifier(request.idFields, defaults) - : undefined, + param: 'technical_contact', + value: + request.technicalContact !== undefined + ? marshalNewContact(request.technicalContact, defaults) + : undefined, }, ]), }) -const marshalDSRecord = ( - request: DSRecord, +export const marshalRegistrarApiCheckContactsCompatibilityRequest = ( + request: RegistrarApiCheckContactsCompatibilityRequest, defaults: DefaultValues, ): Record => ({ - algorithm: request.algorithm, - key_id: request.keyId, - ...resolveOneOf([ + domains: request.domains, + tlds: request.tlds, + ...resolveOneOf>([ + { param: 'owner_contact_id', value: request.ownerContactId }, { - param: 'digest', - value: request.digest - ? marshalDSRecordDigest(request.digest, defaults) - : undefined, + param: 'owner_contact', + value: + request.ownerContact !== undefined + ? marshalNewContact(request.ownerContact, defaults) + : undefined, }, + ]), + ...resolveOneOf>([ { - param: 'public_key', - value: request.publicKey - ? marshalDSRecordPublicKey(request.publicKey, defaults) - : undefined, + param: 'administrative_contact_id', + value: request.administrativeContactId, + }, + { + param: 'administrative_contact', + value: + request.administrativeContact !== undefined + ? marshalNewContact(request.administrativeContact, defaults) + : undefined, + }, + ]), + ...resolveOneOf>([ + { param: 'technical_contact_id', value: request.technicalContactId }, + { + param: 'technical_contact', + value: + request.technicalContact !== undefined + ? marshalNewContact(request.technicalContact, defaults) + : undefined, }, ]), }) -const marshalImportProviderDNSZoneRequestOnlineV1 = ( - request: ImportProviderDNSZoneRequestOnlineV1, - defaults: DefaultValues, -): Record => ({ - token: request.token, -}) - -const marshalImportRawDNSZoneRequestAXFRSource = ( - request: ImportRawDNSZoneRequestAXFRSource, - defaults: DefaultValues, -): Record => ({ - name_server: request.nameServer, - tsig_key: request.tsigKey - ? marshalImportRawDNSZoneRequestTsigKey(request.tsigKey, defaults) - : undefined, -}) - -const marshalImportRawDNSZoneRequestBindSource = ( - request: ImportRawDNSZoneRequestBindSource, +export const marshalRegistrarApiCreateDomainHostRequest = ( + request: RegistrarApiCreateDomainHostRequest, defaults: DefaultValues, ): Record => ({ - content: request.content, + ips: request.ips, + name: request.name, }) -const marshalNameserver = ( - request: Nameserver, +const marshalDSRecordPublicKey = ( + request: DSRecordPublicKey, defaults: DefaultValues, ): Record => ({ - ip: request.ip, - name: request.name, + key: request.key, }) -const marshalNewContact = ( - request: NewContact, +const marshalDSRecordDigest = ( + request: DSRecordDigest, defaults: DefaultValues, ): Record => ({ - address_line_1: request.addressLine1, - address_line_2: request.addressLine2, - city: request.city, - company_identification_code: request.companyIdentificationCode, - company_name: request.companyName, - country: request.country, - email: request.email, - email_alt: request.emailAlt, - extension_eu: request.extensionEu - ? marshalContactExtensionEU(request.extensionEu, defaults) - : undefined, - extension_fr: request.extensionFr - ? marshalContactExtensionFR(request.extensionFr, defaults) - : undefined, - extension_nl: request.extensionNl - ? marshalContactExtensionNL(request.extensionNl, defaults) - : undefined, - fax_number: request.faxNumber, - firstname: request.firstname, - lang: request.lang, - lastname: request.lastname, - legal_form: request.legalForm, - phone_number: request.phoneNumber, - questions: request.questions - ? request.questions.map(elt => marshalContactQuestion(elt, defaults)) - : undefined, - resale: request.resale, - state: request.state, - vat_identification_code: request.vatIdentificationCode, - whois_opt_in: request.whoisOptIn, - zip: request.zip, + digest: request.digest, + public_key: + request.publicKey !== undefined + ? marshalDSRecordPublicKey(request.publicKey, defaults) + : undefined, + type: request.type, }) -const marshalRecordChange = ( - request: RecordChange, +export const marshalDSRecord = ( + request: DSRecord, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ - { - param: 'add', - value: request.add - ? marshalRecordChangeAdd(request.add, defaults) - : undefined, - }, - { - param: 'set', - value: request.set - ? marshalRecordChangeSet(request.set, defaults) - : undefined, - }, + algorithm: request.algorithm, + key_id: request.keyId, + ...resolveOneOf([ { - param: 'delete', - value: request.delete - ? marshalRecordChangeDelete(request.delete, defaults) - : undefined, + param: 'digest', + value: + request.digest !== undefined + ? marshalDSRecordDigest(request.digest, defaults) + : undefined, }, { - param: 'clear', - value: request.clear - ? marshalRecordChangeClear(request.clear, defaults) - : undefined, + param: 'public_key', + value: + request.publicKey !== undefined + ? marshalDSRecordPublicKey(request.publicKey, defaults) + : undefined, }, ]), }) -const marshalTransferInDomainRequestTransferRequest = ( - request: TransferInDomainRequestTransferRequest, - defaults: DefaultValues, -): Record => ({ - auth_code: request.authCode, - domain: request.domain, -}) - -const marshalUpdateContactRequestQuestion = ( - request: UpdateContactRequestQuestion, - defaults: DefaultValues, -): Record => ({ - answer: request.answer, - question: request.question, -}) - -export const marshalCloneDNSZoneRequest = ( - request: CloneDNSZoneRequest, +export const marshalRegistrarApiEnableDomainDNSSECRequest = ( + request: RegistrarApiEnableDomainDNSSECRequest, defaults: DefaultValues, ): Record => ({ - dest_dns_zone: request.destDnsZone, - overwrite: request.overwrite, - project_id: request.projectId, + ds_record: + request.dsRecord !== undefined + ? marshalDSRecord(request.dsRecord, defaults) + : undefined, }) -export const marshalCreateDNSZoneRequest = ( - request: CreateDNSZoneRequest, +export const marshalRegistrarApiRegisterExternalDomainRequest = ( + request: RegistrarApiRegisterExternalDomainRequest, defaults: DefaultValues, ): Record => ({ domain: request.domain, project_id: request.projectId ?? defaults.defaultProjectId, - subdomain: request.subdomain, -}) - -export const marshalCreateSSLCertificateRequest = ( - request: CreateSSLCertificateRequest, - defaults: DefaultValues, -): Record => ({ - alternative_dns_zones: request.alternativeDnsZones, - dns_zone: request.dnsZone, }) -export const marshalImportProviderDNSZoneRequest = ( - request: ImportProviderDNSZoneRequest, +export const marshalRegistrarApiRenewDomainsRequest = ( + request: RegistrarApiRenewDomainsRequest, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ - { - param: 'online_v1', - value: request.onlineV1 - ? marshalImportProviderDNSZoneRequestOnlineV1( - request.onlineV1, - defaults, - ) - : undefined, - }, - ]), + domains: request.domains, + duration_in_years: request.durationInYears, + force_late_renewal: request.forceLateRenewal, }) -export const marshalImportRawDNSZoneRequest = ( - request: ImportRawDNSZoneRequest, +export const marshalRegistrarApiTradeDomainRequest = ( + request: RegistrarApiTradeDomainRequest, defaults: DefaultValues, ): Record => ({ - content: request.content, - format: request.format, project_id: request.projectId ?? defaults.defaultProjectId, - ...resolveOneOf([ - { - param: 'bind_source', - value: request.bindSource - ? marshalImportRawDNSZoneRequestBindSource(request.bindSource, defaults) - : undefined, - }, + ...resolveOneOf>([ + { param: 'new_owner_contact_id', value: request.newOwnerContactId }, { - param: 'axfr_source', - value: request.axfrSource - ? marshalImportRawDNSZoneRequestAXFRSource(request.axfrSource, defaults) - : undefined, + param: 'new_owner_contact', + value: + request.newOwnerContact !== undefined + ? marshalNewContact(request.newOwnerContact, defaults) + : undefined, }, ]), }) -export const marshalRefreshDNSZoneRequest = ( - request: RefreshDNSZoneRequest, +const marshalTransferInDomainRequestTransferRequest = ( + request: TransferInDomainRequestTransferRequest, defaults: DefaultValues, ): Record => ({ - recreate_dns_zone: request.recreateDnsZone, - recreate_sub_dns_zone: request.recreateSubDnsZone, + auth_code: request.authCode, + domain: request.domain, }) -export const marshalRegistrarApiBuyDomainsRequest = ( - request: RegistrarApiBuyDomainsRequest, +export const marshalRegistrarApiTransferInDomainRequest = ( + request: RegistrarApiTransferInDomainRequest, defaults: DefaultValues, ): Record => ({ - domains: request.domains, - duration_in_years: request.durationInYears, + domains: request.domains.map(elt => + marshalTransferInDomainRequestTransferRequest(elt, defaults), + ), project_id: request.projectId ?? defaults.defaultProjectId, - ...resolveOneOf([ - { - param: 'administrative_contact_id', - value: request.administrativeContactId, - }, + ...resolveOneOf>([ + { param: 'owner_contact_id', value: request.ownerContactId }, { - param: 'administrative_contact', - value: request.administrativeContact - ? marshalNewContact(request.administrativeContact, defaults) - : undefined, + param: 'owner_contact', + value: + request.ownerContact !== undefined + ? marshalNewContact(request.ownerContact, defaults) + : undefined, }, ]), - ...resolveOneOf([ + ...resolveOneOf>([ { - param: 'owner_contact_id', - value: request.ownerContactId, + param: 'administrative_contact_id', + value: request.administrativeContactId, }, { - param: 'owner_contact', - value: request.ownerContact - ? marshalNewContact(request.ownerContact, defaults) - : undefined, + param: 'administrative_contact', + value: + request.administrativeContact !== undefined + ? marshalNewContact(request.administrativeContact, defaults) + : undefined, }, ]), - ...resolveOneOf([ - { - param: 'technical_contact_id', - value: request.technicalContactId, - }, + ...resolveOneOf>([ + { param: 'technical_contact_id', value: request.technicalContactId }, { param: 'technical_contact', - value: request.technicalContact - ? marshalNewContact(request.technicalContact, defaults) - : undefined, + value: + request.technicalContact !== undefined + ? marshalNewContact(request.technicalContact, defaults) + : undefined, }, ]), }) -export const marshalRegistrarApiCheckContactsCompatibilityRequest = ( - request: RegistrarApiCheckContactsCompatibilityRequest, +const marshalUpdateContactRequestQuestion = ( + request: UpdateContactRequestQuestion, defaults: DefaultValues, ): Record => ({ - domains: request.domains, - tlds: request.tlds, - ...resolveOneOf([ - { - param: 'administrative_contact_id', - value: request.administrativeContactId, - }, + answer: request.answer, + question: request.question, +}) + +export const marshalRegistrarApiUpdateContactRequest = ( + request: RegistrarApiUpdateContactRequest, + defaults: DefaultValues, +): Record => ({ + address_line_1: request.addressLine1, + address_line_2: request.addressLine2, + city: request.city, + company_identification_code: request.companyIdentificationCode, + country: request.country, + email: request.email, + email_alt: request.emailAlt, + extension_eu: + request.extensionEu !== undefined + ? marshalContactExtensionEU(request.extensionEu, defaults) + : undefined, + extension_fr: + request.extensionFr !== undefined + ? marshalContactExtensionFR(request.extensionFr, defaults) + : undefined, + extension_nl: + request.extensionNl !== undefined + ? marshalContactExtensionNL(request.extensionNl, defaults) + : undefined, + fax_number: request.faxNumber, + lang: request.lang, + phone_number: request.phoneNumber, + questions: + request.questions !== undefined + ? request.questions.map(elt => + marshalUpdateContactRequestQuestion(elt, defaults), + ) + : undefined, + resale: request.resale, + state: request.state, + vat_identification_code: request.vatIdentificationCode, + whois_opt_in: request.whoisOptIn, + zip: request.zip, +}) + +export const marshalRegistrarApiUpdateDomainHostRequest = ( + request: RegistrarApiUpdateDomainHostRequest, + defaults: DefaultValues, +): Record => ({ + ips: request.ips, +}) + +export const marshalRegistrarApiUpdateDomainRequest = ( + request: RegistrarApiUpdateDomainRequest, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf>([ + { param: 'technical_contact_id', value: request.technicalContactId }, { - param: 'administrative_contact', - value: request.administrativeContact - ? marshalNewContact(request.administrativeContact, defaults) - : undefined, + param: 'technical_contact', + value: + request.technicalContact !== undefined + ? marshalNewContact(request.technicalContact, defaults) + : undefined, }, ]), - ...resolveOneOf([ - { - param: 'owner_contact_id', - value: request.ownerContactId, - }, + ...resolveOneOf>([ + { param: 'owner_contact_id', value: request.ownerContactId }, { param: 'owner_contact', - value: request.ownerContact - ? marshalNewContact(request.ownerContact, defaults) - : undefined, + value: + request.ownerContact !== undefined + ? marshalNewContact(request.ownerContact, defaults) + : undefined, }, ]), - ...resolveOneOf([ + ...resolveOneOf>([ { - param: 'technical_contact_id', - value: request.technicalContactId, + param: 'administrative_contact_id', + value: request.administrativeContactId, }, { - param: 'technical_contact', - value: request.technicalContact - ? marshalNewContact(request.technicalContact, defaults) - : undefined, + param: 'administrative_contact', + value: + request.administrativeContact !== undefined + ? marshalNewContact(request.administrativeContact, defaults) + : undefined, }, ]), }) -export const marshalRegistrarApiCreateDomainHostRequest = ( - request: RegistrarApiCreateDomainHostRequest, +const marshalNameserver = ( + request: Nameserver, defaults: DefaultValues, ): Record => ({ - ips: request.ips, + ip: request.ip, name: request.name, }) -export const marshalRegistrarApiEnableDomainDNSSECRequest = ( - request: RegistrarApiEnableDomainDNSSECRequest, +export const marshalUpdateDNSZoneNameserversRequest = ( + request: UpdateDNSZoneNameserversRequest, defaults: DefaultValues, ): Record => ({ - ds_record: request.dsRecord - ? marshalDSRecord(request.dsRecord, defaults) - : undefined, + ns: request.ns.map(elt => marshalNameserver(elt, defaults)), }) -export const marshalRegistrarApiRegisterExternalDomainRequest = ( - request: RegistrarApiRegisterExternalDomainRequest, +const marshalDomainRecordGeoIPConfigMatch = ( + request: DomainRecordGeoIPConfigMatch, defaults: DefaultValues, ): Record => ({ - domain: request.domain, - project_id: request.projectId ?? defaults.defaultProjectId, + continents: request.continents, + countries: request.countries, + data: request.data, }) -export const marshalRegistrarApiRenewDomainsRequest = ( - request: RegistrarApiRenewDomainsRequest, +const marshalDomainRecordViewConfigView = ( + request: DomainRecordViewConfigView, defaults: DefaultValues, ): Record => ({ - domains: request.domains, - duration_in_years: request.durationInYears, - force_late_renewal: request.forceLateRenewal, + data: request.data, + subnet: request.subnet, }) -export const marshalRegistrarApiTradeDomainRequest = ( - request: RegistrarApiTradeDomainRequest, +const marshalDomainRecordWeightedConfigWeightedIP = ( + request: DomainRecordWeightedConfigWeightedIP, defaults: DefaultValues, ): Record => ({ - project_id: request.projectId, - ...resolveOneOf([ - { - param: 'new_owner_contact_id', - value: request.newOwnerContactId, - }, - { - param: 'new_owner_contact', - value: request.newOwnerContact - ? marshalNewContact(request.newOwnerContact, defaults) - : undefined, - }, - ]), + ip: request.ip, + weight: request.weight, }) -export const marshalRegistrarApiTransferInDomainRequest = ( - request: RegistrarApiTransferInDomainRequest, +const marshalDomainRecordGeoIPConfig = ( + request: DomainRecordGeoIPConfig, defaults: DefaultValues, ): Record => ({ - domains: request.domains.map(elt => - marshalTransferInDomainRequestTransferRequest(elt, defaults), + default: request.default, + matches: request.matches.map(elt => + marshalDomainRecordGeoIPConfigMatch(elt, defaults), ), - project_id: request.projectId ?? defaults.defaultProjectId, - ...resolveOneOf([ - { - param: 'administrative_contact_id', - value: request.administrativeContactId, - }, - { - param: 'administrative_contact', - value: request.administrativeContact - ? marshalNewContact(request.administrativeContact, defaults) - : undefined, - }, - ]), - ...resolveOneOf([ +}) + +const marshalDomainRecordHTTPServiceConfig = ( + request: DomainRecordHTTPServiceConfig, + defaults: DefaultValues, +): Record => ({ + ips: request.ips, + must_contain: request.mustContain, + strategy: request.strategy, + url: request.url, + user_agent: request.userAgent, +}) + +const marshalDomainRecordViewConfig = ( + request: DomainRecordViewConfig, + defaults: DefaultValues, +): Record => ({ + views: request.views.map(elt => + marshalDomainRecordViewConfigView(elt, defaults), + ), +}) + +const marshalDomainRecordWeightedConfig = ( + request: DomainRecordWeightedConfig, + defaults: DefaultValues, +): Record => ({ + weighted_ips: request.weightedIps.map(elt => + marshalDomainRecordWeightedConfigWeightedIP(elt, defaults), + ), +}) + +const marshalDomainRecord = ( + request: DomainRecord, + defaults: DefaultValues, +): Record => ({ + comment: request.comment, + data: request.data, + id: request.id, + name: request.name, + priority: request.priority, + ttl: request.ttl, + type: request.type, + ...resolveOneOf([ { - param: 'owner_contact_id', - value: request.ownerContactId, + param: 'geo_ip_config', + value: + request.geoIpConfig !== undefined + ? marshalDomainRecordGeoIPConfig(request.geoIpConfig, defaults) + : undefined, }, { - param: 'owner_contact', - value: request.ownerContact - ? marshalNewContact(request.ownerContact, defaults) - : undefined, + param: 'http_service_config', + value: + request.httpServiceConfig !== undefined + ? marshalDomainRecordHTTPServiceConfig( + request.httpServiceConfig, + defaults, + ) + : undefined, }, - ]), - ...resolveOneOf([ { - param: 'technical_contact_id', - value: request.technicalContactId, + param: 'weighted_config', + value: + request.weightedConfig !== undefined + ? marshalDomainRecordWeightedConfig(request.weightedConfig, defaults) + : undefined, }, { - param: 'technical_contact', - value: request.technicalContact - ? marshalNewContact(request.technicalContact, defaults) - : undefined, + param: 'view_config', + value: + request.viewConfig !== undefined + ? marshalDomainRecordViewConfig(request.viewConfig, defaults) + : undefined, }, ]), }) -export const marshalRegistrarApiUpdateContactRequest = ( - request: RegistrarApiUpdateContactRequest, +const marshalRecordIdentifier = ( + request: RecordIdentifier, defaults: DefaultValues, ): Record => ({ - address_line_1: request.addressLine1, - address_line_2: request.addressLine2, - city: request.city, - company_identification_code: request.companyIdentificationCode, - country: request.country, - email: request.email, - email_alt: request.emailAlt, - extension_eu: request.extensionEu - ? marshalContactExtensionEU(request.extensionEu, defaults) - : undefined, - extension_fr: request.extensionFr - ? marshalContactExtensionFR(request.extensionFr, defaults) - : undefined, - extension_nl: request.extensionNl - ? marshalContactExtensionNL(request.extensionNl, defaults) - : undefined, - fax_number: request.faxNumber, - lang: request.lang ?? 'unknown_language_code', - phone_number: request.phoneNumber, - questions: request.questions - ? request.questions.map(elt => - marshalUpdateContactRequestQuestion(elt, defaults), - ) - : undefined, - resale: request.resale, - state: request.state, - vat_identification_code: request.vatIdentificationCode, - whois_opt_in: request.whoisOptIn, - zip: request.zip, + data: request.data, + name: request.name, + ttl: request.ttl, + type: request.type, }) -export const marshalRegistrarApiUpdateDomainHostRequest = ( - request: RegistrarApiUpdateDomainHostRequest, +const marshalRecordChangeAdd = ( + request: RecordChangeAdd, defaults: DefaultValues, ): Record => ({ - ips: request.ips, + records: request.records.map(elt => marshalDomainRecord(elt, defaults)), }) -export const marshalRegistrarApiUpdateDomainRequest = ( - request: RegistrarApiUpdateDomainRequest, +const marshalRecordChangeClear = ( + request: RecordChangeClear, + defaults: DefaultValues, +): Record => ({}) + +const marshalRecordChangeDelete = ( + request: RecordChangeDelete, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ + ...resolveOneOf>([ + { param: 'id', value: request.id }, { - param: 'administrative_contact_id', - value: request.administrativeContactId, + param: 'id_fields', + value: + request.idFields !== undefined + ? marshalRecordIdentifier(request.idFields, defaults) + : undefined, }, + ]), +}) + +const marshalRecordChangeSet = ( + request: RecordChangeSet, + defaults: DefaultValues, +): Record => ({ + records: request.records.map(elt => marshalDomainRecord(elt, defaults)), + ...resolveOneOf>([ + { param: 'id', value: request.id }, { - param: 'administrative_contact', - value: request.administrativeContact - ? marshalNewContact(request.administrativeContact, defaults) - : undefined, + param: 'id_fields', + value: + request.idFields !== undefined + ? marshalRecordIdentifier(request.idFields, defaults) + : undefined, }, ]), - ...resolveOneOf([ +}) + +const marshalRecordChange = ( + request: RecordChange, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf([ { - param: 'owner_contact_id', - value: request.ownerContactId, + param: 'add', + value: + request.add !== undefined + ? marshalRecordChangeAdd(request.add, defaults) + : undefined, }, { - param: 'owner_contact', - value: request.ownerContact - ? marshalNewContact(request.ownerContact, defaults) - : undefined, + param: 'set', + value: + request.set !== undefined + ? marshalRecordChangeSet(request.set, defaults) + : undefined, }, - ]), - ...resolveOneOf([ { - param: 'technical_contact_id', - value: request.technicalContactId, + param: 'delete', + value: + request.delete !== undefined + ? marshalRecordChangeDelete(request.delete, defaults) + : undefined, }, { - param: 'technical_contact', - value: request.technicalContact - ? marshalNewContact(request.technicalContact, defaults) - : undefined, + param: 'clear', + value: + request.clear !== undefined + ? marshalRecordChangeClear(request.clear, defaults) + : undefined, }, ]), }) -export const marshalUpdateDNSZoneNameserversRequest = ( - request: UpdateDNSZoneNameserversRequest, - defaults: DefaultValues, -): Record => ({ - ns: request.ns.map(elt => marshalNameserver(elt, defaults)), -}) - export const marshalUpdateDNSZoneRecordsRequest = ( request: UpdateDNSZoneRecordsRequest, defaults: DefaultValues, diff --git a/packages/clients/src/api/domain/v2beta1/types.gen.ts b/packages/clients/src/api/domain/v2beta1/types.gen.ts index 7fb3bbdad..ff87dc52f 100644 --- a/packages/clients/src/api/domain/v2beta1/types.gen.ts +++ b/packages/clients/src/api/domain/v2beta1/types.gen.ts @@ -1,6 +1,7 @@ // This file was automatically generated. DO NOT EDIT. // If you have any remark or suggestion do not hesitate to open an issue. import type { Money } from '../../../bridge' +import type { LanguageCode as StdLanguageCode } from '../../std/types.gen' export type ContactEmailStatus = | 'email_status_unknown' @@ -132,8 +133,6 @@ export type DomainStatus = export type HostStatus = 'unknown_status' | 'active' | 'updating' | 'deleting' -export type LanguageCode = 'unknown_language_code' | 'en_US' | 'fr_FR' | 'de_DE' - export type ListContactsRequestRole = | 'unknown_role' | 'owner' @@ -216,89 +215,45 @@ export type TaskType = | 'delete_host' | 'move_project' -export interface AvailableDomain { - domain: string - available: boolean - tld?: Tld +export interface DomainRecordGeoIPConfigMatch { + countries: string[] + continents: string[] + data: string } -/** Check contacts compatibility response. */ -export interface CheckContactsCompatibilityResponse { - compatible: boolean - ownerCheckResult?: CheckContactsCompatibilityResponseContactCheckResult - administrativeCheckResult?: CheckContactsCompatibilityResponseContactCheckResult - technicalCheckResult?: CheckContactsCompatibilityResponseContactCheckResult +export interface DomainRecordViewConfigView { + subnet: string + data: string } -export interface CheckContactsCompatibilityResponseContactCheckResult { - compatible: boolean - errorMessage?: string +export interface DomainRecordWeightedConfigWeightedIP { + ip: string + weight: number } -/** Clear dns zone records response. */ -export interface ClearDNSZoneRecordsResponse {} +export interface DSRecordPublicKey { + key: string +} -/** Contact. */ -export interface Contact { - id: string - legalForm: ContactLegalForm - firstname: string - lastname: string - companyName: string - email: string - emailAlt: string - phoneNumber: string - faxNumber: string - addressLine1: string - addressLine2: string - zip: string - city: string - country: string - vatIdentificationCode: string - companyIdentificationCode: string - lang: LanguageCode - resale: boolean - /** @deprecated */ - questions?: ContactQuestion[] - extensionFr?: ContactExtensionFR - extensionEu?: ContactExtensionEU - whoisOptIn: boolean - emailStatus: ContactEmailStatus - state: string - extensionNl?: ContactExtensionNL +export interface DomainRecordGeoIPConfig { + matches: DomainRecordGeoIPConfigMatch[] + default: string } -export interface ContactExtensionEU { - europeanCitizenship: string +export interface DomainRecordHTTPServiceConfig { + ips: string[] + mustContain?: string + url: string + userAgent?: string + strategy: DomainRecordHTTPServiceConfigStrategy } -export interface ContactExtensionFR { - mode: ContactExtensionFRMode - /** - * One-of ('modeFields'): at most one of 'individualInfo', 'dunsInfo', - * 'associationInfo', 'trademarkInfo', 'codeAuthAfnicInfo' could be set. - */ - individualInfo?: ContactExtensionFRIndividualInfo - /** - * One-of ('modeFields'): at most one of 'individualInfo', 'dunsInfo', - * 'associationInfo', 'trademarkInfo', 'codeAuthAfnicInfo' could be set. - */ - dunsInfo?: ContactExtensionFRDunsInfo - /** - * One-of ('modeFields'): at most one of 'individualInfo', 'dunsInfo', - * 'associationInfo', 'trademarkInfo', 'codeAuthAfnicInfo' could be set. - */ - associationInfo?: ContactExtensionFRAssociationInfo - /** - * One-of ('modeFields'): at most one of 'individualInfo', 'dunsInfo', - * 'associationInfo', 'trademarkInfo', 'codeAuthAfnicInfo' could be set. - */ - trademarkInfo?: ContactExtensionFRTrademarkInfo - /** - * One-of ('modeFields'): at most one of 'individualInfo', 'dunsInfo', - * 'associationInfo', 'trademarkInfo', 'codeAuthAfnicInfo' could be set. - */ - codeAuthAfnicInfo?: ContactExtensionFRCodeAuthAfnicInfo +export interface DomainRecordViewConfig { + views: DomainRecordViewConfigView[] +} + +export interface DomainRecordWeightedConfig { + weightedIps: DomainRecordWeightedConfigWeightedIP[] } export interface ContactExtensionFRAssociationInfo { @@ -323,109 +278,12 @@ export interface ContactExtensionFRTrademarkInfo { trademarkInpi: string } -export interface ContactExtensionNL { - legalForm: ContactExtensionNLLegalForm - legalFormRegistrationNumber: string -} - -export interface ContactQuestion { - question: string - answer: string -} - -export interface ContactRoles { - contact?: Contact - roles: Record -} - -export interface ContactRolesRoles { - isOwner: boolean - isAdministrative: boolean - isTechnical: boolean -} - -export interface DNSZone { - domain: string - subdomain: string - ns: string[] - nsDefault: string[] - nsMaster: string[] - status: DNSZoneStatus - message?: string - updatedAt?: Date - projectId: string -} - -export interface DNSZoneVersion { - id: string - createdAt?: Date -} - -export interface DSRecord { - keyId: number - algorithm: DSRecordAlgorithm - /** One-of ('type'): at most one of 'digest', 'publicKey' could be set. */ - digest?: DSRecordDigest - /** One-of ('type'): at most one of 'digest', 'publicKey' could be set. */ - publicKey?: DSRecordPublicKey -} - export interface DSRecordDigest { type: DSRecordDigestType digest: string publicKey?: DSRecordPublicKey } -export interface DSRecordPublicKey { - key: string -} - -/** Delete dns zone response. */ -export interface DeleteDNSZoneResponse {} - -/** Delete external domain response. */ -export interface DeleteExternalDomainResponse {} - -/** Delete ssl certificate response. */ -export interface DeleteSSLCertificateResponse {} - -/** Domain. */ -export interface Domain { - domain: string - organizationId: string - projectId: string - autoRenewStatus: DomainFeatureStatus - dnssec?: DomainDNSSEC - eppCode: string[] - expiredAt?: Date - updatedAt?: Date - registrar: string - isExternal: boolean - status: DomainStatus - dnsZones: DNSZone[] - ownerContact?: Contact - technicalContact?: Contact - administrativeContact?: Contact - /** - * One-of ('registrationStatus'): at most one of - * 'externalDomainRegistrationStatus', 'transferRegistrationStatus' could be - * set. - */ - externalDomainRegistrationStatus?: DomainRegistrationStatusExternalDomain - /** - * One-of ('registrationStatus'): at most one of - * 'externalDomainRegistrationStatus', 'transferRegistrationStatus' could be - * set. - */ - transferRegistrationStatus?: DomainRegistrationStatusTransfer - tld?: Tld -} - -export interface DomainDNSSEC { - status: DomainFeatureStatus - dsRecords: DSRecord[] -} - export interface DomainRecord { data: string name: string @@ -456,215 +314,151 @@ export interface DomainRecord { id: string } -export interface DomainRecordGeoIPConfig { - matches: DomainRecordGeoIPConfigMatch[] - default: string +export interface RecordIdentifier { + name: string + type: DomainRecordType + data?: string + ttl?: number } -export interface DomainRecordGeoIPConfigMatch { - countries: string[] - continents: string[] - data: string +export interface ContactExtensionEU { + europeanCitizenship: string } -export interface DomainRecordHTTPServiceConfig { - ips: string[] - mustContain?: string - url: string - userAgent?: string - strategy: DomainRecordHTTPServiceConfigStrategy +export interface ContactExtensionFR { + mode: ContactExtensionFRMode + /** + * One-of ('modeFields'): at most one of 'individualInfo', 'dunsInfo', + * 'associationInfo', 'trademarkInfo', 'codeAuthAfnicInfo' could be set. + */ + individualInfo?: ContactExtensionFRIndividualInfo + /** + * One-of ('modeFields'): at most one of 'individualInfo', 'dunsInfo', + * 'associationInfo', 'trademarkInfo', 'codeAuthAfnicInfo' could be set. + */ + dunsInfo?: ContactExtensionFRDunsInfo + /** + * One-of ('modeFields'): at most one of 'individualInfo', 'dunsInfo', + * 'associationInfo', 'trademarkInfo', 'codeAuthAfnicInfo' could be set. + */ + associationInfo?: ContactExtensionFRAssociationInfo + /** + * One-of ('modeFields'): at most one of 'individualInfo', 'dunsInfo', + * 'associationInfo', 'trademarkInfo', 'codeAuthAfnicInfo' could be set. + */ + trademarkInfo?: ContactExtensionFRTrademarkInfo + /** + * One-of ('modeFields'): at most one of 'individualInfo', 'dunsInfo', + * 'associationInfo', 'trademarkInfo', 'codeAuthAfnicInfo' could be set. + */ + codeAuthAfnicInfo?: ContactExtensionFRCodeAuthAfnicInfo } -export interface DomainRecordViewConfig { - views: DomainRecordViewConfigView[] +export interface ContactExtensionNL { + legalForm: ContactExtensionNLLegalForm + legalFormRegistrationNumber: string } -export interface DomainRecordViewConfigView { - subnet: string - data: string +export interface ContactQuestion { + question: string + answer: string } -export interface DomainRecordWeightedConfig { - weightedIps: DomainRecordWeightedConfigWeightedIP[] +export interface TldOffer { + action: string + operationPath: string + price?: Money } -export interface DomainRecordWeightedConfigWeightedIP { - ip: string - weight: number -} - -export interface DomainRegistrationStatusExternalDomain { - validationToken: string -} - -export interface DomainRegistrationStatusTransfer { - status: DomainRegistrationStatusTransferStatus - voteCurrentOwner: boolean - voteNewOwner: boolean -} - -export interface DomainSummary { - domain: string - projectId: string - autoRenewStatus: DomainFeatureStatus - dnssecStatus: DomainFeatureStatus - eppCode: string[] - expiredAt?: Date - updatedAt?: Date - registrar: string - isExternal: boolean - status: DomainStatus - /** - * One-of ('registrationStatus'): at most one of - * 'externalDomainRegistrationStatus', 'transferRegistrationStatus' could be - * set. - */ - externalDomainRegistrationStatus?: DomainRegistrationStatusExternalDomain - /** - * One-of ('registrationStatus'): at most one of - * 'externalDomainRegistrationStatus', 'transferRegistrationStatus' could be - * set. - */ - transferRegistrationStatus?: DomainRegistrationStatusTransfer - organizationId: string -} - -/** Get dns zone tsig key response. */ -export interface GetDNSZoneTsigKeyResponse { - name: string - key: string - algorithm: string -} - -/** Get dns zone version diff response. */ -export interface GetDNSZoneVersionDiffResponse { - changes: RecordChange[] +export interface DSRecord { + keyId: number + algorithm: DSRecordAlgorithm + /** One-of ('type'): at most one of 'digest', 'publicKey' could be set. */ + digest?: DSRecordDigest + /** One-of ('type'): at most one of 'digest', 'publicKey' could be set. */ + publicKey?: DSRecordPublicKey } -/** Get domain auth code response. */ -export interface GetDomainAuthCodeResponse { - authCode: string +export interface RecordChangeAdd { + records: DomainRecord[] } -export interface Host { - domain: string - name: string - ips: string[] - status: HostStatus -} +export interface RecordChangeClear {} -export interface ImportProviderDNSZoneRequestOnlineV1 { - token: string +export interface RecordChangeDelete { + /** One-of ('identifier'): at most one of 'id', 'idFields' could be set. */ + id?: string + /** One-of ('identifier'): at most one of 'id', 'idFields' could be set. */ + idFields?: RecordIdentifier } -/** Import provider dns zone response. */ -export interface ImportProviderDNSZoneResponse { +export interface RecordChangeSet { + /** One-of ('identifier'): at most one of 'id', 'idFields' could be set. */ + id?: string + /** One-of ('identifier'): at most one of 'id', 'idFields' could be set. */ + idFields?: RecordIdentifier records: DomainRecord[] } -export interface ImportRawDNSZoneRequestAXFRSource { - nameServer: string - tsigKey?: ImportRawDNSZoneRequestTsigKey -} - -export interface ImportRawDNSZoneRequestBindSource { - content: string -} - export interface ImportRawDNSZoneRequestTsigKey { name: string key: string algorithm: string } -/** Import raw dns zone response. */ -export interface ImportRawDNSZoneResponse { - records: DomainRecord[] -} - -/** List contacts response. */ -export interface ListContactsResponse { - totalCount: number - contacts: ContactRoles[] -} - -/** List dns zone nameservers response. */ -export interface ListDNSZoneNameserversResponse { - /** DNS zone name servers returned. */ - ns: Nameserver[] -} - -/** List dns zone records response. */ -export interface ListDNSZoneRecordsResponse { - /** Total number of DNS zone records. */ - totalCount: number - /** Paginated returned DNS zone records. */ - records: DomainRecord[] -} - -/** List dns zone version records response. */ -export interface ListDNSZoneVersionRecordsResponse { - /** Total number of DNS zones versions records. */ - totalCount: number - records: DomainRecord[] -} - -/** List dns zone versions response. */ -export interface ListDNSZoneVersionsResponse { - /** Total number of DNS zones versions. */ - totalCount: number - versions: DNSZoneVersion[] -} - -/** List dns zones response. */ -export interface ListDNSZonesResponse { - /** Total number of DNS zones matching the requested criteria. */ - totalCount: number - /** Paginated returned DNS zones. */ - dnsZones: DNSZone[] -} - -/** List domain hosts response. */ -export interface ListDomainHostsResponse { - totalCount: number - hosts: Host[] -} - -/** List domains response. */ -export interface ListDomainsResponse { - totalCount: number - domains: DomainSummary[] -} - -/** List renewable domains response. */ -export interface ListRenewableDomainsResponse { - totalCount: number - domains: RenewableDomain[] +export interface Contact { + id: string + legalForm: ContactLegalForm + firstname: string + lastname: string + companyName: string + email: string + emailAlt: string + phoneNumber: string + faxNumber: string + addressLine1: string + addressLine2: string + zip: string + city: string + country: string + vatIdentificationCode: string + companyIdentificationCode: string + lang: StdLanguageCode + resale: boolean + /** @deprecated */ + questions?: ContactQuestion[] + extensionFr?: ContactExtensionFR + extensionEu?: ContactExtensionEU + whoisOptIn: boolean + emailStatus: ContactEmailStatus + state: string + extensionNl?: ContactExtensionNL } -/** List ssl certificates response. */ -export interface ListSSLCertificatesResponse { - totalCount: number - certificates: SSLCertificate[] +export interface ContactRolesRoles { + isOwner: boolean + isAdministrative: boolean + isTechnical: boolean } -/** List tasks response. */ -export interface ListTasksResponse { - totalCount: number - tasks: Task[] +export interface DomainRegistrationStatusExternalDomain { + validationToken: string } -/** List tlds response. */ -export interface ListTldsResponse { - /** Array of TLDs. */ - tlds: Tld[] - /** Total count of TLDs returned. */ - totalCount: number +export interface DomainRegistrationStatusTransfer { + status: DomainRegistrationStatusTransferStatus + voteCurrentOwner: boolean + voteNewOwner: boolean } -export interface Nameserver { +export interface Tld { name: string - ip: string[] + dnssecSupport: boolean + durationInYearsMin: number + durationInYearsMax: number + idnSupport: boolean + offers: Record + specifications: Record } export interface NewContact { @@ -683,7 +477,7 @@ export interface NewContact { country: string vatIdentificationCode?: string companyIdentificationCode?: string - lang: LanguageCode + lang: StdLanguageCode resale: boolean /** @deprecated */ questions?: ContactQuestion[] @@ -694,12 +488,26 @@ export interface NewContact { extensionNl?: ContactExtensionNL } -export interface OrderResponse { - domains: string[] - organizationId: string +export interface CheckContactsCompatibilityResponseContactCheckResult { + compatible: boolean + errorMessage?: string +} + +export interface DNSZone { + domain: string + subdomain: string + ns: string[] + nsDefault: string[] + nsMaster: string[] + status: DNSZoneStatus + message?: string + updatedAt?: Date projectId: string - taskId: string - createdAt?: Date +} + +export interface DomainDNSSEC { + status: DomainFeatureStatus + dsRecords: DSRecord[] } export interface RecordChange { @@ -725,46 +533,65 @@ export interface RecordChange { clear?: RecordChangeClear } -export interface RecordChangeAdd { - records: DomainRecord[] +export interface ImportProviderDNSZoneRequestOnlineV1 { + token: string } -export interface RecordChangeClear {} - -export interface RecordChangeDelete { - /** One-of ('identifier'): at most one of 'id', 'idFields' could be set. */ - id?: string - /** One-of ('identifier'): at most one of 'id', 'idFields' could be set. */ - idFields?: RecordIdentifier +export interface ImportRawDNSZoneRequestAXFRSource { + nameServer: string + tsigKey?: ImportRawDNSZoneRequestTsigKey } -export interface RecordChangeSet { - /** One-of ('identifier'): at most one of 'id', 'idFields' could be set. */ - id?: string - /** One-of ('identifier'): at most one of 'id', 'idFields' could be set. */ - idFields?: RecordIdentifier - records: DomainRecord[] +export interface ImportRawDNSZoneRequestBindSource { + content: string } -export interface RecordIdentifier { - name: string - type: DomainRecordType - data?: string - ttl?: number +export interface ContactRoles { + contact?: Contact + roles: Record } -/** Refresh dns zone response. */ -export interface RefreshDNSZoneResponse { - /** DNS zones returned. */ - dnsZones: DNSZone[] +export interface Nameserver { + name: string + ip: string[] } -export interface RegisterExternalDomainResponse { - domain: string - organizationId: string - validationToken: string +export interface DNSZoneVersion { + id: string createdAt?: Date +} + +export interface Host { + domain: string + name: string + ips: string[] + status: HostStatus +} + +export interface DomainSummary { + domain: string projectId: string + autoRenewStatus: DomainFeatureStatus + dnssecStatus: DomainFeatureStatus + eppCode: string[] + expiredAt?: Date + updatedAt?: Date + registrar: string + isExternal: boolean + status: DomainStatus + /** + * One-of ('registrationStatus'): at most one of + * 'externalDomainRegistrationStatus', 'transferRegistrationStatus' could be + * set. + */ + externalDomainRegistrationStatus?: DomainRegistrationStatusExternalDomain + /** + * One-of ('registrationStatus'): at most one of + * 'externalDomainRegistrationStatus', 'transferRegistrationStatus' could be + * set. + */ + transferRegistrationStatus?: DomainRegistrationStatusTransfer + organizationId: string } export interface RenewableDomain { @@ -780,9 +607,6 @@ export interface RenewableDomain { tld?: Tld } -/** Restore dns zone version response. */ -export interface RestoreDNSZoneVersionResponse {} - export interface SSLCertificate { dnsZone: string alternativeDnsZones: string[] @@ -793,12 +617,6 @@ export interface SSLCertificate { expiredAt?: Date } -/** Search available domains response. */ -export interface SearchAvailableDomainsResponse { - /** Array of available domains. */ - availableDomains: AvailableDomain[] -} - export interface Task { id: string projectId: string @@ -811,22 +629,6 @@ export interface Task { message?: string } -export interface Tld { - name: string - dnssecSupport: boolean - durationInYearsMin: number - durationInYearsMax: number - idnSupport: boolean - offers: Record - specifications: Record -} - -export interface TldOffer { - action: string - operationPath: string - price?: Money -} - export interface TransferInDomainRequestTransferRequest { domain: string authCode: string @@ -837,63 +639,26 @@ export interface UpdateContactRequestQuestion { answer?: string } -/** Update dns zone nameservers response. */ -export interface UpdateDNSZoneNameserversResponse { - /** DNS zone name servers returned. */ - ns: Nameserver[] -} - -/** Update dns zone records response. */ -export interface UpdateDNSZoneRecordsResponse { - /** DNS zone records returned. */ - records: DomainRecord[] -} - -export type ListDNSZonesRequest = { - /** Organization ID on which to filter the returned DNS zones. */ - organizationId?: string - /** Project ID on which to filter the returned DNS zones. */ - projectId?: string - /** Sort order of the returned DNS zones. */ - orderBy?: ListDNSZonesRequestOrderBy - /** Page number to return, from the paginated results. */ - page?: number - /** Maximum number of DNS zones to return per page. */ - pageSize?: number - /** Domain on which to filter the returned DNS zones. */ +export interface AvailableDomain { domain: string - /** @deprecated DNS zone on which to filter the returned DNS zones. */ - dnsZone?: string - /** DNS zones on which to filter the returned DNS zones. */ - dnsZones?: string[] - /** Only list DNS zones created after this date. */ - createdAfter?: Date - /** Only list DNS zones created before this date. */ - createdBefore?: Date - /** Only list DNS zones updated after this date. */ - updatedAfter?: Date - /** Only list DNS zones updated before this date. */ - updatedBefore?: Date + available: boolean + tld?: Tld } -export type CreateDNSZoneRequest = { - /** Domain in which to crreate the DNS zone. */ - domain: string - /** Subdomain of the DNS zone to create. */ - subdomain: string - /** Project ID in which to create the DNS zone. */ - projectId?: string +export interface CheckContactsCompatibilityResponse { + compatible: boolean + ownerCheckResult?: CheckContactsCompatibilityResponseContactCheckResult + administrativeCheckResult?: CheckContactsCompatibilityResponseContactCheckResult + technicalCheckResult?: CheckContactsCompatibilityResponseContactCheckResult } -export type UpdateDNSZoneRequest = { - /** DNS zone to update. */ +export type ClearDNSZoneRecordsRequest = { + /** DNS zone to clear. */ dnsZone: string - /** Name of the new DNS zone to create. */ - newDnsZone: string - /** Project ID in which to create the new DNS zone. */ - projectId?: string } +export interface ClearDNSZoneRecordsResponse {} + export type CloneDNSZoneRequest = { /** DNS zone to clone. */ dnsZone: string @@ -905,6 +670,20 @@ export type CloneDNSZoneRequest = { projectId?: string } +export type CreateDNSZoneRequest = { + /** Domain in which to crreate the DNS zone. */ + domain: string + /** Subdomain of the DNS zone to create. */ + subdomain: string + /** Project ID in which to create the DNS zone. */ + projectId?: string +} + +export type CreateSSLCertificateRequest = { + dnsZone: string + alternativeDnsZones?: string[] +} + export type DeleteDNSZoneRequest = { /** DNS zone to delete. */ dnsZone: string @@ -912,65 +691,92 @@ export type DeleteDNSZoneRequest = { projectId?: string } -export type ListDNSZoneRecordsRequest = { - /** DNS zone on which to filter the returned DNS zone records. */ +export interface DeleteDNSZoneResponse {} + +export type DeleteDNSZoneTsigKeyRequest = { dnsZone: string - /** Project ID on which to filter the returned DNS zone records. */ - projectId?: string - /** Sort order of the returned DNS zone records. */ - orderBy?: ListDNSZoneRecordsRequestOrderBy - /** Page number to return, from the paginated results. */ - page?: number - /** Maximum number of DNS zone records per page. */ - pageSize?: number - /** Name on which to filter the returned DNS zone records. */ - name: string - /** Record type on which to filter the returned DNS zone records. */ - type?: DomainRecordType - /** Record ID on which to filter the returned DNS zone records. */ - id?: string } -export type UpdateDNSZoneRecordsRequest = { - /** DNS zone in which to update the DNS zone records. */ +export interface DeleteExternalDomainResponse {} + +export type DeleteSSLCertificateRequest = { dnsZone: string - /** Changes made to the records. */ - changes: RecordChange[] - /** Specifies whether or not to return all the records. */ - returnAllRecords?: boolean +} + +export interface DeleteSSLCertificateResponse {} + +export interface Domain { + domain: string + organizationId: string + projectId: string + autoRenewStatus: DomainFeatureStatus + dnssec?: DomainDNSSEC + eppCode: string[] + expiredAt?: Date + updatedAt?: Date + registrar: string + isExternal: boolean + status: DomainStatus + dnsZones: DNSZone[] + ownerContact?: Contact + technicalContact?: Contact + administrativeContact?: Contact /** - * Disable the creation of the target zone if it does not exist. Target zone - * creation is disabled by default. + * One-of ('registrationStatus'): at most one of + * 'externalDomainRegistrationStatus', 'transferRegistrationStatus' could be + * set. */ - disallowNewZoneCreation: boolean - /** Use the provided serial (0) instead of the auto-increment serial. */ - serial?: number + externalDomainRegistrationStatus?: DomainRegistrationStatusExternalDomain + /** + * One-of ('registrationStatus'): at most one of + * 'externalDomainRegistrationStatus', 'transferRegistrationStatus' could be + * set. + */ + transferRegistrationStatus?: DomainRegistrationStatusTransfer + tld?: Tld } -export type ListDNSZoneNameserversRequest = { - /** DNS zone on which to filter the returned DNS zone name servers. */ +export type ExportRawDNSZoneRequest = { + /** DNS zone to export. */ dnsZone: string - /** Project ID on which to filter the returned DNS zone name servers. */ - projectId?: string + /** DNS zone format. */ + format?: RawFormat } -export type UpdateDNSZoneNameserversRequest = { - /** DNS zone in which to update the DNS zone name servers. */ +export type GetDNSZoneTsigKeyRequest = { dnsZone: string - /** New DNS zone name servers. */ - ns: Nameserver[] } -export type ClearDNSZoneRecordsRequest = { - /** DNS zone to clear. */ +export interface GetDNSZoneTsigKeyResponse { + name: string + key: string + algorithm: string +} + +export type GetDNSZoneVersionDiffRequest = { + dnsZoneVersionId: string +} + +export interface GetDNSZoneVersionDiffResponse { + changes: RecordChange[] +} + +export interface GetDomainAuthCodeResponse { + authCode: string +} + +export type GetSSLCertificateRequest = { dnsZone: string } -export type ExportRawDNSZoneRequest = { - /** DNS zone to export. */ +export type ImportProviderDNSZoneRequest = { dnsZone: string - /** DNS zone format. */ - format?: RawFormat + /** One-of ('provider'): at most one of 'onlineV1' could be set. */ + onlineV1?: ImportProviderDNSZoneRequestOnlineV1 +} + +export interface ImportProviderDNSZoneResponse { + records: DomainRecord[] } export type ImportRawDNSZoneRequest = { @@ -995,27 +801,51 @@ export type ImportRawDNSZoneRequest = { axfrSource?: ImportRawDNSZoneRequestAXFRSource } -export type ImportProviderDNSZoneRequest = { - dnsZone: string - /** One-of ('provider'): at most one of 'onlineV1' could be set. */ - onlineV1?: ImportProviderDNSZoneRequestOnlineV1 +export interface ImportRawDNSZoneResponse { + records: DomainRecord[] } -export type RefreshDNSZoneRequest = { - /** DNS zone to refresh. */ - dnsZone: string - /** Specifies whether or not to recreate the DNS zone. */ - recreateDnsZone: boolean - /** Specifies whether or not to recreate the sub DNS zone. */ - recreateSubDnsZone: boolean -} +export interface ListContactsResponse { + totalCount: number + contacts: ContactRoles[] +} -export type ListDNSZoneVersionsRequest = { +export type ListDNSZoneNameserversRequest = { + /** DNS zone on which to filter the returned DNS zone name servers. */ + dnsZone: string + /** Project ID on which to filter the returned DNS zone name servers. */ + projectId?: string +} + +export interface ListDNSZoneNameserversResponse { + /** DNS zone name servers returned. */ + ns: Nameserver[] +} + +export type ListDNSZoneRecordsRequest = { + /** DNS zone on which to filter the returned DNS zone records. */ dnsZone: string + /** Project ID on which to filter the returned DNS zone records. */ + projectId?: string + /** Sort order of the returned DNS zone records. */ + orderBy?: ListDNSZoneRecordsRequestOrderBy /** Page number to return, from the paginated results. */ page?: number - /** Maximum number of DNS zones versions per page. */ + /** Maximum number of DNS zone records per page. */ pageSize?: number + /** Name on which to filter the returned DNS zone records. */ + name: string + /** Record type on which to filter the returned DNS zone records. */ + type?: DomainRecordType + /** Record ID on which to filter the returned DNS zone records. */ + id?: string +} + +export interface ListDNSZoneRecordsResponse { + /** Total number of DNS zone records. */ + totalCount: number + /** Paginated returned DNS zone records. */ + records: DomainRecord[] } export type ListDNSZoneVersionRecordsRequest = { @@ -1026,40 +856,278 @@ export type ListDNSZoneVersionRecordsRequest = { pageSize?: number } -export type GetDNSZoneVersionDiffRequest = { - dnsZoneVersionId: string +export interface ListDNSZoneVersionRecordsResponse { + /** Total number of DNS zones versions records. */ + totalCount: number + records: DomainRecord[] } -export type RestoreDNSZoneVersionRequest = { - dnsZoneVersionId: string +export type ListDNSZoneVersionsRequest = { + dnsZone: string + /** Page number to return, from the paginated results. */ + page?: number + /** Maximum number of DNS zones versions per page. */ + pageSize?: number } -export type GetSSLCertificateRequest = { +export interface ListDNSZoneVersionsResponse { + /** Total number of DNS zones versions. */ + totalCount: number + versions: DNSZoneVersion[] +} + +export type ListDNSZonesRequest = { + /** Organization ID on which to filter the returned DNS zones. */ + organizationId?: string + /** Project ID on which to filter the returned DNS zones. */ + projectId?: string + /** Sort order of the returned DNS zones. */ + orderBy?: ListDNSZonesRequestOrderBy + /** Page number to return, from the paginated results. */ + page?: number + /** Maximum number of DNS zones to return per page. */ + pageSize?: number + /** Domain on which to filter the returned DNS zones. */ + domain: string + /** @deprecated DNS zone on which to filter the returned DNS zones. */ + dnsZone?: string + /** DNS zones on which to filter the returned DNS zones. */ + dnsZones?: string[] + /** Only list DNS zones created after this date. */ + createdAfter?: Date + /** Only list DNS zones created before this date. */ + createdBefore?: Date + /** Only list DNS zones updated after this date. */ + updatedAfter?: Date + /** Only list DNS zones updated before this date. */ + updatedBefore?: Date +} + +export interface ListDNSZonesResponse { + /** Total number of DNS zones matching the requested criteria. */ + totalCount: number + /** Paginated returned DNS zones. */ + dnsZones: DNSZone[] +} + +export interface ListDomainHostsResponse { + totalCount: number + hosts: Host[] +} + +export interface ListDomainsResponse { + totalCount: number + domains: DomainSummary[] +} + +export interface ListRenewableDomainsResponse { + totalCount: number + domains: RenewableDomain[] +} + +export type ListSSLCertificatesRequest = { dnsZone: string + page?: number + pageSize?: number + projectId?: string } -export type CreateSSLCertificateRequest = { +export interface ListSSLCertificatesResponse { + totalCount: number + certificates: SSLCertificate[] +} + +export interface ListTasksResponse { + totalCount: number + tasks: Task[] +} + +export interface ListTldsResponse { + /** Array of TLDs. */ + tlds: Tld[] + /** Total count of TLDs returned. */ + totalCount: number +} + +export interface OrderResponse { + domains: string[] + organizationId: string + projectId: string + taskId: string + createdAt?: Date +} + +export type RefreshDNSZoneRequest = { + /** DNS zone to refresh. */ dnsZone: string - alternativeDnsZones?: string[] + /** Specifies whether or not to recreate the DNS zone. */ + recreateDnsZone: boolean + /** Specifies whether or not to recreate the sub DNS zone. */ + recreateSubDnsZone: boolean +} + +export interface RefreshDNSZoneResponse { + /** DNS zones returned. */ + dnsZones: DNSZone[] +} + +export interface RegisterExternalDomainResponse { + domain: string + organizationId: string + validationToken: string + createdAt?: Date + projectId: string +} + +export type RegistrarApiBuyDomainsRequest = { + domains: string[] + durationInYears: number + projectId?: string + /** + * One-of ('ownerContactType'): at most one of 'ownerContactId', + * 'ownerContact' could be set. + */ + ownerContactId?: string + /** + * One-of ('ownerContactType'): at most one of 'ownerContactId', + * 'ownerContact' could be set. + */ + ownerContact?: NewContact + /** + * One-of ('administrativeContactType'): at most one of + * 'administrativeContactId', 'administrativeContact' could be set. + */ + administrativeContactId?: string + /** + * One-of ('administrativeContactType'): at most one of + * 'administrativeContactId', 'administrativeContact' could be set. + */ + administrativeContact?: NewContact + /** + * One-of ('technicalContactType'): at most one of 'technicalContactId', + * 'technicalContact' could be set. + */ + technicalContactId?: string + /** + * One-of ('technicalContactType'): at most one of 'technicalContactId', + * 'technicalContact' could be set. + */ + technicalContact?: NewContact +} + +export type RegistrarApiCheckContactsCompatibilityRequest = { + domains?: string[] + tlds?: string[] + /** + * One-of ('ownerContactType'): at most one of 'ownerContactId', + * 'ownerContact' could be set. + */ + ownerContactId?: string + /** + * One-of ('ownerContactType'): at most one of 'ownerContactId', + * 'ownerContact' could be set. + */ + ownerContact?: NewContact + /** + * One-of ('administrativeContactType'): at most one of + * 'administrativeContactId', 'administrativeContact' could be set. + */ + administrativeContactId?: string + /** + * One-of ('administrativeContactType'): at most one of + * 'administrativeContactId', 'administrativeContact' could be set. + */ + administrativeContact?: NewContact + /** + * One-of ('technicalContactType'): at most one of 'technicalContactId', + * 'technicalContact' could be set. + */ + technicalContactId?: string + /** + * One-of ('technicalContactType'): at most one of 'technicalContactId', + * 'technicalContact' could be set. + */ + technicalContact?: NewContact +} + +export type RegistrarApiCreateDomainHostRequest = { + domain: string + name: string + ips?: string[] +} + +export type RegistrarApiDeleteDomainHostRequest = { + domain: string + name: string +} + +export type RegistrarApiDeleteExternalDomainRequest = { + domain: string +} + +export type RegistrarApiDisableDomainAutoRenewRequest = { + domain: string +} + +export type RegistrarApiDisableDomainDNSSECRequest = { + domain: string +} + +export type RegistrarApiEnableDomainAutoRenewRequest = { + domain: string +} + +export type RegistrarApiEnableDomainDNSSECRequest = { + domain: string + dsRecord?: DSRecord +} + +export type RegistrarApiGetContactRequest = { + contactId: string +} + +export type RegistrarApiGetDomainAuthCodeRequest = { + domain: string +} + +export type RegistrarApiGetDomainRequest = { + domain: string +} + +export type RegistrarApiListContactsRequest = { + page?: number + pageSize?: number + domain?: string + projectId?: string + organizationId?: string + role?: ListContactsRequestRole + emailStatus?: ContactEmailStatus +} + +export type RegistrarApiListDomainHostsRequest = { + domain: string + page?: number + pageSize?: number +} + +export type RegistrarApiListDomainsRequest = { + page?: number + pageSize?: number + orderBy?: ListDomainsRequestOrderBy + registrar?: string + status?: DomainStatus + projectId?: string + organizationId?: string + isExternal?: boolean + domain?: string } -export type ListSSLCertificatesRequest = { - dnsZone: string +export type RegistrarApiListRenewableDomainsRequest = { page?: number pageSize?: number + orderBy?: ListRenewableDomainsRequestOrderBy projectId?: string -} - -export type DeleteSSLCertificateRequest = { - dnsZone: string -} - -export type GetDNSZoneTsigKeyRequest = { - dnsZone: string -} - -export type DeleteDNSZoneTsigKeyRequest = { - dnsZone: string + organizationId?: string } export type RegistrarApiListTasksRequest = { @@ -1073,40 +1141,24 @@ export type RegistrarApiListTasksRequest = { orderBy?: ListTasksRequestOrderBy } -export type RegistrarApiBuyDomainsRequest = { - domains: string[] - durationInYears: number +export type RegistrarApiListTldsRequest = { + /** Array of TLDs to return. */ + tlds?: string[] + /** Page number for the returned Projects. */ + page?: number + /** Maximum number of Project per page. */ + pageSize?: number + /** Sort order of the returned TLDs. */ + orderBy?: ListTldsRequestOrderBy +} + +export type RegistrarApiLockDomainTransferRequest = { + domain: string +} + +export type RegistrarApiRegisterExternalDomainRequest = { + domain: string projectId?: string - /** - * One-of ('ownerContactType'): at most one of 'ownerContactId', - * 'ownerContact' could be set. - */ - ownerContactId?: string - /** - * One-of ('ownerContactType'): at most one of 'ownerContactId', - * 'ownerContact' could be set. - */ - ownerContact?: NewContact - /** - * One-of ('administrativeContactType'): at most one of - * 'administrativeContactId', 'administrativeContact' could be set. - */ - administrativeContactId?: string - /** - * One-of ('administrativeContactType'): at most one of - * 'administrativeContactId', 'administrativeContact' could be set. - */ - administrativeContact?: NewContact - /** - * One-of ('technicalContactType'): at most one of 'technicalContactId', - * 'technicalContact' could be set. - */ - technicalContactId?: string - /** - * One-of ('technicalContactType'): at most one of 'technicalContactId', - * 'technicalContact' could be set. - */ - technicalContact?: NewContact } export type RegistrarApiRenewDomainsRequest = { @@ -1115,39 +1167,13 @@ export type RegistrarApiRenewDomainsRequest = { forceLateRenewal?: boolean } -export type RegistrarApiTransferInDomainRequest = { - domains: TransferInDomainRequestTransferRequest[] - projectId?: string - /** - * One-of ('ownerContactType'): at most one of 'ownerContactId', - * 'ownerContact' could be set. - */ - ownerContactId?: string - /** - * One-of ('ownerContactType'): at most one of 'ownerContactId', - * 'ownerContact' could be set. - */ - ownerContact?: NewContact - /** - * One-of ('administrativeContactType'): at most one of - * 'administrativeContactId', 'administrativeContact' could be set. - */ - administrativeContactId?: string - /** - * One-of ('administrativeContactType'): at most one of - * 'administrativeContactId', 'administrativeContact' could be set. - */ - administrativeContact?: NewContact - /** - * One-of ('technicalContactType'): at most one of 'technicalContactId', - * 'technicalContact' could be set. - */ - technicalContactId?: string - /** - * One-of ('technicalContactType'): at most one of 'technicalContactId', - * 'technicalContact' could be set. - */ - technicalContact?: NewContact +export type RegistrarApiSearchAvailableDomainsRequest = { + /** A list of domain to search, TLD is optional. */ + domains: string[] + /** Array of tlds to search on. */ + tlds?: string[] + /** Search exact match. */ + strictSearch: boolean } export type RegistrarApiTradeDomainRequest = { @@ -1165,18 +1191,9 @@ export type RegistrarApiTradeDomainRequest = { newOwnerContact?: NewContact } -export type RegistrarApiRegisterExternalDomainRequest = { - domain: string +export type RegistrarApiTransferInDomainRequest = { + domains: TransferInDomainRequestTransferRequest[] projectId?: string -} - -export type RegistrarApiDeleteExternalDomainRequest = { - domain: string -} - -export type RegistrarApiCheckContactsCompatibilityRequest = { - domains?: string[] - tlds?: string[] /** * One-of ('ownerContactType'): at most one of 'ownerContactId', * 'ownerContact' could be set. @@ -1209,18 +1226,8 @@ export type RegistrarApiCheckContactsCompatibilityRequest = { technicalContact?: NewContact } -export type RegistrarApiListContactsRequest = { - page?: number - pageSize?: number - domain?: string - projectId?: string - organizationId?: string - role?: ListContactsRequestRole - emailStatus?: ContactEmailStatus -} - -export type RegistrarApiGetContactRequest = { - contactId: string +export type RegistrarApiUnlockDomainTransferRequest = { + domain: string } export type RegistrarApiUpdateContactRequest = { @@ -1236,7 +1243,7 @@ export type RegistrarApiUpdateContactRequest = { country?: string vatIdentificationCode?: string companyIdentificationCode?: string - lang?: LanguageCode + lang?: StdLanguageCode resale?: boolean /** @deprecated */ questions?: UpdateContactRequestQuestion[] @@ -1247,28 +1254,10 @@ export type RegistrarApiUpdateContactRequest = { extensionNl?: ContactExtensionNL } -export type RegistrarApiListDomainsRequest = { - page?: number - pageSize?: number - orderBy?: ListDomainsRequestOrderBy - registrar?: string - status?: DomainStatus - projectId?: string - organizationId?: string - isExternal?: boolean - domain?: string -} - -export type RegistrarApiListRenewableDomainsRequest = { - page?: number - pageSize?: number - orderBy?: ListRenewableDomainsRequestOrderBy - projectId?: string - organizationId?: string -} - -export type RegistrarApiGetDomainRequest = { +export type RegistrarApiUpdateDomainHostRequest = { domain: string + name: string + ips?: string[] } export type RegistrarApiUpdateDomainRequest = { @@ -1305,74 +1294,55 @@ export type RegistrarApiUpdateDomainRequest = { administrativeContact?: NewContact } -export type RegistrarApiLockDomainTransferRequest = { - domain: string -} - -export type RegistrarApiUnlockDomainTransferRequest = { - domain: string -} - -export type RegistrarApiEnableDomainAutoRenewRequest = { - domain: string -} - -export type RegistrarApiDisableDomainAutoRenewRequest = { - domain: string -} - -export type RegistrarApiGetDomainAuthCodeRequest = { - domain: string -} - -export type RegistrarApiEnableDomainDNSSECRequest = { - domain: string - dsRecord?: DSRecord +export type RestoreDNSZoneVersionRequest = { + dnsZoneVersionId: string } -export type RegistrarApiDisableDomainDNSSECRequest = { - domain: string -} +export interface RestoreDNSZoneVersionResponse {} -export type RegistrarApiSearchAvailableDomainsRequest = { - /** A list of domain to search, TLD is optional. */ - domains: string[] - /** Array of tlds to search on. */ - tlds?: string[] - /** Search exact match. */ - strictSearch: boolean +export interface SearchAvailableDomainsResponse { + /** Array of available domains. */ + availableDomains: AvailableDomain[] } -export type RegistrarApiListTldsRequest = { - /** Array of TLDs to return. */ - tlds?: string[] - /** Page number for the returned Projects. */ - page?: number - /** Maximum number of Project per page. */ - pageSize?: number - /** Sort order of the returned TLDs. */ - orderBy?: ListTldsRequestOrderBy +export type UpdateDNSZoneNameserversRequest = { + /** DNS zone in which to update the DNS zone name servers. */ + dnsZone: string + /** New DNS zone name servers. */ + ns: Nameserver[] } -export type RegistrarApiCreateDomainHostRequest = { - domain: string - name: string - ips?: string[] +export interface UpdateDNSZoneNameserversResponse { + /** DNS zone name servers returned. */ + ns: Nameserver[] } -export type RegistrarApiListDomainHostsRequest = { - domain: string - page?: number - pageSize?: number +export type UpdateDNSZoneRecordsRequest = { + /** DNS zone in which to update the DNS zone records. */ + dnsZone: string + /** Changes made to the records. */ + changes: RecordChange[] + /** Specifies whether or not to return all the records. */ + returnAllRecords?: boolean + /** + * Disable the creation of the target zone if it does not exist. Target zone + * creation is disabled by default. + */ + disallowNewZoneCreation: boolean + /** Use the provided serial (0) instead of the auto-increment serial. */ + serial?: number } -export type RegistrarApiUpdateDomainHostRequest = { - domain: string - name: string - ips?: string[] +export interface UpdateDNSZoneRecordsResponse { + /** DNS zone records returned. */ + records: DomainRecord[] } -export type RegistrarApiDeleteDomainHostRequest = { - domain: string - name: string +export type UpdateDNSZoneRequest = { + /** DNS zone to update. */ + dnsZone: string + /** Name of the new DNS zone to create. */ + newDnsZone?: string + /** Project ID in which to create the new DNS zone. */ + projectId?: string } diff --git a/packages/clients/src/api/flexibleip/v1alpha1/api.gen.ts b/packages/clients/src/api/flexibleip/v1alpha1/api.gen.ts index a03521dcc..e692148e2 100644 --- a/packages/clients/src/api/flexibleip/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/flexibleip/v1alpha1/api.gen.ts @@ -129,7 +129,7 @@ export class API extends ParentAPI { request.zone ?? this.client.settings.defaultZone, )}/fips`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/flexibleip/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/flexibleip/v1alpha1/marshalling.gen.ts index d9e6d6b96..be953dc63 100644 --- a/packages/clients/src/api/flexibleip/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/flexibleip/v1alpha1/marshalling.gen.ts @@ -21,7 +21,7 @@ import type { UpdateFlexibleIPRequest, } from './types.gen' -const unmarshalMACAddress = (data: unknown) => { +const unmarshalMACAddress = (data: unknown): MACAddress => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'MACAddress' failed as data isn't a dictionary.`, @@ -39,7 +39,7 @@ const unmarshalMACAddress = (data: unknown) => { } as MACAddress } -export const unmarshalFlexibleIP = (data: unknown) => { +export const unmarshalFlexibleIP = (data: unknown): FlexibleIP => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'FlexibleIP' failed as data isn't a dictionary.`, @@ -65,7 +65,9 @@ export const unmarshalFlexibleIP = (data: unknown) => { } as FlexibleIP } -export const unmarshalAttachFlexibleIPsResponse = (data: unknown) => { +export const unmarshalAttachFlexibleIPsResponse = ( + data: unknown, +): AttachFlexibleIPsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'AttachFlexibleIPsResponse' failed as data isn't a dictionary.`, @@ -78,7 +80,9 @@ export const unmarshalAttachFlexibleIPsResponse = (data: unknown) => { } as AttachFlexibleIPsResponse } -export const unmarshalDetachFlexibleIPsResponse = (data: unknown) => { +export const unmarshalDetachFlexibleIPsResponse = ( + data: unknown, +): DetachFlexibleIPsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DetachFlexibleIPsResponse' failed as data isn't a dictionary.`, @@ -91,7 +95,9 @@ export const unmarshalDetachFlexibleIPsResponse = (data: unknown) => { } as DetachFlexibleIPsResponse } -export const unmarshalListFlexibleIPsResponse = (data: unknown) => { +export const unmarshalListFlexibleIPsResponse = ( + data: unknown, +): ListFlexibleIPsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListFlexibleIPsResponse' failed as data isn't a dictionary.`, diff --git a/packages/clients/src/api/flexibleip/v1alpha1/types.gen.ts b/packages/clients/src/api/flexibleip/v1alpha1/types.gen.ts index 8da08ca2c..17a506913 100644 --- a/packages/clients/src/api/flexibleip/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/flexibleip/v1alpha1/types.gen.ts @@ -23,23 +23,23 @@ export type MACAddressStatus = export type MACAddressType = 'unknown_type' | 'vmware' | 'xen' | 'kvm' -/** Attach flexible i ps response. */ -export interface AttachFlexibleIPsResponse { - /** Total count of flexible IPs that are being updated. */ - totalCount: number - /** List of flexible IPs in an updating state. */ - flexibleIps: FlexibleIP[] -} - -/** Detach flexible i ps response. */ -export interface DetachFlexibleIPsResponse { - /** Total count of flexible IPs that are being detached. */ - totalCount: number - /** List of flexible IPs in a detaching state. */ - flexibleIps: FlexibleIP[] +export interface MACAddress { + /** ID of the flexible IP. */ + id: string + /** MAC address of the Virtual MAC. */ + macAddress: string + /** Type of virtual MAC. */ + macType: MACAddressType + /** Status of virtual MAC. */ + status: MACAddressStatus + /** Date on which the virtual MAC was last updated. */ + updatedAt?: Date + /** Date on which the virtual MAC was created. */ + createdAt?: Date + /** MAC address IP Availability Zone. */ + zone: Zone } -/** Flexible ip. */ export interface FlexibleIP { /** ID of the flexible IP. */ id: string @@ -56,8 +56,6 @@ export interface FlexibleIP { /** Date on which the flexible IP was created. */ createdAt?: Date /** - * Flexible IP status. - * * - Ready : flexible IP is created and ready to be attached to a server or to * be associated with a virtual MAC. * - Updating: flexible IP is being attached to a server or a virtual MAC @@ -80,30 +78,23 @@ export interface FlexibleIP { zone: Zone } -/** List flexible i ps response. */ -export interface ListFlexibleIPsResponse { - /** Total count of matching flexible IPs. */ - totalCount: number - /** List of all flexible IPs. */ - flexibleIps: FlexibleIP[] +export type AttachFlexibleIPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** + * Multiple IDs can be provided, but note that flexible IPs must belong to the + * same MAC group (see details about MAC groups). + */ + fipsIds: string[] + /** ID of the server on which to attach the flexible IPs. */ + serverId: string } -/** Mac address. */ -export interface MACAddress { - /** ID of the flexible IP. */ - id: string - /** MAC address of the Virtual MAC. */ - macAddress: string - /** Type of virtual MAC. */ - macType: MACAddressType - /** Status of virtual MAC. */ - status: MACAddressStatus - /** Date on which the virtual MAC was last updated. */ - updatedAt?: Date - /** Date on which the virtual MAC was created. */ - createdAt?: Date - /** MAC address IP Availability Zone. */ - zone: Zone +export interface AttachFlexibleIPsResponse { + /** Total count of flexible IPs that are being updated. */ + totalCount: number + /** List of flexible IPs in an updating state. */ + flexibleIps: FlexibleIP[] } export type CreateFlexibleIPRequest = { @@ -123,56 +114,6 @@ export type CreateFlexibleIPRequest = { isIpv6: boolean } -export type GetFlexibleIPRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the flexible IP. */ - fipId: string -} - -export type ListFlexibleIPsRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Sort order of the returned flexible IPs. */ - orderBy?: ListFlexibleIPsRequestOrderBy - /** Page number. */ - page?: number - /** Maximum number of flexible IPs per page. */ - pageSize?: number - /** - * Filter by tag, only flexible IPs with one or more matching tags will be - * returned. - */ - tags?: string[] - /** Filter by status, only flexible IPs with this status will be returned. */ - status?: FlexibleIPStatus[] - /** - * Filter by server IDs, only flexible IPs with these server IDs will be - * returned. - */ - serverIds?: string[] - /** - * Filter by Organization ID, only flexible IPs from this Organization will be - * returned. - */ - organizationId?: string - /** Filter by Project ID, only flexible IPs from this Project will be returned. */ - projectId?: string -} - -export type UpdateFlexibleIPRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the flexible IP to update. */ - fipId: string - /** Flexible IP description (max. 255 characters). */ - description?: string - /** Tags associated with the flexible IP. */ - tags?: string[] - /** Value of the reverse DNS. */ - reverse?: string -} - export type DeleteFlexibleIPRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone @@ -180,17 +121,14 @@ export type DeleteFlexibleIPRequest = { fipId: string } -export type AttachFlexibleIPRequest = { +export type DeleteMACAddrRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone /** - * List of flexible IP IDs to attach to a server. Multiple IDs can be - * provided, but note that flexible IPs must belong to the same MAC group (see - * details about MAC groups). + * If the flexible IP belongs to a MAC group, the MAC will be removed from + * both the MAC group and flexible IP. */ - fipsIds: string[] - /** ID of the server on which to attach the flexible IPs. */ - serverId: string + fipId: string } export type DetachFlexibleIPRequest = { @@ -203,6 +141,22 @@ export type DetachFlexibleIPRequest = { fipsIds: string[] } +export interface DetachFlexibleIPsResponse { + /** Total count of flexible IPs that are being detached. */ + totalCount: number + /** List of flexible IPs in a detaching state. */ + flexibleIps: FlexibleIP[] +} + +export type DuplicateMACAddrRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Note that the flexible IPs need to be attached to the same server. */ + fipId: string + /** Note that flexible IPs need to be attached to the same server. */ + duplicateFromFipId: string +} + export type GenerateMACAddrRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone @@ -212,19 +166,48 @@ export type GenerateMACAddrRequest = { macType: MACAddressType } -export type DuplicateMACAddrRequest = { +export type GetFlexibleIPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the flexible IP. */ + fipId: string +} + +export type ListFlexibleIPsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone + /** Sort order of the returned flexible IPs. */ + orderBy?: ListFlexibleIPsRequestOrderBy + /** Page number. */ + page?: number + /** Maximum number of flexible IPs per page. */ + pageSize?: number /** - * ID of the flexible IP on which to duplicate the virtual MAC. Note that the - * flexible IPs need to be attached to the same server. + * Filter by tag, only flexible IPs with one or more matching tags will be + * returned. */ - fipId: string + tags?: string[] + /** Filter by status, only flexible IPs with this status will be returned. */ + status?: FlexibleIPStatus[] /** - * ID of the flexible IP to duplicate the Virtual MAC from. Note that flexible - * IPs need to be attached to the same server. + * Filter by server IDs, only flexible IPs with these server IDs will be + * returned. */ - duplicateFromFipId: string + serverIds?: string[] + /** + * Filter by Organization ID, only flexible IPs from this Organization will be + * returned. + */ + organizationId?: string + /** Filter by Project ID, only flexible IPs from this Project will be returned. */ + projectId?: string +} + +export interface ListFlexibleIPsResponse { + /** Total count of matching flexible IPs. */ + totalCount: number + /** List of all flexible IPs. */ + flexibleIps: FlexibleIP[] } export type MoveMACAddrRequest = { @@ -234,13 +217,15 @@ export type MoveMACAddrRequest = { dstFipId: string } -export type DeleteMACAddrRequest = { +export type UpdateFlexibleIPRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** - * ID of the flexible IP from which to delete the virtual MAC. If the flexible - * IP belongs to a MAC group, the MAC will be removed from both the MAC group - * and flexible IP. - */ + /** ID of the flexible IP to update. */ fipId: string + /** Flexible IP description (max. 255 characters). */ + description?: string + /** Tags associated with the flexible IP. */ + tags?: string[] + /** Value of the reverse DNS. */ + reverse?: string } diff --git a/packages/clients/src/api/function/v1beta1/api.gen.ts b/packages/clients/src/api/function/v1beta1/api.gen.ts index 57e425be3..53f2364d0 100644 --- a/packages/clients/src/api/function/v1beta1/api.gen.ts +++ b/packages/clients/src/api/function/v1beta1/api.gen.ts @@ -119,7 +119,7 @@ export class API extends ParentAPI { )}/namespaces`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -256,7 +256,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['name', request.name], ['namespace_id', request.namespaceId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -478,7 +478,7 @@ export class API extends ParentAPI { )}/crons`, urlParams: urlParams( ['function_id', request.functionId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -610,7 +610,7 @@ export class API extends ParentAPI { request.functionId, )}/logs`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'timestamp_desc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -641,7 +641,7 @@ export class API extends ParentAPI { )}/domains`, urlParams: urlParams( ['function_id', request.functionId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -760,14 +760,8 @@ export class API extends ParentAPI { ['expires_at', request.expiresAt], ...Object.entries( resolveOneOf([ - { - param: 'function_id', - value: request.functionId, - }, - { - param: 'namespace_id', - value: request.namespaceId, - }, + { param: 'function_id', value: request.functionId }, + { param: 'namespace_id', value: request.namespaceId }, ]), ), ), @@ -846,7 +840,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['function_id', request.functionId], ['namespace_id', request.namespaceId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -955,7 +949,7 @@ export class API extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/triggers`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -963,19 +957,13 @@ export class API extends ParentAPI { ], ...Object.entries( resolveOneOf([ + { param: 'function_id', value: request.functionId }, + { param: 'namespace_id', value: request.namespaceId }, { default: this.client.settings.defaultProjectId, param: 'project_id', value: request.projectId, }, - { - param: 'function_id', - value: request.functionId, - }, - { - param: 'namespace_id', - value: request.namespaceId, - }, ]), ), ), diff --git a/packages/clients/src/api/function/v1beta1/index.gen.ts b/packages/clients/src/api/function/v1beta1/index.gen.ts index cb35e2ae9..117c9b786 100644 --- a/packages/clients/src/api/function/v1beta1/index.gen.ts +++ b/packages/clients/src/api/function/v1beta1/index.gen.ts @@ -65,7 +65,6 @@ export type { LogStream, Namespace, NamespaceStatus, - NullValue, Runtime, RuntimeStatus, Secret, diff --git a/packages/clients/src/api/iam/v1alpha1/api.gen.ts b/packages/clients/src/api/iam/v1alpha1/api.gen.ts index 415033c90..60a3b2dd7 100644 --- a/packages/clients/src/api/iam/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/api.gen.ts @@ -128,7 +128,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['disabled', request.disabled], ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -239,7 +239,7 @@ export class API extends ParentAPI { path: `/iam/v1alpha1/users`, urlParams: urlParams( ['mfa', request.mfa], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], [ 'organization_id', request.organizationId ?? @@ -338,7 +338,7 @@ export class API extends ParentAPI { ['application_ids', request.applicationIds], ['editable', request.editable], ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], [ 'organization_id', request.organizationId ?? @@ -458,8 +458,12 @@ export class API extends ParentAPI { ['application_ids', request.applicationIds], ['group_ids', request.groupIds], ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], - ['organization_id', request.organizationId], + ['order_by', request.orderBy], + [ + 'organization_id', + request.organizationId ?? + this.client.settings.defaultOrganizationId, + ], ['page', request.page], [ 'page_size', @@ -678,7 +682,7 @@ export class API extends ParentAPI { ['editable', request.editable], ['group_ids', request.groupIds], ['no_principal', request.noPrincipal], - ['order_by', request.orderBy ?? 'policy_name_asc'], + ['order_by', request.orderBy], [ 'organization_id', request.organizationId ?? @@ -876,7 +880,7 @@ export class API extends ParentAPI { method: 'GET', path: `/iam/v1alpha1/permission-sets`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], [ 'organization_id', request.organizationId ?? @@ -915,11 +919,11 @@ export class API extends ParentAPI { urlParams: urlParams( ['access_key', request.accessKey], ['bearer_id', request.bearerId], - ['bearer_type', request.bearerType ?? 'unknown_bearer_type'], + ['bearer_type', request.bearerType], ['description', request.description], ['editable', request.editable], ['expired', request.expired], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], [ 'organization_id', request.organizationId ?? @@ -932,14 +936,8 @@ export class API extends ParentAPI { ], ...Object.entries( resolveOneOf([ - { - param: 'application_id', - value: request.applicationId, - }, - { - param: 'user_id', - value: request.userId, - }, + { param: 'application_id', value: request.applicationId }, + { param: 'user_id', value: request.userId }, ]), ), ), @@ -1051,7 +1049,7 @@ export class API extends ParentAPI { method: 'GET', path: `/iam/v1alpha1/quota`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], [ 'organization_id', request.organizationId ?? @@ -1104,7 +1102,7 @@ export class API extends ParentAPI { unmarshalQuotum, ) - protected pageOfListJWTs = (request: Readonly) => + protected pageOfListJWTs = (request: Readonly = {}) => this.client.fetch( { method: 'GET', @@ -1112,7 +1110,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['audience_id', request.audienceId], ['expired', request.expired], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -1129,7 +1127,7 @@ export class API extends ParentAPI { * @param request - The request {@link ListJWTsRequest} * @returns A Promise of ListJWTsResponse */ - listJWTs = (request: Readonly) => + listJWTs = (request: Readonly = {}) => enrichForPagination('jwts', this.pageOfListJWTs, request) /** diff --git a/packages/clients/src/api/instance/v1/api.gen.ts b/packages/clients/src/api/instance/v1/api.gen.ts index a4bf9958d..a6dec3490 100644 --- a/packages/clients/src/api/instance/v1/api.gen.ts +++ b/packages/clients/src/api/instance/v1/api.gen.ts @@ -103,6 +103,7 @@ import type { CreateSecurityGroupResponse, CreateSecurityGroupRuleRequest, CreateSecurityGroupRuleResponse, + CreateServerRequest, CreateServerResponse, CreateSnapshotRequest, CreateSnapshotResponse, @@ -180,6 +181,7 @@ import type { PrivateNIC, ServerActionRequest, ServerActionResponse, + SetImageRequest, SetPlacementGroupRequest, SetPlacementGroupResponse, SetPlacementGroupServersRequest, @@ -193,13 +195,12 @@ import type { UpdatePlacementGroupServersRequest, UpdatePlacementGroupServersResponse, UpdatePrivateNICRequest, + UpdateServerRequest, UpdateServerResponse, UpdateVolumeRequest, UpdateVolumeResponse, } from './types.gen' import type { - CreateServerRequest, - SetImageRequest, SetImageResponse, SetSecurityGroupRequest, SetSecurityGroupResponse, @@ -209,7 +210,6 @@ import type { SetServerResponse, SetSnapshotRequest, SetSnapshotResponse, - UpdateServerRequest, } from './types.private.gen' const jsonContentHeaders = { diff --git a/packages/clients/src/api/instance/v1/api.utils.ts b/packages/clients/src/api/instance/v1/api.utils.ts index ab522b09b..881f1e71f 100644 --- a/packages/clients/src/api/instance/v1/api.utils.ts +++ b/packages/clients/src/api/instance/v1/api.utils.ts @@ -15,6 +15,7 @@ import { import { unmarshalSetImageResponse } from './marshalling.gen' import { marshalSetImageRequestWithID } from './marshalling.utils' import type { + CreateServerRequest, GetImageRequest, GetPrivateNICRequest, GetServerRequest, @@ -26,6 +27,7 @@ import type { ServerActionRequest, ServerState, Snapshot, + UpdateServerRequest, Volume, VolumeServerTemplate, } from './types.gen' @@ -36,7 +38,6 @@ import type { import type { AttachVolumeRequest, AttachVolumeResponse, - CreateServerRequest, DetachVolumeRequest, DetachVolumeResponse, GetServerUserDataRequest, @@ -47,7 +48,6 @@ import type { UpdateSecurityGroupResponse, UpdateSecurityGroupRuleRequest, UpdateSecurityGroupRuleResponse, - UpdateServerRequest, UpdateSnapshotRequest, UpdateSnapshotResponse, } from './types.utils' diff --git a/packages/clients/src/api/instance/v1/index.gen.ts b/packages/clients/src/api/instance/v1/index.gen.ts index 1c55d17f7..44a39ae20 100644 --- a/packages/clients/src/api/instance/v1/index.gen.ts +++ b/packages/clients/src/api/instance/v1/index.gen.ts @@ -19,6 +19,7 @@ export type { CreateSecurityGroupResponse, CreateSecurityGroupRuleRequest, CreateSecurityGroupRuleResponse, + CreateServerRequest, CreateServerResponse, CreateSnapshotRequest, CreateSnapshotResponse, @@ -137,6 +138,7 @@ export type { ServerTypeVolumeConstraintSizes, ServerTypeVolumeConstraintsByType, ServerTypesAvailability, + SetImageRequest, SetPlacementGroupRequest, SetPlacementGroupResponse, SetPlacementGroupServersRequest, @@ -157,6 +159,7 @@ export type { UpdatePlacementGroupServersRequest, UpdatePlacementGroupServersResponse, UpdatePrivateNICRequest, + UpdateServerRequest, UpdateServerResponse, UpdateVolumeRequest, UpdateVolumeResponse, diff --git a/packages/clients/src/api/instance/v1/marshalling.utils.ts b/packages/clients/src/api/instance/v1/marshalling.utils.ts index 9d7f7cc8d..49f0d59f4 100644 --- a/packages/clients/src/api/instance/v1/marshalling.utils.ts +++ b/packages/clients/src/api/instance/v1/marshalling.utils.ts @@ -2,10 +2,10 @@ import { type DefaultValues } from '../../../bridge' import type { Bootscript, ServerSummary, + SetImageRequest, Volume, VolumeSummary, } from './types.gen' -import type { SetImageRequest } from './types.private.gen' const marshalVolumeSummary = ( request: VolumeSummary, diff --git a/packages/clients/src/api/instance/v1/types.private.gen.ts b/packages/clients/src/api/instance/v1/types.private.gen.ts index 2c87396c7..025365a55 100644 --- a/packages/clients/src/api/instance/v1/types.private.gen.ts +++ b/packages/clients/src/api/instance/v1/types.private.gen.ts @@ -6,7 +6,6 @@ import type { BootType, Bootscript, Image, - ImageState, PlacementGroup, PrivateNIC, SecurityGroup, @@ -16,7 +15,6 @@ import type { SecurityGroupRuleDirection, SecurityGroupRuleProtocol, SecurityGroupSummary, - SecurityGroupTemplate, Server, ServerAction, ServerIp, @@ -29,80 +27,73 @@ import type { SnapshotBaseVolume, SnapshotState, Volume, - VolumeServerTemplate, - VolumeSummary, VolumeVolumeType, } from './types.gen' -/** Set image response. */ + export interface SetImageResponse { image?: Image } -/** Set security group response. */ -export interface SetSecurityGroupResponse { - securityGroup?: SecurityGroup -} - -/** Set security group rule response. */ -export interface SetSecurityGroupRuleResponse { - rule?: SecurityGroupRule -} - -/** Set server response. */ -export interface SetServerResponse { - server?: Server -} - -/** Set snapshot response. */ -export interface SetSnapshotResponse { - snapshot?: Snapshot -} - -export type CreateServerRequest = { +export type SetSecurityGroupRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Instance name. */ - name?: string - /** Define if a dynamic IPv4 is required for the Instance. */ - dynamicIpRequired?: boolean - /** If true, configure the Instance so it uses the new routed IP mode. */ - routedIpEnabled?: boolean - /** Define the Instance commercial type (i.e. GP1-S). */ - commercialType: string - /** Instance image ID or label. */ - image: string - /** Volumes attached to the server. */ - volumes?: Record - /** True if IPv6 is enabled on the server. */ - enableIpv6: boolean - /** ID of the reserved IP to attach to the Instance. */ - publicIp?: string - /** A list of reserved IP IDs to attach to the Instance. */ - publicIps?: string[] - /** Boot type to use. */ - bootType?: BootType - /** @deprecated Bootscript ID to use when `boot_type` is set to `bootscript`. */ - bootscript?: string + /** ID of the security group (will be ignored). */ + id: string + /** Name of the security group. */ + name: string + /** Tags of the security group. */ + tags?: string[] + /** Creation date of the security group (will be ignored). */ + creationDate?: Date + /** Modification date of the security group (will be ignored). */ + modificationDate?: Date + /** Description of the security group. */ + description: string /** - * @deprecated Instance Organization ID. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. + * True to block SMTP on IPv4 and IPv6. This feature is read only, please open + * a support ticket if you need to make it configurable. */ + enableDefaultSecurity: boolean + /** Default inbound policy. */ + inboundDefaultPolicy?: SecurityGroupPolicy + /** Default outbound policy. */ + outboundDefaultPolicy?: SecurityGroupPolicy + /** Security groups Organization ID. */ organization?: string - /** - * Instance Project ID. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ + /** Security group Project ID. */ project?: string - /** Instance tags. */ - tags?: string[] - /** Security group ID. */ - securityGroup?: string - /** Placement group ID if Instance must be part of a placement group. */ - placementGroup?: string + /** @deprecated Please use project_default instead. */ + organizationDefault?: boolean + /** True use this security group for future Instances created in this project. */ + projectDefault: boolean + /** Instances attached to this security group. */ + servers?: ServerSummary[] + /** True to set the security group as stateful. */ + stateful: boolean +} + +export interface SetSecurityGroupResponse { + securityGroup?: SecurityGroup +} + +export type SetSecurityGroupRuleRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + securityGroupId: string + securityGroupRuleId: string + id: string + protocol?: SecurityGroupRuleProtocol + direction?: SecurityGroupRuleDirection + action?: SecurityGroupRuleAction + ipRange: string + destPortFrom?: number + destPortTo?: number + position: number + editable: boolean +} + +export interface SetSecurityGroupRuleResponse { + rule?: SecurityGroupRule } export type SetServerRequest = { @@ -176,66 +167,8 @@ export type SetServerRequest = { privateNics?: PrivateNIC[] } -export type UpdateServerRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the Instance. */ - serverId: string - /** Name of the Instance. */ - name?: string - bootType?: BootType - /** Tags of the Instance. */ - tags?: string[] - volumes?: Record - /** @deprecated */ - bootscript?: string - dynamicIpRequired?: boolean - /** - * True to configure the instance so it uses the new routed IP mode (once this - * is set to True you cannot set it back to False). - */ - routedIpEnabled?: boolean - /** A list of reserved IP IDs to attach to the Instance. */ - publicIps?: string[] - enableIpv6?: boolean - protected?: boolean - securityGroup?: SecurityGroupTemplate - /** Placement group ID if Instance must be part of a placement group. */ - placementGroup?: string | null - /** Instance private NICs. */ - privateNics?: string[] - /** - * Set the commercial_type for this Instance. Warning: This field has some - * restrictions: - * - * - Cannot be changed if the Instance is not in `stopped` state. - * - Cannot be changed if the Instance is in a placement group. - * - Local storage requirements of the target commercial_types must be fulfilled - * (i.e. if an Instance has 80GB of local storage, it can be changed into a - * GP1-XS, which has a maximum of 150GB, but it cannot be changed into a - * DEV1-S, which has only 20GB). - */ - commercialType?: string -} - -export type SetImageRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - id: string - name: string - arch?: Arch - creationDate?: Date - modificationDate?: Date - /** @deprecated */ - defaultBootscript?: Bootscript - extraVolumes?: Record - fromServer: string - organization?: string - public: boolean - rootVolume?: VolumeSummary - state?: ImageState - project?: string - tags?: string[] +export interface SetServerResponse { + server?: Server } export type SetSnapshotRequest = { @@ -255,56 +188,6 @@ export type SetSnapshotRequest = { tags?: string[] } -export type SetSecurityGroupRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the security group (will be ignored). */ - id: string - /** Name of the security group. */ - name: string - /** Tags of the security group. */ - tags?: string[] - /** Creation date of the security group (will be ignored). */ - creationDate?: Date - /** Modification date of the security group (will be ignored). */ - modificationDate?: Date - /** Description of the security group. */ - description: string - /** - * True to block SMTP on IPv4 and IPv6. This feature is read only, please open - * a support ticket if you need to make it configurable. - */ - enableDefaultSecurity: boolean - /** Default inbound policy. */ - inboundDefaultPolicy?: SecurityGroupPolicy - /** Default outbound policy. */ - outboundDefaultPolicy?: SecurityGroupPolicy - /** Security groups Organization ID. */ - organization?: string - /** Security group Project ID. */ - project?: string - /** @deprecated Please use project_default instead. */ - organizationDefault?: boolean - /** True use this security group for future Instances created in this project. */ - projectDefault: boolean - /** Instances attached to this security group. */ - servers?: ServerSummary[] - /** True to set the security group as stateful. */ - stateful: boolean -} - -export type SetSecurityGroupRuleRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - securityGroupId: string - securityGroupRuleId: string - id: string - protocol?: SecurityGroupRuleProtocol - direction?: SecurityGroupRuleDirection - action?: SecurityGroupRuleAction - ipRange: string - destPortFrom?: number - destPortTo?: number - position: number - editable: boolean +export interface SetSnapshotResponse { + snapshot?: Snapshot } diff --git a/packages/clients/src/api/instance/v1/types.utils.ts b/packages/clients/src/api/instance/v1/types.utils.ts index 3d917bf32..a9924af4f 100644 --- a/packages/clients/src/api/instance/v1/types.utils.ts +++ b/packages/clients/src/api/instance/v1/types.utils.ts @@ -123,8 +123,3 @@ export type SetServerUserDataRequest = { /** The data encoded in base64 */ content: string } - -export type { - CreateServerRequest, - UpdateServerRequest, -} from './types.private.gen' diff --git a/packages/clients/src/api/iot/v1/api.gen.ts b/packages/clients/src/api/iot/v1/api.gen.ts index ddc998061..5c71156e9 100644 --- a/packages/clients/src/api/iot/v1/api.gen.ts +++ b/packages/clients/src/api/iot/v1/api.gen.ts @@ -104,7 +104,7 @@ const jsonContentHeaders = { /** * IoT Hub API. * - * This API allows you to manage IoT hubs and devices. IoT Hub API. + * This API allows you to manage IoT hubs and devices. */ export class API extends ParentAPI { /** Lists the available regions of the API. */ @@ -120,7 +120,7 @@ export class API extends ParentAPI { )}/hubs`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -360,13 +360,13 @@ export class API extends ParentAPI { ['allow_insecure', request.allowInsecure], ['hub_id', request.hubId], ['name', request.name], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', request.pageSize ?? this.client.settings.defaultPageSize, ], - ['status', request.status ?? 'unknown'], + ['status', request.status], ), }, unmarshalListDevicesResponse, @@ -608,7 +608,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['hub_id', request.hubId], ['name', request.name], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -639,7 +639,7 @@ export class API extends ParentAPI { * MQTT messages. * - S3 Routes. Create a route that will put subscribed MQTT messages into an S3 * bucket. You need to create the bucket yourself and grant write access. - * Granting can be done with s3cmd (`s3cmd setacl s3://<my-bucket> + * Granting can be done with s3cmd (`s3cmd setacl s3:// * --acl-grant=write:555c69c3-87d0-4bf8-80f1-99a2f757d031:555c69c3-87d0-4bf8-80f1-99a2f757d031`). * * @param request - The request {@link CreateRouteRequest} @@ -732,7 +732,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['hub_id', request.hubId], ['name', request.name], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', diff --git a/packages/clients/src/api/iot/v1/index.gen.ts b/packages/clients/src/api/iot/v1/index.gen.ts index f441e2610..4ed403b2d 100644 --- a/packages/clients/src/api/iot/v1/index.gen.ts +++ b/packages/clients/src/api/iot/v1/index.gen.ts @@ -62,7 +62,6 @@ export type { ListTwinDocumentsResponseDocumentSummary, Network, NetworkNetworkType, - NullValue, PatchTwinDocumentRequest, PutTwinDocumentRequest, RenewDeviceCertificateRequest, diff --git a/packages/clients/src/api/iot/v1/marshalling.gen.ts b/packages/clients/src/api/iot/v1/marshalling.gen.ts index 6eb283dbd..f13ce3444 100644 --- a/packages/clients/src/api/iot/v1/marshalling.gen.ts +++ b/packages/clients/src/api/iot/v1/marshalling.gen.ts @@ -56,7 +56,9 @@ import type { UpdateRouteRequestS3Config, } from './types.gen' -const unmarshalDeviceMessageFiltersRule = (data: unknown) => { +const unmarshalDeviceMessageFiltersRule = ( + data: unknown, +): DeviceMessageFiltersRule => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DeviceMessageFiltersRule' failed as data isn't a dictionary.`, @@ -69,7 +71,7 @@ const unmarshalDeviceMessageFiltersRule = (data: unknown) => { } as DeviceMessageFiltersRule } -const unmarshalDeviceMessageFilters = (data: unknown) => { +const unmarshalDeviceMessageFilters = (data: unknown): DeviceMessageFilters => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DeviceMessageFilters' failed as data isn't a dictionary.`, @@ -86,27 +88,7 @@ const unmarshalDeviceMessageFilters = (data: unknown) => { } as DeviceMessageFilters } -const unmarshalHubTwinsGraphiteConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'HubTwinsGraphiteConfig' failed as data isn't a dictionary.`, - ) - } - - return { pushUri: data.push_uri } as HubTwinsGraphiteConfig -} - -const unmarshalCertificate = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Certificate' failed as data isn't a dictionary.`, - ) - } - - return { crt: data.crt, key: data.key } as Certificate -} - -export const unmarshalDevice = (data: unknown) => { +export const unmarshalDevice = (data: unknown): Device => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Device' failed as data isn't a dictionary.`, @@ -132,50 +114,7 @@ export const unmarshalDevice = (data: unknown) => { } as Device } -export const unmarshalHub = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Hub' failed as data isn't a dictionary.`, - ) - } - - return { - connectedDeviceCount: data.connected_device_count, - createdAt: unmarshalDate(data.created_at), - deviceCount: data.device_count, - disableEvents: data.disable_events, - enabled: data.enabled, - enableDeviceAutoProvisioning: data.enable_device_auto_provisioning, - endpoint: data.endpoint, - eventsTopicPrefix: data.events_topic_prefix, - hasCustomCa: data.has_custom_ca, - id: data.id, - name: data.name, - organizationId: data.organization_id, - productPlan: data.product_plan, - projectId: data.project_id, - region: data.region, - status: data.status, - twinsGraphiteConfig: data.twins_graphite_config - ? unmarshalHubTwinsGraphiteConfig(data.twins_graphite_config) - : undefined, - updatedAt: unmarshalDate(data.updated_at), - } as Hub -} - -const unmarshalListTwinDocumentsResponseDocumentSummary = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ListTwinDocumentsResponseDocumentSummary' failed as data isn't a dictionary.`, - ) - } - - return { - documentName: data.document_name, - } as ListTwinDocumentsResponseDocumentSummary -} - -export const unmarshalNetwork = (data: unknown) => { +export const unmarshalNetwork = (data: unknown): Network => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Network' failed as data isn't a dictionary.`, @@ -193,72 +132,67 @@ export const unmarshalNetwork = (data: unknown) => { } as Network } -const unmarshalRouteDatabaseConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'RouteDatabaseConfig' failed as data isn't a dictionary.`, - ) - } - - return { - dbname: data.dbname, - engine: data.engine, - host: data.host, - password: data.password, - port: data.port, - query: data.query, - username: data.username, - } as RouteDatabaseConfig -} - -const unmarshalRouteRestConfig = (data: unknown) => { +const unmarshalHubTwinsGraphiteConfig = ( + data: unknown, +): HubTwinsGraphiteConfig => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RouteRestConfig' failed as data isn't a dictionary.`, + `Unmarshalling the type 'HubTwinsGraphiteConfig' failed as data isn't a dictionary.`, ) } return { - headers: data.headers, - uri: data.uri, - verb: data.verb, - } as RouteRestConfig + pushUri: data.push_uri, + } as HubTwinsGraphiteConfig } -const unmarshalRouteS3Config = (data: unknown) => { +export const unmarshalHub = (data: unknown): Hub => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RouteS3Config' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Hub' failed as data isn't a dictionary.`, ) } return { - bucketName: data.bucket_name, - bucketRegion: data.bucket_region, - objectPrefix: data.object_prefix, - strategy: data.strategy, - } as RouteS3Config + connectedDeviceCount: data.connected_device_count, + createdAt: unmarshalDate(data.created_at), + deviceCount: data.device_count, + disableEvents: data.disable_events, + enableDeviceAutoProvisioning: data.enable_device_auto_provisioning, + enabled: data.enabled, + endpoint: data.endpoint, + eventsTopicPrefix: data.events_topic_prefix, + hasCustomCa: data.has_custom_ca, + id: data.id, + name: data.name, + organizationId: data.organization_id, + productPlan: data.product_plan, + projectId: data.project_id, + region: data.region, + status: data.status, + twinsGraphiteConfig: data.twins_graphite_config + ? unmarshalHubTwinsGraphiteConfig(data.twins_graphite_config) + : undefined, + updatedAt: unmarshalDate(data.updated_at), + } as Hub } -const unmarshalRouteSummary = (data: unknown) => { +const unmarshalCertificate = (data: unknown): Certificate => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RouteSummary' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Certificate' failed as data isn't a dictionary.`, ) } return { - createdAt: unmarshalDate(data.created_at), - hubId: data.hub_id, - id: data.id, - name: data.name, - topic: data.topic, - type: data.type, - updatedAt: unmarshalDate(data.updated_at), - } as RouteSummary + crt: data.crt, + key: data.key, + } as Certificate } -export const unmarshalCreateDeviceResponse = (data: unknown) => { +export const unmarshalCreateDeviceResponse = ( + data: unknown, +): CreateDeviceResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'CreateDeviceResponse' failed as data isn't a dictionary.`, @@ -273,7 +207,9 @@ export const unmarshalCreateDeviceResponse = (data: unknown) => { } as CreateDeviceResponse } -export const unmarshalCreateNetworkResponse = (data: unknown) => { +export const unmarshalCreateNetworkResponse = ( + data: unknown, +): CreateNetworkResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'CreateNetworkResponse' failed as data isn't a dictionary.`, @@ -286,7 +222,9 @@ export const unmarshalCreateNetworkResponse = (data: unknown) => { } as CreateNetworkResponse } -export const unmarshalGetDeviceCertificateResponse = (data: unknown) => { +export const unmarshalGetDeviceCertificateResponse = ( + data: unknown, +): GetDeviceCertificateResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetDeviceCertificateResponse' failed as data isn't a dictionary.`, @@ -299,7 +237,9 @@ export const unmarshalGetDeviceCertificateResponse = (data: unknown) => { } as GetDeviceCertificateResponse } -export const unmarshalGetDeviceMetricsResponse = (data: unknown) => { +export const unmarshalGetDeviceMetricsResponse = ( + data: unknown, +): GetDeviceMetricsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetDeviceMetricsResponse' failed as data isn't a dictionary.`, @@ -311,17 +251,21 @@ export const unmarshalGetDeviceMetricsResponse = (data: unknown) => { } as GetDeviceMetricsResponse } -export const unmarshalGetHubCAResponse = (data: unknown) => { +export const unmarshalGetHubCAResponse = (data: unknown): GetHubCAResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetHubCAResponse' failed as data isn't a dictionary.`, ) } - return { caCertPem: data.ca_cert_pem } as GetHubCAResponse + return { + caCertPem: data.ca_cert_pem, + } as GetHubCAResponse } -export const unmarshalGetHubMetricsResponse = (data: unknown) => { +export const unmarshalGetHubMetricsResponse = ( + data: unknown, +): GetHubMetricsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetHubMetricsResponse' failed as data isn't a dictionary.`, @@ -333,7 +277,9 @@ export const unmarshalGetHubMetricsResponse = (data: unknown) => { } as GetHubMetricsResponse } -export const unmarshalListDevicesResponse = (data: unknown) => { +export const unmarshalListDevicesResponse = ( + data: unknown, +): ListDevicesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDevicesResponse' failed as data isn't a dictionary.`, @@ -346,7 +292,7 @@ export const unmarshalListDevicesResponse = (data: unknown) => { } as ListDevicesResponse } -export const unmarshalListHubsResponse = (data: unknown) => { +export const unmarshalListHubsResponse = (data: unknown): ListHubsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListHubsResponse' failed as data isn't a dictionary.`, @@ -359,7 +305,9 @@ export const unmarshalListHubsResponse = (data: unknown) => { } as ListHubsResponse } -export const unmarshalListNetworksResponse = (data: unknown) => { +export const unmarshalListNetworksResponse = ( + data: unknown, +): ListNetworksResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNetworksResponse' failed as data isn't a dictionary.`, @@ -372,7 +320,27 @@ export const unmarshalListNetworksResponse = (data: unknown) => { } as ListNetworksResponse } -export const unmarshalListRoutesResponse = (data: unknown) => { +const unmarshalRouteSummary = (data: unknown): RouteSummary => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RouteSummary' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + hubId: data.hub_id, + id: data.id, + name: data.name, + topic: data.topic, + type: data.type, + updatedAt: unmarshalDate(data.updated_at), + } as RouteSummary +} + +export const unmarshalListRoutesResponse = ( + data: unknown, +): ListRoutesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListRoutesResponse' failed as data isn't a dictionary.`, @@ -385,7 +353,23 @@ export const unmarshalListRoutesResponse = (data: unknown) => { } as ListRoutesResponse } -export const unmarshalListTwinDocumentsResponse = (data: unknown) => { +const unmarshalListTwinDocumentsResponseDocumentSummary = ( + data: unknown, +): ListTwinDocumentsResponseDocumentSummary => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListTwinDocumentsResponseDocumentSummary' failed as data isn't a dictionary.`, + ) + } + + return { + documentName: data.document_name, + } as ListTwinDocumentsResponseDocumentSummary +} + +export const unmarshalListTwinDocumentsResponse = ( + data: unknown, +): ListTwinDocumentsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListTwinDocumentsResponse' failed as data isn't a dictionary.`, @@ -400,7 +384,9 @@ export const unmarshalListTwinDocumentsResponse = (data: unknown) => { } as ListTwinDocumentsResponse } -export const unmarshalRenewDeviceCertificateResponse = (data: unknown) => { +export const unmarshalRenewDeviceCertificateResponse = ( + data: unknown, +): RenewDeviceCertificateResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'RenewDeviceCertificateResponse' failed as data isn't a dictionary.`, @@ -415,7 +401,54 @@ export const unmarshalRenewDeviceCertificateResponse = (data: unknown) => { } as RenewDeviceCertificateResponse } -export const unmarshalRoute = (data: unknown) => { +const unmarshalRouteDatabaseConfig = (data: unknown): RouteDatabaseConfig => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RouteDatabaseConfig' failed as data isn't a dictionary.`, + ) + } + + return { + dbname: data.dbname, + engine: data.engine, + host: data.host, + password: data.password, + port: data.port, + query: data.query, + username: data.username, + } as RouteDatabaseConfig +} + +const unmarshalRouteRestConfig = (data: unknown): RouteRestConfig => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RouteRestConfig' failed as data isn't a dictionary.`, + ) + } + + return { + headers: data.headers, + uri: data.uri, + verb: data.verb, + } as RouteRestConfig +} + +const unmarshalRouteS3Config = (data: unknown): RouteS3Config => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RouteS3Config' failed as data isn't a dictionary.`, + ) + } + + return { + bucketName: data.bucket_name, + bucketRegion: data.bucket_region, + objectPrefix: data.object_prefix, + strategy: data.strategy, + } as RouteS3Config +} + +export const unmarshalRoute = (data: unknown): Route => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Route' failed as data isn't a dictionary.`, @@ -442,7 +475,9 @@ export const unmarshalRoute = (data: unknown) => { } as Route } -export const unmarshalSetDeviceCertificateResponse = (data: unknown) => { +export const unmarshalSetDeviceCertificateResponse = ( + data: unknown, +): SetDeviceCertificateResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetDeviceCertificateResponse' failed as data isn't a dictionary.`, @@ -455,7 +490,7 @@ export const unmarshalSetDeviceCertificateResponse = (data: unknown) => { } as SetDeviceCertificateResponse } -export const unmarshalTwinDocument = (data: unknown) => { +export const unmarshalTwinDocument = (data: unknown): TwinDocument => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'TwinDocument' failed as data isn't a dictionary.`, @@ -478,59 +513,74 @@ const marshalDeviceMessageFiltersRule = ( topics: request.topics, }) -const marshalCreateRouteRequestDatabaseConfig = ( - request: CreateRouteRequestDatabaseConfig, +const marshalDeviceMessageFilters = ( + request: DeviceMessageFilters, defaults: DefaultValues, ): Record => ({ - dbname: request.dbname, - engine: request.engine, - host: request.host, - password: request.password, - port: request.port, - query: request.query, - username: request.username, + publish: + request.publish !== undefined + ? marshalDeviceMessageFiltersRule(request.publish, defaults) + : undefined, + subscribe: + request.subscribe !== undefined + ? marshalDeviceMessageFiltersRule(request.subscribe, defaults) + : undefined, }) -const marshalCreateRouteRequestRestConfig = ( - request: CreateRouteRequestRestConfig, +export const marshalCreateDeviceRequest = ( + request: CreateDeviceRequest, defaults: DefaultValues, ): Record => ({ - headers: request.headers, - uri: request.uri, - verb: request.verb, + allow_insecure: request.allowInsecure, + allow_multiple_connections: request.allowMultipleConnections, + description: request.description, + hub_id: request.hubId, + message_filters: + request.messageFilters !== undefined + ? marshalDeviceMessageFilters(request.messageFilters, defaults) + : undefined, + name: request.name || randomName('device'), }) -const marshalCreateRouteRequestS3Config = ( - request: CreateRouteRequestS3Config, +const marshalHubTwinsGraphiteConfig = ( + request: HubTwinsGraphiteConfig, defaults: DefaultValues, ): Record => ({ - bucket_name: request.bucketName, - bucket_region: request.bucketRegion, - object_prefix: request.objectPrefix, - strategy: request.strategy, + push_uri: request.pushUri, }) -const marshalDeviceMessageFilters = ( - request: DeviceMessageFilters, +export const marshalCreateHubRequest = ( + request: CreateHubRequest, defaults: DefaultValues, ): Record => ({ - publish: request.publish - ? marshalDeviceMessageFiltersRule(request.publish, defaults) - : undefined, - subscribe: request.subscribe - ? marshalDeviceMessageFiltersRule(request.subscribe, defaults) - : undefined, + disable_events: request.disableEvents, + events_topic_prefix: request.eventsTopicPrefix, + name: request.name || randomName('hub'), + product_plan: request.productPlan, + project_id: request.projectId ?? defaults.defaultProjectId, + ...resolveOneOf([ + { + param: 'twins_graphite_config', + value: + request.twinsGraphiteConfig !== undefined + ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig, defaults) + : undefined, + }, + ]), }) -const marshalHubTwinsGraphiteConfig = ( - request: HubTwinsGraphiteConfig, +export const marshalCreateNetworkRequest = ( + request: CreateNetworkRequest, defaults: DefaultValues, ): Record => ({ - push_uri: request.pushUri, + hub_id: request.hubId, + name: request.name || randomName('network'), + topic_prefix: request.topicPrefix, + type: request.type, }) -const marshalUpdateRouteRequestDatabaseConfig = ( - request: UpdateRouteRequestDatabaseConfig, +const marshalCreateRouteRequestDatabaseConfig = ( + request: CreateRouteRequestDatabaseConfig, defaults: DefaultValues, ): Record => ({ dbname: request.dbname, @@ -542,8 +592,8 @@ const marshalUpdateRouteRequestDatabaseConfig = ( username: request.username, }) -const marshalUpdateRouteRequestRestConfig = ( - request: UpdateRouteRequestRestConfig, +const marshalCreateRouteRequestRestConfig = ( + request: CreateRouteRequestRestConfig, defaults: DefaultValues, ): Record => ({ headers: request.headers, @@ -551,8 +601,8 @@ const marshalUpdateRouteRequestRestConfig = ( verb: request.verb, }) -const marshalUpdateRouteRequestS3Config = ( - request: UpdateRouteRequestS3Config, +const marshalCreateRouteRequestS3Config = ( + request: CreateRouteRequestS3Config, defaults: DefaultValues, ): Record => ({ bucket_name: request.bucketName, @@ -561,49 +611,6 @@ const marshalUpdateRouteRequestS3Config = ( strategy: request.strategy, }) -export const marshalCreateDeviceRequest = ( - request: CreateDeviceRequest, - defaults: DefaultValues, -): Record => ({ - allow_insecure: request.allowInsecure, - allow_multiple_connections: request.allowMultipleConnections, - description: request.description, - hub_id: request.hubId, - message_filters: request.messageFilters - ? marshalDeviceMessageFilters(request.messageFilters, defaults) - : undefined, - name: request.name || randomName('device'), -}) - -export const marshalCreateHubRequest = ( - request: CreateHubRequest, - defaults: DefaultValues, -): Record => ({ - disable_events: request.disableEvents, - events_topic_prefix: request.eventsTopicPrefix, - name: request.name || randomName('hub'), - product_plan: request.productPlan, - project_id: request.projectId ?? defaults.defaultProjectId, - ...resolveOneOf([ - { - param: 'twins_graphite_config', - value: request.twinsGraphiteConfig - ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig, defaults) - : undefined, - }, - ]), -}) - -export const marshalCreateNetworkRequest = ( - request: CreateNetworkRequest, - defaults: DefaultValues, -): Record => ({ - hub_id: request.hubId, - name: request.name || randomName('network'), - topic_prefix: request.topicPrefix, - type: request.type, -}) - export const marshalCreateRouteRequest = ( request: CreateRouteRequest, defaults: DefaultValues, @@ -611,24 +618,27 @@ export const marshalCreateRouteRequest = ( hub_id: request.hubId, name: request.name || randomName('route'), topic: request.topic, - ...resolveOneOf([ + ...resolveOneOf([ { param: 's3_config', - value: request.s3Config - ? marshalCreateRouteRequestS3Config(request.s3Config, defaults) - : undefined, + value: + request.s3Config !== undefined + ? marshalCreateRouteRequestS3Config(request.s3Config, defaults) + : undefined, }, { param: 'db_config', - value: request.dbConfig - ? marshalCreateRouteRequestDatabaseConfig(request.dbConfig, defaults) - : undefined, + value: + request.dbConfig !== undefined + ? marshalCreateRouteRequestDatabaseConfig(request.dbConfig, defaults) + : undefined, }, { param: 'rest_config', - value: request.restConfig - ? marshalCreateRouteRequestRestConfig(request.restConfig, defaults) - : undefined, + value: + request.restConfig !== undefined + ? marshalCreateRouteRequestRestConfig(request.restConfig, defaults) + : undefined, }, ]), }) @@ -672,9 +682,10 @@ export const marshalUpdateDeviceRequest = ( allow_multiple_connections: request.allowMultipleConnections, description: request.description, hub_id: request.hubId, - message_filters: request.messageFilters - ? marshalDeviceMessageFilters(request.messageFilters, defaults) - : undefined, + message_filters: + request.messageFilters !== undefined + ? marshalDeviceMessageFilters(request.messageFilters, defaults) + : undefined, }) export const marshalUpdateHubRequest = ( @@ -685,41 +696,77 @@ export const marshalUpdateHubRequest = ( enable_device_auto_provisioning: request.enableDeviceAutoProvisioning, events_topic_prefix: request.eventsTopicPrefix, name: request.name, - product_plan: request.productPlan ?? 'plan_unknown', + product_plan: request.productPlan, ...resolveOneOf([ { param: 'twins_graphite_config', - value: request.twinsGraphiteConfig - ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig, defaults) - : undefined, + value: + request.twinsGraphiteConfig !== undefined + ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig, defaults) + : undefined, }, ]), }) +const marshalUpdateRouteRequestDatabaseConfig = ( + request: UpdateRouteRequestDatabaseConfig, + defaults: DefaultValues, +): Record => ({ + dbname: request.dbname, + engine: request.engine, + host: request.host, + password: request.password, + port: request.port, + query: request.query, + username: request.username, +}) + +const marshalUpdateRouteRequestRestConfig = ( + request: UpdateRouteRequestRestConfig, + defaults: DefaultValues, +): Record => ({ + headers: request.headers, + uri: request.uri, + verb: request.verb, +}) + +const marshalUpdateRouteRequestS3Config = ( + request: UpdateRouteRequestS3Config, + defaults: DefaultValues, +): Record => ({ + bucket_name: request.bucketName, + bucket_region: request.bucketRegion, + object_prefix: request.objectPrefix, + strategy: request.strategy, +}) + export const marshalUpdateRouteRequest = ( request: UpdateRouteRequest, defaults: DefaultValues, ): Record => ({ name: request.name, topic: request.topic, - ...resolveOneOf([ + ...resolveOneOf([ { param: 's3_config', - value: request.s3Config - ? marshalUpdateRouteRequestS3Config(request.s3Config, defaults) - : undefined, + value: + request.s3Config !== undefined + ? marshalUpdateRouteRequestS3Config(request.s3Config, defaults) + : undefined, }, { param: 'db_config', - value: request.dbConfig - ? marshalUpdateRouteRequestDatabaseConfig(request.dbConfig, defaults) - : undefined, + value: + request.dbConfig !== undefined + ? marshalUpdateRouteRequestDatabaseConfig(request.dbConfig, defaults) + : undefined, }, { param: 'rest_config', - value: request.restConfig - ? marshalUpdateRouteRequestRestConfig(request.restConfig, defaults) - : undefined, + value: + request.restConfig !== undefined + ? marshalUpdateRouteRequestRestConfig(request.restConfig, defaults) + : undefined, }, ]), }) diff --git a/packages/clients/src/api/iot/v1/types.gen.ts b/packages/clients/src/api/iot/v1/types.gen.ts index 70e23eb37..e55d8eb71 100644 --- a/packages/clients/src/api/iot/v1/types.gen.ts +++ b/packages/clients/src/api/iot/v1/types.gen.ts @@ -66,8 +66,6 @@ export type ListRoutesRequestOrderBy = export type NetworkNetworkType = 'unknown' | 'sigfox' | 'rest' -export type NullValue = 'NULL_VALUE' - export type RouteDatabaseConfigEngine = 'unknown' | 'postgresql' | 'mysql' export type RouteRestConfigHttpVerb = @@ -82,51 +80,36 @@ export type RouteRouteType = 'unknown' | 's3' | 'database' | 'rest' export type RouteS3ConfigS3Strategy = 'unknown' | 'per_topic' | 'per_message' -export interface Certificate { - crt: string - key: string -} - -/** Create device response. */ -export interface CreateDeviceResponse { - /** Information related to the created device. */ - device?: Device - /** Device certificate. */ - certificate?: Certificate -} - -/** Create network response. */ -export interface CreateNetworkResponse { - /** Information related to the created network. */ - network?: Network - /** Endpoint Key to keep secret. This cannot be retrieved later. */ - secret: string +export interface DeviceMessageFiltersRule { + /** + * If set to `accept`, all topics in the topics list will be allowed, with all + * other topics being denied. If set to `reject`, all topics in the topics + * list will be denied, with all other topics being allowed. + */ + policy: DeviceMessageFiltersRulePolicy + /** + * List of topics to accept or reject. It must be valid MQTT topics and up to + * 65535 characters. + */ + topics?: string[] } -export interface CreateRouteRequestDatabaseConfig { - host: string - port: number - dbname: string - username: string - password: string - query: string - engine: RouteDatabaseConfigEngine +export interface DeviceMessageFilters { + /** Filtering rule to restrict topics the device can publish to. */ + publish?: DeviceMessageFiltersRule + /** Filtering rule to restrict topics the device can subscribe to. */ + subscribe?: DeviceMessageFiltersRule } -export interface CreateRouteRequestRestConfig { - verb: RouteRestConfigHttpVerb - uri: string - headers: Record +export interface HubTwinsGraphiteConfig { + pushUri: string } -export interface CreateRouteRequestS3Config { - bucketRegion: string - bucketName: string - objectPrefix: string - strategy: RouteS3ConfigS3Strategy +export interface Certificate { + crt: string + key: string } -/** Device. */ export interface Device { /** Device ID, also used as MQTT Client ID or username. */ id: string @@ -155,9 +138,8 @@ export interface Device { /** Filter-sets to restrict the topics the device can publish/subscribe to. */ messageFilters?: DeviceMessageFilters /** - * Defines whether the device was assigned a custom certificate. Assigning a - * custom certificate allows a device to authenticate using that specific - * certificate without checking the Hub's CA certificate. + * Assigning a custom certificate allows a device to authenticate using that + * specific certificate without checking the Hub's CA certificate. */ hasCustomCertificate: boolean /** Date at which the device was added. */ @@ -166,55 +148,46 @@ export interface Device { updatedAt?: Date } -/** Device. message filters. */ -export interface DeviceMessageFilters { - /** Filtering rule to restrict topics the device can publish to. */ - publish?: DeviceMessageFiltersRule - /** Filtering rule to restrict topics the device can subscribe to. */ - subscribe?: DeviceMessageFiltersRule -} - -/** Device. message filters. rule. */ -export interface DeviceMessageFiltersRule { - /** - * How to use the topic list. If set to `accept`, all topics in the topics - * list will be allowed, with all other topics being denied. If set to - * `reject`, all topics in the topics list will be denied, with all other - * topics being allowed. - */ - policy: DeviceMessageFiltersRulePolicy - /** - * List of topics to accept or reject. It must be valid MQTT topics and up to - * 65535 characters. - */ - topics?: string[] -} - -/** Get device certificate response. */ -export interface GetDeviceCertificateResponse { - /** Information related to the created device. */ - device?: Device - /** Device certificate. */ - certificatePem: string +export interface Network { + /** Network ID. */ + id: string + /** Network name. */ + name: string + /** Type of network to connect with. */ + type: NetworkNetworkType + /** Endpoint to use for interacting with the network. */ + endpoint: string + /** Hub ID to connect the Network to. */ + hubId: string + /** Date at which the network was created. */ + createdAt?: Date + /** This prefix will be prepended to all topics for this Network. */ + topicPrefix: string } -/** Get device metrics response. */ -export interface GetDeviceMetricsResponse { - /** Metrics for a device over the requested period. */ - metrics: TimeSeries[] +export interface CreateRouteRequestDatabaseConfig { + host: string + port: number + dbname: string + username: string + password: string + query: string + engine: RouteDatabaseConfigEngine } -export interface GetHubCAResponse { - caCertPem: string +export interface CreateRouteRequestRestConfig { + verb: RouteRestConfigHttpVerb + uri: string + headers: Record } -/** Get hub metrics response. */ -export interface GetHubMetricsResponse { - /** Metrics for a Hub over the requested period. */ - metrics: TimeSeries[] +export interface CreateRouteRequestS3Config { + bucketRegion: string + bucketName: string + objectPrefix: string + strategy: RouteS3ConfigS3Strategy } -/** Hub. */ export interface Hub { /** Hub ID. */ id: string @@ -231,9 +204,9 @@ export interface Hub { /** Number of currently connected devices. */ connectedDeviceCount: number /** - * Host to connect your devices to. Devices should be connected to this host. - * Port may be 1883 (MQTT), 8883 (MQTT over TLS), 80 (MQTT over Websocket) or - * 443 (MQTT over Websocket over TLS). + * Devices should be connected to this host. Port may be 1883 (MQTT), 8883 + * (MQTT over TLS), 80 (MQTT over Websocket) or 443 (MQTT over Websocket over + * TLS). */ endpoint: string /** Defines whether to disable Hub events. */ @@ -251,19 +224,17 @@ export interface Hub { /** Organization owning the resource. */ organizationId: string /** - * Defines whether to enable device auto provisioning. When an unknown device - * connects to your hub using a valid certificate chain, it will be - * automatically provisioned inside your Hub. The Hub uses the common name of - * the device certifcate to find out if a device with the same name already - * exists. This setting can only be enabled on a hub with a custom certificate - * authority. + * When an unknown device connects to your hub using a valid certificate + * chain, it will be automatically provisioned inside your Hub. The Hub uses + * the common name of the device certifcate to find out if a device with the + * same name already exists. This setting can only be enabled on a hub with a + * custom certificate authority. */ enableDeviceAutoProvisioning: boolean /** - * Defines whether the hub is using a custom certificate authority. Flag is - * automatically set to `false` after Hub creation, as Hub certificates are - * managed by Scaleway. Once a custom certificate authority is set, the flag - * will be set to `true`. + * Flag is automatically set to `false` after Hub creation, as Hub + * certificates are managed by Scaleway. Once a custom certificate authority + * is set, the flag will be set to `true`. */ hasCustomCa: boolean /** @@ -275,85 +246,7 @@ export interface Hub { twinsGraphiteConfig?: HubTwinsGraphiteConfig } -export interface HubTwinsGraphiteConfig { - pushUri: string -} - -/** List devices response. */ -export interface ListDevicesResponse { - /** Total number of devices. */ - totalCount: number - /** Page of devices. */ - devices: Device[] -} - -/** List hubs response. */ -export interface ListHubsResponse { - /** Total number of Hubs. */ - totalCount: number - /** A page of hubs. */ - hubs: Hub[] -} - -/** List networks response. */ -export interface ListNetworksResponse { - /** Total number of Networks. */ - totalCount: number - /** Page of networks. */ - networks: Network[] -} - -/** List routes response. */ -export interface ListRoutesResponse { - /** Total number of routes. */ - totalCount: number - /** Page of routes. */ - routes: RouteSummary[] -} - -/** List twin documents response. */ -export interface ListTwinDocumentsResponse { - /** List of the twin document. */ - documents: ListTwinDocumentsResponseDocumentSummary[] -} - -/** List twin documents response. document summary. */ -export interface ListTwinDocumentsResponseDocumentSummary { - /** Name of the document. */ - documentName: string -} - -/** Network. */ -export interface Network { - /** Network ID. */ - id: string - /** Network name. */ - name: string - /** Type of network to connect with. */ - type: NetworkNetworkType - /** Endpoint to use for interacting with the network. */ - endpoint: string - /** Hub ID to connect the Network to. */ - hubId: string - /** Date at which the network was created. */ - createdAt?: Date - /** - * Topic prefix for the Network. This prefix will be prepended to all topics - * for this Network. - */ - topicPrefix: string -} - -/** Renew device certificate response. */ -export interface RenewDeviceCertificateResponse { - /** Information related to the created device. */ - device?: Device - /** Device certificate. */ - certificate?: Certificate -} - -/** Route. */ -export interface Route { +export interface RouteSummary { /** Route ID. */ id: string /** Route name. */ @@ -369,32 +262,15 @@ export interface Route { type: RouteRouteType /** Date at which the route was created. */ createdAt?: Date - /** - * When using S3 Route, S3-specific configuration fields. - * - * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' - * could be set. - */ - s3Config?: RouteS3Config - /** - * When using Database Route, DB-specific configuration fields. - * - * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' - * could be set. - */ - dbConfig?: RouteDatabaseConfig - /** - * When using Rest Route, Rest-specific configuration fields. - * - * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' - * could be set. - */ - restConfig?: RouteRestConfig /** Date at which the route was last updated. */ updatedAt?: Date } -/** Route. database config. */ +export interface ListTwinDocumentsResponseDocumentSummary { + /** Name of the document. */ + documentName: string +} + export interface RouteDatabaseConfig { /** * Database engine the route will connect to. If not specified, the default @@ -418,7 +294,6 @@ export interface RouteDatabaseConfig { query: string } -/** Route. rest config. */ export interface RouteRestConfig { /** HTTP verb used to call REST URI. */ verb: RouteRestConfigHttpVerb @@ -428,7 +303,6 @@ export interface RouteRestConfig { headers: Record } -/** Route.s3 config. */ export interface RouteS3Config { /** Region of the S3 route's destination bucket (e.g., 'fr-par'). */ bucketRegion: string @@ -443,44 +317,6 @@ export interface RouteS3Config { strategy: RouteS3ConfigS3Strategy } -/** Route summary. */ -export interface RouteSummary { - /** Route ID. */ - id: string - /** Route name. */ - name: string - /** Hub ID of the route. */ - hubId: string - /** - * Topic the route subscribes to. It must be a valid MQTT topic and up to - * 65535 characters. - */ - topic: string - /** Route type. */ - type: RouteRouteType - /** Date at which the route was created. */ - createdAt?: Date - /** Date at which the route was last updated. */ - updatedAt?: Date -} - -export interface SetDeviceCertificateResponse { - device?: Device - certificatePem: string -} - -/** Twin document. */ -export interface TwinDocument { - /** Parent twin ID of the document. */ - twinId: string - /** Name of the document. */ - documentName: string - /** New version of the document. */ - version: number - /** New data related to the document. */ - data?: Record -} - export interface UpdateRouteRequestDatabaseConfig { host?: string port?: number @@ -504,24 +340,40 @@ export interface UpdateRouteRequestS3Config { strategy: RouteS3ConfigS3Strategy } -export type ListHubsRequest = { +export type CreateDeviceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number to return, from the paginated results. */ - page?: number - /** Number of Hubs to return within a page. Maximum value is 100. */ - pageSize?: number - /** Sort order of Hubs in the response. */ - orderBy?: ListHubsRequestOrderBy - /** Only list Hubs of this Project ID. */ - projectId?: string - /** Only list Hubs of this Organization ID. */ - organizationId?: string - /** Hub name. */ + /** Device name. */ name?: string + /** Hub ID of the device. */ + hubId: string + /** + * Defines whether to allow plain and server-authenticated SSL connections in + * addition to mutually-authenticated ones. + */ + allowInsecure: boolean + /** + * Defines whether to allow multiple physical devices to connect with this + * device's credentials. + */ + allowMultipleConnections: boolean + /** + * Filter-sets to authorize or deny the device to publish/subscribe to + * specific topics. + */ + messageFilters?: DeviceMessageFilters + /** Device description. */ + description?: string +} + +export interface CreateDeviceResponse { + /** Information related to the created device. */ + device?: Device + /** Device certificate. */ + certificate?: Certificate } export type CreateHubRequest = { @@ -552,61 +404,75 @@ export type CreateHubRequest = { twinsGraphiteConfig?: HubTwinsGraphiteConfig } -export type GetHubRequest = { +export type CreateNetworkRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Hub ID. */ + /** Network name. */ + name?: string + /** Type of network to connect with. */ + type: NetworkNetworkType + /** Hub ID to connect the Network to. */ hubId: string + /** Topic prefix for the Network. */ + topicPrefix: string } -export type UpdateHubRequest = { +export interface CreateNetworkResponse { + /** Information related to the created network. */ + network?: Network + /** Endpoint Key to keep secret. This cannot be retrieved later. */ + secret: string +} + +export type CreateRouteRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the Hub you want to update. */ - hubId: string - /** Hub name (up to 255 characters). */ + /** Route name. */ name?: string - /** Hub product plan. */ - productPlan?: HubProductPlan - /** Disable Hub events. */ - disableEvents?: boolean - /** Topic prefix of Hub events. */ - eventsTopicPrefix?: string - /** Enable device auto provisioning. */ - enableDeviceAutoProvisioning?: boolean + /** Hub ID of the route. */ + hubId: string /** - * BETA - not implemented yet. + * Topic the route subscribes to. It must be a valid MQTT topic and up to + * 65535 characters. + */ + topic: string + /** + * If creating S3 Route, S3-specific configuration fields. * - * One-of ('twinsDbConfig'): at most one of 'twinsGraphiteConfig' could be - * set. + * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' + * could be set. */ - twinsGraphiteConfig?: HubTwinsGraphiteConfig -} - -export type EnableHubRequest = { + s3Config?: CreateRouteRequestS3Config /** - * Region to target. If none is passed will use default region from the - * config. + * If creating Database Route, DB-specific configuration fields. + * + * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' + * could be set. */ - region?: Region - /** Hub ID. */ - hubId: string + dbConfig?: CreateRouteRequestDatabaseConfig + /** + * If creating Rest Route, Rest-specific configuration fields. + * + * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' + * could be set. + */ + restConfig?: CreateRouteRequestRestConfig } -export type DisableHubRequest = { +export type DeleteDeviceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Hub ID. */ - hubId: string + /** Device ID. */ + deviceId: string } export type DeleteHubRequest = { @@ -624,97 +490,69 @@ export type DeleteHubRequest = { deleteDevices?: boolean } -export type GetHubMetricsRequest = { +export type DeleteNetworkRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Hub ID. */ - hubId: string - /** Start date used to compute the best scale for returned metrics. */ - startDate: Date + /** Network ID. */ + networkId: string } -export type SetHubCARequest = { +export type DeleteRouteRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Hub ID. */ - hubId: string - /** CA's PEM-encoded certificate. */ - caCertPem: string + /** Route ID. */ + routeId: string +} + +export type DeleteTwinDocumentRequest = { /** - * Proof of possession of PEM-encoded certificate. Challenge is a PEM-encoded - * certificate that acts as proof of possession of the CA. It must be signed - * by the CA, and have a Common Name equal to the Hub ID. + * Region to target. If none is passed will use default region from the + * config. */ - challengeCertPem: string + region?: Region + /** Twin ID. */ + twinId: string + /** Name of the document. */ + documentName: string } -export type GetHubCARequest = { +export type DeleteTwinDocumentsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - hubId: string + /** Twin ID. */ + twinId: string } -export type ListDevicesRequest = { +export type DisableDeviceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number to return, from the paginated results. */ - page?: number - /** Number of devices to return within a page. Maximum value is 100. */ - pageSize?: number - /** Ordering of requested devices. */ - orderBy?: ListDevicesRequestOrderBy - /** Name to filter for, only devices with this name will be returned. */ - name?: string - /** Hub ID to filter for, only devices attached to this Hub will be returned. */ - hubId?: string - /** Defines wheter to filter the allow_insecure flag. */ - allowInsecure?: boolean - /** Device status (enabled, disabled, etc.). */ - status?: DeviceStatus + /** Device ID. */ + deviceId: string } -export type CreateDeviceRequest = { +export type DisableHubRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Device name. */ - name?: string - /** Hub ID of the device. */ + /** Hub ID. */ hubId: string - /** - * Defines whether to allow plain and server-authenticated SSL connections in - * addition to mutually-authenticated ones. - */ - allowInsecure: boolean - /** - * Defines whether to allow multiple physical devices to connect with this - * device's credentials. - */ - allowMultipleConnections: boolean - /** - * Filter-sets to authorize or deny the device to publish/subscribe to - * specific topics. - */ - messageFilters?: DeviceMessageFilters - /** Device description. */ - description?: string } -export type GetDeviceRequest = { +export type EnableDeviceRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -724,33 +562,17 @@ export type GetDeviceRequest = { deviceId: string } -export type UpdateDeviceRequest = { +export type EnableHubRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Device ID. */ - deviceId: string - /** Description for the device. */ - description?: string - /** - * Defines whether to allow plain and server-authenticated SSL connections in - * addition to mutually-authenticated ones. - */ - allowInsecure?: boolean - /** - * Defines whether to allow multiple physical devices to connect with this - * device's credentials. - */ - allowMultipleConnections?: boolean - /** Filter-sets to restrict the topics the device can publish/subscribe to. */ - messageFilters?: DeviceMessageFilters - /** Change Hub for this device, additional fees may apply, see IoT Hub pricing. */ - hubId?: string + /** Hub ID. */ + hubId: string } -export type EnableDeviceRequest = { +export type GetDeviceCertificateRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -760,7 +582,14 @@ export type EnableDeviceRequest = { deviceId: string } -export type DisableDeviceRequest = { +export interface GetDeviceCertificateResponse { + /** Information related to the created device. */ + device?: Device + /** Device certificate. */ + certificatePem: string +} + +export type GetDeviceMetricsRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -768,9 +597,16 @@ export type DisableDeviceRequest = { region?: Region /** Device ID. */ deviceId: string + /** Start date used to compute the best scale for the returned metrics. */ + startDate?: Date } -export type RenewDeviceCertificateRequest = { +export interface GetDeviceMetricsResponse { + /** Metrics for a device over the requested period. */ + metrics: TimeSeries[] +} + +export type GetDeviceRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -780,162 +616,132 @@ export type RenewDeviceCertificateRequest = { deviceId: string } -export type SetDeviceCertificateRequest = { +export type GetHubCARequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Device ID. */ - deviceId: string - /** PEM-encoded custom certificate. */ - certificatePem: string + hubId: string } -export type GetDeviceCertificateRequest = { +export interface GetHubCAResponse { + caCertPem: string +} + +export type GetHubMetricsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Device ID. */ - deviceId: string + /** Hub ID. */ + hubId: string + /** Start date used to compute the best scale for returned metrics. */ + startDate?: Date } -export type DeleteDeviceRequest = { +export interface GetHubMetricsResponse { + /** Metrics for a Hub over the requested period. */ + metrics: TimeSeries[] +} + +export type GetHubRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Device ID. */ - deviceId: string + /** Hub ID. */ + hubId: string } -export type GetDeviceMetricsRequest = { +export type GetNetworkRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Device ID. */ - deviceId: string - /** Start date used to compute the best scale for the returned metrics. */ - startDate: Date + /** Network ID. */ + networkId: string } -export type ListRoutesRequest = { +export type GetRouteRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number to return, from the paginated results. */ - page?: number - /** Number of routes to return within a page. Maximum value is 100. */ - pageSize?: number - /** Ordering of requested routes. */ - orderBy?: ListRoutesRequestOrderBy - /** Hub ID to filter for. */ - hubId?: string - /** Route name to filter for. */ - name?: string + /** Route ID. */ + routeId: string } -export type CreateRouteRequest = { +export type GetTwinDocumentRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Route name. */ - name?: string - /** Hub ID of the route. */ - hubId: string - /** - * Topic the route subscribes to. It must be a valid MQTT topic and up to - * 65535 characters. - */ - topic: string - /** - * If creating S3 Route, S3-specific configuration fields. - * - * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' - * could be set. - */ - s3Config?: CreateRouteRequestS3Config - /** - * If creating Database Route, DB-specific configuration fields. - * - * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' - * could be set. - */ - dbConfig?: CreateRouteRequestDatabaseConfig - /** - * If creating Rest Route, Rest-specific configuration fields. - * - * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' - * could be set. - */ - restConfig?: CreateRouteRequestRestConfig + /** Twin ID. */ + twinId: string + /** Name of the document. */ + documentName: string } -export type UpdateRouteRequest = { +export type ListDevicesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Route id. */ - routeId: string - /** Route name. */ + /** Page number to return, from the paginated results. */ + page?: number + /** Number of devices to return within a page. Maximum value is 100. */ + pageSize?: number + /** Ordering of requested devices. */ + orderBy?: ListDevicesRequestOrderBy + /** Name to filter for, only devices with this name will be returned. */ name?: string - /** - * Topic the route subscribes to. It must be a valid MQTT topic and up to - * 65535 characters. - */ - topic?: string - /** - * When updating S3 Route, S3-specific configuration fields. - * - * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' - * could be set. - */ - s3Config?: UpdateRouteRequestS3Config - /** - * When updating Database Route, DB-specific configuration fields. - * - * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' - * could be set. - */ - dbConfig?: UpdateRouteRequestDatabaseConfig - /** - * When updating Rest Route, Rest-specific configuration fields. - * - * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' - * could be set. - */ - restConfig?: UpdateRouteRequestRestConfig + /** Hub ID to filter for, only devices attached to this Hub will be returned. */ + hubId?: string + /** Defines wheter to filter the allow_insecure flag. */ + allowInsecure?: boolean + /** Device status (enabled, disabled, etc.). */ + status?: DeviceStatus } -export type GetRouteRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Route ID. */ - routeId: string +export interface ListDevicesResponse { + /** Total number of devices. */ + totalCount: number + /** Page of devices. */ + devices: Device[] } -export type DeleteRouteRequest = { +export type ListHubsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Route ID. */ - routeId: string + /** Page number to return, from the paginated results. */ + page?: number + /** Number of Hubs to return within a page. Maximum value is 100. */ + pageSize?: number + /** Sort order of Hubs in the response. */ + orderBy?: ListHubsRequestOrderBy + /** Only list Hubs of this Project ID. */ + projectId?: string + /** Only list Hubs of this Organization ID. */ + organizationId?: string + /** Hub name. */ + name?: string +} + +export interface ListHubsResponse { + /** Total number of Hubs. */ + totalCount: number + /** A page of hubs. */ + hubs: Hub[] } export type ListNetworksRequest = { @@ -958,43 +764,54 @@ export type ListNetworksRequest = { topicPrefix?: string } -export type CreateNetworkRequest = { +export interface ListNetworksResponse { + /** Total number of Networks. */ + totalCount: number + /** Page of networks. */ + networks: Network[] +} + +export type ListRoutesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Network name. */ + /** Page number to return, from the paginated results. */ + page?: number + /** Number of routes to return within a page. Maximum value is 100. */ + pageSize?: number + /** Ordering of requested routes. */ + orderBy?: ListRoutesRequestOrderBy + /** Hub ID to filter for. */ + hubId?: string + /** Route name to filter for. */ name?: string - /** Type of network to connect with. */ - type: NetworkNetworkType - /** Hub ID to connect the Network to. */ - hubId: string - /** Topic prefix for the Network. */ - topicPrefix: string } -export type GetNetworkRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Network ID. */ - networkId: string +export interface ListRoutesResponse { + /** Total number of routes. */ + totalCount: number + /** Page of routes. */ + routes: RouteSummary[] } -export type DeleteNetworkRequest = { +export type ListTwinDocumentsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Network ID. */ - networkId: string + /** Twin ID. */ + twinId: string } -export type GetTwinDocumentRequest = { +export interface ListTwinDocumentsResponse { + /** List of the twin document. */ + documents: ListTwinDocumentsResponseDocumentSummary[] +} + +export type PatchTwinDocumentRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -1004,6 +821,20 @@ export type GetTwinDocumentRequest = { twinId: string /** Name of the document. */ documentName: string + /** + * If set, ensures that the current version of the document matches before + * persisting the update. + */ + version?: number + /** + * A json data that will be applied on the document's current data. Patching + * rules: The patch goes recursively through the patch objects. If the patch + * object property is null, it is removed from the final object. If the patch + * object property is a value (number, strings, bool, arrays), it is replaced. + * If the patch object property is an object, the previous rules will be + * applied recursively on it. + */ + data?: Record } export type PutTwinDocumentRequest = { @@ -1017,71 +848,205 @@ export type PutTwinDocumentRequest = { /** Name of the document. */ documentName: string /** - * Version of the document to update. If set, ensures that the current version - * of the document matches before persisting the update. + * If set, ensures that the current version of the document matches before + * persisting the update. */ version?: number - /** - * Data of the new document. New data that will replace the contents of the - * document. - */ + /** New data that will replace the contents of the document. */ data?: Record } -export type PatchTwinDocumentRequest = { +export type RenewDeviceCertificateRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Twin ID. */ - twinId: string - /** Name of the document. */ - documentName: string + /** Device ID. */ + deviceId: string +} + +export interface RenewDeviceCertificateResponse { + /** Information related to the created device. */ + device?: Device + /** Device certificate. */ + certificate?: Certificate +} + +export interface Route { + /** Route ID. */ + id: string + /** Route name. */ + name: string + /** Hub ID of the route. */ + hubId: string /** - * The version of the document to update. If set, ensures that the current - * version of the document matches before persisting the update. + * Topic the route subscribes to. It must be a valid MQTT topic and up to + * 65535 characters. */ - version?: number + topic: string + /** Route type. */ + type: RouteRouteType + /** Date at which the route was created. */ + createdAt?: Date /** - * Patch data. A json data that will be applied on the document's current - * data. Patching rules: The patch goes recursively through the patch objects. - * If the patch object property is null, it is removed from the final object. - * If the patch object property is a value (number, strings, bool, arrays), it - * is replaced. If the patch object property is an object, the previous rules - * will be applied recursively on it. + * When using S3 Route, S3-specific configuration fields. + * + * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' + * could be set. */ - data?: Record + s3Config?: RouteS3Config + /** + * When using Database Route, DB-specific configuration fields. + * + * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' + * could be set. + */ + dbConfig?: RouteDatabaseConfig + /** + * When using Rest Route, Rest-specific configuration fields. + * + * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' + * could be set. + */ + restConfig?: RouteRestConfig + /** Date at which the route was last updated. */ + updatedAt?: Date } -export type DeleteTwinDocumentRequest = { +export type SetDeviceCertificateRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Twin ID. */ + /** Device ID. */ + deviceId: string + /** PEM-encoded custom certificate. */ + certificatePem: string +} + +export interface SetDeviceCertificateResponse { + device?: Device + certificatePem: string +} + +export type SetHubCARequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Hub ID. */ + hubId: string + /** CA's PEM-encoded certificate. */ + caCertPem: string + /** + * Challenge is a PEM-encoded certificate that acts as proof of possession of + * the CA. It must be signed by the CA, and have a Common Name equal to the + * Hub ID. + */ + challengeCertPem: string +} + +export interface TwinDocument { + /** Parent twin ID of the document. */ twinId: string /** Name of the document. */ documentName: string + /** New version of the document. */ + version: number + /** New data related to the document. */ + data?: Record } -export type ListTwinDocumentsRequest = { +export type UpdateDeviceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Twin ID. */ - twinId: string + /** Device ID. */ + deviceId: string + /** Description for the device. */ + description?: string + /** + * Defines whether to allow plain and server-authenticated SSL connections in + * addition to mutually-authenticated ones. + */ + allowInsecure?: boolean + /** + * Defines whether to allow multiple physical devices to connect with this + * device's credentials. + */ + allowMultipleConnections?: boolean + /** Filter-sets to restrict the topics the device can publish/subscribe to. */ + messageFilters?: DeviceMessageFilters + /** Change Hub for this device, additional fees may apply, see IoT Hub pricing. */ + hubId?: string } -export type DeleteTwinDocumentsRequest = { +export type UpdateHubRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Twin ID. */ - twinId: string + /** ID of the Hub you want to update. */ + hubId: string + /** Hub name (up to 255 characters). */ + name?: string + /** Hub product plan. */ + productPlan?: HubProductPlan + /** Disable Hub events. */ + disableEvents?: boolean + /** Topic prefix of Hub events. */ + eventsTopicPrefix?: string + /** Enable device auto provisioning. */ + enableDeviceAutoProvisioning?: boolean + /** + * BETA - not implemented yet. + * + * One-of ('twinsDbConfig'): at most one of 'twinsGraphiteConfig' could be + * set. + */ + twinsGraphiteConfig?: HubTwinsGraphiteConfig +} + +export type UpdateRouteRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Route id. */ + routeId: string + /** Route name. */ + name?: string + /** + * Topic the route subscribes to. It must be a valid MQTT topic and up to + * 65535 characters. + */ + topic?: string + /** + * When updating S3 Route, S3-specific configuration fields. + * + * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' + * could be set. + */ + s3Config?: UpdateRouteRequestS3Config + /** + * When updating Database Route, DB-specific configuration fields. + * + * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' + * could be set. + */ + dbConfig?: UpdateRouteRequestDatabaseConfig + /** + * When updating Rest Route, Rest-specific configuration fields. + * + * One-of ('config'): at most one of 's3Config', 'dbConfig', 'restConfig' + * could be set. + */ + restConfig?: UpdateRouteRequestRestConfig } diff --git a/packages/clients/src/api/ipam/v1/api.gen.ts b/packages/clients/src/api/ipam/v1/api.gen.ts index c8e37964f..f54a17627 100644 --- a/packages/clients/src/api/ipam/v1/api.gen.ts +++ b/packages/clients/src/api/ipam/v1/api.gen.ts @@ -32,7 +32,7 @@ const jsonContentHeaders = { * IPAM API. * * This API allows you to manage IP addresses with Scaleway's IP Address - * Management tool. IPAM API. + * Management tool. */ export class API extends ParentAPI { /** Lists the available regions of the API. */ @@ -130,7 +130,7 @@ export class API extends ParentAPI { ['attached', request.attached], ['is_ipv6', request.isIpv6], ['mac_address', request.macAddress], - ['order_by', request.orderBy ?? 'created_at_desc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -140,18 +140,12 @@ export class API extends ParentAPI { ['project_id', request.projectId], ['resource_id', request.resourceId], ['resource_name', request.resourceName], - ['resource_type', request.resourceType ?? 'unknown_type'], + ['resource_type', request.resourceType], ['tags', request.tags], ...Object.entries( resolveOneOf([ - { - param: 'zonal', - value: request.zonal, - }, - { - param: 'private_network_id', - value: request.privateNetworkId, - }, + { param: 'zonal', value: request.zonal }, + { param: 'private_network_id', value: request.privateNetworkId }, ]), ), ), diff --git a/packages/clients/src/api/ipam/v1/marshalling.gen.ts b/packages/clients/src/api/ipam/v1/marshalling.gen.ts index e0b96ef82..7751be623 100644 --- a/packages/clients/src/api/ipam/v1/marshalling.gen.ts +++ b/packages/clients/src/api/ipam/v1/marshalling.gen.ts @@ -16,7 +16,7 @@ import type { UpdateIPRequest, } from './types.gen' -const unmarshalResource = (data: unknown) => { +const unmarshalResource = (data: unknown): Resource => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Resource' failed as data isn't a dictionary.`, @@ -31,7 +31,7 @@ const unmarshalResource = (data: unknown) => { } as Resource } -const unmarshalSource = (data: unknown) => { +const unmarshalSource = (data: unknown): Source => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Source' failed as data isn't a dictionary.`, @@ -45,7 +45,7 @@ const unmarshalSource = (data: unknown) => { } as Source } -export const unmarshalIP = (data: unknown) => { +export const unmarshalIP = (data: unknown): IP => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'IP' failed as data isn't a dictionary.`, @@ -60,14 +60,14 @@ export const unmarshalIP = (data: unknown) => { projectId: data.project_id, region: data.region, resource: data.resource ? unmarshalResource(data.resource) : undefined, - source: data.source ? unmarshalSource(data.source) : undefined, + source: unmarshalSource(data.source), tags: data.tags, updatedAt: unmarshalDate(data.updated_at), zone: data.zone, } as IP } -export const unmarshalListIPsResponse = (data: unknown) => { +export const unmarshalListIPsResponse = (data: unknown): ListIPsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`, @@ -85,18 +85,9 @@ const marshalSource = ( defaults: DefaultValues, ): Record => ({ ...resolveOneOf([ - { - param: 'zonal', - value: request.zonal, - }, - { - param: 'private_network_id', - value: request.privateNetworkId, - }, - { - param: 'subnet_id', - value: request.subnetId, - }, + { param: 'zonal', value: request.zonal }, + { param: 'private_network_id', value: request.privateNetworkId }, + { param: 'subnet_id', value: request.subnetId }, ]), }) @@ -107,7 +98,7 @@ export const marshalBookIPRequest = ( address: request.address, is_ipv6: request.isIpv6, project_id: request.projectId ?? defaults.defaultProjectId, - source: request.source ? marshalSource(request.source, defaults) : undefined, + source: marshalSource(request.source, defaults), tags: request.tags, }) diff --git a/packages/clients/src/api/ipam/v1/types.gen.ts b/packages/clients/src/api/ipam/v1/types.gen.ts index d67e4eb2a..f6c870c95 100644 --- a/packages/clients/src/api/ipam/v1/types.gen.ts +++ b/packages/clients/src/api/ipam/v1/types.gen.ts @@ -25,38 +25,6 @@ export type ResourceType = | 'baremetal_server' | 'baremetal_private_nic' -/** Ip. */ -export interface IP { - /** IP ID. */ - id: string - /** IPv4 or IPv6 address in CIDR notation. */ - address: string - /** Scaleway Project the IP belongs to. */ - projectId: string - /** Defines whether the IP is an IPv6 (false = IPv4). */ - isIpv6: boolean - /** Date the IP was booked. */ - createdAt?: Date - /** Date the IP was last modified. */ - updatedAt?: Date - /** Source pool where the IP was booked in. */ - source?: Source - /** Resource which the IP is attached to. */ - resource?: Resource - /** Tags for the IP. */ - tags: string[] - /** Region of the IP. */ - region: Region - /** Zone of the IP, if zonal. */ - zone: Zone -} - -export interface ListIPsResponse { - totalCount: number - ips: IP[] -} - -/** Resource. */ export interface Resource { /** Type of resource the IP is attached to. */ type: ResourceType @@ -65,33 +33,29 @@ export interface Resource { /** MAC of the resource the IP is attached to. */ macAddress?: string /** - * Name of the resource the IP is attached to. When the IP is in a Private - * Network, then a DNS record is available to resolve the resource name to - * this IP. + * When the IP is in a Private Network, then a DNS record is available to + * resolve the resource name to this IP. */ name?: string } -/** Source. */ export interface Source { /** - * Zone the IP lives in if the IP is a public zoned IP. This source is global. + * This source is global. * * One-of ('source'): at most one of 'zonal', 'privateNetworkId', 'subnetId' * could be set. */ zonal?: string /** - * Private Network the IP lives in if the IP is a private IP. This source is - * specific. + * This source is specific. * * One-of ('source'): at most one of 'zonal', 'privateNetworkId', 'subnetId' * could be set. */ privateNetworkId?: string /** - * Private Network subnet the IP lives in if the IP is a private IP in a - * Private Network. This source is specific. + * This source is specific. * * One-of ('source'): at most one of 'zonal', 'privateNetworkId', 'subnetId' * could be set. @@ -99,6 +63,31 @@ export interface Source { subnetId?: string } +export interface IP { + /** IP ID. */ + id: string + /** IPv4 or IPv6 address in CIDR notation. */ + address: string + /** Scaleway Project the IP belongs to. */ + projectId: string + /** Defines whether the IP is an IPv6 (false = IPv4). */ + isIpv6: boolean + /** Date the IP was booked. */ + createdAt?: Date + /** Date the IP was last modified. */ + updatedAt?: Date + /** Source pool where the IP was booked in. */ + source: Source + /** Resource which the IP is attached to. */ + resource?: Resource + /** Tags for the IP. */ + tags: string[] + /** Region of the IP. */ + region: Region + /** Zone of the IP, if zonal. */ + zone?: Zone +} + export type BookIPRequest = { /** * Region to target. If none is passed will use default region from the @@ -106,34 +95,23 @@ export type BookIPRequest = { */ region?: Region /** - * Scaleway Project in which to create the IP. When creating an IP in a - * Private Network, the Project must match the Private Network's Project. + * When creating an IP in a Private Network, the Project must match the + * Private Network's Project. */ projectId?: string /** Source in which to book the IP. Not all sources are available for booking. */ - source?: Source + source: Source /** Request an IPv6 instead of an IPv4. */ isIpv6: boolean /** - * Request a specific IP in the requested source pool. Note that only the - * Private Network source allows you to pick a specific IP. If the requested - * IP is already booked, then the call will fail. + * Note that only the Private Network source allows you to pick a specific IP. + * If the requested IP is already booked, then the call will fail. */ address?: string /** Tags for the IP. */ tags?: string[] } -export type ReleaseIPRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** IP ID. */ - ipId: string -} - export type GetIPRequest = { /** * Region to target. If none is passed will use default region from the @@ -144,18 +122,6 @@ export type GetIPRequest = { ipId: string } -export type UpdateIPRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** IP ID. */ - ipId: string - /** Tags for the IP. */ - tags?: string[] -} - export type ListIPsRequest = { /** * Region to target. If none is passed will use default region from the @@ -181,8 +147,7 @@ export type ListIPsRequest = { */ zonal?: string /** - * Private Network to filter for. Only IPs that are private, and in this - * Private Network, will be returned. + * Only IPs that are private, and in this Private Network, will be returned. * * One-of ('source'): at most one of 'zonal', 'privateNetworkId' could be set. */ @@ -222,3 +187,30 @@ export type ListIPsRequest = { */ resourceName?: string } + +export interface ListIPsResponse { + totalCount: number + ips: IP[] +} + +export type ReleaseIPRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** IP ID. */ + ipId: string +} + +export type UpdateIPRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** IP ID. */ + ipId: string + /** Tags for the IP. */ + tags?: string[] +} diff --git a/packages/clients/src/api/ipfs/v1alpha1/api.gen.ts b/packages/clients/src/api/ipfs/v1alpha1/api.gen.ts index d618402dd..f81f0912e 100644 --- a/packages/clients/src/api/ipfs/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/ipfs/v1alpha1/api.gen.ts @@ -119,7 +119,7 @@ export class API extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/volumes`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -302,7 +302,7 @@ export class API extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/pins`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -310,7 +310,7 @@ export class API extends ParentAPI { request.pageSize ?? this.client.settings.defaultPageSize, ], ['project_id', request.projectId], - ['status', request.status ?? 'unknown_status'], + ['status', request.status], ['volume_id', request.volumeId], ), }, @@ -394,7 +394,7 @@ export class IpnsAPI extends ParentAPI { /** * Waits for {@link Name} to be in a final state. * - * @param request - The request {@link GetNameRequest} + * @param request - The request {@link IpnsApiGetNameRequest} * @param options - The waiting options * @returns A Promise of Name */ @@ -435,7 +435,7 @@ export class IpnsAPI extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/names`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/k8s/v1/api.gen.ts b/packages/clients/src/api/k8s/v1/api.gen.ts index 91837e429..283952403 100644 --- a/packages/clients/src/api/k8s/v1/api.gen.ts +++ b/packages/clients/src/api/k8s/v1/api.gen.ts @@ -44,6 +44,7 @@ import type { DeleteNodeRequest, DeletePoolRequest, ExternalNode, + GetClusterKubeConfigRequest, GetClusterRequest, GetNodeRequest, GetPoolRequest, @@ -75,7 +76,6 @@ import type { UpgradePoolRequest, Version, } from './types.gen' -import type { GetClusterKubeConfigRequest } from './types.private.gen' const jsonContentHeaders = { 'Content-Type': 'application/json; charset=utf-8', @@ -98,7 +98,7 @@ export class API extends ParentAPI { )}/clusters`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -107,7 +107,7 @@ export class API extends ParentAPI { ], ['private_network_id', request.privateNetworkId], ['project_id', request.projectId], - ['status', request.status ?? 'unknown'], + ['status', request.status], ['type', request.type], ), }, @@ -416,13 +416,13 @@ export class API extends ParentAPI { )}/clusters/${validatePathParam('clusterId', request.clusterId)}/pools`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', request.pageSize ?? this.client.settings.defaultPageSize, ], - ['status', request.status ?? 'unknown'], + ['status', request.status], ), }, unmarshalListPoolsResponse, @@ -597,14 +597,14 @@ export class API extends ParentAPI { )}/clusters/${validatePathParam('clusterId', request.clusterId)}/nodes`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', request.pageSize ?? this.client.settings.defaultPageSize, ], ['pool_id', request.poolId], - ['status', request.status ?? 'unknown'], + ['status', request.status], ), }, unmarshalListNodesResponse, diff --git a/packages/clients/src/api/k8s/v1/index.gen.ts b/packages/clients/src/api/k8s/v1/index.gen.ts index 24e6cbcfb..f2996f09f 100644 --- a/packages/clients/src/api/k8s/v1/index.gen.ts +++ b/packages/clients/src/api/k8s/v1/index.gen.ts @@ -27,6 +27,7 @@ export type { DeleteNodeRequest, DeletePoolRequest, ExternalNode, + GetClusterKubeConfigRequest, GetClusterRequest, GetNodeRequest, GetPoolRequest, diff --git a/packages/clients/src/api/k8s/v1/index.ts b/packages/clients/src/api/k8s/v1/index.ts index 09ed33cca..841da6f64 100644 --- a/packages/clients/src/api/k8s/v1/index.ts +++ b/packages/clients/src/api/k8s/v1/index.ts @@ -1,5 +1,4 @@ export { K8SUtilsAPI as API } from './api.utils' export * from './content.gen' export type * from './types.gen' -export type * from './types.utils' export * as ValidationRules from './validation-rules.gen' diff --git a/packages/clients/src/api/k8s/v1/marshalling.gen.ts b/packages/clients/src/api/k8s/v1/marshalling.gen.ts index c0a24249e..73e2f1c98 100644 --- a/packages/clients/src/api/k8s/v1/marshalling.gen.ts +++ b/packages/clients/src/api/k8s/v1/marshalling.gen.ts @@ -47,17 +47,91 @@ import type { Version, } from './types.gen' -const unmarshalMaintenanceWindow = (data: unknown) => { +const unmarshalPoolUpgradePolicy = (data: unknown): PoolUpgradePolicy => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'PoolUpgradePolicy' failed as data isn't a dictionary.`, + ) + } + + return { + maxSurge: data.max_surge, + maxUnavailable: data.max_unavailable, + } as PoolUpgradePolicy +} + +export const unmarshalPool = (data: unknown): Pool => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Pool' failed as data isn't a dictionary.`, + ) + } + + return { + autohealing: data.autohealing, + autoscaling: data.autoscaling, + clusterId: data.cluster_id, + containerRuntime: data.container_runtime, + createdAt: unmarshalDate(data.created_at), + id: data.id, + kubeletArgs: data.kubelet_args, + maxSize: data.max_size, + minSize: data.min_size, + name: data.name, + nodeType: data.node_type, + placementGroupId: data.placement_group_id, + publicIpDisabled: data.public_ip_disabled, + region: data.region, + rootVolumeSize: data.root_volume_size, + rootVolumeType: data.root_volume_type, + size: data.size, + status: data.status, + tags: data.tags, + updatedAt: unmarshalDate(data.updated_at), + upgradePolicy: data.upgrade_policy + ? unmarshalPoolUpgradePolicy(data.upgrade_policy) + : undefined, + version: data.version, + zone: data.zone, + } as Pool +} + +export const unmarshalVersion = (data: unknown): Version => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Version' failed as data isn't a dictionary.`, + ) + } + + return { + availableAdmissionPlugins: data.available_admission_plugins, + availableCnis: data.available_cnis, + availableContainerRuntimes: data.available_container_runtimes, + availableFeatureGates: data.available_feature_gates, + availableIngresses: data.available_ingresses + ? data.available_ingresses + : undefined, + availableKubeletArgs: data.available_kubelet_args, + label: data.label, + name: data.name, + region: data.region, + } as Version +} + +const unmarshalMaintenanceWindow = (data: unknown): MaintenanceWindow => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'MaintenanceWindow' failed as data isn't a dictionary.`, ) } - return { day: data.day, startHour: data.start_hour } as MaintenanceWindow + return { + day: data.day, + startHour: data.start_hour, + } as MaintenanceWindow } -const unmarshalClusterAutoUpgrade = (data: unknown) => { +const unmarshalClusterAutoUpgrade = (data: unknown): ClusterAutoUpgrade => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ClusterAutoUpgrade' failed as data isn't a dictionary.`, @@ -72,7 +146,9 @@ const unmarshalClusterAutoUpgrade = (data: unknown) => { } as ClusterAutoUpgrade } -const unmarshalClusterAutoscalerConfig = (data: unknown) => { +const unmarshalClusterAutoscalerConfig = ( + data: unknown, +): ClusterAutoscalerConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ClusterAutoscalerConfig' failed as data isn't a dictionary.`, @@ -93,7 +169,9 @@ const unmarshalClusterAutoscalerConfig = (data: unknown) => { } as ClusterAutoscalerConfig } -const unmarshalClusterOpenIDConnectConfig = (data: unknown) => { +const unmarshalClusterOpenIDConnectConfig = ( + data: unknown, +): ClusterOpenIDConnectConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ClusterOpenIDConnectConfig' failed as data isn't a dictionary.`, @@ -111,20 +189,7 @@ const unmarshalClusterOpenIDConnectConfig = (data: unknown) => { } as ClusterOpenIDConnectConfig } -const unmarshalPoolUpgradePolicy = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'PoolUpgradePolicy' failed as data isn't a dictionary.`, - ) - } - - return { - maxSurge: data.max_surge, - maxUnavailable: data.max_unavailable, - } as PoolUpgradePolicy -} - -export const unmarshalCluster = (data: unknown) => { +export const unmarshalCluster = (data: unknown): Cluster => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Cluster' failed as data isn't a dictionary.`, @@ -134,12 +199,12 @@ export const unmarshalCluster = (data: unknown) => { return { admissionPlugins: data.admission_plugins, apiserverCertSans: data.apiserver_cert_sans, - autoscalerConfig: data.autoscaler_config - ? unmarshalClusterAutoscalerConfig(data.autoscaler_config) - : undefined, autoUpgrade: data.auto_upgrade ? unmarshalClusterAutoUpgrade(data.auto_upgrade) : undefined, + autoscalerConfig: data.autoscaler_config + ? unmarshalClusterAutoscalerConfig(data.autoscaler_config) + : undefined, clusterUrl: data.cluster_url, cni: data.cni, commitmentEndsAt: unmarshalDate(data.commitment_ends_at), @@ -149,7 +214,7 @@ export const unmarshalCluster = (data: unknown) => { dnsWildcard: data.dns_wildcard, featureGates: data.feature_gates, id: data.id, - ingress: data.ingress, + ingress: data.ingress ? data.ingress : undefined, name: data.name, openIdConnectConfig: data.open_id_connect_config ? unmarshalClusterOpenIDConnectConfig(data.open_id_connect_config) @@ -167,26 +232,7 @@ export const unmarshalCluster = (data: unknown) => { } as Cluster } -const unmarshalClusterType = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ClusterType' failed as data isn't a dictionary.`, - ) - } - - return { - availability: data.availability, - commitmentDelay: data.commitment_delay, - dedicated: data.dedicated, - maxNodes: data.max_nodes, - memory: data.memory, - name: data.name, - resiliency: data.resiliency, - sla: data.sla, - } as ClusterType -} - -export const unmarshalNode = (data: unknown) => { +export const unmarshalNode = (data: unknown): Node => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Node' failed as data isn't a dictionary.`, @@ -195,7 +241,7 @@ export const unmarshalNode = (data: unknown) => { return { clusterId: data.cluster_id, - conditions: data.conditions, + conditions: data.conditions ? data.conditions : undefined, createdAt: unmarshalDate(data.created_at), errorMessage: data.error_message, id: data.id, @@ -210,82 +256,47 @@ export const unmarshalNode = (data: unknown) => { } as Node } -export const unmarshalPool = (data: unknown) => { +export const unmarshalExternalNode = (data: unknown): ExternalNode => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Pool' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ExternalNode' failed as data isn't a dictionary.`, ) } return { - autohealing: data.autohealing, - autoscaling: data.autoscaling, - clusterId: data.cluster_id, - containerRuntime: data.container_runtime, - createdAt: unmarshalDate(data.created_at), + clusterCa: data.cluster_ca, + clusterUrl: data.cluster_url, + externalIp: data.external_ip, id: data.id, - kubeletArgs: data.kubelet_args, - maxSize: data.max_size, - minSize: data.min_size, - name: data.name, - nodeType: data.node_type, - placementGroupId: data.placement_group_id, - publicIpDisabled: data.public_ip_disabled, - region: data.region, - rootVolumeSize: data.root_volume_size, - rootVolumeType: data.root_volume_type, - size: data.size, - status: data.status, - tags: data.tags, - updatedAt: unmarshalDate(data.updated_at), - upgradePolicy: data.upgrade_policy - ? unmarshalPoolUpgradePolicy(data.upgrade_policy) - : undefined, - version: data.version, - zone: data.zone, - } as Pool -} - -export const unmarshalVersion = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Version' failed as data isn't a dictionary.`, - ) - } - - return { - availableAdmissionPlugins: data.available_admission_plugins, - availableCnis: data.available_cnis, - availableContainerRuntimes: data.available_container_runtimes, - availableFeatureGates: data.available_feature_gates, - availableIngresses: data.available_ingresses, - availableKubeletArgs: data.available_kubelet_args, - label: data.label, + kubeToken: data.kube_token, + kubeletConfig: data.kubelet_config, name: data.name, - region: data.region, - } as Version + poolVersion: data.pool_version, + } as ExternalNode } -export const unmarshalExternalNode = (data: unknown) => { +const unmarshalClusterType = (data: unknown): ClusterType => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ExternalNode' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ClusterType' failed as data isn't a dictionary.`, ) } return { - clusterCa: data.cluster_ca, - clusterUrl: data.cluster_url, - externalIp: data.external_ip, - id: data.id, - kubeletConfig: data.kubelet_config, - kubeToken: data.kube_token, + availability: data.availability, + commitmentDelay: data.commitment_delay, + dedicated: data.dedicated, + maxNodes: data.max_nodes, + memory: data.memory, name: data.name, - poolVersion: data.pool_version, - } as ExternalNode + resiliency: data.resiliency, + sla: data.sla, + } as ClusterType } -export const unmarshalListClusterAvailableTypesResponse = (data: unknown) => { +export const unmarshalListClusterAvailableTypesResponse = ( + data: unknown, +): ListClusterAvailableTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListClusterAvailableTypesResponse' failed as data isn't a dictionary.`, @@ -303,7 +314,7 @@ export const unmarshalListClusterAvailableTypesResponse = (data: unknown) => { export const unmarshalListClusterAvailableVersionsResponse = ( data: unknown, -) => { +): ListClusterAvailableVersionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListClusterAvailableVersionsResponse' failed as data isn't a dictionary.`, @@ -315,7 +326,9 @@ export const unmarshalListClusterAvailableVersionsResponse = ( } as ListClusterAvailableVersionsResponse } -export const unmarshalListClusterTypesResponse = (data: unknown) => { +export const unmarshalListClusterTypesResponse = ( + data: unknown, +): ListClusterTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListClusterTypesResponse' failed as data isn't a dictionary.`, @@ -331,7 +344,9 @@ export const unmarshalListClusterTypesResponse = (data: unknown) => { } as ListClusterTypesResponse } -export const unmarshalListClustersResponse = (data: unknown) => { +export const unmarshalListClustersResponse = ( + data: unknown, +): ListClustersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListClustersResponse' failed as data isn't a dictionary.`, @@ -344,7 +359,9 @@ export const unmarshalListClustersResponse = (data: unknown) => { } as ListClustersResponse } -export const unmarshalListNodesResponse = (data: unknown) => { +export const unmarshalListNodesResponse = ( + data: unknown, +): ListNodesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNodesResponse' failed as data isn't a dictionary.`, @@ -357,7 +374,9 @@ export const unmarshalListNodesResponse = (data: unknown) => { } as ListNodesResponse } -export const unmarshalListPoolsResponse = (data: unknown) => { +export const unmarshalListPoolsResponse = ( + data: unknown, +): ListPoolsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPoolsResponse' failed as data isn't a dictionary.`, @@ -370,7 +389,9 @@ export const unmarshalListPoolsResponse = (data: unknown) => { } as ListPoolsResponse } -export const unmarshalListVersionsResponse = (data: unknown) => { +export const unmarshalListVersionsResponse = ( + data: unknown, +): ListVersionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`, @@ -382,14 +403,6 @@ export const unmarshalListVersionsResponse = (data: unknown) => { } as ListVersionsResponse } -const marshalCreateClusterRequestPoolConfigUpgradePolicy = ( - request: CreateClusterRequestPoolConfigUpgradePolicy, - defaults: DefaultValues, -): Record => ({ - max_surge: request.maxSurge, - max_unavailable: request.maxUnavailable, -}) - const marshalMaintenanceWindow = ( request: MaintenanceWindow, defaults: DefaultValues, @@ -398,14 +411,23 @@ const marshalMaintenanceWindow = ( start_hour: request.startHour, }) +const marshalCreateClusterRequestPoolConfigUpgradePolicy = ( + request: CreateClusterRequestPoolConfigUpgradePolicy, + defaults: DefaultValues, +): Record => ({ + max_surge: request.maxSurge, + max_unavailable: request.maxUnavailable, +}) + const marshalCreateClusterRequestAutoUpgrade = ( request: CreateClusterRequestAutoUpgrade, defaults: DefaultValues, ): Record => ({ enable: request.enable, - maintenance_window: request.maintenanceWindow - ? marshalMaintenanceWindow(request.maintenanceWindow, defaults) - : undefined, + maintenance_window: + request.maintenanceWindow !== undefined + ? marshalMaintenanceWindow(request.maintenanceWindow, defaults) + : undefined, }) const marshalCreateClusterRequestAutoscalerConfig = ( @@ -455,128 +477,87 @@ const marshalCreateClusterRequestPoolConfig = ( root_volume_type: request.rootVolumeType, size: request.size, tags: request.tags, - upgrade_policy: request.upgradePolicy - ? marshalCreateClusterRequestPoolConfigUpgradePolicy( - request.upgradePolicy, - defaults, - ) - : undefined, + upgrade_policy: + request.upgradePolicy !== undefined + ? marshalCreateClusterRequestPoolConfigUpgradePolicy( + request.upgradePolicy, + defaults, + ) + : undefined, zone: request.zone, }) -const marshalCreatePoolRequestUpgradePolicy = ( - request: CreatePoolRequestUpgradePolicy, - defaults: DefaultValues, -): Record => ({ - max_surge: request.maxSurge, - max_unavailable: request.maxUnavailable, -}) - -const marshalUpdateClusterRequestAutoUpgrade = ( - request: UpdateClusterRequestAutoUpgrade, - defaults: DefaultValues, -): Record => ({ - enable: request.enable, - maintenance_window: request.maintenanceWindow - ? marshalMaintenanceWindow(request.maintenanceWindow, defaults) - : undefined, -}) - -const marshalUpdateClusterRequestAutoscalerConfig = ( - request: UpdateClusterRequestAutoscalerConfig, - defaults: DefaultValues, -): Record => ({ - balance_similar_node_groups: request.balanceSimilarNodeGroups, - estimator: request.estimator, - expander: request.expander, - expendable_pods_priority_cutoff: request.expendablePodsPriorityCutoff, - ignore_daemonsets_utilization: request.ignoreDaemonsetsUtilization, - max_graceful_termination_sec: request.maxGracefulTerminationSec, - scale_down_delay_after_add: request.scaleDownDelayAfterAdd, - scale_down_disabled: request.scaleDownDisabled, - scale_down_unneeded_time: request.scaleDownUnneededTime, - scale_down_utilization_threshold: request.scaleDownUtilizationThreshold, -}) - -const marshalUpdateClusterRequestOpenIDConnectConfig = ( - request: UpdateClusterRequestOpenIDConnectConfig, - defaults: DefaultValues, -): Record => ({ - client_id: request.clientId, - groups_claim: request.groupsClaim, - groups_prefix: request.groupsPrefix, - issuer_url: request.issuerUrl, - required_claim: request.requiredClaim, - username_claim: request.usernameClaim, - username_prefix: request.usernamePrefix, -}) - -const marshalUpdatePoolRequestUpgradePolicy = ( - request: UpdatePoolRequestUpgradePolicy, - defaults: DefaultValues, -): Record => ({ - max_surge: request.maxSurge, - max_unavailable: request.maxUnavailable, -}) - export const marshalCreateClusterRequest = ( request: CreateClusterRequest, defaults: DefaultValues, ): Record => ({ admission_plugins: request.admissionPlugins, apiserver_cert_sans: request.apiserverCertSans, - auto_upgrade: request.autoUpgrade - ? marshalCreateClusterRequestAutoUpgrade(request.autoUpgrade, defaults) - : undefined, - autoscaler_config: request.autoscalerConfig - ? marshalCreateClusterRequestAutoscalerConfig( - request.autoscalerConfig, - defaults, - ) - : undefined, + auto_upgrade: + request.autoUpgrade !== undefined + ? marshalCreateClusterRequestAutoUpgrade(request.autoUpgrade, defaults) + : undefined, + autoscaler_config: + request.autoscalerConfig !== undefined + ? marshalCreateClusterRequestAutoscalerConfig( + request.autoscalerConfig, + defaults, + ) + : undefined, cni: request.cni, description: request.description, enable_dashboard: request.enableDashboard, feature_gates: request.featureGates, ingress: request.ingress, name: request.name || randomName('k8s'), - open_id_connect_config: request.openIdConnectConfig - ? marshalCreateClusterRequestOpenIDConnectConfig( - request.openIdConnectConfig, - defaults, - ) - : undefined, - pools: request.pools - ? request.pools.map(elt => - marshalCreateClusterRequestPoolConfig(elt, defaults), - ) - : undefined, + open_id_connect_config: + request.openIdConnectConfig !== undefined + ? marshalCreateClusterRequestOpenIDConnectConfig( + request.openIdConnectConfig, + defaults, + ) + : undefined, + pools: + request.pools !== undefined + ? request.pools.map(elt => + marshalCreateClusterRequestPoolConfig(elt, defaults), + ) + : undefined, private_network_id: request.privateNetworkId, tags: request.tags, type: request.type, version: request.version, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, ]), }) +const marshalCreatePoolRequestUpgradePolicy = ( + request: CreatePoolRequestUpgradePolicy, + defaults: DefaultValues, +): Record => ({ + max_surge: request.maxSurge, + max_unavailable: request.maxUnavailable, +}) + export const marshalCreatePoolRequest = ( request: CreatePoolRequest, defaults: DefaultValues, ): Record => ({ autohealing: request.autohealing, autoscaling: request.autoscaling, - container_runtime: request.containerRuntime ?? 'unknown_runtime', - kubelet_args: request.kubeletArgs, + container_runtime: request.containerRuntime, + kubelet_args: + request.kubeletArgs !== undefined ? request.kubeletArgs : undefined, max_size: request.maxSize, min_size: request.minSize, name: request.name || randomName('pool'), @@ -584,12 +565,13 @@ export const marshalCreatePoolRequest = ( placement_group_id: request.placementGroupId, public_ip_disabled: request.publicIpDisabled, root_volume_size: request.rootVolumeSize, - root_volume_type: request.rootVolumeType ?? 'default_volume_type', + root_volume_type: request.rootVolumeType, size: request.size, tags: request.tags, - upgrade_policy: request.upgradePolicy - ? marshalCreatePoolRequestUpgradePolicy(request.upgradePolicy, defaults) - : undefined, + upgrade_policy: + request.upgradePolicy !== undefined + ? marshalCreatePoolRequestUpgradePolicy(request.upgradePolicy, defaults) + : undefined, zone: request.zone ?? defaults.defaultZone, }) @@ -607,35 +589,86 @@ export const marshalSetClusterTypeRequest = ( type: request.type, }) +const marshalUpdateClusterRequestAutoUpgrade = ( + request: UpdateClusterRequestAutoUpgrade, + defaults: DefaultValues, +): Record => ({ + enable: request.enable, + maintenance_window: + request.maintenanceWindow !== undefined + ? marshalMaintenanceWindow(request.maintenanceWindow, defaults) + : undefined, +}) + +const marshalUpdateClusterRequestAutoscalerConfig = ( + request: UpdateClusterRequestAutoscalerConfig, + defaults: DefaultValues, +): Record => ({ + balance_similar_node_groups: request.balanceSimilarNodeGroups, + estimator: request.estimator, + expander: request.expander, + expendable_pods_priority_cutoff: request.expendablePodsPriorityCutoff, + ignore_daemonsets_utilization: request.ignoreDaemonsetsUtilization, + max_graceful_termination_sec: request.maxGracefulTerminationSec, + scale_down_delay_after_add: request.scaleDownDelayAfterAdd, + scale_down_disabled: request.scaleDownDisabled, + scale_down_unneeded_time: request.scaleDownUnneededTime, + scale_down_utilization_threshold: request.scaleDownUtilizationThreshold, +}) + +const marshalUpdateClusterRequestOpenIDConnectConfig = ( + request: UpdateClusterRequestOpenIDConnectConfig, + defaults: DefaultValues, +): Record => ({ + client_id: request.clientId, + groups_claim: request.groupsClaim, + groups_prefix: request.groupsPrefix, + issuer_url: request.issuerUrl, + required_claim: request.requiredClaim, + username_claim: request.usernameClaim, + username_prefix: request.usernamePrefix, +}) + export const marshalUpdateClusterRequest = ( request: UpdateClusterRequest, defaults: DefaultValues, ): Record => ({ admission_plugins: request.admissionPlugins, apiserver_cert_sans: request.apiserverCertSans, - auto_upgrade: request.autoUpgrade - ? marshalUpdateClusterRequestAutoUpgrade(request.autoUpgrade, defaults) - : undefined, - autoscaler_config: request.autoscalerConfig - ? marshalUpdateClusterRequestAutoscalerConfig( - request.autoscalerConfig, - defaults, - ) - : undefined, + auto_upgrade: + request.autoUpgrade !== undefined + ? marshalUpdateClusterRequestAutoUpgrade(request.autoUpgrade, defaults) + : undefined, + autoscaler_config: + request.autoscalerConfig !== undefined + ? marshalUpdateClusterRequestAutoscalerConfig( + request.autoscalerConfig, + defaults, + ) + : undefined, description: request.description, enable_dashboard: request.enableDashboard, feature_gates: request.featureGates, ingress: request.ingress, name: request.name, - open_id_connect_config: request.openIdConnectConfig - ? marshalUpdateClusterRequestOpenIDConnectConfig( - request.openIdConnectConfig, - defaults, - ) - : undefined, + open_id_connect_config: + request.openIdConnectConfig !== undefined + ? marshalUpdateClusterRequestOpenIDConnectConfig( + request.openIdConnectConfig, + defaults, + ) + : undefined, tags: request.tags, }) +const marshalUpdatePoolRequestUpgradePolicy = ( + request: UpdatePoolRequestUpgradePolicy, + defaults: DefaultValues, +): Record => ({ + max_surge: request.maxSurge, + max_unavailable: request.maxUnavailable, +}) + export const marshalUpdatePoolRequest = ( request: UpdatePoolRequest, defaults: DefaultValues, @@ -647,9 +680,10 @@ export const marshalUpdatePoolRequest = ( min_size: request.minSize, size: request.size, tags: request.tags, - upgrade_policy: request.upgradePolicy - ? marshalUpdatePoolRequestUpgradePolicy(request.upgradePolicy, defaults) - : undefined, + upgrade_policy: + request.upgradePolicy !== undefined + ? marshalUpdatePoolRequestUpgradePolicy(request.upgradePolicy, defaults) + : undefined, }) export const marshalUpgradeClusterRequest = ( diff --git a/packages/clients/src/api/k8s/v1/types.gen.ts b/packages/clients/src/api/k8s/v1/types.gen.ts index 572d87465..a90516a8d 100644 --- a/packages/clients/src/api/k8s/v1/types.gen.ts +++ b/packages/clients/src/api/k8s/v1/types.gen.ts @@ -108,75 +108,25 @@ export type PoolVolumeType = 'default_volume_type' | 'l_ssd' | 'b_ssd' export type Runtime = 'unknown_runtime' | 'docker' | 'containerd' | 'crio' -/** Cluster. */ -export interface Cluster { - /** Cluster ID. */ - id: string - /** Cluster type. */ - type: string - /** Cluster name. */ - name: string - /** Status of the cluster. */ - status: ClusterStatus - /** Kubernetes version of the cluster. */ - version: string - /** Region in which the cluster is deployed. */ - region: Region - /** ID of the Organization owning the cluster. */ - organizationId: string - /** ID of the Project owning the cluster. */ - projectId: string - /** Tags associated with the cluster. */ - tags: string[] - /** Container Network Interface (CNI) plugin running in the cluster. */ - cni: CNI - /** Cluster description. */ - description: string - /** Kubernetes API server URL of the cluster. */ - clusterUrl: string - /** Wildcard DNS resolving all the ready cluster nodes. */ - dnsWildcard: string - /** Date on which the cluster was created. */ - createdAt?: Date - /** Date on which the cluster was last updated. */ - updatedAt?: Date - /** Autoscaler config for the cluster. */ - autoscalerConfig?: ClusterAutoscalerConfig - /** - * @deprecated Defines whether the Kubernetes dashboard is enabled for the - * cluster. - */ - dashboardEnabled?: boolean - /** - * @deprecated Managed Ingress controller used in the cluster (deprecated - * feature). - */ - ingress?: Ingress - /** Auto upgrade configuration of the cluster. */ - autoUpgrade?: ClusterAutoUpgrade - /** Defines whether a new Kubernetes version is available. */ - upgradeAvailable: boolean - /** List of enabled feature gates. */ - featureGates: string[] - /** List of enabled admission plugins. */ - admissionPlugins: string[] - /** - * This configuration enables to update the OpenID Connect configuration of - * the Kubernetes API server. - */ - openIdConnectConfig?: ClusterOpenIDConnectConfig - /** - * Additional Subject Alternative Names for the Kubernetes API server - * certificate. - */ - apiserverCertSans: string[] - /** Private network ID for internal cluster communication. */ - privateNetworkId?: string - /** Date on which it will be possible to switch to a smaller offer. */ - commitmentEndsAt?: Date +export interface MaintenanceWindow { + /** Start time of the two-hour maintenance window. */ + startHour: number + /** Day of the week for the maintenance window. */ + day: MaintenanceWindowDayOfTheWeek +} + +export interface PoolUpgradePolicy { + maxUnavailable: number + maxSurge: number +} + +export interface CreateClusterRequestPoolConfigUpgradePolicy { + /** The maximum number of nodes that can be not ready at the same time. */ + maxUnavailable?: number + /** The maximum number of nodes to be created during the upgrade. */ + maxSurge?: number } -/** Cluster. auto upgrade. */ export interface ClusterAutoUpgrade { /** Defines whether auto upgrade is enabled for the cluster. */ enabled: boolean @@ -184,7 +134,6 @@ export interface ClusterAutoUpgrade { maintenanceWindow?: MaintenanceWindow } -/** Cluster. autoscaler config. */ export interface ClusterAutoscalerConfig { /** Disable the cluster autoscaler. */ scaleDownDisabled: boolean @@ -221,7 +170,6 @@ export interface ClusterAutoscalerConfig { maxGracefulTerminationSec: number } -/** Cluster. open id connect config. */ export interface ClusterOpenIDConnectConfig { /** * URL of the provider which allows the API server to discover public signing @@ -265,27 +213,83 @@ export interface ClusterOpenIDConnectConfig { requiredClaim: string[] } -/** Cluster type. */ -export interface ClusterType { - /** Cluster type name. */ +export interface Pool { + /** Pool ID. */ + id: string + /** Cluster ID of the pool. */ + clusterId: string + /** Date on which the pool was created. */ + createdAt?: Date + /** Date on which the pool was last updated. */ + updatedAt?: Date + /** Pool name. */ name: string - /** Cluster type availability. */ - availability: ClusterTypeAvailability - /** Maximum number of nodes supported by the offer. */ - maxNodes: number - /** Time period during which you can no longer switch to a lower offer. */ - commitmentDelay?: string - /** Value of the Service Level Agreement of the offer. */ - sla: number - /** Resiliency offered by the offer. */ - resiliency: ClusterTypeResiliency - /** Max RAM allowed for the control plane. */ - memory: number - /** Returns information if this offer uses dedicated resources. */ - dedicated: boolean + /** Pool status. */ + status: PoolStatus + /** Pool version. */ + version: string + /** + * Node type is the type of Scaleway Instance wanted for the pool. Nodes with + * insufficient memory are not eligible (DEV1-S, PLAY2-PICO, STARDUST). + * 'external' is a special node type used to provision instances from other + * cloud providers in a Kosmos Cluster. + */ + nodeType: string + /** Defines whether the autoscaling feature is enabled for the pool. */ + autoscaling: boolean + /** Size (number of nodes) of the pool. */ + size: number + /** + * Defines the minimum size of the pool. Note that this field is only used + * when autoscaling is enabled on the pool. + */ + minSize: number + /** + * Defines the maximum size of the pool. Note that this field is only used + * when autoscaling is enabled on the pool. + */ + maxSize: number + /** + * Customization of the container runtime is available for each pool. Note + * that `docker` has been deprecated since version 1.20 and will be removed by + * version 1.24. + */ + containerRuntime: Runtime + /** Defines whether the autohealing feature is enabled for the pool. */ + autohealing: boolean + /** Tags associated with the pool. */ + tags: string[] + /** Placement group ID in which all the nodes of the pool will be created. */ + placementGroupId?: string + /** + * Kubelet arguments to be used by this pool. Note that this feature is + * experimental. + */ + kubeletArgs: Record + /** Pool upgrade policy. */ + upgradePolicy?: PoolUpgradePolicy + /** Zone in which the pool's nodes will be spawned. */ + zone: Zone + /** + * Defines the system volume disk type. Two different types of volume + * (`volume_type`) are provided: `l_ssd` is a local block storage which means + * your system is stored locally on your node's hypervisor. `b_ssd` is a + * remote block storage which means your system is stored on a centralized and + * resilient cluster. + */ + rootVolumeType: PoolVolumeType + /** System volume disk size. */ + rootVolumeSize?: number + /** + * Defines if the public IP should be removed from Nodes. To use this feature, + * your Cluster must have an attached Private Network set up with a Public + * Gateway. + */ + publicIpDisabled: boolean + /** Cluster region of the pool. */ + region: Region } -/** Create cluster request. auto upgrade. */ export interface CreateClusterRequestAutoUpgrade { /** Defines whether auto upgrade is enabled for the cluster. */ enable: boolean @@ -293,7 +297,6 @@ export interface CreateClusterRequestAutoUpgrade { maintenanceWindow?: MaintenanceWindow } -/** Create cluster request. autoscaler config. */ export interface CreateClusterRequestAutoscalerConfig { /** Disable the cluster autoscaler. */ scaleDownDisabled?: boolean @@ -330,7 +333,6 @@ export interface CreateClusterRequestAutoscalerConfig { maxGracefulTerminationSec?: number } -/** Create cluster request. open id connect config. */ export interface CreateClusterRequestOpenIDConnectConfig { /** * URL of the provider which allows the API server to discover public signing @@ -374,7 +376,6 @@ export interface CreateClusterRequestOpenIDConnectConfig { requiredClaim?: string[] } -/** Create cluster request. pool config. */ export interface CreateClusterRequestPoolConfig { /** Name of the pool. */ name: string @@ -438,91 +439,118 @@ export interface CreateClusterRequestPoolConfig { publicIpDisabled: boolean } -/** Create cluster request. pool config. upgrade policy. */ -export interface CreateClusterRequestPoolConfigUpgradePolicy { - /** The maximum number of nodes that can be not ready at the same time. */ - maxUnavailable?: number - /** The maximum number of nodes to be created during the upgrade. */ - maxSurge?: number -} - export interface CreatePoolRequestUpgradePolicy { maxUnavailable?: number maxSurge?: number } -export interface ExternalNode { - id: string +export interface ClusterType { + /** Cluster type name. */ name: string - clusterUrl: string - poolVersion: string - clusterCa: string - kubeToken: string - kubeletConfig: string - externalIp: string -} - -/** List cluster available types response. */ -export interface ListClusterAvailableTypesResponse { - /** Available cluster types for the cluster. */ - clusterTypes: ClusterType[] - /** Total number of types. */ - totalCount: number -} - -/** List cluster available versions response. */ -export interface ListClusterAvailableVersionsResponse { - /** Available Kubernetes versions for the cluster. */ - versions: Version[] -} - -/** List cluster types response. */ -export interface ListClusterTypesResponse { - /** Total number of cluster-types. */ - totalCount: number - /** Paginated returned cluster-types. */ - clusterTypes: ClusterType[] -} - -/** List clusters response. */ -export interface ListClustersResponse { - /** Total number of clusters. */ - totalCount: number - /** Paginated returned clusters. */ - clusters: Cluster[] + /** Cluster type availability. */ + availability: ClusterTypeAvailability + /** Maximum number of nodes supported by the offer. */ + maxNodes: number + /** Time period during which you can no longer switch to a lower offer. */ + commitmentDelay?: string + /** Value of the Service Level Agreement of the offer. */ + sla: number + /** Resiliency offered by the offer. */ + resiliency: ClusterTypeResiliency + /** Max RAM allowed for the control plane. */ + memory: number + /** Returns information if this offer uses dedicated resources. */ + dedicated: boolean } -/** List nodes response. */ -export interface ListNodesResponse { - /** Total number of nodes. */ - totalCount: number - /** Paginated returned nodes. */ - nodes: Node[] +export interface Version { + /** Name of the Kubernetes version. */ + name: string + /** Label of the Kubernetes version. */ + label: string + /** Region in which this version is available. */ + region: Region + /** Supported Container Network Interface (CNI) plugins for this version. */ + availableCnis: CNI[] + /** @deprecated Supported Ingress Controllers for this version. */ + availableIngresses?: Ingress[] + /** Supported container runtimes for this version. */ + availableContainerRuntimes: Runtime[] + /** Supported feature gates for this version. */ + availableFeatureGates: string[] + /** Supported admission plugins for this version. */ + availableAdmissionPlugins: string[] + /** Supported kubelet arguments for this version. */ + availableKubeletArgs: Record } -/** List pools response. */ -export interface ListPoolsResponse { - /** Total number of pools that exists for the cluster. */ - totalCount: number - /** Paginated returned pools. */ - pools: Pool[] -} - -/** List versions response. */ -export interface ListVersionsResponse { - /** Available Kubernetes versions. */ - versions: Version[] -} - -/** Maintenance window. */ -export interface MaintenanceWindow { - /** Start time of the two-hour maintenance window. */ - startHour: number - /** Day of the week for the maintenance window. */ - day: MaintenanceWindowDayOfTheWeek +export interface Cluster { + /** Cluster ID. */ + id: string + /** Cluster type. */ + type: string + /** Cluster name. */ + name: string + /** Status of the cluster. */ + status: ClusterStatus + /** Kubernetes version of the cluster. */ + version: string + /** Region in which the cluster is deployed. */ + region: Region + /** ID of the Organization owning the cluster. */ + organizationId: string + /** ID of the Project owning the cluster. */ + projectId: string + /** Tags associated with the cluster. */ + tags: string[] + /** Container Network Interface (CNI) plugin running in the cluster. */ + cni: CNI + /** Cluster description. */ + description: string + /** Kubernetes API server URL of the cluster. */ + clusterUrl: string + /** Wildcard DNS resolving all the ready cluster nodes. */ + dnsWildcard: string + /** Date on which the cluster was created. */ + createdAt?: Date + /** Date on which the cluster was last updated. */ + updatedAt?: Date + /** Autoscaler config for the cluster. */ + autoscalerConfig?: ClusterAutoscalerConfig + /** + * @deprecated Defines whether the Kubernetes dashboard is enabled for the + * cluster. + */ + dashboardEnabled?: boolean + /** + * @deprecated Managed Ingress controller used in the cluster (deprecated + * feature). + */ + ingress?: Ingress + /** Auto upgrade configuration of the cluster. */ + autoUpgrade?: ClusterAutoUpgrade + /** Defines whether a new Kubernetes version is available. */ + upgradeAvailable: boolean + /** List of enabled feature gates. */ + featureGates: string[] + /** List of enabled admission plugins. */ + admissionPlugins: string[] + /** + * This configuration enables to update the OpenID Connect configuration of + * the Kubernetes API server. + */ + openIdConnectConfig?: ClusterOpenIDConnectConfig + /** + * Additional Subject Alternative Names for the Kubernetes API server + * certificate. + */ + apiserverCertSans: string[] + /** Private network ID for internal cluster communication. */ + privateNetworkId?: string + /** Date on which it will be possible to switch to a smaller offer. */ + commitmentEndsAt?: Date } -/** Node. */ export interface Node { /** Node ID. */ id: string @@ -559,90 +587,6 @@ export interface Node { updatedAt?: Date } -/** Pool. */ -export interface Pool { - /** Pool ID. */ - id: string - /** Cluster ID of the pool. */ - clusterId: string - /** Date on which the pool was created. */ - createdAt?: Date - /** Date on which the pool was last updated. */ - updatedAt?: Date - /** Pool name. */ - name: string - /** Pool status. */ - status: PoolStatus - /** Pool version. */ - version: string - /** - * Node type is the type of Scaleway Instance wanted for the pool. Nodes with - * insufficient memory are not eligible (DEV1-S, PLAY2-PICO, STARDUST). - * 'external' is a special node type used to provision instances from other - * cloud providers in a Kosmos Cluster. - */ - nodeType: string - /** Defines whether the autoscaling feature is enabled for the pool. */ - autoscaling: boolean - /** Size (number of nodes) of the pool. */ - size: number - /** - * Defines the minimum size of the pool. Note that this field is only used - * when autoscaling is enabled on the pool. - */ - minSize: number - /** - * Defines the maximum size of the pool. Note that this field is only used - * when autoscaling is enabled on the pool. - */ - maxSize: number - /** - * Customization of the container runtime is available for each pool. Note - * that `docker` has been deprecated since version 1.20 and will be removed by - * version 1.24. - */ - containerRuntime: Runtime - /** Defines whether the autohealing feature is enabled for the pool. */ - autohealing: boolean - /** Tags associated with the pool. */ - tags: string[] - /** Placement group ID in which all the nodes of the pool will be created. */ - placementGroupId?: string - /** - * Kubelet arguments to be used by this pool. Note that this feature is - * experimental. - */ - kubeletArgs: Record - /** Pool upgrade policy. */ - upgradePolicy?: PoolUpgradePolicy - /** Zone in which the pool's nodes will be spawned. */ - zone: Zone - /** - * Defines the system volume disk type. Two different types of volume - * (`volume_type`) are provided: `l_ssd` is a local block storage which means - * your system is stored locally on your node's hypervisor. `b_ssd` is a - * remote block storage which means your system is stored on a centralized and - * resilient cluster. - */ - rootVolumeType: PoolVolumeType - /** System volume disk size. */ - rootVolumeSize?: number - /** - * Defines if the public IP should be removed from Nodes. To use this feature, - * your Cluster must have an attached Private Network set up with a Public - * Gateway. - */ - publicIpDisabled: boolean - /** Cluster region of the pool. */ - region: Region -} - -export interface PoolUpgradePolicy { - maxUnavailable: number - maxSurge: number -} - -/** Update cluster request. auto upgrade. */ export interface UpdateClusterRequestAutoUpgrade { /** Defines whether auto upgrade is enabled for the cluster. */ enable?: boolean @@ -650,7 +594,6 @@ export interface UpdateClusterRequestAutoUpgrade { maintenanceWindow?: MaintenanceWindow } -/** Update cluster request. autoscaler config. */ export interface UpdateClusterRequestAutoscalerConfig { /** Disable the cluster autoscaler. */ scaleDownDisabled?: boolean @@ -687,7 +630,6 @@ export interface UpdateClusterRequestAutoscalerConfig { maxGracefulTerminationSec?: number } -/** Update cluster request. open id connect config. */ export interface UpdateClusterRequestOpenIDConnectConfig { /** * URL of the provider which allows the API server to discover public signing @@ -736,60 +678,6 @@ export interface UpdatePoolRequestUpgradePolicy { maxSurge?: number } -/** Version. */ -export interface Version { - /** Name of the Kubernetes version. */ - name: string - /** Label of the Kubernetes version. */ - label: string - /** Region in which this version is available. */ - region: Region - /** Supported Container Network Interface (CNI) plugins for this version. */ - availableCnis: CNI[] - /** @deprecated Supported Ingress Controllers for this version. */ - availableIngresses?: Ingress[] - /** Supported container runtimes for this version. */ - availableContainerRuntimes: Runtime[] - /** Supported feature gates for this version. */ - availableFeatureGates: string[] - /** Supported admission plugins for this version. */ - availableAdmissionPlugins: string[] - /** Supported kubelet arguments for this version. */ - availableKubeletArgs: Record -} - -export type ListClustersRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Organization ID on which to filter the returned clusters. */ - organizationId?: string - /** Project ID on which to filter the returned clusters. */ - projectId?: string - /** Sort order of returned clusters. */ - orderBy?: ListClustersRequestOrderBy - /** Page number to return for clusters, from the paginated results. */ - page?: number - /** Maximum number of clusters per page. */ - pageSize?: number - /** - * Name to filter on, only clusters containing this substring in their name - * will be returned. - */ - name?: string - /** Status to filter on, only clusters with this status will be returned. */ - status?: ClusterStatus - /** Type to filter on, only clusters with this type will be returned. */ - type?: string - /** - * Private Network ID to filter on, only clusters within this Private Network - * will be returned. - */ - privateNetworkId?: string -} - export type CreateClusterRequest = { /** * Region to target. If none is passed will use default region from the @@ -868,55 +756,83 @@ export type CreateClusterRequest = { privateNetworkId?: string } -export type GetClusterRequest = { +export type CreateExternalNodeRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the requested cluster. */ - clusterId: string + poolId: string } -export type UpdateClusterRequest = { +export type CreatePoolRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the cluster to update. */ + /** Cluster ID to which the pool will be attached. */ clusterId: string - /** New external name for the cluster. */ + /** Pool name. */ name?: string - /** New description for the cluster. */ - description?: string - /** New tags associated with the cluster. */ - tags?: string[] - /** New autoscaler config for the cluster. */ - autoscalerConfig?: UpdateClusterRequestAutoscalerConfig - /** @deprecated New value for the Kubernetes Dashboard enablement. */ - enableDashboard?: boolean - /** @deprecated New Ingress Controller for the cluster (deprecated feature). */ - ingress?: Ingress /** - * New auto upgrade configuration for the cluster. Note that all fields need - * to be set. + * Node type is the type of Scaleway Instance wanted for the pool. Nodes with + * insufficient memory are not eligible (DEV1-S, PLAY2-PICO, STARDUST). + * 'external' is a special node type used to provision instances from other + * cloud providers in a Kosmos Cluster. */ - autoUpgrade?: UpdateClusterRequestAutoUpgrade - /** List of feature gates to enable. */ - featureGates?: string[] - /** List of admission plugins to enable. */ - admissionPlugins?: string[] + nodeType: string + /** Placement group ID in which all the nodes of the pool will be created. */ + placementGroupId?: string + /** Defines whether the autoscaling feature is enabled for the pool. */ + autoscaling: boolean + /** Size (number of nodes) of the pool. */ + size: number /** - * OpenID Connect configuration of the cluster. This configuration enables to - * update the OpenID Connect configuration of the Kubernetes API server. - */ - openIdConnectConfig?: UpdateClusterRequestOpenIDConnectConfig + * Defines the minimum size of the pool. Note that this field is only used + * when autoscaling is enabled on the pool. + */ + minSize?: number /** - * Additional Subject Alternative Names for the Kubernetes API server - * certificate. + * Defines the maximum size of the pool. Note that this field is only used + * when autoscaling is enabled on the pool. */ - apiserverCertSans?: string[] + maxSize?: number + /** + * Customization of the container runtime is available for each pool. Note + * that `docker` has been deprecated since version 1.20 and will be removed by + * version 1.24. + */ + containerRuntime?: Runtime + /** Defines whether the autohealing feature is enabled for the pool. */ + autohealing: boolean + /** Tags associated with the pool. */ + tags?: string[] + /** + * Kubelet arguments to be used by this pool. Note that this feature is + * experimental. + */ + kubeletArgs?: Record + /** Pool upgrade policy. */ + upgradePolicy?: CreatePoolRequestUpgradePolicy + /** Zone in which the pool's nodes will be spawned. */ + zone?: Zone + /** + * Defines the system volume disk type. Two different types of volume + * (`volume_type`) are provided: `l_ssd` is a local block storage which means + * your system is stored locally on your node's hypervisor. `b_ssd` is a + * remote block storage which means your system is stored on a centralized and + * resilient cluster. + */ + rootVolumeType?: PoolVolumeType + /** System volume disk size. */ + rootVolumeSize?: number + /** + * Defines if the public IP should be removed from Nodes. To use this feature, + * your Cluster must have an attached Private Network set up with a Public + * Gateway. + */ + publicIpDisabled: boolean } export type DeleteClusterRequest = { @@ -935,245 +851,179 @@ export type DeleteClusterRequest = { withAdditionalResources: boolean } -export type UpgradeClusterRequest = { +export type DeleteNodeRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the cluster to upgrade. */ - clusterId: string - /** - * New Kubernetes version of the cluster. Note that the version should either - * be a higher patch version of the same minor version or the direct minor - * version after the current one. - */ - version: string - /** - * Defines whether pools will also be upgraded once the control plane is - * upgraded. - */ - upgradePools: boolean + /** ID of the node to replace. */ + nodeId: string + /** Skip draining node from its workload. */ + skipDrain: boolean + /** Add a new node after the deletion of this node. */ + replace: boolean } -export type SetClusterTypeRequest = { +export type DeletePoolRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the cluster to migrate from one type to another. */ - clusterId: string - /** - * Type of the cluster. Note that some migrations are not possible (please - * refer to product documentation). - */ - type: string + /** ID of the pool to delete. */ + poolId: string } -export type ListClusterAvailableVersionsRequest = { +export interface ExternalNode { + id: string + name: string + clusterUrl: string + poolVersion: string + clusterCa: string + kubeToken: string + kubeletConfig: string + externalIp: string +} + +export type GetClusterKubeConfigRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Cluster ID for which the available Kubernetes versions will be listed. */ + /** Cluster ID for which to download the kubeconfig. */ clusterId: string } -export type ListClusterAvailableTypesRequest = { +export type GetClusterRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Cluster ID for which the available Kubernetes types will be listed. */ + /** ID of the requested cluster. */ clusterId: string } -export type ResetClusterAdminTokenRequest = { +export type GetNodeRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Cluster ID on which the admin token will be renewed. */ - clusterId: string + /** ID of the requested node. */ + nodeId: string } -export type MigrateToPrivateNetworkClusterRequest = { +export type GetPoolRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the cluster to migrate. */ - clusterId: string - /** ID of the Private Network to link to the cluster. */ - privateNetworkId: string + /** ID of the requested pool. */ + poolId: string } -export type ListPoolsRequest = { +export type GetVersionRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the cluster whose pools will be listed. */ - clusterId: string - /** Sort order of returned pools. */ - orderBy?: ListPoolsRequestOrderBy - /** Page number for the returned pools. */ - page?: number - /** Maximum number of pools per page. */ - pageSize?: number - /** - * Name to filter on, only pools containing this substring in their name will - * be returned. - */ - name?: string - /** Status to filter on, only pools with this status will be returned. */ - status?: PoolStatus + /** Requested version name. */ + versionName: string } -export type CreatePoolRequest = { +export type ListClusterAvailableTypesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Cluster ID to which the pool will be attached. */ + /** Cluster ID for which the available Kubernetes types will be listed. */ clusterId: string - /** Pool name. */ - name?: string - /** - * Node type is the type of Scaleway Instance wanted for the pool. Nodes with - * insufficient memory are not eligible (DEV1-S, PLAY2-PICO, STARDUST). - * 'external' is a special node type used to provision instances from other - * cloud providers in a Kosmos Cluster. - */ - nodeType: string - /** Placement group ID in which all the nodes of the pool will be created. */ - placementGroupId?: string - /** Defines whether the autoscaling feature is enabled for the pool. */ - autoscaling: boolean - /** Size (number of nodes) of the pool. */ - size: number - /** - * Defines the minimum size of the pool. Note that this field is only used - * when autoscaling is enabled on the pool. - */ - minSize?: number - /** - * Defines the maximum size of the pool. Note that this field is only used - * when autoscaling is enabled on the pool. - */ - maxSize?: number - /** - * Customization of the container runtime is available for each pool. Note - * that `docker` has been deprecated since version 1.20 and will be removed by - * version 1.24. - */ - containerRuntime?: Runtime - /** Defines whether the autohealing feature is enabled for the pool. */ - autohealing: boolean - /** Tags associated with the pool. */ - tags?: string[] - /** - * Kubelet arguments to be used by this pool. Note that this feature is - * experimental. - */ - kubeletArgs?: Record - /** Pool upgrade policy. */ - upgradePolicy?: CreatePoolRequestUpgradePolicy - /** Zone in which the pool's nodes will be spawned. */ - zone?: Zone - /** - * Defines the system volume disk type. Two different types of volume - * (`volume_type`) are provided: `l_ssd` is a local block storage which means - * your system is stored locally on your node's hypervisor. `b_ssd` is a - * remote block storage which means your system is stored on a centralized and - * resilient cluster. - */ - rootVolumeType?: PoolVolumeType - /** System volume disk size. */ - rootVolumeSize?: number - /** - * Defines if the public IP should be removed from Nodes. To use this feature, - * your Cluster must have an attached Private Network set up with a Public - * Gateway. - */ - publicIpDisabled: boolean } -export type GetPoolRequest = { +export interface ListClusterAvailableTypesResponse { + /** Available cluster types for the cluster. */ + clusterTypes: ClusterType[] + /** Total number of types. */ + totalCount: number +} + +export type ListClusterAvailableVersionsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the requested pool. */ - poolId: string + /** Cluster ID for which the available Kubernetes versions will be listed. */ + clusterId: string } -export type UpgradePoolRequest = { +export interface ListClusterAvailableVersionsResponse { + /** Available Kubernetes versions for the cluster. */ + versions: Version[] +} + +export type ListClusterTypesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the pool to upgrade. */ - poolId: string - /** New Kubernetes version for the pool. */ - version: string + /** Page number, from the paginated results, to return for cluster-types. */ + page?: number + /** Maximum number of clusters per page. */ + pageSize?: number } -export type UpdatePoolRequest = { +export interface ListClusterTypesResponse { + /** Total number of cluster-types. */ + totalCount: number + /** Paginated returned cluster-types. */ + clusterTypes: ClusterType[] +} + +export type ListClustersRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the pool to update. */ - poolId: string - /** New value for the pool autoscaling enablement. */ - autoscaling?: boolean - /** New desired pool size. */ - size?: number - /** New minimum size for the pool. */ - minSize?: number - /** New maximum size for the pool. */ - maxSize?: number - /** New value for the pool autohealing enablement. */ - autohealing?: boolean - /** New tags associated with the pool. */ - tags?: string[] + /** Organization ID on which to filter the returned clusters. */ + organizationId?: string + /** Project ID on which to filter the returned clusters. */ + projectId?: string + /** Sort order of returned clusters. */ + orderBy?: ListClustersRequestOrderBy + /** Page number to return for clusters, from the paginated results. */ + page?: number + /** Maximum number of clusters per page. */ + pageSize?: number /** - * New Kubelet arguments to be used by this pool. Note that this feature is - * experimental. + * Name to filter on, only clusters containing this substring in their name + * will be returned. */ - kubeletArgs?: Record - /** New upgrade policy for the pool. */ - upgradePolicy?: UpdatePoolRequestUpgradePolicy -} - -export type DeletePoolRequest = { + name?: string + /** Status to filter on, only clusters with this status will be returned. */ + status?: ClusterStatus + /** Type to filter on, only clusters with this type will be returned. */ + type?: string /** - * Region to target. If none is passed will use default region from the - * config. + * Private Network ID to filter on, only clusters within this Private Network + * will be returned. */ - region?: Region - /** ID of the pool to delete. */ - poolId: string + privateNetworkId?: string } -export type CreateExternalNodeRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - poolId: string +export interface ListClustersResponse { + /** Total number of clusters. */ + totalCount: number + /** Paginated returned clusters. */ + clusters: Cluster[] } export type ListNodesRequest = { @@ -1201,24 +1051,66 @@ export type ListNodesRequest = { status?: NodeStatus } -export type GetNodeRequest = { +export interface ListNodesResponse { + /** Total number of nodes. */ + totalCount: number + /** Paginated returned nodes. */ + nodes: Node[] +} + +export type ListPoolsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the requested node. */ - nodeId: string + /** ID of the cluster whose pools will be listed. */ + clusterId: string + /** Sort order of returned pools. */ + orderBy?: ListPoolsRequestOrderBy + /** Page number for the returned pools. */ + page?: number + /** Maximum number of pools per page. */ + pageSize?: number + /** + * Name to filter on, only pools containing this substring in their name will + * be returned. + */ + name?: string + /** Status to filter on, only pools with this status will be returned. */ + status?: PoolStatus } -export type ReplaceNodeRequest = { +export interface ListPoolsResponse { + /** Total number of pools that exists for the cluster. */ + totalCount: number + /** Paginated returned pools. */ + pools: Pool[] +} + +export type ListVersionsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the node to replace. */ - nodeId: string +} + +export interface ListVersionsResponse { + /** Available Kubernetes versions. */ + versions: Version[] +} + +export type MigrateToPrivateNetworkClusterRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** ID of the cluster to migrate. */ + clusterId: string + /** ID of the Private Network to link to the cluster. */ + privateNetworkId: string } export type RebootNodeRequest = { @@ -1231,7 +1123,7 @@ export type RebootNodeRequest = { nodeId: string } -export type DeleteNodeRequest = { +export type ReplaceNodeRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -1239,38 +1131,132 @@ export type DeleteNodeRequest = { region?: Region /** ID of the node to replace. */ nodeId: string - /** Skip draining node from its workload. */ - skipDrain: boolean - /** Add a new node after the deletion of this node. */ - replace: boolean } -export type ListVersionsRequest = { +export type ResetClusterAdminTokenRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region + /** Cluster ID on which the admin token will be renewed. */ + clusterId: string } -export type GetVersionRequest = { +export type SetClusterTypeRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Requested version name. */ - versionName: string + /** ID of the cluster to migrate from one type to another. */ + clusterId: string + /** + * Type of the cluster. Note that some migrations are not possible (please + * refer to product documentation). + */ + type: string } -export type ListClusterTypesRequest = { +export type UpdateClusterRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number, from the paginated results, to return for cluster-types. */ - page?: number - /** Maximum number of clusters per page. */ - pageSize?: number + /** ID of the cluster to update. */ + clusterId: string + /** New external name for the cluster. */ + name?: string + /** New description for the cluster. */ + description?: string + /** New tags associated with the cluster. */ + tags?: string[] + /** New autoscaler config for the cluster. */ + autoscalerConfig?: UpdateClusterRequestAutoscalerConfig + /** @deprecated New value for the Kubernetes Dashboard enablement. */ + enableDashboard?: boolean + /** @deprecated New Ingress Controller for the cluster (deprecated feature). */ + ingress?: Ingress + /** + * New auto upgrade configuration for the cluster. Note that all fields need + * to be set. + */ + autoUpgrade?: UpdateClusterRequestAutoUpgrade + /** List of feature gates to enable. */ + featureGates?: string[] + /** List of admission plugins to enable. */ + admissionPlugins?: string[] + /** + * OpenID Connect configuration of the cluster. This configuration enables to + * update the OpenID Connect configuration of the Kubernetes API server. + */ + openIdConnectConfig?: UpdateClusterRequestOpenIDConnectConfig + /** + * Additional Subject Alternative Names for the Kubernetes API server + * certificate. + */ + apiserverCertSans?: string[] +} + +export type UpdatePoolRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** ID of the pool to update. */ + poolId: string + /** New value for the pool autoscaling enablement. */ + autoscaling?: boolean + /** New desired pool size. */ + size?: number + /** New minimum size for the pool. */ + minSize?: number + /** New maximum size for the pool. */ + maxSize?: number + /** New value for the pool autohealing enablement. */ + autohealing?: boolean + /** New tags associated with the pool. */ + tags?: string[] + /** + * New Kubelet arguments to be used by this pool. Note that this feature is + * experimental. + */ + kubeletArgs?: Record + /** New upgrade policy for the pool. */ + upgradePolicy?: UpdatePoolRequestUpgradePolicy +} + +export type UpgradeClusterRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** ID of the cluster to upgrade. */ + clusterId: string + /** + * New Kubernetes version of the cluster. Note that the version should either + * be a higher patch version of the same minor version or the direct minor + * version after the current one. + */ + version: string + /** + * Defines whether pools will also be upgraded once the control plane is + * upgraded. + */ + upgradePools: boolean +} + +export type UpgradePoolRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** ID of the pool to upgrade. */ + poolId: string + /** New Kubernetes version for the pool. */ + version: string } diff --git a/packages/clients/src/api/lb/v1/api.gen.ts b/packages/clients/src/api/lb/v1/api.gen.ts index 06075ae80..0122b3ba4 100644 --- a/packages/clients/src/api/lb/v1/api.gen.ts +++ b/packages/clients/src/api/lb/v1/api.gen.ts @@ -222,25 +222,34 @@ const jsonContentHeaders = { } /** - * Load balancer API. + * Load Balancer API. * - * This API allows you to manage your load balancer service. Load balancer API. + * This API allows you to manage your Scaleway Load Balancer services. */ -export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: Region[] = ['fr-par', 'nl-ams', 'pl-waw'] +export class ZonedAPI 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 pageOfListLbs = (request: Readonly = {}) => + protected pageOfListLbs = (request: Readonly = {}) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -254,49 +263,56 @@ export class API extends ParentAPI { ) /** - * List load balancers. + * List Load Balancers. List all Load Balancers in the specified zone, for a + * Scaleway Organization or Scaleway Project. By default, the Load Balancers + * returned in the list are ordered by creation date in ascending order, + * though this can be modified via the `order_by` field. * - * @param request - The request {@link ListLbsRequest} + * @param request - The request {@link ZonedApiListLbsRequest} * @returns A Promise of ListLbsResponse */ - listLbs = (request: Readonly = {}) => + listLbs = (request: Readonly = {}) => enrichForPagination('lbs', this.pageOfListLbs, request) /** - * Create a load balancer. + * Create a Load Balancer. Create a new Load Balancer. Note that the Load + * Balancer will be created without frontends or backends; these must be + * created separately via the dedicated endpoints. * - * @param request - The request {@link CreateLbRequest} + * @param request - The request {@link ZonedApiCreateLbRequest} * @returns A Promise of Lb */ - createLb = (request: Readonly) => + createLb = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalCreateLbRequest(request, this.client.settings), + marshalZonedApiCreateLbRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs`, }, unmarshalLb, ) /** - * Get a load balancer. + * Get a Load Balancer. Retrieve information about an existing Load Balancer, + * specified by its Load Balancer ID. Its full details, including name, status + * and IP address, are returned in the response object. * - * @param request - The request {@link GetLbRequest} + * @param request - The request {@link ZonedApiGetLbRequest} * @returns A Promise of Lb */ - getLb = (request: Readonly) => + getLb = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}`, }, unmarshalLb, @@ -305,12 +321,12 @@ export class API extends ParentAPI { /** * Waits for {@link Lb} to be in a final state. * - * @param request - The request {@link GetLbRequest} + * @param request - The request {@link ZonedApiGetLbRequest} * @param options - The waiting options * @returns A Promise of Lb */ waitForLb = ( - request: Readonly, + request: Readonly, options?: Readonly>, ) => waitForResource( @@ -322,71 +338,78 @@ export class API extends ParentAPI { ) /** - * Update a load balancer. + * Update a Load Balancer. Update the parameters of an existing Load Balancer, + * specified by its Load Balancer ID. Note that the request type is PUT and + * not PATCH. You must set all parameters. * - * @param request - The request {@link UpdateLbRequest} + * @param request - The request {@link ZonedApiUpdateLbRequest} * @returns A Promise of Lb */ - updateLb = (request: Readonly) => + updateLb = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalUpdateLbRequest(request, this.client.settings), + marshalZonedApiUpdateLbRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}`, }, unmarshalLb, ) /** - * Delete a load balancer. + * Delete a Load Balancer. Delete an existing Load Balancer, specified by its + * Load Balancer ID. Deleting a Load Balancer is permanent, and cannot be + * undone. The Load Balancer's flexible IP address can either be deleted with + * the Load Balancer, or kept in your account for future use. * - * @param request - The request {@link DeleteLbRequest} + * @param request - The request {@link ZonedApiDeleteLbRequest} */ - deleteLb = (request: Readonly) => + deleteLb = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}`, urlParams: urlParams(['release_ip', request.releaseIp]), }) /** - * Migrate a load balancer. + * Migrate a Load Balancer. Migrate an existing Load Balancer from one + * commercial type to another. Allows you to scale your Load Balancer up or + * down in terms of bandwidth or multi-cloud provision. * - * @param request - The request {@link MigrateLbRequest} + * @param request - The request {@link ZonedApiMigrateLbRequest} * @returns A Promise of Lb */ - migrateLb = (request: Readonly) => + migrateLb = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalMigrateLbRequest(request, this.client.settings), + marshalZonedApiMigrateLbRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}/migrate`, }, unmarshalLb, ) - protected pageOfListIPs = (request: Readonly = {}) => + protected pageOfListIPs = (request: Readonly = {}) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/ips`, urlParams: urlParams( ['ip_address', request.ipAddress], @@ -403,101 +426,110 @@ export class API extends ParentAPI { ) /** - * List IPs. + * List IP addresses. List the Load Balancer flexible IP addresses held in the + * account (filtered by Organization ID or Project ID). It is also possible to + * search for a specific IP address. * - * @param request - The request {@link ListIPsRequest} + * @param request - The request {@link ZonedApiListIPsRequest} * @returns A Promise of ListIpsResponse */ - listIPs = (request: Readonly = {}) => + listIPs = (request: Readonly = {}) => enrichForPagination('ips', this.pageOfListIPs, request) /** - * Create an IP. + * Create an IP address. Create a new Load Balancer flexible IP address, in + * the specified Scaleway Project. This can be attached to new Load Balancers + * created in the future. * - * @param request - The request {@link CreateIpRequest} + * @param request - The request {@link ZonedApiCreateIpRequest} * @returns A Promise of Ip */ - createIp = (request: Readonly = {}) => + createIp = (request: Readonly = {}) => this.client.fetch( { body: JSON.stringify( - marshalCreateIpRequest(request, this.client.settings), + marshalZonedApiCreateIpRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/ips`, }, unmarshalIp, ) /** - * Get an IP. + * Get an IP address. Retrieve the full details of a Load Balancer flexible IP + * address. * - * @param request - The request {@link GetIpRequest} + * @param request - The request {@link ZonedApiGetIpRequest} * @returns A Promise of Ip */ - getIp = (request: Readonly) => + getIp = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/ips/${validatePathParam('ipId', request.ipId)}`, }, unmarshalIp, ) /** - * Delete an IP. + * Delete an IP address. Delete a Load Balancer flexible IP address. This + * action is irreversible, and cannot be undone. * - * @param request - The request {@link ReleaseIpRequest} + * @param request - The request {@link ZonedApiReleaseIpRequest} */ - releaseIp = (request: Readonly) => + releaseIp = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/ips/${validatePathParam('ipId', request.ipId)}`, }) /** - * Update an IP. + * Update an IP address. Update the reverse DNS of a Load Balancer flexible IP + * address. * - * @param request - The request {@link UpdateIpRequest} + * @param request - The request {@link ZonedApiUpdateIpRequest} * @returns A Promise of Ip */ - updateIp = (request: Readonly) => + updateIp = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalUpdateIpRequest(request, this.client.settings), + marshalZonedApiUpdateIpRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PATCH', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/ips/${validatePathParam('ipId', request.ipId)}`, }, unmarshalIp, ) - protected pageOfListBackends = (request: Readonly) => + protected pageOfListBackends = ( + request: Readonly, + ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}/backends`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -509,107 +541,127 @@ export class API extends ParentAPI { ) /** - * List backends in a given load balancer. + * List the backends of a given Load Balancer. List all the backends of a Load + * Balancer, specified by its Load Balancer ID. By default, results are + * returned in ascending order by the creation date of each backend. The + * response is an array of backend objects, containing full details of each + * one including their configuration parameters such as protocol, port and + * forwarding algorithm. * - * @param request - The request {@link ListBackendsRequest} + * @param request - The request {@link ZonedApiListBackendsRequest} * @returns A Promise of ListBackendsResponse */ - listBackends = (request: Readonly) => + listBackends = (request: Readonly) => enrichForPagination('backends', this.pageOfListBackends, request) /** - * Create a backend in a given load balancer. + * Create a backend for a given Load Balancer. Create a new backend for a + * given Load Balancer, specifying its full configuration including protocol, + * port and forwarding algorithm. * - * @param request - The request {@link CreateBackendRequest} + * @param request - The request {@link ZonedApiCreateBackendRequest} * @returns A Promise of Backend */ - createBackend = (request: Readonly) => + createBackend = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalCreateBackendRequest(request, this.client.settings), + marshalZonedApiCreateBackendRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}/backends`, }, unmarshalBackend, ) /** - * Get a backend in a given load balancer. + * Get a backend of a given Load Balancer. Get the full details of a given + * backend, specified by its backend ID. The response contains the backend's + * full configuration parameters including protocol, port and forwarding + * algorithm. * - * @param request - The request {@link GetBackendRequest} + * @param request - The request {@link ZonedApiGetBackendRequest} * @returns A Promise of Backend */ - getBackend = (request: Readonly) => + getBackend = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/backends/${validatePathParam('backendId', request.backendId)}`, }, unmarshalBackend, ) /** - * Update a backend in a given load balancer. + * Update a backend of a given Load Balancer. Update a backend of a given Load + * Balancer, specified by its backend ID. Note that the request type is PUT + * and not PATCH. You must set all parameters. * - * @param request - The request {@link UpdateBackendRequest} + * @param request - The request {@link ZonedApiUpdateBackendRequest} * @returns A Promise of Backend */ - updateBackend = (request: Readonly) => + updateBackend = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalUpdateBackendRequest(request, this.client.settings), + marshalZonedApiUpdateBackendRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/backends/${validatePathParam('backendId', request.backendId)}`, }, unmarshalBackend, ) /** - * Delete a backend in a given load balancer. + * Delete a backend of a given Load Balancer. Delete a backend of a given Load + * Balancer, specified by its backend ID. This action is irreversible and + * cannot be undone. * - * @param request - The request {@link DeleteBackendRequest} + * @param request - The request {@link ZonedApiDeleteBackendRequest} */ - deleteBackend = (request: Readonly) => + deleteBackend = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/backends/${validatePathParam('backendId', request.backendId)}`, }) /** - * Add a set of servers in a given backend. + * Add a set of backend servers to a given backend. For a given backend + * specified by its backend ID, add a set of backend servers (identified by + * their IP addresses) it should forward traffic to. These will be appended to + * any existing set of backend servers for this backend. * - * @param request - The request {@link AddBackendServersRequest} + * @param request - The request {@link ZonedApiAddBackendServersRequest} * @returns A Promise of Backend */ - addBackendServers = (request: Readonly) => + addBackendServers = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalAddBackendServersRequest(request, this.client.settings), + marshalZonedApiAddBackendServersRequest( + request, + this.client.settings, + ), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/backends/${validatePathParam( 'backendId', request.backendId, @@ -619,22 +671,29 @@ export class API extends ParentAPI { ) /** - * Remove a set of servers for a given backend. + * Remove a set of servers for a given backend. For a given backend specified + * by its backend ID, remove the specified backend servers (identified by + * their IP addresses) so that it no longer forwards traffic to them. * - * @param request - The request {@link RemoveBackendServersRequest} + * @param request - The request {@link ZonedApiRemoveBackendServersRequest} * @returns A Promise of Backend */ - removeBackendServers = (request: Readonly) => + removeBackendServers = ( + request: Readonly, + ) => this.client.fetch( { body: JSON.stringify( - marshalRemoveBackendServersRequest(request, this.client.settings), + marshalZonedApiRemoveBackendServersRequest( + request, + this.client.settings, + ), ), headers: jsonContentHeaders, method: 'DELETE', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/backends/${validatePathParam( 'backendId', request.backendId, @@ -644,22 +703,28 @@ export class API extends ParentAPI { ) /** - * Define all servers in a given backend. + * Define all backend servers for a given backend. For a given backend + * specified by its backend ID, define the set of backend servers (identified + * by their IP addresses) that it should forward traffic to. Any existing + * backend servers configured for this backend will be removed. * - * @param request - The request {@link SetBackendServersRequest} + * @param request - The request {@link ZonedApiSetBackendServersRequest} * @returns A Promise of Backend */ - setBackendServers = (request: Readonly) => + setBackendServers = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalSetBackendServersRequest(request, this.client.settings), + marshalZonedApiSetBackendServersRequest( + request, + this.client.settings, + ), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/backends/${validatePathParam( 'backendId', request.backendId, @@ -669,22 +734,28 @@ export class API extends ParentAPI { ) /** - * Update an health check for a given backend. + * Update a health check for a given backend. Update the configuration of the + * health check performed by a given backend to verify the health of its + * backend servers, identified by its backend ID. Note that the request type + * is PUT and not PATCH. You must set all parameters. * - * @param request - The request {@link UpdateHealthCheckRequest} + * @param request - The request {@link ZonedApiUpdateHealthCheckRequest} * @returns A Promise of HealthCheck */ - updateHealthCheck = (request: Readonly) => + updateHealthCheck = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalUpdateHealthCheckRequest(request, this.client.settings), + marshalZonedApiUpdateHealthCheckRequest( + request, + this.client.settings, + ), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/backends/${validatePathParam( 'backendId', request.backendId, @@ -693,17 +764,19 @@ export class API extends ParentAPI { unmarshalHealthCheck, ) - protected pageOfListFrontends = (request: Readonly) => + protected pageOfListFrontends = ( + request: Readonly, + ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}/frontends`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -715,101 +788,117 @@ export class API extends ParentAPI { ) /** - * List frontends in a given load balancer. + * List frontends of a given Load Balancer. List all the frontends of a Load + * Balancer, specified by its Load Balancer ID. By default, results are + * returned in ascending order by the creation date of each frontend. The + * response is an array of frontend objects, containing full details of each + * one including the port they listen on and the backend they are attached + * to. * - * @param request - The request {@link ListFrontendsRequest} + * @param request - The request {@link ZonedApiListFrontendsRequest} * @returns A Promise of ListFrontendsResponse */ - listFrontends = (request: Readonly) => + listFrontends = (request: Readonly) => enrichForPagination('frontends', this.pageOfListFrontends, request) /** - * Create a frontend in a given load balancer. + * Create a frontend in a given Load Balancer. Create a new frontend for a + * given Load Balancer, specifying its configuration including the port it + * should listen on and the backend to attach it to. * - * @param request - The request {@link CreateFrontendRequest} + * @param request - The request {@link ZonedApiCreateFrontendRequest} * @returns A Promise of Frontend */ - createFrontend = (request: Readonly) => + createFrontend = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalCreateFrontendRequest(request, this.client.settings), + marshalZonedApiCreateFrontendRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}/frontends`, }, unmarshalFrontend, ) /** - * Get a frontend. + * Get a frontend. Get the full details of a given frontend, specified by its + * frontend ID. The response contains the frontend's full configuration + * parameters including the backend it is attached to, the port it listens on, + * and any certificates it has. * - * @param request - The request {@link GetFrontendRequest} + * @param request - The request {@link ZonedApiGetFrontendRequest} * @returns A Promise of Frontend */ - getFrontend = (request: Readonly) => + getFrontend = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/frontends/${validatePathParam('frontendId', request.frontendId)}`, }, unmarshalFrontend, ) /** - * Update a frontend. + * Update a frontend. Update a given frontend, specified by its frontend ID. + * You can update configuration parameters including its name and the port it + * listens on. Note that the request type is PUT and not PATCH. You must set + * all parameters. * - * @param request - The request {@link UpdateFrontendRequest} + * @param request - The request {@link ZonedApiUpdateFrontendRequest} * @returns A Promise of Frontend */ - updateFrontend = (request: Readonly) => + updateFrontend = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalUpdateFrontendRequest(request, this.client.settings), + marshalZonedApiUpdateFrontendRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/frontends/${validatePathParam('frontendId', request.frontendId)}`, }, unmarshalFrontend, ) /** - * Delete a frontend. + * Delete a frontend. Delete a given frontend, specified by its frontend ID. + * This action is irreversible and cannot be undone. * - * @param request - The request {@link DeleteFrontendRequest} + * @param request - The request {@link ZonedApiDeleteFrontendRequest} */ - deleteFrontend = (request: Readonly) => + deleteFrontend = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/frontends/${validatePathParam('frontendId', request.frontendId)}`, }) - protected pageOfListRoutes = (request: Readonly = {}) => + protected pageOfListRoutes = ( + request: Readonly = {}, + ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/routes`, urlParams: urlParams( ['frontend_id', request.frontendId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -821,104 +910,113 @@ export class API extends ParentAPI { ) /** - * List all backend redirections. + * List all routes. List all routes for a given frontend. The response is an + * array of routes, each one with a specified backend to direct to if a + * certain condition is matched (based on the value of the SNI field or HTTP + * Host header). * - * @param request - The request {@link ListRoutesRequest} + * @param request - The request {@link ZonedApiListRoutesRequest} * @returns A Promise of ListRoutesResponse */ - listRoutes = (request: Readonly = {}) => + listRoutes = (request: Readonly = {}) => enrichForPagination('routes', this.pageOfListRoutes, request) /** - * Create a backend redirection. + * Create a route. Create a new route on a given frontend. To configure a + * route, specify the backend to direct to if a certain condition is matched + * (based on the value of the SNI field or HTTP Host header). * - * @param request - The request {@link CreateRouteRequest} + * @param request - The request {@link ZonedApiCreateRouteRequest} * @returns A Promise of Route */ - createRoute = (request: Readonly) => + createRoute = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalCreateRouteRequest(request, this.client.settings), + marshalZonedApiCreateRouteRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/routes`, }, unmarshalRoute, ) /** - * Get single backend redirection. + * Get a route. Retrieve information about an existing route, specified by its + * route ID. Its full details, origin frontend, target backend and match + * condition, are returned in the response object. * - * @param request - The request {@link GetRouteRequest} + * @param request - The request {@link ZonedApiGetRouteRequest} * @returns A Promise of Route */ - getRoute = (request: Readonly) => + getRoute = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/routes/${validatePathParam('routeId', request.routeId)}`, }, unmarshalRoute, ) /** - * Edit a backend redirection. + * Update a route. Update the configuration of an existing route, specified by + * its route ID. * - * @param request - The request {@link UpdateRouteRequest} + * @param request - The request {@link ZonedApiUpdateRouteRequest} * @returns A Promise of Route */ - updateRoute = (request: Readonly) => + updateRoute = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalUpdateRouteRequest(request, this.client.settings), + marshalZonedApiUpdateRouteRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/routes/${validatePathParam('routeId', request.routeId)}`, }, unmarshalRoute, ) /** - * Delete a backend redirection. + * Delete a route. Delete an existing route, specified by its route ID. + * Deleting a route is permanent, and cannot be undone. * - * @param request - The request {@link DeleteRouteRequest} + * @param request - The request {@link ZonedApiDeleteRouteRequest} */ - deleteRoute = (request: Readonly) => + deleteRoute = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/routes/${validatePathParam('routeId', request.routeId)}`, }) /** - * Get usage statistics of a given load balancer. + * Get usage statistics of a given Load Balancer. * * @deprecated - * @param request - The request {@link GetLbStatsRequest} + * @param request - The request {@link ZonedApiGetLbStatsRequest} * @returns A Promise of LbStats */ - getLbStats = (request: Readonly) => + getLbStats = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}/stats`, urlParams: urlParams(['backend_id', request.backendId]), }, @@ -926,14 +1024,14 @@ export class API extends ParentAPI { ) protected pageOfListBackendStats = ( - request: Readonly, + request: Readonly, ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}/backend-stats`, urlParams: urlParams( ['backend_id', request.backendId], @@ -948,32 +1046,33 @@ export class API extends ParentAPI { ) /** - * List backend server statistics. + * List backend server statistics. List information about your backend + * servers, including their state and the result of their last health check. * - * @param request - The request {@link ListBackendStatsRequest} + * @param request - The request {@link ZonedApiListBackendStatsRequest} * @returns A Promise of ListBackendStatsResponse */ - listBackendStats = (request: Readonly) => + listBackendStats = (request: Readonly) => enrichForPagination( 'backendServersStats', this.pageOfListBackendStats, request, ) - protected pageOfListAcls = (request: Readonly) => + protected pageOfListAcls = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/frontends/${validatePathParam( 'frontendId', request.frontendId, )}/acls`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -985,31 +1084,37 @@ export class API extends ParentAPI { ) /** - * List ACL for a given frontend. + * List ACLs for a given frontend. List the ACLs for a given frontend, + * specified by its frontend ID. The response is an array of ACL objects, each + * one representing an ACL that denies or allows traffic based on certain + * conditions. * - * @param request - The request {@link ListAclsRequest} + * @param request - The request {@link ZonedApiListAclsRequest} * @returns A Promise of ListAclResponse */ - listAcls = (request: Readonly) => + listAcls = (request: Readonly) => enrichForPagination('acls', this.pageOfListAcls, request) /** - * Create an ACL for a given frontend. + * Create an ACL for a given frontend. Create a new ACL for a given frontend. + * Each ACL must have a name, an action to perform (allow or deny), and a + * match rule (the action is carried out when the incoming traffic matches the + * rule). * - * @param request - The request {@link CreateAclRequest} + * @param request - The request {@link ZonedApiCreateAclRequest} * @returns A Promise of Acl */ - createAcl = (request: Readonly) => + createAcl = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalCreateAclRequest(request, this.client.settings), + marshalZonedApiCreateAclRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/frontends/${validatePathParam( 'frontendId', request.frontendId, @@ -1019,95 +1124,130 @@ export class API extends ParentAPI { ) /** - * Get an ACL. + * Get an ACL. Get information for a particular ACL, specified by its ACL ID. + * The response returns full details of the ACL, including its name, action, + * match rule and frontend. * - * @param request - The request {@link GetAclRequest} + * @param request - The request {@link ZonedApiGetAclRequest} * @returns A Promise of Acl */ - getAcl = (request: Readonly) => + getAcl = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/acls/${validatePathParam('aclId', request.aclId)}`, }, unmarshalAcl, ) /** - * Update an ACL. + * Update an ACL. Update a particular ACL, specified by its ACL ID. You can + * update details including its name, action and match rule. * - * @param request - The request {@link UpdateAclRequest} + * @param request - The request {@link ZonedApiUpdateAclRequest} * @returns A Promise of Acl */ - updateAcl = (request: Readonly) => + updateAcl = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalUpdateAclRequest(request, this.client.settings), + marshalZonedApiUpdateAclRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/acls/${validatePathParam('aclId', request.aclId)}`, }, unmarshalAcl, ) /** - * Delete an ACL. + * Delete an ACL. Delete an ACL, specified by its ACL ID. Deleting an ACL is + * irreversible and cannot be undone. * - * @param request - The request {@link DeleteAclRequest} + * @param request - The request {@link ZonedApiDeleteAclRequest} */ - deleteAcl = (request: Readonly) => + deleteAcl = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/acls/${validatePathParam('aclId', request.aclId)}`, }) /** - * Create a TLS certificate. Generate a new TLS certificate using Let's - * Encrypt or import your certificate. + * Define all ACLs for a given frontend. For a given frontend specified by its + * frontend ID, define and add the complete set of ACLS for that frontend. Any + * existing ACLs on this frontend will be removed. * - * @param request - The request {@link CreateCertificateRequest} + * @param request - The request {@link ZonedApiSetAclsRequest} + * @returns A Promise of SetAclsResponse + */ + setAcls = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalZonedApiSetAclsRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PUT', + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, + )}/frontends/${validatePathParam( + 'frontendId', + request.frontendId, + )}/acls`, + }, + unmarshalSetAclsResponse, + ) + + /** + * Create an SSL/TLS certificate. Generate a new SSL/TLS certificate for a + * given Load Balancer. You can choose to create a Let's Encrypt certificate, + * or import a custom certificate. + * + * @param request - The request {@link ZonedApiCreateCertificateRequest} * @returns A Promise of Certificate */ - createCertificate = (request: Readonly) => + createCertificate = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalCreateCertificateRequest(request, this.client.settings), + marshalZonedApiCreateCertificateRequest( + request, + this.client.settings, + ), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}/certificates`, }, unmarshalCertificate, ) protected pageOfListCertificates = ( - request: Readonly, + request: Readonly, ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}/certificates`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -1119,27 +1259,33 @@ export class API extends ParentAPI { ) /** - * List all TLS certificates on a given load balancer. + * List all SSL/TLS certificates on a given Load Balancer. List all the + * SSL/TLS certificates on a given Load Balancer. The response is an array of + * certificate objects, which are by default listed in ascending order of + * creation date. * - * @param request - The request {@link ListCertificatesRequest} + * @param request - The request {@link ZonedApiListCertificatesRequest} * @returns A Promise of ListCertificatesResponse */ - listCertificates = (request: Readonly) => + listCertificates = (request: Readonly) => enrichForPagination('certificates', this.pageOfListCertificates, request) /** - * Get a TLS certificate. + * Get an SSL/TLS certificate. Get information for a particular SSL/TLS + * certificate, specified by its certificate ID. The response returns full + * details of the certificate, including its type, main domain name, and + * alternative domain names. * - * @param request - The request {@link GetCertificateRequest} + * @param request - The request {@link ZonedApiGetCertificateRequest} * @returns A Promise of Certificate */ - getCertificate = (request: Readonly) => + getCertificate = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/certificates/${validatePathParam( 'certificateId', request.certificateId, @@ -1151,12 +1297,12 @@ export class API extends ParentAPI { /** * Waits for {@link Certificate} to be in a final state. * - * @param request - The request {@link GetCertificateRequest} + * @param request - The request {@link ZonedApiGetCertificateRequest} * @param options - The waiting options * @returns A Promise of Certificate */ waitForCertificate = ( - request: Readonly, + request: Readonly, options?: Readonly>, ) => waitForResource( @@ -1171,22 +1317,26 @@ export class API extends ParentAPI { ) /** - * Update a TLS certificate. + * Update an SSL/TLS certificate. Update the name of a particular SSL/TLS + * certificate, specified by its certificate ID. * - * @param request - The request {@link UpdateCertificateRequest} + * @param request - The request {@link ZonedApiUpdateCertificateRequest} * @returns A Promise of Certificate */ - updateCertificate = (request: Readonly) => + updateCertificate = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalUpdateCertificateRequest(request, this.client.settings), + marshalZonedApiUpdateCertificateRequest( + request, + this.client.settings, + ), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/certificates/${validatePathParam( 'certificateId', request.certificateId, @@ -1196,29 +1346,33 @@ export class API extends ParentAPI { ) /** - * Delete a TLS certificate. + * Delete an SSL/TLS certificate. Delete an SSL/TLS certificate, specified by + * its certificate ID. Deleting a certificate is irreversible and cannot be + * undone. * - * @param request - The request {@link DeleteCertificateRequest} + * @param request - The request {@link ZonedApiDeleteCertificateRequest} */ - deleteCertificate = (request: Readonly) => + deleteCertificate = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/certificates/${validatePathParam( 'certificateId', request.certificateId, )}`, }) - protected pageOfListLbTypes = (request: Readonly = {}) => + protected pageOfListLbTypes = ( + request: Readonly = {}, + ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lb-types`, urlParams: urlParams( ['page', request.page], @@ -1232,49 +1386,55 @@ export class API extends ParentAPI { ) /** - * List all load balancer offer type. + * List all Load Balancer offer types. List all the different commercial Load + * Balancer types. The response includes an array of offer types, each with a + * name, description, and information about its stock availability. * - * @param request - The request {@link ListLbTypesRequest} + * @param request - The request {@link ZonedApiListLbTypesRequest} * @returns A Promise of ListLbTypesResponse */ - listLbTypes = (request: Readonly = {}) => + listLbTypes = (request: Readonly = {}) => enrichForPagination('lbTypes', this.pageOfListLbTypes, request) /** - * Create a subscriber, webhook or email. + * Create a subscriber. Create a new subscriber, either with an email + * configuration or a webhook configuration, for a specified Scaleway + * Project. * - * @param request - The request {@link CreateSubscriberRequest} + * @param request - The request {@link ZonedApiCreateSubscriberRequest} * @returns A Promise of Subscriber */ - createSubscriber = (request: Readonly) => + createSubscriber = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalCreateSubscriberRequest(request, this.client.settings), + marshalZonedApiCreateSubscriberRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/subscribers`, }, unmarshalSubscriber, ) /** - * Get a subscriber. + * Get a subscriber. Retrieve information about an existing subscriber, + * specified by its subscriber ID. Its full details, including name and + * email/webhook configuration, are returned in the response object. * - * @param request - The request {@link GetSubscriberRequest} + * @param request - The request {@link ZonedApiGetSubscriberRequest} * @returns A Promise of Subscriber */ - getSubscriber = (request: Readonly) => + getSubscriber = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/subscribers/${validatePathParam( 'subscriberId', request.subscriberId, @@ -1283,17 +1443,19 @@ export class API extends ParentAPI { unmarshalSubscriber, ) - protected pageOfListSubscriber = (request: Readonly) => + protected pageOfListSubscriber = ( + request: Readonly = {}, + ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/subscribers`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -1307,31 +1469,36 @@ export class API extends ParentAPI { ) /** - * List all subscriber. + * List all subscribers. List all subscribers to Load Balancer alerts. By + * default, returns all subscribers to Load Balancer alerts for the + * Organization associated with the authentication token used for the + * request. * - * @param request - The request {@link ListSubscriberRequest} + * @param request - The request {@link ZonedApiListSubscriberRequest} * @returns A Promise of ListSubscriberResponse */ - listSubscriber = (request: Readonly) => + listSubscriber = (request: Readonly = {}) => enrichForPagination('subscribers', this.pageOfListSubscriber, request) /** - * Update a subscriber. + * Update a subscriber. Update the parameters of a given subscriber (e.g. + * name, webhook configuration, email configuration), specified by its + * subscriber ID. * - * @param request - The request {@link UpdateSubscriberRequest} + * @param request - The request {@link ZonedApiUpdateSubscriberRequest} * @returns A Promise of Subscriber */ - updateSubscriber = (request: Readonly) => + updateSubscriber = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalUpdateSubscriberRequest(request, this.client.settings), + marshalZonedApiUpdateSubscriberRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/subscribers/${validatePathParam( 'subscriberId', request.subscriberId, @@ -1341,74 +1508,78 @@ export class API extends ParentAPI { ) /** - * Delete a subscriber. + * Delete a subscriber. Delete an existing subscriber, specified by its + * subscriber ID. Deleting a subscriber is permanent, and cannot be undone. * - * @param request - The request {@link DeleteSubscriberRequest} + * @param request - The request {@link ZonedApiDeleteSubscriberRequest} */ - deleteSubscriber = (request: Readonly) => + deleteSubscriber = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, - )}/lb/subscriber/${validatePathParam( + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, + )}/lb/subscription/${validatePathParam( 'subscriberId', request.subscriberId, )}`, }) /** - * Subscribe a subscriber to a given load balancer. + * Subscribe a subscriber to alerts for a given Load Balancer. Subscribe an + * existing subscriber to alerts for a given Load Balancer. * - * @param request - The request {@link SubscribeToLbRequest} + * @param request - The request {@link ZonedApiSubscribeToLbRequest} * @returns A Promise of Lb */ - subscribeToLb = (request: Readonly) => + subscribeToLb = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalSubscribeToLbRequest(request, this.client.settings), + marshalZonedApiSubscribeToLbRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lb/${validatePathParam('lbId', request.lbId)}/subscribe`, }, unmarshalLb, ) /** - * Unsubscribe a subscriber from a given load balancer. + * Unsubscribe a subscriber from alerts for a given Load Balancer. Unsubscribe + * a subscriber from alerts for a given Load Balancer. The subscriber is not + * deleted, and can be resubscribed in the future if necessary. * - * @param request - The request {@link UnsubscribeFromLbRequest} + * @param request - The request {@link ZonedApiUnsubscribeFromLbRequest} * @returns A Promise of Lb */ - unsubscribeFromLb = (request: Readonly) => + unsubscribeFromLb = (request: Readonly) => this.client.fetch( { method: 'DELETE', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lb/${validatePathParam('lbId', request.lbId)}/unsubscribe`, }, unmarshalLb, ) protected pageOfListLbPrivateNetworks = ( - request: Readonly, + request: Readonly, ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam('lbId', request.lbId)}/private-networks`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -1420,12 +1591,18 @@ export class API extends ParentAPI { ) /** - * List attached private network of load balancer. + * List Private Networks attached to a Load Balancer. List the Private + * Networks attached to a given Load Balancer, specified by its Load Balancer + * ID. The response is an array of Private Network objects, giving information + * including the status, configuration, name and creation date of each Private + * Network. * - * @param request - The request {@link ListLbPrivateNetworksRequest} + * @param request - The request {@link ZonedApiListLbPrivateNetworksRequest} * @returns A Promise of ListLbPrivateNetworksResponse */ - listLbPrivateNetworks = (request: Readonly) => + listLbPrivateNetworks = ( + request: Readonly, + ) => enrichForPagination( 'privateNetwork', this.pageOfListLbPrivateNetworks, @@ -1433,22 +1610,29 @@ export class API extends ParentAPI { ) /** - * Add load balancer on instance private network. + * Attach a Load Balancer to a Private Network. Attach a specified Load + * Balancer to a specified Private Network, defining a static or DHCP + * configuration for the Load Balancer on the network. * - * @param request - The request {@link AttachPrivateNetworkRequest} + * @param request - The request {@link ZonedApiAttachPrivateNetworkRequest} * @returns A Promise of PrivateNetwork */ - attachPrivateNetwork = (request: Readonly) => + attachPrivateNetwork = ( + request: Readonly, + ) => this.client.fetch( { body: JSON.stringify( - marshalAttachPrivateNetworkRequest(request, this.client.settings), + marshalZonedApiAttachPrivateNetworkRequest( + request, + this.client.settings, + ), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam( 'lbId', request.lbId, @@ -1461,18 +1645,21 @@ export class API extends ParentAPI { ) /** - * Remove load balancer of private network. + * Detach Load Balancer from Private Network. Detach a specified Load Balancer + * from a specified Private Network. * - * @param request - The request {@link DetachPrivateNetworkRequest} + * @param request - The request {@link ZonedApiDetachPrivateNetworkRequest} */ - detachPrivateNetwork = (request: Readonly) => + detachPrivateNetwork = ( + request: Readonly, + ) => this.client.fetch({ body: '{}', headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/regions/${validatePathParam( - 'region', - request.region ?? this.client.settings.defaultRegion, + path: `/lb/v1/zones/${validatePathParam( + 'zone', + request.zone ?? this.client.settings.defaultZone, )}/lbs/${validatePathParam( 'lbId', request.lbId, @@ -1484,35 +1671,25 @@ export class API extends ParentAPI { } /** - * Load Balancer API. + * Load balancer API. * - * This API allows you to manage your Scaleway Load Balancer services. Load - * Balancer API. + * This API allows you to manage your load balancer service. */ -export class ZonedAPI 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', - ] +export class API extends ParentAPI { + /** Lists the available regions of the API. */ + public static readonly LOCALITIES: Region[] = ['fr-par', 'nl-ams', 'pl-waw'] - protected pageOfListLbs = (request: Readonly = {}) => + protected pageOfListLbs = (request: Readonly = {}) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -1526,56 +1703,49 @@ export class ZonedAPI extends ParentAPI { ) /** - * List Load Balancers. List all Load Balancers in the specified zone, for a - * Scaleway Organization or Scaleway Project. By default, the Load Balancers - * returned in the list are ordered by creation date in ascending order, - * though this can be modified via the `order_by` field. + * List load balancers. * - * @param request - The request {@link ZonedApiListLbsRequest} + * @param request - The request {@link ListLbsRequest} * @returns A Promise of ListLbsResponse */ - listLbs = (request: Readonly = {}) => + listLbs = (request: Readonly = {}) => enrichForPagination('lbs', this.pageOfListLbs, request) /** - * Create a Load Balancer. Create a new Load Balancer. Note that the Load - * Balancer will be created without frontends or backends; these must be - * created separately via the dedicated endpoints. + * Create a load balancer. * - * @param request - The request {@link ZonedApiCreateLbRequest} + * @param request - The request {@link CreateLbRequest} * @returns A Promise of Lb */ - createLb = (request: Readonly) => + createLb = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiCreateLbRequest(request, this.client.settings), + marshalCreateLbRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs`, }, unmarshalLb, ) /** - * Get a Load Balancer. Retrieve information about an existing Load Balancer, - * specified by its Load Balancer ID. Its full details, including name, status - * and IP address, are returned in the response object. + * Get a load balancer. * - * @param request - The request {@link ZonedApiGetLbRequest} + * @param request - The request {@link GetLbRequest} * @returns A Promise of Lb */ - getLb = (request: Readonly) => + getLb = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}`, }, unmarshalLb, @@ -1589,7 +1759,7 @@ export class ZonedAPI extends ParentAPI { * @returns A Promise of Lb */ waitForLb = ( - request: Readonly, + request: Readonly, options?: Readonly>, ) => waitForResource( @@ -1601,78 +1771,71 @@ export class ZonedAPI extends ParentAPI { ) /** - * Update a Load Balancer. Update the parameters of an existing Load Balancer, - * specified by its Load Balancer ID. Note that the request type is PUT and - * not PATCH. You must set all parameters. + * Update a load balancer. * - * @param request - The request {@link ZonedApiUpdateLbRequest} + * @param request - The request {@link UpdateLbRequest} * @returns A Promise of Lb */ - updateLb = (request: Readonly) => + updateLb = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiUpdateLbRequest(request, this.client.settings), + marshalUpdateLbRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}`, }, unmarshalLb, ) /** - * Delete a Load Balancer. Delete an existing Load Balancer, specified by its - * Load Balancer ID. Deleting a Load Balancer is permanent, and cannot be - * undone. The Load Balancer's flexible IP address can either be deleted with - * the Load Balancer, or kept in your account for future use. + * Delete a load balancer. * - * @param request - The request {@link ZonedApiDeleteLbRequest} + * @param request - The request {@link DeleteLbRequest} */ - deleteLb = (request: Readonly) => + deleteLb = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}`, urlParams: urlParams(['release_ip', request.releaseIp]), }) /** - * Migrate a Load Balancer. Migrate an existing Load Balancer from one - * commercial type to another. Allows you to scale your Load Balancer up or - * down in terms of bandwidth or multi-cloud provision. + * Migrate a load balancer. * - * @param request - The request {@link ZonedApiMigrateLbRequest} + * @param request - The request {@link MigrateLbRequest} * @returns A Promise of Lb */ - migrateLb = (request: Readonly) => + migrateLb = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiMigrateLbRequest(request, this.client.settings), + marshalMigrateLbRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}/migrate`, }, unmarshalLb, ) - protected pageOfListIPs = (request: Readonly = {}) => + protected pageOfListIPs = (request: Readonly = {}) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/ips`, urlParams: urlParams( ['ip_address', request.ipAddress], @@ -1689,110 +1852,101 @@ export class ZonedAPI extends ParentAPI { ) /** - * List IP addresses. List the Load Balancer flexible IP addresses held in the - * account (filtered by Organization ID or Project ID). It is also possible to - * search for a specific IP address. + * List IPs. * - * @param request - The request {@link ZonedApiListIPsRequest} + * @param request - The request {@link ListIPsRequest} * @returns A Promise of ListIpsResponse */ - listIPs = (request: Readonly = {}) => + listIPs = (request: Readonly = {}) => enrichForPagination('ips', this.pageOfListIPs, request) /** - * Create an IP address. Create a new Load Balancer flexible IP address, in - * the specified Scaleway Project. This can be attached to new Load Balancers - * created in the future. + * Create an IP. * - * @param request - The request {@link ZonedApiCreateIpRequest} + * @param request - The request {@link CreateIpRequest} * @returns A Promise of Ip */ - createIp = (request: Readonly = {}) => + createIp = (request: Readonly = {}) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiCreateIpRequest(request, this.client.settings), + marshalCreateIpRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/ips`, }, unmarshalIp, ) /** - * Get an IP address. Retrieve the full details of a Load Balancer flexible IP - * address. + * Get an IP. * - * @param request - The request {@link ZonedApiGetIpRequest} + * @param request - The request {@link GetIpRequest} * @returns A Promise of Ip */ - getIp = (request: Readonly) => + getIp = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/ips/${validatePathParam('ipId', request.ipId)}`, }, unmarshalIp, ) /** - * Delete an IP address. Delete a Load Balancer flexible IP address. This - * action is irreversible, and cannot be undone. + * Delete an IP. * - * @param request - The request {@link ZonedApiReleaseIpRequest} + * @param request - The request {@link ReleaseIpRequest} */ - releaseIp = (request: Readonly) => + releaseIp = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/ips/${validatePathParam('ipId', request.ipId)}`, }) /** - * Update an IP address. Update the reverse DNS of a Load Balancer flexible IP - * address. + * Update an IP. * - * @param request - The request {@link ZonedApiUpdateIpRequest} + * @param request - The request {@link UpdateIpRequest} * @returns A Promise of Ip */ - updateIp = (request: Readonly) => + updateIp = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiUpdateIpRequest(request, this.client.settings), + marshalUpdateIpRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PATCH', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/ips/${validatePathParam('ipId', request.ipId)}`, }, unmarshalIp, ) - protected pageOfListBackends = ( - request: Readonly, - ) => + protected pageOfListBackends = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}/backends`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -1804,127 +1958,107 @@ export class ZonedAPI extends ParentAPI { ) /** - * List the backends of a given Load Balancer. List all the backends of a Load - * Balancer, specified by its Load Balancer ID. By default, results are - * returned in ascending order by the creation date of each backend. The - * response is an array of backend objects, containing full details of each - * one including their configuration parameters such as protocol, port and - * forwarding algorithm. + * List backends in a given load balancer. * - * @param request - The request {@link ZonedApiListBackendsRequest} + * @param request - The request {@link ListBackendsRequest} * @returns A Promise of ListBackendsResponse */ - listBackends = (request: Readonly) => + listBackends = (request: Readonly) => enrichForPagination('backends', this.pageOfListBackends, request) /** - * Create a backend for a given Load Balancer. Create a new backend for a - * given Load Balancer, specifying its full configuration including protocol, - * port and forwarding algorithm. + * Create a backend in a given load balancer. * - * @param request - The request {@link ZonedApiCreateBackendRequest} + * @param request - The request {@link CreateBackendRequest} * @returns A Promise of Backend */ - createBackend = (request: Readonly) => + createBackend = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiCreateBackendRequest(request, this.client.settings), + marshalCreateBackendRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}/backends`, }, unmarshalBackend, ) /** - * Get a backend of a given Load Balancer. Get the full details of a given - * backend, specified by its backend ID. The response contains the backend's - * full configuration parameters including protocol, port and forwarding - * algorithm. + * Get a backend in a given load balancer. * - * @param request - The request {@link ZonedApiGetBackendRequest} + * @param request - The request {@link GetBackendRequest} * @returns A Promise of Backend */ - getBackend = (request: Readonly) => + getBackend = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/backends/${validatePathParam('backendId', request.backendId)}`, }, unmarshalBackend, ) /** - * Update a backend of a given Load Balancer. Update a backend of a given Load - * Balancer, specified by its backend ID. Note that the request type is PUT - * and not PATCH. You must set all parameters. + * Update a backend in a given load balancer. * - * @param request - The request {@link ZonedApiUpdateBackendRequest} + * @param request - The request {@link UpdateBackendRequest} * @returns A Promise of Backend */ - updateBackend = (request: Readonly) => + updateBackend = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiUpdateBackendRequest(request, this.client.settings), + marshalUpdateBackendRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/backends/${validatePathParam('backendId', request.backendId)}`, }, unmarshalBackend, ) /** - * Delete a backend of a given Load Balancer. Delete a backend of a given Load - * Balancer, specified by its backend ID. This action is irreversible and - * cannot be undone. + * Delete a backend in a given load balancer. * - * @param request - The request {@link ZonedApiDeleteBackendRequest} + * @param request - The request {@link DeleteBackendRequest} */ - deleteBackend = (request: Readonly) => + deleteBackend = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/backends/${validatePathParam('backendId', request.backendId)}`, }) /** - * Add a set of backend servers to a given backend. For a given backend - * specified by its backend ID, add a set of backend servers (identified by - * their IP addresses) it should forward traffic to. These will be appended to - * any existing set of backend servers for this backend. + * Add a set of servers in a given backend. * - * @param request - The request {@link ZonedApiAddBackendServersRequest} + * @param request - The request {@link AddBackendServersRequest} * @returns A Promise of Backend */ - addBackendServers = (request: Readonly) => + addBackendServers = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiAddBackendServersRequest( - request, - this.client.settings, - ), + marshalAddBackendServersRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/backends/${validatePathParam( 'backendId', request.backendId, @@ -1934,29 +2068,22 @@ export class ZonedAPI extends ParentAPI { ) /** - * Remove a set of servers for a given backend. For a given backend specified - * by its backend ID, remove the specified backend servers (identified by - * their IP addresses) so that it no longer forwards traffic to them. + * Remove a set of servers for a given backend. * - * @param request - The request {@link ZonedApiRemoveBackendServersRequest} + * @param request - The request {@link RemoveBackendServersRequest} * @returns A Promise of Backend */ - removeBackendServers = ( - request: Readonly, - ) => + removeBackendServers = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiRemoveBackendServersRequest( - request, - this.client.settings, - ), + marshalRemoveBackendServersRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'DELETE', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/backends/${validatePathParam( 'backendId', request.backendId, @@ -1966,28 +2093,22 @@ export class ZonedAPI extends ParentAPI { ) /** - * Define all backend servers for a given backend. For a given backend - * specified by its backend ID, define the set of backend servers (identified - * by their IP addresses) that it should forward traffic to. Any existing - * backend servers configured for this backend will be removed. + * Define all servers in a given backend. * - * @param request - The request {@link ZonedApiSetBackendServersRequest} + * @param request - The request {@link SetBackendServersRequest} * @returns A Promise of Backend */ - setBackendServers = (request: Readonly) => + setBackendServers = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiSetBackendServersRequest( - request, - this.client.settings, - ), + marshalSetBackendServersRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/backends/${validatePathParam( 'backendId', request.backendId, @@ -1997,28 +2118,22 @@ export class ZonedAPI extends ParentAPI { ) /** - * Update a health check for a given backend. Update the configuration of the - * health check performed by a given backend to verify the health of its - * backend servers, identified by its backend ID. Note that the request type - * is PUT and not PATCH. You must set all parameters. + * Update an health check for a given backend. * - * @param request - The request {@link ZonedApiUpdateHealthCheckRequest} + * @param request - The request {@link UpdateHealthCheckRequest} * @returns A Promise of HealthCheck */ - updateHealthCheck = (request: Readonly) => + updateHealthCheck = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiUpdateHealthCheckRequest( - request, - this.client.settings, - ), + marshalUpdateHealthCheckRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/backends/${validatePathParam( 'backendId', request.backendId, @@ -2027,19 +2142,17 @@ export class ZonedAPI extends ParentAPI { unmarshalHealthCheck, ) - protected pageOfListFrontends = ( - request: Readonly, - ) => + protected pageOfListFrontends = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}/frontends`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -2051,117 +2164,101 @@ export class ZonedAPI extends ParentAPI { ) /** - * List frontends of a given Load Balancer. List all the frontends of a Load - * Balancer, specified by its Load Balancer ID. By default, results are - * returned in ascending order by the creation date of each frontend. The - * response is an array of frontend objects, containing full details of each - * one including the port they listen on and the backend they are attached - * to. + * List frontends in a given load balancer. * - * @param request - The request {@link ZonedApiListFrontendsRequest} + * @param request - The request {@link ListFrontendsRequest} * @returns A Promise of ListFrontendsResponse */ - listFrontends = (request: Readonly) => + listFrontends = (request: Readonly) => enrichForPagination('frontends', this.pageOfListFrontends, request) /** - * Create a frontend in a given Load Balancer. Create a new frontend for a - * given Load Balancer, specifying its configuration including the port it - * should listen on and the backend to attach it to. + * Create a frontend in a given load balancer. * - * @param request - The request {@link ZonedApiCreateFrontendRequest} + * @param request - The request {@link CreateFrontendRequest} * @returns A Promise of Frontend */ - createFrontend = (request: Readonly) => + createFrontend = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiCreateFrontendRequest(request, this.client.settings), + marshalCreateFrontendRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}/frontends`, }, unmarshalFrontend, ) - /** - * Get a frontend. Get the full details of a given frontend, specified by its - * frontend ID. The response contains the frontend's full configuration - * parameters including the backend it is attached to, the port it listens on, - * and any certificates it has. + /** + * Get a frontend. * - * @param request - The request {@link ZonedApiGetFrontendRequest} + * @param request - The request {@link GetFrontendRequest} * @returns A Promise of Frontend */ - getFrontend = (request: Readonly) => + getFrontend = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/frontends/${validatePathParam('frontendId', request.frontendId)}`, }, unmarshalFrontend, ) /** - * Update a frontend. Update a given frontend, specified by its frontend ID. - * You can update configuration parameters including its name and the port it - * listens on. Note that the request type is PUT and not PATCH. You must set - * all parameters. + * Update a frontend. * - * @param request - The request {@link ZonedApiUpdateFrontendRequest} + * @param request - The request {@link UpdateFrontendRequest} * @returns A Promise of Frontend */ - updateFrontend = (request: Readonly) => + updateFrontend = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiUpdateFrontendRequest(request, this.client.settings), + marshalUpdateFrontendRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/frontends/${validatePathParam('frontendId', request.frontendId)}`, }, unmarshalFrontend, ) /** - * Delete a frontend. Delete a given frontend, specified by its frontend ID. - * This action is irreversible and cannot be undone. + * Delete a frontend. * - * @param request - The request {@link ZonedApiDeleteFrontendRequest} + * @param request - The request {@link DeleteFrontendRequest} */ - deleteFrontend = (request: Readonly) => + deleteFrontend = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/frontends/${validatePathParam('frontendId', request.frontendId)}`, }) - protected pageOfListRoutes = ( - request: Readonly = {}, - ) => + protected pageOfListRoutes = (request: Readonly = {}) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/routes`, urlParams: urlParams( ['frontend_id', request.frontendId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -2173,113 +2270,104 @@ export class ZonedAPI extends ParentAPI { ) /** - * List all routes. List all routes for a given frontend. The response is an - * array of routes, each one with a specified backend to direct to if a - * certain condition is matched (based on the value of the SNI field or HTTP - * Host header). + * List all backend redirections. * - * @param request - The request {@link ZonedApiListRoutesRequest} + * @param request - The request {@link ListRoutesRequest} * @returns A Promise of ListRoutesResponse */ - listRoutes = (request: Readonly = {}) => + listRoutes = (request: Readonly = {}) => enrichForPagination('routes', this.pageOfListRoutes, request) /** - * Create a route. Create a new route on a given frontend. To configure a - * route, specify the backend to direct to if a certain condition is matched - * (based on the value of the SNI field or HTTP Host header). + * Create a backend redirection. * - * @param request - The request {@link ZonedApiCreateRouteRequest} + * @param request - The request {@link CreateRouteRequest} * @returns A Promise of Route */ - createRoute = (request: Readonly) => + createRoute = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiCreateRouteRequest(request, this.client.settings), + marshalCreateRouteRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/routes`, }, unmarshalRoute, ) /** - * Get a route. Retrieve information about an existing route, specified by its - * route ID. Its full details, origin frontend, target backend and match - * condition, are returned in the response object. + * Get single backend redirection. * - * @param request - The request {@link ZonedApiGetRouteRequest} + * @param request - The request {@link GetRouteRequest} * @returns A Promise of Route */ - getRoute = (request: Readonly) => + getRoute = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/routes/${validatePathParam('routeId', request.routeId)}`, }, unmarshalRoute, ) /** - * Update a route. Update the configuration of an existing route, specified by - * its route ID. + * Edit a backend redirection. * - * @param request - The request {@link ZonedApiUpdateRouteRequest} + * @param request - The request {@link UpdateRouteRequest} * @returns A Promise of Route */ - updateRoute = (request: Readonly) => + updateRoute = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiUpdateRouteRequest(request, this.client.settings), + marshalUpdateRouteRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/routes/${validatePathParam('routeId', request.routeId)}`, }, unmarshalRoute, ) /** - * Delete a route. Delete an existing route, specified by its route ID. - * Deleting a route is permanent, and cannot be undone. + * Delete a backend redirection. * - * @param request - The request {@link ZonedApiDeleteRouteRequest} + * @param request - The request {@link DeleteRouteRequest} */ - deleteRoute = (request: Readonly) => + deleteRoute = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/routes/${validatePathParam('routeId', request.routeId)}`, }) /** - * Get usage statistics of a given Load Balancer. + * Get usage statistics of a given load balancer. * * @deprecated - * @param request - The request {@link ZonedApiGetLbStatsRequest} + * @param request - The request {@link GetLbStatsRequest} * @returns A Promise of LbStats */ - getLbStats = (request: Readonly) => + getLbStats = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}/stats`, urlParams: urlParams(['backend_id', request.backendId]), }, @@ -2287,14 +2375,14 @@ export class ZonedAPI extends ParentAPI { ) protected pageOfListBackendStats = ( - request: Readonly, + request: Readonly, ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}/backend-stats`, urlParams: urlParams( ['backend_id', request.backendId], @@ -2309,33 +2397,32 @@ export class ZonedAPI extends ParentAPI { ) /** - * List backend server statistics. List information about your backend - * servers, including their state and the result of their last health check. + * List backend server statistics. * - * @param request - The request {@link ZonedApiListBackendStatsRequest} + * @param request - The request {@link ListBackendStatsRequest} * @returns A Promise of ListBackendStatsResponse */ - listBackendStats = (request: Readonly) => + listBackendStats = (request: Readonly) => enrichForPagination( 'backendServersStats', this.pageOfListBackendStats, request, ) - protected pageOfListAcls = (request: Readonly) => + protected pageOfListAcls = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/frontends/${validatePathParam( 'frontendId', request.frontendId, )}/acls`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -2347,37 +2434,31 @@ export class ZonedAPI extends ParentAPI { ) /** - * List ACLs for a given frontend. List the ACLs for a given frontend, - * specified by its frontend ID. The response is an array of ACL objects, each - * one representing an ACL that denies or allows traffic based on certain - * conditions. + * List ACL for a given frontend. * - * @param request - The request {@link ZonedApiListAclsRequest} + * @param request - The request {@link ListAclsRequest} * @returns A Promise of ListAclResponse */ - listAcls = (request: Readonly) => + listAcls = (request: Readonly) => enrichForPagination('acls', this.pageOfListAcls, request) /** - * Create an ACL for a given frontend. Create a new ACL for a given frontend. - * Each ACL must have a name, an action to perform (allow or deny), and a - * match rule (the action is carried out when the incoming traffic matches the - * rule). + * Create an ACL for a given frontend. * - * @param request - The request {@link ZonedApiCreateAclRequest} + * @param request - The request {@link CreateAclRequest} * @returns A Promise of Acl */ - createAcl = (request: Readonly) => + createAcl = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiCreateAclRequest(request, this.client.settings), + marshalCreateAclRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/frontends/${validatePathParam( 'frontendId', request.frontendId, @@ -2387,130 +2468,95 @@ export class ZonedAPI extends ParentAPI { ) /** - * Get an ACL. Get information for a particular ACL, specified by its ACL ID. - * The response returns full details of the ACL, including its name, action, - * match rule and frontend. + * Get an ACL. * - * @param request - The request {@link ZonedApiGetAclRequest} + * @param request - The request {@link GetAclRequest} * @returns A Promise of Acl */ - getAcl = (request: Readonly) => + getAcl = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/acls/${validatePathParam('aclId', request.aclId)}`, }, unmarshalAcl, ) /** - * Update an ACL. Update a particular ACL, specified by its ACL ID. You can - * update details including its name, action and match rule. + * Update an ACL. * - * @param request - The request {@link ZonedApiUpdateAclRequest} + * @param request - The request {@link UpdateAclRequest} * @returns A Promise of Acl */ - updateAcl = (request: Readonly) => + updateAcl = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiUpdateAclRequest(request, this.client.settings), + marshalUpdateAclRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/acls/${validatePathParam('aclId', request.aclId)}`, }, unmarshalAcl, ) /** - * Delete an ACL. Delete an ACL, specified by its ACL ID. Deleting an ACL is - * irreversible and cannot be undone. + * Delete an ACL. * - * @param request - The request {@link ZonedApiDeleteAclRequest} + * @param request - The request {@link DeleteAclRequest} */ - deleteAcl = (request: Readonly) => + deleteAcl = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/acls/${validatePathParam('aclId', request.aclId)}`, }) /** - * Define all ACLs for a given frontend. For a given frontend specified by its - * frontend ID, define and add the complete set of ACLS for that frontend. Any - * existing ACLs on this frontend will be removed. - * - * @param request - The request {@link ZonedApiSetAclsRequest} - * @returns A Promise of SetAclsResponse - */ - setAcls = (request: Readonly) => - this.client.fetch( - { - body: JSON.stringify( - marshalZonedApiSetAclsRequest(request, this.client.settings), - ), - headers: jsonContentHeaders, - method: 'PUT', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, - )}/frontends/${validatePathParam( - 'frontendId', - request.frontendId, - )}/acls`, - }, - unmarshalSetAclsResponse, - ) - - /** - * Create an SSL/TLS certificate. Generate a new SSL/TLS certificate for a - * given Load Balancer. You can choose to create a Let's Encrypt certificate, - * or import a custom certificate. + * Create a TLS certificate. Generate a new TLS certificate using Let's + * Encrypt or import your certificate. * - * @param request - The request {@link ZonedApiCreateCertificateRequest} + * @param request - The request {@link CreateCertificateRequest} * @returns A Promise of Certificate */ - createCertificate = (request: Readonly) => + createCertificate = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiCreateCertificateRequest( - request, - this.client.settings, - ), + marshalCreateCertificateRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}/certificates`, }, unmarshalCertificate, ) protected pageOfListCertificates = ( - request: Readonly, + request: Readonly, ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}/certificates`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -2522,33 +2568,27 @@ export class ZonedAPI extends ParentAPI { ) /** - * List all SSL/TLS certificates on a given Load Balancer. List all the - * SSL/TLS certificates on a given Load Balancer. The response is an array of - * certificate objects, which are by default listed in ascending order of - * creation date. + * List all TLS certificates on a given load balancer. * - * @param request - The request {@link ZonedApiListCertificatesRequest} + * @param request - The request {@link ListCertificatesRequest} * @returns A Promise of ListCertificatesResponse */ - listCertificates = (request: Readonly) => + listCertificates = (request: Readonly) => enrichForPagination('certificates', this.pageOfListCertificates, request) /** - * Get an SSL/TLS certificate. Get information for a particular SSL/TLS - * certificate, specified by its certificate ID. The response returns full - * details of the certificate, including its type, main domain name, and - * alternative domain names. + * Get a TLS certificate. * - * @param request - The request {@link ZonedApiGetCertificateRequest} + * @param request - The request {@link GetCertificateRequest} * @returns A Promise of Certificate */ - getCertificate = (request: Readonly) => + getCertificate = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/certificates/${validatePathParam( 'certificateId', request.certificateId, @@ -2565,7 +2605,7 @@ export class ZonedAPI extends ParentAPI { * @returns A Promise of Certificate */ waitForCertificate = ( - request: Readonly, + request: Readonly, options?: Readonly>, ) => waitForResource( @@ -2580,26 +2620,22 @@ export class ZonedAPI extends ParentAPI { ) /** - * Update an SSL/TLS certificate. Update the name of a particular SSL/TLS - * certificate, specified by its certificate ID. + * Update a TLS certificate. * - * @param request - The request {@link ZonedApiUpdateCertificateRequest} + * @param request - The request {@link UpdateCertificateRequest} * @returns A Promise of Certificate */ - updateCertificate = (request: Readonly) => + updateCertificate = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiUpdateCertificateRequest( - request, - this.client.settings, - ), + marshalUpdateCertificateRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/certificates/${validatePathParam( 'certificateId', request.certificateId, @@ -2609,33 +2645,29 @@ export class ZonedAPI extends ParentAPI { ) /** - * Delete an SSL/TLS certificate. Delete an SSL/TLS certificate, specified by - * its certificate ID. Deleting a certificate is irreversible and cannot be - * undone. + * Delete a TLS certificate. * - * @param request - The request {@link ZonedApiDeleteCertificateRequest} + * @param request - The request {@link DeleteCertificateRequest} */ - deleteCertificate = (request: Readonly) => + deleteCertificate = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/certificates/${validatePathParam( 'certificateId', request.certificateId, )}`, }) - protected pageOfListLbTypes = ( - request: Readonly = {}, - ) => + protected pageOfListLbTypes = (request: Readonly = {}) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lb-types`, urlParams: urlParams( ['page', request.page], @@ -2649,55 +2681,49 @@ export class ZonedAPI extends ParentAPI { ) /** - * List all Load Balancer offer types. List all the different commercial Load - * Balancer types. The response includes an array of offer types, each with a - * name, description, and information about its stock availability. + * List all load balancer offer type. * - * @param request - The request {@link ZonedApiListLbTypesRequest} + * @param request - The request {@link ListLbTypesRequest} * @returns A Promise of ListLbTypesResponse */ - listLbTypes = (request: Readonly = {}) => + listLbTypes = (request: Readonly = {}) => enrichForPagination('lbTypes', this.pageOfListLbTypes, request) /** - * Create a subscriber. Create a new subscriber, either with an email - * configuration or a webhook configuration, for a specified Scaleway - * Project. + * Create a subscriber, webhook or email. * - * @param request - The request {@link ZonedApiCreateSubscriberRequest} + * @param request - The request {@link CreateSubscriberRequest} * @returns A Promise of Subscriber */ - createSubscriber = (request: Readonly) => + createSubscriber = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiCreateSubscriberRequest(request, this.client.settings), + marshalCreateSubscriberRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/subscribers`, }, unmarshalSubscriber, ) /** - * Get a subscriber. Retrieve information about an existing subscriber, - * specified by its subscriber ID. Its full details, including name and - * email/webhook configuration, are returned in the response object. + * Get a subscriber. * - * @param request - The request {@link ZonedApiGetSubscriberRequest} + * @param request - The request {@link GetSubscriberRequest} * @returns A Promise of Subscriber */ - getSubscriber = (request: Readonly) => + getSubscriber = (request: Readonly) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/subscribers/${validatePathParam( 'subscriberId', request.subscriberId, @@ -2707,18 +2733,18 @@ export class ZonedAPI extends ParentAPI { ) protected pageOfListSubscriber = ( - request: Readonly, + request: Readonly = {}, ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/subscribers`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -2732,36 +2758,31 @@ export class ZonedAPI extends ParentAPI { ) /** - * List all subscribers. List all subscribers to Load Balancer alerts. By - * default, returns all subscribers to Load Balancer alerts for the - * Organization associated with the authentication token used for the - * request. + * List all subscriber. * - * @param request - The request {@link ZonedApiListSubscriberRequest} + * @param request - The request {@link ListSubscriberRequest} * @returns A Promise of ListSubscriberResponse */ - listSubscriber = (request: Readonly) => + listSubscriber = (request: Readonly = {}) => enrichForPagination('subscribers', this.pageOfListSubscriber, request) /** - * Update a subscriber. Update the parameters of a given subscriber (e.g. - * name, webhook configuration, email configuration), specified by its - * subscriber ID. + * Update a subscriber. * - * @param request - The request {@link ZonedApiUpdateSubscriberRequest} + * @param request - The request {@link UpdateSubscriberRequest} * @returns A Promise of Subscriber */ - updateSubscriber = (request: Readonly) => + updateSubscriber = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiUpdateSubscriberRequest(request, this.client.settings), + marshalUpdateSubscriberRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'PUT', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/subscribers/${validatePathParam( 'subscriberId', request.subscriberId, @@ -2771,78 +2792,74 @@ export class ZonedAPI extends ParentAPI { ) /** - * Delete a subscriber. Delete an existing subscriber, specified by its - * subscriber ID. Deleting a subscriber is permanent, and cannot be undone. + * Delete a subscriber. * - * @param request - The request {@link ZonedApiDeleteSubscriberRequest} + * @param request - The request {@link DeleteSubscriberRequest} */ - deleteSubscriber = (request: Readonly) => + deleteSubscriber = (request: Readonly) => this.client.fetch({ method: 'DELETE', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, - )}/lb/subscription/${validatePathParam( + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/lb/subscriber/${validatePathParam( 'subscriberId', request.subscriberId, )}`, }) /** - * Subscribe a subscriber to alerts for a given Load Balancer. Subscribe an - * existing subscriber to alerts for a given Load Balancer. + * Subscribe a subscriber to a given load balancer. * - * @param request - The request {@link ZonedApiSubscribeToLbRequest} + * @param request - The request {@link SubscribeToLbRequest} * @returns A Promise of Lb */ - subscribeToLb = (request: Readonly) => + subscribeToLb = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiSubscribeToLbRequest(request, this.client.settings), + marshalSubscribeToLbRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lb/${validatePathParam('lbId', request.lbId)}/subscribe`, }, unmarshalLb, ) /** - * Unsubscribe a subscriber from alerts for a given Load Balancer. Unsubscribe - * a subscriber from alerts for a given Load Balancer. The subscriber is not - * deleted, and can be resubscribed in the future if necessary. + * Unsubscribe a subscriber from a given load balancer. * - * @param request - The request {@link ZonedApiUnsubscribeFromLbRequest} + * @param request - The request {@link UnsubscribeFromLbRequest} * @returns A Promise of Lb */ - unsubscribeFromLb = (request: Readonly) => + unsubscribeFromLb = (request: Readonly) => this.client.fetch( { method: 'DELETE', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lb/${validatePathParam('lbId', request.lbId)}/unsubscribe`, }, unmarshalLb, ) protected pageOfListLbPrivateNetworks = ( - request: Readonly, + request: Readonly, ) => this.client.fetch( { method: 'GET', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam('lbId', request.lbId)}/private-networks`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -2854,18 +2871,12 @@ export class ZonedAPI extends ParentAPI { ) /** - * List Private Networks attached to a Load Balancer. List the Private - * Networks attached to a given Load Balancer, specified by its Load Balancer - * ID. The response is an array of Private Network objects, giving information - * including the status, configuration, name and creation date of each Private - * Network. + * List attached private network of load balancer. * - * @param request - The request {@link ZonedApiListLbPrivateNetworksRequest} + * @param request - The request {@link ListLbPrivateNetworksRequest} * @returns A Promise of ListLbPrivateNetworksResponse */ - listLbPrivateNetworks = ( - request: Readonly, - ) => + listLbPrivateNetworks = (request: Readonly) => enrichForPagination( 'privateNetwork', this.pageOfListLbPrivateNetworks, @@ -2873,29 +2884,22 @@ export class ZonedAPI extends ParentAPI { ) /** - * Attach a Load Balancer to a Private Network. Attach a specified Load - * Balancer to a specified Private Network, defining a static or DHCP - * configuration for the Load Balancer on the network. + * Add load balancer on instance private network. * - * @param request - The request {@link ZonedApiAttachPrivateNetworkRequest} + * @param request - The request {@link AttachPrivateNetworkRequest} * @returns A Promise of PrivateNetwork */ - attachPrivateNetwork = ( - request: Readonly, - ) => + attachPrivateNetwork = (request: Readonly) => this.client.fetch( { body: JSON.stringify( - marshalZonedApiAttachPrivateNetworkRequest( - request, - this.client.settings, - ), + marshalAttachPrivateNetworkRequest(request, this.client.settings), ), headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam( 'lbId', request.lbId, @@ -2908,21 +2912,18 @@ export class ZonedAPI extends ParentAPI { ) /** - * Detach Load Balancer from Private Network. Detach a specified Load Balancer - * from a specified Private Network. + * Remove load balancer of private network. * - * @param request - The request {@link ZonedApiDetachPrivateNetworkRequest} + * @param request - The request {@link DetachPrivateNetworkRequest} */ - detachPrivateNetwork = ( - request: Readonly, - ) => + detachPrivateNetwork = (request: Readonly) => this.client.fetch({ body: '{}', headers: jsonContentHeaders, method: 'POST', - path: `/lb/v1/zones/${validatePathParam( - 'zone', - request.zone ?? this.client.settings.defaultZone, + path: `/lb/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, )}/lbs/${validatePathParam( 'lbId', request.lbId, diff --git a/packages/clients/src/api/lb/v1/marshalling.gen.ts b/packages/clients/src/api/lb/v1/marshalling.gen.ts index 7c08745ae..a367d59b8 100644 --- a/packages/clients/src/api/lb/v1/marshalling.gen.ts +++ b/packages/clients/src/api/lb/v1/marshalling.gen.ts @@ -103,27 +103,75 @@ import type { ZonedApiUpdateSubscriberRequest, } from './types.gen' -const unmarshalSubscriberEmailConfig = (data: unknown) => { +export const unmarshalIp = (data: unknown): Ip => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Ip' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + ipAddress: data.ip_address, + lbId: data.lb_id, + organizationId: data.organization_id, + projectId: data.project_id, + region: data.region, + reverse: data.reverse, + zone: data.zone, + } as Ip +} + +const unmarshalSubscriberEmailConfig = ( + data: unknown, +): SubscriberEmailConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SubscriberEmailConfig' failed as data isn't a dictionary.`, ) } - return { email: data.email } as SubscriberEmailConfig + return { + email: data.email, + } as SubscriberEmailConfig } -const unmarshalSubscriberWebhookConfig = (data: unknown) => { +const unmarshalSubscriberWebhookConfig = ( + data: unknown, +): SubscriberWebhookConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SubscriberWebhookConfig' failed as data isn't a dictionary.`, ) } - return { uri: data.uri } as SubscriberWebhookConfig + return { + uri: data.uri, + } as SubscriberWebhookConfig +} + +export const unmarshalSubscriber = (data: unknown): Subscriber => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Subscriber' failed as data isn't a dictionary.`, + ) + } + + return { + emailConfig: data.email_config + ? unmarshalSubscriberEmailConfig(data.email_config) + : undefined, + id: data.id, + name: data.name, + webhookConfig: data.webhook_config + ? unmarshalSubscriberWebhookConfig(data.webhook_config) + : undefined, + } as Subscriber } -const unmarshalHealthCheckHttpConfig = (data: unknown) => { +const unmarshalHealthCheckHttpConfig = ( + data: unknown, +): HealthCheckHttpConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'HealthCheckHttpConfig' failed as data isn't a dictionary.`, @@ -138,7 +186,9 @@ const unmarshalHealthCheckHttpConfig = (data: unknown) => { } as HealthCheckHttpConfig } -const unmarshalHealthCheckHttpsConfig = (data: unknown) => { +const unmarshalHealthCheckHttpsConfig = ( + data: unknown, +): HealthCheckHttpsConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'HealthCheckHttpsConfig' failed as data isn't a dictionary.`, @@ -154,7 +204,9 @@ const unmarshalHealthCheckHttpsConfig = (data: unknown) => { } as HealthCheckHttpsConfig } -const unmarshalHealthCheckLdapConfig = (data: unknown) => { +const unmarshalHealthCheckLdapConfig = ( + data: unknown, +): HealthCheckLdapConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'HealthCheckLdapConfig' failed as data isn't a dictionary.`, @@ -164,27 +216,37 @@ const unmarshalHealthCheckLdapConfig = (data: unknown) => { return {} as HealthCheckLdapConfig } -const unmarshalHealthCheckMysqlConfig = (data: unknown) => { +const unmarshalHealthCheckMysqlConfig = ( + data: unknown, +): HealthCheckMysqlConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'HealthCheckMysqlConfig' failed as data isn't a dictionary.`, ) } - return { user: data.user } as HealthCheckMysqlConfig + return { + user: data.user, + } as HealthCheckMysqlConfig } -const unmarshalHealthCheckPgsqlConfig = (data: unknown) => { +const unmarshalHealthCheckPgsqlConfig = ( + data: unknown, +): HealthCheckPgsqlConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'HealthCheckPgsqlConfig' failed as data isn't a dictionary.`, ) } - return { user: data.user } as HealthCheckPgsqlConfig + return { + user: data.user, + } as HealthCheckPgsqlConfig } -const unmarshalHealthCheckRedisConfig = (data: unknown) => { +const unmarshalHealthCheckRedisConfig = ( + data: unknown, +): HealthCheckRedisConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'HealthCheckRedisConfig' failed as data isn't a dictionary.`, @@ -194,7 +256,7 @@ const unmarshalHealthCheckRedisConfig = (data: unknown) => { return {} as HealthCheckRedisConfig } -const unmarshalHealthCheckTcpConfig = (data: unknown) => { +const unmarshalHealthCheckTcpConfig = (data: unknown): HealthCheckTcpConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'HealthCheckTcpConfig' failed as data isn't a dictionary.`, @@ -204,63 +266,7 @@ const unmarshalHealthCheckTcpConfig = (data: unknown) => { return {} as HealthCheckTcpConfig } -const unmarshalInstance = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Instance' failed as data isn't a dictionary.`, - ) - } - - return { - createdAt: unmarshalDate(data.created_at), - id: data.id, - ipAddress: data.ip_address, - region: data.region, - status: data.status, - updatedAt: unmarshalDate(data.updated_at), - zone: data.zone, - } as Instance -} - -export const unmarshalIp = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Ip' failed as data isn't a dictionary.`, - ) - } - - return { - id: data.id, - ipAddress: data.ip_address, - lbId: data.lb_id, - organizationId: data.organization_id, - projectId: data.project_id, - region: data.region, - reverse: data.reverse, - zone: data.zone, - } as Ip -} - -export const unmarshalSubscriber = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Subscriber' failed as data isn't a dictionary.`, - ) - } - - return { - emailConfig: data.email_config - ? unmarshalSubscriberEmailConfig(data.email_config) - : undefined, - id: data.id, - name: data.name, - webhookConfig: data.webhook_config - ? unmarshalSubscriberWebhookConfig(data.webhook_config) - : undefined, - } as Subscriber -} - -export const unmarshalHealthCheck = (data: unknown) => { +export const unmarshalHealthCheck = (data: unknown): HealthCheck => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'HealthCheck' failed as data isn't a dictionary.`, @@ -298,7 +304,25 @@ export const unmarshalHealthCheck = (data: unknown) => { } as HealthCheck } -export const unmarshalLb = (data: unknown) => { +const unmarshalInstance = (data: unknown): Instance => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Instance' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + id: data.id, + ipAddress: data.ip_address, + region: data.region, + status: data.status, + updatedAt: unmarshalDate(data.updated_at), + zone: data.zone, + } as Instance +} + +export const unmarshalLb = (data: unknown): Lb => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Lb' failed as data isn't a dictionary.`, @@ -331,21 +355,7 @@ export const unmarshalLb = (data: unknown) => { } as Lb } -const unmarshalAclActionRedirect = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'AclActionRedirect' failed as data isn't a dictionary.`, - ) - } - - return { - code: data.code, - target: data.target, - type: data.type, - } as AclActionRedirect -} - -export const unmarshalBackend = (data: unknown) => { +export const unmarshalBackend = (data: unknown): Backend => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Backend' failed as data isn't a dictionary.`, @@ -383,7 +393,7 @@ export const unmarshalBackend = (data: unknown) => { } as Backend } -export const unmarshalCertificate = (data: unknown) => { +export const unmarshalCertificate = (data: unknown): Certificate => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Certificate' failed as data isn't a dictionary.`, @@ -407,38 +417,7 @@ export const unmarshalCertificate = (data: unknown) => { } as Certificate } -const unmarshalAclAction = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'AclAction' failed as data isn't a dictionary.`, - ) - } - - return { - redirect: data.redirect - ? unmarshalAclActionRedirect(data.redirect) - : undefined, - type: data.type, - } as AclAction -} - -const unmarshalAclMatch = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'AclMatch' failed as data isn't a dictionary.`, - ) - } - - return { - httpFilter: data.http_filter, - httpFilterOption: data.http_filter_option, - httpFilterValue: data.http_filter_value, - invert: data.invert, - ipSubnet: data.ip_subnet, - } as AclMatch -} - -export const unmarshalFrontend = (data: unknown) => { +export const unmarshalFrontend = (data: unknown): Frontend => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Frontend' failed as data isn't a dictionary.`, @@ -462,47 +441,52 @@ export const unmarshalFrontend = (data: unknown) => { } as Frontend } -const unmarshalPrivateNetworkDHCPConfig = (data: unknown) => { +const unmarshalAclActionRedirect = (data: unknown): AclActionRedirect => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'PrivateNetworkDHCPConfig' failed as data isn't a dictionary.`, - ) - } - - return { ipId: data.ip_id } as PrivateNetworkDHCPConfig -} - -const unmarshalPrivateNetworkIpamConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'PrivateNetworkIpamConfig' failed as data isn't a dictionary.`, + `Unmarshalling the type 'AclActionRedirect' failed as data isn't a dictionary.`, ) } - return {} as PrivateNetworkIpamConfig + return { + code: data.code, + target: data.target, + type: data.type, + } as AclActionRedirect } -const unmarshalPrivateNetworkStaticConfig = (data: unknown) => { +const unmarshalAclAction = (data: unknown): AclAction => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'PrivateNetworkStaticConfig' failed as data isn't a dictionary.`, + `Unmarshalling the type 'AclAction' failed as data isn't a dictionary.`, ) } - return { ipAddress: data.ip_address } as PrivateNetworkStaticConfig + return { + redirect: data.redirect + ? unmarshalAclActionRedirect(data.redirect) + : undefined, + type: data.type, + } as AclAction } -const unmarshalRouteMatch = (data: unknown) => { +const unmarshalAclMatch = (data: unknown): AclMatch => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'RouteMatch' failed as data isn't a dictionary.`, + `Unmarshalling the type 'AclMatch' failed as data isn't a dictionary.`, ) } - return { hostHeader: data.host_header, sni: data.sni } as RouteMatch + return { + httpFilter: data.http_filter, + httpFilterOption: data.http_filter_option, + httpFilterValue: data.http_filter_value, + invert: data.invert, + ipSubnet: data.ip_subnet, + } as AclMatch } -export const unmarshalAcl = (data: unknown) => { +export const unmarshalAcl = (data: unknown): Acl => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Acl' failed as data isn't a dictionary.`, @@ -522,40 +506,47 @@ export const unmarshalAcl = (data: unknown) => { } as Acl } -const unmarshalBackendServerStats = (data: unknown) => { +const unmarshalPrivateNetworkDHCPConfig = ( + data: unknown, +): PrivateNetworkDHCPConfig => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'BackendServerStats' failed as data isn't a dictionary.`, + `Unmarshalling the type 'PrivateNetworkDHCPConfig' failed as data isn't a dictionary.`, ) } return { - backendId: data.backend_id, - instanceId: data.instance_id, - ip: data.ip, - lastHealthCheckStatus: data.last_health_check_status, - serverState: data.server_state, - serverStateChangedAt: unmarshalDate(data.server_state_changed_at), - } as BackendServerStats + ipId: data.ip_id, + } as PrivateNetworkDHCPConfig } -const unmarshalLbType = (data: unknown) => { +const unmarshalPrivateNetworkIpamConfig = ( + data: unknown, +): PrivateNetworkIpamConfig => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'LbType' failed as data isn't a dictionary.`, + `Unmarshalling the type 'PrivateNetworkIpamConfig' failed as data isn't a dictionary.`, + ) + } + + return {} as PrivateNetworkIpamConfig +} + +const unmarshalPrivateNetworkStaticConfig = ( + data: unknown, +): PrivateNetworkStaticConfig => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'PrivateNetworkStaticConfig' failed as data isn't a dictionary.`, ) } return { - description: data.description, - name: data.name, - region: data.region, - stockStatus: data.stock_status, - zone: data.zone, - } as LbType + ipAddress: data.ip_address ? data.ip_address : undefined, + } as PrivateNetworkStaticConfig } -export const unmarshalPrivateNetwork = (data: unknown) => { +export const unmarshalPrivateNetwork = (data: unknown): PrivateNetwork => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`, @@ -581,7 +572,20 @@ export const unmarshalPrivateNetwork = (data: unknown) => { } as PrivateNetwork } -export const unmarshalRoute = (data: unknown) => { +const unmarshalRouteMatch = (data: unknown): RouteMatch => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RouteMatch' failed as data isn't a dictionary.`, + ) + } + + return { + hostHeader: data.host_header, + sni: data.sni, + } as RouteMatch +} + +export const unmarshalRoute = (data: unknown): Route => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Route' failed as data isn't a dictionary.`, @@ -598,7 +602,26 @@ export const unmarshalRoute = (data: unknown) => { } as Route } -export const unmarshalLbStats = (data: unknown) => { +export const unmarshalBackendServerStats = ( + data: unknown, +): BackendServerStats => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'BackendServerStats' failed as data isn't a dictionary.`, + ) + } + + return { + backendId: data.backend_id, + instanceId: data.instance_id, + ip: data.ip, + lastHealthCheckStatus: data.last_health_check_status, + serverState: data.server_state, + serverStateChangedAt: unmarshalDate(data.server_state_changed_at), + } as BackendServerStats +} + +export const unmarshalLbStats = (data: unknown): LbStats => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'LbStats' failed as data isn't a dictionary.`, @@ -613,7 +636,7 @@ export const unmarshalLbStats = (data: unknown) => { } as LbStats } -export const unmarshalListAclResponse = (data: unknown) => { +export const unmarshalListAclResponse = (data: unknown): ListAclResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListAclResponse' failed as data isn't a dictionary.`, @@ -626,7 +649,9 @@ export const unmarshalListAclResponse = (data: unknown) => { } as ListAclResponse } -export const unmarshalListBackendStatsResponse = (data: unknown) => { +export const unmarshalListBackendStatsResponse = ( + data: unknown, +): ListBackendStatsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListBackendStatsResponse' failed as data isn't a dictionary.`, @@ -642,7 +667,9 @@ export const unmarshalListBackendStatsResponse = (data: unknown) => { } as ListBackendStatsResponse } -export const unmarshalListBackendsResponse = (data: unknown) => { +export const unmarshalListBackendsResponse = ( + data: unknown, +): ListBackendsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListBackendsResponse' failed as data isn't a dictionary.`, @@ -655,7 +682,9 @@ export const unmarshalListBackendsResponse = (data: unknown) => { } as ListBackendsResponse } -export const unmarshalListCertificatesResponse = (data: unknown) => { +export const unmarshalListCertificatesResponse = ( + data: unknown, +): ListCertificatesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListCertificatesResponse' failed as data isn't a dictionary.`, @@ -671,7 +700,9 @@ export const unmarshalListCertificatesResponse = (data: unknown) => { } as ListCertificatesResponse } -export const unmarshalListFrontendsResponse = (data: unknown) => { +export const unmarshalListFrontendsResponse = ( + data: unknown, +): ListFrontendsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListFrontendsResponse' failed as data isn't a dictionary.`, @@ -684,7 +715,7 @@ export const unmarshalListFrontendsResponse = (data: unknown) => { } as ListFrontendsResponse } -export const unmarshalListIpsResponse = (data: unknown) => { +export const unmarshalListIpsResponse = (data: unknown): ListIpsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListIpsResponse' failed as data isn't a dictionary.`, @@ -697,7 +728,9 @@ export const unmarshalListIpsResponse = (data: unknown) => { } as ListIpsResponse } -export const unmarshalListLbPrivateNetworksResponse = (data: unknown) => { +export const unmarshalListLbPrivateNetworksResponse = ( + data: unknown, +): ListLbPrivateNetworksResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListLbPrivateNetworksResponse' failed as data isn't a dictionary.`, @@ -713,7 +746,25 @@ export const unmarshalListLbPrivateNetworksResponse = (data: unknown) => { } as ListLbPrivateNetworksResponse } -export const unmarshalListLbTypesResponse = (data: unknown) => { +const unmarshalLbType = (data: unknown): LbType => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'LbType' failed as data isn't a dictionary.`, + ) + } + + return { + description: data.description, + name: data.name, + region: data.region, + stockStatus: data.stock_status, + zone: data.zone, + } as LbType +} + +export const unmarshalListLbTypesResponse = ( + data: unknown, +): ListLbTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListLbTypesResponse' failed as data isn't a dictionary.`, @@ -726,7 +777,7 @@ export const unmarshalListLbTypesResponse = (data: unknown) => { } as ListLbTypesResponse } -export const unmarshalListLbsResponse = (data: unknown) => { +export const unmarshalListLbsResponse = (data: unknown): ListLbsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListLbsResponse' failed as data isn't a dictionary.`, @@ -739,7 +790,9 @@ export const unmarshalListLbsResponse = (data: unknown) => { } as ListLbsResponse } -export const unmarshalListRoutesResponse = (data: unknown) => { +export const unmarshalListRoutesResponse = ( + data: unknown, +): ListRoutesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListRoutesResponse' failed as data isn't a dictionary.`, @@ -752,7 +805,9 @@ export const unmarshalListRoutesResponse = (data: unknown) => { } as ListRoutesResponse } -export const unmarshalListSubscriberResponse = (data: unknown) => { +export const unmarshalListSubscriberResponse = ( + data: unknown, +): ListSubscriberResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSubscriberResponse' failed as data isn't a dictionary.`, @@ -765,7 +820,7 @@ export const unmarshalListSubscriberResponse = (data: unknown) => { } as ListSubscriberResponse } -export const unmarshalSetAclsResponse = (data: unknown) => { +export const unmarshalSetAclsResponse = (data: unknown): SetAclsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetAclsResponse' failed as data isn't a dictionary.`, @@ -778,6 +833,61 @@ export const unmarshalSetAclsResponse = (data: unknown) => { } as SetAclsResponse } +export const marshalAddBackendServersRequest = ( + request: AddBackendServersRequest, + defaults: DefaultValues, +): Record => ({ + server_ip: request.serverIp, +}) + +const marshalPrivateNetworkDHCPConfig = ( + request: PrivateNetworkDHCPConfig, + defaults: DefaultValues, +): Record => ({ + ip_id: request.ipId, +}) + +const marshalPrivateNetworkIpamConfig = ( + request: PrivateNetworkIpamConfig, + defaults: DefaultValues, +): Record => ({}) + +const marshalPrivateNetworkStaticConfig = ( + request: PrivateNetworkStaticConfig, + defaults: DefaultValues, +): Record => ({ + ip_address: request.ipAddress, +}) + +export const marshalAttachPrivateNetworkRequest = ( + request: AttachPrivateNetworkRequest, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf([ + { + param: 'static_config', + value: + request.staticConfig !== undefined + ? marshalPrivateNetworkStaticConfig(request.staticConfig, defaults) + : undefined, + }, + { + param: 'dhcp_config', + value: + request.dhcpConfig !== undefined + ? marshalPrivateNetworkDHCPConfig(request.dhcpConfig, defaults) + : undefined, + }, + { + param: 'ipam_config', + value: + request.ipamConfig !== undefined + ? marshalPrivateNetworkIpamConfig(request.ipamConfig, defaults) + : undefined, + }, + ]), +}) + const marshalAclActionRedirect = ( request: AclActionRedirect, defaults: DefaultValues, @@ -791,9 +901,10 @@ const marshalAclAction = ( request: AclAction, defaults: DefaultValues, ): Record => ({ - redirect: request.redirect - ? marshalAclActionRedirect(request.redirect, defaults) - : undefined, + redirect: + request.redirect !== undefined + ? marshalAclActionRedirect(request.redirect, defaults) + : undefined, type: request.type, }) @@ -808,6 +919,20 @@ const marshalAclMatch = ( ip_subnet: request.ipSubnet, }) +export const marshalCreateAclRequest = ( + request: CreateAclRequest, + defaults: DefaultValues, +): Record => ({ + action: marshalAclAction(request.action, defaults), + description: request.description, + index: request.index, + match: + request.match !== undefined + ? marshalAclMatch(request.match, defaults) + : undefined, + name: request.name || randomName('acl'), +}) + const marshalHealthCheckHttpConfig = ( request: HealthCheckHttpConfig, defaults: DefaultValues, @@ -850,39 +975,13 @@ const marshalHealthCheckPgsqlConfig = ( const marshalHealthCheckRedisConfig = ( request: HealthCheckRedisConfig, - defaults: DefaultValues, -): Record => ({}) - -const marshalHealthCheckTcpConfig = ( - request: HealthCheckTcpConfig, - defaults: DefaultValues, -): Record => ({}) - -const marshalAclSpec = ( - request: AclSpec, - defaults: DefaultValues, -): Record => ({ - action: marshalAclAction(request.action, defaults), - description: request.description, - index: request.index, - match: request.match ? marshalAclMatch(request.match, defaults) : undefined, - name: request.name, -}) - -const marshalCreateCertificateRequestCustomCertificate = ( - request: CreateCertificateRequestCustomCertificate, - defaults: DefaultValues, -): Record => ({ - certificate_chain: request.certificateChain, -}) + defaults: DefaultValues, +): Record => ({}) -const marshalCreateCertificateRequestLetsencryptConfig = ( - request: CreateCertificateRequestLetsencryptConfig, +const marshalHealthCheckTcpConfig = ( + request: HealthCheckTcpConfig, defaults: DefaultValues, -): Record => ({ - common_name: request.commonName, - subject_alternative_name: request.subjectAlternativeName, -}) +): Record => ({}) const marshalHealthCheck = ( request: HealthCheck, @@ -894,145 +993,59 @@ const marshalHealthCheck = ( check_timeout: request.checkTimeout, port: request.port, transient_check_delay: request.transientCheckDelay, - ...resolveOneOf([ + ...resolveOneOf([ { param: 'tcp_config', - value: request.tcpConfig - ? marshalHealthCheckTcpConfig(request.tcpConfig, defaults) - : undefined, + value: + request.tcpConfig !== undefined + ? marshalHealthCheckTcpConfig(request.tcpConfig, defaults) + : undefined, }, { param: 'mysql_config', - value: request.mysqlConfig - ? marshalHealthCheckMysqlConfig(request.mysqlConfig, defaults) - : undefined, + value: + request.mysqlConfig !== undefined + ? marshalHealthCheckMysqlConfig(request.mysqlConfig, defaults) + : undefined, }, { param: 'pgsql_config', - value: request.pgsqlConfig - ? marshalHealthCheckPgsqlConfig(request.pgsqlConfig, defaults) - : undefined, + value: + request.pgsqlConfig !== undefined + ? marshalHealthCheckPgsqlConfig(request.pgsqlConfig, defaults) + : undefined, }, { param: 'ldap_config', - value: request.ldapConfig - ? marshalHealthCheckLdapConfig(request.ldapConfig, defaults) - : undefined, + value: + request.ldapConfig !== undefined + ? marshalHealthCheckLdapConfig(request.ldapConfig, defaults) + : undefined, }, { param: 'redis_config', - value: request.redisConfig - ? marshalHealthCheckRedisConfig(request.redisConfig, defaults) - : undefined, + value: + request.redisConfig !== undefined + ? marshalHealthCheckRedisConfig(request.redisConfig, defaults) + : undefined, }, { param: 'http_config', - value: request.httpConfig - ? marshalHealthCheckHttpConfig(request.httpConfig, defaults) - : undefined, + value: + request.httpConfig !== undefined + ? marshalHealthCheckHttpConfig(request.httpConfig, defaults) + : undefined, }, { param: 'https_config', - value: request.httpsConfig - ? marshalHealthCheckHttpsConfig(request.httpsConfig, defaults) - : undefined, - }, - ]), -}) - -const marshalPrivateNetworkDHCPConfig = ( - request: PrivateNetworkDHCPConfig, - defaults: DefaultValues, -): Record => ({ - ip_id: request.ipId, -}) - -const marshalPrivateNetworkIpamConfig = ( - request: PrivateNetworkIpamConfig, - defaults: DefaultValues, -): Record => ({}) - -const marshalPrivateNetworkStaticConfig = ( - request: PrivateNetworkStaticConfig, - defaults: DefaultValues, -): Record => ({ - ip_address: request.ipAddress, -}) - -const marshalRouteMatch = ( - request: RouteMatch, - defaults: DefaultValues, -): Record => ({ - ...resolveOneOf([ - { - param: 'sni', - value: request.sni, - }, - { - param: 'host_header', - value: request.hostHeader, - }, - ]), -}) - -const marshalSubscriberEmailConfig = ( - request: SubscriberEmailConfig, - defaults: DefaultValues, -): Record => ({ - email: request.email, -}) - -const marshalSubscriberWebhookConfig = ( - request: SubscriberWebhookConfig, - defaults: DefaultValues, -): Record => ({ - uri: request.uri, -}) - -export const marshalAddBackendServersRequest = ( - request: AddBackendServersRequest, - defaults: DefaultValues, -): Record => ({ - server_ip: request.serverIp, -}) - -export const marshalAttachPrivateNetworkRequest = ( - request: AttachPrivateNetworkRequest, - defaults: DefaultValues, -): Record => ({ - ...resolveOneOf([ - { - param: 'static_config', - value: request.staticConfig - ? marshalPrivateNetworkStaticConfig(request.staticConfig, defaults) - : undefined, - }, - { - param: 'dhcp_config', - value: request.dhcpConfig - ? marshalPrivateNetworkDHCPConfig(request.dhcpConfig, defaults) - : undefined, - }, - { - param: 'ipam_config', - value: request.ipamConfig - ? marshalPrivateNetworkIpamConfig(request.ipamConfig, defaults) - : undefined, + value: + request.httpsConfig !== undefined + ? marshalHealthCheckHttpsConfig(request.httpsConfig, defaults) + : undefined, }, ]), }) -export const marshalCreateAclRequest = ( - request: CreateAclRequest, - defaults: DefaultValues, -): Record => ({ - action: marshalAclAction(request.action, defaults), - description: request.description, - index: request.index, - match: request.match ? marshalAclMatch(request.match, defaults) : undefined, - name: request.name || randomName('acl'), -}) - export const marshalCreateBackendRequest = ( request: CreateBackendRequest, defaults: DefaultValues, @@ -1046,9 +1059,8 @@ export const marshalCreateBackendRequest = ( max_connections: request.maxConnections, max_retries: request.maxRetries, name: request.name || randomName('lbb'), - on_marked_down_action: - request.onMarkedDownAction ?? 'on_marked_down_action_none', - proxy_protocol: request.proxyProtocol ?? 'proxy_protocol_unknown', + on_marked_down_action: request.onMarkedDownAction, + proxy_protocol: request.proxyProtocol, redispatch_attempt_count: request.redispatchAttemptCount, send_proxy_v2: request.sendProxyV2, server_ip: request.serverIp, @@ -1061,34 +1073,48 @@ export const marshalCreateBackendRequest = ( timeout_tunnel: request.timeoutTunnel, }) +const marshalCreateCertificateRequestCustomCertificate = ( + request: CreateCertificateRequestCustomCertificate, + defaults: DefaultValues, +): Record => ({ + certificate_chain: request.certificateChain, +}) + +const marshalCreateCertificateRequestLetsencryptConfig = ( + request: CreateCertificateRequestLetsencryptConfig, + defaults: DefaultValues, +): Record => ({ + common_name: request.commonName, + subject_alternative_name: request.subjectAlternativeName, +}) + export const marshalCreateCertificateRequest = ( request: CreateCertificateRequest, defaults: DefaultValues, ): Record => ({ name: request.name || randomName('certificate'), - ...resolveOneOf( - [ - { - param: 'letsencrypt', - value: request.letsencrypt + ...resolveOneOf([ + { + param: 'letsencrypt', + value: + request.letsencrypt !== undefined ? marshalCreateCertificateRequestLetsencryptConfig( request.letsencrypt, defaults, ) : undefined, - }, - { - param: 'custom_certificate', - value: request.customCertificate + }, + { + param: 'custom_certificate', + value: + request.customCertificate !== undefined ? marshalCreateCertificateRequestCustomCertificate( request.customCertificate, defaults, ) : undefined, - }, - ], - true, - ), + }, + ]), }) export const marshalCreateFrontendRequest = ( @@ -1110,16 +1136,16 @@ export const marshalCreateIpRequest = ( ): Record => ({ reverse: request.reverse, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, ]), }) @@ -1131,21 +1157,30 @@ export const marshalCreateLbRequest = ( description: request.description, ip_id: request.ipId, name: request.name || randomName('lb'), - ssl_compatibility_level: - request.sslCompatibilityLevel ?? 'ssl_compatibility_level_unknown', + ssl_compatibility_level: request.sslCompatibilityLevel, tags: request.tags, type: request.type, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, + ]), +}) + +const marshalRouteMatch = ( + request: RouteMatch, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf([ + { param: 'sni', value: request.sni }, + { param: 'host_header', value: request.hostHeader }, ]), }) @@ -1155,7 +1190,24 @@ export const marshalCreateRouteRequest = ( ): Record => ({ backend_id: request.backendId, frontend_id: request.frontendId, - match: request.match ? marshalRouteMatch(request.match, defaults) : undefined, + match: + request.match !== undefined + ? marshalRouteMatch(request.match, defaults) + : undefined, +}) + +const marshalSubscriberEmailConfig = ( + request: SubscriberEmailConfig, + defaults: DefaultValues, +): Record => ({ + email: request.email, +}) + +const marshalSubscriberWebhookConfig = ( + request: SubscriberWebhookConfig, + defaults: DefaultValues, +): Record => ({ + uri: request.uri, }) export const marshalCreateSubscriberRequest = ( @@ -1164,29 +1216,31 @@ export const marshalCreateSubscriberRequest = ( ): Record => ({ name: request.name, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, ]), - ...resolveOneOf([ + ...resolveOneOf([ { param: 'email_config', - value: request.emailConfig - ? marshalSubscriberEmailConfig(request.emailConfig, defaults) - : undefined, + value: + request.emailConfig !== undefined + ? marshalSubscriberEmailConfig(request.emailConfig, defaults) + : undefined, }, { param: 'webhook_config', - value: request.webhookConfig - ? marshalSubscriberWebhookConfig(request.webhookConfig, defaults) - : undefined, + value: + request.webhookConfig !== undefined + ? marshalSubscriberWebhookConfig(request.webhookConfig, defaults) + : undefined, }, ]), }) @@ -1226,7 +1280,10 @@ export const marshalUpdateAclRequest = ( action: marshalAclAction(request.action, defaults), description: request.description, index: request.index, - match: request.match ? marshalAclMatch(request.match, defaults) : undefined, + match: + request.match !== undefined + ? marshalAclMatch(request.match, defaults) + : undefined, name: request.name, }) @@ -1242,9 +1299,8 @@ export const marshalUpdateBackendRequest = ( max_connections: request.maxConnections, max_retries: request.maxRetries, name: request.name, - on_marked_down_action: - request.onMarkedDownAction ?? 'on_marked_down_action_none', - proxy_protocol: request.proxyProtocol ?? 'proxy_protocol_unknown', + on_marked_down_action: request.onMarkedDownAction, + proxy_protocol: request.proxyProtocol, redispatch_attempt_count: request.redispatchAttemptCount, send_proxy_v2: request.sendProxyV2, ssl_bridging: request.sslBridging, @@ -1286,48 +1342,55 @@ export const marshalUpdateHealthCheckRequest = ( check_timeout: request.checkTimeout, port: request.port, transient_check_delay: request.transientCheckDelay, - ...resolveOneOf([ + ...resolveOneOf([ { param: 'tcp_config', - value: request.tcpConfig - ? marshalHealthCheckTcpConfig(request.tcpConfig, defaults) - : undefined, + value: + request.tcpConfig !== undefined + ? marshalHealthCheckTcpConfig(request.tcpConfig, defaults) + : undefined, }, { param: 'mysql_config', - value: request.mysqlConfig - ? marshalHealthCheckMysqlConfig(request.mysqlConfig, defaults) - : undefined, + value: + request.mysqlConfig !== undefined + ? marshalHealthCheckMysqlConfig(request.mysqlConfig, defaults) + : undefined, }, { param: 'pgsql_config', - value: request.pgsqlConfig - ? marshalHealthCheckPgsqlConfig(request.pgsqlConfig, defaults) - : undefined, + value: + request.pgsqlConfig !== undefined + ? marshalHealthCheckPgsqlConfig(request.pgsqlConfig, defaults) + : undefined, }, { param: 'ldap_config', - value: request.ldapConfig - ? marshalHealthCheckLdapConfig(request.ldapConfig, defaults) - : undefined, + value: + request.ldapConfig !== undefined + ? marshalHealthCheckLdapConfig(request.ldapConfig, defaults) + : undefined, }, { param: 'redis_config', - value: request.redisConfig - ? marshalHealthCheckRedisConfig(request.redisConfig, defaults) - : undefined, + value: + request.redisConfig !== undefined + ? marshalHealthCheckRedisConfig(request.redisConfig, defaults) + : undefined, }, { param: 'http_config', - value: request.httpConfig - ? marshalHealthCheckHttpConfig(request.httpConfig, defaults) - : undefined, + value: + request.httpConfig !== undefined + ? marshalHealthCheckHttpConfig(request.httpConfig, defaults) + : undefined, }, { param: 'https_config', - value: request.httpsConfig - ? marshalHealthCheckHttpsConfig(request.httpsConfig, defaults) - : undefined, + value: + request.httpsConfig !== undefined + ? marshalHealthCheckHttpsConfig(request.httpsConfig, defaults) + : undefined, }, ]), }) @@ -1345,8 +1408,7 @@ export const marshalUpdateLbRequest = ( ): Record => ({ description: request.description, name: request.name, - ssl_compatibility_level: - request.sslCompatibilityLevel ?? 'ssl_compatibility_level_unknown', + ssl_compatibility_level: request.sslCompatibilityLevel, tags: request.tags, }) @@ -1355,7 +1417,10 @@ export const marshalUpdateRouteRequest = ( defaults: DefaultValues, ): Record => ({ backend_id: request.backendId, - match: request.match ? marshalRouteMatch(request.match, defaults) : undefined, + match: + request.match !== undefined + ? marshalRouteMatch(request.match, defaults) + : undefined, }) export const marshalUpdateSubscriberRequest = ( @@ -1363,18 +1428,20 @@ export const marshalUpdateSubscriberRequest = ( defaults: DefaultValues, ): Record => ({ name: request.name, - ...resolveOneOf([ + ...resolveOneOf([ { param: 'email_config', - value: request.emailConfig - ? marshalSubscriberEmailConfig(request.emailConfig, defaults) - : undefined, + value: + request.emailConfig !== undefined + ? marshalSubscriberEmailConfig(request.emailConfig, defaults) + : undefined, }, { param: 'webhook_config', - value: request.webhookConfig - ? marshalSubscriberWebhookConfig(request.webhookConfig, defaults) - : undefined, + value: + request.webhookConfig !== undefined + ? marshalSubscriberWebhookConfig(request.webhookConfig, defaults) + : undefined, }, ]), }) @@ -1390,24 +1457,27 @@ export const marshalZonedApiAttachPrivateNetworkRequest = ( request: ZonedApiAttachPrivateNetworkRequest, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ + ...resolveOneOf([ { param: 'static_config', - value: request.staticConfig - ? marshalPrivateNetworkStaticConfig(request.staticConfig, defaults) - : undefined, + value: + request.staticConfig !== undefined + ? marshalPrivateNetworkStaticConfig(request.staticConfig, defaults) + : undefined, }, { param: 'dhcp_config', - value: request.dhcpConfig - ? marshalPrivateNetworkDHCPConfig(request.dhcpConfig, defaults) - : undefined, + value: + request.dhcpConfig !== undefined + ? marshalPrivateNetworkDHCPConfig(request.dhcpConfig, defaults) + : undefined, }, { param: 'ipam_config', - value: request.ipamConfig - ? marshalPrivateNetworkIpamConfig(request.ipamConfig, defaults) - : undefined, + value: + request.ipamConfig !== undefined + ? marshalPrivateNetworkIpamConfig(request.ipamConfig, defaults) + : undefined, }, ]), }) @@ -1419,7 +1489,10 @@ export const marshalZonedApiCreateAclRequest = ( action: marshalAclAction(request.action, defaults), description: request.description, index: request.index, - match: request.match ? marshalAclMatch(request.match, defaults) : undefined, + match: + request.match !== undefined + ? marshalAclMatch(request.match, defaults) + : undefined, name: request.name || randomName('acl'), }) @@ -1436,9 +1509,8 @@ export const marshalZonedApiCreateBackendRequest = ( max_connections: request.maxConnections, max_retries: request.maxRetries, name: request.name || randomName('lbb'), - on_marked_down_action: - request.onMarkedDownAction ?? 'on_marked_down_action_none', - proxy_protocol: request.proxyProtocol ?? 'proxy_protocol_unknown', + on_marked_down_action: request.onMarkedDownAction, + proxy_protocol: request.proxyProtocol, redispatch_attempt_count: request.redispatchAttemptCount, send_proxy_v2: request.sendProxyV2, server_ip: request.serverIp, @@ -1456,29 +1528,28 @@ export const marshalZonedApiCreateCertificateRequest = ( defaults: DefaultValues, ): Record => ({ name: request.name || randomName('certificate'), - ...resolveOneOf( - [ - { - param: 'letsencrypt', - value: request.letsencrypt + ...resolveOneOf([ + { + param: 'letsencrypt', + value: + request.letsencrypt !== undefined ? marshalCreateCertificateRequestLetsencryptConfig( request.letsencrypt, defaults, ) : undefined, - }, - { - param: 'custom_certificate', - value: request.customCertificate + }, + { + param: 'custom_certificate', + value: + request.customCertificate !== undefined ? marshalCreateCertificateRequestCustomCertificate( request.customCertificate, defaults, ) : undefined, - }, - ], - true, - ), + }, + ]), }) export const marshalZonedApiCreateFrontendRequest = ( @@ -1500,16 +1571,16 @@ export const marshalZonedApiCreateIpRequest = ( ): Record => ({ reverse: request.reverse, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, ]), }) @@ -1521,21 +1592,20 @@ export const marshalZonedApiCreateLbRequest = ( description: request.description, ip_id: request.ipId, name: request.name || randomName('lb'), - ssl_compatibility_level: - request.sslCompatibilityLevel ?? 'ssl_compatibility_level_unknown', + ssl_compatibility_level: request.sslCompatibilityLevel, tags: request.tags, type: request.type, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, ]), }) @@ -1545,7 +1615,10 @@ export const marshalZonedApiCreateRouteRequest = ( ): Record => ({ backend_id: request.backendId, frontend_id: request.frontendId, - match: request.match ? marshalRouteMatch(request.match, defaults) : undefined, + match: + request.match !== undefined + ? marshalRouteMatch(request.match, defaults) + : undefined, }) export const marshalZonedApiCreateSubscriberRequest = ( @@ -1554,29 +1627,31 @@ export const marshalZonedApiCreateSubscriberRequest = ( ): Record => ({ name: request.name, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, ]), - ...resolveOneOf([ + ...resolveOneOf([ { param: 'email_config', - value: request.emailConfig - ? marshalSubscriberEmailConfig(request.emailConfig, defaults) - : undefined, + value: + request.emailConfig !== undefined + ? marshalSubscriberEmailConfig(request.emailConfig, defaults) + : undefined, }, { param: 'webhook_config', - value: request.webhookConfig - ? marshalSubscriberWebhookConfig(request.webhookConfig, defaults) - : undefined, + value: + request.webhookConfig !== undefined + ? marshalSubscriberWebhookConfig(request.webhookConfig, defaults) + : undefined, }, ]), }) @@ -1595,6 +1670,20 @@ export const marshalZonedApiRemoveBackendServersRequest = ( server_ip: request.serverIp, }) +const marshalAclSpec = ( + request: AclSpec, + defaults: DefaultValues, +): Record => ({ + action: marshalAclAction(request.action, defaults), + description: request.description, + index: request.index, + match: + request.match !== undefined + ? marshalAclMatch(request.match, defaults) + : undefined, + name: request.name, +}) + export const marshalZonedApiSetAclsRequest = ( request: ZonedApiSetAclsRequest, defaults: DefaultValues, @@ -1623,7 +1712,10 @@ export const marshalZonedApiUpdateAclRequest = ( action: marshalAclAction(request.action, defaults), description: request.description, index: request.index, - match: request.match ? marshalAclMatch(request.match, defaults) : undefined, + match: + request.match !== undefined + ? marshalAclMatch(request.match, defaults) + : undefined, name: request.name, }) @@ -1639,9 +1731,8 @@ export const marshalZonedApiUpdateBackendRequest = ( max_connections: request.maxConnections, max_retries: request.maxRetries, name: request.name, - on_marked_down_action: - request.onMarkedDownAction ?? 'on_marked_down_action_none', - proxy_protocol: request.proxyProtocol ?? 'proxy_protocol_unknown', + on_marked_down_action: request.onMarkedDownAction, + proxy_protocol: request.proxyProtocol, redispatch_attempt_count: request.redispatchAttemptCount, send_proxy_v2: request.sendProxyV2, ssl_bridging: request.sslBridging, @@ -1683,48 +1774,55 @@ export const marshalZonedApiUpdateHealthCheckRequest = ( check_timeout: request.checkTimeout, port: request.port, transient_check_delay: request.transientCheckDelay, - ...resolveOneOf([ + ...resolveOneOf([ { param: 'tcp_config', - value: request.tcpConfig - ? marshalHealthCheckTcpConfig(request.tcpConfig, defaults) - : undefined, + value: + request.tcpConfig !== undefined + ? marshalHealthCheckTcpConfig(request.tcpConfig, defaults) + : undefined, }, { param: 'mysql_config', - value: request.mysqlConfig - ? marshalHealthCheckMysqlConfig(request.mysqlConfig, defaults) - : undefined, + value: + request.mysqlConfig !== undefined + ? marshalHealthCheckMysqlConfig(request.mysqlConfig, defaults) + : undefined, }, { param: 'pgsql_config', - value: request.pgsqlConfig - ? marshalHealthCheckPgsqlConfig(request.pgsqlConfig, defaults) - : undefined, + value: + request.pgsqlConfig !== undefined + ? marshalHealthCheckPgsqlConfig(request.pgsqlConfig, defaults) + : undefined, }, { param: 'ldap_config', - value: request.ldapConfig - ? marshalHealthCheckLdapConfig(request.ldapConfig, defaults) - : undefined, + value: + request.ldapConfig !== undefined + ? marshalHealthCheckLdapConfig(request.ldapConfig, defaults) + : undefined, }, { param: 'redis_config', - value: request.redisConfig - ? marshalHealthCheckRedisConfig(request.redisConfig, defaults) - : undefined, + value: + request.redisConfig !== undefined + ? marshalHealthCheckRedisConfig(request.redisConfig, defaults) + : undefined, }, { param: 'http_config', - value: request.httpConfig - ? marshalHealthCheckHttpConfig(request.httpConfig, defaults) - : undefined, + value: + request.httpConfig !== undefined + ? marshalHealthCheckHttpConfig(request.httpConfig, defaults) + : undefined, }, { param: 'https_config', - value: request.httpsConfig - ? marshalHealthCheckHttpsConfig(request.httpsConfig, defaults) - : undefined, + value: + request.httpsConfig !== undefined + ? marshalHealthCheckHttpsConfig(request.httpsConfig, defaults) + : undefined, }, ]), }) @@ -1742,8 +1840,7 @@ export const marshalZonedApiUpdateLbRequest = ( ): Record => ({ description: request.description, name: request.name, - ssl_compatibility_level: - request.sslCompatibilityLevel ?? 'ssl_compatibility_level_unknown', + ssl_compatibility_level: request.sslCompatibilityLevel, tags: request.tags, }) @@ -1752,7 +1849,10 @@ export const marshalZonedApiUpdateRouteRequest = ( defaults: DefaultValues, ): Record => ({ backend_id: request.backendId, - match: request.match ? marshalRouteMatch(request.match, defaults) : undefined, + match: + request.match !== undefined + ? marshalRouteMatch(request.match, defaults) + : undefined, }) export const marshalZonedApiUpdateSubscriberRequest = ( @@ -1760,18 +1860,20 @@ export const marshalZonedApiUpdateSubscriberRequest = ( defaults: DefaultValues, ): Record => ({ name: request.name, - ...resolveOneOf([ + ...resolveOneOf([ { param: 'email_config', - value: request.emailConfig - ? marshalSubscriberEmailConfig(request.emailConfig, defaults) - : undefined, + value: + request.emailConfig !== undefined + ? marshalSubscriberEmailConfig(request.emailConfig, defaults) + : undefined, }, { param: 'webhook_config', - value: request.webhookConfig - ? marshalSubscriberWebhookConfig(request.webhookConfig, defaults) - : undefined, + value: + request.webhookConfig !== undefined + ? marshalSubscriberWebhookConfig(request.webhookConfig, defaults) + : undefined, }, ]), }) diff --git a/packages/clients/src/api/lb/v1/types.gen.ts b/packages/clients/src/api/lb/v1/types.gen.ts index 8a796dd67..e8b9e22f9 100644 --- a/packages/clients/src/api/lb/v1/types.gen.ts +++ b/packages/clients/src/api/lb/v1/types.gen.ts @@ -106,14 +106,6 @@ export type PrivateNetworkStatus = 'unknown' | 'ready' | 'pending' | 'error' export type Protocol = 'tcp' | 'http' -/** - * PROXY protocol to use between the Load Balancer and backend servers. Allows - * the backend servers to be informed of the client's real IP address. PROXY - * protocol must be supported by the backend servers' software. For more - * information on the different protocols available, see the [dedicated - * documentation](https://www.scaleway.com/en/docs/network/load-balancer/reference-content/configuring-load-balancer/#choosing-a-proxy-protocol). - * Proxy protocol. - */ export type ProxyProtocol = | 'proxy_protocol_unknown' | 'proxy_protocol_none' @@ -130,172 +122,339 @@ export type SSLCompatibilityLevel = export type StickySessionsType = 'none' | 'cookie' | 'table' -/** Acl. */ -export interface Acl { - /** ACL ID. */ - id: string - /** ACL name. */ - name: string - /** - * ACL match filter object. One of `ip_subnet` or `http_filter` & - * `http_filter_value` are required. - */ - match?: AclMatch - /** Action to take when incoming traffic matches an ACL filter. */ - action?: AclAction - /** ACL is attached to this frontend object. */ - frontend?: Frontend - /** - * Priority of this ACL (ACLs are applied in ascending order, 0 is the first - * ACL executed). - */ - index: number - /** Date on which the ACL was created. */ - createdAt?: Date - /** Date on which the ACL was last updated. */ - updatedAt?: Date - /** ACL description. */ - description: string +export interface SubscriberEmailConfig { + /** Email address to send alerts to. */ + email: string } -/** Acl action. */ -export interface AclAction { - /** Action to take when incoming traffic matches an ACL filter. */ - type: AclActionType - /** Redirection parameters when using an ACL with a `redirect` action. */ - redirect?: AclActionRedirect +/** Webhook alert of subscriber. */ +export interface SubscriberWebhookConfig { + /** URI to receive POST requests. */ + uri: string } -/** Acl action redirect. */ -export interface AclActionRedirect { - /** Redirect type. */ - type: AclActionRedirectRedirectType +export interface HealthCheckHttpConfig { + /** The HTTP URI to use when performing a health check on backend servers. */ + uri: string + /** The HTTP method used when performing a health check on backend servers. */ + method: string /** - * Redirect target. For a location redirect, you can use a URL e.g. - * `https://scaleway.com`. Using a scheme name (e.g. `https`, `http`, `ftp`, - * `git`) will replace the request's original scheme. This can be useful to - * implement HTTP to HTTPS redirects. Valid placeholders that can be used in a - * `location` redirect to preserve parts of the original request in the - * redirection URL are {{host}}, {{query}}, {{path}} and {{scheme}}. + * The HTTP response code that should be returned for a health check to be + * considered successful. */ - target: string + code?: number /** - * HTTP redirect code to use. Valid values are 301, 302, 303, 307 and 308. - * Default value is 302. + * The HTTP host header used when performing a health check on backend + * servers. */ - code?: number + hostHeader: string } -/** Acl match. */ -export interface AclMatch { - /** List of IPs or CIDR v4/v6 addresses to filter for from the client side. */ - ipSubnet: string[] +export interface HealthCheckHttpsConfig { + /** The HTTP URI to use when performing a health check on backend servers. */ + uri: string + /** The HTTP method used when performing a health check on backend servers. */ + method: string /** - * Type of HTTP filter to match. Extracts the request's URL path, which starts - * at the first slash and ends before the question mark (without the host - * part). Defines where to filter for the http_filter_value. Only supported - * for HTTP backends. + * The HTTP response code that should be returned for a health check to be + * considered successful. */ - httpFilter: AclHttpFilter - /** List of values to filter for. */ - httpFilterValue: string[] + code?: number /** - * Name of the HTTP header to filter on if `http_header_match` was selected in - * `http_filter`. + * The HTTP host header used when performing a health check on backend + * servers. */ - httpFilterOption?: string + hostHeader: string /** - * Defines whether to invert the match condition. If set to `true`, the ACL - * carries out its action when the condition DOES NOT match. + * The SNI value used when performing a health check on backend servers over + * SSL. */ - invert: boolean + sni: string } -/** Acl spec. */ -export interface AclSpec { - /** ACL name. */ +export interface HealthCheckLdapConfig {} + +export interface HealthCheckMysqlConfig { + /** MySQL user to use for the health check. */ + user: string +} + +export interface HealthCheckPgsqlConfig { + /** PostgreSQL user to use for the health check. */ + user: string +} + +export interface HealthCheckRedisConfig {} + +export interface HealthCheckTcpConfig {} + +export interface Instance { + /** Underlying Instance ID. */ + id: string + /** Instance status. */ + status: InstanceStatus + /** Instance IP address. */ + ipAddress: string + /** Date on which the Instance was created. */ + createdAt?: Date + /** Date on which the Instance was last updated. */ + updatedAt?: Date + /** @deprecated The region the Instance is in. */ + region?: Region + /** The zone the Instance is in. */ + zone: Zone +} + +export interface Ip { + /** IP address ID. */ + id: string + /** IP address. */ + ipAddress: string + /** Organization ID of the Scaleway Organization the IP address is in. */ + organizationId: string + /** Project ID of the Scaleway Project the IP address is in. */ + projectId: string + /** Load Balancer ID. */ + lbId?: string + /** Reverse DNS (domain name) of the IP address. */ + reverse: string + /** @deprecated The region the IP address is in. */ + region?: Region + /** The zone the IP address is in. */ + zone: Zone +} + +/** Subscriber. */ +export interface Subscriber { + /** Subscriber ID. */ + id: string + /** Subscriber name. */ name: string - /** Action to take when incoming traffic matches an ACL filter. */ - action: AclAction /** - * ACL match filter object. One of `ip_subnet` or `http_filter` and - * `http_filter_value` are required. + * Email address of subscriber. + * + * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be + * set. */ - match?: AclMatch + emailConfig?: SubscriberEmailConfig /** - * Priority of this ACL (ACLs are applied in ascending order, 0 is the first - * ACL executed). + * Webhook URI of subscriber. + * + * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be + * set. */ - index: number - /** ACL description. */ - description: string + webhookConfig?: SubscriberWebhookConfig } -/** Backend. */ -export interface Backend { - /** Backend ID. */ - id: string - /** Name of the backend. */ - name: string - /** Protocol used by the backend when forwarding traffic to backend servers. */ - forwardProtocol: Protocol - /** Port used by the backend when forwarding traffic to backend servers. */ - forwardPort: number +export interface HealthCheck { + /** Port to use for the backend server health check. */ + port: number + /** Time to wait between two consecutive health checks. */ + checkDelay?: string + /** Maximum time a backend server has to reply to the health check. */ + checkTimeout?: string /** - * Load balancing algorithm to use when determining which backend server to - * forward new traffic to. + * Number of consecutive unsuccessful health checks after which the server + * will be considered dead. */ - forwardPortAlgorithm: ForwardPortAlgorithm + checkMaxRetries: number /** - * Defines whether sticky sessions (binding a particular session to a - * particular backend server) are activated and the method to use if so. None - * disables sticky sessions. Cookie-based uses an HTTP cookie to stick a - * session to a backend server. Table-based uses the source (client) IP - * address to stick a session to a backend server. + * Object to configure a basic TCP health check. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - stickySessions: StickySessionsType - /** Cookie name for cookie-based sticky sessions. */ - stickySessionsCookieName: string + tcpConfig?: HealthCheckTcpConfig /** - * Object defining the health check to be carried out by the backend when - * checking the status and health of backend servers. + * Object to configure a MySQL health check. The check requires MySQL >=3.22, + * for older versions, use a TCP health check. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - healthCheck?: HealthCheck - /** List of IP addresses of backend servers attached to this backend. */ - pool: string[] - /** Load Balancer the backend is attached to. */ - lb?: Lb - /** @deprecated Deprecated in favor of proxy_protocol field. */ - sendProxyV2?: boolean - /** Maximum allowed time for a backend server to process a request. */ - timeoutServer?: string - /** Maximum allowed time for establishing a connection to a backend server. */ - timeoutConnect?: string + mysqlConfig?: HealthCheckMysqlConfig /** - * Maximum allowed tunnel inactivity time after Websocket is established - * (takes precedence over client and server timeout). + * Object to configure a PostgreSQL health check. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - timeoutTunnel?: string - /** Action to take when a backend server is marked as down. */ - onMarkedDownAction: OnMarkedDownAction + pgsqlConfig?: HealthCheckPgsqlConfig /** - * Protocol to use between the Load Balancer and backend servers. Allows the - * backend servers to be informed of the client's real IP address. The PROXY - * protocol must be supported by the backend servers' software. + * Object to configure an LDAP health check. The response is analyzed to find + * the LDAPv3 response message. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - proxyProtocol: ProxyProtocol - /** Date at which the backend was created. */ - createdAt?: Date - /** Date at which the backend was updated. */ - updatedAt?: Date + ldapConfig?: HealthCheckLdapConfig /** - * Scaleway S3 bucket website to be served as failover if all backend servers - * are down, e.g. failover-website.s3-website.fr-par.scw.cloud. + * Object to configure a Redis health check. The response is analyzed to find + * the +PONG response message. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - failoverHost?: string + redisConfig?: HealthCheckRedisConfig /** - * Defines whether to enable SSL bridging between the Load Balancer and - * backend servers. + * Object to configure an HTTP health check. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. + */ + httpConfig?: HealthCheckHttpConfig + /** + * Object to configure an HTTPS health check. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. + */ + httpsConfig?: HealthCheckHttpsConfig + /** Defines whether proxy protocol should be activated for the health check. */ + checkSendProxy: boolean + /** + * Time to wait between two consecutive health checks when a backend server is + * in a transient state (going UP or DOWN). + */ + transientCheckDelay?: string +} + +export interface Lb { + /** Underlying Instance ID. */ + id: string + /** Load Balancer name. */ + name: string + /** Load Balancer description. */ + description: string + /** Load Balancer status. */ + status: LbStatus + /** List of underlying Instances. */ + instances: Instance[] + /** Scaleway Organization ID. */ + organizationId: string + /** Scaleway Project ID. */ + projectId: string + /** List of IP addresses attached to the Load Balancer. */ + ip: Ip[] + /** Load Balancer tags. */ + tags: string[] + /** Number of frontends the Load Balancer has. */ + frontendCount: number + /** Number of backends the Load Balancer has. */ + backendCount: number + /** Load Balancer offer type. */ + type: string + /** Subscriber information. */ + subscriber?: Subscriber + /** + * Determines the minimal SSL version which needs to be supported on client + * side. + */ + sslCompatibilityLevel: SSLCompatibilityLevel + /** Date on which the Load Balancer was created. */ + createdAt?: Date + /** Date on which the Load Balancer was last updated. */ + updatedAt?: Date + /** Number of Private Networks attached to the Load Balancer. */ + privateNetworkCount: number + /** Number of routes configured on the Load Balancer. */ + routeCount: number + /** @deprecated The region the Load Balancer is in. */ + region?: Region + /** The zone the Load Balancer is in. */ + zone: Zone +} + +export interface AclActionRedirect { + /** Redirect type. */ + type: AclActionRedirectRedirectType + /** + * Redirect target. For a location redirect, you can use a URL e.g. + * `https://scaleway.com`. Using a scheme name (e.g. `https`, `http`, `ftp`, + * `git`) will replace the request's original scheme. This can be useful to + * implement HTTP to HTTPS redirects. Valid placeholders that can be used in a + * `location` redirect to preserve parts of the original request in the + * redirection URL are {{host}}, {{query}}, {{path}} and {{scheme}}. + */ + target: string + /** + * HTTP redirect code to use. Valid values are 301, 302, 303, 307 and 308. + * Default value is 302. + */ + code?: number +} + +export interface Backend { + /** Backend ID. */ + id: string + /** Name of the backend. */ + name: string + /** Protocol used by the backend when forwarding traffic to backend servers. */ + forwardProtocol: Protocol + /** Port used by the backend when forwarding traffic to backend servers. */ + forwardPort: number + /** + * Load balancing algorithm to use when determining which backend server to + * forward new traffic to. + */ + forwardPortAlgorithm: ForwardPortAlgorithm + /** + * Defines whether sticky sessions (binding a particular session to a + * particular backend server) are activated and the method to use if so. None + * disables sticky sessions. Cookie-based uses an HTTP cookie to stick a + * session to a backend server. Table-based uses the source (client) IP + * address to stick a session to a backend server. + */ + stickySessions: StickySessionsType + /** Cookie name for cookie-based sticky sessions. */ + stickySessionsCookieName: string + /** + * Object defining the health check to be carried out by the backend when + * checking the status and health of backend servers. + */ + healthCheck?: HealthCheck + /** List of IP addresses of backend servers attached to this backend. */ + pool: string[] + /** Load Balancer the backend is attached to. */ + lb?: Lb + /** @deprecated Deprecated in favor of proxy_protocol field. */ + sendProxyV2?: boolean + /** Maximum allowed time for a backend server to process a request. */ + timeoutServer?: string + /** Maximum allowed time for establishing a connection to a backend server. */ + timeoutConnect?: string + /** + * Maximum allowed tunnel inactivity time after Websocket is established + * (takes precedence over client and server timeout). + */ + timeoutTunnel?: string + /** Action to take when a backend server is marked as down. */ + onMarkedDownAction: OnMarkedDownAction + /** + * Protocol to use between the Load Balancer and backend servers. Allows the + * backend servers to be informed of the client's real IP address. The PROXY + * protocol must be supported by the backend servers' software. + */ + proxyProtocol: ProxyProtocol + /** Date at which the backend was created. */ + createdAt?: Date + /** Date at which the backend was updated. */ + updatedAt?: Date + /** + * Scaleway S3 bucket website to be served as failover if all backend servers + * are down, e.g. failover-website.s3-website.fr-par.scw.cloud. + */ + failoverHost?: string + /** + * Defines whether to enable SSL bridging between the Load Balancer and + * backend servers. */ sslBridging?: boolean /** Defines whether the server certificate verification should be ignored. */ @@ -313,23 +472,6 @@ export interface Backend { timeoutQueue?: string } -/** Backend server stats. */ -export interface BackendServerStats { - /** ID of your Load Balancer's underlying Instance. */ - instanceId: string - /** Backend ID. */ - backendId: string - /** IPv4 or IPv6 address of the backend server. */ - ip: string - /** Server operational state (stopped/starting/running/stopping). */ - serverState: BackendServerStatsServerState - /** Time since last operational change. */ - serverStateChangedAt?: Date - /** Last health check status (unknown/neutral/failed/passed/condpass). */ - lastHealthCheckStatus: BackendServerStatsHealthCheckStatus -} - -/** Certificate. */ export interface Certificate { /** Certificate type (Let's Encrypt or custom). */ type: CertificateType @@ -362,31 +504,37 @@ export interface Certificate { statusDetails?: string } -/** Create certificate request. custom certificate. */ -export interface CreateCertificateRequestCustomCertificate { - /** - * Full PEM-formatted certificate, consisting of the entire certificate chain - * including public key, private key, and (optionally) Certificate - * Authorities. - */ - certificateChain: string +export interface AclAction { + /** Action to take when incoming traffic matches an ACL filter. */ + type: AclActionType + /** Redirection parameters when using an ACL with a `redirect` action. */ + redirect?: AclActionRedirect } -/** Create certificate request. letsencrypt config. */ -export interface CreateCertificateRequestLetsencryptConfig { +export interface AclMatch { + /** List of IPs or CIDR v4/v6 addresses to filter for from the client side. */ + ipSubnet: string[] /** - * Main domain name of certificate (this domain must exist and resolve to your - * Load Balancer IP address). + * Type of HTTP filter to match. Extracts the request's URL path, which starts + * at the first slash and ends before the question mark (without the host + * part). Defines where to filter for the http_filter_value. Only supported + * for HTTP backends. */ - commonName: string + httpFilter: AclHttpFilter + /** List of values to filter for. */ + httpFilterValue: string[] /** - * Alternative domain names (all domain names must exist and resolve to your - * Load Balancer IP address). + * Name of the HTTP header to filter on if `http_header_match` was selected in + * `http_filter`. */ - subjectAlternativeName: string[] + httpFilterOption?: string + /** + * Defines whether to invert the match condition. If set to `true`, the ACL + * carries out its action when the condition DOES NOT match. + */ + invert: boolean } -/** Frontend. */ export interface Frontend { /** Frontend ID. */ id: string @@ -406,395 +554,10 @@ export interface Frontend { certificateIds: string[] /** Date on which the frontend was created. */ createdAt?: Date - /** Date on which the frontend was last updated. */ - updatedAt?: Date - /** Defines whether to enable HTTP/3 protocol on the frontend. */ - enableHttp3: boolean -} - -/** Health check. */ -export interface HealthCheck { - /** Port to use for the backend server health check. */ - port: number - /** Time to wait between two consecutive health checks. */ - checkDelay?: string - /** Maximum time a backend server has to reply to the health check. */ - checkTimeout?: string - /** - * Number of consecutive unsuccessful health checks after which the server - * will be considered dead. - */ - checkMaxRetries: number - /** - * Object to configure a basic TCP health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - tcpConfig?: HealthCheckTcpConfig - /** - * Object to configure a MySQL health check. The check requires MySQL >=3.22, - * for older versions, use a TCP health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - mysqlConfig?: HealthCheckMysqlConfig - /** - * Object to configure a PostgreSQL health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - pgsqlConfig?: HealthCheckPgsqlConfig - /** - * Object to configure an LDAP health check. The response is analyzed to find - * the LDAPv3 response message. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - ldapConfig?: HealthCheckLdapConfig - /** - * Object to configure a Redis health check. The response is analyzed to find - * the +PONG response message. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - redisConfig?: HealthCheckRedisConfig - /** - * Object to configure an HTTP health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - httpConfig?: HealthCheckHttpConfig - /** - * Object to configure an HTTPS health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - httpsConfig?: HealthCheckHttpsConfig - /** Defines whether proxy protocol should be activated for the health check. */ - checkSendProxy: boolean - /** - * Time to wait between two consecutive health checks when a backend server is - * in a transient state (going UP or DOWN). - */ - transientCheckDelay?: string -} - -/** Health check. http config. */ -export interface HealthCheckHttpConfig { - /** - * HTTP URI used for the health check. The HTTP URI to use when performing a - * health check on backend servers. - */ - uri: string - /** - * HTTP method used for the health check. The HTTP method used when performing - * a health check on backend servers. - */ - method: string - /** - * HTTP response code expected for a successful health check. The HTTP - * response code that should be returned for a health check to be considered - * successful. - */ - code?: number - /** - * HTTP host header used for the health check. The HTTP host header used when - * performing a health check on backend servers. - */ - hostHeader: string -} - -/** Health check. https config. */ -export interface HealthCheckHttpsConfig { - /** - * HTTP URI used for the health check. The HTTP URI to use when performing a - * health check on backend servers. - */ - uri: string - /** - * HTTP method used for the health check. The HTTP method used when performing - * a health check on backend servers. - */ - method: string - /** - * HTTP response code expected for a successful health check. The HTTP - * response code that should be returned for a health check to be considered - * successful. - */ - code?: number - /** - * HTTP host header used for the health check. The HTTP host header used when - * performing a health check on backend servers. - */ - hostHeader: string - /** - * SNI used for SSL health checks. The SNI value used when performing a health - * check on backend servers over SSL. - */ - sni: string -} - -export interface HealthCheckLdapConfig {} - -/** Health check. mysql config. */ -export interface HealthCheckMysqlConfig { - /** MySQL user to use for the health check. */ - user: string -} - -/** Health check. pgsql config. */ -export interface HealthCheckPgsqlConfig { - /** PostgreSQL user to use for the health check. */ - user: string -} - -export interface HealthCheckRedisConfig {} - -export interface HealthCheckTcpConfig {} - -/** Instance. */ -export interface Instance { - /** Underlying Instance ID. */ - id: string - /** Instance status. */ - status: InstanceStatus - /** Instance IP address. */ - ipAddress: string - /** Date on which the Instance was created. */ - createdAt?: Date - /** Date on which the Instance was last updated. */ - updatedAt?: Date - /** @deprecated The region the Instance is in. */ - region?: Region - /** The zone the Instance is in. */ - zone: Zone -} - -/** Ip. */ -export interface Ip { - /** IP address ID. */ - id: string - /** IP address. */ - ipAddress: string - /** Organization ID of the Scaleway Organization the IP address is in. */ - organizationId: string - /** Project ID of the Scaleway Project the IP address is in. */ - projectId: string - /** Load Balancer ID. */ - lbId?: string - /** Reverse DNS (domain name) of the IP address. */ - reverse: string - /** @deprecated The region the IP address is in. */ - region?: Region - /** The zone the IP address is in. */ - zone: Zone -} - -/** Lb. */ -export interface Lb { - /** Underlying Instance ID. */ - id: string - /** Load Balancer name. */ - name: string - /** Load Balancer description. */ - description: string - /** Load Balancer status. */ - status: LbStatus - /** List of underlying Instances. */ - instances: Instance[] - /** Scaleway Organization ID. */ - organizationId: string - /** Scaleway Project ID. */ - projectId: string - /** List of IP addresses attached to the Load Balancer. */ - ip: Ip[] - /** Load Balancer tags. */ - tags: string[] - /** Number of frontends the Load Balancer has. */ - frontendCount: number - /** Number of backends the Load Balancer has. */ - backendCount: number - /** Load Balancer offer type. */ - type: string - /** Subscriber information. */ - subscriber?: Subscriber - /** - * Determines the minimal SSL version which needs to be supported on client - * side. - */ - sslCompatibilityLevel: SSLCompatibilityLevel - /** Date on which the Load Balancer was created. */ - createdAt?: Date - /** Date on which the Load Balancer was last updated. */ - updatedAt?: Date - /** Number of Private Networks attached to the Load Balancer. */ - privateNetworkCount: number - /** Number of routes configured on the Load Balancer. */ - routeCount: number - /** @deprecated The region the Load Balancer is in. */ - region?: Region - /** The zone the Load Balancer is in. */ - zone: Zone -} - -/** Lb stats. */ -export interface LbStats { - /** List of objects containing Load Balancer statistics. */ - backendServersStats: BackendServerStats[] -} - -/** Lb type. */ -export interface LbType { - /** Load Balancer commercial offer type name. */ - name: string - /** Current stock status for a given Load Balancer type. */ - stockStatus: LbTypeStock - /** Load Balancer commercial offer type description. */ - description: string - /** @deprecated The region the Load Balancer stock is in. */ - region?: Region - /** The zone the Load Balancer stock is in. */ - zone: Zone -} - -/** List acl response. */ -export interface ListAclResponse { - /** List of ACL objects. */ - acls: Acl[] - /** The total number of objects. */ - totalCount: number -} - -/** List backend stats response. */ -export interface ListBackendStatsResponse { - /** List of objects containing backend server statistics. */ - backendServersStats: BackendServerStats[] - /** The total number of objects. */ - totalCount: number -} - -/** List backends response. */ -export interface ListBackendsResponse { - /** List of backend objects of a given Load Balancer. */ - backends: Backend[] - /** Total count of backend objects, without pagination. */ - totalCount: number -} - -/** List certificates response. */ -export interface ListCertificatesResponse { - /** List of certificate objects. */ - certificates: Certificate[] - /** The total number of objects. */ - totalCount: number -} - -/** List frontends response. */ -export interface ListFrontendsResponse { - /** List of frontend objects of a given Load Balancer. */ - frontends: Frontend[] - /** Total count of frontend objects, without pagination. */ - totalCount: number -} - -/** List ips response. */ -export interface ListIpsResponse { - /** List of IP address objects. */ - ips: Ip[] - /** Total count of IP address objects, without pagination. */ - totalCount: number -} - -/** List lb private networks response. */ -export interface ListLbPrivateNetworksResponse { - /** List of Private Network objects attached to the Load Balancer. */ - privateNetwork: PrivateNetwork[] - /** Total number of objects in the response. */ - totalCount: number -} - -/** List lb types response. */ -export interface ListLbTypesResponse { - /** List of Load Balancer commercial offer type objects. */ - lbTypes: LbType[] - /** Total number of Load Balancer offer type objects. */ - totalCount: number -} - -/** List lbs response. */ -export interface ListLbsResponse { - /** List of Load Balancer objects. */ - lbs: Lb[] - /** The total number of Load Balancer objects. */ - totalCount: number -} - -/** List routes response. */ -export interface ListRoutesResponse { - /** List of route objects. */ - routes: Route[] - /** The total number of route objects. */ - totalCount: number -} - -/** List subscriber response. */ -export interface ListSubscriberResponse { - /** List of subscriber objects. */ - subscribers: Subscriber[] - /** The total number of objects. */ - totalCount: number -} - -/** Private network. */ -export interface PrivateNetwork { - /** Load Balancer object which is attached to the Private Network. */ - lb?: Lb - /** IPAM IDs of the booked IP addresses. */ - ipamIds: string[] - /** - * @deprecated Object containing an array of a local IP address for the Load - * Balancer on this Private Network. - * - * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', - * 'ipamConfig' could be set. - */ - staticConfig?: PrivateNetworkStaticConfig - /** - * @deprecated Object containing DHCP-assigned IP addresses. - * - * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', - * 'ipamConfig' could be set. - */ - dhcpConfig?: PrivateNetworkDHCPConfig - /** - * @deprecated For internal use only. - * - * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', - * 'ipamConfig' could be set. - */ - ipamConfig?: PrivateNetworkIpamConfig - /** Private Network ID. */ - privateNetworkId: string - /** Status of Private Network connection. */ - status: PrivateNetworkStatus - /** Date on which the Private Network was created. */ - createdAt?: Date - /** Date on which the PN was last updated. */ + /** Date on which the frontend was last updated. */ updatedAt?: Date + /** Defines whether to enable HTTP/3 protocol on the frontend. */ + enableHttp3: boolean } export interface PrivateNetworkDHCPConfig { @@ -804,7 +567,6 @@ export interface PrivateNetworkDHCPConfig { export interface PrivateNetworkIpamConfig {} -/** Private network. static config. */ export interface PrivateNetworkStaticConfig { /** * @deprecated Array of a local IP address for the Load Balancer on this @@ -813,331 +575,248 @@ export interface PrivateNetworkStaticConfig { ipAddress?: string[] } -/** Route. */ -export interface Route { - /** Route ID. */ - id: string - /** ID of the source frontend. */ - frontendId: string - /** ID of the target backend. */ - backendId: string - /** - * Object defining the match condition for a route to be applied. If an - * incoming client session matches the specified condition (i.e. it has a - * matching SNI value or HTTP Host header value), it will be passed to the - * target backend. - */ - match?: RouteMatch - /** Date on which the route was created. */ - createdAt?: Date - /** Date on which the route was last updated. */ - updatedAt?: Date -} - -/** Route. match. */ export interface RouteMatch { /** - * Server Name Indication (SNI) value to match. Value to match in the Server - * Name Indication TLS extension (SNI) field from an incoming connection made - * via an SSL/TLS transport layer. This field should be set for routes on TCP - * Load Balancers. + * Value to match in the Server Name Indication TLS extension (SNI) field from + * an incoming connection made via an SSL/TLS transport layer. This field + * should be set for routes on TCP Load Balancers. * * One-of ('matchType'): at most one of 'sni', 'hostHeader' could be set. */ sni?: string /** - * HTTP host header to match. Value to match in the HTTP Host request header - * from an incoming connection. This field should be set for routes on HTTP - * Load Balancers. + * Value to match in the HTTP Host request header from an incoming connection. + * This field should be set for routes on HTTP Load Balancers. * * One-of ('matchType'): at most one of 'sni', 'hostHeader' could be set. */ hostHeader?: string } -/** Set acls response. */ -export interface SetAclsResponse { - /** List of ACL objects. */ - acls: Acl[] - /** The total number of ACL objects. */ - totalCount: number +export interface CreateCertificateRequestCustomCertificate { + /** + * Full PEM-formatted certificate, consisting of the entire certificate chain + * including public key, private key, and (optionally) Certificate + * Authorities. + */ + certificateChain: string } -/** Subscriber. */ -export interface Subscriber { - /** Subscriber ID. */ - id: string - /** Subscriber name. */ - name: string +export interface CreateCertificateRequestLetsencryptConfig { /** - * Email address of subscriber. - * - * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be - * set. + * Main domain name of certificate (this domain must exist and resolve to your + * Load Balancer IP address). */ - emailConfig?: SubscriberEmailConfig + commonName: string /** - * Webhook URI of subscriber. - * - * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be - * set. + * Alternative domain names (all domain names must exist and resolve to your + * Load Balancer IP address). */ - webhookConfig?: SubscriberWebhookConfig -} - -/** Subscriber. email config. */ -export interface SubscriberEmailConfig { - /** Email address to send alerts to. */ - email: string + subjectAlternativeName: string[] } -/** Webhook alert of subscriber. Subscriber. webhook config. */ -export interface SubscriberWebhookConfig { - /** URI to receive POST requests. */ - uri: string +export interface BackendServerStats { + /** ID of your Load Balancer's underlying Instance. */ + instanceId: string + /** Backend ID. */ + backendId: string + /** IPv4 or IPv6 address of the backend server. */ + ip: string + /** Server operational state (stopped/starting/running/stopping). */ + serverState: BackendServerStatsServerState + /** Time since last operational change. */ + serverStateChangedAt?: Date + /** Last health check status (unknown/neutral/failed/passed/condpass). */ + lastHealthCheckStatus: BackendServerStatsHealthCheckStatus } -export type ListLbsRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Load Balancer name to filter for. */ - name?: string - /** Sort order of Load Balancers in the response. */ - orderBy?: ListLbsRequestOrderBy - /** Number of Load Balancers to return. */ - pageSize?: number - /** Page number to return, from the paginated results. */ - page?: number +export interface Acl { + /** ACL ID. */ + id: string + /** ACL name. */ + name: string /** - * Organization ID to filter for, only Load Balancers from this Organization - * will be returned. + * ACL match filter object. One of `ip_subnet` or `http_filter` & + * `http_filter_value` are required. */ - organizationId?: string + match?: AclMatch + /** Action to take when incoming traffic matches an ACL filter. */ + action?: AclAction + /** ACL is attached to this frontend object. */ + frontend?: Frontend /** - * Project ID to filter for, only Load Balancers from this Project will be - * returned. + * Priority of this ACL (ACLs are applied in ascending order, 0 is the first + * ACL executed). */ - projectId?: string + index: number + /** Date on which the ACL was created. */ + createdAt?: Date + /** Date on which the ACL was last updated. */ + updatedAt?: Date + /** ACL description. */ + description: string } -export type CreateLbRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region +export interface PrivateNetwork { + /** Load Balancer object which is attached to the Private Network. */ + lb?: Lb + /** IPAM IDs of the booked IP addresses. */ + ipamIds: string[] /** - * @deprecated Scaleway Organization to create the Load Balancer in. + * @deprecated Object containing an array of a local IP address for the Load + * Balancer on this Private Network. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', + * 'ipamConfig' could be set. */ - organizationId?: string + staticConfig?: PrivateNetworkStaticConfig /** - * Scaleway Project to create the Load Balancer in. + * @deprecated Object containing DHCP-assigned IP addresses. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. - */ - projectId?: string - /** Name for the Load Balancer. */ - name?: string - /** Description for the Load Balancer. */ - description: string - /** - * @deprecated ID of an existing flexible IP address to attach to the Load - * Balancer. - */ - ipId?: string - /** - * Defines whether to automatically assign a flexible public IP to lb. Default - * value is `false` (do not assign). - */ - assignFlexibleIp?: boolean - /** List of tags for the Load Balancer. */ - tags?: string[] - /** - * Load Balancer commercial offer type. Use the Load Balancer types endpoint - * to retrieve a list of available offer types. - */ - type: string - /** - * Determines the minimal SSL version which needs to be supported on the - * client side, in an SSL/TLS offloading context. Intermediate is suitable for - * general-purpose servers with a variety of clients, recommended for almost - * all systems. Modern is suitable for services with clients that support TLS - * 1.3 and do not need backward compatibility. Old is compatible with a small - * number of very old clients and should be used only as a last resort. + * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', + * 'ipamConfig' could be set. */ - sslCompatibilityLevel?: SSLCompatibilityLevel -} - -export type GetLbRequest = { + dhcpConfig?: PrivateNetworkDHCPConfig /** - * Region to target. If none is passed will use default region from the - * config. + * @deprecated For internal use only. + * + * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', + * 'ipamConfig' could be set. */ - region?: Region - /** Load Balancer ID. */ - lbId: string + ipamConfig?: PrivateNetworkIpamConfig + /** Private Network ID. */ + privateNetworkId: string + /** Status of Private Network connection. */ + status: PrivateNetworkStatus + /** Date on which the Private Network was created. */ + createdAt?: Date + /** Date on which the PN was last updated. */ + updatedAt?: Date } -export type UpdateLbRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Load Balancer ID. */ - lbId: string - /** Load Balancer name. */ +export interface LbType { + /** Load Balancer commercial offer type name. */ name: string - /** Load Balancer description. */ + /** Current stock status for a given Load Balancer type. */ + stockStatus: LbTypeStock + /** Load Balancer commercial offer type description. */ description: string - /** List of tags for the Load Balancer. */ - tags?: string[] - /** - * Determines the minimal SSL version which needs to be supported on the - * client side, in an SSL/TLS offloading context. Intermediate is suitable for - * general-purpose servers with a variety of clients, recommended for almost - * all systems. Modern is suitable for services with clients that support TLS - * 1.3 and don't need backward compatibility. Old is compatible with a small - * number of very old clients and should be used only as a last resort. - */ - sslCompatibilityLevel?: SSLCompatibilityLevel + /** @deprecated The region the Load Balancer stock is in. */ + region?: Region + /** The zone the Load Balancer stock is in. */ + zone: Zone } -export type DeleteLbRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** ID of the Load Balancer to delete. */ - lbId: string +export interface Route { + /** Route ID. */ + id: string + /** ID of the source frontend. */ + frontendId: string + /** ID of the target backend. */ + backendId: string /** - * Defines whether the Load Balancer's flexible IP should be deleted. Set to - * true to release the flexible IP, or false to keep it available in your - * account for future Load Balancers. + * Object defining the match condition for a route to be applied. If an + * incoming client session matches the specified condition (i.e. it has a + * matching SNI value or HTTP Host header value), it will be passed to the + * target backend. */ - releaseIp: boolean + match?: RouteMatch + /** Date on which the route was created. */ + createdAt?: Date + /** Date on which the route was last updated. */ + updatedAt?: Date } -export type MigrateLbRequest = { +export interface AclSpec { + /** ACL name. */ + name: string + /** Action to take when incoming traffic matches an ACL filter. */ + action: AclAction /** - * Region to target. If none is passed will use default region from the - * config. + * ACL match filter object. One of `ip_subnet` or `http_filter` and + * `http_filter_value` are required. */ - region?: Region - /** Load Balancer ID. */ - lbId: string + match?: AclMatch /** - * Load Balancer type to migrate to (use the List all Load Balancer offer - * types endpoint to get a list of available offer types). + * Priority of this ACL (ACLs are applied in ascending order, 0 is the first + * ACL executed). */ - type: string + index: number + /** ACL description. */ + description: string } -export type ListIPsRequest = { +export type AddBackendServersRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** The page number to return, from the paginated results. */ - page?: number - /** Number of IP addresses to return. */ - pageSize?: number - /** IP address to filter for. */ - ipAddress?: string - /** - * Organization ID to filter for, only Load Balancer IP addresses from this - * Organization will be returned. - */ - organizationId?: string - /** - * Project ID to filter for, only Load Balancer IP addresses from this Project - * will be returned. - */ - projectId?: string + /** Backend ID. */ + backendId: string + /** List of IP addresses to add to backend servers. */ + serverIp: string[] } -export type CreateIpRequest = { +export type AttachPrivateNetworkRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region + /** Load Balancer ID. */ + lbId: string + /** Private Network ID. */ + privateNetworkId: string /** - * @deprecated Organization ID of the Organization where the IP address should - * be created. + * @deprecated Object containing an array of a local IP address for the Load + * Balancer on this Private Network. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', + * 'ipamConfig' could be set. */ - organizationId?: string + staticConfig?: PrivateNetworkStaticConfig /** - * Project ID of the Project where the IP address should be created. + * @deprecated Defines whether to let DHCP assign IP addresses. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', + * 'ipamConfig' could be set. */ - projectId?: string - /** Reverse DNS (domain name) for the IP address. */ - reverse?: string -} - -export type GetIpRequest = { + dhcpConfig?: PrivateNetworkDHCPConfig /** - * Region to target. If none is passed will use default region from the - * config. + * @deprecated For internal use only. + * + * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', + * 'ipamConfig' could be set. */ - region?: Region - /** IP address ID. */ - ipId: string + ipamConfig?: PrivateNetworkIpamConfig } -export type ReleaseIpRequest = { +/** Add an ACL to a Load Balancer frontend. */ +export type CreateAclRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** IP address ID. */ - ipId: string -} - -export type UpdateIpRequest = { + /** Frontend ID to attach the ACL to. */ + frontendId: string + /** ACL name. */ + name?: string + /** Action to take when incoming traffic matches an ACL filter. */ + action: AclAction /** - * Region to target. If none is passed will use default region from the - * config. + * ACL match filter object. One of `ip_subnet` or `http_filter` & + * `http_filter_value` are required. */ - region?: Region - /** IP address ID. */ - ipId: string - /** Reverse DNS (domain name) for the IP address. */ - reverse?: string -} - -export type ListBackendsRequest = { + match?: AclMatch /** - * Region to target. If none is passed will use default region from the - * config. + * Priority of this ACL (ACLs are applied in ascending order, 0 is the first + * ACL executed). */ - region?: Region - /** Load Balancer ID. */ - lbId: string - /** Name of the backend to filter for. */ - name?: string - /** Sort order of backends in the response. */ - orderBy?: ListBackendsRequestOrderBy - /** The page number to return, from the paginated results. */ - page?: number - /** Number of backends to return. */ - pageSize?: number + index: number + /** ACL description. */ + description: string } export type CreateBackendRequest = { @@ -1226,90 +905,199 @@ export type CreateBackendRequest = { timeoutQueue?: string } -export type GetBackendRequest = { +export type CreateCertificateRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Load Balancer ID. */ + lbId: string + /** Name for the certificate. */ + name?: string + /** + * Object to define a new Let's Encrypt certificate to be generated. + * + * One-of ('type'): at most one of 'letsencrypt', 'customCertificate' could be + * set. + */ + letsencrypt?: CreateCertificateRequestLetsencryptConfig + /** + * Object to define an existing custom certificate to be imported. + * + * One-of ('type'): at most one of 'letsencrypt', 'customCertificate' could be + * set. + */ + customCertificate?: CreateCertificateRequestCustomCertificate +} + +export type CreateFrontendRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Load Balancer ID (ID of the Load Balancer to attach the frontend to). */ + lbId: string + /** Name for the frontend. */ + name?: string + /** Port the frontend should listen on. */ + inboundPort: number + /** Backend ID (ID of the backend the frontend should pass traffic to). */ + backendId: string + /** Maximum allowed inactivity time on the client side. */ + timeoutClient?: string + /** @deprecated Certificate ID, deprecated in favor of certificate_ids array. */ + certificateId?: string + /** List of SSL/TLS certificate IDs to bind to the frontend. */ + certificateIds?: string[] + /** Defines whether to enable HTTP/3 protocol on the frontend. */ + enableHttp3: boolean +} + +export type CreateIpRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** + * @deprecated Organization ID of the Organization where the IP address should + * be created. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + organizationId?: string + /** + * Project ID of the Project where the IP address should be created. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + projectId?: string + /** Reverse DNS (domain name) for the IP address. */ + reverse?: string +} + +export type CreateLbRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** + * @deprecated Scaleway Organization to create the Load Balancer in. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + organizationId?: string + /** + * Scaleway Project to create the Load Balancer in. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + projectId?: string + /** Name for the Load Balancer. */ + name?: string + /** Description for the Load Balancer. */ + description: string + /** + * @deprecated ID of an existing flexible IP address to attach to the Load + * Balancer. + */ + ipId?: string + /** + * Defines whether to automatically assign a flexible public IP to lb. Default + * value is `false` (do not assign). + */ + assignFlexibleIp?: boolean + /** List of tags for the Load Balancer. */ + tags?: string[] + /** + * Load Balancer commercial offer type. Use the Load Balancer types endpoint + * to retrieve a list of available offer types. + */ + type: string + /** + * Determines the minimal SSL version which needs to be supported on the + * client side, in an SSL/TLS offloading context. Intermediate is suitable for + * general-purpose servers with a variety of clients, recommended for almost + * all systems. Modern is suitable for services with clients that support TLS + * 1.3 and do not need backward compatibility. Old is compatible with a small + * number of very old clients and should be used only as a last resort. + */ + sslCompatibilityLevel?: SSLCompatibilityLevel +} + +export type CreateRouteRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Backend ID. */ + /** ID of the source frontend to create the route on. */ + frontendId: string + /** ID of the target backend for the route. */ backendId: string + /** + * Object defining the match condition for a route to be applied. If an + * incoming client session matches the specified condition (i.e. it has a + * matching SNI value or HTTP Host header value), it will be passed to the + * target backend. + */ + match?: RouteMatch } -export type UpdateBackendRequest = { +/** Create a new alert subscriber (webhook or email). */ +export type CreateSubscriberRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Backend ID. */ - backendId: string - /** Backend name. */ + /** Subscriber name. */ name: string /** - * Protocol to be used by the backend when forwarding traffic to backend - * servers. - */ - forwardProtocol: Protocol - /** Port to be used by the backend when forwarding traffic to backend servers. */ - forwardPort: number - /** - * Load balancing algorithm to be used when determining which backend server - * to forward new traffic to. - */ - forwardPortAlgorithm: ForwardPortAlgorithm - /** - * Defines whether to activate sticky sessions (binding a particular session - * to a particular backend server) and the method to use if so. None disables - * sticky sessions. Cookie-based uses an HTTP cookie to stick a session to a - * backend server. Table-based uses the source (client) IP address to stick a - * session to a backend server. - */ - stickySessions: StickySessionsType - /** Cookie name for cookie-based sticky sessions. */ - stickySessionsCookieName: string - /** @deprecated Deprecated in favor of proxy_protocol field. */ - sendProxyV2?: boolean - /** Maximum allowed time for a backend server to process a request. */ - timeoutServer?: string - /** Maximum allowed time for establishing a connection to a backend server. */ - timeoutConnect?: string - /** - * Maximum allowed tunnel inactivity time after Websocket is established - * (takes precedence over client and server timeout). + * Email address configuration. + * + * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be + * set. */ - timeoutTunnel?: string - /** Action to take when a backend server is marked as down. */ - onMarkedDownAction?: OnMarkedDownAction + emailConfig?: SubscriberEmailConfig /** - * Protocol to use between the Load Balancer and backend servers. Allows the - * backend servers to be informed of the client's real IP address. The PROXY - * protocol must be supported by the backend servers' software. + * WebHook URI configuration. + * + * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be + * set. */ - proxyProtocol?: ProxyProtocol + webhookConfig?: SubscriberWebhookConfig /** - * Scaleway S3 bucket website to be served as failover if all backend servers - * are down, e.g. failover-website.s3-website.fr-par.scw.cloud. + * @deprecated Organization ID to create the subscriber in. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. */ - failoverHost?: string + organizationId?: string /** - * Defines whether to enable SSL bridging between the Load Balancer and - * backend servers. + * Project ID to create the subscriber in. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. */ - sslBridging?: boolean - /** Defines whether the server certificate verification should be ignored. */ - ignoreSslServerVerify?: boolean - /** Whether to use another backend server on each attempt. */ - redispatchAttemptCount?: number - /** Number of retries when a backend server connection failed. */ - maxRetries?: number - /** Maximum number of connections allowed per backend server. */ - maxConnections?: number + projectId?: string +} + +export type DeleteAclRequest = { /** - * Maximum time for a request to be left pending in queue when - * `max_connections` is reached. + * Region to target. If none is passed will use default region from the + * config. */ - timeoutQueue?: string + region?: Region + /** ACL ID. */ + aclId: string } export type DeleteBackendRequest = { @@ -1322,185 +1110,105 @@ export type DeleteBackendRequest = { backendId: string } -export type AddBackendServersRequest = { +export type DeleteCertificateRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Backend ID. */ - backendId: string - /** List of IP addresses to add to backend servers. */ - serverIp: string[] + /** Certificate ID. */ + certificateId: string } -export type RemoveBackendServersRequest = { +export type DeleteFrontendRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Backend ID. */ - backendId: string - /** List of IP addresses to remove from backend servers. */ - serverIp: string[] + /** ID of the frontend to delete. */ + frontendId: string } -export type SetBackendServersRequest = { +export type DeleteLbRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Backend ID. */ - backendId: string + /** ID of the Load Balancer to delete. */ + lbId: string /** - * List of IP addresses for backend servers. Any other existing backend - * servers will be removed. + * Defines whether the Load Balancer's flexible IP should be deleted. Set to + * true to release the flexible IP, or false to keep it available in your + * account for future Load Balancers. */ - serverIp: string[] + releaseIp: boolean } -export type UpdateHealthCheckRequest = { +export type DeleteRouteRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Backend ID. */ - backendId: string - /** Port to use for the backend server health check. */ - port: number - /** Time to wait between two consecutive health checks. */ - checkDelay: string - /** Maximum time a backend server has to reply to the health check. */ - checkTimeout: string - /** - * Number of consecutive unsuccessful health checks after which the server - * will be considered dead. - */ - checkMaxRetries: number - /** Defines whether proxy protocol should be activated for the health check. */ - checkSendProxy: boolean - /** - * Object to configure a basic TCP health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - tcpConfig?: HealthCheckTcpConfig - /** - * Object to configure a MySQL health check. The check requires MySQL >=3.22, - * for older versions, use a TCP health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - mysqlConfig?: HealthCheckMysqlConfig - /** - * Object to configure a PostgreSQL health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - pgsqlConfig?: HealthCheckPgsqlConfig - /** - * Object to configure an LDAP health check. The response is analyzed to find - * the LDAPv3 response message. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - ldapConfig?: HealthCheckLdapConfig - /** - * Object to configure a Redis health check. The response is analyzed to find - * the +PONG response message. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - redisConfig?: HealthCheckRedisConfig - /** - * Object to configure an HTTP health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - httpConfig?: HealthCheckHttpConfig + /** Route ID. */ + routeId: string +} + +export type DeleteSubscriberRequest = { /** - * Object to configure an HTTPS health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. + * Region to target. If none is passed will use default region from the + * config. */ - httpsConfig?: HealthCheckHttpsConfig + region?: Region + /** Subscriber ID. */ + subscriberId: string +} + +export type DetachPrivateNetworkRequest = { /** - * Time to wait between two consecutive health checks when a backend server is - * in a transient state (going UP or DOWN). + * Region to target. If none is passed will use default region from the + * config. */ - transientCheckDelay?: string + region?: Region + /** Load balancer ID. */ + lbId: string + /** Set your instance private network id. */ + privateNetworkId: string } -export type ListFrontendsRequest = { +export type GetAclRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Load Balancer ID. */ - lbId: string - /** Name of the frontend to filter for. */ - name?: string - /** Sort order of frontends in the response. */ - orderBy?: ListFrontendsRequestOrderBy - /** The page number to return, from the paginated results. */ - page?: number - /** Number of frontends to return. */ - pageSize?: number + /** ACL ID. */ + aclId: string } -export type CreateFrontendRequest = { +export type GetBackendRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Load Balancer ID (ID of the Load Balancer to attach the frontend to). */ - lbId: string - /** Name for the frontend. */ - name?: string - /** Port the frontend should listen on. */ - inboundPort: number - /** Backend ID (ID of the backend the frontend should pass traffic to). */ - backendId: string - /** Maximum allowed inactivity time on the client side. */ - timeoutClient?: string - /** @deprecated Certificate ID, deprecated in favor of certificate_ids array. */ - certificateId?: string - /** List of SSL/TLS certificate IDs to bind to the frontend. */ - certificateIds?: string[] - /** Defines whether to enable HTTP/3 protocol on the frontend. */ - enableHttp3: boolean + /** Backend ID. */ + backendId: string } -export type GetFrontendRequest = { +export type GetCertificateRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Frontend ID. */ - frontendId: string + /** Certificate ID. */ + certificateId: string } -export type UpdateFrontendRequest = { +export type GetFrontendRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -1508,65 +1216,39 @@ export type UpdateFrontendRequest = { region?: Region /** Frontend ID. */ frontendId: string - /** Frontend name. */ - name: string - /** Port the frontend should listen on. */ - inboundPort: number - /** Backend ID (ID of the backend the frontend should pass traffic to). */ - backendId: string - /** Maximum allowed inactivity time on the client side. */ - timeoutClient?: string - /** @deprecated Certificate ID, deprecated in favor of certificate_ids array. */ - certificateId?: string - /** List of SSL/TLS certificate IDs to bind to the frontend. */ - certificateIds?: string[] - /** Defines whether to enable HTTP/3 protocol on the frontend. */ - enableHttp3: boolean } -export type DeleteFrontendRequest = { +export type GetIpRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the frontend to delete. */ - frontendId: string + /** IP address ID. */ + ipId: string } -export type ListRoutesRequest = { +export type GetLbRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Sort order of routes in the response. */ - orderBy?: ListRoutesRequestOrderBy - /** The number of route objects to return. */ - pageSize?: number - /** The page number to return, from the paginated results. */ - page?: number - /** Frontend ID to filter for, only Routes from this Frontend will be returned. */ - frontendId?: string + /** Load Balancer ID. */ + lbId: string } -export type CreateRouteRequest = { +/** Get Load Balancer stats. */ +export type GetLbStatsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the source frontend to create the route on. */ - frontendId: string - /** ID of the target backend for the route. */ - backendId: string - /** - * Object defining the match condition for a route to be applied. If an - * incoming client session matches the specified condition (i.e. it has a - * matching SNI value or HTTP Host header value), it will be passed to the - * target backend. - */ - match?: RouteMatch + /** Load Balancer ID. */ + lbId: string + /** ID of the backend. */ + backendId?: string } export type GetRouteRequest = { @@ -1579,36 +1261,50 @@ export type GetRouteRequest = { routeId: string } -export type UpdateRouteRequest = { +export type GetSubscriberRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Route ID. */ - routeId: string - /** ID of the target backend for the route. */ - backendId: string - /** - * Object defining the match condition for a route to be applied. If an - * incoming client session matches the specified condition (i.e. it has a - * matching SNI value or HTTP Host header value), it will be passed to the - * target backend. - */ - match?: RouteMatch + /** Subscriber ID. */ + subscriberId: string } -export type DeleteRouteRequest = { +export interface LbStats { + /** List of objects containing Load Balancer statistics. */ + backendServersStats: BackendServerStats[] +} + +export interface ListAclResponse { + /** List of ACL objects. */ + acls: Acl[] + /** The total number of objects. */ + totalCount: number +} + +export type ListAclsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Route ID. */ - routeId: string + /** + * Frontend ID (ACLs attached to this frontend will be returned in the + * response). + */ + frontendId: string + /** Sort order of ACLs in the response. */ + orderBy?: ListAclRequestOrderBy + /** The page number to return, from the paginated results. */ + page?: number + /** The number of ACLs to return. */ + pageSize?: number + /** ACL name to filter for. */ + name?: string } -export type GetLbStatsRequest = { +export type ListBackendStatsRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -1616,11 +1312,22 @@ export type GetLbStatsRequest = { region?: Region /** Load Balancer ID. */ lbId: string + /** The page number to return, from the paginated results. */ + page?: number + /** Number of items to return. */ + pageSize?: number /** ID of the backend. */ backendId?: string } -export type ListBackendStatsRequest = { +export interface ListBackendStatsResponse { + /** List of objects containing backend server statistics. */ + backendServersStats: BackendServerStats[] + /** The total number of objects. */ + totalCount: number +} + +export type ListBackendsRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -1628,108 +1335,233 @@ export type ListBackendStatsRequest = { region?: Region /** Load Balancer ID. */ lbId: string + /** Name of the backend to filter for. */ + name?: string + /** Sort order of backends in the response. */ + orderBy?: ListBackendsRequestOrderBy /** The page number to return, from the paginated results. */ page?: number - /** Number of items to return. */ + /** Number of backends to return. */ pageSize?: number - /** ID of the backend. */ - backendId?: string } -export type ListAclsRequest = { +export interface ListBackendsResponse { + /** List of backend objects of a given Load Balancer. */ + backends: Backend[] + /** Total count of backend objects, without pagination. */ + totalCount: number +} + +export type ListCertificatesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** - * Frontend ID (ACLs attached to this frontend will be returned in the - * response). - */ - frontendId: string - /** Sort order of ACLs in the response. */ - orderBy?: ListAclRequestOrderBy + /** Load Balancer ID. */ + lbId: string + /** Sort order of certificates in the response. */ + orderBy?: ListCertificatesRequestOrderBy /** The page number to return, from the paginated results. */ page?: number - /** The number of ACLs to return. */ + /** Number of certificates to return. */ pageSize?: number - /** ACL name to filter for. */ + /** + * Certificate name to filter for, only certificates of this name will be + * returned. + */ name?: string } -export type CreateAclRequest = { +export interface ListCertificatesResponse { + /** List of certificate objects. */ + certificates: Certificate[] + /** The total number of objects. */ + totalCount: number +} + +export type ListFrontendsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Frontend ID to attach the ACL to. */ - frontendId: string - /** ACL name. */ + /** Load Balancer ID. */ + lbId: string + /** Name of the frontend to filter for. */ name?: string - /** Action to take when incoming traffic matches an ACL filter. */ - action: AclAction + /** Sort order of frontends in the response. */ + orderBy?: ListFrontendsRequestOrderBy + /** The page number to return, from the paginated results. */ + page?: number + /** Number of frontends to return. */ + pageSize?: number +} + +export interface ListFrontendsResponse { + /** List of frontend objects of a given Load Balancer. */ + frontends: Frontend[] + /** Total count of frontend objects, without pagination. */ + totalCount: number +} + +export type ListIPsRequest = { /** - * ACL match filter object. One of `ip_subnet` or `http_filter` & - * `http_filter_value` are required. + * Region to target. If none is passed will use default region from the + * config. */ - match?: AclMatch + region?: Region + /** The page number to return, from the paginated results. */ + page?: number + /** Number of IP addresses to return. */ + pageSize?: number + /** IP address to filter for. */ + ipAddress?: string /** - * Priority of this ACL (ACLs are applied in ascending order, 0 is the first - * ACL executed). + * Organization ID to filter for, only Load Balancer IP addresses from this + * Organization will be returned. */ - index: number - /** ACL description. */ - description: string + organizationId?: string + /** + * Project ID to filter for, only Load Balancer IP addresses from this Project + * will be returned. + */ + projectId?: string +} + +export interface ListIpsResponse { + /** List of IP address objects. */ + ips: Ip[] + /** Total count of IP address objects, without pagination. */ + totalCount: number +} + +export type ListLbPrivateNetworksRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Load Balancer ID. */ + lbId: string + /** Sort order of Private Network objects in the response. */ + orderBy?: ListPrivateNetworksRequestOrderBy + /** Number of objects to return. */ + pageSize?: number + /** The page number to return, from the paginated results. */ + page?: number +} + +export interface ListLbPrivateNetworksResponse { + /** List of Private Network objects attached to the Load Balancer. */ + privateNetwork: PrivateNetwork[] + /** Total number of objects in the response. */ + totalCount: number +} + +export type ListLbTypesRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** The page number to return, from the paginated results. */ + page?: number + /** The number of items to return. */ + pageSize?: number +} + +export interface ListLbTypesResponse { + /** List of Load Balancer commercial offer type objects. */ + lbTypes: LbType[] + /** Total number of Load Balancer offer type objects. */ + totalCount: number } -export type GetAclRequest = { +export type ListLbsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ACL ID. */ - aclId: string + /** Load Balancer name to filter for. */ + name?: string + /** Sort order of Load Balancers in the response. */ + orderBy?: ListLbsRequestOrderBy + /** Number of Load Balancers to return. */ + pageSize?: number + /** Page number to return, from the paginated results. */ + page?: number + /** + * Organization ID to filter for, only Load Balancers from this Organization + * will be returned. + */ + organizationId?: string + /** + * Project ID to filter for, only Load Balancers from this Project will be + * returned. + */ + projectId?: string } -export type UpdateAclRequest = { +export interface ListLbsResponse { + /** List of Load Balancer objects. */ + lbs: Lb[] + /** The total number of Load Balancer objects. */ + totalCount: number +} + +export type ListRoutesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ACL ID. */ - aclId: string - /** ACL name. */ - name: string - /** Action to take when incoming traffic matches an ACL filter. */ - action: AclAction - /** - * ACL match filter object. One of `ip_subnet` or `http_filter` & - * `http_filter_value` are required. - */ - match?: AclMatch - /** - * Priority of this ACL (ACLs are applied in ascending order, 0 is the first - * ACL executed). - */ - index: number - /** ACL description. */ - description?: string + /** Sort order of routes in the response. */ + orderBy?: ListRoutesRequestOrderBy + /** The number of route objects to return. */ + pageSize?: number + /** The page number to return, from the paginated results. */ + page?: number + /** Frontend ID to filter for, only Routes from this Frontend will be returned. */ + frontendId?: string } -export type DeleteAclRequest = { +export interface ListRoutesResponse { + /** List of route objects. */ + routes: Route[] + /** The total number of route objects. */ + totalCount: number +} + +export type ListSubscriberRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ACL ID. */ - aclId: string + /** Sort order of subscribers in the response. */ + orderBy?: ListSubscriberRequestOrderBy + /** The page number to return, from the paginated results. */ + page?: number + /** The number of items to return. */ + pageSize?: number + /** Subscriber name to search for. */ + name?: string + /** Filter subscribers by Organization ID. */ + organizationId?: string + /** Filter subscribers by Project ID. */ + projectId?: string } -export type CreateCertificateRequest = { +export interface ListSubscriberResponse { + /** List of subscriber objects. */ + subscribers: Subscriber[] + /** The total number of objects. */ + totalCount: number +} + +export type MigrateLbRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -1737,359 +1569,322 @@ export type CreateCertificateRequest = { region?: Region /** Load Balancer ID. */ lbId: string - /** Name for the certificate. */ - name?: string - /** - * Object to define a new Let's Encrypt certificate to be generated. - * - * One-of ('type'): at most one of 'letsencrypt', 'customCertificate' could be - * set. - */ - letsencrypt?: CreateCertificateRequestLetsencryptConfig /** - * Object to define an existing custom certificate to be imported. - * - * One-of ('type'): at most one of 'letsencrypt', 'customCertificate' could be - * set. + * Load Balancer type to migrate to (use the List all Load Balancer offer + * types endpoint to get a list of available offer types). */ - customCertificate?: CreateCertificateRequestCustomCertificate + type: string } -export type ListCertificatesRequest = { +export type ReleaseIpRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Load Balancer ID. */ - lbId: string - /** Sort order of certificates in the response. */ - orderBy?: ListCertificatesRequestOrderBy - /** The page number to return, from the paginated results. */ - page?: number - /** Number of certificates to return. */ - pageSize?: number - /** - * Certificate name to filter for, only certificates of this name will be - * returned. - */ - name?: string + /** IP address ID. */ + ipId: string } -export type GetCertificateRequest = { +export type RemoveBackendServersRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Certificate ID. */ - certificateId: string + /** Backend ID. */ + backendId: string + /** List of IP addresses to remove from backend servers. */ + serverIp: string[] } -export type UpdateCertificateRequest = { +export interface SetAclsResponse { + /** List of ACL objects. */ + acls: Acl[] + /** The total number of ACL objects. */ + totalCount: number +} + +export type SetBackendServersRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Certificate ID. */ - certificateId: string - /** Certificate name. */ - name: string + /** Backend ID. */ + backendId: string + /** + * List of IP addresses for backend servers. Any other existing backend + * servers will be removed. + */ + serverIp: string[] } -export type DeleteCertificateRequest = { +export type SubscribeToLbRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Certificate ID. */ - certificateId: string + /** Load Balancer ID. */ + lbId: string + /** Subscriber ID. */ + subscriberId: string } -export type ListLbTypesRequest = { +export type UnsubscribeFromLbRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** The page number to return, from the paginated results. */ - page?: number - /** The number of items to return. */ - pageSize?: number + /** Load Balancer ID. */ + lbId: string } -export type CreateSubscriberRequest = { +export type UpdateAclRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Subscriber name. */ + /** ACL ID. */ + aclId: string + /** ACL name. */ name: string + /** Action to take when incoming traffic matches an ACL filter. */ + action: AclAction /** - * Email address configuration. - * - * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be - * set. - */ - emailConfig?: SubscriberEmailConfig - /** - * WebHook URI configuration. - * - * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be - * set. - */ - webhookConfig?: SubscriberWebhookConfig - /** - * @deprecated Organization ID to create the subscriber in. - * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * ACL match filter object. One of `ip_subnet` or `http_filter` & + * `http_filter_value` are required. */ - organizationId?: string + match?: AclMatch /** - * Project ID to create the subscriber in. - * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * Priority of this ACL (ACLs are applied in ascending order, 0 is the first + * ACL executed). */ - projectId?: string + index: number + /** ACL description. */ + description?: string } -export type GetSubscriberRequest = { +export type UpdateBackendRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Subscriber ID. */ - subscriberId: string -} - -export type ListSubscriberRequest = { + /** Backend ID. */ + backendId: string + /** Backend name. */ + name: string /** - * Region to target. If none is passed will use default region from the - * config. + * Protocol to be used by the backend when forwarding traffic to backend + * servers. */ - region?: Region - /** Sort order of subscribers in the response. */ - orderBy?: ListSubscriberRequestOrderBy - /** The page number to return, from the paginated results. */ - page?: number - /** The number of items to return. */ - pageSize?: number - /** Subscriber name to search for. */ - name: string - /** Filter subscribers by Organization ID. */ - organizationId?: string - /** Filter subscribers by Project ID. */ - projectId?: string -} - -export type UpdateSubscriberRequest = { + forwardProtocol: Protocol + /** Port to be used by the backend when forwarding traffic to backend servers. */ + forwardPort: number + /** + * Load balancing algorithm to be used when determining which backend server + * to forward new traffic to. + */ + forwardPortAlgorithm: ForwardPortAlgorithm + /** + * Defines whether to activate sticky sessions (binding a particular session + * to a particular backend server) and the method to use if so. None disables + * sticky sessions. Cookie-based uses an HTTP cookie to stick a session to a + * backend server. Table-based uses the source (client) IP address to stick a + * session to a backend server. + */ + stickySessions: StickySessionsType + /** Cookie name for cookie-based sticky sessions. */ + stickySessionsCookieName: string + /** @deprecated Deprecated in favor of proxy_protocol field. */ + sendProxyV2?: boolean + /** Maximum allowed time for a backend server to process a request. */ + timeoutServer?: string + /** Maximum allowed time for establishing a connection to a backend server. */ + timeoutConnect?: string /** - * Region to target. If none is passed will use default region from the - * config. + * Maximum allowed tunnel inactivity time after Websocket is established + * (takes precedence over client and server timeout). */ - region?: Region - /** Subscriber ID. */ - subscriberId: string - /** Subscriber name. */ - name: string + timeoutTunnel?: string + /** Action to take when a backend server is marked as down. */ + onMarkedDownAction?: OnMarkedDownAction /** - * Email address configuration. - * - * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be - * set. + * Protocol to use between the Load Balancer and backend servers. Allows the + * backend servers to be informed of the client's real IP address. The PROXY + * protocol must be supported by the backend servers' software. */ - emailConfig?: SubscriberEmailConfig + proxyProtocol?: ProxyProtocol /** - * Webhook URI configuration. - * - * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be - * set. + * Scaleway S3 bucket website to be served as failover if all backend servers + * are down, e.g. failover-website.s3-website.fr-par.scw.cloud. */ - webhookConfig?: SubscriberWebhookConfig -} - -export type DeleteSubscriberRequest = { + failoverHost?: string /** - * Region to target. If none is passed will use default region from the - * config. + * Defines whether to enable SSL bridging between the Load Balancer and + * backend servers. */ - region?: Region - /** Subscriber ID. */ - subscriberId: string -} - -export type SubscribeToLbRequest = { + sslBridging?: boolean + /** Defines whether the server certificate verification should be ignored. */ + ignoreSslServerVerify?: boolean + /** Whether to use another backend server on each attempt. */ + redispatchAttemptCount?: number + /** Number of retries when a backend server connection failed. */ + maxRetries?: number + /** Maximum number of connections allowed per backend server. */ + maxConnections?: number /** - * Region to target. If none is passed will use default region from the - * config. + * Maximum time for a request to be left pending in queue when + * `max_connections` is reached. */ - region?: Region - /** Load Balancer ID. */ - lbId: string - /** Subscriber ID. */ - subscriberId: string + timeoutQueue?: string } -export type UnsubscribeFromLbRequest = { +export type UpdateCertificateRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Load Balancer ID. */ - lbId: string + /** Certificate ID. */ + certificateId: string + /** Certificate name. */ + name: string } -export type ListLbPrivateNetworksRequest = { +export type UpdateFrontendRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Load Balancer ID. */ - lbId: string - /** Sort order of Private Network objects in the response. */ - orderBy?: ListPrivateNetworksRequestOrderBy - /** Number of objects to return. */ - pageSize?: number - /** The page number to return, from the paginated results. */ - page?: number + /** Frontend ID. */ + frontendId: string + /** Frontend name. */ + name: string + /** Port the frontend should listen on. */ + inboundPort: number + /** Backend ID (ID of the backend the frontend should pass traffic to). */ + backendId: string + /** Maximum allowed inactivity time on the client side. */ + timeoutClient?: string + /** @deprecated Certificate ID, deprecated in favor of certificate_ids array. */ + certificateId?: string + /** List of SSL/TLS certificate IDs to bind to the frontend. */ + certificateIds?: string[] + /** Defines whether to enable HTTP/3 protocol on the frontend. */ + enableHttp3: boolean } -export type AttachPrivateNetworkRequest = { +export type UpdateHealthCheckRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Load Balancer ID. */ - lbId: string - /** Private Network ID. */ - privateNetworkId: string + /** Backend ID. */ + backendId: string + /** Port to use for the backend server health check. */ + port: number + /** Time to wait between two consecutive health checks. */ + checkDelay?: string + /** Maximum time a backend server has to reply to the health check. */ + checkTimeout?: string /** - * @deprecated Object containing an array of a local IP address for the Load - * Balancer on this Private Network. - * - * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', - * 'ipamConfig' could be set. + * Number of consecutive unsuccessful health checks after which the server + * will be considered dead. */ - staticConfig?: PrivateNetworkStaticConfig + checkMaxRetries: number + /** Defines whether proxy protocol should be activated for the health check. */ + checkSendProxy: boolean /** - * @deprecated Defines whether to let DHCP assign IP addresses. + * Object to configure a basic TCP health check. * - * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', - * 'ipamConfig' could be set. + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - dhcpConfig?: PrivateNetworkDHCPConfig + tcpConfig?: HealthCheckTcpConfig /** - * @deprecated For internal use only. + * Object to configure a MySQL health check. The check requires MySQL >=3.22, + * for older versions, use a TCP health check. * - * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', - * 'ipamConfig' could be set. - */ - ipamConfig?: PrivateNetworkIpamConfig -} - -export type DetachPrivateNetworkRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Load balancer ID. */ - lbId: string - /** Set your instance private network id. */ - privateNetworkId: string -} - -export type ZonedApiListLbsRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Load Balancer name to filter for. */ - name?: string - /** Sort order of Load Balancers in the response. */ - orderBy?: ListLbsRequestOrderBy - /** Number of Load Balancers to return. */ - pageSize?: number - /** Page number to return, from the paginated results. */ - page?: number - /** - * Organization ID to filter for, only Load Balancers from this Organization - * will be returned. - */ - organizationId?: string - /** - * Project ID to filter for, only Load Balancers from this Project will be - * returned. + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - projectId?: string -} - -export type ZonedApiCreateLbRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone + mysqlConfig?: HealthCheckMysqlConfig /** - * @deprecated Scaleway Organization to create the Load Balancer in. + * Object to configure a PostgreSQL health check. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - organizationId?: string + pgsqlConfig?: HealthCheckPgsqlConfig /** - * Scaleway Project to create the Load Balancer in. + * Object to configure an LDAP health check. The response is analyzed to find + * the LDAPv3 response message. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' * could be set. */ - projectId?: string - /** Name for the Load Balancer. */ - name?: string - /** Description for the Load Balancer. */ - description: string + ldapConfig?: HealthCheckLdapConfig /** - * @deprecated ID of an existing flexible IP address to attach to the Load - * Balancer. + * Object to configure a Redis health check. The response is analyzed to find + * the +PONG response message. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - ipId?: string + redisConfig?: HealthCheckRedisConfig /** - * Defines whether to automatically assign a flexible public IP to lb. Default - * value is `false` (do not assign). + * Object to configure an HTTP health check. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - assignFlexibleIp?: boolean - /** List of tags for the Load Balancer. */ - tags?: string[] + httpConfig?: HealthCheckHttpConfig /** - * Load Balancer commercial offer type. Use the Load Balancer types endpoint - * to retrieve a list of available offer types. + * Object to configure an HTTPS health check. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - type: string + httpsConfig?: HealthCheckHttpsConfig /** - * Determines the minimal SSL version which needs to be supported on the - * client side, in an SSL/TLS offloading context. Intermediate is suitable for - * general-purpose servers with a variety of clients, recommended for almost - * all systems. Modern is suitable for services with clients that support TLS - * 1.3 and do not need backward compatibility. Old is compatible with a small - * number of very old clients and should be used only as a last resort. + * Time to wait between two consecutive health checks when a backend server is + * in a transient state (going UP or DOWN). */ - sslCompatibilityLevel?: SSLCompatibilityLevel + transientCheckDelay?: string } -export type ZonedApiGetLbRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Load Balancer ID. */ - lbId: string +export type UpdateIpRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** IP address ID. */ + ipId: string + /** Reverse DNS (domain name) for the IP address. */ + reverse?: string } -export type ZonedApiUpdateLbRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone +export type UpdateLbRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region /** Load Balancer ID. */ lbId: string /** Load Balancer name. */ @@ -2109,209 +1904,122 @@ export type ZonedApiUpdateLbRequest = { sslCompatibilityLevel?: SSLCompatibilityLevel } -export type ZonedApiDeleteLbRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the Load Balancer to delete. */ - lbId: string +export type UpdateRouteRequest = { /** - * Defines whether the Load Balancer's flexible IP should be deleted. Set to - * true to release the flexible IP, or false to keep it available in your - * account for future Load Balancers. + * Region to target. If none is passed will use default region from the + * config. */ - releaseIp: boolean -} - -export type ZonedApiMigrateLbRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Load Balancer ID. */ - lbId: string + region?: Region + /** Route ID. */ + routeId: string + /** ID of the target backend for the route. */ + backendId: string /** - * Load Balancer type to migrate to (use the List all Load Balancer offer - * types endpoint to get a list of available offer types). + * Object defining the match condition for a route to be applied. If an + * incoming client session matches the specified condition (i.e. it has a + * matching SNI value or HTTP Host header value), it will be passed to the + * target backend. */ - type: string + match?: RouteMatch } -export type ZonedApiListIPsRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** The page number to return, from the paginated results. */ - page?: number - /** Number of IP addresses to return. */ - pageSize?: number - /** IP address to filter for. */ - ipAddress?: string - /** - * Organization ID to filter for, only Load Balancer IP addresses from this - * Organization will be returned. - */ - organizationId?: string +export type UpdateSubscriberRequest = { /** - * Project ID to filter for, only Load Balancer IP addresses from this Project - * will be returned. + * Region to target. If none is passed will use default region from the + * config. */ - projectId?: string -} - -export type ZonedApiCreateIpRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone + region?: Region + /** Subscriber ID. */ + subscriberId: string + /** Subscriber name. */ + name: string /** - * @deprecated Organization ID of the Organization where the IP address should - * be created. + * Email address configuration. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be + * set. */ - organizationId?: string + emailConfig?: SubscriberEmailConfig /** - * Project ID of the Project where the IP address should be created. + * Webhook URI configuration. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be + * set. */ - projectId?: string - /** Reverse DNS (domain name) for the IP address. */ - reverse?: string -} - -export type ZonedApiGetIpRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** IP address ID. */ - ipId: string -} - -export type ZonedApiReleaseIpRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** IP address ID. */ - ipId: string -} - -export type ZonedApiUpdateIpRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** IP address ID. */ - ipId: string - /** Reverse DNS (domain name) for the IP address. */ - reverse?: string + webhookConfig?: SubscriberWebhookConfig } -export type ZonedApiListBackendsRequest = { +export type ZonedApiAddBackendServersRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Load Balancer ID. */ - lbId: string - /** Name of the backend to filter for. */ - name?: string - /** Sort order of backends in the response. */ - orderBy?: ListBackendsRequestOrderBy - /** The page number to return, from the paginated results. */ - page?: number - /** Number of backends to return. */ - pageSize?: number + /** Backend ID. */ + backendId: string + /** List of IP addresses to add to backend servers. */ + serverIp: string[] } -export type ZonedApiCreateBackendRequest = { +export type ZonedApiAttachPrivateNetworkRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone /** Load Balancer ID. */ lbId: string - /** Name for the backend. */ - name?: string - /** - * Protocol to be used by the backend when forwarding traffic to backend - * servers. - */ - forwardProtocol: Protocol - /** Port to be used by the backend when forwarding traffic to backend servers. */ - forwardPort: number - /** - * Load balancing algorithm to be used when determining which backend server - * to forward new traffic to. - */ - forwardPortAlgorithm: ForwardPortAlgorithm - /** - * Defines whether to activate sticky sessions (binding a particular session - * to a particular backend server) and the method to use if so. None disables - * sticky sessions. Cookie-based uses an HTTP cookie TO stick a session to a - * backend server. Table-based uses the source (client) IP address to stick a - * session to a backend server. - */ - stickySessions: StickySessionsType - /** Cookie name for cookie-based sticky sessions. */ - stickySessionsCookieName: string - /** - * Object defining the health check to be carried out by the backend when - * checking the status and health of backend servers. - */ - healthCheck: HealthCheck - /** - * List of backend server IP addresses (IPv4 or IPv6) the backend should - * forward traffic to. - */ - serverIp: string[] - /** @deprecated Deprecated in favor of proxy_protocol field. */ - sendProxyV2?: boolean - /** Maximum allowed time for a backend server to process a request. */ - timeoutServer?: string - /** Maximum allowed time for establishing a connection to a backend server. */ - timeoutConnect?: string - /** - * Maximum allowed tunnel inactivity time after Websocket is established - * (takes precedence over client and server timeout). - */ - timeoutTunnel?: string - /** Action to take when a backend server is marked as down. */ - onMarkedDownAction?: OnMarkedDownAction - /** - * Protocol to use between the Load Balancer and backend servers. Allows the - * backend servers to be informed of the client's real IP address. The PROXY - * protocol must be supported by the backend servers' software. - */ - proxyProtocol?: ProxyProtocol + /** Private Network ID. */ + privateNetworkId: string /** - * Scaleway S3 bucket website to be served as failover if all backend servers - * are down, e.g. failover-website.s3-website.fr-par.scw.cloud. + * @deprecated Object containing an array of a local IP address for the Load + * Balancer on this Private Network. + * + * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', + * 'ipamConfig' could be set. */ - failoverHost?: string + staticConfig?: PrivateNetworkStaticConfig /** - * Defines whether to enable SSL bridging between the Load Balancer and - * backend servers. + * @deprecated Defines whether to let DHCP assign IP addresses. + * + * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', + * 'ipamConfig' could be set. */ - sslBridging?: boolean - /** Defines whether the server certificate verification should be ignored. */ - ignoreSslServerVerify?: boolean - /** Whether to use another backend server on each attempt. */ - redispatchAttemptCount?: number - /** Number of retries when a backend server connection failed. */ - maxRetries?: number - /** Maximum number of connections allowed per backend server. */ - maxConnections?: number + dhcpConfig?: PrivateNetworkDHCPConfig /** - * Maximum time for a request to be left pending in queue when - * `max_connections` is reached. + * @deprecated For internal use only. + * + * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', + * 'ipamConfig' could be set. */ - timeoutQueue?: string + ipamConfig?: PrivateNetworkIpamConfig } -export type ZonedApiGetBackendRequest = { +/** Add an ACL to a Load Balancer frontend. */ +export type ZonedApiCreateAclRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Backend ID. */ - backendId: string + /** Frontend ID to attach the ACL to. */ + frontendId: string + /** ACL name. */ + name?: string + /** Action to take when incoming traffic matches an ACL filter. */ + action: AclAction + /** + * ACL match filter object. One of `ip_subnet` or `http_filter` & + * `http_filter_value` are required. + */ + match?: AclMatch + /** + * Priority of this ACL (ACLs are applied in ascending order, 0 is the first + * ACL executed). + */ + index: number + /** ACL description. */ + description: string } -export type ZonedApiUpdateBackendRequest = { +export type ZonedApiCreateBackendRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Backend ID. */ - backendId: string - /** Backend name. */ - name: string + /** Load Balancer ID. */ + lbId: string + /** Name for the backend. */ + name?: string /** * Protocol to be used by the backend when forwarding traffic to backend * servers. @@ -2327,13 +2035,23 @@ export type ZonedApiUpdateBackendRequest = { /** * Defines whether to activate sticky sessions (binding a particular session * to a particular backend server) and the method to use if so. None disables - * sticky sessions. Cookie-based uses an HTTP cookie to stick a session to a + * sticky sessions. Cookie-based uses an HTTP cookie TO stick a session to a * backend server. Table-based uses the source (client) IP address to stick a * session to a backend server. */ stickySessions: StickySessionsType /** Cookie name for cookie-based sticky sessions. */ stickySessionsCookieName: string + /** + * Object defining the health check to be carried out by the backend when + * checking the status and health of backend servers. + */ + healthCheck: HealthCheck + /** + * List of backend server IP addresses (IPv4 or IPv6) the backend should + * forward traffic to. + */ + serverIp: string[] /** @deprecated Deprecated in favor of proxy_protocol field. */ sendProxyV2?: boolean /** Maximum allowed time for a backend server to process a request. */ @@ -2378,125 +2096,365 @@ export type ZonedApiUpdateBackendRequest = { timeoutQueue?: string } -export type ZonedApiDeleteBackendRequest = { +export type ZonedApiCreateCertificateRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Load Balancer ID. */ + lbId: string + /** Name for the certificate. */ + name?: string + /** + * Object to define a new Let's Encrypt certificate to be generated. + * + * One-of ('type'): at most one of 'letsencrypt', 'customCertificate' could be + * set. + */ + letsencrypt?: CreateCertificateRequestLetsencryptConfig + /** + * Object to define an existing custom certificate to be imported. + * + * One-of ('type'): at most one of 'letsencrypt', 'customCertificate' could be + * set. + */ + customCertificate?: CreateCertificateRequestCustomCertificate +} + +export type ZonedApiCreateFrontendRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Load Balancer ID (ID of the Load Balancer to attach the frontend to). */ + lbId: string + /** Name for the frontend. */ + name?: string + /** Port the frontend should listen on. */ + inboundPort: number + /** Backend ID (ID of the backend the frontend should pass traffic to). */ + backendId: string + /** Maximum allowed inactivity time on the client side. */ + timeoutClient?: string + /** @deprecated Certificate ID, deprecated in favor of certificate_ids array. */ + certificateId?: string + /** List of SSL/TLS certificate IDs to bind to the frontend. */ + certificateIds?: string[] + /** Defines whether to enable HTTP/3 protocol on the frontend. */ + enableHttp3: boolean +} + +export type ZonedApiCreateIpRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** + * @deprecated Organization ID of the Organization where the IP address should + * be created. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + organizationId?: string + /** + * Project ID of the Project where the IP address should be created. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + projectId?: string + /** Reverse DNS (domain name) for the IP address. */ + reverse?: string +} + +export type ZonedApiCreateLbRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** + * @deprecated Scaleway Organization to create the Load Balancer in. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + organizationId?: string + /** + * Scaleway Project to create the Load Balancer in. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + projectId?: string + /** Name for the Load Balancer. */ + name?: string + /** Description for the Load Balancer. */ + description: string + /** + * @deprecated ID of an existing flexible IP address to attach to the Load + * Balancer. + */ + ipId?: string + /** + * Defines whether to automatically assign a flexible public IP to lb. Default + * value is `false` (do not assign). + */ + assignFlexibleIp?: boolean + /** List of tags for the Load Balancer. */ + tags?: string[] + /** + * Load Balancer commercial offer type. Use the Load Balancer types endpoint + * to retrieve a list of available offer types. + */ + type: string + /** + * Determines the minimal SSL version which needs to be supported on the + * client side, in an SSL/TLS offloading context. Intermediate is suitable for + * general-purpose servers with a variety of clients, recommended for almost + * all systems. Modern is suitable for services with clients that support TLS + * 1.3 and do not need backward compatibility. Old is compatible with a small + * number of very old clients and should be used only as a last resort. + */ + sslCompatibilityLevel?: SSLCompatibilityLevel +} + +export type ZonedApiCreateRouteRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the source frontend to create the route on. */ + frontendId: string + /** ID of the target backend for the route. */ + backendId: string + /** + * Object defining the match condition for a route to be applied. If an + * incoming client session matches the specified condition (i.e. it has a + * matching SNI value or HTTP Host header value), it will be passed to the + * target backend. + */ + match?: RouteMatch +} + +/** Create a new alert subscriber (webhook or email). */ +export type ZonedApiCreateSubscriberRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Subscriber name. */ + name: string + /** + * Email address configuration. + * + * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be + * set. + */ + emailConfig?: SubscriberEmailConfig + /** + * WebHook URI configuration. + * + * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be + * set. + */ + webhookConfig?: SubscriberWebhookConfig + /** + * @deprecated Organization ID to create the subscriber in. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + organizationId?: string + /** + * Project ID to create the subscriber in. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + projectId?: string +} + +export type ZonedApiDeleteAclRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ACL ID. */ + aclId: string +} + +export type ZonedApiDeleteBackendRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the backend to delete. */ + backendId: string +} + +export type ZonedApiDeleteCertificateRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Certificate ID. */ + certificateId: string +} + +export type ZonedApiDeleteFrontendRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the frontend to delete. */ + frontendId: string +} + +export type ZonedApiDeleteLbRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the Load Balancer to delete. */ + lbId: string + /** + * Defines whether the Load Balancer's flexible IP should be deleted. Set to + * true to release the flexible IP, or false to keep it available in your + * account for future Load Balancers. + */ + releaseIp: boolean +} + +export type ZonedApiDeleteRouteRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Route ID. */ + routeId: string +} + +export type ZonedApiDeleteSubscriberRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Subscriber ID. */ + subscriberId: string +} + +export type ZonedApiDetachPrivateNetworkRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Load balancer ID. */ + lbId: string + /** Set your instance private network id. */ + privateNetworkId: string +} + +export type ZonedApiGetAclRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ACL ID. */ + aclId: string +} + +export type ZonedApiGetBackendRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Backend ID. */ + backendId: string +} + +export type ZonedApiGetCertificateRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the backend to delete. */ - backendId: string + /** Certificate ID. */ + certificateId: string } -export type ZonedApiAddBackendServersRequest = { +export type ZonedApiGetFrontendRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Backend ID. */ - backendId: string - /** List of IP addresses to add to backend servers. */ - serverIp: string[] + /** Frontend ID. */ + frontendId: string } -export type ZonedApiRemoveBackendServersRequest = { +export type ZonedApiGetIpRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Backend ID. */ - backendId: string - /** List of IP addresses to remove from backend servers. */ - serverIp: string[] + /** IP address ID. */ + ipId: string } -export type ZonedApiSetBackendServersRequest = { +export type ZonedApiGetLbRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Backend ID. */ - backendId: string - /** - * List of IP addresses for backend servers. Any other existing backend - * servers will be removed. - */ - serverIp: string[] + /** Load Balancer ID. */ + lbId: string } -export type ZonedApiUpdateHealthCheckRequest = { +/** Get Load Balancer stats. */ +export type ZonedApiGetLbStatsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Load Balancer ID. */ + lbId: string + /** ID of the backend. */ + backendId?: string +} + +export type ZonedApiGetRouteRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Route ID. */ + routeId: string +} + +export type ZonedApiGetSubscriberRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Subscriber ID. */ + subscriberId: string +} + +export type ZonedApiListAclsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Backend ID. */ - backendId: string - /** Port to use for the backend server health check. */ - port: number - /** Time to wait between two consecutive health checks. */ - checkDelay: string - /** Maximum time a backend server has to reply to the health check. */ - checkTimeout: string - /** - * Number of consecutive unsuccessful health checks after which the server - * will be considered dead. - */ - checkMaxRetries: number - /** Defines whether proxy protocol should be activated for the health check. */ - checkSendProxy: boolean - /** - * Object to configure a basic TCP health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - tcpConfig?: HealthCheckTcpConfig - /** - * Object to configure a MySQL health check. The check requires MySQL >=3.22, - * for older versions, use a TCP health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - mysqlConfig?: HealthCheckMysqlConfig - /** - * Object to configure a PostgreSQL health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - pgsqlConfig?: HealthCheckPgsqlConfig - /** - * Object to configure an LDAP health check. The response is analyzed to find - * the LDAPv3 response message. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - ldapConfig?: HealthCheckLdapConfig - /** - * Object to configure a Redis health check. The response is analyzed to find - * the +PONG response message. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - redisConfig?: HealthCheckRedisConfig - /** - * Object to configure an HTTP health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. - */ - httpConfig?: HealthCheckHttpConfig /** - * Object to configure an HTTPS health check. - * - * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', - * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' - * could be set. + * Frontend ID (ACLs attached to this frontend will be returned in the + * response). */ - httpsConfig?: HealthCheckHttpsConfig + frontendId: string + /** Sort order of ACLs in the response. */ + orderBy?: ListAclRequestOrderBy + /** The page number to return, from the paginated results. */ + page?: number + /** The number of ACLs to return. */ + pageSize?: number + /** ACL name to filter for. */ + name?: string +} + +export type ZonedApiListBackendStatsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Load Balancer ID. */ + lbId: string + /** The page number to return, from the paginated results. */ + page?: number + /** Number of items to return. */ + pageSize?: number + /** ID of the backend. */ + backendId?: string +} + +export type ZonedApiListBackendsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Load Balancer ID. */ + lbId: string + /** Name of the backend to filter for. */ + name?: string + /** Sort order of backends in the response. */ + orderBy?: ListBackendsRequestOrderBy + /** The page number to return, from the paginated results. */ + page?: number + /** Number of backends to return. */ + pageSize?: number +} + +export type ZonedApiListCertificatesRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Load Balancer ID. */ + lbId: string + /** Sort order of certificates in the response. */ + orderBy?: ListCertificatesRequestOrderBy + /** The page number to return, from the paginated results. */ + page?: number + /** Number of certificates to return. */ + pageSize?: number /** - * Time to wait between two consecutive health checks when a backend server is - * in a transient state (going UP or DOWN). + * Certificate name to filter for, only certificates of this name will be + * returned. */ - transientCheckDelay?: string + name?: string } export type ZonedApiListFrontendsRequest = { @@ -2514,60 +2472,70 @@ export type ZonedApiListFrontendsRequest = { pageSize?: number } -export type ZonedApiCreateFrontendRequest = { +export type ZonedApiListIPsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Load Balancer ID (ID of the Load Balancer to attach the frontend to). */ - lbId: string - /** Name for the frontend. */ - name?: string - /** Port the frontend should listen on. */ - inboundPort: number - /** Backend ID (ID of the backend the frontend should pass traffic to). */ - backendId: string - /** Maximum allowed inactivity time on the client side. */ - timeoutClient?: string - /** @deprecated Certificate ID, deprecated in favor of certificate_ids array. */ - certificateId?: string - /** List of SSL/TLS certificate IDs to bind to the frontend. */ - certificateIds?: string[] - /** Defines whether to enable HTTP/3 protocol on the frontend. */ - enableHttp3: boolean + /** The page number to return, from the paginated results. */ + page?: number + /** Number of IP addresses to return. */ + pageSize?: number + /** IP address to filter for. */ + ipAddress?: string + /** + * Organization ID to filter for, only Load Balancer IP addresses from this + * Organization will be returned. + */ + organizationId?: string + /** + * Project ID to filter for, only Load Balancer IP addresses from this Project + * will be returned. + */ + projectId?: string } -export type ZonedApiGetFrontendRequest = { +export type ZonedApiListLbPrivateNetworksRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Frontend ID. */ - frontendId: string + /** Load Balancer ID. */ + lbId: string + /** Sort order of Private Network objects in the response. */ + orderBy?: ListPrivateNetworksRequestOrderBy + /** Number of objects to return. */ + pageSize?: number + /** The page number to return, from the paginated results. */ + page?: number } -export type ZonedApiUpdateFrontendRequest = { +export type ZonedApiListLbTypesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Frontend ID. */ - frontendId: string - /** Frontend name. */ - name: string - /** Port the frontend should listen on. */ - inboundPort: number - /** Backend ID (ID of the backend the frontend should pass traffic to). */ - backendId: string - /** Maximum allowed inactivity time on the client side. */ - timeoutClient?: string - /** @deprecated Certificate ID, deprecated in favor of certificate_ids array. */ - certificateId?: string - /** List of SSL/TLS certificate IDs to bind to the frontend. */ - certificateIds?: string[] - /** Defines whether to enable HTTP/3 protocol on the frontend. */ - enableHttp3: boolean + /** The page number to return, from the paginated results. */ + page?: number + /** The number of items to return. */ + pageSize?: number } -export type ZonedApiDeleteFrontendRequest = { +export type ZonedApiListLbsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the frontend to delete. */ - frontendId: string + /** Load Balancer name to filter for. */ + name?: string + /** Sort order of Load Balancers in the response. */ + orderBy?: ListLbsRequestOrderBy + /** Number of Load Balancers to return. */ + pageSize?: number + /** Page number to return, from the paginated results. */ + page?: number + /** + * Organization ID to filter for, only Load Balancers from this Organization + * will be returned. + */ + organizationId?: string + /** + * Project ID to filter for, only Load Balancers from this Project will be + * returned. + */ + projectId?: string } export type ZonedApiListRoutesRequest = { @@ -2583,120 +2551,89 @@ export type ZonedApiListRoutesRequest = { frontendId?: string } -export type ZonedApiCreateRouteRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the source frontend to create the route on. */ - frontendId: string - /** ID of the target backend for the route. */ - backendId: string - /** - * Object defining the match condition for a route to be applied. If an - * incoming client session matches the specified condition (i.e. it has a - * matching SNI value or HTTP Host header value), it will be passed to the - * target backend. - */ - match?: RouteMatch -} - -export type ZonedApiGetRouteRequest = { +export type ZonedApiListSubscriberRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Route ID. */ - routeId: string + /** Sort order of subscribers in the response. */ + orderBy?: ListSubscriberRequestOrderBy + /** The page number to return, from the paginated results. */ + page?: number + /** The number of items to return. */ + pageSize?: number + /** Subscriber name to search for. */ + name?: string + /** Filter subscribers by Organization ID. */ + organizationId?: string + /** Filter subscribers by Project ID. */ + projectId?: string } -export type ZonedApiUpdateRouteRequest = { +export type ZonedApiMigrateLbRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Route ID. */ - routeId: string - /** ID of the target backend for the route. */ - backendId: string + /** Load Balancer ID. */ + lbId: string /** - * Object defining the match condition for a route to be applied. If an - * incoming client session matches the specified condition (i.e. it has a - * matching SNI value or HTTP Host header value), it will be passed to the - * target backend. + * Load Balancer type to migrate to (use the List all Load Balancer offer + * types endpoint to get a list of available offer types). */ - match?: RouteMatch + type: string } -export type ZonedApiDeleteRouteRequest = { +export type ZonedApiReleaseIpRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Route ID. */ - routeId: string + /** IP address ID. */ + ipId: string } -export type ZonedApiGetLbStatsRequest = { +export type ZonedApiRemoveBackendServersRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Load Balancer ID. */ - lbId: string - /** ID of the backend. */ - backendId?: string + /** Backend ID. */ + backendId: string + /** List of IP addresses to remove from backend servers. */ + serverIp: string[] } -export type ZonedApiListBackendStatsRequest = { +export type ZonedApiSetAclsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Load Balancer ID. */ - lbId: string - /** The page number to return, from the paginated results. */ - page?: number - /** Number of items to return. */ - pageSize?: number - /** ID of the backend. */ - backendId?: string + /** Frontend ID. */ + frontendId: string + /** + * List of ACLs for this frontend. Any other existing ACLs on this frontend + * will be removed. + */ + acls: AclSpec[] } -export type ZonedApiListAclsRequest = { +export type ZonedApiSetBackendServersRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone + /** Backend ID. */ + backendId: string /** - * Frontend ID (ACLs attached to this frontend will be returned in the - * response). + * List of IP addresses for backend servers. Any other existing backend + * servers will be removed. */ - frontendId: string - /** Sort order of ACLs in the response. */ - orderBy?: ListAclRequestOrderBy - /** The page number to return, from the paginated results. */ - page?: number - /** The number of ACLs to return. */ - pageSize?: number - /** ACL name to filter for. */ - name?: string + serverIp: string[] } -export type ZonedApiCreateAclRequest = { +export type ZonedApiSubscribeToLbRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Frontend ID to attach the ACL to. */ - frontendId: string - /** ACL name. */ - name?: string - /** Action to take when incoming traffic matches an ACL filter. */ - action: AclAction - /** - * ACL match filter object. One of `ip_subnet` or `http_filter` & - * `http_filter_value` are required. - */ - match?: AclMatch - /** - * Priority of this ACL (ACLs are applied in ascending order, 0 is the first - * ACL executed). - */ - index: number - /** ACL description. */ - description: string + /** Load Balancer ID. */ + lbId: string + /** Subscriber ID. */ + subscriberId: string } -export type ZonedApiGetAclRequest = { +export type ZonedApiUnsubscribeFromLbRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ACL ID. */ - aclId: string + /** Load Balancer ID. */ + lbId: string } export type ZonedApiUpdateAclRequest = { @@ -2722,71 +2659,77 @@ export type ZonedApiUpdateAclRequest = { description?: string } -export type ZonedApiDeleteAclRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ACL ID. */ - aclId: string -} - -export type ZonedApiSetAclsRequest = { +export type ZonedApiUpdateBackendRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Frontend ID. */ - frontendId: string + /** Backend ID. */ + backendId: string + /** Backend name. */ + name: string /** - * List of ACLs for this frontend. Any other existing ACLs on this frontend - * will be removed. + * Protocol to be used by the backend when forwarding traffic to backend + * servers. */ - acls: AclSpec[] -} - -export type ZonedApiCreateCertificateRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Load Balancer ID. */ - lbId: string - /** Name for the certificate. */ - name?: string + forwardProtocol: Protocol + /** Port to be used by the backend when forwarding traffic to backend servers. */ + forwardPort: number /** - * Object to define a new Let's Encrypt certificate to be generated. - * - * One-of ('type'): at most one of 'letsencrypt', 'customCertificate' could be - * set. + * Load balancing algorithm to be used when determining which backend server + * to forward new traffic to. */ - letsencrypt?: CreateCertificateRequestLetsencryptConfig + forwardPortAlgorithm: ForwardPortAlgorithm /** - * Object to define an existing custom certificate to be imported. - * - * One-of ('type'): at most one of 'letsencrypt', 'customCertificate' could be - * set. + * Defines whether to activate sticky sessions (binding a particular session + * to a particular backend server) and the method to use if so. None disables + * sticky sessions. Cookie-based uses an HTTP cookie to stick a session to a + * backend server. Table-based uses the source (client) IP address to stick a + * session to a backend server. */ - customCertificate?: CreateCertificateRequestCustomCertificate -} - -export type ZonedApiListCertificatesRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Load Balancer ID. */ - lbId: string - /** Sort order of certificates in the response. */ - orderBy?: ListCertificatesRequestOrderBy - /** The page number to return, from the paginated results. */ - page?: number - /** Number of certificates to return. */ - pageSize?: number + stickySessions: StickySessionsType + /** Cookie name for cookie-based sticky sessions. */ + stickySessionsCookieName: string + /** @deprecated Deprecated in favor of proxy_protocol field. */ + sendProxyV2?: boolean + /** Maximum allowed time for a backend server to process a request. */ + timeoutServer?: string + /** Maximum allowed time for establishing a connection to a backend server. */ + timeoutConnect?: string + /** + * Maximum allowed tunnel inactivity time after Websocket is established + * (takes precedence over client and server timeout). + */ + timeoutTunnel?: string + /** Action to take when a backend server is marked as down. */ + onMarkedDownAction?: OnMarkedDownAction + /** + * Protocol to use between the Load Balancer and backend servers. Allows the + * backend servers to be informed of the client's real IP address. The PROXY + * protocol must be supported by the backend servers' software. + */ + proxyProtocol?: ProxyProtocol + /** + * Scaleway S3 bucket website to be served as failover if all backend servers + * are down, e.g. failover-website.s3-website.fr-par.scw.cloud. + */ + failoverHost?: string + /** + * Defines whether to enable SSL bridging between the Load Balancer and + * backend servers. + */ + sslBridging?: boolean + /** Defines whether the server certificate verification should be ignored. */ + ignoreSslServerVerify?: boolean + /** Whether to use another backend server on each attempt. */ + redispatchAttemptCount?: number + /** Number of retries when a backend server connection failed. */ + maxRetries?: number + /** Maximum number of connections allowed per backend server. */ + maxConnections?: number /** - * Certificate name to filter for, only certificates of this name will be - * returned. + * Maximum time for a request to be left pending in queue when + * `max_connections` is reached. */ - name?: string -} - -export type ZonedApiGetCertificateRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Certificate ID. */ - certificateId: string + timeoutQueue?: string } export type ZonedApiUpdateCertificateRequest = { @@ -2798,79 +2741,156 @@ export type ZonedApiUpdateCertificateRequest = { name: string } -export type ZonedApiDeleteCertificateRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Certificate ID. */ - certificateId: string -} - -export type ZonedApiListLbTypesRequest = { +export type ZonedApiUpdateFrontendRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** The page number to return, from the paginated results. */ - page?: number - /** The number of items to return. */ - pageSize?: number + /** Frontend ID. */ + frontendId: string + /** Frontend name. */ + name: string + /** Port the frontend should listen on. */ + inboundPort: number + /** Backend ID (ID of the backend the frontend should pass traffic to). */ + backendId: string + /** Maximum allowed inactivity time on the client side. */ + timeoutClient?: string + /** @deprecated Certificate ID, deprecated in favor of certificate_ids array. */ + certificateId?: string + /** List of SSL/TLS certificate IDs to bind to the frontend. */ + certificateIds?: string[] + /** Defines whether to enable HTTP/3 protocol on the frontend. */ + enableHttp3: boolean } -export type ZonedApiCreateSubscriberRequest = { +export type ZonedApiUpdateHealthCheckRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Subscriber name. */ - name: string + /** Backend ID. */ + backendId: string + /** Port to use for the backend server health check. */ + port: number + /** Time to wait between two consecutive health checks. */ + checkDelay?: string + /** Maximum time a backend server has to reply to the health check. */ + checkTimeout?: string /** - * Email address configuration. + * Number of consecutive unsuccessful health checks after which the server + * will be considered dead. + */ + checkMaxRetries: number + /** Defines whether proxy protocol should be activated for the health check. */ + checkSendProxy: boolean + /** + * Object to configure a basic TCP health check. * - * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be - * set. + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - emailConfig?: SubscriberEmailConfig + tcpConfig?: HealthCheckTcpConfig /** - * WebHook URI configuration. + * Object to configure a MySQL health check. The check requires MySQL >=3.22, + * for older versions, use a TCP health check. * - * One-of ('config'): at most one of 'emailConfig', 'webhookConfig' could be - * set. + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - webhookConfig?: SubscriberWebhookConfig + mysqlConfig?: HealthCheckMysqlConfig /** - * @deprecated Organization ID to create the subscriber in. + * Object to configure a PostgreSQL health check. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. */ - organizationId?: string + pgsqlConfig?: HealthCheckPgsqlConfig /** - * Project ID to create the subscriber in. + * Object to configure an LDAP health check. The response is analyzed to find + * the LDAPv3 response message. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' * could be set. */ - projectId?: string + ldapConfig?: HealthCheckLdapConfig + /** + * Object to configure a Redis health check. The response is analyzed to find + * the +PONG response message. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. + */ + redisConfig?: HealthCheckRedisConfig + /** + * Object to configure an HTTP health check. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. + */ + httpConfig?: HealthCheckHttpConfig + /** + * Object to configure an HTTPS health check. + * + * One-of ('config'): at most one of 'tcpConfig', 'mysqlConfig', + * 'pgsqlConfig', 'ldapConfig', 'redisConfig', 'httpConfig', 'httpsConfig' + * could be set. + */ + httpsConfig?: HealthCheckHttpsConfig + /** + * Time to wait between two consecutive health checks when a backend server is + * in a transient state (going UP or DOWN). + */ + transientCheckDelay?: string } -export type ZonedApiGetSubscriberRequest = { +export type ZonedApiUpdateIpRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Subscriber ID. */ - subscriberId: string + /** IP address ID. */ + ipId: string + /** Reverse DNS (domain name) for the IP address. */ + reverse?: string } -export type ZonedApiListSubscriberRequest = { +export type ZonedApiUpdateLbRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Sort order of subscribers in the response. */ - orderBy?: ListSubscriberRequestOrderBy - /** The page number to return, from the paginated results. */ - page?: number - /** The number of items to return. */ - pageSize?: number - /** Subscriber name to search for. */ + /** Load Balancer ID. */ + lbId: string + /** Load Balancer name. */ name: string - /** Filter subscribers by Organization ID. */ - organizationId?: string - /** Filter subscribers by Project ID. */ - projectId?: string + /** Load Balancer description. */ + description: string + /** List of tags for the Load Balancer. */ + tags?: string[] + /** + * Determines the minimal SSL version which needs to be supported on the + * client side, in an SSL/TLS offloading context. Intermediate is suitable for + * general-purpose servers with a variety of clients, recommended for almost + * all systems. Modern is suitable for services with clients that support TLS + * 1.3 and don't need backward compatibility. Old is compatible with a small + * number of very old clients and should be used only as a last resort. + */ + sslCompatibilityLevel?: SSLCompatibilityLevel +} + +export type ZonedApiUpdateRouteRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Route ID. */ + routeId: string + /** ID of the target backend for the route. */ + backendId: string + /** + * Object defining the match condition for a route to be applied. If an + * incoming client session matches the specified condition (i.e. it has a + * matching SNI value or HTTP Host header value), it will be passed to the + * target backend. + */ + match?: RouteMatch } export type ZonedApiUpdateSubscriberRequest = { @@ -2895,79 +2915,3 @@ export type ZonedApiUpdateSubscriberRequest = { */ webhookConfig?: SubscriberWebhookConfig } - -export type ZonedApiDeleteSubscriberRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Subscriber ID. */ - subscriberId: string -} - -export type ZonedApiSubscribeToLbRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Load Balancer ID. */ - lbId: string - /** Subscriber ID. */ - subscriberId: string -} - -export type ZonedApiUnsubscribeFromLbRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Load Balancer ID. */ - lbId: string -} - -export type ZonedApiListLbPrivateNetworksRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Load Balancer ID. */ - lbId: string - /** Sort order of Private Network objects in the response. */ - orderBy?: ListPrivateNetworksRequestOrderBy - /** Number of objects to return. */ - pageSize?: number - /** The page number to return, from the paginated results. */ - page?: number -} - -export type ZonedApiAttachPrivateNetworkRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Load Balancer ID. */ - lbId: string - /** Private Network ID. */ - privateNetworkId: string - /** - * @deprecated Object containing an array of a local IP address for the Load - * Balancer on this Private Network. - * - * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', - * 'ipamConfig' could be set. - */ - staticConfig?: PrivateNetworkStaticConfig - /** - * @deprecated Defines whether to let DHCP assign IP addresses. - * - * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', - * 'ipamConfig' could be set. - */ - dhcpConfig?: PrivateNetworkDHCPConfig - /** - * @deprecated For internal use only. - * - * One-of ('config'): at most one of 'staticConfig', 'dhcpConfig', - * 'ipamConfig' could be set. - */ - ipamConfig?: PrivateNetworkIpamConfig -} - -export type ZonedApiDetachPrivateNetworkRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Load balancer ID. */ - lbId: string - /** Set your instance private network id. */ - privateNetworkId: string -} diff --git a/packages/clients/src/api/marketplace/v1/marshalling.gen.ts b/packages/clients/src/api/marketplace/v1/marshalling.gen.ts index 47ee6092d..aa965dea8 100644 --- a/packages/clients/src/api/marketplace/v1/marshalling.gen.ts +++ b/packages/clients/src/api/marketplace/v1/marshalling.gen.ts @@ -16,7 +16,7 @@ import type { Version, } from './types.gen' -const unmarshalLocalImage = (data: unknown) => { +const unmarshalLocalImage = (data: unknown): LocalImage => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'LocalImage' failed as data isn't a dictionary.`, @@ -31,17 +31,20 @@ const unmarshalLocalImage = (data: unknown) => { } as LocalImage } -const unmarshalOrganization = (data: unknown) => { +const unmarshalOrganization = (data: unknown): Organization => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Organization' failed as data isn't a dictionary.`, ) } - return { id: data.id, name: data.name } as Organization + return { + id: data.id, + name: data.name, + } as Organization } -const unmarshalVersion = (data: unknown) => { +const unmarshalVersion = (data: unknown): Version => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Version' failed as data isn't a dictionary.`, @@ -57,7 +60,7 @@ const unmarshalVersion = (data: unknown) => { } as Version } -const unmarshalImage = (data: unknown) => { +const unmarshalImage = (data: unknown): Image => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Image' failed as data isn't a dictionary.`, @@ -82,7 +85,7 @@ const unmarshalImage = (data: unknown) => { } as Image } -export const unmarshalGetImageResponse = (data: unknown) => { +export const unmarshalGetImageResponse = (data: unknown): GetImageResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetImageResponse' failed as data isn't a dictionary.`, @@ -94,7 +97,9 @@ export const unmarshalGetImageResponse = (data: unknown) => { } as GetImageResponse } -export const unmarshalGetVersionResponse = (data: unknown) => { +export const unmarshalGetVersionResponse = ( + data: unknown, +): GetVersionResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetVersionResponse' failed as data isn't a dictionary.`, @@ -106,7 +111,9 @@ export const unmarshalGetVersionResponse = (data: unknown) => { } as GetVersionResponse } -export const unmarshalListImagesResponse = (data: unknown) => { +export const unmarshalListImagesResponse = ( + data: unknown, +): ListImagesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`, @@ -119,7 +126,9 @@ export const unmarshalListImagesResponse = (data: unknown) => { } as ListImagesResponse } -export const unmarshalListVersionsResponse = (data: unknown) => { +export const unmarshalListVersionsResponse = ( + data: unknown, +): ListVersionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`, diff --git a/packages/clients/src/api/marketplace/v1/types.gen.ts b/packages/clients/src/api/marketplace/v1/types.gen.ts index e9eb5f49b..b40cd07c6 100644 --- a/packages/clients/src/api/marketplace/v1/types.gen.ts +++ b/packages/clients/src/api/marketplace/v1/types.gen.ts @@ -2,15 +2,35 @@ // If you have any remark or suggestion do not hesitate to open an issue. import type { Zone } from '../../../bridge' -export interface GetImageResponse { - image?: Image +export interface LocalImage { + /** Version you will typically use to define an image in an API call. */ + id: string + /** List of all commercial types that are compatible with this local image. */ + compatibleCommercialTypes: string[] + /** Supported architecture for this local image. */ + arch: string + /** Availability Zone where this local image is available. */ + zone: Zone } -export interface GetVersionResponse { - version?: Version +export interface Organization { + id: string + name: string +} + +export interface Version { + /** UUID of this version. */ + id: string + /** Name of this version. */ + name: string + /** Creation date of this image version. */ + creationDate?: Date + /** Date of the last modification of this version. */ + modificationDate?: Date + /** List of local images available in this version. */ + localImages: LocalImage[] } -/** Image. */ export interface Image { /** UUID of this image. */ id: string @@ -28,10 +48,7 @@ export interface Image { modificationDate?: Date /** Expiration date of this image. */ validUntil?: Date - /** - * Label of this image. Typically an identifier for a distribution (ex. - * "ubuntu_focal"). - */ + /** Typically an identifier for a distribution (ex. "ubuntu_focal"). */ label: string /** List of versions of this image. */ versions: Version[] @@ -40,48 +57,22 @@ export interface Image { currentPublicVersion: string } -export interface ListImagesResponse { - images: Image[] - totalCount: number -} - -export interface ListVersionsResponse { - versions: Version[] - totalCount: number +export type GetImageRequest = { + /** Display the image name. */ + imageId: string } -/** Local image. */ -export interface LocalImage { - /** - * UUID of this local image. Version you will typically use to define an image - * in an API call. - */ - id: string - /** List of all commercial types that are compatible with this local image. */ - compatibleCommercialTypes: string[] - /** Supported architecture for this local image. */ - arch: string - /** Availability Zone where this local image is available. */ - zone: Zone +export interface GetImageResponse { + image?: Image } -export interface Organization { - id: string - name: string +export type GetVersionRequest = { + imageId: string + versionId: string } -/** Version. */ -export interface Version { - /** UUID of this version. */ - id: string - /** Name of this version. */ - name: string - /** Creation date of this image version. */ - creationDate?: Date - /** Date of the last modification of this version. */ - modificationDate?: Date - /** List of local images available in this version. */ - localImages: LocalImage[] +export interface GetVersionResponse { + version?: Version } export type ListImagesRequest = { @@ -94,16 +85,16 @@ export type ListImagesRequest = { page?: number } -export type GetImageRequest = { - /** Display the image name. */ - imageId: string +export interface ListImagesResponse { + images: Image[] + totalCount: number } export type ListVersionsRequest = { imageId: string } -export type GetVersionRequest = { - imageId: string - versionId: string +export interface ListVersionsResponse { + versions: Version[] + totalCount: number } diff --git a/packages/clients/src/api/marketplace/v2/api.gen.ts b/packages/clients/src/api/marketplace/v2/api.gen.ts index 11e0e1038..bba2cd590 100644 --- a/packages/clients/src/api/marketplace/v2/api.gen.ts +++ b/packages/clients/src/api/marketplace/v2/api.gen.ts @@ -47,7 +47,7 @@ export class API extends ParentAPI { ['arch', request.arch], ['category', request.category], ['include_eol', request.includeEol], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -94,7 +94,7 @@ export class API extends ParentAPI { path: `/marketplace/v2/versions`, urlParams: urlParams( ['image_id', request.imageId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -143,28 +143,19 @@ export class API extends ParentAPI { method: 'GET', path: `/marketplace/v2/local-images`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', request.pageSize ?? this.client.settings.defaultPageSize, ], - ['type', request.type ?? 'unknown_type'], - ['zone', request.zone ?? this.client.settings.defaultZone], + ['type', request.type], + ['zone', request.zone], ...Object.entries( resolveOneOf([ - { - param: 'image_id', - value: request.imageId, - }, - { - param: 'version_id', - value: request.versionId, - }, - { - param: 'image_label', - value: request.imageLabel, - }, + { param: 'image_id', value: request.imageId }, + { param: 'version_id', value: request.versionId }, + { param: 'image_label', value: request.imageLabel }, ]), ), ), diff --git a/packages/clients/src/api/marketplace/v2/marshalling.gen.ts b/packages/clients/src/api/marketplace/v2/marshalling.gen.ts index e2841a37b..39859a568 100644 --- a/packages/clients/src/api/marketplace/v2/marshalling.gen.ts +++ b/packages/clients/src/api/marketplace/v2/marshalling.gen.ts @@ -16,7 +16,7 @@ import type { Version, } from './types.gen' -export const unmarshalCategory = (data: unknown) => { +export const unmarshalCategory = (data: unknown): Category => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Category' failed as data isn't a dictionary.`, @@ -30,7 +30,7 @@ export const unmarshalCategory = (data: unknown) => { } as Category } -export const unmarshalImage = (data: unknown) => { +export const unmarshalImage = (data: unknown): Image => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Image' failed as data isn't a dictionary.`, @@ -50,7 +50,7 @@ export const unmarshalImage = (data: unknown) => { } as Image } -export const unmarshalLocalImage = (data: unknown) => { +export const unmarshalLocalImage = (data: unknown): LocalImage => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'LocalImage' failed as data isn't a dictionary.`, @@ -67,7 +67,7 @@ export const unmarshalLocalImage = (data: unknown) => { } as LocalImage } -export const unmarshalVersion = (data: unknown) => { +export const unmarshalVersion = (data: unknown): Version => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Version' failed as data isn't a dictionary.`, @@ -83,7 +83,9 @@ export const unmarshalVersion = (data: unknown) => { } as Version } -export const unmarshalListCategoriesResponse = (data: unknown) => { +export const unmarshalListCategoriesResponse = ( + data: unknown, +): ListCategoriesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListCategoriesResponse' failed as data isn't a dictionary.`, @@ -96,7 +98,9 @@ export const unmarshalListCategoriesResponse = (data: unknown) => { } as ListCategoriesResponse } -export const unmarshalListImagesResponse = (data: unknown) => { +export const unmarshalListImagesResponse = ( + data: unknown, +): ListImagesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`, @@ -109,7 +113,9 @@ export const unmarshalListImagesResponse = (data: unknown) => { } as ListImagesResponse } -export const unmarshalListLocalImagesResponse = (data: unknown) => { +export const unmarshalListLocalImagesResponse = ( + data: unknown, +): ListLocalImagesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListLocalImagesResponse' failed as data isn't a dictionary.`, @@ -122,7 +128,9 @@ export const unmarshalListLocalImagesResponse = (data: unknown) => { } as ListLocalImagesResponse } -export const unmarshalListVersionsResponse = (data: unknown) => { +export const unmarshalListVersionsResponse = ( + data: unknown, +): ListVersionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`, diff --git a/packages/clients/src/api/marketplace/v2/types.gen.ts b/packages/clients/src/api/marketplace/v2/types.gen.ts index 41352e81f..6aa9a7d44 100644 --- a/packages/clients/src/api/marketplace/v2/types.gen.ts +++ b/packages/clients/src/api/marketplace/v2/types.gen.ts @@ -22,7 +22,6 @@ export interface Category { description: string } -/** Image. */ export interface Image { /** UUID of this image. */ id: string @@ -40,39 +39,12 @@ export interface Image { updatedAt?: Date /** Expiration date of this image. */ validUntil?: Date - /** - * Label of this image. Typically an identifier for a distribution (ex. - * "ubuntu_focal"). - */ + /** Typically an identifier for a distribution (ex. "ubuntu_focal"). */ label: string } -export interface ListCategoriesResponse { - categories: Category[] - totalCount: number -} - -export interface ListImagesResponse { - images: Image[] - totalCount: number -} - -export interface ListLocalImagesResponse { - localImages: LocalImage[] - totalCount: number -} - -export interface ListVersionsResponse { - versions: Version[] - totalCount: number -} - -/** Local image. */ export interface LocalImage { - /** - * UUID of this local image. Version you will typically use to define an image - * in an API call. - */ + /** Version you will typically use to define an image in an API call. */ id: string /** List of all commercial types that are compatible with this local image. */ compatibleCommercialTypes: string[] @@ -86,7 +58,6 @@ export interface LocalImage { type: LocalImageType } -/** Version. */ export interface Version { /** UUID of this version. */ id: string @@ -100,6 +71,33 @@ export interface Version { publishedAt?: Date } +export type GetCategoryRequest = { + categoryId: string +} + +export type GetImageRequest = { + /** Display the image name. */ + imageId: string +} + +export type GetLocalImageRequest = { + localImageId: string +} + +export type GetVersionRequest = { + versionId: string +} + +export type ListCategoriesRequest = { + pageSize?: number + page?: number +} + +export interface ListCategoriesResponse { + categories: Category[] + totalCount: number +} + export type ListImagesRequest = { /** * A positive integer lower or equal to 100 to select the number of items to @@ -118,20 +116,9 @@ export type ListImagesRequest = { includeEol: boolean } -export type GetImageRequest = { - /** Display the image name. */ - imageId: string -} - -export type ListVersionsRequest = { - imageId: string - pageSize?: number - page?: number - orderBy?: ListVersionsRequestOrderBy -} - -export type GetVersionRequest = { - versionId: string +export interface ListImagesResponse { + images: Image[] + totalCount: number } export type ListLocalImagesRequest = { @@ -153,19 +140,24 @@ export type ListLocalImagesRequest = { * be set. */ imageLabel?: string + /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone type?: LocalImageType } -export type GetLocalImageRequest = { - localImageId: string +export interface ListLocalImagesResponse { + localImages: LocalImage[] + totalCount: number } -export type ListCategoriesRequest = { +export type ListVersionsRequest = { + imageId: string pageSize?: number page?: number + orderBy?: ListVersionsRequestOrderBy } -export type GetCategoryRequest = { - categoryId: string +export interface ListVersionsResponse { + versions: Version[] + totalCount: number } diff --git a/packages/clients/src/api/mnq/v1alpha1/api.gen.ts b/packages/clients/src/api/mnq/v1alpha1/api.gen.ts index 34d2a7402..052f372cf 100644 --- a/packages/clients/src/api/mnq/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/mnq/v1alpha1/api.gen.ts @@ -42,7 +42,6 @@ const jsonContentHeaders = { * Messaging and Queuing API. * * This API allows you to manage Scaleway Messaging and Queueing brokers. - * Messaging and Queuing API. */ export class API extends ParentAPI { /** Lists the available regions of the API. */ @@ -59,7 +58,7 @@ export class API extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/namespaces`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -224,7 +223,7 @@ export class API extends ParentAPI { )}/credentials`, urlParams: urlParams( ['namespace_id', request.namespaceId], - ['order_by', request.orderBy ?? 'id_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', diff --git a/packages/clients/src/api/mnq/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/mnq/v1alpha1/marshalling.gen.ts index 8b15f9343..b6921e101 100644 --- a/packages/clients/src/api/mnq/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/mnq/v1alpha1/marshalling.gen.ts @@ -23,46 +23,56 @@ import type { UpdateNamespaceRequest, } from './types.gen' -const unmarshalPermissions = (data: unknown) => { +export const unmarshalNamespace = (data: unknown): Namespace => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Permissions' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`, ) } return { - canManage: data.can_manage, - canPublish: data.can_publish, - canReceive: data.can_receive, - } as Permissions + createdAt: unmarshalDate(data.created_at), + endpoint: data.endpoint, + id: data.id, + name: data.name, + projectId: data.project_id, + protocol: data.protocol, + region: data.region, + updatedAt: unmarshalDate(data.updated_at), + } as Namespace } -const unmarshalCredentialSummarySQSSNSCreds = (data: unknown) => { +const unmarshalPermissions = (data: unknown): Permissions => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CredentialSummarySQSSNSCreds' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Permissions' failed as data isn't a dictionary.`, ) } return { - accessKey: data.access_key, - permissions: data.permissions - ? unmarshalPermissions(data.permissions) - : undefined, - } as CredentialSummarySQSSNSCreds + canManage: data.can_manage, + canPublish: data.can_publish, + canReceive: data.can_receive, + } as Permissions } -const unmarshalCredentialNATSCredsFile = (data: unknown) => { +const unmarshalCredentialNATSCredsFile = ( + data: unknown, +): CredentialNATSCredsFile => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'CredentialNATSCredsFile' failed as data isn't a dictionary.`, ) } - return { content: data.content } as CredentialNATSCredsFile + return { + content: data.content, + } as CredentialNATSCredsFile } -const unmarshalCredentialSQSSNSCreds = (data: unknown) => { +const unmarshalCredentialSQSSNSCreds = ( + data: unknown, +): CredentialSQSSNSCreds => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'CredentialSQSSNSCreds' failed as data isn't a dictionary.`, @@ -78,10 +88,10 @@ const unmarshalCredentialSQSSNSCreds = (data: unknown) => { } as CredentialSQSSNSCreds } -const unmarshalCredentialSummary = (data: unknown) => { +export const unmarshalCredential = (data: unknown): Credential => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CredentialSummary' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Credential' failed as data isn't a dictionary.`, ) } @@ -89,36 +99,37 @@ const unmarshalCredentialSummary = (data: unknown) => { id: data.id, name: data.name, namespaceId: data.namespace_id, + natsCredentials: data.nats_credentials + ? unmarshalCredentialNATSCredsFile(data.nats_credentials) + : undefined, protocol: data.protocol, sqsSnsCredentials: data.sqs_sns_credentials - ? unmarshalCredentialSummarySQSSNSCreds(data.sqs_sns_credentials) + ? unmarshalCredentialSQSSNSCreds(data.sqs_sns_credentials) : undefined, - } as CredentialSummary + } as Credential } -export const unmarshalNamespace = (data: unknown) => { +const unmarshalCredentialSummarySQSSNSCreds = ( + data: unknown, +): CredentialSummarySQSSNSCreds => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CredentialSummarySQSSNSCreds' failed as data isn't a dictionary.`, ) } return { - createdAt: unmarshalDate(data.created_at), - endpoint: data.endpoint, - id: data.id, - name: data.name, - projectId: data.project_id, - protocol: data.protocol, - region: data.region, - updatedAt: unmarshalDate(data.updated_at), - } as Namespace + accessKey: data.access_key, + permissions: data.permissions + ? unmarshalPermissions(data.permissions) + : undefined, + } as CredentialSummarySQSSNSCreds } -export const unmarshalCredential = (data: unknown) => { +const unmarshalCredentialSummary = (data: unknown): CredentialSummary => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Credential' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CredentialSummary' failed as data isn't a dictionary.`, ) } @@ -126,17 +137,16 @@ export const unmarshalCredential = (data: unknown) => { id: data.id, name: data.name, namespaceId: data.namespace_id, - natsCredentials: data.nats_credentials - ? unmarshalCredentialNATSCredsFile(data.nats_credentials) - : undefined, protocol: data.protocol, sqsSnsCredentials: data.sqs_sns_credentials - ? unmarshalCredentialSQSSNSCreds(data.sqs_sns_credentials) + ? unmarshalCredentialSummarySQSSNSCreds(data.sqs_sns_credentials) : undefined, - } as Credential + } as CredentialSummary } -export const unmarshalListCredentialsResponse = (data: unknown) => { +export const unmarshalListCredentialsResponse = ( + data: unknown, +): ListCredentialsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListCredentialsResponse' failed as data isn't a dictionary.`, @@ -152,7 +162,9 @@ export const unmarshalListCredentialsResponse = (data: unknown) => { } as ListCredentialsResponse } -export const unmarshalListNamespacesResponse = (data: unknown) => { +export const unmarshalListNamespacesResponse = ( + data: unknown, +): ListNamespacesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`, @@ -180,9 +192,10 @@ export const marshalCreateCredentialRequest = ( ): Record => ({ name: request.name || randomName('mnq'), namespace_id: request.namespaceId, - permissions: request.permissions - ? marshalPermissions(request.permissions, defaults) - : undefined, + permissions: + request.permissions !== undefined + ? marshalPermissions(request.permissions, defaults) + : undefined, }) export const marshalCreateNamespaceRequest = ( @@ -199,9 +212,10 @@ export const marshalUpdateCredentialRequest = ( defaults: DefaultValues, ): Record => ({ name: request.name, - permissions: request.permissions - ? marshalPermissions(request.permissions, defaults) - : undefined, + permissions: + request.permissions !== undefined + ? marshalPermissions(request.permissions, defaults) + : undefined, }) export const marshalUpdateNamespaceRequest = ( diff --git a/packages/clients/src/api/mnq/v1alpha1/types.gen.ts b/packages/clients/src/api/mnq/v1alpha1/types.gen.ts index cea25e0e1..4dcf244e0 100644 --- a/packages/clients/src/api/mnq/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/mnq/v1alpha1/types.gen.ts @@ -22,41 +22,36 @@ export type ListNamespacesRequestOrderBy = export type NamespaceProtocol = 'unknown' | 'nats' | 'sqs_sns' -/** Credential. */ -export interface Credential { - /** ID of the credentials. */ - id: string - /** Name of the credentials. */ - name: string - /** Namespace containing the credentials. */ - namespaceId: string - /** Protocol associated with the credentials. */ - protocol: NamespaceProtocol +export interface Permissions { /** - * Object containing the credentials, if the credentials are for a NATS - * namespace. - * - * One-of ('credentialType'): at most one of 'natsCredentials', - * 'sqsSnsCredentials' could be set. + * Defines whether the credentials bearer can publish messages to the service + * (send messages to SQS queues or publish to SNS topics). */ - natsCredentials?: CredentialNATSCredsFile + canPublish?: boolean /** - * Object containing the credentials and their metadata, if the credentials - * are for an SQS/SNS namespace. - * - * One-of ('credentialType'): at most one of 'natsCredentials', - * 'sqsSnsCredentials' could be set. + * Defines whether the credentials bearer can receive messages from the + * service. */ - sqsSnsCredentials?: CredentialSQSSNSCreds + canReceive?: boolean + /** + * Defines whether the credentials bearer can manage the associated resources + * (SQS queues or SNS topics or subscriptions). + */ + canManage?: boolean +} + +export interface CredentialSummarySQSSNSCreds { + /** Access key ID. */ + accessKey: string + /** Permissions associated with these credentials. */ + permissions?: Permissions } -/** Credential.nats creds file. */ export interface CredentialNATSCredsFile { /** Raw content of the NATS credentials file. */ content: string } -/** Credential.sqssns creds. */ export interface CredentialSQSSNSCreds { /** Access key ID. */ accessKey: string @@ -66,7 +61,6 @@ export interface CredentialSQSSNSCreds { permissions?: Permissions } -/** Credential summary. */ export interface CredentialSummary { /** ID of the credentials. */ id: string @@ -85,31 +79,6 @@ export interface CredentialSummary { sqsSnsCredentials?: CredentialSummarySQSSNSCreds } -/** Credential summary.sqssns creds. */ -export interface CredentialSummarySQSSNSCreds { - /** Access key ID. */ - accessKey: string - /** Permissions associated with these credentials. */ - permissions?: Permissions -} - -/** List credentials response. */ -export interface ListCredentialsResponse { - /** Total count of existing credentials (matching any filters specified). */ - totalCount: number - /** Credentials on this page. */ - credentials: CredentialSummary[] -} - -/** List namespaces response. */ -export interface ListNamespacesResponse { - /** Total count of existing namespaces (matching any filters specified). */ - totalCount: number - /** Namespaces on this page. */ - namespaces: Namespace[] -} - -/** Namespace. */ export interface Namespace { /** Namespace ID. */ id: string @@ -129,41 +98,18 @@ export interface Namespace { updatedAt?: Date } -/** Permissions. */ -export interface Permissions { - /** - * Defines whether the credentials bearer can publish messages to the service - * (send messages to SQS queues or publish to SNS topics). - */ - canPublish?: boolean - /** - * Defines whether the credentials bearer can receive messages from the - * service. - */ - canReceive?: boolean - /** - * Defines whether the credentials bearer can manage the associated resources - * (SQS queues or SNS topics or subscriptions). - */ - canManage?: boolean -} - -export type ListNamespacesRequest = { +export type CreateCredentialRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Include only namespaces in this Organization. */ - organizationId?: string - /** Include only namespaces in this Project. */ - projectId?: string - /** Page number to return. */ - page?: number - /** Maximum number of namespaces to return per page. */ - pageSize?: number - /** Order in which to return results. */ - orderBy?: ListNamespacesRequestOrderBy + /** Namespace containing the credentials. */ + namespaceId: string + /** Name of the credentials. */ + name?: string + /** Permissions associated with these credentials. */ + permissions?: Permissions } export type CreateNamespaceRequest = { @@ -183,26 +129,41 @@ export type CreateNamespaceRequest = { projectId?: string } -export type UpdateNamespaceRequest = { +export interface Credential { + /** ID of the credentials. */ + id: string + /** Name of the credentials. */ + name: string + /** Namespace containing the credentials. */ + namespaceId: string + /** Protocol associated with the credentials. */ + protocol: NamespaceProtocol /** - * Region to target. If none is passed will use default region from the - * config. + * Object containing the credentials, if the credentials are for a NATS + * namespace. + * + * One-of ('credentialType'): at most one of 'natsCredentials', + * 'sqsSnsCredentials' could be set. */ - region?: Region - /** ID of the Namespace to update. */ - namespaceId: string - /** Namespace name. */ - name?: string + natsCredentials?: CredentialNATSCredsFile + /** + * Object containing the credentials and their metadata, if the credentials + * are for an SQS/SNS namespace. + * + * One-of ('credentialType'): at most one of 'natsCredentials', + * 'sqsSnsCredentials' could be set. + */ + sqsSnsCredentials?: CredentialSQSSNSCreds } -export type GetNamespaceRequest = { +export type DeleteCredentialRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the Namespace to get. */ - namespaceId: string + /** ID of the credentials to delete. */ + credentialId: string } export type DeleteNamespaceRequest = { @@ -215,28 +176,24 @@ export type DeleteNamespaceRequest = { namespaceId: string } -export type CreateCredentialRequest = { +export type GetCredentialRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Namespace containing the credentials. */ - namespaceId: string - /** Name of the credentials. */ - name?: string - /** Permissions associated with these credentials. */ - permissions?: Permissions + /** ID of the credentials to get. */ + credentialId: string } -export type DeleteCredentialRequest = { +export type GetNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the credentials to delete. */ - credentialId: string + /** ID of the Namespace to get. */ + namespaceId: string } export type ListCredentialsRequest = { @@ -255,6 +212,38 @@ export type ListCredentialsRequest = { orderBy?: ListCredentialsRequestOrderBy } +export interface ListCredentialsResponse { + /** Total count of existing credentials (matching any filters specified). */ + totalCount: number + /** Credentials on this page. */ + credentials: CredentialSummary[] +} + +export type ListNamespacesRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Include only namespaces in this Organization. */ + organizationId?: string + /** Include only namespaces in this Project. */ + projectId?: string + /** Page number to return. */ + page?: number + /** Maximum number of namespaces to return per page. */ + pageSize?: number + /** Order in which to return results. */ + orderBy?: ListNamespacesRequestOrderBy +} + +export interface ListNamespacesResponse { + /** Total count of existing namespaces (matching any filters specified). */ + totalCount: number + /** Namespaces on this page. */ + namespaces: Namespace[] +} + export type UpdateCredentialRequest = { /** * Region to target. If none is passed will use default region from the @@ -269,12 +258,14 @@ export type UpdateCredentialRequest = { permissions?: Permissions } -export type GetCredentialRequest = { +export type UpdateNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the credentials to get. */ - credentialId: string + /** ID of the Namespace to update. */ + namespaceId: string + /** Namespace name. */ + name?: string } diff --git a/packages/clients/src/api/mnq/v1beta1/api.gen.ts b/packages/clients/src/api/mnq/v1beta1/api.gen.ts index e84ba5b92..7b2f7e6c4 100644 --- a/packages/clients/src/api/mnq/v1beta1/api.gen.ts +++ b/packages/clients/src/api/mnq/v1beta1/api.gen.ts @@ -76,7 +76,6 @@ const jsonContentHeaders = { * Messaging and Queuing NATS API. * * This API allows you to manage Scaleway Messaging and Queueing NATS accounts. - * Messaging and Queuing NATS API. */ export class NatsAPI extends ParentAPI { /** Lists the available regions of the API. */ @@ -186,7 +185,7 @@ export class NatsAPI extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/nats-accounts`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -285,7 +284,7 @@ export class NatsAPI extends ParentAPI { ) protected pageOfListNatsCredentials = ( - request: Readonly, + request: Readonly = {}, ) => this.client.fetch( { @@ -296,7 +295,7 @@ export class NatsAPI extends ParentAPI { )}/nats-credentials`, urlParams: urlParams( ['nats_account_id', request.natsAccountId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -317,7 +316,7 @@ export class NatsAPI extends ParentAPI { * @returns A Promise of ListNatsCredentialsResponse */ listNatsCredentials = ( - request: Readonly, + request: Readonly = {}, ) => enrichForPagination( 'natsCredentials', @@ -330,7 +329,6 @@ export class NatsAPI extends ParentAPI { * Messaging and Queuing SNS API. * * This API allows you to manage Scaleway Messaging and Queueing SNS brokers. - * Messaging and Queuing SNS API. */ export class SnsAPI extends ParentAPI { /** Lists the available regions of the API. */ @@ -522,7 +520,7 @@ export class SnsAPI extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/sns-credentials`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -556,7 +554,6 @@ export class SnsAPI extends ParentAPI { * Messaging and Queuing SQS API. * * This API allows you to manage Scaleway Messaging and Queueing SQS brokers. - * Messaging and Queuing SQS API. */ export class SqsAPI extends ParentAPI { /** Lists the available regions of the API. */ @@ -749,7 +746,7 @@ export class SqsAPI extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/sqs-credentials`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', diff --git a/packages/clients/src/api/mnq/v1beta1/marshalling.gen.ts b/packages/clients/src/api/mnq/v1beta1/marshalling.gen.ts index b05118866..9508a1bde 100644 --- a/packages/clients/src/api/mnq/v1beta1/marshalling.gen.ts +++ b/packages/clients/src/api/mnq/v1beta1/marshalling.gen.ts @@ -34,81 +34,70 @@ import type { SqsPermissions, } from './types.gen' -const unmarshalFile = (data: unknown) => { +export const unmarshalNatsAccount = (data: unknown): NatsAccount => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'File' failed as data isn't a dictionary.`, - ) - } - - return { content: data.content, name: data.name } as File -} - -const unmarshalSnsPermissions = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'SnsPermissions' failed as data isn't a dictionary.`, + `Unmarshalling the type 'NatsAccount' failed as data isn't a dictionary.`, ) } return { - canManage: data.can_manage, - canPublish: data.can_publish, - canReceive: data.can_receive, - } as SnsPermissions + createdAt: unmarshalDate(data.created_at), + endpoint: data.endpoint, + id: data.id, + name: data.name, + projectId: data.project_id, + region: data.region, + updatedAt: unmarshalDate(data.updated_at), + } as NatsAccount } -const unmarshalSqsPermissions = (data: unknown) => { +const unmarshalFile = (data: unknown): File => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'SqsPermissions' failed as data isn't a dictionary.`, + `Unmarshalling the type 'File' failed as data isn't a dictionary.`, ) } return { - canManage: data.can_manage, - canPublish: data.can_publish, - canReceive: data.can_receive, - } as SqsPermissions + content: data.content, + name: data.name, + } as File } -export const unmarshalNatsAccount = (data: unknown) => { +export const unmarshalNatsCredentials = (data: unknown): NatsCredentials => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'NatsAccount' failed as data isn't a dictionary.`, + `Unmarshalling the type 'NatsCredentials' failed as data isn't a dictionary.`, ) } return { + checksum: data.checksum, createdAt: unmarshalDate(data.created_at), - endpoint: data.endpoint, + credentials: data.credentials ? unmarshalFile(data.credentials) : undefined, id: data.id, name: data.name, - projectId: data.project_id, - region: data.region, + natsAccountId: data.nats_account_id, updatedAt: unmarshalDate(data.updated_at), - } as NatsAccount + } as NatsCredentials } -export const unmarshalNatsCredentials = (data: unknown) => { +const unmarshalSnsPermissions = (data: unknown): SnsPermissions => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'NatsCredentials' failed as data isn't a dictionary.`, + `Unmarshalling the type 'SnsPermissions' failed as data isn't a dictionary.`, ) } return { - checksum: data.checksum, - createdAt: unmarshalDate(data.created_at), - credentials: data.credentials ? unmarshalFile(data.credentials) : undefined, - id: data.id, - name: data.name, - natsAccountId: data.nats_account_id, - updatedAt: unmarshalDate(data.updated_at), - } as NatsCredentials + canManage: data.can_manage, + canPublish: data.can_publish, + canReceive: data.can_receive, + } as SnsPermissions } -export const unmarshalSnsCredentials = (data: unknown) => { +export const unmarshalSnsCredentials = (data: unknown): SnsCredentials => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SnsCredentials' failed as data isn't a dictionary.`, @@ -131,7 +120,21 @@ export const unmarshalSnsCredentials = (data: unknown) => { } as SnsCredentials } -export const unmarshalSqsCredentials = (data: unknown) => { +const unmarshalSqsPermissions = (data: unknown): SqsPermissions => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'SqsPermissions' failed as data isn't a dictionary.`, + ) + } + + return { + canManage: data.can_manage, + canPublish: data.can_publish, + canReceive: data.can_receive, + } as SqsPermissions +} + +export const unmarshalSqsCredentials = (data: unknown): SqsCredentials => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SqsCredentials' failed as data isn't a dictionary.`, @@ -154,7 +157,9 @@ export const unmarshalSqsCredentials = (data: unknown) => { } as SqsCredentials } -export const unmarshalListNatsAccountsResponse = (data: unknown) => { +export const unmarshalListNatsAccountsResponse = ( + data: unknown, +): ListNatsAccountsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNatsAccountsResponse' failed as data isn't a dictionary.`, @@ -170,7 +175,9 @@ export const unmarshalListNatsAccountsResponse = (data: unknown) => { } as ListNatsAccountsResponse } -export const unmarshalListNatsCredentialsResponse = (data: unknown) => { +export const unmarshalListNatsCredentialsResponse = ( + data: unknown, +): ListNatsCredentialsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNatsCredentialsResponse' failed as data isn't a dictionary.`, @@ -186,7 +193,9 @@ export const unmarshalListNatsCredentialsResponse = (data: unknown) => { } as ListNatsCredentialsResponse } -export const unmarshalListSnsCredentialsResponse = (data: unknown) => { +export const unmarshalListSnsCredentialsResponse = ( + data: unknown, +): ListSnsCredentialsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSnsCredentialsResponse' failed as data isn't a dictionary.`, @@ -202,7 +211,9 @@ export const unmarshalListSnsCredentialsResponse = (data: unknown) => { } as ListSnsCredentialsResponse } -export const unmarshalListSqsCredentialsResponse = (data: unknown) => { +export const unmarshalListSqsCredentialsResponse = ( + data: unknown, +): ListSqsCredentialsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSqsCredentialsResponse' failed as data isn't a dictionary.`, @@ -218,7 +229,7 @@ export const unmarshalListSqsCredentialsResponse = (data: unknown) => { } as ListSqsCredentialsResponse } -export const unmarshalSnsInfo = (data: unknown) => { +export const unmarshalSnsInfo = (data: unknown): SnsInfo => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SnsInfo' failed as data isn't a dictionary.`, @@ -235,7 +246,7 @@ export const unmarshalSnsInfo = (data: unknown) => { } as SnsInfo } -export const unmarshalSqsInfo = (data: unknown) => { +export const unmarshalSqsInfo = (data: unknown): SqsInfo => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SqsInfo' failed as data isn't a dictionary.`, @@ -252,24 +263,6 @@ export const unmarshalSqsInfo = (data: unknown) => { } as SqsInfo } -const marshalSnsPermissions = ( - request: SnsPermissions, - defaults: DefaultValues, -): Record => ({ - can_manage: request.canManage, - can_publish: request.canPublish, - can_receive: request.canReceive, -}) - -const marshalSqsPermissions = ( - request: SqsPermissions, - defaults: DefaultValues, -): Record => ({ - can_manage: request.canManage, - can_publish: request.canPublish, - can_receive: request.canReceive, -}) - export const marshalNatsApiCreateNatsAccountRequest = ( request: NatsApiCreateNatsAccountRequest, defaults: DefaultValues, @@ -300,14 +293,24 @@ export const marshalSnsApiActivateSnsRequest = ( project_id: request.projectId ?? defaults.defaultProjectId, }) +const marshalSnsPermissions = ( + request: SnsPermissions, + defaults: DefaultValues, +): Record => ({ + can_manage: request.canManage, + can_publish: request.canPublish, + can_receive: request.canReceive, +}) + export const marshalSnsApiCreateSnsCredentialsRequest = ( request: SnsApiCreateSnsCredentialsRequest, defaults: DefaultValues, ): Record => ({ name: request.name || randomName('mnq_sns'), - permissions: request.permissions - ? marshalSnsPermissions(request.permissions, defaults) - : undefined, + permissions: + request.permissions !== undefined + ? marshalSnsPermissions(request.permissions, defaults) + : undefined, project_id: request.projectId ?? defaults.defaultProjectId, }) @@ -323,9 +326,10 @@ export const marshalSnsApiUpdateSnsCredentialsRequest = ( defaults: DefaultValues, ): Record => ({ name: request.name, - permissions: request.permissions - ? marshalSnsPermissions(request.permissions, defaults) - : undefined, + permissions: + request.permissions !== undefined + ? marshalSnsPermissions(request.permissions, defaults) + : undefined, }) export const marshalSqsApiActivateSqsRequest = ( @@ -335,14 +339,24 @@ export const marshalSqsApiActivateSqsRequest = ( project_id: request.projectId ?? defaults.defaultProjectId, }) +const marshalSqsPermissions = ( + request: SqsPermissions, + defaults: DefaultValues, +): Record => ({ + can_manage: request.canManage, + can_publish: request.canPublish, + can_receive: request.canReceive, +}) + export const marshalSqsApiCreateSqsCredentialsRequest = ( request: SqsApiCreateSqsCredentialsRequest, defaults: DefaultValues, ): Record => ({ name: request.name || randomName('mnq_sqs'), - permissions: request.permissions - ? marshalSqsPermissions(request.permissions, defaults) - : undefined, + permissions: + request.permissions !== undefined + ? marshalSqsPermissions(request.permissions, defaults) + : undefined, project_id: request.projectId ?? defaults.defaultProjectId, }) @@ -358,7 +372,8 @@ export const marshalSqsApiUpdateSqsCredentialsRequest = ( defaults: DefaultValues, ): Record => ({ name: request.name, - permissions: request.permissions - ? marshalSqsPermissions(request.permissions, defaults) - : undefined, + permissions: + request.permissions !== undefined + ? marshalSqsPermissions(request.permissions, defaults) + : undefined, }) diff --git a/packages/clients/src/api/mnq/v1beta1/types.gen.ts b/packages/clients/src/api/mnq/v1beta1/types.gen.ts index e65584175..ba6dea5c6 100644 --- a/packages/clients/src/api/mnq/v1beta1/types.gen.ts +++ b/packages/clients/src/api/mnq/v1beta1/types.gen.ts @@ -38,7 +38,6 @@ export type SnsInfoStatus = 'unknown_status' | 'enabled' | 'disabled' export type SqsInfoStatus = 'unknown_status' | 'enabled' | 'disabled' -/** File. */ export interface File { /** File name. */ name: string @@ -46,39 +45,42 @@ export interface File { content: string } -/** List nats accounts response. */ -export interface ListNatsAccountsResponse { - /** Total count of existing NATS accounts (matching any filters specified). */ - totalCount: number - /** NATS accounts on this page. */ - natsAccounts: NatsAccount[] -} - -/** List nats credentials response. */ -export interface ListNatsCredentialsResponse { - /** Total count of existing credentials (matching any filters specified). */ - totalCount: number - /** Credentials on this page. */ - natsCredentials: NatsCredentials[] -} - -/** List sns credentials response. */ -export interface ListSnsCredentialsResponse { - /** Total count of existing credentials (matching any filters specified). */ - totalCount: number - /** SNS credentials on this page. */ - snsCredentials: SnsCredentials[] +export interface SnsPermissions { + /** + * Defines whether the credentials bearer can publish messages to the service + * (publish to SNS topics). + */ + canPublish?: boolean + /** + * Defines whether the credentials bearer can receive messages from the + * service (configure subscriptions). + */ + canReceive?: boolean + /** + * Defines whether the credentials bearer can manage the associated SNS topics + * or subscriptions. + */ + canManage?: boolean } -/** List sqs credentials response. */ -export interface ListSqsCredentialsResponse { - /** Total count of existing credentials (matching any filters specified). */ - totalCount: number - /** SQS credentials on this page. */ - sqsCredentials: SqsCredentials[] +export interface SqsPermissions { + /** + * Defines whether the credentials bearer can publish messages to the service + * (send messages to SQS queues). + */ + canPublish?: boolean + /** + * Defines whether the credentials bearer can receive messages from SQS + * queues. + */ + canReceive?: boolean + /** + * Defines whether the credentials bearer can manage the associated SQS + * queues. + */ + canManage?: boolean } -/** Nats account. */ export interface NatsAccount { /** NATS account ID. */ id: string @@ -96,7 +98,6 @@ export interface NatsAccount { updatedAt?: Date } -/** Nats credentials. */ export interface NatsCredentials { /** ID of the credentials. */ id: string @@ -117,7 +118,6 @@ export interface NatsCredentials { checksum: string } -/** Sns credentials. */ export interface SnsCredentials { /** ID of the credentials. */ id: string @@ -141,42 +141,6 @@ export interface SnsCredentials { permissions?: SnsPermissions } -/** Sns info. */ -export interface SnsInfo { - /** Project ID of the Project containing the service. */ - projectId: string - /** Region of the service. */ - region: Region - /** SNS creation date. */ - createdAt?: Date - /** SNS last modification date. */ - updatedAt?: Date - /** SNS activation status. */ - status: SnsInfoStatus - /** Endpoint of the SNS service for this region and project. */ - snsEndpointUrl: string -} - -/** Sns permissions. */ -export interface SnsPermissions { - /** - * Defines whether the credentials bearer can publish messages to the service - * (publish to SNS topics). - */ - canPublish?: boolean - /** - * Defines whether the credentials bearer can receive messages from the - * service (configure subscriptions). - */ - canReceive?: boolean - /** - * Defines whether the credentials bearer can manage the associated SNS topics - * or subscriptions. - */ - canManage?: boolean -} - -/** Sqs credentials. */ export interface SqsCredentials { /** ID of the credentials. */ id: string @@ -200,39 +164,32 @@ export interface SqsCredentials { permissions?: SqsPermissions } -/** Sqs info. */ -export interface SqsInfo { - /** Project ID of the Project containing the service. */ - projectId: string - /** Region of the service. */ - region: Region - /** SQS creation date. */ - createdAt?: Date - /** SQS last modification date. */ - updatedAt?: Date - /** SQS activation status. */ - status: SqsInfoStatus - /** Endpoint of the SQS service for this region and project. */ - sqsEndpointUrl: string +export interface ListNatsAccountsResponse { + /** Total count of existing NATS accounts (matching any filters specified). */ + totalCount: number + /** NATS accounts on this page. */ + natsAccounts: NatsAccount[] } -/** Sqs permissions. */ -export interface SqsPermissions { - /** - * Defines whether the credentials bearer can publish messages to the service - * (send messages to SQS queues). - */ - canPublish?: boolean - /** - * Defines whether the credentials bearer can receive messages from SQS - * queues. - */ - canReceive?: boolean - /** - * Defines whether the credentials bearer can manage the associated SQS - * queues. - */ - canManage?: boolean +export interface ListNatsCredentialsResponse { + /** Total count of existing credentials (matching any filters specified). */ + totalCount: number + /** Credentials on this page. */ + natsCredentials: NatsCredentials[] +} + +export interface ListSnsCredentialsResponse { + /** Total count of existing credentials (matching any filters specified). */ + totalCount: number + /** SNS credentials on this page. */ + snsCredentials: SnsCredentials[] +} + +export interface ListSqsCredentialsResponse { + /** Total count of existing credentials (matching any filters specified). */ + totalCount: number + /** SQS credentials on this page. */ + sqsCredentials: SqsCredentials[] } export type NatsApiCreateNatsAccountRequest = { @@ -247,84 +204,72 @@ export type NatsApiCreateNatsAccountRequest = { projectId?: string } -export type NatsApiDeleteNatsAccountRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** ID of the NATS account to delete. */ - natsAccountId: string -} - -export type NatsApiUpdateNatsAccountRequest = { +export type NatsApiCreateNatsCredentialsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the NATS account to update. */ + /** NATS account containing the credentials. */ natsAccountId: string - /** NATS account name. */ + /** Name of the credentials. */ name?: string } -export type NatsApiGetNatsAccountRequest = { +export type NatsApiDeleteNatsAccountRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the NATS account to get. */ + /** ID of the NATS account to delete. */ natsAccountId: string } -export type NatsApiListNatsAccountsRequest = { +export type NatsApiDeleteNatsCredentialsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Include only NATS accounts in this Project. */ - projectId?: string - /** Page number to return. */ - page?: number - /** Maximum number of NATS accounts to return per page. */ - pageSize?: number - /** Order in which to return results. */ - orderBy?: ListNatsAccountsRequestOrderBy + /** ID of the credentials to delete. */ + natsCredentialsId: string } -export type NatsApiCreateNatsCredentialsRequest = { +export type NatsApiGetNatsAccountRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** NATS account containing the credentials. */ + /** ID of the NATS account to get. */ natsAccountId: string - /** Name of the credentials. */ - name?: string } -export type NatsApiDeleteNatsCredentialsRequest = { +export type NatsApiGetNatsCredentialsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the credentials to delete. */ + /** ID of the credentials to get. */ natsCredentialsId: string } -export type NatsApiGetNatsCredentialsRequest = { +export type NatsApiListNatsAccountsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the credentials to get. */ - natsCredentialsId: string + /** Include only NATS accounts in this Project. */ + projectId?: string + /** Page number to return. */ + page?: number + /** Maximum number of NATS accounts to return per page. */ + pageSize?: number + /** Order in which to return results. */ + orderBy?: ListNatsAccountsRequestOrderBy } export type NatsApiListNatsCredentialsRequest = { @@ -334,7 +279,7 @@ export type NatsApiListNatsCredentialsRequest = { */ region?: Region /** Include only credentials for this NATS account. */ - natsAccountId: string + natsAccountId?: string /** Page number to return. */ page?: number /** Maximum number of credentials to return per page. */ @@ -343,48 +288,50 @@ export type NatsApiListNatsCredentialsRequest = { orderBy?: ListNatsCredentialsRequestOrderBy } -export type SnsApiActivateSnsRequest = { +export type NatsApiUpdateNatsAccountRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Project on which to activate the SNS service. */ - projectId?: string + /** ID of the NATS account to update. */ + natsAccountId: string + /** NATS account name. */ + name?: string } -export type SnsApiGetSnsInfoRequest = { +export type SnsApiActivateSnsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Project to retrieve SNS info from. */ + /** Project on which to activate the SNS service. */ projectId?: string } -export type SnsApiDeactivateSnsRequest = { +export type SnsApiCreateSnsCredentialsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Project on which to deactivate the SNS service. */ + /** Project containing the SNS credentials. */ projectId?: string + /** Name of the credentials. */ + name?: string + /** Permissions associated with these credentials. */ + permissions?: SnsPermissions } -export type SnsApiCreateSnsCredentialsRequest = { +export type SnsApiDeactivateSnsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Project containing the SNS credentials. */ + /** Project on which to deactivate the SNS service. */ projectId?: string - /** Name of the credentials. */ - name?: string - /** Permissions associated with these credentials. */ - permissions?: SnsPermissions } export type SnsApiDeleteSnsCredentialsRequest = { @@ -397,28 +344,24 @@ export type SnsApiDeleteSnsCredentialsRequest = { snsCredentialsId: string } -export type SnsApiUpdateSnsCredentialsRequest = { +export type SnsApiGetSnsCredentialsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the SNS credentials to update. */ + /** ID of the SNS credentials to get. */ snsCredentialsId: string - /** Name of the credentials. */ - name?: string - /** Permissions associated with these credentials. */ - permissions?: SnsPermissions } -export type SnsApiGetSnsCredentialsRequest = { +export type SnsApiGetSnsInfoRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the SNS credentials to get. */ - snsCredentialsId: string + /** Project to retrieve SNS info from. */ + projectId?: string } export type SnsApiListSnsCredentialsRequest = { @@ -437,33 +380,42 @@ export type SnsApiListSnsCredentialsRequest = { orderBy?: ListSnsCredentialsRequestOrderBy } -export type SqsApiActivateSqsRequest = { +export type SnsApiUpdateSnsCredentialsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Project on which to activate the SQS service. */ - projectId?: string + /** ID of the SNS credentials to update. */ + snsCredentialsId: string + /** Name of the credentials. */ + name?: string + /** Permissions associated with these credentials. */ + permissions?: SnsPermissions } -export type SqsApiGetSqsInfoRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Project to retrieve SQS info from. */ - projectId?: string +export interface SnsInfo { + /** Project ID of the Project containing the service. */ + projectId: string + /** Region of the service. */ + region: Region + /** SNS creation date. */ + createdAt?: Date + /** SNS last modification date. */ + updatedAt?: Date + /** SNS activation status. */ + status: SnsInfoStatus + /** Endpoint of the SNS service for this region and project. */ + snsEndpointUrl: string } -export type SqsApiDeactivateSqsRequest = { +export type SqsApiActivateSqsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Project on which to deactivate the SQS service. */ + /** Project on which to activate the SQS service. */ projectId?: string } @@ -481,28 +433,24 @@ export type SqsApiCreateSqsCredentialsRequest = { permissions?: SqsPermissions } -export type SqsApiDeleteSqsCredentialsRequest = { +export type SqsApiDeactivateSqsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the credentials to delete. */ - sqsCredentialsId: string + /** Project on which to deactivate the SQS service. */ + projectId?: string } -export type SqsApiUpdateSqsCredentialsRequest = { +export type SqsApiDeleteSqsCredentialsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the SQS credentials to update. */ + /** ID of the credentials to delete. */ sqsCredentialsId: string - /** Name of the credentials. */ - name?: string - /** Permissions associated with these credentials. */ - permissions?: SqsPermissions } export type SqsApiGetSqsCredentialsRequest = { @@ -515,6 +463,16 @@ export type SqsApiGetSqsCredentialsRequest = { sqsCredentialsId: string } +export type SqsApiGetSqsInfoRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Project to retrieve SQS info from. */ + projectId?: string +} + export type SqsApiListSqsCredentialsRequest = { /** * Region to target. If none is passed will use default region from the @@ -530,3 +488,32 @@ export type SqsApiListSqsCredentialsRequest = { /** Order in which to return results. */ orderBy?: ListSqsCredentialsRequestOrderBy } + +export type SqsApiUpdateSqsCredentialsRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** ID of the SQS credentials to update. */ + sqsCredentialsId: string + /** Name of the credentials. */ + name?: string + /** Permissions associated with these credentials. */ + permissions?: SqsPermissions +} + +export interface SqsInfo { + /** Project ID of the Project containing the service. */ + projectId: string + /** Region of the service. */ + region: Region + /** SQS creation date. */ + createdAt?: Date + /** SQS last modification date. */ + updatedAt?: Date + /** SQS activation status. */ + status: SqsInfoStatus + /** Endpoint of the SQS service for this region and project. */ + sqsEndpointUrl: string +} diff --git a/packages/clients/src/api/mnq/v1beta1/validation-rules.gen.ts b/packages/clients/src/api/mnq/v1beta1/validation-rules.gen.ts index e8ade3256..c38896eac 100644 --- a/packages/clients/src/api/mnq/v1beta1/validation-rules.gen.ts +++ b/packages/clients/src/api/mnq/v1beta1/validation-rules.gen.ts @@ -1,6 +1,13 @@ // This file was automatically generated. DO NOT EDIT. // If you have any remark or suggestion do not hesitate to open an issue. +export const NatsAccount = { + name: { + maxLength: 64, + minLength: 1, + }, +} + export const NatsApiCreateNatsAccountRequest = { name: { maxLength: 64, @@ -22,6 +29,13 @@ export const NatsApiUpdateNatsAccountRequest = { }, } +export const NatsCredentials = { + name: { + maxLength: 500, + minLength: 1, + }, +} + export const SnsApiCreateSnsCredentialsRequest = { name: { maxLength: 500, @@ -36,6 +50,16 @@ export const SnsApiUpdateSnsCredentialsRequest = { }, } +export const SnsCredentials = { + accessKey: { + minLength: 1, + }, + name: { + maxLength: 500, + minLength: 1, + }, +} + export const SqsApiCreateSqsCredentialsRequest = { name: { maxLength: 500, @@ -49,3 +73,13 @@ export const SqsApiUpdateSqsCredentialsRequest = { minLength: 1, }, } + +export const SqsCredentials = { + accessKey: { + minLength: 1, + }, + name: { + maxLength: 500, + minLength: 1, + }, +} diff --git a/packages/clients/src/api/rdb/v1/api.gen.ts b/packages/clients/src/api/rdb/v1/api.gen.ts index 33a13102a..55c1fb7ec 100644 --- a/packages/clients/src/api/rdb/v1/api.gen.ts +++ b/packages/clients/src/api/rdb/v1/api.gen.ts @@ -245,7 +245,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['instance_id', request.instanceId], ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -483,7 +483,7 @@ export class API extends ParentAPI { )}/instances`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -976,7 +976,7 @@ export class API extends ParentAPI { 'instanceId', request.instanceId, )}/logs`, - urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc']), + urlParams: urlParams(['order_by', request.orderBy]), }, unmarshalListInstanceLogsResponse, ) @@ -1280,7 +1280,7 @@ export class API extends ParentAPI { )}/users`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -1390,7 +1390,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['managed', request.managed], ['name', request.name], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['owner', request.owner], ['page', request.page], [ @@ -1473,7 +1473,7 @@ export class API extends ParentAPI { )}/privileges`, urlParams: urlParams( ['database_name', request.databaseName], - ['order_by', request.orderBy ?? 'user_name_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -1538,7 +1538,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['instance_id', request.instanceId], ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/redis/v1/api.gen.ts b/packages/clients/src/api/redis/v1/api.gen.ts index bcad5c7ae..58987b28d 100644 --- a/packages/clients/src/api/redis/v1/api.gen.ts +++ b/packages/clients/src/api/redis/v1/api.gen.ts @@ -190,7 +190,7 @@ export class API extends ParentAPI { )}/clusters`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/redis/v1/marshalling.gen.ts b/packages/clients/src/api/redis/v1/marshalling.gen.ts index 45829c185..2ae5bab41 100644 --- a/packages/clients/src/api/redis/v1/marshalling.gen.ts +++ b/packages/clients/src/api/redis/v1/marshalling.gen.ts @@ -45,32 +45,7 @@ import type { UpdateEndpointRequest, } from './types.gen' -const unmarshalPrivateNetwork = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`, - ) - } - - return { - id: data.id, - provisioningMode: data.provisioning_mode, - serviceIps: data.service_ips, - zone: data.zone, - } as PrivateNetwork -} - -const unmarshalPublicNetwork = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'PublicNetwork' failed as data isn't a dictionary.`, - ) - } - - return {} as PublicNetwork -} - -export const unmarshalACLRule = (data: unknown) => { +export const unmarshalACLRule = (data: unknown): ACLRule => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`, @@ -84,36 +59,32 @@ export const unmarshalACLRule = (data: unknown) => { } as ACLRule } -const unmarshalAvailableClusterSetting = (data: unknown) => { +const unmarshalPrivateNetwork = (data: unknown): PrivateNetwork => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'AvailableClusterSetting' failed as data isn't a dictionary.`, + `Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`, ) } return { - defaultValue: data.default_value, - deprecated: data.deprecated, - description: data.description, - maxValue: data.max_value, - minValue: data.min_value, - name: data.name, - regex: data.regex, - type: data.type, - } as AvailableClusterSetting + id: data.id, + provisioningMode: data.provisioning_mode, + serviceIps: data.service_ips, + zone: data.zone, + } as PrivateNetwork } -const unmarshalClusterSetting = (data: unknown) => { +const unmarshalPublicNetwork = (data: unknown): PublicNetwork => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ClusterSetting' failed as data isn't a dictionary.`, + `Unmarshalling the type 'PublicNetwork' failed as data isn't a dictionary.`, ) } - return { name: data.name, value: data.value } as ClusterSetting + return {} as PublicNetwork } -export const unmarshalEndpoint = (data: unknown) => { +export const unmarshalEndpoint = (data: unknown): Endpoint => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`, @@ -133,7 +104,20 @@ export const unmarshalEndpoint = (data: unknown) => { } as Endpoint } -export const unmarshalCluster = (data: unknown) => { +const unmarshalClusterSetting = (data: unknown): ClusterSetting => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ClusterSetting' failed as data isn't a dictionary.`, + ) + } + + return { + name: data.name, + value: data.value, + } as ClusterSetting +} + +export const unmarshalCluster = (data: unknown): Cluster => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Cluster' failed as data isn't a dictionary.`, @@ -164,95 +148,107 @@ export const unmarshalCluster = (data: unknown) => { } as Cluster } -const unmarshalClusterVersion = (data: unknown) => { +export const unmarshalAddAclRulesResponse = ( + data: unknown, +): AddAclRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ClusterVersion' failed as data isn't a dictionary.`, + `Unmarshalling the type 'AddAclRulesResponse' failed as data isn't a dictionary.`, ) } return { - availableSettings: unmarshalArrayOfObject( - data.available_settings, - unmarshalAvailableClusterSetting, - ), - endOfLifeAt: unmarshalDate(data.end_of_life_at), - logoUrl: data.logo_url, - version: data.version, - zone: data.zone, - } as ClusterVersion + aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule), + totalCount: data.total_count, + } as AddAclRulesResponse } -const unmarshalNodeType = (data: unknown) => { +export const unmarshalAddEndpointsResponse = ( + data: unknown, +): AddEndpointsResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`, + `Unmarshalling the type 'AddEndpointsResponse' failed as data isn't a dictionary.`, ) } return { - beta: data.beta, - description: data.description, - disabled: data.disabled, - memory: data.memory, - name: data.name, - stockStatus: data.stock_status, - vcpus: data.vcpus, - zone: data.zone, - } as NodeType + endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint), + totalCount: data.total_count, + } as AddEndpointsResponse } -export const unmarshalAddAclRulesResponse = (data: unknown) => { +export const unmarshalClusterMetricsResponse = ( + data: unknown, +): ClusterMetricsResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'AddAclRulesResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ClusterMetricsResponse' failed as data isn't a dictionary.`, ) } return { - aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule), - totalCount: data.total_count, - } as AddAclRulesResponse + timeseries: unmarshalArrayOfObject(data.timeseries, unmarshalTimeSeries), + } as ClusterMetricsResponse } -export const unmarshalAddEndpointsResponse = (data: unknown) => { +export const unmarshalClusterSettingsResponse = ( + data: unknown, +): ClusterSettingsResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'AddEndpointsResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ClusterSettingsResponse' failed as data isn't a dictionary.`, ) } return { - endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint), - totalCount: data.total_count, - } as AddEndpointsResponse + settings: unmarshalArrayOfObject(data.settings, unmarshalClusterSetting), + } as ClusterSettingsResponse } -export const unmarshalClusterMetricsResponse = (data: unknown) => { +const unmarshalAvailableClusterSetting = ( + data: unknown, +): AvailableClusterSetting => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ClusterMetricsResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'AvailableClusterSetting' failed as data isn't a dictionary.`, ) } return { - timeseries: unmarshalArrayOfObject(data.timeseries, unmarshalTimeSeries), - } as ClusterMetricsResponse + defaultValue: data.default_value, + deprecated: data.deprecated, + description: data.description, + maxValue: data.max_value, + minValue: data.min_value, + name: data.name, + regex: data.regex, + type: data.type, + } as AvailableClusterSetting } -export const unmarshalClusterSettingsResponse = (data: unknown) => { +const unmarshalClusterVersion = (data: unknown): ClusterVersion => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ClusterSettingsResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ClusterVersion' failed as data isn't a dictionary.`, ) } return { - settings: unmarshalArrayOfObject(data.settings, unmarshalClusterSetting), - } as ClusterSettingsResponse + availableSettings: unmarshalArrayOfObject( + data.available_settings, + unmarshalAvailableClusterSetting, + ), + endOfLifeAt: unmarshalDate(data.end_of_life_at), + logoUrl: data.logo_url, + version: data.version, + zone: data.zone, + } as ClusterVersion } -export const unmarshalListClusterVersionsResponse = (data: unknown) => { +export const unmarshalListClusterVersionsResponse = ( + data: unknown, +): ListClusterVersionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListClusterVersionsResponse' failed as data isn't a dictionary.`, @@ -265,7 +261,9 @@ export const unmarshalListClusterVersionsResponse = (data: unknown) => { } as ListClusterVersionsResponse } -export const unmarshalListClustersResponse = (data: unknown) => { +export const unmarshalListClustersResponse = ( + data: unknown, +): ListClustersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListClustersResponse' failed as data isn't a dictionary.`, @@ -278,7 +276,28 @@ export const unmarshalListClustersResponse = (data: unknown) => { } as ListClustersResponse } -export const unmarshalListNodeTypesResponse = (data: unknown) => { +const unmarshalNodeType = (data: unknown): NodeType => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`, + ) + } + + return { + beta: data.beta, + description: data.description, + disabled: data.disabled, + memory: data.memory, + name: data.name, + stockStatus: data.stock_status, + vcpus: data.vcpus, + zone: data.zone, + } as NodeType +} + +export const unmarshalListNodeTypesResponse = ( + data: unknown, +): ListNodeTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`, @@ -291,7 +310,9 @@ export const unmarshalListNodeTypesResponse = (data: unknown) => { } as ListNodeTypesResponse } -export const unmarshalSetAclRulesResponse = (data: unknown) => { +export const unmarshalSetAclRulesResponse = ( + data: unknown, +): SetAclRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetAclRulesResponse' failed as data isn't a dictionary.`, @@ -303,7 +324,9 @@ export const unmarshalSetAclRulesResponse = (data: unknown) => { } as SetAclRulesResponse } -export const unmarshalSetEndpointsResponse = (data: unknown) => { +export const unmarshalSetEndpointsResponse = ( + data: unknown, +): SetEndpointsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetEndpointsResponse' failed as data isn't a dictionary.`, @@ -315,6 +338,36 @@ export const unmarshalSetEndpointsResponse = (data: unknown) => { } as SetEndpointsResponse } +const marshalACLRuleSpec = ( + request: ACLRuleSpec, + defaults: DefaultValues, +): Record => ({ + description: request.description, + ip_cidr: request.ipCidr, +}) + +export const marshalAddAclRulesRequest = ( + request: AddAclRulesRequest, + defaults: DefaultValues, +): Record => ({ + acl_rules: request.aclRules.map(elt => marshalACLRuleSpec(elt, defaults)), +}) + +const marshalClusterSetting = ( + request: ClusterSetting, + defaults: DefaultValues, +): Record => ({ + name: request.name, + value: request.value, +}) + +export const marshalAddClusterSettingsRequest = ( + request: AddClusterSettingsRequest, + defaults: DefaultValues, +): Record => ({ + settings: request.settings.map(elt => marshalClusterSetting(elt, defaults)), +}) + const marshalEndpointSpecPrivateNetworkSpecIpamConfig = ( request: EndpointSpecPrivateNetworkSpecIpamConfig, defaults: DefaultValues, @@ -325,12 +378,13 @@ const marshalEndpointSpecPrivateNetworkSpec = ( defaults: DefaultValues, ): Record => ({ id: request.id, - ipam_config: request.ipamConfig - ? marshalEndpointSpecPrivateNetworkSpecIpamConfig( - request.ipamConfig, - defaults, - ) - : undefined, + ipam_config: + request.ipamConfig !== undefined + ? marshalEndpointSpecPrivateNetworkSpecIpamConfig( + request.ipamConfig, + defaults, + ) + : undefined, service_ips: request.serviceIps, }) @@ -339,59 +393,34 @@ const marshalEndpointSpecPublicNetworkSpec = ( defaults: DefaultValues, ): Record => ({}) -const marshalACLRuleSpec = ( - request: ACLRuleSpec, - defaults: DefaultValues, -): Record => ({ - description: request.description, - ip_cidr: request.ipCidr, -}) - -const marshalClusterSetting = ( - request: ClusterSetting, - defaults: DefaultValues, -): Record => ({ - name: request.name, - value: request.value, -}) - const marshalEndpointSpec = ( request: EndpointSpec, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ + ...resolveOneOf([ { param: 'private_network', - value: request.privateNetwork - ? marshalEndpointSpecPrivateNetworkSpec( - request.privateNetwork, - defaults, - ) - : undefined, + value: + request.privateNetwork !== undefined + ? marshalEndpointSpecPrivateNetworkSpec( + request.privateNetwork, + defaults, + ) + : undefined, }, { param: 'public_network', - value: request.publicNetwork - ? marshalEndpointSpecPublicNetworkSpec(request.publicNetwork, defaults) - : undefined, + value: + request.publicNetwork !== undefined + ? marshalEndpointSpecPublicNetworkSpec( + request.publicNetwork, + defaults, + ) + : undefined, }, ]), }) -export const marshalAddAclRulesRequest = ( - request: AddAclRulesRequest, - defaults: DefaultValues, -): Record => ({ - acl_rules: request.aclRules.map(elt => marshalACLRuleSpec(elt, defaults)), -}) - -export const marshalAddClusterSettingsRequest = ( - request: AddClusterSettingsRequest, - defaults: DefaultValues, -): Record => ({ - settings: request.settings.map(elt => marshalClusterSetting(elt, defaults)), -}) - export const marshalAddEndpointsRequest = ( request: AddEndpointsRequest, defaults: DefaultValues, @@ -403,16 +432,19 @@ export const marshalCreateClusterRequest = ( request: CreateClusterRequest, defaults: DefaultValues, ): Record => ({ - acl_rules: request.aclRules - ? request.aclRules.map(elt => marshalACLRuleSpec(elt, defaults)) - : undefined, - cluster_settings: request.clusterSettings - ? request.clusterSettings.map(elt => marshalClusterSetting(elt, defaults)) - : undefined, + acl_rules: + request.aclRules !== undefined + ? request.aclRules.map(elt => marshalACLRuleSpec(elt, defaults)) + : undefined, + cluster_settings: + request.clusterSettings !== undefined + ? request.clusterSettings.map(elt => marshalClusterSetting(elt, defaults)) + : undefined, cluster_size: request.clusterSize, - endpoints: request.endpoints - ? request.endpoints.map(elt => marshalEndpointSpec(elt, defaults)) - : undefined, + endpoints: + request.endpoints !== undefined + ? request.endpoints.map(elt => marshalEndpointSpec(elt, defaults)) + : undefined, name: request.name || randomName('ins'), node_type: request.nodeType, password: request.password, @@ -427,19 +459,10 @@ export const marshalMigrateClusterRequest = ( request: MigrateClusterRequest, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ - { - param: 'version', - value: request.version, - }, - { - param: 'node_type', - value: request.nodeType, - }, - { - param: 'cluster_size', - value: request.clusterSize, - }, + ...resolveOneOf([ + { param: 'version', value: request.version }, + { param: 'node_type', value: request.nodeType }, + { param: 'cluster_size', value: request.clusterSize }, ]), }) @@ -478,21 +501,26 @@ export const marshalUpdateEndpointRequest = ( request: UpdateEndpointRequest, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ + ...resolveOneOf([ { param: 'private_network', - value: request.privateNetwork - ? marshalEndpointSpecPrivateNetworkSpec( - request.privateNetwork, - defaults, - ) - : undefined, + value: + request.privateNetwork !== undefined + ? marshalEndpointSpecPrivateNetworkSpec( + request.privateNetwork, + defaults, + ) + : undefined, }, { param: 'public_network', - value: request.publicNetwork - ? marshalEndpointSpecPublicNetworkSpec(request.publicNetwork, defaults) - : undefined, + value: + request.publicNetwork !== undefined + ? marshalEndpointSpecPublicNetworkSpec( + request.publicNetwork, + defaults, + ) + : undefined, }, ]), }) diff --git a/packages/clients/src/api/redis/v1/types.gen.ts b/packages/clients/src/api/redis/v1/types.gen.ts index 4121a2c24..040cfb10f 100644 --- a/packages/clients/src/api/redis/v1/types.gen.ts +++ b/packages/clients/src/api/redis/v1/types.gen.ts @@ -34,41 +34,38 @@ export type NodeTypeStock = export type PrivateNetworkProvisioningMode = 'static' | 'ipam' -/** Acl rule. */ -export interface ACLRule { - /** ID of the rule. */ +export interface EndpointSpecPrivateNetworkSpecIpamConfig {} + +export interface PrivateNetwork { + /** UUID of the Private Network. */ id: string - /** IPv4 network address of the rule. */ - ipCidr?: string - /** Description of the rule. */ - description?: string + /** List of IPv4 CIDR notation addresses of the endpoint. */ + serviceIps: string[] + /** Zone of the Private Network. */ + zone: Zone + /** How your endpoint ips are provisioned. */ + provisioningMode: PrivateNetworkProvisioningMode } -/** Acl rule spec. */ -export interface ACLRuleSpec { - /** IPv4 network address of the rule. */ - ipCidr: string - /** Description of the rule. */ - description: string -} +export interface PublicNetwork {} -/** Add acl rules response. */ -export interface AddAclRulesResponse { - /** ACL Rules enabled for the Database Instance. */ - aclRules: ACLRule[] - /** Total count of ACL rules of the Database Instance. */ - totalCount: number +export interface EndpointSpecPrivateNetworkSpec { + /** UUID of the Private Network to connect to the Database Instance. */ + id: string + /** + * Endpoint IPv4 address with a CIDR notation. You must provide at least one + * IPv4 per node. + */ + serviceIps: string[] + /** + * Automated configuration of your Private Network endpoint with Scaleway IPAM + * service. + */ + ipamConfig?: EndpointSpecPrivateNetworkSpecIpamConfig } -/** Add endpoints response. */ -export interface AddEndpointsResponse { - /** Endpoints defined on the Database Instance. */ - endpoints: Endpoint[] - /** Total count of endpoints of the Database Instance. */ - totalCount: number -} +export interface EndpointSpecPublicNetworkSpec {} -/** Available cluster setting. */ export interface AvailableClusterSetting { /** Name of the setting. */ name: string @@ -88,51 +85,15 @@ export interface AvailableClusterSetting { deprecated: boolean } -/** Cluster. */ -export interface Cluster { - /** UUID of the Database Instance. */ +export interface ACLRule { + /** ID of the rule. */ id: string - /** Name of the Database Instance. */ - name: string - /** Project ID the Database Instance belongs to. */ - projectId: string - /** Status of the Database Instance. */ - status: ClusterStatus - /** Redis™ engine version of the Database Instance. */ - version: string - /** List of Database Instance endpoints. */ - endpoints: Endpoint[] - /** List of tags applied to the Database Instance. */ - tags: string[] - /** Node type of the Database Instance. */ - nodeType: string - /** Creation date (Format ISO 8601). */ - createdAt?: Date - /** Update date (Format ISO 8601). */ - updatedAt?: Date - /** Defines whether or not TLS is enabled. */ - tlsEnabled: boolean - /** List of Database Instance settings. */ - clusterSettings: ClusterSetting[] - /** List of ACL rules. */ - aclRules: ACLRule[] - /** Number of nodes of the Database Instance cluster. */ - clusterSize: number - /** Zone of the Database Instance. */ - zone: Zone - /** Name of the user associated to the cluster. */ - userName: string - /** List of engine versions the Database Instance can upgrade to. */ - upgradableVersions: string[] -} - -/** Cluster metrics response. */ -export interface ClusterMetricsResponse { - /** Time series of metrics of a given cluster. */ - timeseries: TimeSeries[] + /** IPv4 network address of the rule. */ + ipCidr?: string + /** Description of the rule. */ + description?: string } -/** Cluster setting. */ export interface ClusterSetting { /** Value of the setting. */ value: string @@ -140,27 +101,6 @@ export interface ClusterSetting { name: string } -/** Cluster settings response. */ -export interface ClusterSettingsResponse { - /** Settings configured for a given Database Instance. */ - settings: ClusterSetting[] -} - -/** Cluster version. */ -export interface ClusterVersion { - /** Redis™ engine version. */ - version: string - /** Date of End of Life. */ - endOfLifeAt?: Date - /** Cluster settings available to be updated. */ - availableSettings: AvailableClusterSetting[] - /** Redis™ logo url. */ - logoUrl: string - /** Zone of the Redis™ Database Instance. */ - zone: Zone -} - -/** Endpoint. */ export interface Endpoint { /** TCP port of the endpoint. */ port: number @@ -184,7 +124,13 @@ export interface Endpoint { id: string } -/** Endpoint spec. */ +export interface ACLRuleSpec { + /** IPv4 network address of the rule. */ + ipCidr: string + /** Description of the rule. */ + description: string +} + export interface EndpointSpec { /** * Private Network specification details. @@ -202,52 +148,56 @@ export interface EndpointSpec { publicNetwork?: EndpointSpecPublicNetworkSpec } -/** Endpoint spec. private network spec. */ -export interface EndpointSpecPrivateNetworkSpec { - /** UUID of the Private Network to connect to the Database Instance. */ - id: string - /** - * Endpoint IPv4 address with a CIDR notation. You must provide at least one - * IPv4 per node. - */ - serviceIps: string[] - /** - * Automated configuration of your Private Network endpoint with Scaleway IPAM - * service. - */ - ipamConfig?: EndpointSpecPrivateNetworkSpecIpamConfig -} - -export interface EndpointSpecPrivateNetworkSpecIpamConfig {} - -/** Endpoint spec. public network spec. */ -export interface EndpointSpecPublicNetworkSpec {} - -/** List cluster versions response. */ -export interface ListClusterVersionsResponse { - /** List of available Redis™ engine versions. */ - versions: ClusterVersion[] - /** Total count of available Redis™ engine versions. */ - totalCount: number -} - -/** List clusters response. */ -export interface ListClustersResponse { - /** List all Database Instances. */ - clusters: Cluster[] - /** Total count of Database Instances. */ - totalCount: number +export interface ClusterVersion { + /** Redis™ engine version. */ + version: string + /** Date of End of Life. */ + endOfLifeAt?: Date + /** Cluster settings available to be updated. */ + availableSettings: AvailableClusterSetting[] + /** Redis™ logo url. */ + logoUrl: string + /** Zone of the Redis™ Database Instance. */ + zone: Zone } -/** List node types response. */ -export interface ListNodeTypesResponse { - /** Types of node. */ - nodeTypes: NodeType[] - /** Total count of node types available. */ - totalCount: number +export interface Cluster { + /** UUID of the Database Instance. */ + id: string + /** Name of the Database Instance. */ + name: string + /** Project ID the Database Instance belongs to. */ + projectId: string + /** Status of the Database Instance. */ + status: ClusterStatus + /** Redis™ engine version of the Database Instance. */ + version: string + /** List of Database Instance endpoints. */ + endpoints: Endpoint[] + /** List of tags applied to the Database Instance. */ + tags: string[] + /** Node type of the Database Instance. */ + nodeType: string + /** Creation date (Format ISO 8601). */ + createdAt?: Date + /** Update date (Format ISO 8601). */ + updatedAt?: Date + /** Defines whether or not TLS is enabled. */ + tlsEnabled: boolean + /** List of Database Instance settings. */ + clusterSettings: ClusterSetting[] + /** List of ACL rules. */ + aclRules: ACLRule[] + /** Number of nodes of the Database Instance cluster. */ + clusterSize: number + /** Zone of the Database Instance. */ + zone: Zone + /** Name of the user associated to the cluster. */ + userName: string + /** List of engine versions the Database Instance can upgrade to. */ + upgradableVersions: string[] } -/** Node type. */ export interface NodeType { /** Node type name. */ name: string @@ -267,30 +217,55 @@ export interface NodeType { zone: Zone } -/** Private network. */ -export interface PrivateNetwork { - /** UUID of the Private Network. */ - id: string - /** List of IPv4 CIDR notation addresses of the endpoint. */ - serviceIps: string[] - /** Zone of the Private Network. */ - zone: Zone - /** How your endpoint ips are provisioned. */ - provisioningMode: PrivateNetworkProvisioningMode +export type AddAclRulesRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the Database Instance you want to add ACL rules to. */ + clusterId: string + /** ACLs rules to add to the cluster. */ + aclRules: ACLRuleSpec[] } -export interface PublicNetwork {} - -/** Set acl rules response. */ -export interface SetAclRulesResponse { +export interface AddAclRulesResponse { /** ACL Rules enabled for the Database Instance. */ aclRules: ACLRule[] + /** Total count of ACL rules of the Database Instance. */ + totalCount: number } -/** Set endpoints response. */ -export interface SetEndpointsResponse { +export type AddClusterSettingsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the Database Instance you want to add settings to. */ + clusterId: string + /** Settings to add to the cluster. */ + settings: ClusterSetting[] +} + +export type AddEndpointsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the Database Instance you want to add endpoints to. */ + clusterId: string + /** Endpoints to add to the Database Instance. */ + endpoints: EndpointSpec[] +} + +export interface AddEndpointsResponse { /** Endpoints defined on the Database Instance. */ endpoints: Endpoint[] + /** Total count of endpoints of the Database Instance. */ + totalCount: number +} + +export interface ClusterMetricsResponse { + /** Time series of metrics of a given cluster. */ + timeseries: TimeSeries[] +} + +export interface ClusterSettingsResponse { + /** Settings configured for a given Database Instance. */ + settings: ClusterSetting[] } export type CreateClusterRequest = { @@ -316,9 +291,8 @@ export type CreateClusterRequest = { aclRules?: ACLRuleSpec[] /** * Zero or multiple EndpointSpec used to expose your cluster publicly and - * inside Private Networks. Zero or multiple EndpointSpec used to expose your - * cluster publicly and inside private networks. If no EndpoindSpec is given - * the cluster will be publicly exposed by default. + * inside private networks. If no EndpoindSpec is given the cluster will be + * publicly exposed by default. */ endpoints?: EndpointSpec[] /** Defines whether or not TLS is enabled. */ @@ -327,79 +301,47 @@ export type CreateClusterRequest = { clusterSettings?: ClusterSetting[] } -export type UpdateClusterRequest = { +export type DeleteAclRuleRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the Database Instance to update. */ + /** UUID of the ACL rule you want to delete. */ + aclId: string +} + +export type DeleteClusterRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the Database Instance to delete. */ clusterId: string - /** Name of the Database Instance. */ - name?: string - /** Database Instance tags. */ - tags?: string[] - /** Name of the Database Instance user. */ - userName?: string - /** Password of the Database Instance user. */ - password?: string } -export type GetClusterRequest = { +export type DeleteClusterSettingRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the cluster. */ + /** UUID of the Database Instance where the settings must be set. */ clusterId: string + /** Setting name to delete. */ + settingName: string } -export type ListClustersRequest = { +export type DeleteEndpointRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Filter by Database Instance tags. */ - tags?: string[] - /** Filter by Database Instance names. */ - name?: string - /** Criteria to use when ordering the list. */ - orderBy?: ListClustersRequestOrderBy - /** Filter by Project ID. */ - projectId?: string - /** Filter by Organization ID. */ - organizationId?: string - /** Filter by Redis™ engine version. */ - version?: string - page?: number - pageSize?: number + /** UUID of the endpoint you want to delete. */ + endpointId: string } -export type MigrateClusterRequest = { +export type GetAclRuleRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the Database Instance to update. */ - clusterId: string - /** - * Redis™ engine version of the Database Instance. - * - * One-of ('action'): at most one of 'version', 'nodeType', 'clusterSize' - * could be set. - */ - version?: string - /** - * Type of node to use for the Database Instance. - * - * One-of ('action'): at most one of 'version', 'nodeType', 'clusterSize' - * could be set. - */ - nodeType?: string - /** - * Number of nodes for the Database Instance. - * - * One-of ('action'): at most one of 'version', 'nodeType', 'clusterSize' - * could be set. - */ - clusterSize?: number + /** UUID of the ACL rule you want to get. */ + aclId: string } -export type DeleteClusterRequest = { +export type GetClusterCertificateRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the Database Instance to delete. */ + /** UUID of the cluster. */ clusterId: string } @@ -416,13 +358,18 @@ export type GetClusterMetricsRequest = { metricName?: string } -export type ListNodeTypesRequest = { +export type GetClusterRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Defines whether or not to include disabled types. */ - includeDisabledTypes: boolean - page?: number - pageSize?: number + /** UUID of the cluster. */ + clusterId: string +} + +export type GetEndpointRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the endpoint you want to get. */ + endpointId: string } export type ListClusterVersionsRequest = { @@ -440,45 +387,88 @@ export type ListClusterVersionsRequest = { pageSize?: number } -export type GetClusterCertificateRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the cluster. */ - clusterId: string +export interface ListClusterVersionsResponse { + /** List of available Redis™ engine versions. */ + versions: ClusterVersion[] + /** Total count of available Redis™ engine versions. */ + totalCount: number } -export type RenewClusterCertificateRequest = { +export type ListClustersRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the cluster. */ - clusterId: string + /** Filter by Database Instance tags. */ + tags?: string[] + /** Filter by Database Instance names. */ + name?: string + /** Criteria to use when ordering the list. */ + orderBy?: ListClustersRequestOrderBy + /** Filter by Project ID. */ + projectId?: string + /** Filter by Organization ID. */ + organizationId?: string + /** Filter by Redis™ engine version. */ + version?: string + page?: number + pageSize?: number } -export type AddClusterSettingsRequest = { +export interface ListClustersResponse { + /** List all Database Instances. */ + clusters: Cluster[] + /** Total count of Database Instances. */ + totalCount: number +} + +export type ListNodeTypesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the Database Instance you want to add settings to. */ - clusterId: string - /** Settings to add to the cluster. */ - settings: ClusterSetting[] + /** Defines whether or not to include disabled types. */ + includeDisabledTypes: boolean + page?: number + pageSize?: number } -export type DeleteClusterSettingRequest = { +export interface ListNodeTypesResponse { + /** Types of node. */ + nodeTypes: NodeType[] + /** Total count of node types available. */ + totalCount: number +} + +export type MigrateClusterRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the Database Instance where the settings must be set. */ + /** UUID of the Database Instance to update. */ clusterId: string - /** Setting name to delete. */ - settingName: string + /** + * Redis™ engine version of the Database Instance. + * + * One-of ('action'): at most one of 'version', 'nodeType', 'clusterSize' + * could be set. + */ + version?: string + /** + * Type of node to use for the Database Instance. + * + * One-of ('action'): at most one of 'version', 'nodeType', 'clusterSize' + * could be set. + */ + nodeType?: string + /** + * Number of nodes for the Database Instance. + * + * One-of ('action'): at most one of 'version', 'nodeType', 'clusterSize' + * could be set. + */ + clusterSize?: number } -export type SetClusterSettingsRequest = { +export type RenewClusterCertificateRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the Database Instance where the settings must be set. */ + /** UUID of the cluster. */ clusterId: string - /** Settings to define for the Database Instance. */ - settings: ClusterSetting[] } export type SetAclRulesRequest = { @@ -490,27 +480,18 @@ export type SetAclRulesRequest = { aclRules: ACLRuleSpec[] } -export type AddAclRulesRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the Database Instance you want to add ACL rules to. */ - clusterId: string - /** ACLs rules to add to the cluster. */ - aclRules: ACLRuleSpec[] -} - -export type DeleteAclRuleRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the ACL rule you want to delete. */ - aclId: string +export interface SetAclRulesResponse { + /** ACL Rules enabled for the Database Instance. */ + aclRules: ACLRule[] } -export type GetAclRuleRequest = { +export type SetClusterSettingsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the ACL rule you want to get. */ - aclId: string + /** UUID of the Database Instance where the settings must be set. */ + clusterId: string + /** Settings to define for the Database Instance. */ + settings: ClusterSetting[] } export type SetEndpointsRequest = { @@ -522,27 +503,24 @@ export type SetEndpointsRequest = { endpoints: EndpointSpec[] } -export type AddEndpointsRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the Database Instance you want to add endpoints to. */ - clusterId: string - /** Endpoints to add to the Database Instance. */ - endpoints: EndpointSpec[] -} - -export type DeleteEndpointRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the endpoint you want to delete. */ - endpointId: string +export interface SetEndpointsResponse { + /** Endpoints defined on the Database Instance. */ + endpoints: Endpoint[] } -export type GetEndpointRequest = { +export type UpdateClusterRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the endpoint you want to get. */ - endpointId: string + /** UUID of the Database Instance to update. */ + clusterId: string + /** Name of the Database Instance. */ + name?: string + /** Database Instance tags. */ + tags?: string[] + /** Name of the Database Instance user. */ + userName?: string + /** Password of the Database Instance user. */ + password?: string } export type UpdateEndpointRequest = { diff --git a/packages/clients/src/api/registry/v1/api.gen.ts b/packages/clients/src/api/registry/v1/api.gen.ts index 941936282..69b859488 100644 --- a/packages/clients/src/api/registry/v1/api.gen.ts +++ b/packages/clients/src/api/registry/v1/api.gen.ts @@ -66,7 +66,7 @@ export class API extends ParentAPI { )}/namespaces`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -213,7 +213,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['name', request.name], ['namespace_id', request.namespaceId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -331,7 +331,7 @@ export class API extends ParentAPI { )}/images/${validatePathParam('imageId', request.imageId)}/tags`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', diff --git a/packages/clients/src/api/registry/v1/marshalling.gen.ts b/packages/clients/src/api/registry/v1/marshalling.gen.ts index 4140f7abe..db5e36577 100644 --- a/packages/clients/src/api/registry/v1/marshalling.gen.ts +++ b/packages/clients/src/api/registry/v1/marshalling.gen.ts @@ -20,7 +20,7 @@ import type { UpdateNamespaceRequest, } from './types.gen' -export const unmarshalImage = (data: unknown) => { +export const unmarshalImage = (data: unknown): Image => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Image' failed as data isn't a dictionary.`, @@ -41,7 +41,7 @@ export const unmarshalImage = (data: unknown) => { } as Image } -export const unmarshalNamespace = (data: unknown) => { +export const unmarshalNamespace = (data: unknown): Namespace => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`, @@ -66,7 +66,7 @@ export const unmarshalNamespace = (data: unknown) => { } as Namespace } -export const unmarshalTag = (data: unknown) => { +export const unmarshalTag = (data: unknown): Tag => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Tag' failed as data isn't a dictionary.`, @@ -84,7 +84,9 @@ export const unmarshalTag = (data: unknown) => { } as Tag } -export const unmarshalListImagesResponse = (data: unknown) => { +export const unmarshalListImagesResponse = ( + data: unknown, +): ListImagesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`, @@ -97,7 +99,9 @@ export const unmarshalListImagesResponse = (data: unknown) => { } as ListImagesResponse } -export const unmarshalListNamespacesResponse = (data: unknown) => { +export const unmarshalListNamespacesResponse = ( + data: unknown, +): ListNamespacesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`, @@ -110,7 +114,7 @@ export const unmarshalListNamespacesResponse = (data: unknown) => { } as ListNamespacesResponse } -export const unmarshalListTagsResponse = (data: unknown) => { +export const unmarshalListTagsResponse = (data: unknown): ListTagsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListTagsResponse' failed as data isn't a dictionary.`, @@ -131,16 +135,16 @@ export const marshalCreateNamespaceRequest = ( is_public: request.isPublic, name: request.name || randomName('ns'), ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, ]), }) @@ -148,7 +152,7 @@ export const marshalUpdateImageRequest = ( request: UpdateImageRequest, defaults: DefaultValues, ): Record => ({ - visibility: request.visibility ?? 'visibility_unknown', + visibility: request.visibility, }) export const marshalUpdateNamespaceRequest = ( diff --git a/packages/clients/src/api/registry/v1/types.gen.ts b/packages/clients/src/api/registry/v1/types.gen.ts index 833bdc76a..9426c6d79 100644 --- a/packages/clients/src/api/registry/v1/types.gen.ts +++ b/packages/clients/src/api/registry/v1/types.gen.ts @@ -39,7 +39,6 @@ export type NamespaceStatus = export type TagStatus = 'unknown' | 'ready' | 'deleting' | 'error' | 'locked' -/** Image. */ export interface Image { /** UUID of the image. */ id: string @@ -58,10 +57,9 @@ export interface Image { */ visibility: ImageVisibility /** - * Image size in bytes, calculated from the size of image layers. Image size - * in bytes, calculated from the size of image layers. One layer used in two - * tags of the same image is counted once but one layer used in two images is - * counted twice. + * Image size in bytes, calculated from the size of image layers. One layer + * used in two tags of the same image is counted once but one layer used in + * two images is counted twice. */ size: number /** Date and time of image creation. */ @@ -72,31 +70,6 @@ export interface Image { tags: string[] } -/** List images response. */ -export interface ListImagesResponse { - /** Paginated list of images that match the selected filters. */ - images: Image[] - /** Total number of images that match the selected filters. */ - totalCount: number -} - -/** List namespaces response. */ -export interface ListNamespacesResponse { - /** Paginated list of namespaces that match the selected filters. */ - namespaces: Namespace[] - /** Total number of namespaces that match the selected filters. */ - totalCount: number -} - -/** List tags response. */ -export interface ListTagsResponse { - /** Paginated list of tags that match the selected filters. */ - tags: Tag[] - /** Total number of tags that match the selected filters. */ - totalCount: number -} - -/** Namespace. */ export interface Namespace { /** UUID of the namespace. */ id: string @@ -131,7 +104,6 @@ export interface Namespace { region: Region } -/** Tag. */ export interface Tag { /** UUID of the tag. */ id: string @@ -152,34 +124,45 @@ export interface Tag { updatedAt?: Date } -export type ListNamespacesRequest = { +export type CreateNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** A positive integer to choose the page to display. */ - page?: number + /** Name of the namespace. */ + name?: string + /** Description of the namespace. */ + description: string /** - * A positive integer lower or equal to 100 to select the number of items to - * display. + * @deprecated Namespace owner (deprecated). + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. */ - pageSize?: number + organizationId?: string /** - * Criteria to use when ordering namespace listings. Possible values are - * `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`, `region`, - * `status_asc` and `status_desc`. The default value is `created_at_asc`. + * Project ID on which the namespace will be created. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. */ - orderBy?: ListNamespacesRequestOrderBy - /** Filter by Organization ID. */ - organizationId?: string - /** Filter by Project ID. */ projectId?: string - /** Filter by the namespace name (exact match). */ - name?: string + /** Defines whether or not namespace is public. */ + isPublic: boolean } -export type GetNamespaceRequest = { +export type DeleteImageRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the image. */ + imageId: string +} + +export type DeleteNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -189,56 +172,49 @@ export type GetNamespaceRequest = { namespaceId: string } -export type CreateNamespaceRequest = { +export type DeleteTagRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Name of the namespace. */ - name?: string - /** Description of the namespace. */ - description: string + /** UUID of the tag. */ + tagId: string /** - * @deprecated Namespace owner (deprecated). - * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * @deprecated If two tags share the same digest the deletion will fail unless + * this parameter is set to true (deprecated). */ - organizationId?: string + force?: boolean +} + +export type GetImageRequest = { /** - * Project ID on which the namespace will be created. - * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. + * Region to target. If none is passed will use default region from the + * config. */ - projectId?: string - /** Defines whether or not namespace is public. */ - isPublic: boolean + region?: Region + /** UUID of the image. */ + imageId: string } -export type UpdateNamespaceRequest = { +export type GetNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the namespace to update. */ + /** UUID of the namespace. */ namespaceId: string - /** Namespace description. */ - description?: string - /** Defines whether or not the namespace is public. */ - isPublic?: boolean } -export type DeleteNamespaceRequest = { +export type GetTagRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the namespace. */ - namespaceId: string + /** UUID of the tag. */ + tagId: string } export type ListImagesRequest = { @@ -270,40 +246,45 @@ export type ListImagesRequest = { projectId?: string } -export type GetImageRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the image. */ - imageId: string +export interface ListImagesResponse { + /** Paginated list of images that match the selected filters. */ + images: Image[] + /** Total number of images that match the selected filters. */ + totalCount: number } -export type UpdateImageRequest = { +export type ListNamespacesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the image to update. */ - imageId: string + /** A positive integer to choose the page to display. */ + page?: number /** - * Set to `public` to allow the image to be pulled without authentication. - * Else, set to `private`. Set to `inherit` to keep the same visibility - * configuration as the namespace. + * A positive integer lower or equal to 100 to select the number of items to + * display. */ - visibility?: ImageVisibility -} - -export type DeleteImageRequest = { + pageSize?: number /** - * Region to target. If none is passed will use default region from the - * config. + * Criteria to use when ordering namespace listings. Possible values are + * `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`, `region`, + * `status_asc` and `status_desc`. The default value is `created_at_asc`. */ - region?: Region - /** UUID of the image. */ - imageId: string + orderBy?: ListNamespacesRequestOrderBy + /** Filter by Organization ID. */ + organizationId?: string + /** Filter by Project ID. */ + projectId?: string + /** Filter by the namespace name (exact match). */ + name?: string +} + +export interface ListNamespacesResponse { + /** Paginated list of namespaces that match the selected filters. */ + namespaces: Namespace[] + /** Total number of namespaces that match the selected filters. */ + totalCount: number } export type ListTagsRequest = { @@ -331,27 +312,39 @@ export type ListTagsRequest = { name?: string } -export type GetTagRequest = { +export interface ListTagsResponse { + /** Paginated list of tags that match the selected filters. */ + tags: Tag[] + /** Total number of tags that match the selected filters. */ + totalCount: number +} + +export type UpdateImageRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the tag. */ - tagId: string + /** ID of the image to update. */ + imageId: string + /** + * Set to `public` to allow the image to be pulled without authentication. + * Else, set to `private`. Set to `inherit` to keep the same visibility + * configuration as the namespace. + */ + visibility?: ImageVisibility } -export type DeleteTagRequest = { +export type UpdateNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the tag. */ - tagId: string - /** - * @deprecated If two tags share the same digest the deletion will fail unless - * this parameter is set to true (deprecated). - */ - force?: boolean + /** ID of the namespace to update. */ + namespaceId: string + /** Namespace description. */ + description?: string + /** Defines whether or not the namespace is public. */ + isPublic?: boolean } diff --git a/packages/clients/src/api/secret/v1alpha1/api.gen.ts b/packages/clients/src/api/secret/v1alpha1/api.gen.ts index fe79f23ba..31515d715 100644 --- a/packages/clients/src/api/secret/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/api.gen.ts @@ -202,7 +202,7 @@ export class API extends ParentAPI { ['is_ephemeral', request.isEphemeral], ['is_managed', request.isManaged], ['name', request.name], - ['order_by', request.orderBy ?? 'name_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -237,7 +237,7 @@ export class API extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/folders`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', diff --git a/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts index 2c994eee6..94ad5a7f9 100644 --- a/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts @@ -2,7 +2,6 @@ // If you have any remark or suggestion do not hesitate to open an issue. import { isJSONObject, - resolveOneOf, unmarshalArrayOfObject, unmarshalDate, } from '../../../bridge' @@ -26,7 +25,7 @@ import type { UpdateSecretVersionRequest, } from './types.gen' -export const unmarshalFolder = (data: unknown) => { +export const unmarshalFolder = (data: unknown): Folder => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Folder' failed as data isn't a dictionary.`, @@ -43,7 +42,25 @@ export const unmarshalFolder = (data: unknown) => { } as Folder } -export const unmarshalSecret = (data: unknown) => { +export const unmarshalSecretVersion = (data: unknown): SecretVersion => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'SecretVersion' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + description: data.description, + isLatest: data.is_latest, + revision: data.revision, + secretId: data.secret_id, + status: data.status, + updatedAt: unmarshalDate(data.updated_at), + } as SecretVersion +} + +export const unmarshalSecret = (data: unknown): Secret => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Secret' failed as data isn't a dictionary.`, @@ -70,25 +87,9 @@ export const unmarshalSecret = (data: unknown) => { } as Secret } -export const unmarshalSecretVersion = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'SecretVersion' failed as data isn't a dictionary.`, - ) - } - - return { - createdAt: unmarshalDate(data.created_at), - description: data.description, - isLatest: data.is_latest, - revision: data.revision, - secretId: data.secret_id, - status: data.status, - updatedAt: unmarshalDate(data.updated_at), - } as SecretVersion -} - -export const unmarshalAccessSecretVersionResponse = (data: unknown) => { +export const unmarshalAccessSecretVersionResponse = ( + data: unknown, +): AccessSecretVersionResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'AccessSecretVersionResponse' failed as data isn't a dictionary.`, @@ -103,7 +104,9 @@ export const unmarshalAccessSecretVersionResponse = (data: unknown) => { } as AccessSecretVersionResponse } -export const unmarshalListFoldersResponse = (data: unknown) => { +export const unmarshalListFoldersResponse = ( + data: unknown, +): ListFoldersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListFoldersResponse' failed as data isn't a dictionary.`, @@ -116,7 +119,9 @@ export const unmarshalListFoldersResponse = (data: unknown) => { } as ListFoldersResponse } -export const unmarshalListSecretVersionsResponse = (data: unknown) => { +export const unmarshalListSecretVersionsResponse = ( + data: unknown, +): ListSecretVersionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSecretVersionsResponse' failed as data isn't a dictionary.`, @@ -129,7 +134,9 @@ export const unmarshalListSecretVersionsResponse = (data: unknown) => { } as ListSecretVersionsResponse } -export const unmarshalListSecretsResponse = (data: unknown) => { +export const unmarshalListSecretsResponse = ( + data: unknown, +): ListSecretsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSecretsResponse' failed as data isn't a dictionary.`, @@ -142,32 +149,24 @@ export const unmarshalListSecretsResponse = (data: unknown) => { } as ListSecretsResponse } -export const unmarshalListTagsResponse = (data: unknown) => { +export const unmarshalListTagsResponse = (data: unknown): ListTagsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListTagsResponse' failed as data isn't a dictionary.`, ) } - return { tags: data.tags, totalCount: data.total_count } as ListTagsResponse + return { + tags: data.tags, + totalCount: data.total_count, + } as ListTagsResponse } -const marshalPasswordGenerationParams = ( - request: PasswordGenerationParams, - defaults: DefaultValues, -): Record => ({ - additional_chars: request.additionalChars, - length: request.length, - no_digits: request.noDigits, - no_lowercase_letters: request.noLowercaseLetters, - no_uppercase_letters: request.noUppercaseLetters, -}) - export const marshalAddSecretOwnerRequest = ( request: AddSecretOwnerRequest, defaults: DefaultValues, ): Record => ({ - product: request.product ?? 'unknown', + product: request.product, product_name: request.productName, }) @@ -191,7 +190,18 @@ export const marshalCreateSecretRequest = ( path: request.path, project_id: request.projectId ?? defaults.defaultProjectId, tags: request.tags, - type: request.type ?? 'unknown_secret_type', + type: request.type, +}) + +const marshalPasswordGenerationParams = ( + request: PasswordGenerationParams, + defaults: DefaultValues, +): Record => ({ + additional_chars: request.additionalChars, + length: request.length, + no_digits: request.noDigits, + no_lowercase_letters: request.noLowercaseLetters, + no_uppercase_letters: request.noUppercaseLetters, }) export const marshalCreateSecretVersionRequest = ( @@ -202,14 +212,10 @@ export const marshalCreateSecretVersionRequest = ( data_crc32: request.dataCrc32, description: request.description, disable_previous: request.disablePrevious, - ...resolveOneOf([ - { - param: 'password_generation', - value: request.passwordGeneration - ? marshalPasswordGenerationParams(request.passwordGeneration, defaults) - : undefined, - }, - ]), + password_generation: + request.passwordGeneration !== undefined + ? marshalPasswordGenerationParams(request.passwordGeneration, defaults) + : undefined, }) export const marshalGeneratePasswordRequest = ( diff --git a/packages/clients/src/api/secret/v1alpha1/types.gen.ts b/packages/clients/src/api/secret/v1alpha1/types.gen.ts index 91fe3a523..54072d71a 100644 --- a/packages/clients/src/api/secret/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/types.gen.ts @@ -37,25 +37,19 @@ export type SecretVersionStatus = | 'disabled' | 'destroyed' -/** Access secret version response. */ -export interface AccessSecretVersionResponse { - /** ID of the secret. */ - secretId: string - /** - * Version number. The first version of the secret is numbered 1, and all - * subsequent revisions augment by 1. - */ - revision: number - /** The base64-encoded secret payload of the version. */ - data: string - /** - * The CRC32 checksum of the data as a base-10 integer. This field is only - * available if a CRC32 was supplied during the creation of the version. - */ - dataCrc32?: number +export interface PasswordGenerationParams { + /** Length of the password to generate (between 1 and 1024). */ + length: number + /** Do not include lower case letters by default in the alphabet. */ + noLowercaseLetters: boolean + /** Do not include upper case letters by default in the alphabet. */ + noUppercaseLetters: boolean + /** Do not include digits by default in the alphabet. */ + noDigits: boolean + /** Additional ascii characters to be included in the alphabet. */ + additionalChars: string } -/** Folder. */ export interface Folder { /** ID of the folder. */ id: string @@ -63,61 +57,37 @@ export interface Folder { projectId: string /** Name of the folder. */ name: string - /** Path of the folder. Location of the folder in the directory structure. */ + /** Location of the folder in the directory structure. */ path: string /** Date and time of the folder's creation. */ createdAt?: Date - /** Region of the folder. */ - region: Region } -/** List folders response. */ -export interface ListFoldersResponse { - /** List of folders. */ - folders: Folder[] - /** Count of all folders matching the requested criteria. */ - totalCount: number -} - -/** List secret versions response. */ -export interface ListSecretVersionsResponse { - /** Single page of versions. */ - versions: SecretVersion[] - /** Number of versions. */ - totalCount: number -} - -/** List secrets response. */ -export interface ListSecretsResponse { - /** Single page of secrets matching the requested criteria. */ - secrets: Secret[] - /** Count of all secrets matching the requested criteria. */ - totalCount: number -} - -/** List tags response. */ -export interface ListTagsResponse { - /** List of tags. */ - tags: string[] - /** Count of all tags matching the requested criteria. */ - totalCount: number -} - -/** Password generation params. */ -export interface PasswordGenerationParams { - /** Length of the password to generate (between 1 and 1024). */ - length: number - /** Do not include lower case letters by default in the alphabet. */ - noLowercaseLetters: boolean - /** Do not include upper case letters by default in the alphabet. */ - noUppercaseLetters: boolean - /** Do not include digits by default in the alphabet. */ - noDigits: boolean - /** Additional ascii characters to be included in the alphabet. */ - additionalChars: string +export interface SecretVersion { + /** + * The first version of the secret is numbered 1, and all subsequent revisions + * augment by 1. + */ + revision: number + /** ID of the secret. */ + secretId: string + /** + * - `unknown`: the version is in an invalid state. `enabled`: the version is + * accessible. `disabled`: the version is not accessible but can be enabled. + * `destroyed`: the version is permanently deleted. It is not possible to + * recover it. + */ + status: SecretVersionStatus + /** Date and time of the version's creation. */ + createdAt?: Date + /** Last update of the version. */ + updatedAt?: Date + /** Description of the version. */ + description?: string + /** Returns `true` if the version is the latest. */ + isLatest: boolean } -/** Secret. */ export interface Secret { /** ID of the secret. */ id: string @@ -126,9 +96,9 @@ export interface Secret { /** Name of the secret. */ name: string /** - * Current status of the secret. `ready`: the secret can be read, modified and - * deleted. `locked`: no action can be performed on the secret. This status - * can only be applied and removed by Scaleway. + * - `ready`: the secret can be read, modified and deleted. `locked`: no action + * can be performed on the secret. This status can only be applied and + * removed by Scaleway. */ status: SecretStatus /** Date and time of the secret's creation. */ @@ -145,9 +115,9 @@ export interface Secret { isManaged: boolean /** Returns `true` for protected secrets that cannot be deleted. */ isProtected: boolean - /** Type of the secret. See `Secret.Type` enum for description of values. */ + /** See `Secret.Type` enum for description of values. */ type: SecretType - /** Path of the secret. Location of the secret in the directory structure. */ + /** Location of the secret in the directory structure. */ path: string /** * Expiration date of the secret. (Optional.) Date on which the secret will be @@ -163,108 +133,67 @@ export interface Secret { region: Region } -/** Secret version. */ -export interface SecretVersion { - /** - * Version number. The first version of the secret is numbered 1, and all - * subsequent revisions augment by 1. - */ - revision: number - /** ID of the secret. */ - secretId: string - /** - * Current status of the version. `unknown`: the version is in an invalid - * state. `enabled`: the version is accessible. `disabled`: the version is not - * accessible but can be enabled. `destroyed`: the version is permanently - * deleted. It is not possible to recover it. - */ - status: SecretVersionStatus - /** Date and time of the version's creation. */ - createdAt?: Date - /** Last update of the version. */ - updatedAt?: Date - /** Description of the version. */ - description?: string - /** Returns `true` if the version is the latest. */ - isLatest: boolean -} - -export type CreateSecretRequest = { +export type AccessSecretVersionByNameRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the Project containing the secret. */ - projectId?: string /** Name of the secret. */ - name: string - /** List of the secret's tags. */ - tags?: string[] - /** Description of the secret. */ - description?: string - /** - * Type of the secret. (Optional.) See `Secret.Type` enum for description of - * values. If not specified, the type is `Opaque`. - */ - type?: SecretType + secretName: string /** - * Path of the secret. (Optional.) Location of the secret in the directory - * structure. If not specified, the path is `/`. + * The first version of the secret is numbered 1, and all subsequent revisions + * augment by 1. Value can be either: + * + * - A number (the revision number) + * - "latest" (the latest revision) + * - "latest_enabled" (the latest enabled revision). */ - path?: string + revision: string /** - * Expiration date of the secret. (Optional.) Date on which the secret will be - * deleted or deactivated. + * (Optional.) If not specified, Secret Manager will look for the secret + * version in all Projects. */ - expiresAt?: Date - /** Action to be taken when the secret expires. */ - ephemeralAction?: SecretEphemeralAction + projectId?: string } -export type CreateFolderRequest = { +export type AccessSecretVersionRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the Project containing the folder. */ - projectId?: string - /** Name of the folder. */ - name: string + /** ID of the secret. */ + secretId: string /** - * Path of the folder. (Optional.) Location of the folder in the directory - * structure. If not specified, the path is `/`. + * The first version of the secret is numbered 1, and all subsequent revisions + * augment by 1. Value can be either: + * + * - A number (the revision number) + * - "latest" (the latest revision) + * - "latest_enabled" (the latest enabled revision). */ - path?: string + revision: string } -export type GetSecretRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region +export interface AccessSecretVersionResponse { /** ID of the secret. */ secretId: string -} - -export type GetSecretByNameRequest = { /** - * Region to target. If none is passed will use default region from the - * config. + * The first version of the secret is numbered 1, and all subsequent revisions + * augment by 1. */ - region?: Region - /** Name of the secret. */ - secretName: string + revision: number + /** The base64-encoded secret payload of the version. */ + data: string /** - * ID of the Project to target. (Optional.) If not specified, Secret Manager - * will look for the secret in all Projects. + * This field is only available if a CRC32 was supplied during the creation of + * the version. */ - projectId?: string + dataCrc32?: number } -export type UpdateSecretRequest = { +export type AddSecretOwnerRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -272,60 +201,63 @@ export type UpdateSecretRequest = { region?: Region /** ID of the secret. */ secretId: string - /** Secret's updated name (optional). */ - name?: string - /** Secret's updated list of tags (optional). */ - tags?: string[] - /** Description of the secret. */ - description?: string - /** - * Path of the folder. (Optional.) Location of the folder in the directory - * structure. If not specified, the path is `/`. - */ - path?: string + /** @deprecated (Deprecated: use `product` field) Name of the product to add. */ + productName?: string + /** See `Product` enum for description of values. */ + product?: Product } -export type ListSecretsRequest = { +export type CreateFolderRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Filter by Organization ID (optional). */ - organizationId?: string - /** Filter by Project ID (optional). */ + /** ID of the Project containing the folder. */ projectId?: string - orderBy?: ListSecretsRequestOrderBy - page?: number - pageSize?: number - /** List of tags to filter on (optional). */ - tags?: string[] - /** Filter by secret name (optional). */ - name?: string - /** Filter by managed / not managed (optional). */ - isManaged?: boolean - /** Filter by path (optional). */ + /** Name of the folder. */ + name: string + /** + * (Optional.) Location of the folder in the directory structure. If not + * specified, the path is `/`. + */ path?: string - /** Filter by ephemeral / not ephemeral (optional). */ - isEphemeral?: boolean } -export type ListFoldersRequest = { +export type CreateSecretRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Filter by Project ID (optional). */ + /** ID of the Project containing the secret. */ projectId?: string - /** Filter by path (optional). */ + /** Name of the secret. */ + name: string + /** List of the secret's tags. */ + tags?: string[] + /** Description of the secret. */ + description?: string + /** + * (Optional.) See `Secret.Type` enum for description of values. If not + * specified, the type is `Opaque`. + */ + type?: SecretType + /** + * (Optional.) Location of the secret in the directory structure. If not + * specified, the path is `/`. + */ path?: string - page?: number - pageSize?: number - orderBy?: ListFoldersRequestOrderBy + /** + * Expiration date of the secret. (Optional.) Date on which the secret will be + * deleted or deactivated. + */ + expiresAt?: Date + /** Action to be taken when the secret expires. */ + ephemeralAction?: SecretEphemeralAction } -export type DeleteSecretRequest = { +export type CreateSecretVersionRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -333,6 +265,29 @@ export type DeleteSecretRequest = { region?: Region /** ID of the secret. */ secretId: string + /** The base64-encoded secret payload of the version. */ + data: string + /** Description of the version. */ + description?: string + /** + * (Optional.) If there is no previous version or if the previous version was + * already disabled, does nothing. + */ + disablePrevious?: boolean + /** + * @deprecated (Optional.) If specified, a random password will be generated. + * The `data` and `data_crc32` fields must be empty. By default, the + * generator will use upper and lower case letters, and digits. This + * behavior can be tuned using the generation parameters. + */ + passwordGeneration?: PasswordGenerationParams + /** + * If specified, Secret Manager will verify the integrity of the data received + * against the given CRC32 checksum. An error is returned if the CRC32 does + * not match. If, however, the CRC32 matches, it will be stored and returned + * along with the SecretVersion on future access requests. + */ + dataCrc32?: number } export type DeleteFolderRequest = { @@ -345,27 +300,36 @@ export type DeleteFolderRequest = { folderId: string } -export type ProtectSecretRequest = { +export type DeleteSecretRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the secret to protect. */ + /** ID of the secret. */ secretId: string } -export type UnprotectSecretRequest = { +export type DestroySecretVersionRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the secret to unprotect. */ + /** ID of the secret. */ secretId: string + /** + * The first version of the secret is numbered 1, and all subsequent revisions + * augment by 1. Value can be either: + * + * - A number (the revision number) + * - "latest" (the latest revision) + * - "latest_enabled" (the latest enabled revision). + */ + revision: string } -export type AddSecretOwnerRequest = { +export type DisableSecretVersionRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -373,13 +337,18 @@ export type AddSecretOwnerRequest = { region?: Region /** ID of the secret. */ secretId: string - /** @deprecated (Deprecated: use `product` field) Name of the product to add. */ - productName?: string - /** ID of the product to add. See `Product` enum for description of values. */ - product?: Product + /** + * The first version of the secret is numbered 1, and all subsequent revisions + * augment by 1. Value can be either: + * + * - A number (the revision number) + * - "latest" (the latest revision) + * - "latest_enabled" (the latest enabled revision). + */ + revision: string } -export type CreateSecretVersionRequest = { +export type EnableSecretVersionRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -387,34 +356,15 @@ export type CreateSecretVersionRequest = { region?: Region /** ID of the secret. */ secretId: string - /** The base64-encoded secret payload of the version. */ - data: string - /** Description of the version. */ - description?: string /** - * Disable the previous secret version. (Optional.) If there is no previous - * version or if the previous version was already disabled, does nothing. - */ - disablePrevious?: boolean - /** - * @deprecated Options to generate a password. (Optional.) If specified, a - * random password will be generated. The `data` and `data_crc32` fields - * must be empty. By default, the generator will use upper and lower case - * letters, and digits. This behavior can be tuned using the generation - * parameters. + * The first version of the secret is numbered 1, and all subsequent revisions + * augment by 1. Value can be either: * - * One-of ('PasswordGeneration'): at most one of 'passwordGeneration' could be - * set. - */ - passwordGeneration?: PasswordGenerationParams - /** - * (Optional.) The CRC32 checksum of the data as a base-10 integer. If - * specified, Secret Manager will verify the integrity of the data received - * against the given CRC32 checksum. An error is returned if the CRC32 does - * not match. If, however, the CRC32 matches, it will be stored and returned - * along with the SecretVersion on future access requests. + * - A number (the revision number) + * - "latest" (the latest revision) + * - "latest_enabled" (the latest enabled revision). */ - dataCrc32?: number + revision: string } export type GeneratePasswordRequest = { @@ -428,9 +378,8 @@ export type GeneratePasswordRequest = { /** Description of the version. */ description?: string /** - * (Optional.) Disable the previous secret version. This has no effect if - * there is no previous version or if the previous version was already - * disabled. + * This has no effect if there is no previous version or if the previous + * version was already disabled. */ disablePrevious?: boolean /** Length of the password to generate (between 1 and 1024 characters). */ @@ -454,23 +403,29 @@ export type GeneratePasswordRequest = { additionalChars?: string } -export type GetSecretVersionRequest = { +export type GetSecretByNameRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the secret. */ - secretId: string + /** Name of the secret. */ + secretName: string /** - * Version number. The first version of the secret is numbered 1, and all - * subsequent revisions augment by 1. Value can be either: - * - * - A number (the revision number) - * - "latest" (the latest revision) - * - "latest_enabled" (the latest enabled revision). + * (Optional.) If not specified, Secret Manager will look for the secret in + * all Projects. */ - revision: string + projectId?: string +} + +export type GetSecretRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** ID of the secret. */ + secretId: string } export type GetSecretVersionByNameRequest = { @@ -482,8 +437,8 @@ export type GetSecretVersionByNameRequest = { /** Name of the secret. */ secretName: string /** - * Version number. The first version of the secret is numbered 1, and all - * subsequent revisions augment by 1. Value can be either: + * The first version of the secret is numbered 1, and all subsequent revisions + * augment by 1. Value can be either: * * - A number (the revision number) * - "latest" (the latest revision) @@ -491,13 +446,13 @@ export type GetSecretVersionByNameRequest = { */ revision: string /** - * ID of the Project to target. (Optional.) If not specified, Secret Manager - * will look for the secret version in all Projects. + * (Optional.) If not specified, Secret Manager will look for the secret + * version in all Projects. */ projectId?: string } -export type UpdateSecretVersionRequest = { +export type GetSecretVersionRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -506,30 +461,36 @@ export type UpdateSecretVersionRequest = { /** ID of the secret. */ secretId: string /** - * Version number. The first version of the secret is numbered 1, and all - * subsequent revisions augment by 1. Value can be either: + * The first version of the secret is numbered 1, and all subsequent revisions + * augment by 1. Value can be either: * * - A number (the revision number) * - "latest" (the latest revision) * - "latest_enabled" (the latest enabled revision). */ revision: string - /** Description of the version. */ - description?: string } -export type ListSecretVersionsRequest = { +export type ListFoldersRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the secret. */ - secretId: string + /** Filter by Project ID (optional). */ + projectId?: string + /** Filter by path (optional). */ + path?: string page?: number pageSize?: number - /** Filter results by status. */ - status?: SecretVersionStatus[] + orderBy?: ListFoldersRequestOrderBy +} + +export interface ListFoldersResponse { + /** List of folders. */ + folders: Folder[] + /** Count of all folders matching the requested criteria. */ + totalCount: number } export type ListSecretVersionsByNameRequest = { @@ -545,13 +506,13 @@ export type ListSecretVersionsByNameRequest = { /** Filter results by status. */ status?: SecretVersionStatus[] /** - * ID of the Project to target. (Optional.) If not specified, Secret Manager - * will look for the secret in all Projects. + * (Optional.) If not specified, Secret Manager will look for the secret in + * all Projects. */ projectId?: string } -export type EnableSecretVersionRequest = { +export type ListSecretVersionsRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -559,80 +520,94 @@ export type EnableSecretVersionRequest = { region?: Region /** ID of the secret. */ secretId: string + page?: number + pageSize?: number + /** Filter results by status. */ + status?: SecretVersionStatus[] +} + +export interface ListSecretVersionsResponse { + /** Single page of versions. */ + versions: SecretVersion[] + /** Number of versions. */ + totalCount: number +} + +export type ListSecretsRequest = { /** - * Version number. The first version of the secret is numbered 1, and all - * subsequent revisions augment by 1. Value can be either: - * - * - A number (the revision number) - * - "latest" (the latest revision) - * - "latest_enabled" (the latest enabled revision). + * Region to target. If none is passed will use default region from the + * config. */ - revision: string + region?: Region + /** Filter by Organization ID (optional). */ + organizationId?: string + /** Filter by Project ID (optional). */ + projectId?: string + orderBy?: ListSecretsRequestOrderBy + page?: number + pageSize?: number + /** List of tags to filter on (optional). */ + tags?: string[] + /** Filter by secret name (optional). */ + name?: string + /** Filter by managed / not managed (optional). */ + isManaged?: boolean + /** Filter by path (optional). */ + path?: string + /** Filter by ephemeral / not ephemeral (optional). */ + isEphemeral?: boolean } -export type DisableSecretVersionRequest = { +export interface ListSecretsResponse { + /** Single page of secrets matching the requested criteria. */ + secrets: Secret[] + /** Count of all secrets matching the requested criteria. */ + totalCount: number +} + +export type ListTagsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the secret. */ - secretId: string /** - * Version number. The first version of the secret is numbered 1, and all - * subsequent revisions augment by 1. Value can be either: - * - * - A number (the revision number) - * - "latest" (the latest revision) - * - "latest_enabled" (the latest enabled revision). + * (Optional.) If not specified, Secret Manager will look for tags in all + * Projects. */ - revision: string + projectId?: string + page?: number + pageSize?: number } -export type AccessSecretVersionRequest = { +export interface ListTagsResponse { + /** List of tags. */ + tags: string[] + /** Count of all tags matching the requested criteria. */ + totalCount: number +} + +export type ProtectSecretRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the secret. */ + /** ID of the secret to protect. */ secretId: string - /** - * Version number. The first version of the secret is numbered 1, and all - * subsequent revisions augment by 1. Value can be either: - * - * - A number (the revision number) - * - "latest" (the latest revision) - * - "latest_enabled" (the latest enabled revision). - */ - revision: string } -export type AccessSecretVersionByNameRequest = { +export type UnprotectSecretRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Name of the secret. */ - secretName: string - /** - * Version number. The first version of the secret is numbered 1, and all - * subsequent revisions augment by 1. Value can be either: - * - * - A number (the revision number) - * - "latest" (the latest revision) - * - "latest_enabled" (the latest enabled revision). - */ - revision: string - /** - * ID of the Project to target. (Optional.) If not specified, Secret Manager - * will look for the secret version in all Projects. - */ - projectId?: string + /** ID of the secret to unprotect. */ + secretId: string } -export type DestroySecretVersionRequest = { +export type UpdateSecretRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -640,28 +615,36 @@ export type DestroySecretVersionRequest = { region?: Region /** ID of the secret. */ secretId: string + /** Secret's updated name (optional). */ + name?: string + /** Secret's updated list of tags (optional). */ + tags?: string[] + /** Description of the secret. */ + description?: string /** - * Version number. The first version of the secret is numbered 1, and all - * subsequent revisions augment by 1. Value can be either: - * - * - A number (the revision number) - * - "latest" (the latest revision) - * - "latest_enabled" (the latest enabled revision). + * (Optional.) Location of the folder in the directory structure. If not + * specified, the path is `/`. */ - revision: string + path?: string } -export type ListTagsRequest = { +export type UpdateSecretVersionRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region + /** ID of the secret. */ + secretId: string /** - * ID of the Project to target. (Optional.) If not specified, Secret Manager - * will look for tags in all Projects. + * The first version of the secret is numbered 1, and all subsequent revisions + * augment by 1. Value can be either: + * + * - A number (the revision number) + * - "latest" (the latest revision) + * - "latest_enabled" (the latest enabled revision). */ - projectId?: string - page?: number - pageSize?: number + revision: string + /** Description of the version. */ + description?: string } diff --git a/packages/clients/src/api/std/index.gen.ts b/packages/clients/src/api/std/index.gen.ts new file mode 100644 index 000000000..156220bde --- /dev/null +++ b/packages/clients/src/api/std/index.gen.ts @@ -0,0 +1,3 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +export type { LanguageCode } from './types.gen' diff --git a/packages/clients/src/api/std/types.gen.ts b/packages/clients/src/api/std/types.gen.ts new file mode 100644 index 000000000..64cba9318 --- /dev/null +++ b/packages/clients/src/api/std/types.gen.ts @@ -0,0 +1,4 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. + +export type LanguageCode = 'unknown_language_code' | 'en_US' | 'fr_FR' | 'de_DE' diff --git a/packages/clients/src/api/tem/v1alpha1/api.gen.ts b/packages/clients/src/api/tem/v1alpha1/api.gen.ts index 64c40960a..b59fa162c 100644 --- a/packages/clients/src/api/tem/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/tem/v1alpha1/api.gen.ts @@ -132,7 +132,7 @@ export class API extends ParentAPI { ['mail_rcpt', request.mailRcpt], ['mail_to', request.mailTo], ['message_id', request.messageId], - ['order_by', request.orderBy ?? 'created_at_desc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', diff --git a/packages/clients/src/api/test/v1/api.gen.ts b/packages/clients/src/api/test/v1/api.gen.ts index 344cff723..152d76e82 100644 --- a/packages/clients/src/api/test/v1/api.gen.ts +++ b/packages/clients/src/api/test/v1/api.gen.ts @@ -38,16 +38,7 @@ const jsonContentHeaders = { /** * Fake API. * - * No Auth Service for end-to-end testing. Test is a fake service that aim to - * manage fake humans. It is used for internal and public end-to-end tests. - * - * This service don't use the Scaleway authentication service but a fake one. It - * allows to use this test service publicly without requiring a Scaleway - * account. - * - * First, you need to register a user with `scw test human register` to get an - * access-key. Then, you can use other test commands by setting the - * SCW_SECRET_KEY env variable. + * No Auth Service for end-to-end testing. */ export class API extends ParentAPI { /** @@ -79,7 +70,7 @@ export class API extends ParentAPI { method: 'GET', path: `/test/v1/humans`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -226,7 +217,7 @@ export class API extends ParentAPI { * @param request - The request {@link SmokeHumanRequest} * @returns A Promise of Human */ - smokeHuman = (request: Readonly = {}) => + smokeHuman = (request: Readonly) => this.client.fetch( { body: '{}', diff --git a/packages/clients/src/api/test/v1/marshalling.gen.ts b/packages/clients/src/api/test/v1/marshalling.gen.ts index 3cccd7b2a..c32dafbc5 100644 --- a/packages/clients/src/api/test/v1/marshalling.gen.ts +++ b/packages/clients/src/api/test/v1/marshalling.gen.ts @@ -16,7 +16,7 @@ import type { UpdateHumanRequest, } from './types.gen' -export const unmarshalHuman = (data: unknown) => { +export const unmarshalHuman = (data: unknown): Human => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Human' failed as data isn't a dictionary.`, @@ -42,7 +42,9 @@ export const unmarshalHuman = (data: unknown) => { } as Human } -export const unmarshalListHumansResponse = (data: unknown) => { +export const unmarshalListHumansResponse = ( + data: unknown, +): ListHumansResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListHumansResponse' failed as data isn't a dictionary.`, @@ -55,7 +57,7 @@ export const unmarshalListHumansResponse = (data: unknown) => { } as ListHumansResponse } -export const unmarshalRegisterResponse = (data: unknown) => { +export const unmarshalRegisterResponse = (data: unknown): RegisterResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'RegisterResponse' failed as data isn't a dictionary.`, @@ -74,7 +76,7 @@ export const marshalCreateHumanRequest = ( ): Record => ({ altitude_in_meter: request.altitudeInMeter, altitude_in_millimeter: request.altitudeInMillimeter, - eyes_color: request.eyesColor ?? 'unknown', + eyes_color: request.eyesColor, fingers_count: request.fingersCount, hair_count: request.hairCount, height: request.height, @@ -82,16 +84,16 @@ export const marshalCreateHumanRequest = ( name: request.name, shoe_size: request.shoeSize, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, ]), }) @@ -108,7 +110,7 @@ export const marshalUpdateHumanRequest = ( ): Record => ({ altitude_in_meter: request.altitudeInMeter, altitude_in_millimeter: request.altitudeInMillimeter, - eyes_color: request.eyesColor ?? 'unknown', + eyes_color: request.eyesColor, fingers_count: request.fingersCount, hair_count: request.hairCount, height: request.height, diff --git a/packages/clients/src/api/test/v1/types.gen.ts b/packages/clients/src/api/test/v1/types.gen.ts index 0eb820951..5d66d340e 100644 --- a/packages/clients/src/api/test/v1/types.gen.ts +++ b/packages/clients/src/api/test/v1/types.gen.ts @@ -40,33 +40,6 @@ export interface Human { projectId: string } -export interface ListHumansResponse { - totalCount: number - humans: Human[] -} - -export interface RegisterResponse { - secretKey: string - accessKey: string -} - -export type RegisterRequest = { - username: string -} - -export type ListHumansRequest = { - page?: number - pageSize?: number - orderBy?: ListHumansRequestOrderBy - organizationId?: string - projectId?: string -} - -export type GetHumanRequest = { - /** UUID of the human you want to get. */ - humanId: string -} - export type CreateHumanRequest = { height: number shoeSize: number @@ -77,8 +50,10 @@ export type CreateHumanRequest = { isHappy: boolean eyesColor?: EyeColors /** - * @deprecated One-of ('projectIdentifier'): at most one of 'organizationId', - * 'projectId' could be set. + * @deprecated + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. */ organizationId?: string name: string @@ -89,26 +64,38 @@ export type CreateHumanRequest = { projectId?: string } -export type UpdateHumanRequest = { - /** UUID of the human you want to update. */ +export type DeleteHumanRequest = { + /** UUID of the human you want to delete. */ humanId: string - /** Height of the human in meters. */ - height?: number - shoeSize?: number - altitudeInMeter?: number - altitudeInMillimeter?: number - fingersCount?: number - hairCount?: number - isHappy?: boolean - eyesColor?: EyeColors - name?: string } -export type DeleteHumanRequest = { - /** UUID of the human you want to delete. */ +export type GetHumanRequest = { + /** UUID of the human you want to get. */ humanId: string } +export type ListHumansRequest = { + page?: number + pageSize?: number + orderBy?: ListHumansRequestOrderBy + organizationId?: string + projectId?: string +} + +export interface ListHumansResponse { + totalCount: number + humans: Human[] +} + +export type RegisterRequest = { + username: string +} + +export interface RegisterResponse { + secretKey: string + accessKey: string +} + export type RunHumanRequest = { /** UUID of the human you want to make run. */ humanId: string @@ -116,5 +103,20 @@ export type RunHumanRequest = { export type SmokeHumanRequest = { /** @deprecated UUID of the human you want to make smoking. */ - humanId?: string + humanId: string +} + +export type UpdateHumanRequest = { + /** UUID of the human you want to update. */ + humanId: string + /** Height of the human in meters. */ + height?: number + shoeSize?: number + altitudeInMeter?: number + altitudeInMillimeter?: number + fingersCount?: number + hairCount?: number + isHappy?: boolean + eyesColor?: EyeColors + name?: string } diff --git a/packages/clients/src/api/vpc/v1/api.gen.ts b/packages/clients/src/api/vpc/v1/api.gen.ts index f7a60c71b..f30148870 100644 --- a/packages/clients/src/api/vpc/v1/api.gen.ts +++ b/packages/clients/src/api/vpc/v1/api.gen.ts @@ -54,7 +54,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['include_regional', request.includeRegional], ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/vpc/v1/marshalling.gen.ts b/packages/clients/src/api/vpc/v1/marshalling.gen.ts index 99ee93f55..a02403e06 100644 --- a/packages/clients/src/api/vpc/v1/marshalling.gen.ts +++ b/packages/clients/src/api/vpc/v1/marshalling.gen.ts @@ -14,7 +14,7 @@ import type { UpdatePrivateNetworkRequest, } from './types.gen' -export const unmarshalPrivateNetwork = (data: unknown) => { +export const unmarshalPrivateNetwork = (data: unknown): PrivateNetwork => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`, @@ -34,7 +34,9 @@ export const unmarshalPrivateNetwork = (data: unknown) => { } as PrivateNetwork } -export const unmarshalListPrivateNetworksResponse = (data: unknown) => { +export const unmarshalListPrivateNetworksResponse = ( + data: unknown, +): ListPrivateNetworksResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPrivateNetworksResponse' failed as data isn't a dictionary.`, diff --git a/packages/clients/src/api/vpc/v1/types.gen.ts b/packages/clients/src/api/vpc/v1/types.gen.ts index c8844e9d0..75847fd3a 100644 --- a/packages/clients/src/api/vpc/v1/types.gen.ts +++ b/packages/clients/src/api/vpc/v1/types.gen.ts @@ -8,12 +8,6 @@ export type ListPrivateNetworksRequestOrderBy = | 'name_asc' | 'name_desc' -export interface ListPrivateNetworksResponse { - privateNetworks: PrivateNetwork[] - totalCount: number -} - -/** Private network. */ export interface PrivateNetwork { /** Private Network ID. */ id: string @@ -35,6 +29,33 @@ export interface PrivateNetwork { subnets: string[] } +export type CreatePrivateNetworkRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Name for the Private Network. */ + name?: string + /** Scaleway Project in which to create the Private Network. */ + projectId?: string + /** Tags for the Private Network. */ + tags?: string[] + /** Private Network subnets CIDR. */ + subnets?: string[] +} + +export type DeletePrivateNetworkRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Private Network ID. */ + privateNetworkId: string +} + +export type GetPrivateNetworkRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Private Network ID. */ + privateNetworkId: string +} + export type ListPrivateNetworksRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone @@ -73,24 +94,9 @@ export type ListPrivateNetworksRequest = { includeRegional?: boolean } -export type CreatePrivateNetworkRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Name for the Private Network. */ - name?: string - /** Scaleway Project in which to create the Private Network. */ - projectId?: string - /** Tags for the Private Network. */ - tags?: string[] - /** Private Network subnets CIDR. */ - subnets?: string[] -} - -export type GetPrivateNetworkRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Private Network ID. */ - privateNetworkId: string +export interface ListPrivateNetworksResponse { + privateNetworks: PrivateNetwork[] + totalCount: number } export type UpdatePrivateNetworkRequest = { @@ -105,10 +111,3 @@ export type UpdatePrivateNetworkRequest = { /** @deprecated Private Network subnets CIDR (deprecated). */ subnets?: string[] } - -export type DeletePrivateNetworkRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Private Network ID. */ - privateNetworkId: string -} diff --git a/packages/clients/src/api/vpc/v2/api.gen.ts b/packages/clients/src/api/vpc/v2/api.gen.ts index 2e020b7ee..609e64ccd 100644 --- a/packages/clients/src/api/vpc/v2/api.gen.ts +++ b/packages/clients/src/api/vpc/v2/api.gen.ts @@ -69,7 +69,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['is_default', request.isDefault], ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -181,7 +181,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['dhcp_enabled', request.dhcpEnabled], ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/vpc/v2/marshalling.gen.ts b/packages/clients/src/api/vpc/v2/marshalling.gen.ts index ee43f70df..ea32e7a03 100644 --- a/packages/clients/src/api/vpc/v2/marshalling.gen.ts +++ b/packages/clients/src/api/vpc/v2/marshalling.gen.ts @@ -27,7 +27,7 @@ import type { VPC, } from './types.gen' -const unmarshalSubnet = (data: unknown) => { +const unmarshalSubnet = (data: unknown): Subnet => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Subnet' failed as data isn't a dictionary.`, @@ -42,7 +42,7 @@ const unmarshalSubnet = (data: unknown) => { } as Subnet } -export const unmarshalPrivateNetwork = (data: unknown) => { +export const unmarshalPrivateNetwork = (data: unknown): PrivateNetwork => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`, @@ -64,7 +64,7 @@ export const unmarshalPrivateNetwork = (data: unknown) => { } as PrivateNetwork } -export const unmarshalVPC = (data: unknown) => { +export const unmarshalVPC = (data: unknown): VPC => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'VPC' failed as data isn't a dictionary.`, @@ -85,27 +85,37 @@ export const unmarshalVPC = (data: unknown) => { } as VPC } -export const unmarshalAddSubnetsResponse = (data: unknown) => { +export const unmarshalAddSubnetsResponse = ( + data: unknown, +): AddSubnetsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'AddSubnetsResponse' failed as data isn't a dictionary.`, ) } - return { subnets: data.subnets } as AddSubnetsResponse + return { + subnets: data.subnets, + } as AddSubnetsResponse } -export const unmarshalDeleteSubnetsResponse = (data: unknown) => { +export const unmarshalDeleteSubnetsResponse = ( + data: unknown, +): DeleteSubnetsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DeleteSubnetsResponse' failed as data isn't a dictionary.`, ) } - return { subnets: data.subnets } as DeleteSubnetsResponse + return { + subnets: data.subnets, + } as DeleteSubnetsResponse } -export const unmarshalListPrivateNetworksResponse = (data: unknown) => { +export const unmarshalListPrivateNetworksResponse = ( + data: unknown, +): ListPrivateNetworksResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPrivateNetworksResponse' failed as data isn't a dictionary.`, @@ -121,7 +131,7 @@ export const unmarshalListPrivateNetworksResponse = (data: unknown) => { } as ListPrivateNetworksResponse } -export const unmarshalListVPCsResponse = (data: unknown) => { +export const unmarshalListVPCsResponse = (data: unknown): ListVPCsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListVPCsResponse' failed as data isn't a dictionary.`, @@ -134,14 +144,18 @@ export const unmarshalListVPCsResponse = (data: unknown) => { } as ListVPCsResponse } -export const unmarshalSetSubnetsResponse = (data: unknown) => { +export const unmarshalSetSubnetsResponse = ( + data: unknown, +): SetSubnetsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetSubnetsResponse' failed as data isn't a dictionary.`, ) } - return { subnets: data.subnets } as SetSubnetsResponse + return { + subnets: data.subnets, + } as SetSubnetsResponse } export const marshalAddSubnetsRequest = ( @@ -184,16 +198,16 @@ export const marshalMigrateZonalPrivateNetworksRequest = ( ): Record => ({ private_network_ids: request.privateNetworkIds, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project_id', - value: request.projectId, - }, { default: defaults.defaultOrganizationId, param: 'organization_id', value: request.organizationId, }, + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, ]), }) diff --git a/packages/clients/src/api/vpc/v2/types.gen.ts b/packages/clients/src/api/vpc/v2/types.gen.ts index 84396fa99..813e786b2 100644 --- a/packages/clients/src/api/vpc/v2/types.gen.ts +++ b/packages/clients/src/api/vpc/v2/types.gen.ts @@ -14,25 +14,17 @@ export type ListVPCsRequestOrderBy = | 'name_asc' | 'name_desc' -export interface AddSubnetsResponse { - subnets: string[] -} - -export interface DeleteSubnetsResponse { - subnets: string[] -} - -export interface ListPrivateNetworksResponse { - privateNetworks: PrivateNetwork[] - totalCount: number -} - -export interface ListVPCsResponse { - vpcs: VPC[] - totalCount: number +export interface Subnet { + /** ID of the subnet. */ + id: string + /** Subnet creation date. */ + createdAt?: Date + /** Subnet last modification date. */ + updatedAt?: Date + /** Subnet CIDR. */ + subnet: string } -/** Private network. */ export interface PrivateNetwork { /** Private Network ID. */ id: string @@ -58,23 +50,6 @@ export interface PrivateNetwork { dhcpEnabled: boolean } -export interface SetSubnetsResponse { - subnets: string[] -} - -/** Subnet. */ -export interface Subnet { - /** ID of the subnet. */ - id: string - /** Subnet creation date. */ - createdAt?: Date - /** Subnet last modification date. */ - updatedAt?: Date - /** Subnet CIDR. */ - subnet: string -} - -/** Vpc. */ export interface VPC { /** VPC ID. */ id: string @@ -98,43 +73,38 @@ export interface VPC { privateNetworkCount: number } -export type ListVPCsRequest = { +export type AddSubnetsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Sort order of the returned VPCs. */ - orderBy?: ListVPCsRequestOrderBy - /** Page number to return, from the paginated results. */ - page?: number - /** Maximum number of VPCs to return per page. */ - pageSize?: number + /** Private Network ID. */ + privateNetworkId: string + /** Private Network subnets CIDR. */ + subnets?: string[] +} + +export interface AddSubnetsResponse { + subnets: string[] +} + +export type CreatePrivateNetworkRequest = { /** - * Name to filter for. Only VPCs with names containing this string will be - * returned. + * Region to target. If none is passed will use default region from the + * config. */ + region?: Region + /** Name for the Private Network. */ name?: string - /** - * Tags to filter for. Only VPCs with one more more matching tags will be - * returned. - */ - tags?: string[] - /** - * Organization ID to filter for. Only VPCs belonging to this Organization - * will be returned. - */ - organizationId?: string - /** - * Project ID to filter for. Only VPCs belonging to this Project will be - * returned. - */ + /** Scaleway Project in which to create the Private Network. */ projectId?: string - /** - * Defines whether to filter only for VPCs which are the default one for their - * Project. - */ - isDefault?: boolean + /** Tags for the Private Network. */ + tags?: string[] + /** Private Network subnets CIDR. */ + subnets?: string[] + /** VPC in which to create the Private Network. */ + vpcId?: string } export type CreateVPCRequest = { @@ -151,17 +121,33 @@ export type CreateVPCRequest = { tags?: string[] } -export type GetVPCRequest = { +export type DeletePrivateNetworkRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** VPC ID. */ - vpcId: string + /** Private Network ID. */ + privateNetworkId: string } -export type UpdateVPCRequest = { +export type DeleteSubnetsRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Private Network ID. */ + privateNetworkId: string + /** Private Network subnets CIDR. */ + subnets?: string[] +} + +export interface DeleteSubnetsResponse { + subnets: string[] +} + +export type DeleteVPCRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -169,13 +155,29 @@ export type UpdateVPCRequest = { region?: Region /** VPC ID. */ vpcId: string - /** Name for the VPC. */ - name?: string - /** Tags for the VPC. */ - tags?: string[] } -export type DeleteVPCRequest = { +export type EnableDHCPRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Private Network ID. */ + privateNetworkId: string +} + +export type GetPrivateNetworkRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Private Network ID. */ + privateNetworkId: string +} + +export type GetVPCRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -234,56 +236,53 @@ export type ListPrivateNetworksRequest = { dhcpEnabled?: boolean } -export type CreatePrivateNetworkRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Name for the Private Network. */ - name?: string - /** Scaleway Project in which to create the Private Network. */ - projectId?: string - /** Tags for the Private Network. */ - tags?: string[] - /** Private Network subnets CIDR. */ - subnets?: string[] - /** VPC in which to create the Private Network. */ - vpcId?: string +export interface ListPrivateNetworksResponse { + privateNetworks: PrivateNetwork[] + totalCount: number } -export type GetPrivateNetworkRequest = { +export type ListVPCsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Private Network ID. */ - privateNetworkId: string -} - -export type UpdatePrivateNetworkRequest = { + /** Sort order of the returned VPCs. */ + orderBy?: ListVPCsRequestOrderBy + /** Page number to return, from the paginated results. */ + page?: number + /** Maximum number of VPCs to return per page. */ + pageSize?: number /** - * Region to target. If none is passed will use default region from the - * config. + * Name to filter for. Only VPCs with names containing this string will be + * returned. */ - region?: Region - /** Private Network ID. */ - privateNetworkId: string - /** Name for the Private Network. */ name?: string - /** Tags for the Private Network. */ + /** + * Tags to filter for. Only VPCs with one more more matching tags will be + * returned. + */ tags?: string[] -} - -export type DeletePrivateNetworkRequest = { /** - * Region to target. If none is passed will use default region from the - * config. + * Organization ID to filter for. Only VPCs belonging to this Organization + * will be returned. */ - region?: Region - /** Private Network ID. */ - privateNetworkId: string + organizationId?: string + /** + * Project ID to filter for. Only VPCs belonging to this Project will be + * returned. + */ + projectId?: string + /** + * Defines whether to filter only for VPCs which are the default one for their + * Project. + */ + isDefault?: boolean +} + +export interface ListVPCsResponse { + vpcs: VPC[] + totalCount: number } export type MigrateZonalPrivateNetworksRequest = { @@ -312,16 +311,6 @@ export type MigrateZonalPrivateNetworksRequest = { privateNetworkIds?: string[] } -export type EnableDHCPRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Private Network ID. */ - privateNetworkId: string -} - export type SetSubnetsRequest = { /** * Region to target. If none is passed will use default region from the @@ -334,7 +323,11 @@ export type SetSubnetsRequest = { subnets?: string[] } -export type AddSubnetsRequest = { +export interface SetSubnetsResponse { + subnets: string[] +} + +export type UpdatePrivateNetworkRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -342,18 +335,22 @@ export type AddSubnetsRequest = { region?: Region /** Private Network ID. */ privateNetworkId: string - /** Private Network subnets CIDR. */ - subnets?: string[] + /** Name for the Private Network. */ + name?: string + /** Tags for the Private Network. */ + tags?: string[] } -export type DeleteSubnetsRequest = { +export type UpdateVPCRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Private Network ID. */ - privateNetworkId: string - /** Private Network subnets CIDR. */ - subnets?: string[] + /** VPC ID. */ + vpcId: string + /** Name for the VPC. */ + name?: string + /** Tags for the VPC. */ + tags?: string[] } diff --git a/packages/clients/src/api/vpcgw/v1/api.gen.ts b/packages/clients/src/api/vpcgw/v1/api.gen.ts index 2ce785491..fb4007bc0 100644 --- a/packages/clients/src/api/vpcgw/v1/api.gen.ts +++ b/packages/clients/src/api/vpcgw/v1/api.gen.ts @@ -125,7 +125,7 @@ export class API extends ParentAPI { )}/gateways`, urlParams: urlParams( ['name', request.name], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -134,7 +134,7 @@ export class API extends ParentAPI { ], ['private_network_id', request.privateNetworkId], ['project_id', request.projectId], - ['status', request.status ?? 'unknown'], + ['status', request.status], ['tags', request.tags], ['type', request.type], ), @@ -297,14 +297,14 @@ export class API extends ParentAPI { ['dhcp_id', request.dhcpId], ['enable_masquerade', request.enableMasquerade], ['gateway_id', request.gatewayId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', request.pageSize ?? this.client.settings.defaultPageSize, ], ['private_network_id', request.privateNetworkId], - ['status', request.status ?? 'unknown'], + ['status', request.status], ), }, unmarshalListGatewayNetworksResponse, @@ -463,7 +463,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['address', request.address], ['has_address', request.hasAddress], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -598,13 +598,13 @@ export class API extends ParentAPI { ['hostname', request.hostname], ['ip_address', request.ipAddress], ['mac_address', request.macAddress], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', request.pageSize ?? this.client.settings.defaultPageSize, ], - ['type', request.type ?? 'unknown'], + ['type', request.type], ), }, unmarshalListDHCPEntriesResponse, @@ -750,14 +750,14 @@ export class API extends ParentAPI { )}/pat-rules`, urlParams: urlParams( ['gateway_id', request.gatewayId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', request.pageSize ?? this.client.settings.defaultPageSize, ], ['private_ip', request.privateIp], - ['protocol', request.protocol ?? 'unknown'], + ['protocol', request.protocol], ), }, unmarshalListPATRulesResponse, @@ -913,7 +913,7 @@ export class API extends ParentAPI { )}/ips`, urlParams: urlParams( ['is_free', request.isFree], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/webhosting/v1alpha1/api.gen.ts b/packages/clients/src/api/webhosting/v1alpha1/api.gen.ts index 607805398..819eeda9c 100644 --- a/packages/clients/src/api/webhosting/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/webhosting/v1alpha1/api.gen.ts @@ -76,7 +76,7 @@ export class API extends ParentAPI { )}/hostings`, urlParams: urlParams( ['domain', request.domain], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ @@ -251,7 +251,7 @@ export class API extends ParentAPI { urlParams: urlParams( ['hosting_id', request.hostingId], ['only_options', request.onlyOptions], - ['order_by', request.orderBy ?? 'price_asc'], + ['order_by', request.orderBy], ['without_options', request.withoutOptions], ), }, diff --git a/packages/clients/src/api/webhosting/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/webhosting/v1alpha1/marshalling.gen.ts index a097ed15d..ab79f3ba5 100644 --- a/packages/clients/src/api/webhosting/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/webhosting/v1alpha1/marshalling.gen.ts @@ -22,7 +22,7 @@ import type { UpdateHostingRequest, } from './types.gen' -const unmarshalHostingCpanelUrls = (data: unknown) => { +const unmarshalHostingCpanelUrls = (data: unknown): HostingCpanelUrls => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'HostingCpanelUrls' failed as data isn't a dictionary.`, @@ -35,55 +35,20 @@ const unmarshalHostingCpanelUrls = (data: unknown) => { } as HostingCpanelUrls } -const unmarshalHostingOption = (data: unknown) => { +const unmarshalHostingOption = (data: unknown): HostingOption => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'HostingOption' failed as data isn't a dictionary.`, ) } - return { id: data.id, name: data.name } as HostingOption -} - -const unmarshalOfferProduct = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'OfferProduct' failed as data isn't a dictionary.`, - ) - } - - return { - databasesQuota: data.databases_quota, - emailAccountsQuota: data.email_accounts_quota, - emailStorageQuota: data.email_storage_quota, - hostingStorageQuota: data.hosting_storage_quota, - maxAddonDomains: data.max_addon_domains, - name: data.name, - option: data.option, - ram: data.ram, - supportIncluded: data.support_included, - vCpu: data.v_cpu, - } as OfferProduct -} - -const unmarshalDnsRecord = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DnsRecord' failed as data isn't a dictionary.`, - ) - } - return { + id: data.id, name: data.name, - priority: data.priority, - status: data.status, - ttl: data.ttl, - type: data.type, - value: data.value, - } as DnsRecord + } as HostingOption } -export const unmarshalHosting = (data: unknown) => { +export const unmarshalHosting = (data: unknown): Hosting => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Hosting' failed as data isn't a dictionary.`, @@ -114,39 +79,38 @@ export const unmarshalHosting = (data: unknown) => { } as Hosting } -const unmarshalNameserver = (data: unknown) => { +const unmarshalDnsRecord = (data: unknown): DnsRecord => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Nameserver' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DnsRecord' failed as data isn't a dictionary.`, ) } return { - hostname: data.hostname, - isDefault: data.is_default, + name: data.name, + priority: data.priority, status: data.status, - } as Nameserver + ttl: data.ttl, + type: data.type, + value: data.value, + } as DnsRecord } -const unmarshalOffer = (data: unknown) => { +const unmarshalNameserver = (data: unknown): Nameserver => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Offer' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Nameserver' failed as data isn't a dictionary.`, ) } return { - available: data.available, - billingOperationPath: data.billing_operation_path, - endOfLife: data.end_of_life, - id: data.id, - price: data.price ? unmarshalMoney(data.price) : undefined, - product: data.product ? unmarshalOfferProduct(data.product) : undefined, - quotaWarnings: data.quota_warnings, - } as Offer + hostname: data.hostname, + isDefault: data.is_default, + status: data.status, + } as Nameserver } -export const unmarshalDnsRecords = (data: unknown) => { +export const unmarshalDnsRecords = (data: unknown): DnsRecords => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DnsRecords' failed as data isn't a dictionary.`, @@ -160,7 +124,9 @@ export const unmarshalDnsRecords = (data: unknown) => { } as DnsRecords } -export const unmarshalListHostingsResponse = (data: unknown) => { +export const unmarshalListHostingsResponse = ( + data: unknown, +): ListHostingsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListHostingsResponse' failed as data isn't a dictionary.`, @@ -173,7 +139,48 @@ export const unmarshalListHostingsResponse = (data: unknown) => { } as ListHostingsResponse } -export const unmarshalListOffersResponse = (data: unknown) => { +const unmarshalOfferProduct = (data: unknown): OfferProduct => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferProduct' failed as data isn't a dictionary.`, + ) + } + + return { + databasesQuota: data.databases_quota, + emailAccountsQuota: data.email_accounts_quota, + emailStorageQuota: data.email_storage_quota, + hostingStorageQuota: data.hosting_storage_quota, + maxAddonDomains: data.max_addon_domains, + name: data.name, + option: data.option, + ram: data.ram, + supportIncluded: data.support_included, + vCpu: data.v_cpu, + } as OfferProduct +} + +const unmarshalOffer = (data: unknown): Offer => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Offer' failed as data isn't a dictionary.`, + ) + } + + return { + available: data.available, + billingOperationPath: data.billing_operation_path, + endOfLife: data.end_of_life, + id: data.id, + price: data.price ? unmarshalMoney(data.price) : undefined, + product: data.product ? unmarshalOfferProduct(data.product) : undefined, + quotaWarnings: data.quota_warnings, + } as Offer +} + +export const unmarshalListOffersResponse = ( + data: unknown, +): ListOffersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListOffersResponse' failed as data isn't a dictionary.`, diff --git a/packages/clients/src/api/webhosting/v1alpha1/types.gen.ts b/packages/clients/src/api/webhosting/v1alpha1/types.gen.ts index 91d584332..26b264110 100644 --- a/packages/clients/src/api/webhosting/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/webhosting/v1alpha1/types.gen.ts @@ -38,7 +38,41 @@ export type OfferQuotaWarning = | 'database_count_exceeded' | 'disk_usage_exceeded' -/** Dns record. */ +export interface HostingCpanelUrls { + dashboard: string + webmail: string +} + +export interface HostingOption { + /** Option ID. */ + id: string + /** Option name. */ + name: string +} + +export interface OfferProduct { + /** Product name. */ + name: string + /** Product option. */ + option: boolean + /** Limit number of email accounts. */ + emailAccountsQuota: number + /** Limit quantity of email storage in gigabytes. */ + emailStorageQuota: number + /** Limit number of databases. */ + databasesQuota: number + /** Limit quantity of hosting storage in gigabytes. */ + hostingStorageQuota: number + /** Whether or not support is included. */ + supportIncluded: boolean + /** Limit number of virtual CPU. */ + vCpu: number + /** Limit quantity of memory in gigabytes. */ + ram: number + /** Limit number of add-on domains. */ + maxAddonDomains: number +} + export interface DnsRecord { /** Record name. */ name: string @@ -54,17 +88,15 @@ export interface DnsRecord { status: DnsRecordStatus } -/** Dns records. */ -export interface DnsRecords { - /** List of DNS records. */ - records: DnsRecord[] - /** List of nameservers. */ - nameServers: Nameserver[] - /** Status of the records. */ - status: DnsRecordsStatus +export interface Nameserver { + /** Hostname of the nameserver. */ + hostname: string + /** Status of the nameserver. */ + status: NameserverStatus + /** Defines whether the nameserver is the default one. */ + isDefault: boolean } -/** Hosting. */ export interface Hosting { /** ID of the Web Hosting plan. */ id: string @@ -104,44 +136,6 @@ export interface Hosting { region: Region } -export interface HostingCpanelUrls { - dashboard: string - webmail: string -} - -/** Hosting. option. */ -export interface HostingOption { - /** Option ID. */ - id: string - /** Option name. */ - name: string -} - -/** List hostings response. */ -export interface ListHostingsResponse { - /** Number of Web Hosting plans returned. */ - totalCount: number - /** List of Web Hosting plans. */ - hostings: Hosting[] -} - -/** List offers response. */ -export interface ListOffersResponse { - /** List of offers. */ - offers: Offer[] -} - -/** Nameserver. */ -export interface Nameserver { - /** Hostname of the nameserver. */ - hostname: string - /** Status of the nameserver. */ - status: NameserverStatus - /** Defines whether the nameserver is the default one. */ - isDefault: boolean -} - -/** Offer. */ export interface Offer { /** Offer ID. */ id: string @@ -162,30 +156,6 @@ export interface Offer { endOfLife: boolean } -/** Offer. product. */ -export interface OfferProduct { - /** Product name. */ - name: string - /** Product option. */ - option: boolean - /** Limit number of email accounts. */ - emailAccountsQuota: number - /** Limit quantity of email storage in gigabytes. */ - emailStorageQuota: number - /** Limit number of databases. */ - databasesQuota: number - /** Limit quantity of hosting storage in gigabytes. */ - hostingStorageQuota: number - /** Whether or not support is included. */ - supportIncluded: boolean - /** Limit number of virtual CPU. */ - vCpu: number - /** Limit quantity of memory in gigabytes. */ - ram: number - /** Limit number of add-on domains. */ - maxAddonDomains: number -} - export type CreateHostingRequest = { /** * Region to target. If none is passed will use default region from the @@ -209,6 +179,45 @@ export type CreateHostingRequest = { optionIds?: string[] } +export type DeleteHostingRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Hosting ID. */ + hostingId: string +} + +export interface DnsRecords { + /** List of DNS records. */ + records: DnsRecord[] + /** List of nameservers. */ + nameServers: Nameserver[] + /** Status of the records. */ + status: DnsRecordsStatus +} + +export type GetDomainDnsRecordsRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Domain associated with the DNS records. */ + domain: string +} + +export type GetHostingRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Hosting ID. */ + hostingId: string +} + export type ListHostingsRequest = { /** * Region to target. If none is passed will use default region from the @@ -254,42 +263,41 @@ export type ListHostingsRequest = { organizationId?: string } -export type GetHostingRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Hosting ID. */ - hostingId: string +export interface ListHostingsResponse { + /** Number of Web Hosting plans returned. */ + totalCount: number + /** List of Web Hosting plans. */ + hostings: Hosting[] } -export type UpdateHostingRequest = { +export type ListOffersRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Hosting ID. */ - hostingId: string - /** New contact email for the Web Hosting plan. */ - email?: string - /** New tags for the Web Hosting plan. */ - tags?: string[] - /** IDs of the new options for the Web Hosting plan. */ - optionIds?: string[] - /** ID of the new offer for the Web Hosting plan. */ - offerId?: string -} - -export type DeleteHostingRequest = { + /** Sort order of offers in the response. */ + orderBy?: ListOffersRequestOrderBy /** - * Region to target. If none is passed will use default region from the - * config. + * Defines whether the response should consist of offers only, without + * options. */ - region?: Region - /** Hosting ID. */ - hostingId: string + withoutOptions: boolean + /** + * Defines whether the response should consist of options only, without + * offers. + */ + onlyOptions: boolean + /** + * ID of a Web Hosting plan, to check compatibility with returned offers (in + * case of wanting to update the plan). + */ + hostingId?: string +} + +export interface ListOffersResponse { + /** List of offers. */ + offers: Offer[] } export type RestoreHostingRequest = { @@ -302,37 +310,20 @@ export type RestoreHostingRequest = { hostingId: string } -export type GetDomainDnsRecordsRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Domain associated with the DNS records. */ - domain: string -} - -export type ListOffersRequest = { +export type UpdateHostingRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Sort order of offers in the response. */ - orderBy?: ListOffersRequestOrderBy - /** - * Defines whether the response should consist of offers only, without - * options. - */ - withoutOptions: boolean - /** - * Defines whether the response should consist of options only, without - * offers. - */ - onlyOptions: boolean - /** - * ID of a Web Hosting plan, to check compatibility with returned offers (in - * case of wanting to update the plan). - */ - hostingId?: string + /** Hosting ID. */ + hostingId: string + /** New contact email for the Web Hosting plan. */ + email?: string + /** New tags for the Web Hosting plan. */ + tags?: string[] + /** IDs of the new options for the Web Hosting plan. */ + optionIds?: string[] + /** ID of the new offer for the Web Hosting plan. */ + offerId?: string } diff --git a/packages/clients/src/scw/constants.ts b/packages/clients/src/scw/constants.ts index 506024456..53678feaa 100644 --- a/packages/clients/src/scw/constants.ts +++ b/packages/clients/src/scw/constants.ts @@ -1,3 +1,3 @@ -export const version = 'v1.42.0' +export const version = 'v2.0.0-alpha.15' export const userAgent = `scaleway-sdk-js/${version}` From d32b6eeca6300e03b4a5bb762f8ded40adcbf176 Mon Sep 17 00:00:00 2001 From: Vincent Germain Date: Tue, 31 Oct 2023 10:40:26 +0100 Subject: [PATCH 02/10] feat: generation --- .../src/api/billing/v2alpha1/api.gen.ts | 2 +- .../api/billing/v2alpha1/marshalling.gen.ts | 101 +- .../src/api/billing/v2alpha1/types.gen.ts | 134 +- .../src/api/cockpit/v1beta1/types.gen.ts | 437 ++-- .../api/container/v1beta1/marshalling.gen.ts | 377 +-- .../src/api/container/v1beta1/types.gen.ts | 827 +++--- .../api/function/v1beta1/marshalling.gen.ts | 471 ++-- .../src/api/function/v1beta1/types.gen.ts | 795 +++--- .../clients/src/api/iam/v1alpha1/api.gen.ts | 6 +- .../src/api/iam/v1alpha1/marshalling.gen.ts | 275 +- .../clients/src/api/iam/v1alpha1/types.gen.ts | 941 ++++--- .../src/api/instance/v1/marshalling.gen.ts | 1842 ++++++------- .../clients/src/api/instance/v1/types.gen.ts | 2279 +++++++++-------- .../src/api/ipfs/v1alpha1/marshalling.gen.ts | 74 +- .../src/api/ipfs/v1alpha1/types.gen.ts | 286 ++- .../clients/src/api/rdb/v1/marshalling.gen.ts | 919 +++---- packages/clients/src/api/rdb/v1/types.gen.ts | 1692 ++++++------ .../api/secret/v1alpha1/marshalling.gen.ts | 2 +- .../src/api/secret/v1alpha1/types.gen.ts | 15 +- .../src/api/tem/v1alpha1/marshalling.gen.ts | 187 +- .../clients/src/api/tem/v1alpha1/types.gen.ts | 419 ++- .../src/api/vpcgw/v1/marshalling.gen.ts | 210 +- .../clients/src/api/vpcgw/v1/types.gen.ts | 1072 ++++---- 23 files changed, 6764 insertions(+), 6599 deletions(-) diff --git a/packages/clients/src/api/billing/v2alpha1/api.gen.ts b/packages/clients/src/api/billing/v2alpha1/api.gen.ts index c4de6f1e4..74d595099 100644 --- a/packages/clients/src/api/billing/v2alpha1/api.gen.ts +++ b/packages/clients/src/api/billing/v2alpha1/api.gen.ts @@ -106,7 +106,7 @@ export class API extends ParentAPI { method: 'GET', path: `/billing/v2alpha1/discounts`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'creation_date_desc'], + ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], [ diff --git a/packages/clients/src/api/billing/v2alpha1/marshalling.gen.ts b/packages/clients/src/api/billing/v2alpha1/marshalling.gen.ts index 7d379d15d..01827c290 100644 --- a/packages/clients/src/api/billing/v2alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/billing/v2alpha1/marshalling.gen.ts @@ -17,27 +17,68 @@ import type { ListInvoicesResponse, } from './types.gen' -const unmarshalDiscountCoupon = (data: unknown) => { +const unmarshalGetConsumptionResponseConsumption = ( + data: unknown, +): GetConsumptionResponseConsumption => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetConsumptionResponseConsumption' failed as data isn't a dictionary.`, + ) + } + + return { + category: data.category, + description: data.description, + operationPath: data.operation_path, + projectId: data.project_id, + value: data.value ? unmarshalMoney(data.value) : undefined, + } as GetConsumptionResponseConsumption +} + +export const unmarshalGetConsumptionResponse = ( + data: unknown, +): GetConsumptionResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetConsumptionResponse' failed as data isn't a dictionary.`, + ) + } + + return { + consumptions: unmarshalArrayOfObject( + data.consumptions, + unmarshalGetConsumptionResponseConsumption, + ), + updatedAt: unmarshalDate(data.updated_at), + } as GetConsumptionResponse +} + +const unmarshalDiscountCoupon = (data: unknown): DiscountCoupon => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary.`, ) } - return { description: data.description } as DiscountCoupon + return { + description: data.description, + } as DiscountCoupon } -const unmarshalDiscountFilter = (data: unknown) => { +const unmarshalDiscountFilter = (data: unknown): DiscountFilter => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary.`, ) } - return { type: data.type, value: data.value } as DiscountFilter + return { + type: data.type, + value: data.value, + } as DiscountFilter } -const unmarshalDiscount = (data: unknown) => { +const unmarshalDiscount = (data: unknown): Discount => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Discount' failed as data isn't a dictionary.`, @@ -60,23 +101,22 @@ const unmarshalDiscount = (data: unknown) => { } as Discount } -const unmarshalGetConsumptionResponseConsumption = (data: unknown) => { +export const unmarshalListDiscountsResponse = ( + data: unknown, +): ListDiscountsResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'GetConsumptionResponseConsumption' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`, ) } return { - category: data.category, - description: data.description, - operationPath: data.operation_path, - projectId: data.project_id, - value: data.value ? unmarshalMoney(data.value) : undefined, - } as GetConsumptionResponseConsumption + discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount), + totalCount: data.total_count, + } as ListDiscountsResponse } -const unmarshalInvoice = (data: unknown) => { +const unmarshalInvoice = (data: unknown): Invoice => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Invoice' failed as data isn't a dictionary.`, @@ -97,36 +137,9 @@ const unmarshalInvoice = (data: unknown) => { } as Invoice } -export const unmarshalGetConsumptionResponse = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'GetConsumptionResponse' failed as data isn't a dictionary.`, - ) - } - - return { - consumptions: unmarshalArrayOfObject( - data.consumptions, - unmarshalGetConsumptionResponseConsumption, - ), - updatedAt: unmarshalDate(data.updated_at), - } as GetConsumptionResponse -} - -export const unmarshalListDiscountsResponse = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`, - ) - } - - return { - discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount), - totalCount: data.total_count, - } as ListDiscountsResponse -} - -export const unmarshalListInvoicesResponse = (data: unknown) => { +export const unmarshalListInvoicesResponse = ( + data: unknown, +): ListInvoicesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`, diff --git a/packages/clients/src/api/billing/v2alpha1/types.gen.ts b/packages/clients/src/api/billing/v2alpha1/types.gen.ts index 267989617..1b5e8b9f1 100644 --- a/packages/clients/src/api/billing/v2alpha1/types.gen.ts +++ b/packages/clients/src/api/billing/v2alpha1/types.gen.ts @@ -41,7 +41,31 @@ export type ListInvoicesRequestOrderBy = | 'invoice_type_desc' | 'invoice_type_asc' -/** Discount. */ +export interface DiscountCoupon { + /** The description of the coupon. */ + description?: string +} + +export interface DiscountFilter { + /** Type of the filter. */ + type: DiscountFilterType + /** Value of filter, it can be a product/range/region/zone value. */ + value: string +} + +export interface GetConsumptionResponseConsumption { + /** Monetary value of the consumption. */ + value?: Money + /** Description of the consumption. */ + description: string + /** Project ID of the consumption. */ + projectId: string + /** Category of the consumption. */ + category: string + /** Unique identifier of the product. */ + operationPath: string +} + export interface Discount { /** The ID of the discount. */ id: string @@ -69,43 +93,6 @@ export interface Discount { filters: DiscountFilter[] } -/** Discount. coupon. */ -export interface DiscountCoupon { - /** The description of the coupon. */ - description?: string -} - -/** Discount. filter. */ -export interface DiscountFilter { - /** Type of the filter. */ - type: DiscountFilterType - /** Value of filter, it can be a product/range/region/zone value. */ - value: string -} - -/** Get consumption response. */ -export interface GetConsumptionResponse { - /** Detailed consumption list. */ - consumptions: GetConsumptionResponseConsumption[] - /** Last consumption update date. */ - updatedAt?: Date -} - -/** Get consumption response. consumption. */ -export interface GetConsumptionResponseConsumption { - /** Monetary value of the consumption. */ - value?: Money - /** Description of the consumption. */ - description: string - /** Project ID of the consumption. */ - projectId: string - /** Category of the consumption. */ - category: string - /** Unique identifier of the product. */ - operationPath: string -} - -/** Invoice. */ export interface Invoice { /** Invoice ID. */ id: string @@ -125,20 +112,11 @@ export interface Invoice { number: number } -/** List discounts response. */ -export interface ListDiscountsResponse { - /** Total number of discounts. */ - totalCount: number - /** Paginated returned discounts. */ - discounts: Discount[] -} - -/** List invoices response. */ -export interface ListInvoicesResponse { - /** Total number of invoices. */ - totalCount: number - /** Paginated returned invoices. */ - invoices: Invoice[] +export type DownloadInvoiceRequest = { + /** Invoice ID. */ + invoiceId: string + /** Wanted file type. */ + fileType?: DownloadInvoiceRequestFileType } export type GetConsumptionRequest = { @@ -146,6 +124,34 @@ export type GetConsumptionRequest = { organizationId?: string } +export interface GetConsumptionResponse { + /** Detailed consumption list. */ + consumptions: GetConsumptionResponseConsumption[] + /** Last consumption update date. */ + updatedAt?: Date +} + +export type ListDiscountsRequest = { + /** Order discounts in the response by their description. */ + orderBy?: ListDiscountsRequestOrderBy + /** Positive integer to choose the page to return. */ + page?: number + /** + * Positive integer lower or equal to 100 to select the number of items to + * return. + */ + pageSize?: number + /** ID of the organization. */ + organizationId?: string +} + +export interface ListDiscountsResponse { + /** Total number of discounts. */ + totalCount: number + /** Paginated returned discounts. */ + discounts: Discount[] +} + export type ListInvoicesRequest = { /** * Organization ID to filter for, only invoices from this Organization will be @@ -169,23 +175,9 @@ export type ListInvoicesRequest = { orderBy?: ListInvoicesRequestOrderBy } -export type DownloadInvoiceRequest = { - /** Invoice ID. */ - invoiceId: string - /** Wanted file type. */ - fileType?: DownloadInvoiceRequestFileType -} - -export type ListDiscountsRequest = { - /** Order discounts in the response by their description. */ - orderBy?: ListDiscountsRequestOrderBy - /** Positive integer to choose the page to return. */ - page?: number - /** - * Positive integer lower or equal to 100 to select the number of items to - * return. - */ - pageSize?: number - /** ID of the organization. */ - organizationId?: string +export interface ListInvoicesResponse { + /** Total number of invoices. */ + totalCount: number + /** Paginated returned invoices. */ + invoices: Invoice[] } diff --git a/packages/clients/src/api/cockpit/v1beta1/types.gen.ts b/packages/clients/src/api/cockpit/v1beta1/types.gen.ts index 3cb527e98..478d4ac07 100644 --- a/packages/clients/src/api/cockpit/v1beta1/types.gen.ts +++ b/packages/clients/src/api/cockpit/v1beta1/types.gen.ts @@ -37,25 +37,31 @@ export type ListTokensRequestOrderBy = export type PlanName = 'unknown_name' | 'free' | 'premium' | 'custom' -/** Cockpit. */ -export interface Cockpit { - /** ID of the Project the Cockpit belongs to. */ - projectId: string - /** Date and time of the Cockpit's creation. */ - createdAt?: Date - /** Date and time of the Cockpit's last update. */ - updatedAt?: Date - /** Endpoints of the Cockpit. */ - endpoints?: CockpitEndpoints - /** Status of the Cockpit. */ - status: CockpitStatus - /** Specifies whether managed alerts are enabled or disabled. */ - managedAlertsEnabled: boolean - /** Pricing plan information. */ - plan?: Plan +export interface ContactPointEmail { + to: string +} + +export interface TokenScopes { + /** Permission to fetch metrics. */ + queryMetrics: boolean + /** Permission to write metrics. */ + writeMetrics: boolean + /** Permission to setup metrics rules. */ + setupMetricsRules: boolean + /** Permission to fetch logs. */ + queryLogs: boolean + /** Permission to write logs. */ + writeLogs: boolean + /** Permission to set up logs rules. */ + setupLogsRules: boolean + /** Permission to set up alerts. */ + setupAlerts: boolean + /** Permission to fetch traces. */ + queryTraces: boolean + /** Permission to write traces. */ + writeTraces: boolean } -/** Cockpit. endpoints. */ export interface CockpitEndpoints { /** URL for metrics. */ metricsUrl: string @@ -69,10 +75,26 @@ export interface CockpitEndpoints { grafanaUrl: string } -/** Metrics for a given Cockpit. Cockpit metrics. */ -export interface CockpitMetrics { - /** Time series array. */ - timeseries: TimeSeries[] +/** Pricing plan. */ +export interface Plan { + /** ID of a given pricing plan. */ + id: string + /** Name of a given pricing plan. */ + name: PlanName + /** Interval of time during which Scaleway's Cockpit keeps your metrics. */ + retentionMetricsInterval?: string + /** Interval of time during which Scaleway's Cockpit keeps your logs. */ + retentionLogsInterval?: string + /** Interval of time during which Scaleway's Cockpit keeps your traces. */ + retentionTracesInterval?: string + /** Ingestion price in cents for 1 million samples. */ + sampleIngestionPrice: number + /** Ingestion price in cents for 1 GB of logs. */ + logsIngestionPrice: number + /** Ingestion price in cents for 1 GB of traces. */ + tracesIngestionPrice: number + /** Retention price in euros per month. */ + retentionPrice: number } /** Contact point. */ @@ -85,10 +107,6 @@ export interface ContactPoint { email?: ContactPointEmail } -export interface ContactPointEmail { - to: string -} - /** Datasource. */ export interface Datasource { /** ID of the datasource. */ @@ -103,7 +121,7 @@ export interface Datasource { type: DatasourceType } -/** Grafana dashboard. Grafana product dashboard. */ +/** Grafana dashboard. */ export interface GrafanaProductDashboard { /** Name of the dashboard. */ dashboardName: string @@ -129,90 +147,6 @@ export interface GrafanaUser { password?: string } -/** Response returned when listing contact points. List contact points response. */ -export interface ListContactPointsResponse { - /** Count of all contact points created. */ - totalCount: number - /** Array of contact points. */ - contactPoints: ContactPoint[] - /** - * Specifies whether the contact point has other receivers than the default - * receiver. - */ - hasAdditionalReceivers: boolean - /** Specifies whether there are unmanaged contact points. */ - hasAdditionalContactPoints: boolean -} - -/** List datasources response. */ -export interface ListDatasourcesResponse { - /** Count of all datasources corresponding to the request. */ - totalCount: number - /** List of the datasources within the pagination. */ - datasources: Datasource[] -} - -/** - * Response returned when getting a list of dashboards. List grafana product - * dashboards response. - */ -export interface ListGrafanaProductDashboardsResponse { - /** Count of grafana dasboards. */ - totalCount: number - /** Information on grafana dashboards. */ - dashboards: GrafanaProductDashboard[] -} - -/** Response returned when listing Grafana users. List grafana users response. */ -export interface ListGrafanaUsersResponse { - /** Count of all Grafana users. */ - totalCount: number - /** Information on all Grafana users. */ - grafanaUsers: GrafanaUser[] -} - -/** Response returned when listing all pricing plans. List plans response. */ -export interface ListPlansResponse { - /** Count of all pricing plans. */ - totalCount: number - /** Information on plans. */ - plans: Plan[] -} - -/** List tokens response. */ -export interface ListTokensResponse { - /** Count of all tokens created. */ - totalCount: number - /** List of all tokens created. */ - tokens: Token[] -} - -/** Pricing plan. Plan. */ -export interface Plan { - /** ID of a given pricing plan. */ - id: string - /** Name of a given pricing plan. */ - name: PlanName - /** Interval of time during which Scaleway's Cockpit keeps your metrics. */ - retentionMetricsInterval?: string - /** Interval of time during which Scaleway's Cockpit keeps your logs. */ - retentionLogsInterval?: string - /** Interval of time during which Scaleway's Cockpit keeps your traces. */ - retentionTracesInterval?: string - /** Ingestion price in cents for 1 million samples. */ - sampleIngestionPrice: number - /** Ingestion price in cents for 1 GB of logs. */ - logsIngestionPrice: number - /** Ingestion price in cents for 1 GB of traces. */ - tracesIngestionPrice: number - /** Retention price in euros per month. */ - retentionPrice: number -} - -/** Response returned when selecting a pricing plan. Select plan response. */ -export interface SelectPlanResponse {} - -/** Token. */ export interface Token { /** ID of the token. */ id: string @@ -230,59 +164,44 @@ export interface Token { secretKey?: string } -/** Token scopes. */ -export interface TokenScopes { - /** Permission to fetch metrics. */ - queryMetrics: boolean - /** Permission to write metrics. */ - writeMetrics: boolean - /** Permission to setup metrics rules. */ - setupMetricsRules: boolean - /** Permission to fetch logs. */ - queryLogs: boolean - /** Permission to write logs. */ - writeLogs: boolean - /** Permission to set up logs rules. */ - setupLogsRules: boolean - /** Permission to set up alerts. */ - setupAlerts: boolean - /** Permission to fetch traces. */ - queryTraces: boolean - /** Permission to write traces. */ - writeTraces: boolean -} - export type ActivateCockpitRequest = { /** ID of the Project the Cockpit belongs to. */ projectId?: string } -export type GetCockpitRequest = { - /** ID of the Project the Cockpit belongs to. */ - projectId?: string -} - -export type GetCockpitMetricsRequest = { +/** Cockpit. */ +export interface Cockpit { /** ID of the Project the Cockpit belongs to. */ - projectId?: string - /** Desired time range's start date for the metrics. */ - startDate?: Date - /** Desired time range's end date for the metrics. */ - endDate?: Date - /** Name of the metric requested. */ - metricName?: string + projectId: string + /** Date and time of the Cockpit's creation. */ + createdAt?: Date + /** Date and time of the Cockpit's last update. */ + updatedAt?: Date + /** Endpoints of the Cockpit. */ + endpoints?: CockpitEndpoints + /** Status of the Cockpit. */ + status: CockpitStatus + /** Specifies whether managed alerts are enabled or disabled. */ + managedAlertsEnabled: boolean + /** Pricing plan information. */ + plan?: Plan } -export type DeactivateCockpitRequest = { - /** ID of the Project the Cockpit belongs to. */ - projectId?: string +/** Metrics for a given Cockpit. */ +export interface CockpitMetrics { + /** Time series array. */ + timeseries: TimeSeries[] } -export type ResetCockpitGrafanaRequest = { - /** ID of the Project the Cockpit belongs to. */ +/** Request to create a contact point. */ +export type CreateContactPointRequest = { + /** ID of the Project in which to create the contact point. */ projectId?: string + /** Contact point to create. */ + contactPoint?: ContactPoint } +/** Request to create a datasource. */ export type CreateDatasourceRequest = { /** ID of the Project the Cockpit belongs to. */ projectId?: string @@ -292,17 +211,14 @@ export type CreateDatasourceRequest = { type?: DatasourceType } -export type ListDatasourcesRequest = { - /** Page number. */ - page?: number - /** Page size. */ - pageSize?: number - /** How the response is ordered. */ - orderBy?: ListDatasourcesRequestOrderBy +/** Request to create a Grafana user. */ +export type CreateGrafanaUserRequest = { /** ID of the Project. */ projectId?: string - /** Filter by datasource types. */ - types?: DatasourceType[] + /** Username of the Grafana user. */ + login: string + /** Role assigned to the Grafana user. */ + role?: GrafanaUserRole } export type CreateTokenRequest = { @@ -314,20 +230,25 @@ export type CreateTokenRequest = { scopes?: TokenScopes } -export type ListTokensRequest = { - /** Page number. */ - page?: number - /** Page size. */ - pageSize?: number - /** How the response is ordered. */ - orderBy?: ListTokensRequestOrderBy +export type DeactivateCockpitRequest = { + /** ID of the Project the Cockpit belongs to. */ + projectId?: string +} + +/** Request to delete a contact point. */ +export type DeleteContactPointRequest = { /** ID of the Project. */ projectId?: string + /** Contact point to delete. */ + contactPoint?: ContactPoint } -export type GetTokenRequest = { - /** ID of the token. */ - tokenId: string +/** Request to delete a Grafana user. */ +export type DeleteGrafanaUserRequest = { + /** ID of the Grafana user. */ + grafanaUserId: number + /** ID of the Project. */ + projectId?: string } export type DeleteTokenRequest = { @@ -335,76 +256,133 @@ export type DeleteTokenRequest = { tokenId: string } -export type CreateContactPointRequest = { - /** ID of the Project in which to create the contact point. */ +/** Request to disable the sending of managed alerts. */ +export type DisableManagedAlertsRequest = { + /** ID of the Project. */ projectId?: string - /** Contact point to create. */ - contactPoint?: ContactPoint } -export type ListContactPointsRequest = { - /** Page number. */ - page?: number - /** Page size. */ - pageSize?: number - /** ID of the Project from which to list the contact points. */ +/** Request to enable the sending of managed alerts. */ +export type EnableManagedAlertsRequest = { + /** ID of the Project. */ projectId?: string } -export type DeleteContactPointRequest = { - /** ID of the Project. */ +/** Request to get a given Cockpit's metrics. */ +export type GetCockpitMetricsRequest = { + /** ID of the Project the Cockpit belongs to. */ projectId?: string - /** Contact point to delete. */ - contactPoint?: ContactPoint + /** Desired time range's start date for the metrics. */ + startDate?: Date + /** Desired time range's end date for the metrics. */ + endDate?: Date + /** Name of the metric requested. */ + metricName?: string } -export type EnableManagedAlertsRequest = { - /** ID of the Project. */ +export type GetCockpitRequest = { + /** ID of the Project the Cockpit belongs to. */ projectId?: string } -export type DisableManagedAlertsRequest = { +/** Request to get a dashboard. */ +export type GetGrafanaProductDashboardRequest = { + /** Name of the dashboard. */ + dashboardName: string /** ID of the Project. */ projectId?: string } -export type TriggerTestAlertRequest = { - projectId?: string +export type GetTokenRequest = { + /** ID of the token. */ + tokenId: string } -export type CreateGrafanaUserRequest = { - /** ID of the Project. */ +/** Request to list all contact points. */ +export type ListContactPointsRequest = { + /** Page number. */ + page?: number + /** Page size. */ + pageSize?: number + /** ID of the Project from which to list the contact points. */ projectId?: string - /** Username of the Grafana user. */ - login: string - /** Role assigned to the Grafana user. */ - role?: GrafanaUserRole } -export type ListGrafanaUsersRequest = { +/** Response returned when listing contact points. */ +export interface ListContactPointsResponse { + /** Count of all contact points created. */ + totalCount: number + /** Array of contact points. */ + contactPoints: ContactPoint[] + /** + * Specifies whether the contact point has other receivers than the default + * receiver. + */ + hasAdditionalReceivers: boolean + /** Specifies whether there are unmanaged contact points. */ + hasAdditionalContactPoints: boolean +} + +export type ListDatasourcesRequest = { /** Page number. */ page?: number /** Page size. */ pageSize?: number - orderBy?: ListGrafanaUsersRequestOrderBy + /** How the response is ordered. */ + orderBy?: ListDatasourcesRequestOrderBy /** ID of the Project. */ projectId?: string + /** Filter by datasource types. */ + types?: DatasourceType[] } -export type DeleteGrafanaUserRequest = { - /** ID of the Grafana user. */ - grafanaUserId: number +export interface ListDatasourcesResponse { + /** Count of all datasources corresponding to the request. */ + totalCount: number + /** List of the datasources within the pagination. */ + datasources: Datasource[] +} + +/** Request to get a list of dashboards. */ +export type ListGrafanaProductDashboardsRequest = { /** ID of the Project. */ projectId?: string + /** Page number. */ + page?: number + /** Page size. */ + pageSize?: number + /** Tags to filter the dashboards. */ + tags?: string[] } -export type ResetGrafanaUserPasswordRequest = { - /** ID of the Grafana user. */ - grafanaUserId: number +/** Response returned when getting a list of dashboards. */ +export interface ListGrafanaProductDashboardsResponse { + /** Count of grafana dasboards. */ + totalCount: number + /** Information on grafana dashboards. */ + dashboards: GrafanaProductDashboard[] +} + +/** Request to list all Grafana users. */ +export type ListGrafanaUsersRequest = { + /** Page number. */ + page?: number + /** Page size. */ + pageSize?: number + orderBy?: ListGrafanaUsersRequestOrderBy /** ID of the Project. */ projectId?: string } +/** Response returned when listing Grafana users. */ +export interface ListGrafanaUsersResponse { + /** Count of all Grafana users. */ + totalCount: number + /** Information on all Grafana users. */ + grafanaUsers: GrafanaUser[] +} + +/** Request to list all pricing plans. */ export type ListPlansRequest = { /** Page number. */ page?: number @@ -413,27 +391,56 @@ export type ListPlansRequest = { orderBy?: ListPlansRequestOrderBy } -export type SelectPlanRequest = { - /** ID of the Project. */ - projectId?: string - /** ID of the pricing plan. */ - planId: string +/** Response returned when listing all pricing plans. */ +export interface ListPlansResponse { + /** Count of all pricing plans. */ + totalCount: number + /** Information on plans. */ + plans: Plan[] } -export type ListGrafanaProductDashboardsRequest = { - /** ID of the Project. */ - projectId?: string +export type ListTokensRequest = { /** Page number. */ page?: number /** Page size. */ pageSize?: number - /** Tags to filter the dashboards. */ - tags?: string[] + /** How the response is ordered. */ + orderBy?: ListTokensRequestOrderBy + /** ID of the Project. */ + projectId?: string } -export type GetGrafanaProductDashboardRequest = { - /** Name of the dashboard. */ - dashboardName: string +export interface ListTokensResponse { + /** Count of all tokens created. */ + totalCount: number + /** List of all tokens created. */ + tokens: Token[] +} + +export type ResetCockpitGrafanaRequest = { + /** ID of the Project the Cockpit belongs to. */ + projectId?: string +} + +/** Request to reset a Grafana user's password. */ +export type ResetGrafanaUserPasswordRequest = { + /** ID of the Grafana user. */ + grafanaUserId: number + /** ID of the Project. */ + projectId?: string +} + +/** Request to select a specific pricing plan. */ +export type SelectPlanRequest = { /** ID of the Project. */ projectId?: string + /** ID of the pricing plan. */ + planId: string +} + +/** Response returned when selecting a pricing plan. */ +export interface SelectPlanResponse {} + +export type TriggerTestAlertRequest = { + projectId?: string } diff --git a/packages/clients/src/api/container/v1beta1/marshalling.gen.ts b/packages/clients/src/api/container/v1beta1/marshalling.gen.ts index 72225c26d..588b46476 100644 --- a/packages/clients/src/api/container/v1beta1/marshalling.gen.ts +++ b/packages/clients/src/api/container/v1beta1/marshalling.gen.ts @@ -44,65 +44,20 @@ import type { UpdateTriggerRequestSqsClientConfig, } from './types.gen' -const unmarshalSecretHashedValue = (data: unknown) => { +const unmarshalSecretHashedValue = (data: unknown): SecretHashedValue => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SecretHashedValue' failed as data isn't a dictionary.`, ) } - return { hashedValue: data.hashed_value, key: data.key } as SecretHashedValue -} - -const unmarshalTriggerMnqNatsClientConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'TriggerMnqNatsClientConfig' failed as data isn't a dictionary.`, - ) - } - - return { - mnqCredentialId: data.mnq_credential_id, - mnqNamespaceId: data.mnq_namespace_id, - mnqNatsAccountId: data.mnq_nats_account_id, - mnqProjectId: data.mnq_project_id, - mnqRegion: data.mnq_region, - subject: data.subject, - } as TriggerMnqNatsClientConfig -} - -const unmarshalTriggerMnqSqsClientConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'TriggerMnqSqsClientConfig' failed as data isn't a dictionary.`, - ) - } - - return { - mnqCredentialId: data.mnq_credential_id, - mnqNamespaceId: data.mnq_namespace_id, - mnqProjectId: data.mnq_project_id, - mnqRegion: data.mnq_region, - queue: data.queue, - } as TriggerMnqSqsClientConfig -} - -const unmarshalTriggerSqsClientConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'TriggerSqsClientConfig' failed as data isn't a dictionary.`, - ) - } - return { - accessKey: data.access_key, - endpoint: data.endpoint, - queueUrl: data.queue_url, - secretKey: data.secret_key, - } as TriggerSqsClientConfig + hashedValue: data.hashed_value, + key: data.key, + } as SecretHashedValue } -export const unmarshalContainer = (data: unknown) => { +export const unmarshalContainer = (data: unknown): Container => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Container' failed as data isn't a dictionary.`, @@ -137,7 +92,7 @@ export const unmarshalContainer = (data: unknown) => { } as Container } -export const unmarshalCron = (data: unknown) => { +export const unmarshalCron = (data: unknown): Cron => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Cron' failed as data isn't a dictionary.`, @@ -154,7 +109,7 @@ export const unmarshalCron = (data: unknown) => { } as Cron } -export const unmarshalDomain = (data: unknown) => { +export const unmarshalDomain = (data: unknown): Domain => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Domain' failed as data isn't a dictionary.`, @@ -171,24 +126,7 @@ export const unmarshalDomain = (data: unknown) => { } as Domain } -const unmarshalLog = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Log' failed as data isn't a dictionary.`, - ) - } - - return { - id: data.id, - level: data.level, - message: data.message, - source: data.source, - stream: data.stream, - timestamp: unmarshalDate(data.timestamp), - } as Log -} - -export const unmarshalNamespace = (data: unknown) => { +export const unmarshalNamespace = (data: unknown): Namespace => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`, @@ -214,7 +152,7 @@ export const unmarshalNamespace = (data: unknown) => { } as Namespace } -export const unmarshalToken = (data: unknown) => { +export const unmarshalToken = (data: unknown): Token => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Token' failed as data isn't a dictionary.`, @@ -233,7 +171,61 @@ export const unmarshalToken = (data: unknown) => { } as Token } -export const unmarshalTrigger = (data: unknown) => { +const unmarshalTriggerMnqNatsClientConfig = ( + data: unknown, +): TriggerMnqNatsClientConfig => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'TriggerMnqNatsClientConfig' failed as data isn't a dictionary.`, + ) + } + + return { + mnqCredentialId: data.mnq_credential_id, + mnqNamespaceId: data.mnq_namespace_id, + mnqNatsAccountId: data.mnq_nats_account_id, + mnqProjectId: data.mnq_project_id, + mnqRegion: data.mnq_region, + subject: data.subject, + } as TriggerMnqNatsClientConfig +} + +const unmarshalTriggerMnqSqsClientConfig = ( + data: unknown, +): TriggerMnqSqsClientConfig => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'TriggerMnqSqsClientConfig' failed as data isn't a dictionary.`, + ) + } + + return { + mnqCredentialId: data.mnq_credential_id, + mnqNamespaceId: data.mnq_namespace_id, + mnqProjectId: data.mnq_project_id, + mnqRegion: data.mnq_region, + queue: data.queue, + } as TriggerMnqSqsClientConfig +} + +const unmarshalTriggerSqsClientConfig = ( + data: unknown, +): TriggerSqsClientConfig => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'TriggerSqsClientConfig' failed as data isn't a dictionary.`, + ) + } + + return { + accessKey: data.access_key, + endpoint: data.endpoint, + queueUrl: data.queue_url, + secretKey: data.secret_key, + } as TriggerSqsClientConfig +} + +export const unmarshalTrigger = (data: unknown): Trigger => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Trigger' failed as data isn't a dictionary.`, @@ -260,7 +252,9 @@ export const unmarshalTrigger = (data: unknown) => { } as Trigger } -export const unmarshalListContainersResponse = (data: unknown) => { +export const unmarshalListContainersResponse = ( + data: unknown, +): ListContainersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListContainersResponse' failed as data isn't a dictionary.`, @@ -273,7 +267,9 @@ export const unmarshalListContainersResponse = (data: unknown) => { } as ListContainersResponse } -export const unmarshalListCronsResponse = (data: unknown) => { +export const unmarshalListCronsResponse = ( + data: unknown, +): ListCronsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListCronsResponse' failed as data isn't a dictionary.`, @@ -286,7 +282,9 @@ export const unmarshalListCronsResponse = (data: unknown) => { } as ListCronsResponse } -export const unmarshalListDomainsResponse = (data: unknown) => { +export const unmarshalListDomainsResponse = ( + data: unknown, +): ListDomainsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDomainsResponse' failed as data isn't a dictionary.`, @@ -299,7 +297,24 @@ export const unmarshalListDomainsResponse = (data: unknown) => { } as ListDomainsResponse } -export const unmarshalListLogsResponse = (data: unknown) => { +const unmarshalLog = (data: unknown): Log => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Log' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + level: data.level, + message: data.message, + source: data.source, + stream: data.stream, + timestamp: unmarshalDate(data.timestamp), + } as Log +} + +export const unmarshalListLogsResponse = (data: unknown): ListLogsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListLogsResponse' failed as data isn't a dictionary.`, @@ -312,7 +327,9 @@ export const unmarshalListLogsResponse = (data: unknown) => { } as ListLogsResponse } -export const unmarshalListNamespacesResponse = (data: unknown) => { +export const unmarshalListNamespacesResponse = ( + data: unknown, +): ListNamespacesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`, @@ -325,7 +342,9 @@ export const unmarshalListNamespacesResponse = (data: unknown) => { } as ListNamespacesResponse } -export const unmarshalListTokensResponse = (data: unknown) => { +export const unmarshalListTokensResponse = ( + data: unknown, +): ListTokensResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListTokensResponse' failed as data isn't a dictionary.`, @@ -338,7 +357,9 @@ export const unmarshalListTokensResponse = (data: unknown) => { } as ListTokensResponse } -export const unmarshalListTriggersResponse = (data: unknown) => { +export const unmarshalListTriggersResponse = ( + data: unknown, +): ListTriggersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListTriggersResponse' failed as data isn't a dictionary.`, @@ -351,37 +372,6 @@ export const unmarshalListTriggersResponse = (data: unknown) => { } as ListTriggersResponse } -const marshalCreateTriggerRequestMnqNatsClientConfig = ( - request: CreateTriggerRequestMnqNatsClientConfig, - defaults: DefaultValues, -): Record => ({ - mnq_namespace_id: request.mnqNamespaceId, - mnq_nats_account_id: request.mnqNatsAccountId, - mnq_project_id: request.mnqProjectId, - mnq_region: request.mnqRegion, - subject: request.subject, -}) - -const marshalCreateTriggerRequestMnqSqsClientConfig = ( - request: CreateTriggerRequestMnqSqsClientConfig, - defaults: DefaultValues, -): Record => ({ - mnq_namespace_id: request.mnqNamespaceId, - mnq_project_id: request.mnqProjectId, - mnq_region: request.mnqRegion, - queue: request.queue, -}) - -const marshalCreateTriggerRequestSqsClientConfig = ( - request: CreateTriggerRequestSqsClientConfig, - defaults: DefaultValues, -): Record => ({ - access_key: request.accessKey, - endpoint: request.endpoint, - queue_url: request.queueUrl, - secret_key: request.secretKey, -}) - const marshalSecret = ( request: Secret, defaults: DefaultValues, @@ -390,14 +380,6 @@ const marshalSecret = ( value: request.value, }) -const marshalUpdateTriggerRequestSqsClientConfig = ( - request: UpdateTriggerRequestSqsClientConfig, - defaults: DefaultValues, -): Record => ({ - access_key: request.accessKey, - secret_key: request.secretKey, -}) - export const marshalCreateContainerRequest = ( request: CreateContainerRequest, defaults: DefaultValues, @@ -405,7 +387,7 @@ export const marshalCreateContainerRequest = ( cpu_limit: request.cpuLimit, description: request.description, environment_variables: request.environmentVariables, - http_option: request.httpOption ?? 'unknown_http_option', + http_option: request.httpOption, max_concurrency: request.maxConcurrency, max_scale: request.maxScale, memory_limit: request.memoryLimit, @@ -413,14 +395,15 @@ export const marshalCreateContainerRequest = ( name: request.name, namespace_id: request.namespaceId, port: request.port, - privacy: request.privacy ?? 'unknown_privacy', - protocol: request.protocol ?? 'unknown_protocol', + privacy: request.privacy, + protocol: request.protocol, registry_image: request.registryImage, - secret_environment_variables: request.secretEnvironmentVariables - ? request.secretEnvironmentVariables.map(elt => - marshalSecret(elt, defaults), - ) - : undefined, + secret_environment_variables: + request.secretEnvironmentVariables !== undefined + ? request.secretEnvironmentVariables.map(elt => + marshalSecret(elt, defaults), + ) + : undefined, timeout: request.timeout, }) @@ -450,11 +433,12 @@ export const marshalCreateNamespaceRequest = ( environment_variables: request.environmentVariables, name: request.name || randomName('cns'), project_id: request.projectId ?? defaults.defaultProjectId, - secret_environment_variables: request.secretEnvironmentVariables - ? request.secretEnvironmentVariables.map(elt => - marshalSecret(elt, defaults), - ) - : undefined, + secret_environment_variables: + request.secretEnvironmentVariables !== undefined + ? request.secretEnvironmentVariables.map(elt => + marshalSecret(elt, defaults), + ) + : undefined, }) export const marshalCreateTokenRequest = ( @@ -464,17 +448,42 @@ export const marshalCreateTokenRequest = ( description: request.description, expires_at: request.expiresAt, ...resolveOneOf([ - { - param: 'container_id', - value: request.containerId, - }, - { - param: 'namespace_id', - value: request.namespaceId, - }, + { param: 'container_id', value: request.containerId }, + { param: 'namespace_id', value: request.namespaceId }, ]), }) +const marshalCreateTriggerRequestMnqNatsClientConfig = ( + request: CreateTriggerRequestMnqNatsClientConfig, + defaults: DefaultValues, +): Record => ({ + mnq_namespace_id: request.mnqNamespaceId, + mnq_nats_account_id: request.mnqNatsAccountId, + mnq_project_id: request.mnqProjectId, + mnq_region: request.mnqRegion, + subject: request.subject, +}) + +const marshalCreateTriggerRequestMnqSqsClientConfig = ( + request: CreateTriggerRequestMnqSqsClientConfig, + defaults: DefaultValues, +): Record => ({ + mnq_namespace_id: request.mnqNamespaceId, + mnq_project_id: request.mnqProjectId, + mnq_region: request.mnqRegion, + queue: request.queue, +}) + +const marshalCreateTriggerRequestSqsClientConfig = ( + request: CreateTriggerRequestSqsClientConfig, + defaults: DefaultValues, +): Record => ({ + access_key: request.accessKey, + endpoint: request.endpoint, + queue_url: request.queueUrl, + secret_key: request.secretKey, +}) + export const marshalCreateTriggerRequest = ( request: CreateTriggerRequest, defaults: DefaultValues, @@ -482,33 +491,36 @@ export const marshalCreateTriggerRequest = ( container_id: request.containerId, description: request.description, name: request.name, - ...resolveOneOf([ + ...resolveOneOf([ { param: 'scw_sqs_config', - value: request.scwSqsConfig - ? marshalCreateTriggerRequestMnqSqsClientConfig( - request.scwSqsConfig, - defaults, - ) - : undefined, + value: + request.scwSqsConfig !== undefined + ? marshalCreateTriggerRequestMnqSqsClientConfig( + request.scwSqsConfig, + defaults, + ) + : undefined, }, { param: 'scw_nats_config', - value: request.scwNatsConfig - ? marshalCreateTriggerRequestMnqNatsClientConfig( - request.scwNatsConfig, - defaults, - ) - : undefined, + value: + request.scwNatsConfig !== undefined + ? marshalCreateTriggerRequestMnqNatsClientConfig( + request.scwNatsConfig, + defaults, + ) + : undefined, }, { param: 'sqs_config', - value: request.sqsConfig - ? marshalCreateTriggerRequestSqsClientConfig( - request.sqsConfig, - defaults, - ) - : undefined, + value: + request.sqsConfig !== undefined + ? marshalCreateTriggerRequestSqsClientConfig( + request.sqsConfig, + defaults, + ) + : undefined, }, ]), }) @@ -520,21 +532,22 @@ export const marshalUpdateContainerRequest = ( cpu_limit: request.cpuLimit, description: request.description, environment_variables: request.environmentVariables, - http_option: request.httpOption ?? 'unknown_http_option', + http_option: request.httpOption, max_concurrency: request.maxConcurrency, max_scale: request.maxScale, memory_limit: request.memoryLimit, min_scale: request.minScale, port: request.port, - privacy: request.privacy ?? 'unknown_privacy', - protocol: request.protocol ?? 'unknown_protocol', + privacy: request.privacy, + protocol: request.protocol, redeploy: request.redeploy, registry_image: request.registryImage, - secret_environment_variables: request.secretEnvironmentVariables - ? request.secretEnvironmentVariables.map(elt => - marshalSecret(elt, defaults), - ) - : undefined, + secret_environment_variables: + request.secretEnvironmentVariables !== undefined + ? request.secretEnvironmentVariables.map(elt => + marshalSecret(elt, defaults), + ) + : undefined, timeout: request.timeout, }) @@ -554,11 +567,20 @@ export const marshalUpdateNamespaceRequest = ( ): Record => ({ description: request.description, environment_variables: request.environmentVariables, - secret_environment_variables: request.secretEnvironmentVariables - ? request.secretEnvironmentVariables.map(elt => - marshalSecret(elt, defaults), - ) - : undefined, + secret_environment_variables: + request.secretEnvironmentVariables !== undefined + ? request.secretEnvironmentVariables.map(elt => + marshalSecret(elt, defaults), + ) + : undefined, +}) + +const marshalUpdateTriggerRequestSqsClientConfig = ( + request: UpdateTriggerRequestSqsClientConfig, + defaults: DefaultValues, +): Record => ({ + access_key: request.accessKey, + secret_key: request.secretKey, }) export const marshalUpdateTriggerRequest = ( @@ -570,12 +592,13 @@ export const marshalUpdateTriggerRequest = ( ...resolveOneOf([ { param: 'sqs_config', - value: request.sqsConfig - ? marshalUpdateTriggerRequestSqsClientConfig( - request.sqsConfig, - defaults, - ) - : undefined, + value: + request.sqsConfig !== undefined + ? marshalUpdateTriggerRequestSqsClientConfig( + request.sqsConfig, + defaults, + ) + : undefined, }, ]), }) diff --git a/packages/clients/src/api/container/v1beta1/types.gen.ts b/packages/clients/src/api/container/v1beta1/types.gen.ts index 3c16b2e28..f2977b528 100644 --- a/packages/clients/src/api/container/v1beta1/types.gen.ts +++ b/packages/clients/src/api/container/v1beta1/types.gen.ts @@ -75,8 +75,6 @@ export type NamespaceStatus = | 'creating' | 'pending' -export type NullValue = 'NULL_VALUE' - export type TokenStatus = | 'unknown' | 'ready' @@ -99,7 +97,82 @@ export type TriggerStatus = | 'creating' | 'pending' -/** Container. */ +export interface SecretHashedValue { + key: string + hashedValue: string +} + +export interface TriggerMnqNatsClientConfig { + /** @deprecated */ + mnqNamespaceId?: string + /** Name of the NATS subject the trigger listens to. */ + subject: string + /** ID of the M&Q NATS account. */ + mnqNatsAccountId: string + /** ID of the M&Q project. */ + mnqProjectId: string + /** Region of the M&Q project. */ + mnqRegion: string + /** ID of the M&Q credentials used to subscribe to the NATS subject. */ + mnqCredentialId?: string +} + +export interface TriggerMnqSqsClientConfig { + /** @deprecated */ + mnqNamespaceId?: string + /** Name of the SQS queue the trigger listens to. */ + queue: string + /** ID of the M&Q project. */ + mnqProjectId: string + /** Region in which the M&Q project is activated. */ + mnqRegion: string + /** ID of the M&Q credentials used to read from the SQS queue. */ + mnqCredentialId?: string +} + +export interface TriggerSqsClientConfig { + endpoint: string + queueUrl: string + accessKey: string + secretKey: string +} + +export interface Secret { + key: string + value?: string +} + +export interface CreateTriggerRequestMnqNatsClientConfig { + /** @deprecated */ + mnqNamespaceId?: string + /** Name of the NATS subject the trigger should listen to. */ + subject: string + /** ID of the M&Q NATS account. */ + mnqNatsAccountId: string + /** ID of the M&Q project. */ + mnqProjectId: string + /** Region of the M&Q project. */ + mnqRegion: string +} + +export interface CreateTriggerRequestMnqSqsClientConfig { + /** @deprecated */ + mnqNamespaceId?: string + /** Name of the SQS queue the trigger should listen to. */ + queue: string + /** You must have activated SQS on this project. */ + mnqProjectId: string + /** Region in which the M&Q project is activated. */ + mnqRegion: string +} + +export interface CreateTriggerRequestSqsClientConfig { + endpoint: string + queueUrl: string + accessKey: string + secretKey: string +} + export interface Container { /** UUID of the container. */ id: string @@ -143,7 +216,7 @@ export interface Container { /** Secret environment variables of the container. */ secretEnvironmentVariables: SecretHashedValue[] /** - * Configuration for the handling of HTTP and HTTPS requests. Possible values: + * Possible values: * * - Redirected: Responds to HTTP request with a 301 redirect to ask the clients * to use HTTPS. @@ -154,40 +227,6 @@ export interface Container { region: Region } -/** Create trigger request. mnq nats client config. */ -export interface CreateTriggerRequestMnqNatsClientConfig { - /** @deprecated */ - mnqNamespaceId?: string - /** Name of the NATS subject the trigger should listen to. */ - subject: string - /** ID of the M&Q NATS account. */ - mnqNatsAccountId: string - /** ID of the M&Q project. */ - mnqProjectId: string - /** Region of the M&Q project. */ - mnqRegion: string -} - -/** Create trigger request. mnq sqs client config. */ -export interface CreateTriggerRequestMnqSqsClientConfig { - /** @deprecated */ - mnqNamespaceId?: string - /** Name of the SQS queue the trigger should listen to. */ - queue: string - /** ID of the M&Q project. You must have activated SQS on this project. */ - mnqProjectId: string - /** Region in which the M&Q project is activated. */ - mnqRegion: string -} - -export interface CreateTriggerRequestSqsClientConfig { - endpoint: string - queueUrl: string - accessKey: string - secretKey: string -} - -/** Cron. */ export interface Cron { /** UUID of the cron. */ id: string @@ -203,7 +242,6 @@ export interface Cron { name: string } -/** Domain. */ export interface Domain { /** UUID of the domain. */ id: string @@ -219,58 +257,6 @@ export interface Domain { errorMessage?: string } -/** List containers response. */ -export interface ListContainersResponse { - /** Array of containers. */ - containers: Container[] - /** Total number of containers. */ - totalCount: number -} - -/** List crons response. */ -export interface ListCronsResponse { - /** Array of crons. */ - crons: Cron[] - /** Total number of crons. */ - totalCount: number -} - -/** List domains response. */ -export interface ListDomainsResponse { - /** Array of domains. */ - domains: Domain[] - /** Total number of domains. */ - totalCount: number -} - -/** List logs response. */ -export interface ListLogsResponse { - logs: Log[] - totalCount: number -} - -/** List namespaces response. */ -export interface ListNamespacesResponse { - /** Array of the namespaces. */ - namespaces: Namespace[] - /** Total number of namespaces. */ - totalCount: number -} - -export interface ListTokensResponse { - tokens: Token[] - totalCount: number -} - -/** List triggers response. */ -export interface ListTriggersResponse { - /** Total count of existing triggers (matching any filters specified). */ - totalCount: number - /** Triggers on this page. */ - triggers: Trigger[] -} - -/** Log. */ export interface Log { message: string timestamp?: Date @@ -283,7 +269,6 @@ export interface Log { stream: LogStream } -/** Namespace. */ export interface Namespace { /** UUID of the namespace. */ id: string @@ -311,17 +296,6 @@ export interface Namespace { region: Region } -export interface Secret { - key: string - value?: string -} - -export interface SecretHashedValue { - key: string - hashedValue: string -} - -/** Token. */ export interface Token { /** UUID of the token. */ id: string @@ -349,7 +323,6 @@ export interface Token { expiresAt?: Date } -/** Trigger. */ export interface Trigger { /** ID of the trigger. */ id: string @@ -388,78 +361,88 @@ export interface Trigger { sqsConfig?: TriggerSqsClientConfig } -/** Trigger. mnq nats client config. */ -export interface TriggerMnqNatsClientConfig { - /** @deprecated */ - mnqNamespaceId?: string - /** Name of the NATS subject the trigger listens to. */ - subject: string - /** ID of the M&Q NATS account. */ - mnqNatsAccountId: string - /** ID of the M&Q project. */ - mnqProjectId: string - /** Region of the M&Q project. */ - mnqRegion: string - /** ID of the M&Q credentials used to subscribe to the NATS subject. */ - mnqCredentialId?: string -} - -/** Trigger. mnq sqs client config. */ -export interface TriggerMnqSqsClientConfig { - /** @deprecated */ - mnqNamespaceId?: string - /** Name of the SQS queue the trigger listens to. */ - queue: string - /** ID of the M&Q project. */ - mnqProjectId: string - /** Region in which the M&Q project is activated. */ - mnqRegion: string - /** ID of the M&Q credentials used to read from the SQS queue. */ - mnqCredentialId?: string -} - -export interface TriggerSqsClientConfig { - endpoint: string - queueUrl: string - accessKey: string - secretKey: string -} - export interface UpdateTriggerRequestSqsClientConfig { accessKey?: string secretKey?: string } -export type ListNamespacesRequest = { +export type CreateContainerRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number. */ - page?: number - /** Number of namespaces per page. */ - pageSize?: number - /** Order of the namespaces. */ - orderBy?: ListNamespacesRequestOrderBy - /** Name of the namespaces. */ - name?: string - /** UUID of the Organization the namespace belongs to. */ - organizationId?: string - /** UUID of the Project the namespace belongs to. */ - projectId?: string + /** UUID of the namespace the container belongs to. */ + namespaceId: string + /** Name of the container. */ + name: string + /** Environment variables of the container. */ + environmentVariables?: Record + /** Minimum number of instances to scale the container to. */ + minScale?: number + /** Maximum number of instances to scale the container to. */ + maxScale?: number + /** Memory limit of the container in MB. */ + memoryLimit?: number + /** CPU limit of the container in mvCPU. */ + cpuLimit?: number + /** Processing time limit for the container. */ + timeout?: string + /** Privacy setting of the container. */ + privacy?: ContainerPrivacy + /** Description of the container. */ + description?: string + /** + * Name of the registry image (e.g. + * "rg.fr-par.scw.cloud/something/image:tag"). + */ + registryImage?: string + /** Number of maximum concurrent executions of the container. */ + maxConcurrency?: number + /** Protocol the container uses. */ + protocol?: ContainerProtocol + /** Port the container listens on. */ + port?: number + /** Secret environment variables of the container. */ + secretEnvironmentVariables?: Secret[] + /** + * Possible values: + * + * - Redirected: Responds to HTTP request with a 301 redirect to ask the clients + * to use HTTPS. + * - Enabled: Serve both HTTP and HTTPS traffic. + */ + httpOption?: ContainerHttpOption } -export type GetNamespaceRequest = { +export type CreateCronRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the namespace to get. */ - namespaceId: string -} - + /** UUID of the container to invoke by the cron. */ + containerId: string + /** UNIX cron shedule. */ + schedule: string + /** Arguments to pass with the cron. */ + args?: Record + /** Name of the cron to create. */ + name?: string +} + +export type CreateDomainRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Domain to assign. */ + hostname: string + /** UUID of the container to assign the domain to. */ + containerId: string +} + export type CreateNamespaceRequest = { /** * Region to target. If none is passed will use default region from the @@ -478,167 +461,123 @@ export type CreateNamespaceRequest = { secretEnvironmentVariables?: Secret[] } -export type UpdateNamespaceRequest = { +export type CreateTokenRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the namespace to update. */ - namespaceId: string - /** Environment variables of the namespace to update. */ - environmentVariables?: Record - /** Description of the namespace to update. */ + /** + * UUID of the container to create the token for. + * + * One-of ('scope'): at most one of 'containerId', 'namespaceId' could be set. + */ + containerId?: string + /** + * UUID of the namespace to create the token for. + * + * One-of ('scope'): at most one of 'containerId', 'namespaceId' could be set. + */ + namespaceId?: string + /** Description of the token. */ description?: string - /** Secret environment variables of the namespace to update. */ - secretEnvironmentVariables?: Secret[] + /** Expiry date of the token. */ + expiresAt?: Date } -export type DeleteNamespaceRequest = { +export type CreateTriggerRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the namespace to delete. */ - namespaceId: string + /** Name of the trigger. */ + name: string + /** ID of the container to trigger. */ + containerId: string + /** Description of the trigger. */ + description?: string + /** + * Configuration for a Scaleway M&Q SQS queue. + * + * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', + * 'sqsConfig' could be set. + */ + scwSqsConfig?: CreateTriggerRequestMnqSqsClientConfig + /** + * Configuration for a Scaleway M&Q NATS subject. + * + * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', + * 'sqsConfig' could be set. + */ + scwNatsConfig?: CreateTriggerRequestMnqNatsClientConfig + /** + * Configuration for an AWS SQS queue. + * + * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', + * 'sqsConfig' could be set. + */ + sqsConfig?: CreateTriggerRequestSqsClientConfig } -export type ListContainersRequest = { +export type DeleteContainerRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number. */ - page?: number - /** Number of containers per page. */ - pageSize?: number - /** Order of the containers. */ - orderBy?: ListContainersRequestOrderBy - /** UUID of the namespace the container belongs to. */ - namespaceId: string - /** Name of the container. */ - name?: string - /** UUID of the Organization the container belongs to. */ - organizationId?: string - /** UUID of the Project the container belongs to. */ - projectId?: string + /** UUID of the container to delete. */ + containerId: string } -export type GetContainerRequest = { +export type DeleteCronRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the container to get. */ - containerId: string + /** UUID of the cron to delete. */ + cronId: string } -export type CreateContainerRequest = { +export type DeleteDomainRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the namespace the container belongs to. */ - namespaceId: string - /** Name of the container. */ - name: string - /** Environment variables of the container. */ - environmentVariables?: Record - /** Minimum number of instances to scale the container to. */ - minScale?: number - /** Maximum number of instances to scale the container to. */ - maxScale?: number - /** Memory limit of the container in MB. */ - memoryLimit?: number - /** CPU limit of the container in mvCPU. */ - cpuLimit?: number - /** Processing time limit for the container. */ - timeout?: string - /** Privacy setting of the container. */ - privacy?: ContainerPrivacy - /** Description of the container. */ - description?: string - /** - * Name of the registry image (e.g. - * "rg.fr-par.scw.cloud/something/image:tag"). - */ - registryImage?: string - /** Number of maximum concurrent executions of the container. */ - maxConcurrency?: number - /** Protocol the container uses. */ - protocol?: ContainerProtocol - /** Port the container listens on. */ - port?: number - /** Secret environment variables of the container. */ - secretEnvironmentVariables?: Secret[] - /** - * Configure how HTTP and HTTPS requests are handled. Possible values: - * - * - Redirected: Responds to HTTP request with a 301 redirect to ask the clients - * to use HTTPS. - * - Enabled: Serve both HTTP and HTTPS traffic. - */ - httpOption?: ContainerHttpOption + /** UUID of the domain to delete. */ + domainId: string } -export type UpdateContainerRequest = { +export type DeleteNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the container to update. */ - containerId: string - /** Environment variables of the container. */ - environmentVariables?: Record - /** Minimum number of instances to scale the container to. */ - minScale?: number - /** Maximum number of instances to scale the container to. */ - maxScale?: number - /** Memory limit of the container in MB. */ - memoryLimit?: number - /** CPU limit of the container in mvCPU. */ - cpuLimit?: number - /** Processing time limit for the container. */ - timeout?: string - /** Defines whether to redeploy failed containers. */ - redeploy?: boolean - /** Privacy settings of the container. */ - privacy?: ContainerPrivacy - /** Description of the container. */ - description?: string - /** - * Name of the registry image (e.g. - * "rg.fr-par.scw.cloud/something/image:tag"). - */ - registryImage?: string - /** Number of maximum concurrent executions of the container. */ - maxConcurrency?: number - protocol?: ContainerProtocol - port?: number - secretEnvironmentVariables?: Secret[] + /** UUID of the namespace to delete. */ + namespaceId: string +} + +export type DeleteTokenRequest = { /** - * Configure how HTTP and HTTPS requests are handled. Possible values: - * - * - Redirected: Responds to HTTP request with a 301 redirect to ask the clients - * to use HTTPS. - * - Enabled: Serve both HTTP and HTTPS traffic. + * Region to target. If none is passed will use default region from the + * config. */ - httpOption?: ContainerHttpOption + region?: Region + /** UUID of the token to delete. */ + tokenId: string } -export type DeleteContainerRequest = { +export type DeleteTriggerRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the container to delete. */ - containerId: string + /** ID of the trigger to delete. */ + triggerId: string } export type DeployContainerRequest = { @@ -651,19 +590,13 @@ export type DeployContainerRequest = { containerId: string } -export type ListCronsRequest = { +export type GetContainerRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number. */ - page?: number - /** Number of crons per page. */ - pageSize?: number - /** Order of the crons. */ - orderBy?: ListCronsRequestOrderBy - /** UUID of the container invoked by the cron. */ + /** UUID of the container to get. */ containerId: string } @@ -677,159 +610,180 @@ export type GetCronRequest = { cronId: string } -export type CreateCronRequest = { +export type GetDomainRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the container to invoke by the cron. */ - containerId: string - /** UNIX cron shedule. */ - schedule: string - /** Arguments to pass with the cron. */ - args?: Record - /** Name of the cron to create. */ - name?: string + /** UUID of the domain to get. */ + domainId: string } -export type UpdateCronRequest = { +export type GetNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the cron to update. */ - cronId: string - /** UUID of the container invoked by the cron. */ - containerId?: string - /** UNIX cron schedule. */ - schedule?: string - /** Arguments to pass with the cron. */ - args?: Record - /** Name of the cron. */ - name?: string + /** UUID of the namespace to get. */ + namespaceId: string } -export type DeleteCronRequest = { +export type GetTokenRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the cron to delete. */ - cronId: string + /** UUID of the token to get. */ + tokenId: string } -export type ListLogsRequest = { +export type GetTriggerRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the container. */ - containerId: string - /** Page number. */ - page?: number - /** Number of logs per page. */ - pageSize?: number - /** Order of the logs. */ - orderBy?: ListLogsRequestOrderBy + /** ID of the trigger to get. */ + triggerId: string } -export type ListDomainsRequest = { +export type IssueJWTRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number. */ - page?: number - /** Number of domains per page. */ - pageSize?: number - /** Order of the domains. */ - orderBy?: ListDomainsRequestOrderBy - /** UUID of the container the domain belongs to. */ - containerId: string + /** One-of ('scope'): at most one of 'containerId', 'namespaceId' could be set. */ + containerId?: string + /** One-of ('scope'): at most one of 'containerId', 'namespaceId' could be set. */ + namespaceId?: string + expiresAt?: Date } -export type GetDomainRequest = { +export type ListContainersRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the domain to get. */ - domainId: string + /** Page number. */ + page?: number + /** Number of containers per page. */ + pageSize?: number + /** Order of the containers. */ + orderBy?: ListContainersRequestOrderBy + /** UUID of the namespace the container belongs to. */ + namespaceId: string + /** Name of the container. */ + name?: string + /** UUID of the Organization the container belongs to. */ + organizationId?: string + /** UUID of the Project the container belongs to. */ + projectId?: string } -export type CreateDomainRequest = { +export interface ListContainersResponse { + /** Array of containers. */ + containers: Container[] + /** Total number of containers. */ + totalCount: number +} + +export type ListCronsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Domain to assign. */ - hostname: string - /** UUID of the container to assign the domain to. */ + /** Page number. */ + page?: number + /** Number of crons per page. */ + pageSize?: number + /** Order of the crons. */ + orderBy?: ListCronsRequestOrderBy + /** UUID of the container invoked by the cron. */ containerId: string } -export type DeleteDomainRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the domain to delete. */ - domainId: string +export interface ListCronsResponse { + /** Array of crons. */ + crons: Cron[] + /** Total number of crons. */ + totalCount: number } -export type IssueJWTRequest = { +export type ListDomainsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** One-of ('scope'): at most one of 'containerId', 'namespaceId' could be set. */ - containerId?: string - /** One-of ('scope'): at most one of 'containerId', 'namespaceId' could be set. */ - namespaceId?: string - expiresAt?: Date + /** Page number. */ + page?: number + /** Number of domains per page. */ + pageSize?: number + /** Order of the domains. */ + orderBy?: ListDomainsRequestOrderBy + /** UUID of the container the domain belongs to. */ + containerId: string } -export type CreateTokenRequest = { +export interface ListDomainsResponse { + /** Array of domains. */ + domains: Domain[] + /** Total number of domains. */ + totalCount: number +} + +export type ListLogsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** - * UUID of the container to create the token for. - * - * One-of ('scope'): at most one of 'containerId', 'namespaceId' could be set. - */ - containerId?: string - /** - * UUID of the namespace to create the token for. - * - * One-of ('scope'): at most one of 'containerId', 'namespaceId' could be set. - */ - namespaceId?: string - /** Description of the token. */ - description?: string - /** Expiry date of the token. */ - expiresAt?: Date + /** UUID of the container. */ + containerId: string + /** Page number. */ + page?: number + /** Number of logs per page. */ + pageSize?: number + /** Order of the logs. */ + orderBy?: ListLogsRequestOrderBy } -export type GetTokenRequest = { +export interface ListLogsResponse { + logs: Log[] + totalCount: number +} + +export type ListNamespacesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the token to get. */ - tokenId: string + /** Page number. */ + page?: number + /** Number of namespaces per page. */ + pageSize?: number + /** Order of the namespaces. */ + orderBy?: ListNamespacesRequestOrderBy + /** Name of the namespaces. */ + name?: string + /** UUID of the Organization the namespace belongs to. */ + organizationId?: string + /** UUID of the Project the namespace belongs to. */ + projectId?: string +} + +export interface ListNamespacesResponse { + /** Array of the namespaces. */ + namespaces: Namespace[] + /** Total number of namespaces. */ + totalCount: number } export type ListTokensRequest = { @@ -850,59 +804,9 @@ export type ListTokensRequest = { namespaceId?: string } -export type DeleteTokenRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the token to delete. */ - tokenId: string -} - -export type CreateTriggerRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Name of the trigger. */ - name: string - /** ID of the container to trigger. */ - containerId: string - /** Description of the trigger. */ - description?: string - /** - * Configuration for a Scaleway M&Q SQS queue. - * - * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', - * 'sqsConfig' could be set. - */ - scwSqsConfig?: CreateTriggerRequestMnqSqsClientConfig - /** - * Configuration for a Scaleway M&Q NATS subject. - * - * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', - * 'sqsConfig' could be set. - */ - scwNatsConfig?: CreateTriggerRequestMnqNatsClientConfig - /** - * Configuration for an AWS SQS queue. - * - * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', - * 'sqsConfig' could be set. - */ - sqsConfig?: CreateTriggerRequestSqsClientConfig -} - -export type GetTriggerRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** ID of the trigger to get. */ - triggerId: string +export interface ListTokensResponse { + tokens: Token[] + totalCount: number } export type ListTriggersRequest = { @@ -940,6 +844,93 @@ export type ListTriggersRequest = { projectId?: string } +export interface ListTriggersResponse { + /** Total count of existing triggers (matching any filters specified). */ + totalCount: number + /** Triggers on this page. */ + triggers: Trigger[] +} + +export type UpdateContainerRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the container to update. */ + containerId: string + /** Environment variables of the container. */ + environmentVariables?: Record + /** Minimum number of instances to scale the container to. */ + minScale?: number + /** Maximum number of instances to scale the container to. */ + maxScale?: number + /** Memory limit of the container in MB. */ + memoryLimit?: number + /** CPU limit of the container in mvCPU. */ + cpuLimit?: number + /** Processing time limit for the container. */ + timeout?: string + /** Defines whether to redeploy failed containers. */ + redeploy?: boolean + /** Privacy settings of the container. */ + privacy?: ContainerPrivacy + /** Description of the container. */ + description?: string + /** + * Name of the registry image (e.g. + * "rg.fr-par.scw.cloud/something/image:tag"). + */ + registryImage?: string + /** Number of maximum concurrent executions of the container. */ + maxConcurrency?: number + protocol?: ContainerProtocol + port?: number + secretEnvironmentVariables?: Secret[] + /** + * Possible values: + * + * - Redirected: Responds to HTTP request with a 301 redirect to ask the clients + * to use HTTPS. + * - Enabled: Serve both HTTP and HTTPS traffic. + */ + httpOption?: ContainerHttpOption +} + +export type UpdateCronRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the cron to update. */ + cronId: string + /** UUID of the container invoked by the cron. */ + containerId?: string + /** UNIX cron schedule. */ + schedule?: string + /** Arguments to pass with the cron. */ + args?: Record + /** Name of the cron. */ + name?: string +} + +export type UpdateNamespaceRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the namespace to update. */ + namespaceId: string + /** Environment variables of the namespace to update. */ + environmentVariables?: Record + /** Description of the namespace to update. */ + description?: string + /** Secret environment variables of the namespace to update. */ + secretEnvironmentVariables?: Secret[] +} + export type UpdateTriggerRequest = { /** * Region to target. If none is passed will use default region from the @@ -959,13 +950,3 @@ export type UpdateTriggerRequest = { */ sqsConfig?: UpdateTriggerRequestSqsClientConfig } - -export type DeleteTriggerRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** ID of the trigger to delete. */ - triggerId: string -} diff --git a/packages/clients/src/api/function/v1beta1/marshalling.gen.ts b/packages/clients/src/api/function/v1beta1/marshalling.gen.ts index 5482a0c06..0b380d149 100644 --- a/packages/clients/src/api/function/v1beta1/marshalling.gen.ts +++ b/packages/clients/src/api/function/v1beta1/marshalling.gen.ts @@ -48,65 +48,7 @@ import type { UploadURL, } from './types.gen' -const unmarshalSecretHashedValue = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'SecretHashedValue' failed as data isn't a dictionary.`, - ) - } - - return { hashedValue: data.hashed_value, key: data.key } as SecretHashedValue -} - -const unmarshalTriggerMnqNatsClientConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'TriggerMnqNatsClientConfig' failed as data isn't a dictionary.`, - ) - } - - return { - mnqCredentialId: data.mnq_credential_id, - mnqNamespaceId: data.mnq_namespace_id, - mnqNatsAccountId: data.mnq_nats_account_id, - mnqProjectId: data.mnq_project_id, - mnqRegion: data.mnq_region, - subject: data.subject, - } as TriggerMnqNatsClientConfig -} - -const unmarshalTriggerMnqSqsClientConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'TriggerMnqSqsClientConfig' failed as data isn't a dictionary.`, - ) - } - - return { - mnqCredentialId: data.mnq_credential_id, - mnqNamespaceId: data.mnq_namespace_id, - mnqProjectId: data.mnq_project_id, - mnqRegion: data.mnq_region, - queue: data.queue, - } as TriggerMnqSqsClientConfig -} - -const unmarshalTriggerSqsClientConfig = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'TriggerSqsClientConfig' failed as data isn't a dictionary.`, - ) - } - - return { - accessKey: data.access_key, - endpoint: data.endpoint, - queueUrl: data.queue_url, - secretKey: data.secret_key, - } as TriggerSqsClientConfig -} - -export const unmarshalCron = (data: unknown) => { +export const unmarshalCron = (data: unknown): Cron => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Cron' failed as data isn't a dictionary.`, @@ -123,7 +65,7 @@ export const unmarshalCron = (data: unknown) => { } as Cron } -export const unmarshalDomain = (data: unknown) => { +export const unmarshalDomain = (data: unknown): Domain => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Domain' failed as data isn't a dictionary.`, @@ -140,7 +82,20 @@ export const unmarshalDomain = (data: unknown) => { } as Domain } -export const unmarshalFunction = (data: unknown) => { +const unmarshalSecretHashedValue = (data: unknown): SecretHashedValue => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'SecretHashedValue' failed as data isn't a dictionary.`, + ) + } + + return { + hashedValue: data.hashed_value, + key: data.key, + } as SecretHashedValue +} + +export const unmarshalFunction = (data: unknown): Function => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Function' failed as data isn't a dictionary.`, @@ -175,24 +130,7 @@ export const unmarshalFunction = (data: unknown) => { } as Function } -const unmarshalLog = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Log' failed as data isn't a dictionary.`, - ) - } - - return { - id: data.id, - level: data.level, - message: data.message, - source: data.source, - stream: data.stream, - timestamp: unmarshalDate(data.timestamp), - } as Log -} - -export const unmarshalNamespace = (data: unknown) => { +export const unmarshalNamespace = (data: unknown): Namespace => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`, @@ -218,28 +156,7 @@ export const unmarshalNamespace = (data: unknown) => { } as Namespace } -const unmarshalRuntime = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Runtime' failed as data isn't a dictionary.`, - ) - } - - return { - codeSample: data.code_sample, - defaultHandler: data.default_handler, - extension: data.extension, - implementation: data.implementation, - language: data.language, - logoUrl: data.logo_url, - name: data.name, - status: data.status, - statusMessage: data.status_message, - version: data.version, - } as Runtime -} - -export const unmarshalToken = (data: unknown) => { +export const unmarshalToken = (data: unknown): Token => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Token' failed as data isn't a dictionary.`, @@ -258,7 +175,61 @@ export const unmarshalToken = (data: unknown) => { } as Token } -export const unmarshalTrigger = (data: unknown) => { +const unmarshalTriggerMnqNatsClientConfig = ( + data: unknown, +): TriggerMnqNatsClientConfig => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'TriggerMnqNatsClientConfig' failed as data isn't a dictionary.`, + ) + } + + return { + mnqCredentialId: data.mnq_credential_id, + mnqNamespaceId: data.mnq_namespace_id, + mnqNatsAccountId: data.mnq_nats_account_id, + mnqProjectId: data.mnq_project_id, + mnqRegion: data.mnq_region, + subject: data.subject, + } as TriggerMnqNatsClientConfig +} + +const unmarshalTriggerMnqSqsClientConfig = ( + data: unknown, +): TriggerMnqSqsClientConfig => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'TriggerMnqSqsClientConfig' failed as data isn't a dictionary.`, + ) + } + + return { + mnqCredentialId: data.mnq_credential_id, + mnqNamespaceId: data.mnq_namespace_id, + mnqProjectId: data.mnq_project_id, + mnqRegion: data.mnq_region, + queue: data.queue, + } as TriggerMnqSqsClientConfig +} + +const unmarshalTriggerSqsClientConfig = ( + data: unknown, +): TriggerSqsClientConfig => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'TriggerSqsClientConfig' failed as data isn't a dictionary.`, + ) + } + + return { + accessKey: data.access_key, + endpoint: data.endpoint, + queueUrl: data.queue_url, + secretKey: data.secret_key, + } as TriggerSqsClientConfig +} + +export const unmarshalTrigger = (data: unknown): Trigger => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Trigger' failed as data isn't a dictionary.`, @@ -285,17 +256,22 @@ export const unmarshalTrigger = (data: unknown) => { } as Trigger } -export const unmarshalDownloadURL = (data: unknown) => { +export const unmarshalDownloadURL = (data: unknown): DownloadURL => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DownloadURL' failed as data isn't a dictionary.`, ) } - return { headers: data.headers, url: data.url } as DownloadURL + return { + headers: data.headers, + url: data.url, + } as DownloadURL } -export const unmarshalListCronsResponse = (data: unknown) => { +export const unmarshalListCronsResponse = ( + data: unknown, +): ListCronsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListCronsResponse' failed as data isn't a dictionary.`, @@ -308,7 +284,9 @@ export const unmarshalListCronsResponse = (data: unknown) => { } as ListCronsResponse } -export const unmarshalListDomainsResponse = (data: unknown) => { +export const unmarshalListDomainsResponse = ( + data: unknown, +): ListDomainsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDomainsResponse' failed as data isn't a dictionary.`, @@ -321,7 +299,30 @@ export const unmarshalListDomainsResponse = (data: unknown) => { } as ListDomainsResponse } -export const unmarshalListFunctionRuntimesResponse = (data: unknown) => { +const unmarshalRuntime = (data: unknown): Runtime => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Runtime' failed as data isn't a dictionary.`, + ) + } + + return { + codeSample: data.code_sample, + defaultHandler: data.default_handler, + extension: data.extension, + implementation: data.implementation, + language: data.language, + logoUrl: data.logo_url, + name: data.name, + status: data.status, + statusMessage: data.status_message, + version: data.version, + } as Runtime +} + +export const unmarshalListFunctionRuntimesResponse = ( + data: unknown, +): ListFunctionRuntimesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListFunctionRuntimesResponse' failed as data isn't a dictionary.`, @@ -334,7 +335,9 @@ export const unmarshalListFunctionRuntimesResponse = (data: unknown) => { } as ListFunctionRuntimesResponse } -export const unmarshalListFunctionsResponse = (data: unknown) => { +export const unmarshalListFunctionsResponse = ( + data: unknown, +): ListFunctionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListFunctionsResponse' failed as data isn't a dictionary.`, @@ -347,7 +350,24 @@ export const unmarshalListFunctionsResponse = (data: unknown) => { } as ListFunctionsResponse } -export const unmarshalListLogsResponse = (data: unknown) => { +const unmarshalLog = (data: unknown): Log => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Log' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + level: data.level, + message: data.message, + source: data.source, + stream: data.stream, + timestamp: unmarshalDate(data.timestamp), + } as Log +} + +export const unmarshalListLogsResponse = (data: unknown): ListLogsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListLogsResponse' failed as data isn't a dictionary.`, @@ -360,7 +380,9 @@ export const unmarshalListLogsResponse = (data: unknown) => { } as ListLogsResponse } -export const unmarshalListNamespacesResponse = (data: unknown) => { +export const unmarshalListNamespacesResponse = ( + data: unknown, +): ListNamespacesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`, @@ -373,7 +395,9 @@ export const unmarshalListNamespacesResponse = (data: unknown) => { } as ListNamespacesResponse } -export const unmarshalListTokensResponse = (data: unknown) => { +export const unmarshalListTokensResponse = ( + data: unknown, +): ListTokensResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListTokensResponse' failed as data isn't a dictionary.`, @@ -386,7 +410,9 @@ export const unmarshalListTokensResponse = (data: unknown) => { } as ListTokensResponse } -export const unmarshalListTriggersResponse = (data: unknown) => { +export const unmarshalListTriggersResponse = ( + data: unknown, +): ListTriggersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListTriggersResponse' failed as data isn't a dictionary.`, @@ -399,63 +425,19 @@ export const unmarshalListTriggersResponse = (data: unknown) => { } as ListTriggersResponse } -export const unmarshalUploadURL = (data: unknown) => { +export const unmarshalUploadURL = (data: unknown): UploadURL => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'UploadURL' failed as data isn't a dictionary.`, ) } - return { headers: data.headers, url: data.url } as UploadURL + return { + headers: data.headers, + url: data.url, + } as UploadURL } -const marshalCreateTriggerRequestMnqNatsClientConfig = ( - request: CreateTriggerRequestMnqNatsClientConfig, - defaults: DefaultValues, -): Record => ({ - mnq_namespace_id: request.mnqNamespaceId, - mnq_nats_account_id: request.mnqNatsAccountId, - mnq_project_id: request.mnqProjectId, - mnq_region: request.mnqRegion, - subject: request.subject, -}) - -const marshalCreateTriggerRequestMnqSqsClientConfig = ( - request: CreateTriggerRequestMnqSqsClientConfig, - defaults: DefaultValues, -): Record => ({ - mnq_namespace_id: request.mnqNamespaceId, - mnq_project_id: request.mnqProjectId, - mnq_region: request.mnqRegion, - queue: request.queue, -}) - -const marshalCreateTriggerRequestSqsClientConfig = ( - request: CreateTriggerRequestSqsClientConfig, - defaults: DefaultValues, -): Record => ({ - access_key: request.accessKey, - endpoint: request.endpoint, - queue_url: request.queueUrl, - secret_key: request.secretKey, -}) - -const marshalSecret = ( - request: Secret, - defaults: DefaultValues, -): Record => ({ - key: request.key, - value: request.value, -}) - -const marshalUpdateTriggerRequestSqsClientConfig = ( - request: UpdateTriggerRequestSqsClientConfig, - defaults: DefaultValues, -): Record => ({ - access_key: request.accessKey, - secret_key: request.secretKey, -}) - export const marshalCreateCronRequest = ( request: CreateCronRequest, defaults: DefaultValues, @@ -474,6 +456,14 @@ export const marshalCreateDomainRequest = ( hostname: request.hostname, }) +const marshalSecret = ( + request: Secret, + defaults: DefaultValues, +): Record => ({ + key: request.key, + value: request.value, +}) + export const marshalCreateFunctionRequest = ( request: CreateFunctionRequest, defaults: DefaultValues, @@ -481,19 +471,20 @@ export const marshalCreateFunctionRequest = ( description: request.description, environment_variables: request.environmentVariables, handler: request.handler, - http_option: request.httpOption ?? 'unknown_http_option', + http_option: request.httpOption, max_scale: request.maxScale, memory_limit: request.memoryLimit, min_scale: request.minScale, name: request.name || randomName('fn'), namespace_id: request.namespaceId, - privacy: request.privacy ?? 'unknown_privacy', - runtime: request.runtime ?? 'unknown_runtime', - secret_environment_variables: request.secretEnvironmentVariables - ? request.secretEnvironmentVariables.map(elt => - marshalSecret(elt, defaults), - ) - : undefined, + privacy: request.privacy, + runtime: request.runtime, + secret_environment_variables: + request.secretEnvironmentVariables !== undefined + ? request.secretEnvironmentVariables.map(elt => + marshalSecret(elt, defaults), + ) + : undefined, timeout: request.timeout, }) @@ -505,11 +496,12 @@ export const marshalCreateNamespaceRequest = ( environment_variables: request.environmentVariables, name: request.name || randomName('ns'), project_id: request.projectId ?? defaults.defaultProjectId, - secret_environment_variables: request.secretEnvironmentVariables - ? request.secretEnvironmentVariables.map(elt => - marshalSecret(elt, defaults), - ) - : undefined, + secret_environment_variables: + request.secretEnvironmentVariables !== undefined + ? request.secretEnvironmentVariables.map(elt => + marshalSecret(elt, defaults), + ) + : undefined, }) export const marshalCreateTokenRequest = ( @@ -519,17 +511,42 @@ export const marshalCreateTokenRequest = ( description: request.description, expires_at: request.expiresAt, ...resolveOneOf([ - { - param: 'function_id', - value: request.functionId, - }, - { - param: 'namespace_id', - value: request.namespaceId, - }, + { param: 'function_id', value: request.functionId }, + { param: 'namespace_id', value: request.namespaceId }, ]), }) +const marshalCreateTriggerRequestMnqNatsClientConfig = ( + request: CreateTriggerRequestMnqNatsClientConfig, + defaults: DefaultValues, +): Record => ({ + mnq_namespace_id: request.mnqNamespaceId, + mnq_nats_account_id: request.mnqNatsAccountId, + mnq_project_id: request.mnqProjectId, + mnq_region: request.mnqRegion, + subject: request.subject, +}) + +const marshalCreateTriggerRequestMnqSqsClientConfig = ( + request: CreateTriggerRequestMnqSqsClientConfig, + defaults: DefaultValues, +): Record => ({ + mnq_namespace_id: request.mnqNamespaceId, + mnq_project_id: request.mnqProjectId, + mnq_region: request.mnqRegion, + queue: request.queue, +}) + +const marshalCreateTriggerRequestSqsClientConfig = ( + request: CreateTriggerRequestSqsClientConfig, + defaults: DefaultValues, +): Record => ({ + access_key: request.accessKey, + endpoint: request.endpoint, + queue_url: request.queueUrl, + secret_key: request.secretKey, +}) + export const marshalCreateTriggerRequest = ( request: CreateTriggerRequest, defaults: DefaultValues, @@ -537,33 +554,36 @@ export const marshalCreateTriggerRequest = ( description: request.description, function_id: request.functionId, name: request.name, - ...resolveOneOf([ + ...resolveOneOf([ { param: 'scw_sqs_config', - value: request.scwSqsConfig - ? marshalCreateTriggerRequestMnqSqsClientConfig( - request.scwSqsConfig, - defaults, - ) - : undefined, + value: + request.scwSqsConfig !== undefined + ? marshalCreateTriggerRequestMnqSqsClientConfig( + request.scwSqsConfig, + defaults, + ) + : undefined, }, { param: 'scw_nats_config', - value: request.scwNatsConfig - ? marshalCreateTriggerRequestMnqNatsClientConfig( - request.scwNatsConfig, - defaults, - ) - : undefined, + value: + request.scwNatsConfig !== undefined + ? marshalCreateTriggerRequestMnqNatsClientConfig( + request.scwNatsConfig, + defaults, + ) + : undefined, }, { param: 'sqs_config', - value: request.sqsConfig - ? marshalCreateTriggerRequestSqsClientConfig( - request.sqsConfig, - defaults, - ) - : undefined, + value: + request.sqsConfig !== undefined + ? marshalCreateTriggerRequestSqsClientConfig( + request.sqsConfig, + defaults, + ) + : undefined, }, ]), }) @@ -585,18 +605,19 @@ export const marshalUpdateFunctionRequest = ( description: request.description, environment_variables: request.environmentVariables, handler: request.handler, - http_option: request.httpOption ?? 'unknown_http_option', + http_option: request.httpOption, max_scale: request.maxScale, memory_limit: request.memoryLimit, min_scale: request.minScale, - privacy: request.privacy ?? 'unknown_privacy', + privacy: request.privacy, redeploy: request.redeploy, - runtime: request.runtime ?? 'unknown_runtime', - secret_environment_variables: request.secretEnvironmentVariables - ? request.secretEnvironmentVariables.map(elt => - marshalSecret(elt, defaults), - ) - : undefined, + runtime: request.runtime, + secret_environment_variables: + request.secretEnvironmentVariables !== undefined + ? request.secretEnvironmentVariables.map(elt => + marshalSecret(elt, defaults), + ) + : undefined, timeout: request.timeout, }) @@ -606,11 +627,20 @@ export const marshalUpdateNamespaceRequest = ( ): Record => ({ description: request.description, environment_variables: request.environmentVariables, - secret_environment_variables: request.secretEnvironmentVariables - ? request.secretEnvironmentVariables.map(elt => - marshalSecret(elt, defaults), - ) - : undefined, + secret_environment_variables: + request.secretEnvironmentVariables !== undefined + ? request.secretEnvironmentVariables.map(elt => + marshalSecret(elt, defaults), + ) + : undefined, +}) + +const marshalUpdateTriggerRequestSqsClientConfig = ( + request: UpdateTriggerRequestSqsClientConfig, + defaults: DefaultValues, +): Record => ({ + access_key: request.accessKey, + secret_key: request.secretKey, }) export const marshalUpdateTriggerRequest = ( @@ -622,12 +652,13 @@ export const marshalUpdateTriggerRequest = ( ...resolveOneOf([ { param: 'sqs_config', - value: request.sqsConfig - ? marshalUpdateTriggerRequestSqsClientConfig( - request.sqsConfig, - defaults, - ) - : undefined, + value: + request.sqsConfig !== undefined + ? marshalUpdateTriggerRequestSqsClientConfig( + request.sqsConfig, + defaults, + ) + : undefined, }, ]), }) diff --git a/packages/clients/src/api/function/v1beta1/types.gen.ts b/packages/clients/src/api/function/v1beta1/types.gen.ts index 81cc625b1..7a1efdddf 100644 --- a/packages/clients/src/api/function/v1beta1/types.gen.ts +++ b/packages/clients/src/api/function/v1beta1/types.gen.ts @@ -100,8 +100,6 @@ export type NamespaceStatus = | 'creating' | 'pending' -export type NullValue = 'NULL_VALUE' - export type RuntimeStatus = | 'unknown_status' | 'beta' @@ -132,7 +130,51 @@ export type TriggerStatus = | 'creating' | 'pending' -/** Create trigger request. mnq nats client config. */ +export interface SecretHashedValue { + key: string + hashedValue: string +} + +export interface TriggerMnqNatsClientConfig { + /** @deprecated */ + mnqNamespaceId?: string + /** Name of the NATS subject the trigger listens to. */ + subject: string + /** ID of the M&Q NATS account. */ + mnqNatsAccountId: string + /** ID of the M&Q project. */ + mnqProjectId: string + /** Region of the M&Q project. */ + mnqRegion: string + /** ID of the M&Q credentials used to subscribe to the NATS subject. */ + mnqCredentialId?: string +} + +export interface TriggerMnqSqsClientConfig { + /** @deprecated */ + mnqNamespaceId?: string + /** Name of the SQS queue the trigger listens to. */ + queue: string + /** ID of the M&Q project. */ + mnqProjectId: string + /** Region in which the M&Q project is activated. */ + mnqRegion: string + /** ID of the M&Q credentials used to read from the SQS queue. */ + mnqCredentialId?: string +} + +export interface TriggerSqsClientConfig { + endpoint: string + queueUrl: string + accessKey: string + secretKey: string +} + +export interface Secret { + key: string + value?: string +} + export interface CreateTriggerRequestMnqNatsClientConfig { /** @deprecated */ mnqNamespaceId?: string @@ -146,13 +188,12 @@ export interface CreateTriggerRequestMnqNatsClientConfig { mnqRegion: string } -/** Create trigger request. mnq sqs client config. */ export interface CreateTriggerRequestMnqSqsClientConfig { /** @deprecated */ mnqNamespaceId?: string /** Name of the SQS queue the trigger should listen to. */ queue: string - /** ID of the M&Q project. You must have activated SQS on this project. */ + /** You must have activated SQS on this project. */ mnqProjectId: string /** Region in which the M&Q project is activated. */ mnqRegion: string @@ -165,7 +206,6 @@ export interface CreateTriggerRequestSqsClientConfig { secretKey: string } -/** Cron. */ export interface Cron { /** UUID of the cron. */ id: string @@ -181,7 +221,6 @@ export interface Cron { name: string } -/** Domain. */ export interface Domain { /** UUID of the domain. */ id: string @@ -197,12 +236,19 @@ export interface Domain { errorMessage?: string } -export interface DownloadURL { - url: string - headers: Record +export interface Runtime { + name: string + language: string + version: string + defaultHandler: string + codeSample: string + status: RuntimeStatus + statusMessage: string + extension: string + implementation: string + logoUrl: string } -/** Function. */ export interface Function { /** UUID of the function. */ id: string @@ -243,7 +289,7 @@ export interface Function { /** Region in which the function is deployed. */ region: Region /** - * Configuration for handling of HTTP and HTTPS requests. Possible values: + * Possible values: * * - Redirected: Responds to HTTP request with a 301 redirect to ask the clients * to use HTTPS. @@ -253,67 +299,6 @@ export interface Function { runtimeMessage: string } -/** List crons response. */ -export interface ListCronsResponse { - /** Array of crons. */ - crons: Cron[] - /** Total number of crons. */ - totalCount: number -} - -/** List domains response. */ -export interface ListDomainsResponse { - /** Array of domains. */ - domains: Domain[] - /** Total number of domains. */ - totalCount: number -} - -/** List function runtimes response. */ -export interface ListFunctionRuntimesResponse { - /** Array of runtimes available. */ - runtimes: Runtime[] - /** Total number of runtimes. */ - totalCount: number -} - -/** List functions response. */ -export interface ListFunctionsResponse { - /** Array of functions. */ - functions: Function[] - /** Total number of functions. */ - totalCount: number -} - -/** List logs response. */ -export interface ListLogsResponse { - /** Array of logs. */ - logs: Log[] - /** Total number of logs. */ - totalCount: number -} - -/** List namespaces response. */ -export interface ListNamespacesResponse { - namespaces: Namespace[] - /** Total number of namespaces. */ - totalCount: number -} - -export interface ListTokensResponse { - tokens: Token[] - totalCount: number -} - -/** List triggers response. */ -export interface ListTriggersResponse { - /** Total count of existing triggers (matching any filters specified). */ - totalCount: number - /** Triggers on this page. */ - triggers: Trigger[] -} - -/** Log. */ export interface Log { /** Message of the log. */ message: string @@ -329,7 +314,6 @@ export interface Log { stream: LogStream } -/** Namespace. */ export interface Namespace { /** UUID of the namespace. */ id: string @@ -357,30 +341,6 @@ export interface Namespace { region: Region } -export interface Runtime { - name: string - language: string - version: string - defaultHandler: string - codeSample: string - status: RuntimeStatus - statusMessage: string - extension: string - implementation: string - logoUrl: string -} - -export interface Secret { - key: string - value?: string -} - -export interface SecretHashedValue { - key: string - hashedValue: string -} - -/** Token. */ export interface Token { /** UUID of the token. */ id: string @@ -408,7 +368,6 @@ export interface Token { expiresAt?: Date } -/** Trigger. */ export interface Trigger { /** ID of the trigger. */ id: string @@ -447,422 +406,309 @@ export interface Trigger { sqsConfig?: TriggerSqsClientConfig } -/** Trigger. mnq nats client config. */ -export interface TriggerMnqNatsClientConfig { - /** @deprecated */ - mnqNamespaceId?: string - /** Name of the NATS subject the trigger listens to. */ - subject: string - /** ID of the M&Q NATS account. */ - mnqNatsAccountId: string - /** ID of the M&Q project. */ - mnqProjectId: string - /** Region of the M&Q project. */ - mnqRegion: string - /** ID of the M&Q credentials used to subscribe to the NATS subject. */ - mnqCredentialId?: string -} - -/** Trigger. mnq sqs client config. */ -export interface TriggerMnqSqsClientConfig { - /** Name of the SQS queue the trigger listens to. */ - queue: string - /** @deprecated */ - mnqNamespaceId?: string - /** ID of the M&Q project. */ - mnqProjectId: string - /** Region in which the M&Q project is activated. */ - mnqRegion: string - /** ID of the M&Q credentials used to read from the SQS queue. */ - mnqCredentialId?: string -} - -export interface TriggerSqsClientConfig { - endpoint: string - queueUrl: string - accessKey: string - secretKey: string -} - export interface UpdateTriggerRequestSqsClientConfig { accessKey?: string secretKey?: string } -/** Upload url. */ -export interface UploadURL { - /** Upload URL to upload the function to. */ - url: string - /** HTTP headers. */ - headers: Record -} - -export type ListNamespacesRequest = { +export type CreateCronRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number. */ - page?: number - /** Number of namespaces per page. */ - pageSize?: number - /** Order of the namespaces. */ - orderBy?: ListNamespacesRequestOrderBy - /** Name of the namespace. */ + /** UUID of the function to use the cron with. */ + functionId: string + /** Schedule of the cron in UNIX cron format. */ + schedule: string + /** Arguments to use with the cron. */ + args?: Record + /** Name of the cron. */ name?: string - /** UUID of the Organization the namespace belongs to. */ - organizationId?: string - /** UUID of the Project the namespace belongs to. */ - projectId?: string } -export type GetNamespaceRequest = { +export type CreateDomainRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the namespace. */ - namespaceId: string + /** Hostame to create. */ + hostname: string + /** UUID of the function to associate the domain with. */ + functionId: string } -export type CreateNamespaceRequest = { +export type CreateFunctionRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region + /** Name of the function to create. */ name?: string - /** Environment variables of the namespace. */ + /** UUID of the namespace the function will be created in. */ + namespaceId: string + /** Environment variables of the function. */ environmentVariables?: Record - /** UUID of the project in which the namespace will be created. */ - projectId?: string - /** Description of the namespace. */ + /** Minumum number of instances to scale the function to. */ + minScale?: number + /** Maximum number of instances to scale the function to. */ + maxScale?: number + /** Runtime to use with the function. */ + runtime?: FunctionRuntime + /** Memory limit of the function in MB. */ + memoryLimit?: number + /** Request processing time limit for the function. */ + timeout?: string + /** Handler to use with the function. */ + handler?: string + /** Privacy setting of the function. */ + privacy?: FunctionPrivacy + /** Description of the function. */ description?: string - /** Secret environment variables of the namespace. */ secretEnvironmentVariables?: Secret[] + /** + * Possible values: + * + * - Redirected: Responds to HTTP request with a 301 redirect to ask the clients + * to use HTTPS. + * - Enabled: Serve both HTTP and HTTPS traffic. + */ + httpOption?: FunctionHttpOption } -export type UpdateNamespaceRequest = { +export type CreateNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the namespapce. */ - namespaceId: string + name?: string /** Environment variables of the namespace. */ environmentVariables?: Record + /** UUID of the project in which the namespace will be created. */ + projectId?: string /** Description of the namespace. */ description?: string /** Secret environment variables of the namespace. */ secretEnvironmentVariables?: Secret[] } -export type DeleteNamespaceRequest = { +export type CreateTokenRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the namespace. */ - namespaceId: string -} - -export type ListFunctionsRequest = { /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Page number. */ - page?: number - /** Number of functions per page. */ - pageSize?: number - /** Order of the functions. */ - orderBy?: ListFunctionsRequestOrderBy - /** UUID of the namespace the function belongs to. */ - namespaceId: string - /** Name of the function. */ - name?: string - /** UUID of the Organziation the function belongs to. */ - organizationId?: string - /** UUID of the Project the function belongs to. */ - projectId?: string -} - -export type GetFunctionRequest = { + * UUID of the function to associate the token with. + * + * One-of ('scope'): at most one of 'functionId', 'namespaceId' could be set. + */ + functionId?: string /** - * Region to target. If none is passed will use default region from the - * config. + * UUID of the namespace to associate the token with. + * + * One-of ('scope'): at most one of 'functionId', 'namespaceId' could be set. */ - region?: Region - /** UUID of the function. */ - functionId: string + namespaceId?: string + /** Description of the token. */ + description?: string + /** Date on which the token expires. */ + expiresAt?: Date } -export type CreateFunctionRequest = { +export type CreateTriggerRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Name of the function to create. */ - name?: string - /** UUID of the namespace the function will be created in. */ - namespaceId: string - /** Environment variables of the function. */ - environmentVariables?: Record - /** Minumum number of instances to scale the function to. */ - minScale?: number - /** Maximum number of instances to scale the function to. */ - maxScale?: number - /** Runtime to use with the function. */ - runtime?: FunctionRuntime - /** Memory limit of the function in MB. */ - memoryLimit?: number - /** Request processing time limit for the function. */ - timeout?: string - /** Handler to use with the function. */ - handler?: string - /** Privacy setting of the function. */ - privacy?: FunctionPrivacy - /** Description of the function. */ + /** Name of the trigger. */ + name: string + /** ID of the function to trigger. */ + functionId: string + /** Description of the trigger. */ description?: string - secretEnvironmentVariables?: Secret[] /** - * Configure how HTTP and HTTPS requests are handled. Possible values: + * Configuration for a Scaleway M&Q SQS queue. * - * - Redirected: Responds to HTTP request with a 301 redirect to ask the clients - * to use HTTPS. - * - Enabled: Serve both HTTP and HTTPS traffic. + * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', + * 'sqsConfig' could be set. */ - httpOption?: FunctionHttpOption -} - -export type UpdateFunctionRequest = { + scwSqsConfig?: CreateTriggerRequestMnqSqsClientConfig /** - * Region to target. If none is passed will use default region from the - * config. + * Configuration for a Scaleway M&Q NATS subject. + * + * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', + * 'sqsConfig' could be set. */ - region?: Region - /** UUID of the function to update. */ - functionId: string - /** Environment variables of the function to update. */ - environmentVariables?: Record - /** Minumum number of instances to scale the function to. */ - minScale?: number - /** Maximum number of instances to scale the function to. */ - maxScale?: number - /** Runtime to use with the function. */ - runtime?: FunctionRuntime - /** Memory limit of the function in MB. */ - memoryLimit?: number - /** Processing time limit for the function. */ - timeout?: string - /** Redeploy failed function. */ - redeploy?: boolean - /** Handler to use with the function. */ - handler?: string - /** Privacy setting of the function. */ - privacy?: FunctionPrivacy - /** Description of the function. */ - description?: string - /** Secret environment variables of the function. */ - secretEnvironmentVariables?: Secret[] + scwNatsConfig?: CreateTriggerRequestMnqNatsClientConfig /** - * Configure how HTTP and HTTPS requests are handled. Possible values: + * Configuration for an AWS SQS queue. * - * - Redirected: Responds to HTTP request with a 301 redirect to ask the clients - * to use HTTPS. - * - Enabled: Serve both HTTP and HTTPS traffic. + * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', + * 'sqsConfig' could be set. */ - httpOption?: FunctionHttpOption + sqsConfig?: CreateTriggerRequestSqsClientConfig } -export type DeleteFunctionRequest = { +export type DeleteCronRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the function to delete. */ - functionId: string + /** UUID of the cron to delete. */ + cronId: string } -export type DeployFunctionRequest = { +export type DeleteDomainRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the function to deploy. */ - functionId: string + /** UUID of the domain to delete. */ + domainId: string } -export type ListFunctionRuntimesRequest = { +export type DeleteFunctionRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region + /** UUID of the function to delete. */ + functionId: string } -export type GetFunctionUploadURLRequest = { +export type DeleteNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the function to get the upload URL for. */ - functionId: string - /** Size of the archive to upload in bytes. */ - contentLength: number + /** UUID of the namespace. */ + namespaceId: string } -export type GetFunctionDownloadURLRequest = { +export type DeleteTokenRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the function to get the the download URL for. */ - functionId: string + /** UUID of the token to delete. */ + tokenId: string } -export type ListCronsRequest = { +export type DeleteTriggerRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number. */ - page?: number - /** Number of crons per page. */ - pageSize?: number - /** Order of the crons. */ - orderBy?: ListCronsRequestOrderBy - /** UUID of the function. */ - functionId: string + /** ID of the trigger to delete. */ + triggerId: string } -export type GetCronRequest = { +export type DeployFunctionRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the cron to get. */ - cronId: string + /** UUID of the function to deploy. */ + functionId: string } -export type CreateCronRequest = { +export interface DownloadURL { + url: string + headers: Record +} + +export type GetCronRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the function to use the cron with. */ - functionId: string - /** Schedule of the cron in UNIX cron format. */ - schedule: string - /** Arguments to use with the cron. */ - args?: Record - /** Name of the cron. */ - name?: string + /** UUID of the cron to get. */ + cronId: string } -export type UpdateCronRequest = { +export type GetDomainRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the cron to update. */ - cronId: string - /** UUID of the function to use the cron with. */ - functionId?: string - /** Schedule of the cron in UNIX cron format. */ - schedule?: string - /** Arguments to use with the cron. */ - args?: Record - /** Name of the cron. */ - name?: string + /** UUID of the domain to get. */ + domainId: string } -export type DeleteCronRequest = { +export type GetFunctionDownloadURLRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the cron to delete. */ - cronId: string + /** UUID of the function to get the the download URL for. */ + functionId: string } -export type ListLogsRequest = { +export type GetFunctionRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the function to get the logs for. */ + /** UUID of the function. */ functionId: string - /** Page number. */ - page?: number - /** Number of logs per page. */ - pageSize?: number - /** Order of the logs. */ - orderBy?: ListLogsRequestOrderBy } -export type ListDomainsRequest = { +export type GetFunctionUploadURLRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Page number. */ - page?: number - /** Number of domains per page. */ - pageSize?: number - /** Order of the domains. */ - orderBy?: ListDomainsRequestOrderBy - /** UUID of the function the domain is assoicated with. */ + /** UUID of the function to get the upload URL for. */ functionId: string + /** Size of the archive to upload in bytes. */ + contentLength: number } -export type GetDomainRequest = { +export type GetNamespaceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the domain to get. */ - domainId: string + /** UUID of the namespace. */ + namespaceId: string } -export type CreateDomainRequest = { +export type GetTokenRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Hostame to create. */ - hostname: string - /** UUID of the function to associate the domain with. */ - functionId: string + /** UUID of the token to get. */ + tokenId: string } -export type DeleteDomainRequest = { +export type GetTriggerRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the domain to delete. */ - domainId: string + /** ID of the trigger to get. */ + triggerId: string } export type IssueJWTRequest = { @@ -878,41 +724,68 @@ export type IssueJWTRequest = { expiresAt?: Date } -export type CreateTokenRequest = { +export type ListCronsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region + /** Page number. */ + page?: number + /** Number of crons per page. */ + pageSize?: number + /** Order of the crons. */ + orderBy?: ListCronsRequestOrderBy + /** UUID of the function. */ + functionId: string +} + +export interface ListCronsResponse { + /** Array of crons. */ + crons: Cron[] + /** Total number of crons. */ + totalCount: number +} + +export type ListDomainsRequest = { /** - * UUID of the function to associate the token with. - * - * One-of ('scope'): at most one of 'functionId', 'namespaceId' could be set. - */ - functionId?: string - /** - * UUID of the namespace to associate the token with. - * - * One-of ('scope'): at most one of 'functionId', 'namespaceId' could be set. + * Region to target. If none is passed will use default region from the + * config. */ - namespaceId?: string - /** Description of the token. */ - description?: string - /** Date on which the token expires. */ - expiresAt?: Date + region?: Region + /** Page number. */ + page?: number + /** Number of domains per page. */ + pageSize?: number + /** Order of the domains. */ + orderBy?: ListDomainsRequestOrderBy + /** UUID of the function the domain is assoicated with. */ + functionId: string } -export type GetTokenRequest = { +export interface ListDomainsResponse { + /** Array of domains. */ + domains: Domain[] + /** Total number of domains. */ + totalCount: number +} + +export type ListFunctionRuntimesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the token to get. */ - tokenId: string } -export type ListTokensRequest = { +export interface ListFunctionRuntimesResponse { + /** Array of runtimes available. */ + runtimes: Runtime[] + /** Total number of runtimes. */ + totalCount: number +} + +export type ListFunctionsRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -920,69 +793,97 @@ export type ListTokensRequest = { region?: Region /** Page number. */ page?: number - /** Number of tokens per page. */ + /** Number of functions per page. */ pageSize?: number - /** Sort order for the tokens. */ - orderBy?: ListTokensRequestOrderBy - /** UUID of the function the token is assoicated with. */ - functionId?: string - /** UUID of the namespace the token is associated with. */ - namespaceId?: string + /** Order of the functions. */ + orderBy?: ListFunctionsRequestOrderBy + /** UUID of the namespace the function belongs to. */ + namespaceId: string + /** Name of the function. */ + name?: string + /** UUID of the Organziation the function belongs to. */ + organizationId?: string + /** UUID of the Project the function belongs to. */ + projectId?: string } -export type DeleteTokenRequest = { +export interface ListFunctionsResponse { + /** Array of functions. */ + functions: Function[] + /** Total number of functions. */ + totalCount: number +} + +export type ListLogsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the token to delete. */ - tokenId: string + /** UUID of the function to get the logs for. */ + functionId: string + /** Page number. */ + page?: number + /** Number of logs per page. */ + pageSize?: number + /** Order of the logs. */ + orderBy?: ListLogsRequestOrderBy } -export type CreateTriggerRequest = { +export interface ListLogsResponse { + /** Array of logs. */ + logs: Log[] + /** Total number of logs. */ + totalCount: number +} + +export type ListNamespacesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Name of the trigger. */ - name: string - /** ID of the function to trigger. */ - functionId: string - /** Description of the trigger. */ - description?: string - /** - * Configuration for a Scaleway M&Q SQS queue. - * - * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', - * 'sqsConfig' could be set. - */ - scwSqsConfig?: CreateTriggerRequestMnqSqsClientConfig - /** - * Configuration for a Scaleway M&Q NATS subject. - * - * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', - * 'sqsConfig' could be set. - */ - scwNatsConfig?: CreateTriggerRequestMnqNatsClientConfig - /** - * Configuration for an AWS SQS queue. - * - * One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig', - * 'sqsConfig' could be set. - */ - sqsConfig?: CreateTriggerRequestSqsClientConfig + /** Page number. */ + page?: number + /** Number of namespaces per page. */ + pageSize?: number + /** Order of the namespaces. */ + orderBy?: ListNamespacesRequestOrderBy + /** Name of the namespace. */ + name?: string + /** UUID of the Organization the namespace belongs to. */ + organizationId?: string + /** UUID of the Project the namespace belongs to. */ + projectId?: string } -export type GetTriggerRequest = { +export interface ListNamespacesResponse { + namespaces: Namespace[] + /** Total number of namespaces. */ + totalCount: number +} + +export type ListTokensRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the trigger to get. */ - triggerId: string + /** Page number. */ + page?: number + /** Number of tokens per page. */ + pageSize?: number + /** Sort order for the tokens. */ + orderBy?: ListTokensRequestOrderBy + /** UUID of the function the token is assoicated with. */ + functionId?: string + /** UUID of the namespace the token is associated with. */ + namespaceId?: string +} + +export interface ListTokensResponse { + tokens: Token[] + totalCount: number } export type ListTriggersRequest = { @@ -1020,6 +921,87 @@ export type ListTriggersRequest = { projectId?: string } +export interface ListTriggersResponse { + /** Total count of existing triggers (matching any filters specified). */ + totalCount: number + /** Triggers on this page. */ + triggers: Trigger[] +} + +export type UpdateCronRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the cron to update. */ + cronId: string + /** UUID of the function to use the cron with. */ + functionId?: string + /** Schedule of the cron in UNIX cron format. */ + schedule?: string + /** Arguments to use with the cron. */ + args?: Record + /** Name of the cron. */ + name?: string +} + +export type UpdateFunctionRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the function to update. */ + functionId: string + /** Environment variables of the function to update. */ + environmentVariables?: Record + /** Minumum number of instances to scale the function to. */ + minScale?: number + /** Maximum number of instances to scale the function to. */ + maxScale?: number + /** Runtime to use with the function. */ + runtime?: FunctionRuntime + /** Memory limit of the function in MB. */ + memoryLimit?: number + /** Processing time limit for the function. */ + timeout?: string + /** Redeploy failed function. */ + redeploy?: boolean + /** Handler to use with the function. */ + handler?: string + /** Privacy setting of the function. */ + privacy?: FunctionPrivacy + /** Description of the function. */ + description?: string + /** Secret environment variables of the function. */ + secretEnvironmentVariables?: Secret[] + /** + * Possible values: + * + * - Redirected: Responds to HTTP request with a 301 redirect to ask the clients + * to use HTTPS. + * - Enabled: Serve both HTTP and HTTPS traffic. + */ + httpOption?: FunctionHttpOption +} + +export type UpdateNamespaceRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the namespapce. */ + namespaceId: string + /** Environment variables of the namespace. */ + environmentVariables?: Record + /** Description of the namespace. */ + description?: string + /** Secret environment variables of the namespace. */ + secretEnvironmentVariables?: Secret[] +} + export type UpdateTriggerRequest = { /** * Region to target. If none is passed will use default region from the @@ -1040,12 +1022,9 @@ export type UpdateTriggerRequest = { sqsConfig?: UpdateTriggerRequestSqsClientConfig } -export type DeleteTriggerRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** ID of the trigger to delete. */ - triggerId: string +export interface UploadURL { + /** Upload URL to upload the function to. */ + url: string + /** HTTP headers. */ + headers: Record } diff --git a/packages/clients/src/api/iam/v1alpha1/api.gen.ts b/packages/clients/src/api/iam/v1alpha1/api.gen.ts index 60a3b2dd7..422de9336 100644 --- a/packages/clients/src/api/iam/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/api.gen.ts @@ -1162,10 +1162,10 @@ export class API extends ParentAPI { method: 'GET', path: `/iam/v1alpha1/logs`, urlParams: urlParams( - ['action', request.action ?? 'unknown_action'], + ['action', request.action], ['created_after', request.createdAfter], ['created_before', request.createdBefore], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], [ 'organization_id', request.organizationId ?? @@ -1176,7 +1176,7 @@ export class API extends ParentAPI { 'page_size', request.pageSize ?? this.client.settings.defaultPageSize, ], - ['resource_type', request.resourceType ?? 'unknown_resource_type'], + ['resource_type', request.resourceType], ['search', request.search], ), }, diff --git a/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts index ca8cddfd1..4a05a7923 100644 --- a/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts @@ -51,7 +51,26 @@ import type { User, } from './types.gen' -export const unmarshalAPIKey = (data: unknown) => { +export const unmarshalJWT = (data: unknown): JWT => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'JWT' failed as data isn't a dictionary.`, + ) + } + + return { + audienceId: data.audience_id, + createdAt: unmarshalDate(data.created_at), + expiresAt: unmarshalDate(data.expires_at), + ip: data.ip, + issuerId: data.issuer_id, + jti: data.jti, + updatedAt: unmarshalDate(data.updated_at), + userAgent: data.user_agent, + } as JWT +} + +export const unmarshalAPIKey = (data: unknown): APIKey => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'APIKey' failed as data isn't a dictionary.`, @@ -73,7 +92,7 @@ export const unmarshalAPIKey = (data: unknown) => { } as APIKey } -export const unmarshalApplication = (data: unknown) => { +export const unmarshalApplication = (data: unknown): Application => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Application' failed as data isn't a dictionary.`, @@ -92,7 +111,7 @@ export const unmarshalApplication = (data: unknown) => { } as Application } -export const unmarshalGroup = (data: unknown) => { +export const unmarshalGroup = (data: unknown): Group => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Group' failed as data isn't a dictionary.`, @@ -111,26 +130,7 @@ export const unmarshalGroup = (data: unknown) => { } as Group } -export const unmarshalJWT = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'JWT' failed as data isn't a dictionary.`, - ) - } - - return { - audienceId: data.audience_id, - createdAt: unmarshalDate(data.created_at), - expiresAt: unmarshalDate(data.expires_at), - ip: data.ip, - issuerId: data.issuer_id, - jti: data.jti, - updatedAt: unmarshalDate(data.updated_at), - userAgent: data.user_agent, - } as JWT -} - -export const unmarshalLog = (data: unknown) => { +export const unmarshalLog = (data: unknown): Log => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Log' failed as data isn't a dictionary.`, @@ -150,23 +150,7 @@ export const unmarshalLog = (data: unknown) => { } as Log } -const unmarshalPermissionSet = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'PermissionSet' failed as data isn't a dictionary.`, - ) - } - - return { - categories: data.categories, - description: data.description, - id: data.id, - name: data.name, - scopeType: data.scope_type, - } as PermissionSet -} - -export const unmarshalPolicy = (data: unknown) => { +export const unmarshalPolicy = (data: unknown): Policy => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Policy' failed as data isn't a dictionary.`, @@ -191,7 +175,7 @@ export const unmarshalPolicy = (data: unknown) => { } as Policy } -export const unmarshalQuotum = (data: unknown) => { +export const unmarshalQuotum = (data: unknown): Quotum => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Quotum' failed as data isn't a dictionary.`, @@ -205,24 +189,7 @@ export const unmarshalQuotum = (data: unknown) => { } as Quotum } -const unmarshalRule = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Rule' failed as data isn't a dictionary.`, - ) - } - - return { - accountRootUserId: data.account_root_user_id, - id: data.id, - organizationId: data.organization_id, - permissionSetNames: data.permission_set_names, - permissionSetsScopeType: data.permission_sets_scope_type, - projectIds: data.project_ids, - } as Rule -} - -export const unmarshalSSHKey = (data: unknown) => { +export const unmarshalSSHKey = (data: unknown): SSHKey => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SSHKey' failed as data isn't a dictionary.`, @@ -242,7 +209,7 @@ export const unmarshalSSHKey = (data: unknown) => { } as SSHKey } -export const unmarshalUser = (data: unknown) => { +export const unmarshalUser = (data: unknown): User => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'User' failed as data isn't a dictionary.`, @@ -265,7 +232,9 @@ export const unmarshalUser = (data: unknown) => { } as User } -export const unmarshalListAPIKeysResponse = (data: unknown) => { +export const unmarshalListAPIKeysResponse = ( + data: unknown, +): ListAPIKeysResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListAPIKeysResponse' failed as data isn't a dictionary.`, @@ -278,7 +247,9 @@ export const unmarshalListAPIKeysResponse = (data: unknown) => { } as ListAPIKeysResponse } -export const unmarshalListApplicationsResponse = (data: unknown) => { +export const unmarshalListApplicationsResponse = ( + data: unknown, +): ListApplicationsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListApplicationsResponse' failed as data isn't a dictionary.`, @@ -294,7 +265,9 @@ export const unmarshalListApplicationsResponse = (data: unknown) => { } as ListApplicationsResponse } -export const unmarshalListGroupsResponse = (data: unknown) => { +export const unmarshalListGroupsResponse = ( + data: unknown, +): ListGroupsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListGroupsResponse' failed as data isn't a dictionary.`, @@ -307,7 +280,7 @@ export const unmarshalListGroupsResponse = (data: unknown) => { } as ListGroupsResponse } -export const unmarshalListJWTsResponse = (data: unknown) => { +export const unmarshalListJWTsResponse = (data: unknown): ListJWTsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListJWTsResponse' failed as data isn't a dictionary.`, @@ -320,7 +293,7 @@ export const unmarshalListJWTsResponse = (data: unknown) => { } as ListJWTsResponse } -export const unmarshalListLogsResponse = (data: unknown) => { +export const unmarshalListLogsResponse = (data: unknown): ListLogsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListLogsResponse' failed as data isn't a dictionary.`, @@ -333,7 +306,25 @@ export const unmarshalListLogsResponse = (data: unknown) => { } as ListLogsResponse } -export const unmarshalListPermissionSetsResponse = (data: unknown) => { +const unmarshalPermissionSet = (data: unknown): PermissionSet => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'PermissionSet' failed as data isn't a dictionary.`, + ) + } + + return { + categories: data.categories, + description: data.description, + id: data.id, + name: data.name, + scopeType: data.scope_type, + } as PermissionSet +} + +export const unmarshalListPermissionSetsResponse = ( + data: unknown, +): ListPermissionSetsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPermissionSetsResponse' failed as data isn't a dictionary.`, @@ -349,7 +340,9 @@ export const unmarshalListPermissionSetsResponse = (data: unknown) => { } as ListPermissionSetsResponse } -export const unmarshalListPoliciesResponse = (data: unknown) => { +export const unmarshalListPoliciesResponse = ( + data: unknown, +): ListPoliciesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPoliciesResponse' failed as data isn't a dictionary.`, @@ -362,7 +355,9 @@ export const unmarshalListPoliciesResponse = (data: unknown) => { } as ListPoliciesResponse } -export const unmarshalListQuotaResponse = (data: unknown) => { +export const unmarshalListQuotaResponse = ( + data: unknown, +): ListQuotaResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListQuotaResponse' failed as data isn't a dictionary.`, @@ -375,7 +370,26 @@ export const unmarshalListQuotaResponse = (data: unknown) => { } as ListQuotaResponse } -export const unmarshalListRulesResponse = (data: unknown) => { +const unmarshalRule = (data: unknown): Rule => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Rule' failed as data isn't a dictionary.`, + ) + } + + return { + accountRootUserId: data.account_root_user_id, + id: data.id, + organizationId: data.organization_id, + permissionSetNames: data.permission_set_names, + permissionSetsScopeType: data.permission_sets_scope_type, + projectIds: data.project_ids, + } as Rule +} + +export const unmarshalListRulesResponse = ( + data: unknown, +): ListRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListRulesResponse' failed as data isn't a dictionary.`, @@ -388,7 +402,9 @@ export const unmarshalListRulesResponse = (data: unknown) => { } as ListRulesResponse } -export const unmarshalListSSHKeysResponse = (data: unknown) => { +export const unmarshalListSSHKeysResponse = ( + data: unknown, +): ListSSHKeysResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSSHKeysResponse' failed as data isn't a dictionary.`, @@ -401,7 +417,9 @@ export const unmarshalListSSHKeysResponse = (data: unknown) => { } as ListSSHKeysResponse } -export const unmarshalListUsersResponse = (data: unknown) => { +export const unmarshalListUsersResponse = ( + data: unknown, +): ListUsersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`, @@ -414,7 +432,7 @@ export const unmarshalListUsersResponse = (data: unknown) => { } as ListUsersResponse } -export const unmarshalSetRulesResponse = (data: unknown) => { +export const unmarshalSetRulesResponse = (data: unknown): SetRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetRulesResponse' failed as data isn't a dictionary.`, @@ -426,36 +444,13 @@ export const unmarshalSetRulesResponse = (data: unknown) => { } as SetRulesResponse } -const marshalRuleSpecs = ( - request: RuleSpecs, - defaults: DefaultValues, -): Record => ({ - permission_set_names: request.permissionSetNames, - ...resolveOneOf([ - { - param: 'project_ids', - value: request.projectIds, - }, - { - param: 'organization_id', - value: request.organizationId, - }, - ]), -}) - export const marshalAddGroupMemberRequest = ( request: AddGroupMemberRequest, defaults: DefaultValues, ): Record => ({ ...resolveOneOf([ - { - param: 'user_id', - value: request.userId, - }, - { - param: 'application_id', - value: request.applicationId, - }, + { param: 'user_id', value: request.userId }, + { param: 'application_id', value: request.applicationId }, ]), }) @@ -475,14 +470,8 @@ export const marshalCreateAPIKeyRequest = ( description: request.description, expires_at: request.expiresAt, ...resolveOneOf([ - { - param: 'application_id', - value: request.applicationId, - }, - { - param: 'user_id', - value: request.userId, - }, + { param: 'application_id', value: request.applicationId }, + { param: 'user_id', value: request.userId }, ]), }) @@ -504,6 +493,21 @@ export const marshalCreateGroupRequest = ( organization_id: request.organizationId ?? defaults.defaultOrganizationId, }) +const marshalRuleSpecs = ( + request: RuleSpecs, + defaults: DefaultValues, +): Record => ({ + permission_set_names: request.permissionSetNames, + ...resolveOneOf([ + { param: 'project_ids', value: request.projectIds }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, + ]), +}) + export const marshalCreatePolicyRequest = ( request: CreatePolicyRequest, defaults: DefaultValues, @@ -511,26 +515,15 @@ export const marshalCreatePolicyRequest = ( description: request.description, name: request.name || randomName('pol'), organization_id: request.organizationId ?? defaults.defaultOrganizationId, - rules: request.rules - ? request.rules.map(elt => marshalRuleSpecs(elt, defaults)) - : undefined, - ...resolveOneOf([ - { - param: 'user_id', - value: request.userId, - }, - { - param: 'group_id', - value: request.groupId, - }, - { - param: 'application_id', - value: request.applicationId, - }, - { - param: 'no_principal', - value: request.noPrincipal, - }, + rules: + request.rules !== undefined + ? request.rules.map(elt => marshalRuleSpecs(elt, defaults)) + : undefined, + ...resolveOneOf([ + { param: 'user_id', value: request.userId }, + { param: 'group_id', value: request.groupId }, + { param: 'application_id', value: request.applicationId }, + { param: 'no_principal', value: request.noPrincipal }, ]), }) @@ -556,14 +549,8 @@ export const marshalRemoveGroupMemberRequest = ( defaults: DefaultValues, ): Record => ({ ...resolveOneOf([ - { - param: 'user_id', - value: request.userId, - }, - { - param: 'application_id', - value: request.applicationId, - }, + { param: 'user_id', value: request.userId }, + { param: 'application_id', value: request.applicationId }, ]), }) @@ -613,23 +600,11 @@ export const marshalUpdatePolicyRequest = ( ): Record => ({ description: request.description, name: request.name, - ...resolveOneOf([ - { - param: 'user_id', - value: request.userId, - }, - { - param: 'group_id', - value: request.groupId, - }, - { - param: 'application_id', - value: request.applicationId, - }, - { - param: 'no_principal', - value: request.noPrincipal, - }, + ...resolveOneOf([ + { param: 'user_id', value: request.userId }, + { param: 'group_id', value: request.groupId }, + { param: 'application_id', value: request.applicationId }, + { param: 'no_principal', value: request.noPrincipal }, ]), }) diff --git a/packages/clients/src/api/iam/v1alpha1/types.gen.ts b/packages/clients/src/api/iam/v1alpha1/types.gen.ts index fa51ba746..4178ed3bd 100644 --- a/packages/clients/src/api/iam/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/types.gen.ts @@ -89,7 +89,44 @@ export type UserStatus = 'unknown_status' | 'invitation_pending' | 'activated' export type UserType = 'unknown_type' | 'guest' | 'owner' -/** Api key. */ +export interface RuleSpecs { + /** Names of permission sets bound to the rule. */ + permissionSetNames?: string[] + /** + * List of Project IDs the rule is scoped to. + * + * One-of ('scope'): at most one of 'projectIds', 'organizationId' could be + * set. + */ + projectIds?: string[] + /** + * ID of Organization the rule is scoped to. + * + * One-of ('scope'): at most one of 'projectIds', 'organizationId' could be + * set. + */ + organizationId?: string +} + +export interface JWT { + /** JWT ID. */ + jti: string + /** ID of the user who issued the JWT. */ + issuerId: string + /** ID of the user targeted by the JWT. */ + audienceId: string + /** Creation date of the JWT. */ + createdAt?: Date + /** Last update date of the JWT. */ + updatedAt?: Date + /** Expiration date of the JWT. */ + expiresAt?: Date + /** IP address used during the creation of the JWT. */ + ip: string + /** User-agent used during the creation of the JWT. */ + userAgent: string +} + export interface APIKey { /** Access key of the API key. */ accessKey: string @@ -123,7 +160,6 @@ export interface APIKey { creationIp: string } -/** Application. */ export interface Application { /** ID of the application. */ id: string @@ -143,7 +179,6 @@ export interface Application { nbApiKeys: number } -/** Group. */ export interface Group { /** ID of the group. */ id: string @@ -163,112 +198,6 @@ export interface Group { applicationIds: string[] } -/** Jwt. */ -export interface JWT { - /** JWT ID. */ - jti: string - /** ID of the user who issued the JWT. */ - issuerId: string - /** ID of the user targeted by the JWT. */ - audienceId: string - /** Creation date of the JWT. */ - createdAt?: Date - /** Last update date of the JWT. */ - updatedAt?: Date - /** Expiration date of the JWT. */ - expiresAt?: Date - /** IP address used during the creation of the JWT. */ - ip: string - /** User-agent used during the creation of the JWT. */ - userAgent: string -} - -/** List api keys response. */ -export interface ListAPIKeysResponse { - /** List of API keys. */ - apiKeys: APIKey[] - /** Total count of API Keys. */ - totalCount: number -} - -/** List applications response. */ -export interface ListApplicationsResponse { - /** List of applications. */ - applications: Application[] - /** Total count of applications. */ - totalCount: number -} - -/** List groups response. */ -export interface ListGroupsResponse { - /** List of groups. */ - groups: Group[] - /** Total count of groups. */ - totalCount: number -} - -export interface ListJWTsResponse { - jwts: JWT[] - totalCount: number -} - -/** List logs response. */ -export interface ListLogsResponse { - /** List of logs. */ - logs: Log[] - /** Total count of logs. */ - totalCount: number -} - -/** List permission sets response. */ -export interface ListPermissionSetsResponse { - /** List of permission sets. */ - permissionSets: PermissionSet[] - /** Total count of permission sets. */ - totalCount: number -} - -/** List policies response. */ -export interface ListPoliciesResponse { - /** List of policies. */ - policies: Policy[] - /** Total count of policies. */ - totalCount: number -} - -/** List quota response. */ -export interface ListQuotaResponse { - /** List of quota. */ - quota: Quotum[] - /** Total count of quota. */ - totalCount: number -} - -/** List rules response. */ -export interface ListRulesResponse { - /** Rules of the policy. */ - rules: Rule[] - /** Total count of rules. */ - totalCount: number -} - -/** List ssh keys response. */ -export interface ListSSHKeysResponse { - /** List of SSH keys. */ - sshKeys: SSHKey[] - /** Total count of SSH keys. */ - totalCount: number -} - -/** List users response. */ -export interface ListUsersResponse { - /** List of users. */ - users: User[] - /** Total count of users. */ - totalCount: number -} - -/** Log. */ export interface Log { /** Log ID. */ id: string @@ -290,7 +219,6 @@ export interface Log { resourceId: string } -/** Permission set. */ export interface PermissionSet { /** Id of the permission set. */ id: string @@ -304,7 +232,6 @@ export interface PermissionSet { categories?: string[] } -/** Policy. */ export interface Policy { /** Id of the policy. */ id: string @@ -356,7 +283,6 @@ export interface Policy { noPrincipal?: boolean } -/** Quotum. */ export interface Quotum { /** Name of the quota. */ name: string @@ -374,7 +300,6 @@ export interface Quotum { unlimited?: boolean } -/** Rule. */ export interface Rule { /** Id of rule. */ id: string @@ -405,27 +330,6 @@ export interface Rule { accountRootUserId?: string } -/** Rule specs. */ -export interface RuleSpecs { - /** Names of permission sets bound to the rule. */ - permissionSetNames?: string[] - /** - * List of Project IDs the rule is scoped to. - * - * One-of ('scope'): at most one of 'projectIds', 'organizationId' could be - * set. - */ - projectIds?: string[] - /** - * ID of Organization the rule is scoped to. - * - * One-of ('scope'): at most one of 'projectIds', 'organizationId' could be - * set. - */ - organizationId?: string -} - -/** Ssh key. */ export interface SSHKey { /** ID of SSH key. */ id: string @@ -447,13 +351,6 @@ export interface SSHKey { disabled: boolean } -/** Set rules response. */ -export interface SetRulesResponse { - /** Rules of the policy. */ - rules: Rule[] -} - -/** User. */ export interface User { /** ID of user. */ id: string @@ -481,146 +378,64 @@ export interface User { accountRootUserId: string } -export type ListSSHKeysRequest = { - /** Sort order of the SSH keys. */ - orderBy?: ListSSHKeysRequestOrderBy - /** Requested page number. Value must be greater or equal to 1. */ - page?: number - /** Number of items per page. Value must be between 1 and 100. */ - pageSize?: number - /** Filter by Organization ID. */ - organizationId?: string - /** Name of group to find. */ - name?: string - /** Filter by Project ID. */ - projectId?: string - /** Defines whether to include disabled SSH keys or not. */ - disabled?: boolean -} - -export type CreateSSHKeyRequest = { - /** Name of the SSH key. Max length is 1000. */ - name?: string +export type AddGroupMemberRequest = { + /** ID of the group. */ + groupId: string /** - * SSH public key. Currently only the ssh-rsa, ssh-dss (DSA), ssh-ed25519 and - * ecdsa keys with NIST curves are supported. Max length is 65000. + * ID of the user to add. + * + * One-of ('member'): at most one of 'userId', 'applicationId' could be set. */ - publicKey: string - /** Project the resource is attributed to. */ - projectId?: string + userId?: string + /** + * ID of the application to add. + * + * One-of ('member'): at most one of 'userId', 'applicationId' could be set. + */ + applicationId?: string } -export type GetSSHKeyRequest = { - /** ID of the SSH key. */ - sshKeyId: string +export type AddGroupMembersRequest = { + /** ID of the group. */ + groupId: string + /** IDs of the users to add. */ + userIds?: string[] + /** IDs of the applications to add. */ + applicationIds?: string[] } -export type UpdateSSHKeyRequest = { - sshKeyId: string - /** Name of the SSH key. Max length is 1000. */ - name?: string - /** Enable or disable the SSH key. */ - disabled?: boolean +export type ClonePolicyRequest = { + policyId: string } -export type DeleteSSHKeyRequest = { - sshKeyId: string +export type CreateAPIKeyRequest = { + /** + * ID of the application. + * + * One-of ('bearer'): at most one of 'applicationId', 'userId' could be set. + */ + applicationId?: string + /** + * ID of the user. + * + * One-of ('bearer'): at most one of 'applicationId', 'userId' could be set. + */ + userId?: string + /** Expiration date of the API key. */ + expiresAt?: Date + /** Default Project ID to use with Object Storage. */ + defaultProjectId?: string + /** Description of the API key (max length is 200 characters). */ + description: string } -export type ListUsersRequest = { - /** Criteria for sorting results. */ - orderBy?: ListUsersRequestOrderBy - /** Number of results per page. Value must be between 1 and 100. */ - pageSize?: number - /** Page number. Value must be greater or equal to 1. */ - page?: number - /** ID of the Organization to filter. */ +export type CreateApplicationRequest = { + /** Name of the application to create (max length is 64 characters). */ + name?: string + /** ID of the Organization. */ organizationId?: string - /** Filter by list of IDs. */ - userIds?: string[] - /** Filter by MFA status. */ - mfa?: boolean -} - -export type GetUserRequest = { - /** ID of the user to find. */ - userId: string -} - -export type DeleteUserRequest = { - /** ID of the user to delete. */ - userId: string -} - -export type CreateUserRequest = { - /** ID of the Organization. */ - organizationId?: string - /** Email of the user. */ - email: string -} - -export type ListApplicationsRequest = { - /** Criteria for sorting results. */ - orderBy?: ListApplicationsRequestOrderBy - /** Number of results per page. Value must be between 1 and 100. */ - pageSize?: number - /** Page number. Value must be greater than 1. */ - page?: number - /** Name of the application to filter. */ - name?: string - /** ID of the Organization to filter. */ - organizationId?: string - /** Defines whether to filter out editable applications or not. */ - editable?: boolean - /** Filter by list of IDs. */ - applicationIds?: string[] -} - -export type CreateApplicationRequest = { - /** Name of the application to create (max length is 64 characters). */ - name?: string - /** ID of the Organization. */ - organizationId?: string - /** Description of the application (max length is 200 characters). */ - description: string -} - -export type GetApplicationRequest = { - /** ID of the application to find. */ - applicationId: string -} - -export type UpdateApplicationRequest = { - /** ID of the application to update. */ - applicationId: string - /** New name for the application (max length is 64 chars). */ - name?: string - /** New description for the application (max length is 200 chars). */ - description?: string -} - -export type DeleteApplicationRequest = { - /** ID of the application to delete. */ - applicationId: string -} - -export type ListGroupsRequest = { - /** Sort order of groups. */ - orderBy?: ListGroupsRequestOrderBy - /** Requested page number. Value must be greater or equal to 1. */ - page?: number - /** Number of items per page. Value must be between 1 and 100. */ - pageSize?: number - /** Filter by Organization ID. */ - organizationId?: string - /** Name of group to find. */ - name?: string - /** Filter by a list of application IDs. */ - applicationIds?: string[] - /** Filter by a list of user IDs. */ - userIds?: string[] - /** Filter by a list of group IDs. */ - groupIds?: string[] + /** Description of the application (max length is 200 characters). */ + description: string } export type CreateGroupRequest = { @@ -635,100 +450,6 @@ export type CreateGroupRequest = { description: string } -export type GetGroupRequest = { - /** ID of the group. */ - groupId: string -} - -export type UpdateGroupRequest = { - /** ID of the group to update. */ - groupId: string - /** - * New name for the group (max length is 64 chars). MUST be unique inside an - * Organization. - */ - name?: string - /** New description for the group (max length is 200 chars). */ - description?: string -} - -export type SetGroupMembersRequest = { - groupId: string - userIds: string[] - applicationIds: string[] -} - -export type AddGroupMemberRequest = { - /** ID of the group. */ - groupId: string - /** - * ID of the user to add. - * - * One-of ('member'): at most one of 'userId', 'applicationId' could be set. - */ - userId?: string - /** - * ID of the application to add. - * - * One-of ('member'): at most one of 'userId', 'applicationId' could be set. - */ - applicationId?: string -} - -export type AddGroupMembersRequest = { - /** ID of the group. */ - groupId: string - /** IDs of the users to add. */ - userIds?: string[] - /** IDs of the applications to add. */ - applicationIds?: string[] -} - -export type RemoveGroupMemberRequest = { - /** ID of the group. */ - groupId: string - /** - * ID of the user to remove. - * - * One-of ('member'): at most one of 'userId', 'applicationId' could be set. - */ - userId?: string - /** - * ID of the application to remove. - * - * One-of ('member'): at most one of 'userId', 'applicationId' could be set. - */ - applicationId?: string -} - -export type DeleteGroupRequest = { - /** ID of the group to delete. */ - groupId: string -} - -export type ListPoliciesRequest = { - /** Criteria for sorting results. */ - orderBy?: ListPoliciesRequestOrderBy - /** Number of results per page. Value must be between 1 and 100. */ - pageSize?: number - /** Page number. Value must be greater than 1. */ - page?: number - /** ID of the Organization to filter. */ - organizationId?: string - /** Defines whether or not filter out editable policies. */ - editable?: boolean - /** Defines whether or not to filter by list of user IDs. */ - userIds?: string[] - /** Defines whether or not to filter by list of group IDs. */ - groupIds?: string[] - /** Filter by a list of application IDs. */ - applicationIds?: string[] - /** Defines whether or not the policy is attributed to a principal. */ - noPrincipal?: boolean - /** Name of the policy to fetch. */ - policyName?: string -} - export type CreatePolicyRequest = { /** Name of the policy to create (max length is 64 characters). */ name?: string @@ -768,84 +489,106 @@ export type CreatePolicyRequest = { noPrincipal?: boolean } -export type GetPolicyRequest = { - /** Id of policy to search. */ - policyId: string -} - -export type UpdatePolicyRequest = { - /** Id of policy to update. */ - policyId: string - /** New name for the policy (max length is 64 characters). */ +export type CreateSSHKeyRequest = { + /** Name of the SSH key. Max length is 1000. */ name?: string - /** New description of policy (max length is 200 characters). */ - description?: string - /** - * New ID of user attributed to the policy. - * - * One-of ('principal'): at most one of 'userId', 'groupId', 'applicationId', - * 'noPrincipal' could be set. - */ - userId?: string - /** - * New ID of group attributed to the policy. - * - * One-of ('principal'): at most one of 'userId', 'groupId', 'applicationId', - * 'noPrincipal' could be set. - */ - groupId?: string - /** - * New ID of application attributed to the policy. - * - * One-of ('principal'): at most one of 'userId', 'groupId', 'applicationId', - * 'noPrincipal' could be set. - */ - applicationId?: string /** - * Defines whether or not the policy is attributed to a principal. - * - * One-of ('principal'): at most one of 'userId', 'groupId', 'applicationId', - * 'noPrincipal' could be set. + * SSH public key. Currently only the ssh-rsa, ssh-dss (DSA), ssh-ed25519 and + * ecdsa keys with NIST curves are supported. Max length is 65000. */ - noPrincipal?: boolean + publicKey: string + /** Project the resource is attributed to. */ + projectId?: string } -export type DeletePolicyRequest = { - /** Id of policy to delete. */ - policyId: string +export type CreateUserRequest = { + /** ID of the Organization. */ + organizationId?: string + /** Email of the user. */ + email: string } -export type ClonePolicyRequest = { - policyId: string +export type DeleteAPIKeyRequest = { + /** Access key to delete. */ + accessKey: string } -export type SetRulesRequest = { - /** Id of policy to update. */ - policyId: string - /** Rules of the policy to set. */ - rules: RuleSpecs[] +export type DeleteApplicationRequest = { + /** ID of the application to delete. */ + applicationId: string } -export type ListRulesRequest = { - /** Id of policy to search. */ +export type DeleteGroupRequest = { + /** ID of the group to delete. */ + groupId: string +} + +export type DeleteJWTRequest = { + /** JWT ID of the JWT to delete. */ + jti: string +} + +export type DeletePolicyRequest = { + /** Id of policy to delete. */ policyId: string - /** Number of results per page. Value must be between 1 and 100. */ - pageSize?: number - /** Page number. Value must be greater than 1. */ - page?: number } -export type ListPermissionSetsRequest = { - /** Criteria for sorting results. */ - orderBy?: ListPermissionSetsRequestOrderBy - /** Number of results per page. Value must be between 1 and 100. */ - pageSize?: number - /** Page number. Value must be greater than 1. */ - page?: number - /** Filter by Organization ID. */ +export type DeleteSSHKeyRequest = { + sshKeyId: string +} + +export type DeleteUserRequest = { + /** ID of the user to delete. */ + userId: string +} + +export type GetAPIKeyRequest = { + /** Access key to search for. */ + accessKey: string +} + +export type GetApplicationRequest = { + /** ID of the application to find. */ + applicationId: string +} + +export type GetGroupRequest = { + /** ID of the group. */ + groupId: string +} + +export type GetJWTRequest = { + /** JWT ID of the JWT to get. */ + jti: string +} + +export type GetLogRequest = { + /** ID of the log. */ + logId: string +} + +export type GetPolicyRequest = { + /** Id of policy to search. */ + policyId: string +} + +export type GetQuotumRequest = { + /** Name of the quota to get. */ + quotumName: string + /** ID of the Organization. */ organizationId?: string } +export type GetSSHKeyRequest = { + /** ID of the SSH key. */ + sshKeyId: string +} + +export type GetUserRequest = { + /** ID of the user to find. */ + userId: string +} + export type ListAPIKeysRequest = { /** Criteria for sorting results. */ orderBy?: ListAPIKeysRequestOrderBy @@ -881,69 +624,68 @@ export type ListAPIKeysRequest = { bearerType?: BearerType } -export type CreateAPIKeyRequest = { - /** - * ID of the application. - * - * One-of ('bearer'): at most one of 'applicationId', 'userId' could be set. - */ - applicationId?: string - /** - * ID of the user. - * - * One-of ('bearer'): at most one of 'applicationId', 'userId' could be set. - */ - userId?: string - /** Expiration date of the API key. */ - expiresAt?: Date - /** Default Project ID to use with Object Storage. */ - defaultProjectId?: string - /** Description of the API key (max length is 200 characters). */ - description: string -} - -export type GetAPIKeyRequest = { - /** Access key to search for. */ - accessKey: string -} - -export type UpdateAPIKeyRequest = { - /** Access key to update. */ - accessKey: string - /** New default Project ID to set. */ - defaultProjectId?: string - /** New description to update. */ - description?: string -} - -export type DeleteAPIKeyRequest = { - /** Access key to delete. */ - accessKey: string +export interface ListAPIKeysResponse { + /** List of API keys. */ + apiKeys: APIKey[] + /** Total count of API Keys. */ + totalCount: number } -export type ListQuotaRequest = { +export type ListApplicationsRequest = { /** Criteria for sorting results. */ - orderBy?: ListQuotaRequestOrderBy + orderBy?: ListApplicationsRequestOrderBy /** Number of results per page. Value must be between 1 and 100. */ pageSize?: number /** Page number. Value must be greater than 1. */ page?: number - /** Filter by Organization ID. */ + /** Name of the application to filter. */ + name?: string + /** ID of the Organization to filter. */ organizationId?: string + /** Defines whether to filter out editable applications or not. */ + editable?: boolean + /** Filter by list of IDs. */ + applicationIds?: string[] } -export type GetQuotumRequest = { - /** Name of the quota to get. */ - quotumName: string - /** ID of the Organization. */ +export interface ListApplicationsResponse { + /** List of applications. */ + applications: Application[] + /** Total count of applications. */ + totalCount: number +} + +export type ListGroupsRequest = { + /** Sort order of groups. */ + orderBy?: ListGroupsRequestOrderBy + /** Requested page number. Value must be greater or equal to 1. */ + page?: number + /** Number of items per page. Value must be between 1 and 100. */ + pageSize?: number + /** Filter by Organization ID. */ organizationId?: string + /** Name of group to find. */ + name?: string + /** Filter by a list of application IDs. */ + applicationIds?: string[] + /** Filter by a list of user IDs. */ + userIds?: string[] + /** Filter by a list of group IDs. */ + groupIds?: string[] +} + +export interface ListGroupsResponse { + /** List of groups. */ + groups: Group[] + /** Total count of groups. */ + totalCount: number } export type ListJWTsRequest = { /** Criteria for sorting results. */ orderBy?: ListJWTsRequestOrderBy /** ID of the user to search. */ - audienceId: string + audienceId?: string /** Number of results per page. Value must be between 1 and 100. */ pageSize?: number /** Page number. Value must be greater to 1. */ @@ -952,14 +694,9 @@ export type ListJWTsRequest = { expired?: boolean } -export type GetJWTRequest = { - /** JWT ID of the JWT to get. */ - jti: string -} - -export type DeleteJWTRequest = { - /** JWT ID of the JWT to delete. */ - jti: string +export interface ListJWTsResponse { + jwts: JWT[] + totalCount: number } export type ListLogsRequest = { @@ -983,7 +720,247 @@ export type ListLogsRequest = { search?: string } -export type GetLogRequest = { - /** ID of the log. */ - logId: string +export interface ListLogsResponse { + /** List of logs. */ + logs: Log[] + /** Total count of logs. */ + totalCount: number +} + +export type ListPermissionSetsRequest = { + /** Criteria for sorting results. */ + orderBy?: ListPermissionSetsRequestOrderBy + /** Number of results per page. Value must be between 1 and 100. */ + pageSize?: number + /** Page number. Value must be greater than 1. */ + page?: number + /** Filter by Organization ID. */ + organizationId?: string +} + +export interface ListPermissionSetsResponse { + /** List of permission sets. */ + permissionSets: PermissionSet[] + /** Total count of permission sets. */ + totalCount: number +} + +export type ListPoliciesRequest = { + /** Criteria for sorting results. */ + orderBy?: ListPoliciesRequestOrderBy + /** Number of results per page. Value must be between 1 and 100. */ + pageSize?: number + /** Page number. Value must be greater than 1. */ + page?: number + /** ID of the Organization to filter. */ + organizationId?: string + /** Defines whether or not filter out editable policies. */ + editable?: boolean + /** Defines whether or not to filter by list of user IDs. */ + userIds?: string[] + /** Defines whether or not to filter by list of group IDs. */ + groupIds?: string[] + /** Filter by a list of application IDs. */ + applicationIds?: string[] + /** Defines whether or not the policy is attributed to a principal. */ + noPrincipal?: boolean + /** Name of the policy to fetch. */ + policyName?: string +} + +export interface ListPoliciesResponse { + /** List of policies. */ + policies: Policy[] + /** Total count of policies. */ + totalCount: number +} + +export type ListQuotaRequest = { + /** Criteria for sorting results. */ + orderBy?: ListQuotaRequestOrderBy + /** Number of results per page. Value must be between 1 and 100. */ + pageSize?: number + /** Page number. Value must be greater than 1. */ + page?: number + /** Filter by Organization ID. */ + organizationId?: string +} + +export interface ListQuotaResponse { + /** List of quota. */ + quota: Quotum[] + /** Total count of quota. */ + totalCount: number +} + +export type ListRulesRequest = { + /** Id of policy to search. */ + policyId: string + /** Number of results per page. Value must be between 1 and 100. */ + pageSize?: number + /** Page number. Value must be greater than 1. */ + page?: number +} + +export interface ListRulesResponse { + /** Rules of the policy. */ + rules: Rule[] + /** Total count of rules. */ + totalCount: number +} + +export type ListSSHKeysRequest = { + /** Sort order of the SSH keys. */ + orderBy?: ListSSHKeysRequestOrderBy + /** Requested page number. Value must be greater or equal to 1. */ + page?: number + /** Number of items per page. Value must be between 1 and 100. */ + pageSize?: number + /** Filter by Organization ID. */ + organizationId?: string + /** Name of group to find. */ + name?: string + /** Filter by Project ID. */ + projectId?: string + /** Defines whether to include disabled SSH keys or not. */ + disabled?: boolean +} + +export interface ListSSHKeysResponse { + /** List of SSH keys. */ + sshKeys: SSHKey[] + /** Total count of SSH keys. */ + totalCount: number +} + +export type ListUsersRequest = { + /** Criteria for sorting results. */ + orderBy?: ListUsersRequestOrderBy + /** Number of results per page. Value must be between 1 and 100. */ + pageSize?: number + /** Page number. Value must be greater or equal to 1. */ + page?: number + /** ID of the Organization to filter. */ + organizationId?: string + /** Filter by list of IDs. */ + userIds?: string[] + /** Filter by MFA status. */ + mfa?: boolean +} + +export interface ListUsersResponse { + /** List of users. */ + users: User[] + /** Total count of users. */ + totalCount: number +} + +export type RemoveGroupMemberRequest = { + /** ID of the group. */ + groupId: string + /** + * ID of the user to remove. + * + * One-of ('member'): at most one of 'userId', 'applicationId' could be set. + */ + userId?: string + /** + * ID of the application to remove. + * + * One-of ('member'): at most one of 'userId', 'applicationId' could be set. + */ + applicationId?: string +} + +export type SetGroupMembersRequest = { + groupId: string + userIds: string[] + applicationIds: string[] +} + +export type SetRulesRequest = { + /** Id of policy to update. */ + policyId: string + /** Rules of the policy to set. */ + rules: RuleSpecs[] +} + +export interface SetRulesResponse { + /** Rules of the policy. */ + rules: Rule[] +} + +export type UpdateAPIKeyRequest = { + /** Access key to update. */ + accessKey: string + /** New default Project ID to set. */ + defaultProjectId?: string + /** New description to update. */ + description?: string +} + +export type UpdateApplicationRequest = { + /** ID of the application to update. */ + applicationId: string + /** New name for the application (max length is 64 chars). */ + name?: string + /** New description for the application (max length is 200 chars). */ + description?: string +} + +export type UpdateGroupRequest = { + /** ID of the group to update. */ + groupId: string + /** + * New name for the group (max length is 64 chars). MUST be unique inside an + * Organization. + */ + name?: string + /** New description for the group (max length is 200 chars). */ + description?: string +} + +export type UpdatePolicyRequest = { + /** Id of policy to update. */ + policyId: string + /** New name for the policy (max length is 64 characters). */ + name?: string + /** New description of policy (max length is 200 characters). */ + description?: string + /** + * New ID of user attributed to the policy. + * + * One-of ('principal'): at most one of 'userId', 'groupId', 'applicationId', + * 'noPrincipal' could be set. + */ + userId?: string + /** + * New ID of group attributed to the policy. + * + * One-of ('principal'): at most one of 'userId', 'groupId', 'applicationId', + * 'noPrincipal' could be set. + */ + groupId?: string + /** + * New ID of application attributed to the policy. + * + * One-of ('principal'): at most one of 'userId', 'groupId', 'applicationId', + * 'noPrincipal' could be set. + */ + applicationId?: string + /** + * Defines whether or not the policy is attributed to a principal. + * + * One-of ('principal'): at most one of 'userId', 'groupId', 'applicationId', + * 'noPrincipal' could be set. + */ + noPrincipal?: boolean +} + +export type UpdateSSHKeyRequest = { + sshKeyId: string + /** Name of the SSH key. Max length is 1000. */ + name?: string + /** Enable or disable the SSH key. */ + disabled?: boolean } diff --git a/packages/clients/src/api/instance/v1/marshalling.gen.ts b/packages/clients/src/api/instance/v1/marshalling.gen.ts index d880d3402..caa65d417 100644 --- a/packages/clients/src/api/instance/v1/marshalling.gen.ts +++ b/packages/clients/src/api/instance/v1/marshalling.gen.ts @@ -24,6 +24,7 @@ import type { CreateSecurityGroupResponse, CreateSecurityGroupRuleRequest, CreateSecurityGroupRuleResponse, + CreateServerRequest, CreateServerResponse, CreateSnapshotRequest, CreateSnapshotResponse, @@ -86,6 +87,7 @@ import type { ServerTypeNetworkInterface, ServerTypeVolumeConstraintSizes, ServerTypeVolumeConstraintsByType, + SetImageRequest, SetPlacementGroupRequest, SetPlacementGroupResponse, SetPlacementGroupServersRequest, @@ -103,6 +105,7 @@ import type { UpdatePlacementGroupServersRequest, UpdatePlacementGroupServersResponse, UpdatePrivateNICRequest, + UpdateServerRequest, UpdateServerResponse, UpdateVolumeRequest, UpdateVolumeResponse, @@ -116,8 +119,6 @@ import type { VolumeTypeConstraints, } from './types.gen' import type { - CreateServerRequest, - SetImageRequest, SetImageResponse, SetSecurityGroupRequest, SetSecurityGroupResponse, @@ -127,20 +128,39 @@ import type { SetServerResponse, SetSnapshotRequest, SetSnapshotResponse, - UpdateServerRequest, } from './types.private.gen' -const unmarshalServerSummary = (data: unknown) => { +export const unmarshalPrivateNIC = (data: unknown): PrivateNIC => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'PrivateNIC' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + macAddress: data.mac_address, + privateNetworkId: data.private_network_id, + serverId: data.server_id, + state: data.state, + tags: data.tags, + } as PrivateNIC +} + +const unmarshalServerSummary = (data: unknown): ServerSummary => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ServerSummary' failed as data isn't a dictionary.`, ) } - return { id: data.id, name: data.name } as ServerSummary + return { + id: data.id, + name: data.name, + } as ServerSummary } -const unmarshalBootscript = (data: unknown) => { +const unmarshalBootscript = (data: unknown): Bootscript => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Bootscript' failed as data isn't a dictionary.`, @@ -163,33 +183,7 @@ const unmarshalBootscript = (data: unknown) => { } as Bootscript } -const unmarshalServerTypeNetworkInterface = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ServerTypeNetworkInterface' failed as data isn't a dictionary.`, - ) - } - - return { - internalBandwidth: data.internal_bandwidth, - internetBandwidth: data.internet_bandwidth, - } as ServerTypeNetworkInterface -} - -const unmarshalServerTypeVolumeConstraintSizes = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ServerTypeVolumeConstraintSizes' failed as data isn't a dictionary.`, - ) - } - - return { - maxSize: data.max_size, - minSize: data.min_size, - } as ServerTypeVolumeConstraintSizes -} - -const unmarshalVolume = (data: unknown) => { +const unmarshalVolume = (data: unknown): Volume => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`, @@ -213,7 +207,7 @@ const unmarshalVolume = (data: unknown) => { } as Volume } -const unmarshalVolumeSummary = (data: unknown) => { +const unmarshalVolumeSummary = (data: unknown): VolumeSummary => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'VolumeSummary' failed as data isn't a dictionary.`, @@ -228,7 +222,7 @@ const unmarshalVolumeSummary = (data: unknown) => { } as VolumeSummary } -const unmarshalImage = (data: unknown) => { +const unmarshalImage = (data: unknown): Image => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Image' failed as data isn't a dictionary.`, @@ -258,338 +252,285 @@ const unmarshalImage = (data: unknown) => { } as Image } -const unmarshalPlacementGroup = (data: unknown) => { +export const unmarshalCreateImageResponse = ( + data: unknown, +): CreateImageResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'PlacementGroup' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CreateImageResponse' failed as data isn't a dictionary.`, ) } return { - id: data.id, - name: data.name, - organization: data.organization, - policyMode: data.policy_mode, - policyRespected: data.policy_respected, - policyType: data.policy_type, - project: data.project, - tags: data.tags, - zone: data.zone, - } as PlacementGroup + image: data.image ? unmarshalImage(data.image) : undefined, + } as CreateImageResponse } -export const unmarshalPrivateNIC = (data: unknown) => { +const unmarshalIp = (data: unknown): Ip => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'PrivateNIC' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Ip' failed as data isn't a dictionary.`, ) } return { + address: data.address, id: data.id, - macAddress: data.mac_address, - privateNetworkId: data.private_network_id, - serverId: data.server_id, + organization: data.organization, + prefix: data.prefix, + project: data.project, + reverse: data.reverse, + server: data.server ? unmarshalServerSummary(data.server) : undefined, state: data.state, tags: data.tags, - } as PrivateNIC + type: data.type, + zone: data.zone, + } as Ip } -const unmarshalSecurityGroupSummary = (data: unknown) => { +export const unmarshalCreateIpResponse = (data: unknown): CreateIpResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'SecurityGroupSummary' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CreateIpResponse' failed as data isn't a dictionary.`, ) } - return { id: data.id, name: data.name } as SecurityGroupSummary + return { + ip: data.ip ? unmarshalIp(data.ip) : undefined, + } as CreateIpResponse } -const unmarshalServerIp = (data: unknown) => { +const unmarshalPlacementGroup = (data: unknown): PlacementGroup => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerIp' failed as data isn't a dictionary.`, + `Unmarshalling the type 'PlacementGroup' failed as data isn't a dictionary.`, ) } return { - address: data.address, - dynamic: data.dynamic, - family: data.family, - gateway: data.gateway, id: data.id, - netmask: data.netmask, - provisioningMode: data.provisioning_mode, - state: data.state, + name: data.name, + organization: data.organization, + policyMode: data.policy_mode, + policyRespected: data.policy_respected, + policyType: data.policy_type, + project: data.project, tags: data.tags, - } as ServerIp + zone: data.zone, + } as PlacementGroup } -const unmarshalServerIpv6 = (data: unknown) => { +export const unmarshalCreatePlacementGroupResponse = ( + data: unknown, +): CreatePlacementGroupResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerIpv6' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CreatePlacementGroupResponse' failed as data isn't a dictionary.`, ) } return { - address: data.address, - gateway: data.gateway, - netmask: data.netmask, - } as ServerIpv6 + placementGroup: data.placement_group + ? unmarshalPlacementGroup(data.placement_group) + : undefined, + } as CreatePlacementGroupResponse } -const unmarshalServerLocation = (data: unknown) => { +export const unmarshalCreatePrivateNICResponse = ( + data: unknown, +): CreatePrivateNICResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerLocation' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CreatePrivateNICResponse' failed as data isn't a dictionary.`, ) } return { - clusterId: data.cluster_id, - hypervisorId: data.hypervisor_id, - nodeId: data.node_id, - platformId: data.platform_id, - zoneId: data.zone_id, - } as ServerLocation + privateNic: data.private_nic + ? unmarshalPrivateNIC(data.private_nic) + : undefined, + } as CreatePrivateNICResponse } -const unmarshalServerMaintenance = (data: unknown) => { +const unmarshalSecurityGroup = (data: unknown): SecurityGroup => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerMaintenance' failed as data isn't a dictionary.`, + `Unmarshalling the type 'SecurityGroup' failed as data isn't a dictionary.`, ) } - return { reason: data.reason } as ServerMaintenance + return { + creationDate: unmarshalDate(data.creation_date), + description: data.description, + enableDefaultSecurity: data.enable_default_security, + id: data.id, + inboundDefaultPolicy: data.inbound_default_policy, + modificationDate: unmarshalDate(data.modification_date), + name: data.name, + organization: data.organization, + organizationDefault: data.organization_default, + outboundDefaultPolicy: data.outbound_default_policy, + project: data.project, + projectDefault: data.project_default, + servers: unmarshalArrayOfObject(data.servers, unmarshalServerSummary), + state: data.state, + stateful: data.stateful, + tags: data.tags, + zone: data.zone, + } as SecurityGroup } -const unmarshalServerTypeCapabilities = (data: unknown) => { +export const unmarshalCreateSecurityGroupResponse = ( + data: unknown, +): CreateSecurityGroupResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerTypeCapabilities' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CreateSecurityGroupResponse' failed as data isn't a dictionary.`, ) } return { - blockStorage: data.block_storage, - bootTypes: data.boot_types, - } as ServerTypeCapabilities + securityGroup: data.security_group + ? unmarshalSecurityGroup(data.security_group) + : undefined, + } as CreateSecurityGroupResponse } -const unmarshalServerTypeNetwork = (data: unknown) => { +const unmarshalSecurityGroupRule = (data: unknown): SecurityGroupRule => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerTypeNetwork' failed as data isn't a dictionary.`, + `Unmarshalling the type 'SecurityGroupRule' failed as data isn't a dictionary.`, ) } return { - interfaces: unmarshalArrayOfObject( - data.interfaces, - unmarshalServerTypeNetworkInterface, - ), - ipv6Support: data.ipv6_support, - sumInternalBandwidth: data.sum_internal_bandwidth, - sumInternetBandwidth: data.sum_internet_bandwidth, - } as ServerTypeNetwork + action: data.action, + destPortFrom: data.dest_port_from, + destPortTo: data.dest_port_to, + direction: data.direction, + editable: data.editable, + id: data.id, + ipRange: data.ip_range, + position: data.position, + protocol: data.protocol, + zone: data.zone, + } as SecurityGroupRule } -const unmarshalServerTypeVolumeConstraintsByType = (data: unknown) => { +export const unmarshalCreateSecurityGroupRuleResponse = ( + data: unknown, +): CreateSecurityGroupRuleResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerTypeVolumeConstraintsByType' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CreateSecurityGroupRuleResponse' failed as data isn't a dictionary.`, ) } return { - lSsd: data.l_ssd - ? unmarshalServerTypeVolumeConstraintSizes(data.l_ssd) - : undefined, - } as ServerTypeVolumeConstraintsByType + rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined, + } as CreateSecurityGroupRuleResponse } -const unmarshalSnapshotBaseVolume = (data: unknown) => { +const unmarshalSecurityGroupSummary = (data: unknown): SecurityGroupSummary => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'SnapshotBaseVolume' failed as data isn't a dictionary.`, + `Unmarshalling the type 'SecurityGroupSummary' failed as data isn't a dictionary.`, ) } - return { id: data.id, name: data.name } as SnapshotBaseVolume + return { + id: data.id, + name: data.name, + } as SecurityGroupSummary } -const unmarshalVolumeServer = (data: unknown) => { +const unmarshalServerIp = (data: unknown): ServerIp => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'VolumeServer' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ServerIp' failed as data isn't a dictionary.`, ) } return { - boot: data.boot, - creationDate: unmarshalDate(data.creation_date), - exportUri: data.export_uri, + address: data.address, + dynamic: data.dynamic, + family: data.family, + gateway: data.gateway, id: data.id, - modificationDate: unmarshalDate(data.modification_date), - name: data.name, - organization: data.organization, - project: data.project, - server: data.server ? unmarshalServerSummary(data.server) : undefined, - size: data.size, + netmask: data.netmask, + provisioningMode: data.provisioning_mode, state: data.state, - volumeType: data.volume_type, - zone: data.zone, - } as VolumeServer + tags: data.tags, + } as ServerIp } -const unmarshalVolumeTypeCapabilities = (data: unknown) => { +const unmarshalServerIpv6 = (data: unknown): ServerIpv6 => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'VolumeTypeCapabilities' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ServerIpv6' failed as data isn't a dictionary.`, ) } - return { snapshot: data.snapshot } as VolumeTypeCapabilities + return { + address: data.address, + gateway: data.gateway, + netmask: data.netmask, + } as ServerIpv6 } -const unmarshalVolumeTypeConstraints = (data: unknown) => { +const unmarshalServerLocation = (data: unknown): ServerLocation => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'VolumeTypeConstraints' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ServerLocation' failed as data isn't a dictionary.`, ) } - return { max: data.max, min: data.min } as VolumeTypeConstraints + return { + clusterId: data.cluster_id, + hypervisorId: data.hypervisor_id, + nodeId: data.node_id, + platformId: data.platform_id, + zoneId: data.zone_id, + } as ServerLocation } -const unmarshalDashboard = (data: unknown) => { +const unmarshalServerMaintenance = (data: unknown): ServerMaintenance => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Dashboard' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ServerMaintenance' failed as data isn't a dictionary.`, ) } return { - imagesCount: data.images_count, - ipsCount: data.ips_count, - ipsUnused: data.ips_unused, - placementGroupsCount: data.placement_groups_count, - privateNicsCount: data.private_nics_count, - runningServersCount: data.running_servers_count, - securityGroupsCount: data.security_groups_count, - serversByTypes: data.servers_by_types, - serversCount: data.servers_count, - snapshotsCount: data.snapshots_count, - volumesBSsdCount: data.volumes_b_ssd_count, - volumesBSsdTotalSize: data.volumes_b_ssd_total_size, - volumesCount: data.volumes_count, - volumesLSsdCount: data.volumes_l_ssd_count, - volumesLSsdTotalSize: data.volumes_l_ssd_total_size, - } as Dashboard + reason: data.reason, + } as ServerMaintenance } -const unmarshalGetServerTypesAvailabilityResponseAvailability = ( - data: unknown, -) => { +const unmarshalVolumeServer = (data: unknown): VolumeServer => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'GetServerTypesAvailabilityResponseAvailability' failed as data isn't a dictionary.`, - ) - } - - return { - availability: data.availability, - } as GetServerTypesAvailabilityResponseAvailability -} - -const unmarshalIp = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Ip' failed as data isn't a dictionary.`, - ) - } - - return { - address: data.address, - id: data.id, - organization: data.organization, - prefix: data.prefix, - project: data.project, - reverse: data.reverse, - server: data.server ? unmarshalServerSummary(data.server) : undefined, - state: data.state, - tags: data.tags, - type: data.type, - zone: data.zone, - } as Ip -} - -const unmarshalPlacementGroupServer = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'PlacementGroupServer' failed as data isn't a dictionary.`, - ) - } - - return { - id: data.id, - name: data.name, - policyRespected: data.policy_respected, - } as PlacementGroupServer -} - -const unmarshalSecurityGroup = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'SecurityGroup' failed as data isn't a dictionary.`, + `Unmarshalling the type 'VolumeServer' failed as data isn't a dictionary.`, ) } return { + boot: data.boot, creationDate: unmarshalDate(data.creation_date), - description: data.description, - enableDefaultSecurity: data.enable_default_security, + exportUri: data.export_uri, id: data.id, - inboundDefaultPolicy: data.inbound_default_policy, modificationDate: unmarshalDate(data.modification_date), name: data.name, organization: data.organization, - organizationDefault: data.organization_default, - outboundDefaultPolicy: data.outbound_default_policy, project: data.project, - projectDefault: data.project_default, - servers: unmarshalArrayOfObject(data.servers, unmarshalServerSummary), + server: data.server ? unmarshalServerSummary(data.server) : undefined, + size: data.size, state: data.state, - stateful: data.stateful, - tags: data.tags, - zone: data.zone, - } as SecurityGroup -} - -const unmarshalSecurityGroupRule = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'SecurityGroupRule' failed as data isn't a dictionary.`, - ) - } - - return { - action: data.action, - destPortFrom: data.dest_port_from, - destPortTo: data.dest_port_to, - direction: data.direction, - editable: data.editable, - id: data.id, - ipRange: data.ip_range, - position: data.position, - protocol: data.protocol, + volumeType: data.volume_type, zone: data.zone, - } as SecurityGroupRule + } as VolumeServer } -const unmarshalServer = (data: unknown) => { +const unmarshalServer = (data: unknown): Server => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Server' failed as data isn't a dictionary.`, @@ -599,10 +540,10 @@ const unmarshalServer = (data: unknown) => { return { allowedActions: data.allowed_actions, arch: data.arch, + bootType: data.boot_type, bootscript: data.bootscript ? unmarshalBootscript(data.bootscript) : undefined, - bootType: data.boot_type, commercialType: data.commercial_type, creationDate: unmarshalDate(data.creation_date), dynamicIpRequired: data.dynamic_ip_required, @@ -643,39 +584,34 @@ const unmarshalServer = (data: unknown) => { } as Server } -const unmarshalServerType = (data: unknown) => { +export const unmarshalCreateServerResponse = ( + data: unknown, +): CreateServerResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CreateServerResponse' failed as data isn't a dictionary.`, ) } return { - altNames: data.alt_names, - arch: data.arch, - baremetal: data.baremetal, - capabilities: data.capabilities - ? unmarshalServerTypeCapabilities(data.capabilities) - : undefined, - gpu: data.gpu, - hourlyPrice: data.hourly_price, - monthlyPrice: data.monthly_price, - ncpus: data.ncpus, - network: data.network - ? unmarshalServerTypeNetwork(data.network) - : undefined, - perVolumeConstraint: data.per_volume_constraint - ? unmarshalServerTypeVolumeConstraintsByType(data.per_volume_constraint) - : undefined, - ram: data.ram, - scratchStorageMaxSize: data.scratch_storage_max_size, - volumesConstraint: data.volumes_constraint - ? unmarshalServerTypeVolumeConstraintSizes(data.volumes_constraint) - : undefined, - } as ServerType + server: data.server ? unmarshalServer(data.server) : undefined, + } as CreateServerResponse +} + +const unmarshalSnapshotBaseVolume = (data: unknown): SnapshotBaseVolume => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'SnapshotBaseVolume' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + name: data.name, + } as SnapshotBaseVolume } -const unmarshalSnapshot = (data: unknown) => { +const unmarshalSnapshot = (data: unknown): Snapshot => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`, @@ -701,7 +637,7 @@ const unmarshalSnapshot = (data: unknown) => { } as Snapshot } -const unmarshalTask = (data: unknown) => { +const unmarshalTask = (data: unknown): Task => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Task' failed as data isn't a dictionary.`, @@ -721,279 +657,253 @@ const unmarshalTask = (data: unknown) => { } as Task } -const unmarshalVolumeType = (data: unknown) => { +export const unmarshalCreateSnapshotResponse = ( + data: unknown, +): CreateSnapshotResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CreateSnapshotResponse' failed as data isn't a dictionary.`, ) } return { - capabilities: data.capabilities - ? unmarshalVolumeTypeCapabilities(data.capabilities) - : undefined, - constraints: data.constraints - ? unmarshalVolumeTypeConstraints(data.constraints) - : undefined, - displayName: data.display_name, - } as VolumeType + snapshot: data.snapshot ? unmarshalSnapshot(data.snapshot) : undefined, + task: data.task ? unmarshalTask(data.task) : undefined, + } as CreateSnapshotResponse } -export const unmarshalCreateImageResponse = (data: unknown) => { +export const unmarshalCreateVolumeResponse = ( + data: unknown, +): CreateVolumeResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CreateImageResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CreateVolumeResponse' failed as data isn't a dictionary.`, ) } return { - image: data.image ? unmarshalImage(data.image) : undefined, - } as CreateImageResponse + volume: data.volume ? unmarshalVolume(data.volume) : undefined, + } as CreateVolumeResponse } -export const unmarshalCreateIpResponse = (data: unknown) => { +export const unmarshalExportSnapshotResponse = ( + data: unknown, +): ExportSnapshotResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CreateIpResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ExportSnapshotResponse' failed as data isn't a dictionary.`, ) } - return { ip: data.ip ? unmarshalIp(data.ip) : undefined } as CreateIpResponse + return { + task: data.task ? unmarshalTask(data.task) : undefined, + } as ExportSnapshotResponse } -export const unmarshalCreatePlacementGroupResponse = (data: unknown) => { +export const unmarshalGetBootscriptResponse = ( + data: unknown, +): GetBootscriptResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CreatePlacementGroupResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetBootscriptResponse' failed as data isn't a dictionary.`, ) } return { - placementGroup: data.placement_group - ? unmarshalPlacementGroup(data.placement_group) + bootscript: data.bootscript + ? unmarshalBootscript(data.bootscript) : undefined, - } as CreatePlacementGroupResponse + } as GetBootscriptResponse } -export const unmarshalCreatePrivateNICResponse = (data: unknown) => { +const unmarshalDashboard = (data: unknown): Dashboard => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CreatePrivateNICResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Dashboard' failed as data isn't a dictionary.`, ) } return { - privateNic: data.private_nic - ? unmarshalPrivateNIC(data.private_nic) - : undefined, - } as CreatePrivateNICResponse + imagesCount: data.images_count, + ipsCount: data.ips_count, + ipsUnused: data.ips_unused, + placementGroupsCount: data.placement_groups_count, + privateNicsCount: data.private_nics_count, + runningServersCount: data.running_servers_count, + securityGroupsCount: data.security_groups_count, + serversByTypes: data.servers_by_types, + serversCount: data.servers_count, + snapshotsCount: data.snapshots_count, + volumesBSsdCount: data.volumes_b_ssd_count, + volumesBSsdTotalSize: data.volumes_b_ssd_total_size, + volumesCount: data.volumes_count, + volumesLSsdCount: data.volumes_l_ssd_count, + volumesLSsdTotalSize: data.volumes_l_ssd_total_size, + } as Dashboard } -export const unmarshalCreateSecurityGroupResponse = (data: unknown) => { +export const unmarshalGetDashboardResponse = ( + data: unknown, +): GetDashboardResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CreateSecurityGroupResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetDashboardResponse' failed as data isn't a dictionary.`, ) } return { - securityGroup: data.security_group - ? unmarshalSecurityGroup(data.security_group) - : undefined, - } as CreateSecurityGroupResponse + dashboard: data.dashboard ? unmarshalDashboard(data.dashboard) : undefined, + } as GetDashboardResponse } -export const unmarshalCreateSecurityGroupRuleResponse = (data: unknown) => { +export const unmarshalGetImageResponse = (data: unknown): GetImageResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CreateSecurityGroupRuleResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetImageResponse' failed as data isn't a dictionary.`, ) } return { - rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined, - } as CreateSecurityGroupRuleResponse + image: data.image ? unmarshalImage(data.image) : undefined, + } as GetImageResponse } -export const unmarshalCreateServerResponse = (data: unknown) => { +export const unmarshalGetIpResponse = (data: unknown): GetIpResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CreateServerResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetIpResponse' failed as data isn't a dictionary.`, ) } return { - server: data.server ? unmarshalServer(data.server) : undefined, - } as CreateServerResponse + ip: data.ip ? unmarshalIp(data.ip) : undefined, + } as GetIpResponse } -export const unmarshalCreateSnapshotResponse = (data: unknown) => { +export const unmarshalGetPlacementGroupResponse = ( + data: unknown, +): GetPlacementGroupResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CreateSnapshotResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetPlacementGroupResponse' failed as data isn't a dictionary.`, ) } return { - snapshot: data.snapshot ? unmarshalSnapshot(data.snapshot) : undefined, - task: data.task ? unmarshalTask(data.task) : undefined, - } as CreateSnapshotResponse + placementGroup: data.placement_group + ? unmarshalPlacementGroup(data.placement_group) + : undefined, + } as GetPlacementGroupResponse } -export const unmarshalCreateVolumeResponse = (data: unknown) => { +const unmarshalPlacementGroupServer = (data: unknown): PlacementGroupServer => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'CreateVolumeResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'PlacementGroupServer' failed as data isn't a dictionary.`, ) } return { - volume: data.volume ? unmarshalVolume(data.volume) : undefined, - } as CreateVolumeResponse + id: data.id, + name: data.name, + policyRespected: data.policy_respected, + } as PlacementGroupServer } -export const unmarshalExportSnapshotResponse = (data: unknown) => { +export const unmarshalGetPlacementGroupServersResponse = ( + data: unknown, +): GetPlacementGroupServersResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ExportSnapshotResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetPlacementGroupServersResponse' failed as data isn't a dictionary.`, ) } return { - task: data.task ? unmarshalTask(data.task) : undefined, - } as ExportSnapshotResponse + servers: unmarshalArrayOfObject( + data.servers, + unmarshalPlacementGroupServer, + ), + } as GetPlacementGroupServersResponse } -export const unmarshalGetBootscriptResponse = (data: unknown) => { +export const unmarshalGetPrivateNICResponse = ( + data: unknown, +): GetPrivateNICResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'GetBootscriptResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetPrivateNICResponse' failed as data isn't a dictionary.`, ) } return { - bootscript: data.bootscript - ? unmarshalBootscript(data.bootscript) + privateNic: data.private_nic + ? unmarshalPrivateNIC(data.private_nic) : undefined, - } as GetBootscriptResponse + } as GetPrivateNICResponse } -export const unmarshalGetDashboardResponse = (data: unknown) => { +export const unmarshalGetSecurityGroupResponse = ( + data: unknown, +): GetSecurityGroupResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'GetDashboardResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetSecurityGroupResponse' failed as data isn't a dictionary.`, ) } return { - dashboard: data.dashboard ? unmarshalDashboard(data.dashboard) : undefined, - } as GetDashboardResponse + securityGroup: data.security_group + ? unmarshalSecurityGroup(data.security_group) + : undefined, + } as GetSecurityGroupResponse } -export const unmarshalGetImageResponse = (data: unknown) => { +export const unmarshalGetSecurityGroupRuleResponse = ( + data: unknown, +): GetSecurityGroupRuleResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'GetImageResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetSecurityGroupRuleResponse' failed as data isn't a dictionary.`, ) } return { - image: data.image ? unmarshalImage(data.image) : undefined, - } as GetImageResponse + rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined, + } as GetSecurityGroupRuleResponse } -export const unmarshalGetIpResponse = (data: unknown) => { +export const unmarshalGetServerResponse = ( + data: unknown, +): GetServerResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'GetIpResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetServerResponse' failed as data isn't a dictionary.`, ) } - return { ip: data.ip ? unmarshalIp(data.ip) : undefined } as GetIpResponse + return { + server: data.server ? unmarshalServer(data.server) : undefined, + } as GetServerResponse } -export const unmarshalGetPlacementGroupResponse = (data: unknown) => { +const unmarshalGetServerTypesAvailabilityResponseAvailability = ( + data: unknown, +): GetServerTypesAvailabilityResponseAvailability => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'GetPlacementGroupResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'GetServerTypesAvailabilityResponseAvailability' failed as data isn't a dictionary.`, ) } return { - placementGroup: data.placement_group - ? unmarshalPlacementGroup(data.placement_group) - : undefined, - } as GetPlacementGroupResponse -} - -export const unmarshalGetPlacementGroupServersResponse = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'GetPlacementGroupServersResponse' failed as data isn't a dictionary.`, - ) - } - - return { - servers: unmarshalArrayOfObject( - data.servers, - unmarshalPlacementGroupServer, - ), - } as GetPlacementGroupServersResponse -} - -export const unmarshalGetPrivateNICResponse = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'GetPrivateNICResponse' failed as data isn't a dictionary.`, - ) - } - - return { - privateNic: data.private_nic - ? unmarshalPrivateNIC(data.private_nic) - : undefined, - } as GetPrivateNICResponse -} - -export const unmarshalGetSecurityGroupResponse = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'GetSecurityGroupResponse' failed as data isn't a dictionary.`, - ) - } - - return { - securityGroup: data.security_group - ? unmarshalSecurityGroup(data.security_group) - : undefined, - } as GetSecurityGroupResponse -} - -export const unmarshalGetSecurityGroupRuleResponse = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'GetSecurityGroupRuleResponse' failed as data isn't a dictionary.`, - ) - } - - return { - rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined, - } as GetSecurityGroupRuleResponse -} - -export const unmarshalGetServerResponse = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'GetServerResponse' failed as data isn't a dictionary.`, - ) - } - - return { - server: data.server ? unmarshalServer(data.server) : undefined, - } as GetServerResponse + availability: data.availability, + } as GetServerTypesAvailabilityResponseAvailability } -export const unmarshalGetServerTypesAvailabilityResponse = (data: unknown) => { +export const unmarshalGetServerTypesAvailabilityResponse = ( + data: unknown, +): GetServerTypesAvailabilityResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetServerTypesAvailabilityResponse' failed as data isn't a dictionary.`, @@ -1009,7 +919,9 @@ export const unmarshalGetServerTypesAvailabilityResponse = (data: unknown) => { } as GetServerTypesAvailabilityResponse } -export const unmarshalGetSnapshotResponse = (data: unknown) => { +export const unmarshalGetSnapshotResponse = ( + data: unknown, +): GetSnapshotResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetSnapshotResponse' failed as data isn't a dictionary.`, @@ -1021,7 +933,9 @@ export const unmarshalGetSnapshotResponse = (data: unknown) => { } as GetSnapshotResponse } -export const unmarshalGetVolumeResponse = (data: unknown) => { +export const unmarshalGetVolumeResponse = ( + data: unknown, +): GetVolumeResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GetVolumeResponse' failed as data isn't a dictionary.`, @@ -1033,7 +947,9 @@ export const unmarshalGetVolumeResponse = (data: unknown) => { } as GetVolumeResponse } -export const unmarshalListBootscriptsResponse = (data: unknown) => { +export const unmarshalListBootscriptsResponse = ( + data: unknown, +): ListBootscriptsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListBootscriptsResponse' failed as data isn't a dictionary.`, @@ -1046,7 +962,9 @@ export const unmarshalListBootscriptsResponse = (data: unknown) => { } as ListBootscriptsResponse } -export const unmarshalListImagesResponse = (data: unknown) => { +export const unmarshalListImagesResponse = ( + data: unknown, +): ListImagesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`, @@ -1059,7 +977,7 @@ export const unmarshalListImagesResponse = (data: unknown) => { } as ListImagesResponse } -export const unmarshalListIpsResponse = (data: unknown) => { +export const unmarshalListIpsResponse = (data: unknown): ListIpsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListIpsResponse' failed as data isn't a dictionary.`, @@ -1072,7 +990,9 @@ export const unmarshalListIpsResponse = (data: unknown) => { } as ListIpsResponse } -export const unmarshalListPlacementGroupsResponse = (data: unknown) => { +export const unmarshalListPlacementGroupsResponse = ( + data: unknown, +): ListPlacementGroupsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPlacementGroupsResponse' failed as data isn't a dictionary.`, @@ -1088,7 +1008,9 @@ export const unmarshalListPlacementGroupsResponse = (data: unknown) => { } as ListPlacementGroupsResponse } -export const unmarshalListPrivateNICsResponse = (data: unknown) => { +export const unmarshalListPrivateNICsResponse = ( + data: unknown, +): ListPrivateNICsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPrivateNICsResponse' failed as data isn't a dictionary.`, @@ -1101,7 +1023,9 @@ export const unmarshalListPrivateNICsResponse = (data: unknown) => { } as ListPrivateNICsResponse } -export const unmarshalListSecurityGroupRulesResponse = (data: unknown) => { +export const unmarshalListSecurityGroupRulesResponse = ( + data: unknown, +): ListSecurityGroupRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSecurityGroupRulesResponse' failed as data isn't a dictionary.`, @@ -1114,7 +1038,9 @@ export const unmarshalListSecurityGroupRulesResponse = (data: unknown) => { } as ListSecurityGroupRulesResponse } -export const unmarshalListSecurityGroupsResponse = (data: unknown) => { +export const unmarshalListSecurityGroupsResponse = ( + data: unknown, +): ListSecurityGroupsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSecurityGroupsResponse' failed as data isn't a dictionary.`, @@ -1130,27 +1056,37 @@ export const unmarshalListSecurityGroupsResponse = (data: unknown) => { } as ListSecurityGroupsResponse } -export const unmarshalListServerActionsResponse = (data: unknown) => { +export const unmarshalListServerActionsResponse = ( + data: unknown, +): ListServerActionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListServerActionsResponse' failed as data isn't a dictionary.`, ) } - return { actions: data.actions } as ListServerActionsResponse + return { + actions: data.actions, + } as ListServerActionsResponse } -export const unmarshalListServerUserDataResponse = (data: unknown) => { +export const unmarshalListServerUserDataResponse = ( + data: unknown, +): ListServerUserDataResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListServerUserDataResponse' failed as data isn't a dictionary.`, ) } - return { userData: data.user_data } as ListServerUserDataResponse + return { + userData: data.user_data, + } as ListServerUserDataResponse } -export const unmarshalListServersResponse = (data: unknown) => { +export const unmarshalListServersResponse = ( + data: unknown, +): ListServersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`, @@ -1163,7 +1099,120 @@ export const unmarshalListServersResponse = (data: unknown) => { } as ListServersResponse } -export const unmarshalListServersTypesResponse = (data: unknown) => { +const unmarshalServerTypeNetworkInterface = ( + data: unknown, +): ServerTypeNetworkInterface => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerTypeNetworkInterface' failed as data isn't a dictionary.`, + ) + } + + return { + internalBandwidth: data.internal_bandwidth, + internetBandwidth: data.internet_bandwidth, + } as ServerTypeNetworkInterface +} + +const unmarshalServerTypeVolumeConstraintSizes = ( + data: unknown, +): ServerTypeVolumeConstraintSizes => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerTypeVolumeConstraintSizes' failed as data isn't a dictionary.`, + ) + } + + return { + maxSize: data.max_size, + minSize: data.min_size, + } as ServerTypeVolumeConstraintSizes +} + +const unmarshalServerTypeCapabilities = ( + data: unknown, +): ServerTypeCapabilities => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerTypeCapabilities' failed as data isn't a dictionary.`, + ) + } + + return { + blockStorage: data.block_storage, + bootTypes: data.boot_types, + } as ServerTypeCapabilities +} + +const unmarshalServerTypeNetwork = (data: unknown): ServerTypeNetwork => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerTypeNetwork' failed as data isn't a dictionary.`, + ) + } + + return { + interfaces: unmarshalArrayOfObject( + data.interfaces, + unmarshalServerTypeNetworkInterface, + ), + ipv6Support: data.ipv6_support, + sumInternalBandwidth: data.sum_internal_bandwidth, + sumInternetBandwidth: data.sum_internet_bandwidth, + } as ServerTypeNetwork +} + +const unmarshalServerTypeVolumeConstraintsByType = ( + data: unknown, +): ServerTypeVolumeConstraintsByType => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerTypeVolumeConstraintsByType' failed as data isn't a dictionary.`, + ) + } + + return { + lSsd: data.l_ssd + ? unmarshalServerTypeVolumeConstraintSizes(data.l_ssd) + : undefined, + } as ServerTypeVolumeConstraintsByType +} + +const unmarshalServerType = (data: unknown): ServerType => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`, + ) + } + + return { + altNames: data.alt_names, + arch: data.arch, + baremetal: data.baremetal, + capabilities: data.capabilities + ? unmarshalServerTypeCapabilities(data.capabilities) + : undefined, + gpu: data.gpu, + hourlyPrice: data.hourly_price, + monthlyPrice: data.monthly_price, + ncpus: data.ncpus, + network: data.network + ? unmarshalServerTypeNetwork(data.network) + : undefined, + perVolumeConstraint: data.per_volume_constraint + ? unmarshalServerTypeVolumeConstraintsByType(data.per_volume_constraint) + : undefined, + ram: data.ram, + scratchStorageMaxSize: data.scratch_storage_max_size, + volumesConstraint: data.volumes_constraint + ? unmarshalServerTypeVolumeConstraintSizes(data.volumes_constraint) + : undefined, + } as ServerType +} + +export const unmarshalListServersTypesResponse = ( + data: unknown, +): ListServersTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListServersTypesResponse' failed as data isn't a dictionary.`, @@ -1176,7 +1225,9 @@ export const unmarshalListServersTypesResponse = (data: unknown) => { } as ListServersTypesResponse } -export const unmarshalListSnapshotsResponse = (data: unknown) => { +export const unmarshalListSnapshotsResponse = ( + data: unknown, +): ListSnapshotsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`, @@ -1189,7 +1240,9 @@ export const unmarshalListSnapshotsResponse = (data: unknown) => { } as ListSnapshotsResponse } -export const unmarshalListVolumesResponse = (data: unknown) => { +export const unmarshalListVolumesResponse = ( + data: unknown, +): ListVolumesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`, @@ -1202,7 +1255,56 @@ export const unmarshalListVolumesResponse = (data: unknown) => { } as ListVolumesResponse } -export const unmarshalListVolumesTypesResponse = (data: unknown) => { +const unmarshalVolumeTypeCapabilities = ( + data: unknown, +): VolumeTypeCapabilities => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'VolumeTypeCapabilities' failed as data isn't a dictionary.`, + ) + } + + return { + snapshot: data.snapshot, + } as VolumeTypeCapabilities +} + +const unmarshalVolumeTypeConstraints = ( + data: unknown, +): VolumeTypeConstraints => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'VolumeTypeConstraints' failed as data isn't a dictionary.`, + ) + } + + return { + max: data.max, + min: data.min, + } as VolumeTypeConstraints +} + +const unmarshalVolumeType = (data: unknown): VolumeType => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`, + ) + } + + return { + capabilities: data.capabilities + ? unmarshalVolumeTypeCapabilities(data.capabilities) + : undefined, + constraints: data.constraints + ? unmarshalVolumeTypeConstraints(data.constraints) + : undefined, + displayName: data.display_name, + } as VolumeType +} + +export const unmarshalListVolumesTypesResponse = ( + data: unknown, +): ListVolumesTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListVolumesTypesResponse' failed as data isn't a dictionary.`, @@ -1215,7 +1317,7 @@ export const unmarshalListVolumesTypesResponse = (data: unknown) => { } as ListVolumesTypesResponse } -export const unmarshalMigrationPlan = (data: unknown) => { +export const unmarshalMigrationPlan = (data: unknown): MigrationPlan => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'MigrationPlan' failed as data isn't a dictionary.`, @@ -1229,7 +1331,9 @@ export const unmarshalMigrationPlan = (data: unknown) => { } as MigrationPlan } -export const unmarshalServerActionResponse = (data: unknown) => { +export const unmarshalServerActionResponse = ( + data: unknown, +): ServerActionResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ServerActionResponse' failed as data isn't a dictionary.`, @@ -1241,7 +1345,7 @@ export const unmarshalServerActionResponse = (data: unknown) => { } as ServerActionResponse } -export const unmarshalSetImageResponse = (data: unknown) => { +export const unmarshalSetImageResponse = (data: unknown): SetImageResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetImageResponse' failed as data isn't a dictionary.`, @@ -1253,7 +1357,9 @@ export const unmarshalSetImageResponse = (data: unknown) => { } as SetImageResponse } -export const unmarshalSetPlacementGroupResponse = (data: unknown) => { +export const unmarshalSetPlacementGroupResponse = ( + data: unknown, +): SetPlacementGroupResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetPlacementGroupResponse' failed as data isn't a dictionary.`, @@ -1267,7 +1373,9 @@ export const unmarshalSetPlacementGroupResponse = (data: unknown) => { } as SetPlacementGroupResponse } -export const unmarshalSetPlacementGroupServersResponse = (data: unknown) => { +export const unmarshalSetPlacementGroupServersResponse = ( + data: unknown, +): SetPlacementGroupServersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetPlacementGroupServersResponse' failed as data isn't a dictionary.`, @@ -1282,7 +1390,9 @@ export const unmarshalSetPlacementGroupServersResponse = (data: unknown) => { } as SetPlacementGroupServersResponse } -export const unmarshalSetSecurityGroupResponse = (data: unknown) => { +export const unmarshalSetSecurityGroupResponse = ( + data: unknown, +): SetSecurityGroupResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetSecurityGroupResponse' failed as data isn't a dictionary.`, @@ -1296,7 +1406,9 @@ export const unmarshalSetSecurityGroupResponse = (data: unknown) => { } as SetSecurityGroupResponse } -export const unmarshalSetSecurityGroupRuleResponse = (data: unknown) => { +export const unmarshalSetSecurityGroupRuleResponse = ( + data: unknown, +): SetSecurityGroupRuleResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetSecurityGroupRuleResponse' failed as data isn't a dictionary.`, @@ -1308,7 +1420,9 @@ export const unmarshalSetSecurityGroupRuleResponse = (data: unknown) => { } as SetSecurityGroupRuleResponse } -export const unmarshalSetSecurityGroupRulesResponse = (data: unknown) => { +export const unmarshalSetSecurityGroupRulesResponse = ( + data: unknown, +): SetSecurityGroupRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetSecurityGroupRulesResponse' failed as data isn't a dictionary.`, @@ -1320,7 +1434,9 @@ export const unmarshalSetSecurityGroupRulesResponse = (data: unknown) => { } as SetSecurityGroupRulesResponse } -export const unmarshalSetServerResponse = (data: unknown) => { +export const unmarshalSetServerResponse = ( + data: unknown, +): SetServerResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetServerResponse' failed as data isn't a dictionary.`, @@ -1332,7 +1448,9 @@ export const unmarshalSetServerResponse = (data: unknown) => { } as SetServerResponse } -export const unmarshalSetSnapshotResponse = (data: unknown) => { +export const unmarshalSetSnapshotResponse = ( + data: unknown, +): SetSnapshotResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetSnapshotResponse' failed as data isn't a dictionary.`, @@ -1344,17 +1462,21 @@ export const unmarshalSetSnapshotResponse = (data: unknown) => { } as SetSnapshotResponse } -export const unmarshalUpdateIpResponse = (data: unknown) => { +export const unmarshalUpdateIpResponse = (data: unknown): UpdateIpResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'UpdateIpResponse' failed as data isn't a dictionary.`, ) } - return { ip: data.ip ? unmarshalIp(data.ip) : undefined } as UpdateIpResponse + return { + ip: data.ip ? unmarshalIp(data.ip) : undefined, + } as UpdateIpResponse } -export const unmarshalUpdatePlacementGroupResponse = (data: unknown) => { +export const unmarshalUpdatePlacementGroupResponse = ( + data: unknown, +): UpdatePlacementGroupResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'UpdatePlacementGroupResponse' failed as data isn't a dictionary.`, @@ -1368,7 +1490,9 @@ export const unmarshalUpdatePlacementGroupResponse = (data: unknown) => { } as UpdatePlacementGroupResponse } -export const unmarshalUpdatePlacementGroupServersResponse = (data: unknown) => { +export const unmarshalUpdatePlacementGroupServersResponse = ( + data: unknown, +): UpdatePlacementGroupServersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'UpdatePlacementGroupServersResponse' failed as data isn't a dictionary.`, @@ -1383,7 +1507,9 @@ export const unmarshalUpdatePlacementGroupServersResponse = (data: unknown) => { } as UpdatePlacementGroupServersResponse } -export const unmarshalUpdateServerResponse = (data: unknown) => { +export const unmarshalUpdateServerResponse = ( + data: unknown, +): UpdateServerResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'UpdateServerResponse' failed as data isn't a dictionary.`, @@ -1395,7 +1521,9 @@ export const unmarshalUpdateServerResponse = (data: unknown) => { } as UpdateServerResponse } -export const unmarshalUpdateVolumeResponse = (data: unknown) => { +export const unmarshalUpdateVolumeResponse = ( + data: unknown, +): UpdateVolumeResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'UpdateVolumeResponse' failed as data isn't a dictionary.`, @@ -1407,226 +1535,19 @@ export const unmarshalUpdateVolumeResponse = (data: unknown) => { } as UpdateVolumeResponse } -const marshalServerSummary = ( - request: ServerSummary, +export const marshalApplyBlockMigrationRequest = ( + request: ApplyBlockMigrationRequest, defaults: DefaultValues, ): Record => ({ - id: request.id, - name: request.name, + validation_key: request.validationKey, + ...resolveOneOf([ + { param: 'volume_id', value: request.volumeId }, + { param: 'snapshot_id', value: request.snapshotId }, + ]), }) -const marshalBootscript = ( - request: Bootscript, - defaults: DefaultValues, -): Record => ({ - arch: request.arch, - bootcmdargs: request.bootcmdargs, - default: request.default, - dtb: request.dtb, - id: request.id, - initrd: request.initrd, - kernel: request.kernel, - organization: request.organization, - project: request.project, - public: request.public, - title: request.title, - zone: request.zone, -}) - -const marshalVolume = ( - request: Volume, - defaults: DefaultValues, -): Record => ({ - creation_date: request.creationDate, - export_uri: request.exportUri, - id: request.id, - modification_date: request.modificationDate, - name: request.name, - organization: request.organization, - project: request.project, - server: request.server - ? marshalServerSummary(request.server, defaults) - : undefined, - size: request.size, - state: request.state, - tags: request.tags, - volume_type: request.volumeType, - zone: request.zone, -}) - -const marshalVolumeSummary = ( - request: VolumeSummary, - defaults: DefaultValues, -): Record => ({ - id: request.id, - name: request.name, - size: request.size, - volume_type: request.volumeType, -}) - -const marshalImage = ( - request: Image, - defaults: DefaultValues, -): Record => ({ - arch: request.arch, - creation_date: request.creationDate, - default_bootscript: request.defaultBootscript - ? marshalBootscript(request.defaultBootscript, defaults) - : undefined, - extra_volumes: Object.entries(request.extraVolumes).reduce( - (acc, [key, value]) => ({ - ...acc, - [key]: marshalVolume(value, defaults), - }), - {}, - ), - from_server: request.fromServer, - id: request.id, - modification_date: request.modificationDate, - name: request.name, - organization: request.organization, - project: request.project, - public: request.public, - root_volume: request.rootVolume - ? marshalVolumeSummary(request.rootVolume, defaults) - : undefined, - state: request.state, - tags: request.tags, - zone: request.zone, -}) - -const marshalPlacementGroup = ( - request: PlacementGroup, - defaults: DefaultValues, -): Record => ({ - id: request.id, - name: request.name, - organization: request.organization, - policy_mode: request.policyMode, - policy_respected: request.policyRespected, - policy_type: request.policyType, - project: request.project, - tags: request.tags, - zone: request.zone, -}) - -const marshalPrivateNIC = ( - request: PrivateNIC, - defaults: DefaultValues, -): Record => ({ - id: request.id, - mac_address: request.macAddress, - private_network_id: request.privateNetworkId, - server_id: request.serverId, - state: request.state, - tags: request.tags, -}) - -const marshalSecurityGroupSummary = ( - request: SecurityGroupSummary, - defaults: DefaultValues, -): Record => ({ - id: request.id, - name: request.name, -}) - -const marshalSecurityGroupTemplate = ( - request: SecurityGroupTemplate, - defaults: DefaultValues, -): Record => ({ - id: request.id, - name: request.name, -}) - -const marshalServerActionRequestVolumeBackupTemplate = ( - request: ServerActionRequestVolumeBackupTemplate, - defaults: DefaultValues, -): Record => ({ - volume_type: request.volumeType, -}) - -const marshalServerIp = ( - request: ServerIp, - defaults: DefaultValues, -): Record => ({ - address: request.address, - dynamic: request.dynamic, - family: request.family, - gateway: request.gateway, - id: request.id, - netmask: request.netmask, - provisioning_mode: request.provisioningMode, - state: request.state, - tags: request.tags, -}) - -const marshalServerIpv6 = ( - request: ServerIpv6, - defaults: DefaultValues, -): Record => ({ - address: request.address, - gateway: request.gateway, - netmask: request.netmask, -}) - -const marshalServerLocation = ( - request: ServerLocation, - defaults: DefaultValues, -): Record => ({ - cluster_id: request.clusterId, - hypervisor_id: request.hypervisorId, - node_id: request.nodeId, - platform_id: request.platformId, - zone_id: request.zoneId, -}) - -const marshalServerMaintenance = ( - request: ServerMaintenance, - defaults: DefaultValues, -): Record => ({ - reason: request.reason, -}) - -const marshalSetSecurityGroupRulesRequestRule = ( - request: SetSecurityGroupRulesRequestRule, - defaults: DefaultValues, -): Record => ({ - action: request.action, - dest_port_from: request.destPortFrom, - dest_port_to: request.destPortTo, - direction: request.direction, - editable: request.editable, - id: request.id, - ip_range: request.ipRange, - position: request.position, - protocol: request.protocol, - zone: request.zone, -}) - -const marshalSnapshotBaseVolume = ( - request: SnapshotBaseVolume, - defaults: DefaultValues, -): Record => ({ - id: request.id, - name: request.name, -}) - -const marshalVolumeServerTemplate = ( - request: VolumeServerTemplate, - defaults: DefaultValues, -): Record => ({ - base_snapshot: request.baseSnapshot, - boot: request.boot, - id: request.id, - name: request.name, - organization: request.organization, - project: request.project, - size: request.size, - volume_type: request.volumeType, -}) - -const marshalVolumeTemplate = ( - request: VolumeTemplate, +const marshalVolumeTemplate = ( + request: VolumeTemplate, defaults: DefaultValues, ): Record => ({ id: request.id, @@ -1635,29 +1556,14 @@ const marshalVolumeTemplate = ( volume_type: request.volumeType, ...resolveOneOf([ { - param: 'project', - value: request.project, - }, - { + default: defaults.defaultOrganizationId, param: 'organization', value: request.organization, }, - ]), -}) - -export const marshalApplyBlockMigrationRequest = ( - request: ApplyBlockMigrationRequest, - defaults: DefaultValues, -): Record => ({ - validation_key: request.validationKey, - ...resolveOneOf([ - { - param: 'volume_id', - value: request.volumeId, - }, { - param: 'snapshot_id', - value: request.snapshotId, + default: defaults.defaultProjectId, + param: 'project', + value: request.project, }, ]), }) @@ -1668,30 +1574,31 @@ export const marshalCreateImageRequest = ( ): Record => ({ arch: request.arch, default_bootscript: request.defaultBootscript, - extra_volumes: request.extraVolumes - ? Object.entries(request.extraVolumes).reduce( - (acc, [key, value]) => ({ - ...acc, - [key]: marshalVolumeTemplate(value, defaults), - }), - {}, - ) - : undefined, + extra_volumes: + request.extraVolumes !== undefined + ? Object.entries(request.extraVolumes).reduce( + (acc, [key, value]) => ({ + ...acc, + [key]: marshalVolumeTemplate(value, defaults), + }), + {}, + ) + : undefined, name: request.name || randomName('img'), public: request.public, root_volume: request.rootVolume, tags: request.tags, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project', - value: request.project, - }, { default: defaults.defaultOrganizationId, param: 'organization', value: request.organization, }, + { + default: defaults.defaultProjectId, + param: 'project', + value: request.project, + }, ]), }) @@ -1701,18 +1608,18 @@ export const marshalCreateIpRequest = ( ): Record => ({ server: request.server, tags: request.tags, - type: request.type ?? 'unknown_iptype', + type: request.type, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project', - value: request.project, - }, { default: defaults.defaultOrganizationId, param: 'organization', value: request.organization, }, + { + default: defaults.defaultProjectId, + param: 'project', + value: request.project, + }, ]), }) @@ -1721,20 +1628,20 @@ export const marshalCreatePlacementGroupRequest = ( defaults: DefaultValues, ): Record => ({ name: request.name || randomName('pg'), - policy_mode: request.policyMode ?? 'optional', - policy_type: request.policyType ?? 'max_availability', + policy_mode: request.policyMode, + policy_type: request.policyType, tags: request.tags, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project', - value: request.project, - }, { default: defaults.defaultOrganizationId, param: 'organization', value: request.organization, }, + { + default: defaults.defaultProjectId, + param: 'project', + value: request.project, + }, ]), }) @@ -1753,32 +1660,26 @@ export const marshalCreateSecurityGroupRequest = ( ): Record => ({ description: request.description, enable_default_security: request.enableDefaultSecurity, - inbound_default_policy: request.inboundDefaultPolicy ?? 'accept', + inbound_default_policy: request.inboundDefaultPolicy, name: request.name || randomName('sg'), - outbound_default_policy: request.outboundDefaultPolicy ?? 'accept', + outbound_default_policy: request.outboundDefaultPolicy, stateful: request.stateful, tags: request.tags, ...resolveOneOf([ { - param: 'organization_default', - value: request.organizationDefault, - }, - { - param: 'project_default', - value: request.projectDefault, + default: defaults.defaultOrganizationId, + param: 'organization', + value: request.organization, }, - ]), - ...resolveOneOf([ { default: defaults.defaultProjectId, param: 'project', value: request.project, }, - { - default: defaults.defaultOrganizationId, - param: 'organization', - value: request.organization, - }, + ]), + ...resolveOneOf([ + { param: 'organization_default', value: request.organizationDefault }, + { param: 'project_default', value: request.projectDefault }, ]), }) @@ -1796,6 +1697,20 @@ export const marshalCreateSecurityGroupRuleRequest = ( protocol: request.protocol, }) +const marshalVolumeServerTemplate = ( + request: VolumeServerTemplate, + defaults: DefaultValues, +): Record => ({ + base_snapshot: request.baseSnapshot, + boot: request.boot, + id: request.id, + name: request.name, + organization: request.organization ?? defaults.defaultOrganizationId, + project: request.project ?? defaults.defaultProjectId, + size: request.size, + volume_type: request.volumeType, +}) + export const marshalCreateServerRequest = ( request: CreateServerRequest, defaults: DefaultValues, @@ -1813,26 +1728,27 @@ export const marshalCreateServerRequest = ( routed_ip_enabled: request.routedIpEnabled, security_group: request.securityGroup, tags: request.tags, - volumes: request.volumes - ? Object.entries(request.volumes).reduce( - (acc, [key, value]) => ({ - ...acc, - [key]: marshalVolumeServerTemplate(value, defaults), - }), - {}, - ) - : undefined, + volumes: + request.volumes !== undefined + ? Object.entries(request.volumes).reduce( + (acc, [key, value]) => ({ + ...acc, + [key]: marshalVolumeServerTemplate(value, defaults), + }), + {}, + ) + : undefined, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project', - value: request.project, - }, { default: defaults.defaultOrganizationId, param: 'organization', value: request.organization, }, + { + default: defaults.defaultProjectId, + param: 'project', + value: request.project, + }, ]), }) @@ -1846,18 +1762,18 @@ export const marshalCreateSnapshotRequest = ( size: request.size, tags: request.tags, volume_id: request.volumeId, - volume_type: request.volumeType ?? 'unknown_volume_type', + volume_type: request.volumeType, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project', - value: request.project, - }, { default: defaults.defaultOrganizationId, param: 'organization', value: request.organization, }, + { + default: defaults.defaultProjectId, + param: 'project', + value: request.project, + }, ]), }) @@ -1867,33 +1783,24 @@ export const marshalCreateVolumeRequest = ( ): Record => ({ name: request.name || randomName('vol'), tags: request.tags, - volume_type: request.volumeType ?? 'l_ssd', + volume_type: request.volumeType, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project', - value: request.project, - }, { default: defaults.defaultOrganizationId, param: 'organization', value: request.organization, }, - ]), - ...resolveOneOf([ - { - param: 'size', - value: request.size, - }, - { - param: 'base_volume', - value: request.baseVolume, - }, { - param: 'base_snapshot', - value: request.baseSnapshot, + default: defaults.defaultProjectId, + param: 'project', + value: request.project, }, ]), + ...resolveOneOf([ + { param: 'size', value: request.size }, + { param: 'base_volume', value: request.baseVolume }, + { param: 'base_snapshot', value: request.baseSnapshot }, + ]), }) export const marshalExportSnapshotRequest = ( @@ -1909,35 +1816,95 @@ export const marshalPlanBlockMigrationRequest = ( defaults: DefaultValues, ): Record => ({ ...resolveOneOf([ - { - param: 'volume_id', - value: request.volumeId, - }, - { - param: 'snapshot_id', - value: request.snapshotId, - }, + { param: 'volume_id', value: request.volumeId }, + { param: 'snapshot_id', value: request.snapshotId }, ]), }) +const marshalServerActionRequestVolumeBackupTemplate = ( + request: ServerActionRequestVolumeBackupTemplate, + defaults: DefaultValues, +): Record => ({ + volume_type: request.volumeType, +}) + export const marshalServerActionRequest = ( request: ServerActionRequest, defaults: DefaultValues, ): Record => ({ - action: request.action ?? 'poweron', + action: request.action, + name: request.name, + volumes: + request.volumes !== undefined + ? Object.entries(request.volumes).reduce( + (acc, [key, value]) => ({ + ...acc, + [key]: marshalServerActionRequestVolumeBackupTemplate( + value, + defaults, + ), + }), + {}, + ) + : undefined, +}) + +const marshalServerSummary = ( + request: ServerSummary, + defaults: DefaultValues, +): Record => ({ + id: request.id, + name: request.name, +}) + +const marshalBootscript = ( + request: Bootscript, + defaults: DefaultValues, +): Record => ({ + arch: request.arch, + bootcmdargs: request.bootcmdargs, + default: request.default, + dtb: request.dtb, + id: request.id, + initrd: request.initrd, + kernel: request.kernel, + organization: request.organization, + project: request.project, + public: request.public, + title: request.title, + zone: request.zone, +}) + +const marshalVolume = ( + request: Volume, + defaults: DefaultValues, +): Record => ({ + creation_date: request.creationDate, + export_uri: request.exportUri, + id: request.id, + modification_date: request.modificationDate, + name: request.name, + organization: request.organization, + project: request.project, + server: + request.server !== undefined + ? marshalServerSummary(request.server, defaults) + : undefined, + size: request.size, + state: request.state, + tags: request.tags, + volume_type: request.volumeType, + zone: request.zone, +}) + +const marshalVolumeSummary = ( + request: VolumeSummary, + defaults: DefaultValues, +): Record => ({ + id: request.id, name: request.name, - volumes: request.volumes - ? Object.entries(request.volumes).reduce( - (acc, [key, value]) => ({ - ...acc, - [key]: marshalServerActionRequestVolumeBackupTemplate( - value, - defaults, - ), - }), - {}, - ) - : undefined, + size: request.size, + volume_type: request.volumeType, }) export const marshalSetImageRequest = ( @@ -1946,27 +1913,30 @@ export const marshalSetImageRequest = ( ): Record => ({ arch: request.arch, creation_date: request.creationDate, - default_bootscript: request.defaultBootscript - ? marshalBootscript(request.defaultBootscript, defaults) - : undefined, - extra_volumes: request.extraVolumes - ? Object.entries(request.extraVolumes).reduce( - (acc, [key, value]) => ({ - ...acc, - [key]: marshalVolume(value, defaults), - }), - {}, - ) - : undefined, + default_bootscript: + request.defaultBootscript !== undefined + ? marshalBootscript(request.defaultBootscript, defaults) + : undefined, + extra_volumes: + request.extraVolumes !== undefined + ? Object.entries(request.extraVolumes).reduce( + (acc, [key, value]) => ({ + ...acc, + [key]: marshalVolume(value, defaults), + }), + {}, + ) + : undefined, from_server: request.fromServer, modification_date: request.modificationDate, name: request.name, - organization: request.organization, - project: request.project, + organization: request.organization ?? defaults.defaultOrganizationId, + project: request.project ?? defaults.defaultProjectId, public: request.public, - root_volume: request.rootVolume - ? marshalVolumeSummary(request.rootVolume, defaults) - : undefined, + root_volume: + request.rootVolume !== undefined + ? marshalVolumeSummary(request.rootVolume, defaults) + : undefined, state: request.state, tags: request.tags, }) @@ -1976,10 +1946,10 @@ export const marshalSetPlacementGroupRequest = ( defaults: DefaultValues, ): Record => ({ name: request.name, - organization: request.organization, + organization: request.organization ?? defaults.defaultOrganizationId, policy_mode: request.policyMode, policy_type: request.policyType, - project: request.project, + project: request.project ?? defaults.defaultProjectId, tags: request.tags, }) @@ -2000,14 +1970,15 @@ export const marshalSetSecurityGroupRequest = ( inbound_default_policy: request.inboundDefaultPolicy, modification_date: request.modificationDate, name: request.name, - organization: request.organization, + organization: request.organization ?? defaults.defaultOrganizationId, organization_default: request.organizationDefault, outbound_default_policy: request.outboundDefaultPolicy, - project: request.project, + project: request.project ?? defaults.defaultProjectId, project_default: request.projectDefault, - servers: request.servers - ? request.servers.map(elt => marshalServerSummary(elt, defaults)) - : undefined, + servers: + request.servers !== undefined + ? request.servers.map(elt => marshalServerSummary(elt, defaults)) + : undefined, stateful: request.stateful, tags: request.tags, }) @@ -2027,89 +1998,238 @@ export const marshalSetSecurityGroupRuleRequest = ( protocol: request.protocol, }) +const marshalSetSecurityGroupRulesRequestRule = ( + request: SetSecurityGroupRulesRequestRule, + defaults: DefaultValues, +): Record => ({ + action: request.action, + dest_port_from: request.destPortFrom, + dest_port_to: request.destPortTo, + direction: request.direction, + editable: request.editable, + id: request.id, + ip_range: request.ipRange, + position: request.position, + protocol: request.protocol, + zone: request.zone ?? defaults.defaultZone, +}) + export const marshalSetSecurityGroupRulesRequest = ( request: SetSecurityGroupRulesRequest, defaults: DefaultValues, ): Record => ({ - rules: request.rules - ? request.rules.map(elt => - marshalSetSecurityGroupRulesRequestRule(elt, defaults), - ) - : undefined, + rules: + request.rules !== undefined + ? request.rules.map(elt => + marshalSetSecurityGroupRulesRequestRule(elt, defaults), + ) + : undefined, +}) + +const marshalImage = ( + request: Image, + defaults: DefaultValues, +): Record => ({ + arch: request.arch, + creation_date: request.creationDate, + default_bootscript: + request.defaultBootscript !== undefined + ? marshalBootscript(request.defaultBootscript, defaults) + : undefined, + extra_volumes: Object.entries(request.extraVolumes).reduce( + (acc, [key, value]) => ({ ...acc, [key]: marshalVolume(value, defaults) }), + {}, + ), + from_server: request.fromServer, + id: request.id, + modification_date: request.modificationDate, + name: request.name, + organization: request.organization, + project: request.project, + public: request.public, + root_volume: + request.rootVolume !== undefined + ? marshalVolumeSummary(request.rootVolume, defaults) + : undefined, + state: request.state, + tags: request.tags, + zone: request.zone, +}) + +const marshalPlacementGroup = ( + request: PlacementGroup, + defaults: DefaultValues, +): Record => ({ + id: request.id, + name: request.name, + organization: request.organization, + policy_mode: request.policyMode, + policy_respected: request.policyRespected, + policy_type: request.policyType, + project: request.project, + tags: request.tags, + zone: request.zone, +}) + +const marshalPrivateNIC = ( + request: PrivateNIC, + defaults: DefaultValues, +): Record => ({ + id: request.id, + mac_address: request.macAddress, + private_network_id: request.privateNetworkId, + server_id: request.serverId, + state: request.state, + tags: request.tags, +}) + +const marshalSecurityGroupSummary = ( + request: SecurityGroupSummary, + defaults: DefaultValues, +): Record => ({ + id: request.id, + name: request.name, +}) + +const marshalServerIp = ( + request: ServerIp, + defaults: DefaultValues, +): Record => ({ + address: request.address, + dynamic: request.dynamic, + family: request.family, + gateway: request.gateway, + id: request.id, + netmask: request.netmask, + provisioning_mode: request.provisioningMode, + state: request.state, + tags: request.tags, +}) + +const marshalServerIpv6 = ( + request: ServerIpv6, + defaults: DefaultValues, +): Record => ({ + address: request.address, + gateway: request.gateway, + netmask: request.netmask, +}) + +const marshalServerLocation = ( + request: ServerLocation, + defaults: DefaultValues, +): Record => ({ + cluster_id: request.clusterId, + hypervisor_id: request.hypervisorId, + node_id: request.nodeId, + platform_id: request.platformId, + zone_id: request.zoneId, +}) + +const marshalServerMaintenance = ( + request: ServerMaintenance, + defaults: DefaultValues, +): Record => ({ + reason: request.reason, }) export const marshalSetServerRequest = ( request: SetServerRequest, defaults: DefaultValues, ): Record => ({ - allowed_actions: request.allowedActions, + allowed_actions: + request.allowedActions !== undefined ? request.allowedActions : undefined, arch: request.arch, boot_type: request.bootType, - bootscript: request.bootscript - ? marshalBootscript(request.bootscript, defaults) - : undefined, + bootscript: + request.bootscript !== undefined + ? marshalBootscript(request.bootscript, defaults) + : undefined, commercial_type: request.commercialType, creation_date: request.creationDate, dynamic_ip_required: request.dynamicIpRequired, enable_ipv6: request.enableIpv6, hostname: request.hostname, - image: request.image ? marshalImage(request.image, defaults) : undefined, - ipv6: request.ipv6 ? marshalServerIpv6(request.ipv6, defaults) : undefined, - location: request.location - ? marshalServerLocation(request.location, defaults) - : undefined, - maintenances: request.maintenances - ? request.maintenances.map(elt => marshalServerMaintenance(elt, defaults)) - : undefined, + image: + request.image !== undefined + ? marshalImage(request.image, defaults) + : undefined, + ipv6: + request.ipv6 !== undefined + ? marshalServerIpv6(request.ipv6, defaults) + : undefined, + location: + request.location !== undefined + ? marshalServerLocation(request.location, defaults) + : undefined, + maintenances: + request.maintenances !== undefined + ? request.maintenances.map(elt => marshalServerMaintenance(elt, defaults)) + : undefined, modification_date: request.modificationDate, name: request.name, - organization: request.organization, - placement_group: request.placementGroup - ? marshalPlacementGroup(request.placementGroup, defaults) - : undefined, + organization: request.organization ?? defaults.defaultOrganizationId, + placement_group: + request.placementGroup !== undefined + ? marshalPlacementGroup(request.placementGroup, defaults) + : undefined, private_ip: request.privateIp, - private_nics: request.privateNics - ? request.privateNics.map(elt => marshalPrivateNIC(elt, defaults)) - : undefined, - project: request.project, + private_nics: + request.privateNics !== undefined + ? request.privateNics.map(elt => marshalPrivateNIC(elt, defaults)) + : undefined, + project: request.project ?? defaults.defaultProjectId, protected: request.protected, - public_ip: request.publicIp - ? marshalServerIp(request.publicIp, defaults) - : undefined, - public_ips: request.publicIps - ? request.publicIps.map(elt => marshalServerIp(elt, defaults)) - : undefined, + public_ip: + request.publicIp !== undefined + ? marshalServerIp(request.publicIp, defaults) + : undefined, + public_ips: + request.publicIps !== undefined + ? request.publicIps.map(elt => marshalServerIp(elt, defaults)) + : undefined, routed_ip_enabled: request.routedIpEnabled, - security_group: request.securityGroup - ? marshalSecurityGroupSummary(request.securityGroup, defaults) - : undefined, + security_group: + request.securityGroup !== undefined + ? marshalSecurityGroupSummary(request.securityGroup, defaults) + : undefined, state: request.state, state_detail: request.stateDetail, tags: request.tags, - volumes: request.volumes - ? Object.entries(request.volumes).reduce( - (acc, [key, value]) => ({ - ...acc, - [key]: marshalVolume(value, defaults), - }), - {}, - ) - : undefined, + volumes: + request.volumes !== undefined + ? Object.entries(request.volumes).reduce( + (acc, [key, value]) => ({ + ...acc, + [key]: marshalVolume(value, defaults), + }), + {}, + ) + : undefined, +}) + +const marshalSnapshotBaseVolume = ( + request: SnapshotBaseVolume, + defaults: DefaultValues, +): Record => ({ + id: request.id, + name: request.name, }) export const marshalSetSnapshotRequest = ( request: SetSnapshotRequest, defaults: DefaultValues, ): Record => ({ - base_volume: request.baseVolume - ? marshalSnapshotBaseVolume(request.baseVolume, defaults) - : undefined, + base_volume: + request.baseVolume !== undefined + ? marshalSnapshotBaseVolume(request.baseVolume, defaults) + : undefined, creation_date: request.creationDate, id: request.id, modification_date: request.modificationDate, name: request.name, - organization: request.organization, - project: request.project, + organization: request.organization ?? defaults.defaultOrganizationId, + project: request.project ?? defaults.defaultProjectId, size: request.size, state: request.state, tags: request.tags, @@ -2123,7 +2243,7 @@ export const marshalUpdateIpRequest = ( reverse: request.reverse, server: request.server, tags: request.tags, - type: request.type ?? 'unknown_iptype', + type: request.type, }) export const marshalUpdatePlacementGroupRequest = ( @@ -2150,6 +2270,14 @@ export const marshalUpdatePrivateNICRequest = ( tags: request.tags, }) +const marshalSecurityGroupTemplate = ( + request: SecurityGroupTemplate, + defaults: DefaultValues, +): Record => ({ + id: request.id, + name: request.name, +}) + export const marshalUpdateServerRequest = ( request: UpdateServerRequest, defaults: DefaultValues, @@ -2165,19 +2293,21 @@ export const marshalUpdateServerRequest = ( protected: request.protected, public_ips: request.publicIps, routed_ip_enabled: request.routedIpEnabled, - security_group: request.securityGroup - ? marshalSecurityGroupTemplate(request.securityGroup, defaults) - : undefined, + security_group: + request.securityGroup !== undefined + ? marshalSecurityGroupTemplate(request.securityGroup, defaults) + : undefined, tags: request.tags, - volumes: request.volumes - ? Object.entries(request.volumes).reduce( - (acc, [key, value]) => ({ - ...acc, - [key]: marshalVolumeServerTemplate(value, defaults), - }), - {}, - ) - : undefined, + volumes: + request.volumes !== undefined + ? Object.entries(request.volumes).reduce( + (acc, [key, value]) => ({ + ...acc, + [key]: marshalVolumeServerTemplate(value, defaults), + }), + {}, + ) + : undefined, }) export const marshalUpdateVolumeRequest = ( diff --git a/packages/clients/src/api/instance/v1/types.gen.ts b/packages/clients/src/api/instance/v1/types.gen.ts index 953206330..f015a081d 100644 --- a/packages/clients/src/api/instance/v1/types.gen.ts +++ b/packages/clients/src/api/instance/v1/types.gen.ts @@ -88,11 +88,11 @@ export type TaskStatus = 'pending' | 'started' | 'success' | 'failure' | 'retry' export type VolumeServerState = | 'available' | 'snapshotting' - | 'error' | 'fetching' | 'resizing' | 'saving' | 'hotsyncing' + | 'error' export type VolumeServerVolumeType = | 'l_ssd' @@ -103,11 +103,11 @@ export type VolumeServerVolumeType = export type VolumeState = | 'available' | 'snapshotting' - | 'error' | 'fetching' | 'resizing' | 'saving' | 'hotsyncing' + | 'error' export type VolumeVolumeType = | 'l_ssd' @@ -117,7 +117,11 @@ export type VolumeVolumeType = | 'sbs_volume' | 'sbs_snapshot' -/** Bootscript. */ +export interface ServerSummary { + id: string + name: string +} + export interface Bootscript { /** Bootscript arguments. */ bootcmdargs: string @@ -151,124 +155,54 @@ export interface Bootscript { zone: Zone } -export interface CreateImageResponse { - image?: Image -} - -export interface CreateIpResponse { - ip?: Ip -} - -export interface CreatePlacementGroupResponse { - placementGroup?: PlacementGroup -} - -export interface CreatePrivateNICResponse { - privateNic?: PrivateNIC -} - -export interface CreateSecurityGroupResponse { - securityGroup?: SecurityGroup -} - -export interface CreateSecurityGroupRuleResponse { - rule?: SecurityGroupRule -} - -export interface CreateServerResponse { - server?: Server -} - -export interface CreateSnapshotResponse { - snapshot?: Snapshot - task?: Task -} - -export interface CreateVolumeResponse { - volume?: Volume -} - -export interface Dashboard { - volumesCount: number - runningServersCount: number - serversByTypes: Record - imagesCount: number - snapshotsCount: number - serversCount: number - ipsCount: number - securityGroupsCount: number - ipsUnused: number - volumesLSsdCount: number - volumesBSsdCount: number - volumesLSsdTotalSize: number - volumesBSsdTotalSize: number - privateNicsCount: number - placementGroupsCount: number -} - -export interface ExportSnapshotResponse { - task?: Task -} - -export interface GetBootscriptResponse { - bootscript?: Bootscript -} - -export interface GetDashboardResponse { - dashboard?: Dashboard -} - -export interface GetImageResponse { - image?: Image -} - -export interface GetIpResponse { - ip?: Ip -} - -export interface GetPlacementGroupResponse { - placementGroup?: PlacementGroup -} - -/** Get placement group servers response. */ -export interface GetPlacementGroupServersResponse { - /** Instances attached to the placement group. */ - servers: PlacementGroupServer[] -} - -export interface GetPrivateNICResponse { - privateNic?: PrivateNIC -} - -export interface GetSecurityGroupResponse { - securityGroup?: SecurityGroup -} - -export interface GetSecurityGroupRuleResponse { - rule?: SecurityGroupRule -} - -export interface GetServerResponse { - server?: Server -} - -/** Get server types availability response. */ -export interface GetServerTypesAvailabilityResponse { - /** Map of server types. */ - servers: Record - totalCount: number +export interface Volume { + /** Volume unique ID. */ + id: string + /** Volume name. */ + name: string + /** @deprecated Show the volume NBD export URI. */ + exportUri?: string + /** Volume disk size. */ + size: number + /** Volume type. */ + volumeType: VolumeVolumeType + /** Volume creation date. */ + creationDate?: Date + /** Volume modification date. */ + modificationDate?: Date + /** Volume Organization ID. */ + organization: string + /** Volume Project ID. */ + project: string + /** Volume tags. */ + tags: string[] + /** Instance attached to the volume. */ + server?: ServerSummary + /** Volume state. */ + state: VolumeState + /** Zone in which the volume is located. */ + zone: Zone } -export interface GetServerTypesAvailabilityResponseAvailability { - availability: ServerTypesAvailability +export interface VolumeSummary { + id: string + name: string + size: number + volumeType: VolumeVolumeType } -export interface GetSnapshotResponse { - snapshot?: Snapshot +export interface ServerTypeNetworkInterface { + /** Maximum internal bandwidth in bits per seconds. */ + internalBandwidth?: number + /** Maximum internet bandwidth in bits per seconds. */ + internetBandwidth?: number } -export interface GetVolumeResponse { - volume?: Volume +export interface ServerTypeVolumeConstraintSizes { + /** Minimum volume size in bytes. */ + minSize: number + /** Maximum volume size in bytes. */ + maxSize: number } export interface Image { @@ -287,198 +221,194 @@ export interface Image { state: ImageState project: string tags: string[] + /** Zone to target. If none is passed will use default zone from the config. */ zone: Zone } -export interface Ip { +export interface PlacementGroup { + /** Placement group unique ID. */ id: string - address: string - reverse?: string - server?: ServerSummary + /** Placement group name. */ + name: string + /** Placement group Organization ID. */ organization: string - tags: string[] + /** Placement group Project ID. */ project: string - type: IpType - state: IpState - prefix: string + /** Placement group tags. */ + tags: string[] + /** + * Select the failure mode when the placement cannot be respected, either + * optional or enforced. + */ + policyMode: PlacementGroupPolicyMode + /** + * Select the behavior of the placement group, either low_latency (group) or + * max_availability (spread). + */ + policyType: PlacementGroupPolicyType + /** Returns true if the policy is respected, false otherwise. */ + policyRespected: boolean + /** Zone in which the placement group is located. */ zone: Zone } -/** List bootscripts response. */ -export interface ListBootscriptsResponse { - /** Total number of bootscripts. */ - totalCount: number - /** List of bootscripts. */ - bootscripts: Bootscript[] +export interface PrivateNIC { + /** Private NIC unique ID. */ + id: string + /** Instance to which the private NIC is attached. */ + serverId: string + /** Private Network the private NIC is attached to. */ + privateNetworkId: string + /** Private NIC MAC address. */ + macAddress: string + /** Private NIC state. */ + state: PrivateNICState + /** Private NIC tags. */ + tags: string[] } -/** List images response. */ -export interface ListImagesResponse { - /** Total number of images. */ - totalCount: number - /** List of images. */ - images: Image[] +export interface SecurityGroupSummary { + id: string + name: string } -/** List ips response. */ -export interface ListIpsResponse { - /** Total number of ips. */ - totalCount: number - /** List of ips. */ - ips: Ip[] +export interface ServerIp { + /** Unique ID of the IP address. */ + id: string + /** Instance's public IP-Address. */ + address: string + /** Gateway's IP address. */ + gateway: string + /** CIDR netmask. */ + netmask: string + /** IP address family (inet or inet6). */ + family: ServerIpIpFamily + /** True if the IP address is dynamic. */ + dynamic: boolean + /** Information about this address provisioning mode. */ + provisioningMode: ServerIpProvisioningMode + /** Tags associated with the IP. */ + tags: string[] + state: ServerIpState } -/** List placement groups response. */ -export interface ListPlacementGroupsResponse { - /** Total number of placement groups. */ - totalCount: number - /** List of placement groups. */ - placementGroups: PlacementGroup[] +export interface ServerIpv6 { + /** Instance IPv6 IP-Address. */ + address: string + /** IPv6 IP-addresses gateway. */ + gateway: string + /** IPv6 IP-addresses CIDR netmask. */ + netmask: string } -export interface ListPrivateNICsResponse { - privateNics: PrivateNIC[] - totalCount: number -} - -/** List security group rules response. */ -export interface ListSecurityGroupRulesResponse { - /** Total number of security groups. */ - totalCount: number - /** List of security rules. */ - rules: SecurityGroupRule[] -} - -/** List security groups response. */ -export interface ListSecurityGroupsResponse { - /** Total number of security groups. */ - totalCount: number - /** List of security groups. */ - securityGroups: SecurityGroup[] +export interface ServerLocation { + clusterId: string + hypervisorId: string + nodeId: string + platformId: string + zoneId: string } -export interface ListServerActionsResponse { - actions: ServerAction[] +export interface ServerMaintenance { + reason: string } -export interface ListServerUserDataResponse { - userData: string[] +export interface VolumeServer { + id: string + name: string + exportUri: string + organization: string + server?: ServerSummary + size: number + volumeType: VolumeServerVolumeType + creationDate?: Date + modificationDate?: Date + state: VolumeServerState + project: string + boot: boolean + /** Zone to target. If none is passed will use default zone from the config. */ + zone: Zone } -/** List servers response. */ -export interface ListServersResponse { - /** Total number of Instances. */ - totalCount: number - /** List of Instances. */ - servers: Server[] +export interface SnapshotBaseVolume { + /** Volume ID on which the snapshot is based. */ + id: string + /** Volume name on which the snapshot is based on. */ + name: string } -/** List servers types response. */ -export interface ListServersTypesResponse { - /** Total number of Instance types. */ - totalCount: number - /** List of Instance types. */ - servers: Record +export interface ServerTypeCapabilities { + /** Defines whether the Instance supports block storage. */ + blockStorage?: boolean + /** List of supported boot types. */ + bootTypes: BootType[] } -/** List snapshots response. */ -export interface ListSnapshotsResponse { - /** Total number of snapshots. */ - totalCount: number - /** List of snapshots. */ - snapshots: Snapshot[] +export interface ServerTypeNetwork { + /** List of available network interfaces. */ + interfaces: ServerTypeNetworkInterface[] + /** Total maximum internal bandwidth in bits per seconds. */ + sumInternalBandwidth?: number + /** Total maximum internet bandwidth in bits per seconds. */ + sumInternetBandwidth?: number + /** True if IPv6 is enabled. */ + ipv6Support: boolean } -/** List volumes response. */ -export interface ListVolumesResponse { - /** Total number of volumes. */ - totalCount: number - /** List of volumes. */ - volumes: Volume[] +export interface ServerTypeVolumeConstraintsByType { + /** Local SSD volumes. */ + lSsd?: ServerTypeVolumeConstraintSizes } -/** List volumes types response. */ -export interface ListVolumesTypesResponse { - /** Total number of volume types. */ - totalCount: number - /** Map of volume types. */ - volumes: Record +export interface VolumeTypeCapabilities { + snapshot: boolean } -/** Migration plan. */ -export interface MigrationPlan { - /** - * A volume which will be migrated to SBS together with the snapshots, if - * present. - */ - volume?: Volume - /** - * A list of snapshots which will be migrated to SBS together and with the - * volume, if present. - */ - snapshots: Snapshot[] - /** - * A value to be passed to ApplyBlockMigrationRequest, to confirm that the - * execution of the plan is being requested. - */ - validationKey: string +export interface VolumeTypeConstraints { + min: number + max: number } -/** Placement group. */ -export interface PlacementGroup { - /** Placement group unique ID. */ +export interface VolumeTemplate { + /** UUID of the volume. */ id: string - /** Placement group name. */ + /** Name of the volume. */ name: string - /** Placement group Organization ID. */ - organization: string - /** Placement group Project ID. */ - project: string - /** Placement group tags. */ - tags: string[] + /** Disk size of the volume, must be a multiple of 512. */ + size: number + /** Type of the volume. */ + volumeType: VolumeVolumeType /** - * Select the failure mode when the placement cannot be respected, either - * optional or enforced. + * @deprecated Organization ID of the volume. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. */ - policyMode: PlacementGroupPolicyMode + organization?: string /** - * Select the behavior of the placement group, either low_latency (group) or - * max_availability (spread). + * Project ID of the volume. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. */ - policyType: PlacementGroupPolicyType - /** Returns true if the policy is respected, false otherwise. */ - policyRespected: boolean - /** Zone in which the placement group is located. */ - zone: Zone -} - -/** Placement group server. */ -export interface PlacementGroupServer { - /** Instance UUID. */ - id: string - /** Instance name. */ - name: string - /** Defines whether the placement group policy is respected (either 1 or 0). */ - policyRespected: boolean + project?: string } -/** Private nic. */ -export interface PrivateNIC { - /** Private NIC unique ID. */ +export interface Ip { id: string - /** Instance to which the private NIC is attached. */ - serverId: string - /** Private Network the private NIC is attached to. */ - privateNetworkId: string - /** Private NIC MAC address. */ - macAddress: string - /** Private NIC state. */ - state: PrivateNICState - /** Private NIC tags. */ + address: string + reverse?: string + server?: ServerSummary + organization: string tags: string[] + project: string + type: IpType + state: IpState + prefix: string + /** Zone to target. If none is passed will use default zone from the config. */ + zone: Zone } -/** Security group. */ export interface SecurityGroup { /** Security group unique ID. */ id: string @@ -532,20 +462,29 @@ export interface SecurityGroupRule { destPortTo?: number position: number editable: boolean + /** Zone to target. If none is passed will use default zone from the config. */ zone: Zone } -export interface SecurityGroupSummary { - id: string - name: string -} - -export interface SecurityGroupTemplate { - id: string - name: string +export interface VolumeServerTemplate { + /** UUID of the volume. */ + id?: string + /** Force the Instance to boot on this volume. */ + boot?: boolean + /** Name of the volume. */ + name?: string + /** Disk size of the volume, must be a multiple of 512. */ + size?: number + /** Type of the volume. */ + volumeType: VolumeVolumeType + /** ID of the snapshot on which this volume will be based. */ + baseSnapshot?: string + /** Organization ID of the volume. */ + organization?: string + /** Project ID of the volume. */ + project?: string } -/** Server. */ export interface Server { /** Instance unique ID. */ id: string @@ -613,69 +552,85 @@ export interface Server { zone: Zone } -/** Server action request. volume backup template. */ -export interface ServerActionRequestVolumeBackupTemplate { - /** - * Snapshot's volume type. Overrides the `volume_type` of the snapshot for - * this volume. If omitted, the volume type of the original volume will be - * used. - */ - volumeType: SnapshotVolumeType -} - -export interface ServerActionResponse { - task?: Task -} - -/** Server. ip. */ -export interface ServerIp { - /** Unique ID of the IP address. */ +export interface Snapshot { + /** Snapshot ID. */ id: string - /** Instance's public IP-Address. */ - address: string - /** Gateway's IP address. */ - gateway: string - /** CIDR netmask. */ - netmask: string - /** IP address family (inet or inet6). */ - family: ServerIpIpFamily - /** True if the IP address is dynamic. */ - dynamic: boolean - /** Information about this address provisioning mode. */ - provisioningMode: ServerIpProvisioningMode - /** Tags associated with the IP. */ + /** Snapshot name. */ + name: string + /** Snapshot Organization ID. */ + organization: string + /** Snapshot Project ID. */ + project: string + /** Snapshot tags. */ tags: string[] - state: ServerIpState + /** Snapshot volume type. */ + volumeType: VolumeVolumeType + /** Snapshot size. */ + size: number + /** Snapshot state. */ + state: SnapshotState + /** Volume on which the snapshot is based on. */ + baseVolume?: SnapshotBaseVolume + /** Snapshot creation date. */ + creationDate?: Date + /** Snapshot modification date. */ + modificationDate?: Date + /** Snapshot zone. */ + zone: Zone + /** Reason for the failed snapshot import. */ + errorReason?: string } -/** Server. ipv6. */ -export interface ServerIpv6 { - /** Instance IPv6 IP-Address. */ - address: string - /** IPv6 IP-addresses gateway. */ - gateway: string - /** IPv6 IP-addresses CIDR netmask. */ - netmask: string -} - -export interface ServerLocation { - clusterId: string - hypervisorId: string - nodeId: string - platformId: string - zoneId: string +export interface Task { + /** Unique ID of the task. */ + id: string + /** Description of the task. */ + description: string + /** Progress of the task in percent. */ + progress: number + /** Task start date. */ + startedAt?: Date + /** Task end date. */ + terminatedAt?: Date + /** Task status. */ + status: TaskStatus + hrefFrom: string + hrefResult: string + /** Zone in which the task is excecuted. */ + zone: Zone } -export interface ServerMaintenance { - reason: string +export interface Dashboard { + volumesCount: number + runningServersCount: number + serversByTypes: Record + imagesCount: number + snapshotsCount: number + serversCount: number + ipsCount: number + securityGroupsCount: number + ipsUnused: number + volumesLSsdCount: number + volumesBSsdCount: number + volumesLSsdTotalSize: number + volumesBSsdTotalSize: number + privateNicsCount: number + placementGroupsCount: number } -export interface ServerSummary { +export interface PlacementGroupServer { + /** Instance UUID. */ id: string + /** Instance name. */ name: string + /** Defines whether the placement group policy is respected (either 1 or 0). */ + policyRespected: boolean +} + +export interface GetServerTypesAvailabilityResponseAvailability { + availability: ServerTypesAvailability } -/** Server type. */ export interface ServerType { /** @deprecated Estimated monthly price, for a 30 days month, in Euro. */ monthlyPrice?: number @@ -705,59 +660,20 @@ export interface ServerType { scratchStorageMaxSize?: number } -/** Server type. capabilities. */ -export interface ServerTypeCapabilities { - /** Defines whether the Instance supports block storage. */ - blockStorage?: boolean - /** List of supported boot types. */ - bootTypes: BootType[] -} - -/** Server type. network. */ -export interface ServerTypeNetwork { - /** List of available network interfaces. */ - interfaces: ServerTypeNetworkInterface[] - /** Total maximum internal bandwidth in bits per seconds. */ - sumInternalBandwidth?: number - /** Total maximum internet bandwidth in bits per seconds. */ - sumInternetBandwidth?: number - /** True if IPv6 is enabled. */ - ipv6Support: boolean -} - -/** Server type. network. interface. */ -export interface ServerTypeNetworkInterface { - /** Maximum internal bandwidth in bits per seconds. */ - internalBandwidth?: number - /** Maximum internet bandwidth in bits per seconds. */ - internetBandwidth?: number -} - -/** Server type. volume constraint sizes. */ -export interface ServerTypeVolumeConstraintSizes { - /** Minimum volume size in bytes. */ - minSize: number - /** Maximum volume size in bytes. */ - maxSize: number -} - -/** Server type. volume constraints by type. */ -export interface ServerTypeVolumeConstraintsByType { - /** Local SSD volumes. */ - lSsd?: ServerTypeVolumeConstraintSizes -} - -export interface SetPlacementGroupResponse { - placementGroup?: PlacementGroup +export interface VolumeType { + displayName: string + capabilities?: VolumeTypeCapabilities + constraints?: VolumeTypeConstraints } -/** Set placement group servers response. */ -export interface SetPlacementGroupServersResponse { - /** Instances attached to the placement group. */ - servers: PlacementGroupServer[] +export interface ServerActionRequestVolumeBackupTemplate { + /** + * Overrides the `volume_type` of the snapshot for this volume. If omitted, + * the volume type of the original volume will be used. + */ + volumeType: SnapshotVolumeType } -/** Set security group rules request. rule. */ export interface SetSecurityGroupRulesRequestRule { /** * UUID of the security rule to update. If no value is provided, a new rule @@ -794,484 +710,694 @@ export interface SetSecurityGroupRulesRequestRule { */ editable?: boolean /** Zone of the rule. This field is ignored. */ - zone: Zone -} - -export interface SetSecurityGroupRulesResponse { - rules: SecurityGroupRule[] -} - -/** Snapshot. */ -export interface Snapshot { - /** Snapshot ID. */ - id: string - /** Snapshot name. */ - name: string - /** Snapshot Organization ID. */ - organization: string - /** Snapshot Project ID. */ - project: string - /** Snapshot tags. */ - tags: string[] - /** Snapshot volume type. */ - volumeType: VolumeVolumeType - /** Snapshot size. */ - size: number - /** Snapshot state. */ - state: SnapshotState - /** Volume on which the snapshot is based on. */ - baseVolume?: SnapshotBaseVolume - /** Snapshot creation date. */ - creationDate?: Date - /** Snapshot modification date. */ - modificationDate?: Date - /** Snapshot zone. */ - zone: Zone - /** Reason for the failed snapshot import. */ - errorReason?: string + zone?: Zone } -/** Snapshot. base volume. */ -export interface SnapshotBaseVolume { - /** Volume ID on which the snapshot is based. */ +export interface SecurityGroupTemplate { id: string - /** Volume name on which the snapshot is based on. */ name: string } -/** Task. */ -export interface Task { - /** Unique ID of the task. */ - id: string - /** Description of the task. */ - description: string - /** Progress of the task in percent. */ - progress: number - /** Task start date. */ - startedAt?: Date - /** Task end date. */ - terminatedAt?: Date - /** Task status. */ - status: TaskStatus - hrefFrom: string - hrefResult: string - /** Zone in which the task is excecuted. */ - zone: Zone -} - -export interface UpdateIpResponse { - ip?: Ip +export type ApplyBlockMigrationRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** + * The volume to migrate, along with potentially other resources, according to + * the migration plan generated with a call to PlanBlockMigration. + * + * One-of ('resource'): at most one of 'volumeId', 'snapshotId' could be set. + */ + volumeId?: string + /** + * The snapshot to migrate, along with potentially other resources, according + * to the migration plan generated with a call to PlanBlockMigration. + * + * One-of ('resource'): at most one of 'volumeId', 'snapshotId' could be set. + */ + snapshotId?: string + /** + * A value to be retrieved from a call to PlanBlockMigration, to confirm that + * the volume and/or snapshots specified in said plan should be migrated. + */ + validationKey: string } -export interface UpdatePlacementGroupResponse { - placementGroup?: PlacementGroup +export type CreateImageRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Name of the image. */ + name?: string + /** UUID of the snapshot. */ + rootVolume: string + /** Architecture of the image. */ + arch: Arch + /** @deprecated Default bootscript of the image. */ + defaultBootscript?: string + /** Additional volumes of the image. */ + extraVolumes?: Record + /** + * @deprecated Organization ID of the image. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + organization?: string + /** + * Project ID of the image. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + project?: string + /** Tags of the image. */ + tags?: string[] + /** True to create a public image. */ + public?: boolean } -/** Update placement group servers response. */ -export interface UpdatePlacementGroupServersResponse { - /** Instances attached to the placement group. */ - servers: PlacementGroupServer[] +export interface CreateImageResponse { + image?: Image } -export interface UpdateServerResponse { - server?: Server +export type CreateIpRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** + * @deprecated Organization ID in which the IP is reserved. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + organization?: string + /** + * Project ID in which the IP is reserved. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + project?: string + /** Tags of the IP. */ + tags?: string[] + /** UUID of the Instance you want to attach the IP to. */ + server?: string + /** IP type to reserve (either 'nat', 'routed_ipv4' or 'routed_ipv6'). */ + type?: IpType } -export interface UpdateVolumeResponse { - volume?: Volume +export interface CreateIpResponse { + ip?: Ip } -/** Volume. */ -export interface Volume { - /** Volume unique ID. */ - id: string - /** Volume name. */ - name: string - /** @deprecated Show the volume NBD export URI. */ - exportUri?: string - /** Volume disk size. */ - size: number - /** Volume type. */ - volumeType: VolumeVolumeType - /** Volume creation date. */ - creationDate?: Date - /** Volume modification date. */ - modificationDate?: Date - /** Volume Organization ID. */ - organization: string - /** Volume Project ID. */ - project: string - /** Volume tags. */ - tags: string[] - /** Instance attached to the volume. */ - server?: ServerSummary - /** Volume state. */ - state: VolumeState - /** Zone in which the volume is located. */ - zone: Zone +export type CreatePlacementGroupRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Name of the placement group. */ + name?: string + /** + * @deprecated Organization ID of the placement group. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + organization?: string + /** + * Project ID of the placement group. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + project?: string + /** Tags of the placement group. */ + tags?: string[] + /** Operating mode of the placement group. */ + policyMode?: PlacementGroupPolicyMode + /** Policy type of the placement group. */ + policyType?: PlacementGroupPolicyType } -export interface VolumeServer { - id: string - name: string - exportUri: string - organization: string - server?: ServerSummary - size: number - volumeType: VolumeServerVolumeType - creationDate?: Date - modificationDate?: Date - state: VolumeServerState - project: string - boot: boolean - zone: Zone +export interface CreatePlacementGroupResponse { + placementGroup?: PlacementGroup } -/** Volume server template. */ -export interface VolumeServerTemplate { - /** UUID of the volume. */ - id?: string - /** Force the Instance to boot on this volume. */ - boot?: boolean - /** Name of the volume. */ +export type CreatePrivateNICRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the Instance the private NIC will be attached to. */ + serverId: string + /** UUID of the private network where the private NIC will be attached. */ + privateNetworkId: string + /** Private NIC tags. */ + tags?: string[] + /** Ip_ids defined from IPAM. */ + ipIds?: string[] +} + +export interface CreatePrivateNICResponse { + privateNic?: PrivateNIC +} + +export type CreateSecurityGroupRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Name of the security group. */ name?: string - /** Disk size of the volume, must be a multiple of 512. */ + /** Description of the security group. */ + description: string + /** + * @deprecated Organization ID the security group belongs to. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + organization?: string + /** + * Project ID the security group belong to. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + project?: string + /** Tags of the security group. */ + tags?: string[] + /** + * @deprecated Defines whether this security group becomes the default + * security group for new Instances. + * + * One-of ('defaultIdentifier'): at most one of 'organizationDefault', + * 'projectDefault' could be set. + */ + organizationDefault?: boolean + /** + * Whether this security group becomes the default security group for new + * Instances. + * + * One-of ('defaultIdentifier'): at most one of 'organizationDefault', + * 'projectDefault' could be set. + */ + projectDefault?: boolean + /** Whether the security group is stateful or not. */ + stateful: boolean + /** Default policy for inbound rules. */ + inboundDefaultPolicy?: SecurityGroupPolicy + /** Default policy for outbound rules. */ + outboundDefaultPolicy?: SecurityGroupPolicy + /** + * True to block SMTP on IPv4 and IPv6. This feature is read only, please open + * a support ticket if you need to make it configurable. + */ + enableDefaultSecurity?: boolean +} + +export interface CreateSecurityGroupResponse { + securityGroup?: SecurityGroup +} + +export type CreateSecurityGroupRuleRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the security group. */ + securityGroupId: string + protocol: SecurityGroupRuleProtocol + direction: SecurityGroupRuleDirection + action: SecurityGroupRuleAction + ipRange: string + /** Beginning of the range of ports to apply this rule to (inclusive). */ + destPortFrom?: number + /** End of the range of ports to apply this rule to (inclusive). */ + destPortTo?: number + /** Position of this rule in the security group rules list. */ + position: number + /** Indicates if this rule is editable (will be ignored). */ + editable: boolean +} + +export interface CreateSecurityGroupRuleResponse { + rule?: SecurityGroupRule +} + +export type CreateServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Instance name. */ + name?: string + /** Define if a dynamic IPv4 is required for the Instance. */ + dynamicIpRequired?: boolean + /** If true, configure the Instance so it uses the new routed IP mode. */ + routedIpEnabled?: boolean + /** Define the Instance commercial type (i.e. GP1-S). */ + commercialType: string + /** Instance image ID or label. */ + image: string + /** Volumes attached to the server. */ + volumes?: Record + /** True if IPv6 is enabled on the server. */ + enableIpv6: boolean + /** ID of the reserved IP to attach to the Instance. */ + publicIp?: string + /** A list of reserved IP IDs to attach to the Instance. */ + publicIps?: string[] + /** Boot type to use. */ + bootType?: BootType + /** @deprecated Bootscript ID to use when `boot_type` is set to `bootscript`. */ + bootscript?: string + /** + * @deprecated Instance Organization ID. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + organization?: string + /** + * Instance Project ID. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + project?: string + /** Instance tags. */ + tags?: string[] + /** Security group ID. */ + securityGroup?: string + /** Placement group ID if Instance must be part of a placement group. */ + placementGroup?: string +} + +export interface CreateServerResponse { + server?: Server +} + +export type CreateSnapshotRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Name of the snapshot. */ + name?: string + /** UUID of the volume. */ + volumeId?: string + /** Tags of the snapshot. */ + tags?: string[] + /** + * @deprecated Organization ID of the snapshot. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + organization?: string + /** + * Project ID of the snapshot. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ + project?: string + /** + * Overrides the volume_type of the snapshot. If omitted, the volume type of + * the original volume will be used. + */ + volumeType?: SnapshotVolumeType + /** Bucket name for snapshot imports. */ + bucket?: string + /** Object key for snapshot imports. */ + key?: string + /** Imported snapshot size, must be a multiple of 512. */ size?: number - /** Type of the volume. */ - volumeType: VolumeVolumeType - /** ID of the snapshot on which this volume will be based. */ - baseSnapshot?: string - /** Organization ID of the volume. */ +} + +export interface CreateSnapshotResponse { + snapshot?: Snapshot + task?: Task +} + +export type CreateVolumeRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Volume name. */ + name?: string + /** + * @deprecated Volume Organization ID. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ organization?: string - /** Project ID of the volume. */ + /** + * Volume Project ID. + * + * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * could be set. + */ project?: string + /** Volume tags. */ + tags?: string[] + /** Volume type. */ + volumeType?: VolumeVolumeType + /** + * Volume disk size, must be a multiple of 512. + * + * One-of ('from'): at most one of 'size', 'baseVolume', 'baseSnapshot' could + * be set. + */ + size?: number + /** + * ID of the volume on which this volume will be based. + * + * One-of ('from'): at most one of 'size', 'baseVolume', 'baseSnapshot' could + * be set. + */ + baseVolume?: string + /** + * ID of the snapshot on which this volume will be based. + * + * One-of ('from'): at most one of 'size', 'baseVolume', 'baseSnapshot' could + * be set. + */ + baseSnapshot?: string +} + +export interface CreateVolumeResponse { + volume?: Volume +} + +export type DeleteImageRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the image you want to delete. */ + imageId: string +} + +export type DeleteIpRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID or address of the IP to delete. */ + ip: string +} + +export type DeletePlacementGroupRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the placement group you want to delete. */ + placementGroupId: string +} + +export type DeletePrivateNICRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Instance to which the private NIC is attached. */ + serverId: string + /** Private NIC unique ID. */ + privateNicId: string +} + +export type DeleteSecurityGroupRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the security group you want to delete. */ + securityGroupId: string +} + +export type DeleteSecurityGroupRuleRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + securityGroupId: string + securityGroupRuleId: string +} + +export type DeleteServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + serverId: string +} + +export type DeleteServerUserDataRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the Instance. */ + serverId: string + /** Key of the user data to delete. */ + key: string +} + +export type DeleteSnapshotRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the snapshot you want to delete. */ + snapshotId: string +} + +export type DeleteVolumeRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the volume you want to delete. */ + volumeId: string +} + +export type ExportSnapshotRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Snapshot ID. */ + snapshotId: string + /** S3 bucket name. */ + bucket: string + /** S3 object key. */ + key: string +} + +export interface ExportSnapshotResponse { + task?: Task +} + +export type GetBootscriptRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + bootscriptId: string } -export interface VolumeSummary { - id: string - name: string - size: number - volumeType: VolumeVolumeType +export interface GetBootscriptResponse { + bootscript?: Bootscript } -/** Volume template. */ -export interface VolumeTemplate { - /** UUID of the volume. */ - id: string - /** Name of the volume. */ - name: string - /** Disk size of the volume, must be a multiple of 512. */ - size: number - /** Type of the volume. */ - volumeType: VolumeVolumeType - /** - * @deprecated Organization ID of the volume. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ +export type GetDashboardRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone organization?: string - /** - * Project ID of the volume. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ project?: string } -export interface VolumeType { - displayName: string - capabilities?: VolumeTypeCapabilities - constraints?: VolumeTypeConstraints +export interface GetDashboardResponse { + dashboard?: Dashboard } -export interface VolumeTypeCapabilities { - snapshot: boolean +export type GetImageRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the image you want to get. */ + imageId: string } -export interface VolumeTypeConstraints { - min: number - max: number +export interface GetImageResponse { + image?: Image } -export type GetServerTypesAvailabilityRequest = { +export type GetIpRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** - * A positive integer lower or equal to 100 to select the number of items to - * return. - */ - perPage?: number - /** A positive integer to choose the page to return. */ - page?: number + /** IP ID or address to get. */ + ip: string } -export type ListServersTypesRequest = { +export interface GetIpResponse { + ip?: Ip +} + +export type GetPlacementGroupRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - perPage?: number - page?: number + /** UUID of the placement group you want to get. */ + placementGroupId: string } -export type ListVolumesTypesRequest = { +export interface GetPlacementGroupResponse { + placementGroup?: PlacementGroup +} + +export type GetPlacementGroupServersRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - perPage?: number - page?: number + /** UUID of the placement group you want to get. */ + placementGroupId: string } -export type ListServersRequest = { +export interface GetPlacementGroupServersResponse { + /** Instances attached to the placement group. */ + servers: PlacementGroupServer[] +} + +export type GetPrivateNICRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** - * A positive integer lower or equal to 100 to select the number of items to - * return. - */ - perPage?: number - /** A positive integer to choose the page to return. */ - page?: number - /** List only Instances of this Organization ID. */ - organization?: string - /** List only Instances of this Project ID. */ - project?: string - /** - * Filter Instances by name (eg. "server1" will return "server100" and - * "server1" but not "foo"). - */ - name?: string - /** List Instances by private_ip. */ - privateIp?: string - /** List Instances that are not attached to a public IP. */ - withoutIp?: boolean - /** List Instances of this commercial type. */ - commercialType?: string - /** List Instances in this state. */ - state?: ServerState - /** - * List Instances with these exact tags (to filter with several tags, use - * commas to separate them). - */ - tags?: string[] - /** List Instances in this Private Network. */ - privateNetwork?: string - /** Define the order of the returned servers. */ - order?: ListServersRequestOrder - /** - * List Instances from the given Private Networks (use commas to separate - * them). - */ - privateNetworks?: string[] - /** List Instances associated with the given private NIC MAC address. */ - privateNicMacAddress?: string - /** List Instances from these server ids (use commas to separate them). */ - servers?: string[] + /** Instance to which the private NIC is attached. */ + serverId: string + /** Private NIC unique ID. */ + privateNicId: string } -export type DeleteServerRequest = { +export interface GetPrivateNICResponse { + privateNic?: PrivateNIC +} + +export type GetSecurityGroupRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - serverId: string + /** UUID of the security group you want to get. */ + securityGroupId: string } -export type GetServerRequest = { +export interface GetSecurityGroupResponse { + securityGroup?: SecurityGroup +} + +export type GetSecurityGroupRuleRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the Instance you want to get. */ - serverId: string + securityGroupId: string + securityGroupRuleId: string } -export type ListServerActionsRequest = { +export interface GetSecurityGroupRuleResponse { + rule?: SecurityGroupRule +} + +export type GetServerRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone + /** UUID of the Instance you want to get. */ serverId: string } -export type ServerActionRequest = { +export interface GetServerResponse { + server?: Server +} + +export type GetServerTypesAvailabilityRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the Instance. */ - serverId: string - /** Action to perform on the Instance. */ - action?: ServerAction /** - * Name of the backup you want to create. Name of the backup you want to - * create. This field should only be specified when performing a backup - * action. - */ - name?: string - /** - * For each volume UUID, the snapshot parameters of the volume. For each - * volume UUID, the snapshot parameters of the volume. This field should only - * be specified when performing a backup action. + * A positive integer lower or equal to 100 to select the number of items to + * return. */ - volumes?: Record + perPage?: number + /** A positive integer to choose the page to return. */ + page?: number } -export type ListServerUserDataRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the Instance. */ - serverId: string +export interface GetServerTypesAvailabilityResponse { + /** Map of server types. */ + servers: Record + totalCount: number } -export type DeleteServerUserDataRequest = { +export type GetSnapshotRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the Instance. */ - serverId: string - /** Key of the user data to delete. */ - key: string + /** UUID of the snapshot you want to get. */ + snapshotId: string } -export type ListImagesRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - organization?: string - perPage?: number - page?: number - name?: string - public?: boolean - arch?: string - project?: string - tags?: string +export interface GetSnapshotResponse { + snapshot?: Snapshot } -export type GetImageRequest = { +export type GetVolumeRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the image you want to get. */ - imageId: string + /** UUID of the volume you want to get. */ + volumeId: string } -export type CreateImageRequest = { +export interface GetVolumeResponse { + volume?: Volume +} + +export type ListBootscriptsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Name of the image. */ - name?: string - /** UUID of the snapshot. */ - rootVolume: string - /** Architecture of the image. */ - arch: Arch - /** @deprecated Default bootscript of the image. */ - defaultBootscript?: string - /** Additional volumes of the image. */ - extraVolumes?: Record - /** - * @deprecated Organization ID of the image. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ - organization?: string - /** - * Project ID of the image. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ - project?: string - /** Tags of the image. */ - tags?: string[] - /** True to create a public image. */ + arch?: string + title?: string + default?: boolean public?: boolean + perPage?: number + page?: number +} + +export interface ListBootscriptsResponse { + /** Total number of bootscripts. */ + totalCount: number + /** List of bootscripts. */ + bootscripts: Bootscript[] } -export type DeleteImageRequest = { +export type ListDefaultSecurityGroupRulesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the image you want to delete. */ - imageId: string } -export type ListSnapshotsRequest = { +export type ListImagesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** List snapshots only for this Organization ID. */ organization?: string - /** List snapshots only for this Project ID. */ - project?: string - /** - * Number of snapshots returned per page (positive integer lower or equal to - * 100). - */ perPage?: number - /** Page to be returned. */ page?: number - /** List snapshots of the requested name. */ name?: string - /** List snapshots that have the requested tag. */ + public?: boolean + arch?: string + project?: string tags?: string - /** List snapshots originating only from this volume. */ - baseVolumeId?: string } -export type CreateSnapshotRequest = { +export interface ListImagesResponse { + /** Total number of images. */ + totalCount: number + /** List of images. */ + images: Image[] +} + +export type ListIpsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Name of the snapshot. */ - name?: string - /** UUID of the volume. */ - volumeId?: string - /** Tags of the snapshot. */ - tags?: string[] + /** Project ID in which the IPs are reserved. */ + project?: string + /** Organization ID in which the IPs are reserved. */ + organization?: string /** - * @deprecated Organization ID of the snapshot. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. + * Filter IPs with these exact tags (to filter with several tags, use commas + * to separate them). */ - organization?: string + tags?: string[] + /** Filter on the IP address (Works as a LIKE operation on the IP address). */ + name?: string /** - * Project ID of the snapshot. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. + * A positive integer lower or equal to 100 to select the number of items to + * return. */ - project?: string + perPage?: number + /** A positive integer to choose the page to return. */ + page?: number /** - * Volume type of the snapshot. Overrides the volume_type of the snapshot. If - * omitted, the volume type of the original volume will be used. + * Filter on the IP Mobility IP type (whose value should be either 'nat', + * 'routed_ipv4' or 'routed_ipv6'). */ - volumeType?: SnapshotVolumeType - /** Bucket name for snapshot imports. */ - bucket?: string - /** Object key for snapshot imports. */ - key?: string - /** Imported snapshot size, must be a multiple of 512. */ - size?: number -} - -export type GetSnapshotRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the snapshot you want to get. */ - snapshotId: string -} - -export type DeleteSnapshotRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the snapshot you want to delete. */ - snapshotId: string + type?: string } -export type ExportSnapshotRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Snapshot ID. */ - snapshotId: string - /** S3 bucket name. */ - bucket: string - /** S3 object key. */ - key: string +export interface ListIpsResponse { + /** Total number of ips. */ + totalCount: number + /** List of ips. */ + ips: Ip[] } -export type ListVolumesRequest = { +export type ListPlacementGroupsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Filter by volume type. */ - volumeType?: VolumeVolumeType /** * A positive integer lower or equal to 100 to select the number of items to * return. @@ -1279,111 +1405,55 @@ export type ListVolumesRequest = { perPage?: number /** A positive integer to choose the page to return. */ page?: number - /** Filter volume by Organization ID. */ + /** List only placement groups of this Organization ID. */ organization?: string - /** Filter volume by Project ID. */ + /** List only placement groups of this Project ID. */ project?: string /** - * Filter volumes with these exact tags (to filter with several tags, use - * commas to separate them). + * List placement groups with these exact tags (to filter with several tags, + * use commas to separate them). */ tags?: string[] /** - * Filter volume by name (for eg. "vol" will return "myvolume" but not - * "data"). + * Filter placement groups by name (for eg. "cluster1" will return + * "cluster100" and "cluster1" but not "foo"). */ name?: string } -export type CreateVolumeRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Volume name. */ - name?: string - /** - * @deprecated Volume Organization ID. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ - organization?: string - /** - * Volume Project ID. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ - project?: string - /** Volume tags. */ - tags?: string[] - /** Volume type. */ - volumeType?: VolumeVolumeType - /** - * Volume disk size, must be a multiple of 512. - * - * One-of ('from'): at most one of 'size', 'baseVolume', 'baseSnapshot' could - * be set. - */ - size?: number - /** - * ID of the volume on which this volume will be based. - * - * One-of ('from'): at most one of 'size', 'baseVolume', 'baseSnapshot' could - * be set. - */ - baseVolume?: string - /** - * ID of the snapshot on which this volume will be based. - * - * One-of ('from'): at most one of 'size', 'baseVolume', 'baseSnapshot' could - * be set. - */ - baseSnapshot?: string -} - -export type GetVolumeRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the volume you want to get. */ - volumeId: string +export interface ListPlacementGroupsResponse { + /** Total number of placement groups. */ + totalCount: number + /** List of placement groups. */ + placementGroups: PlacementGroup[] } -export type UpdateVolumeRequest = { +export type ListPrivateNICsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the volume. */ - volumeId: string - /** Volume name. */ - name?: string - /** Tags of the volume. */ + /** Instance to which the private NIC is attached. */ + serverId: string + /** Private NIC tags. */ tags?: string[] - /** Volume disk size, must be a multiple of 512. */ - size?: number + /** + * A positive integer lower or equal to 100 to select the number of items to + * return. + */ + perPage?: number + /** A positive integer to choose the page to return. */ + page?: number } -export type DeleteVolumeRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the volume you want to delete. */ - volumeId: string +export interface ListPrivateNICsResponse { + privateNics: PrivateNIC[] + totalCount: number } -export type ListSecurityGroupsRequest = { +export type ListSecurityGroupRulesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Name of the security group. */ - name?: string - /** Security group Organization ID. */ - organization?: string - /** Security group Project ID. */ - project?: string - /** - * List security groups with these exact tags (to filter with several tags, - * use commas to separate them). - */ - tags?: string[] - /** Filter security groups with this value for project_default. */ - projectDefault?: boolean + /** UUID of the security group. */ + securityGroupId: string /** * A positive integer lower or equal to 100 to select the number of items to * return. @@ -1393,82 +1463,69 @@ export type ListSecurityGroupsRequest = { page?: number } -export type CreateSecurityGroupRequest = { +export interface ListSecurityGroupRulesResponse { + /** Total number of security groups. */ + totalCount: number + /** List of security rules. */ + rules: SecurityGroupRule[] +} + +export type ListSecurityGroupsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone /** Name of the security group. */ - name?: string - /** Description of the security group. */ - description: string - /** - * @deprecated Organization ID the security group belongs to. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ - organization?: string - /** - * Project ID the security group belong to. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ - project?: string - /** Tags of the security group. */ - tags?: string[] - /** - * @deprecated Defines whether this security group becomes the default - * security group for new Instances. - * - * One-of ('defaultIdentifier'): at most one of 'organizationDefault', - * 'projectDefault' could be set. - */ - organizationDefault?: boolean + name?: string + /** Security group Organization ID. */ + organization?: string + /** Security group Project ID. */ + project?: string /** - * Whether this security group becomes the default security group for new - * Instances. - * - * One-of ('defaultIdentifier'): at most one of 'organizationDefault', - * 'projectDefault' could be set. + * List security groups with these exact tags (to filter with several tags, + * use commas to separate them). */ + tags?: string[] + /** Filter security groups with this value for project_default. */ projectDefault?: boolean - /** Whether the security group is stateful or not. */ - stateful: boolean - /** Default policy for inbound rules. */ - inboundDefaultPolicy?: SecurityGroupPolicy - /** Default policy for outbound rules. */ - outboundDefaultPolicy?: SecurityGroupPolicy /** - * True to block SMTP on IPv4 and IPv6. This feature is read only, please open - * a support ticket if you need to make it configurable. + * A positive integer lower or equal to 100 to select the number of items to + * return. */ - enableDefaultSecurity?: boolean + perPage?: number + /** A positive integer to choose the page to return. */ + page?: number } -export type GetSecurityGroupRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the security group you want to get. */ - securityGroupId: string +export interface ListSecurityGroupsResponse { + /** Total number of security groups. */ + totalCount: number + /** List of security groups. */ + securityGroups: SecurityGroup[] } -export type DeleteSecurityGroupRequest = { +export type ListServerActionsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the security group you want to delete. */ - securityGroupId: string + serverId: string } -export type ListDefaultSecurityGroupRulesRequest = { +export interface ListServerActionsResponse { + actions: ServerAction[] +} + +export type ListServerUserDataRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone + /** UUID of the Instance. */ + serverId: string } -export type ListSecurityGroupRulesRequest = { +export interface ListServerUserDataResponse { + userData: string[] +} + +export type ListServersRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the security group. */ - securityGroupId: string /** * A positive integer lower or equal to 100 to select the number of items to * return. @@ -1476,53 +1533,98 @@ export type ListSecurityGroupRulesRequest = { perPage?: number /** A positive integer to choose the page to return. */ page?: number + /** List only Instances of this Organization ID. */ + organization?: string + /** List only Instances of this Project ID. */ + project?: string + /** + * Filter Instances by name (eg. "server1" will return "server100" and + * "server1" but not "foo"). + */ + name?: string + /** List Instances by private_ip. */ + privateIp?: string + /** List Instances that are not attached to a public IP. */ + withoutIp?: boolean + /** List Instances of this commercial type. */ + commercialType?: string + /** List Instances in this state. */ + state?: ServerState + /** + * List Instances with these exact tags (to filter with several tags, use + * commas to separate them). + */ + tags?: string[] + /** List Instances in this Private Network. */ + privateNetwork?: string + /** Define the order of the returned servers. */ + order?: ListServersRequestOrder + /** + * List Instances from the given Private Networks (use commas to separate + * them). + */ + privateNetworks?: string[] + /** List Instances associated with the given private NIC MAC address. */ + privateNicMacAddress?: string + /** List Instances from these server ids (use commas to separate them). */ + servers?: string[] } -export type CreateSecurityGroupRuleRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the security group. */ - securityGroupId: string - protocol: SecurityGroupRuleProtocol - direction: SecurityGroupRuleDirection - action: SecurityGroupRuleAction - ipRange: string - /** Beginning of the range of ports to apply this rule to (inclusive). */ - destPortFrom?: number - /** End of the range of ports to apply this rule to (inclusive). */ - destPortTo?: number - /** Position of this rule in the security group rules list. */ - position: number - /** Indicates if this rule is editable (will be ignored). */ - editable: boolean +export interface ListServersResponse { + /** Total number of Instances. */ + totalCount: number + /** List of Instances. */ + servers: Server[] } -export type SetSecurityGroupRulesRequest = { +export type ListServersTypesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the security group to update the rules on. */ - securityGroupId: string - /** List of rules to update in the security group. */ - rules?: SetSecurityGroupRulesRequestRule[] + perPage?: number + page?: number } -export type DeleteSecurityGroupRuleRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - securityGroupId: string - securityGroupRuleId: string +export interface ListServersTypesResponse { + /** Total number of Instance types. */ + totalCount: number + /** List of Instance types. */ + servers: Record } -export type GetSecurityGroupRuleRequest = { +export type ListSnapshotsRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - securityGroupId: string - securityGroupRuleId: string + /** List snapshots only for this Organization ID. */ + organization?: string + /** List snapshots only for this Project ID. */ + project?: string + /** + * Number of snapshots returned per page (positive integer lower or equal to + * 100). + */ + perPage?: number + /** Page to be returned. */ + page?: number + /** List snapshots of the requested name. */ + name?: string + /** List snapshots that have the requested tag. */ + tags?: string + /** List snapshots originating only from this volume. */ + baseVolumeId?: string } -export type ListPlacementGroupsRequest = { +export interface ListSnapshotsResponse { + /** Total number of snapshots. */ + totalCount: number + /** List of snapshots. */ + snapshots: Snapshot[] +} + +export type ListVolumesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone + /** Filter by volume type. */ + volumeType?: VolumeVolumeType /** * A positive integer lower or equal to 100 to select the number of items to * return. @@ -1530,95 +1632,135 @@ export type ListPlacementGroupsRequest = { perPage?: number /** A positive integer to choose the page to return. */ page?: number - /** List only placement groups of this Organization ID. */ + /** Filter volume by Organization ID. */ organization?: string - /** List only placement groups of this Project ID. */ + /** Filter volume by Project ID. */ project?: string /** - * List placement groups with these exact tags (to filter with several tags, - * use commas to separate them). + * Filter volumes with these exact tags (to filter with several tags, use + * commas to separate them). */ tags?: string[] /** - * Filter placement groups by name (for eg. "cluster1" will return - * "cluster100" and "cluster1" but not "foo"). + * Filter volume by name (for eg. "vol" will return "myvolume" but not + * "data"). */ name?: string } -export type CreatePlacementGroupRequest = { +export interface ListVolumesResponse { + /** Total number of volumes. */ + totalCount: number + /** List of volumes. */ + volumes: Volume[] +} + +export type ListVolumesTypesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Name of the placement group. */ - name?: string + perPage?: number + page?: number +} + +export interface ListVolumesTypesResponse { + /** Total number of volume types. */ + totalCount: number + /** Map of volume types. */ + volumes: Record +} + +export interface MigrationPlan { /** - * @deprecated Organization ID of the placement group. + * A volume which will be migrated to SBS together with the snapshots, if + * present. + */ + volume?: Volume + /** + * A list of snapshots which will be migrated to SBS together and with the + * volume, if present. + */ + snapshots: Snapshot[] + /** + * A value to be passed to ApplyBlockMigrationRequest, to confirm that the + * execution of the plan is being requested. + */ + validationKey: string +} + +export type PlanBlockMigrationRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** + * The volume for which the migration plan will be generated. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. + * One-of ('resource'): at most one of 'volumeId', 'snapshotId' could be set. */ - organization?: string + volumeId?: string /** - * Project ID of the placement group. + * The snapshot for which the migration plan will be generated. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. + * One-of ('resource'): at most one of 'volumeId', 'snapshotId' could be set. */ - project?: string - /** Tags of the placement group. */ - tags?: string[] - /** Operating mode of the placement group. */ - policyMode?: PlacementGroupPolicyMode - /** Policy type of the placement group. */ - policyType?: PlacementGroupPolicyType + snapshotId?: string +} + +export type ServerActionRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the Instance. */ + serverId: string + /** Action to perform on the Instance. */ + action?: ServerAction + /** + * Name of the backup you want to create. This field should only be specified + * when performing a backup action. + */ + name?: string + /** + * For each volume UUID, the snapshot parameters of the volume. This field + * should only be specified when performing a backup action. + */ + volumes?: Record } -export type GetPlacementGroupRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the placement group you want to get. */ - placementGroupId: string +export interface ServerActionResponse { + task?: Task } -export type SetPlacementGroupRequest = { +export type SetImageRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - placementGroupId: string + id: string name: string + arch?: Arch + creationDate?: Date + modificationDate?: Date + /** @deprecated */ + defaultBootscript?: Bootscript + extraVolumes?: Record + fromServer: string organization?: string - policyMode?: PlacementGroupPolicyMode - policyType?: PlacementGroupPolicyType + public: boolean + rootVolume?: VolumeSummary + state?: ImageState project?: string tags?: string[] } -export type UpdatePlacementGroupRequest = { +export type SetPlacementGroupRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** UUID of the placement group. */ placementGroupId: string - /** Name of the placement group. */ - name?: string - /** Tags of the placement group. */ - tags?: string[] - /** Operating mode of the placement group. */ + name: string + organization?: string policyMode?: PlacementGroupPolicyMode - /** Policy type of the placement group. */ policyType?: PlacementGroupPolicyType + project?: string + tags?: string[] } -export type DeletePlacementGroupRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the placement group you want to delete. */ - placementGroupId: string -} - -export type GetPlacementGroupServersRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the placement group you want to get. */ - placementGroupId: string +export interface SetPlacementGroupResponse { + placementGroup?: PlacementGroup } export type SetPlacementGroupServersRequest = { @@ -1630,73 +1772,22 @@ export type SetPlacementGroupServersRequest = { servers: string[] } -export type UpdatePlacementGroupServersRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the placement group you want to update. */ - placementGroupId: string - /** An array of the Instances' UUIDs you want to configure. */ - servers: string[] -} - -export type ListIpsRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Project ID in which the IPs are reserved. */ - project?: string - /** Organization ID in which the IPs are reserved. */ - organization?: string - /** - * Filter IPs with these exact tags (to filter with several tags, use commas - * to separate them). - */ - tags?: string[] - /** Filter on the IP address (Works as a LIKE operation on the IP address). */ - name?: string - /** - * A positive integer lower or equal to 100 to select the number of items to - * return. - */ - perPage?: number - /** A positive integer to choose the page to return. */ - page?: number - /** - * Filter on the IP Mobility IP type (whose value should be either 'nat', - * 'routed_ipv4' or 'routed_ipv6'). - */ - type?: string +export interface SetPlacementGroupServersResponse { + /** Instances attached to the placement group. */ + servers: PlacementGroupServer[] } -export type CreateIpRequest = { +export type SetSecurityGroupRulesRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** - * @deprecated Organization ID in which the IP is reserved. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ - organization?: string - /** - * Project ID in which the IP is reserved. - * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' - * could be set. - */ - project?: string - /** Tags of the IP. */ - tags?: string[] - /** UUID of the Instance you want to attach the IP to. */ - server?: string - /** IP type to reserve (either 'nat', 'routed_ipv4' or 'routed_ipv6'). */ - type?: IpType + /** UUID of the security group to update the rules on. */ + securityGroupId: string + /** List of rules to update in the security group. */ + rules?: SetSecurityGroupRulesRequestRule[] } -export type GetIpRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** IP ID or address to get. */ - ip: string +export interface SetSecurityGroupRulesResponse { + rules: SecurityGroupRule[] } export type UpdateIpRequest = { @@ -1713,49 +1804,41 @@ export type UpdateIpRequest = { server?: string | null } -export type DeleteIpRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID or address of the IP to delete. */ - ip: string +export interface UpdateIpResponse { + ip?: Ip } -export type ListPrivateNICsRequest = { +export type UpdatePlacementGroupRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Instance to which the private NIC is attached. */ - serverId: string - /** Private NIC tags. */ + /** UUID of the placement group. */ + placementGroupId: string + /** Name of the placement group. */ + name?: string + /** Tags of the placement group. */ tags?: string[] - /** - * A positive integer lower or equal to 100 to select the number of items to - * return. - */ - perPage?: number - /** A positive integer to choose the page to return. */ - page?: number + /** Operating mode of the placement group. */ + policyMode?: PlacementGroupPolicyMode + /** Policy type of the placement group. */ + policyType?: PlacementGroupPolicyType } -export type CreatePrivateNICRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** UUID of the Instance the private NIC will be attached to. */ - serverId: string - /** UUID of the private network where the private NIC will be attached. */ - privateNetworkId: string - /** Private NIC tags. */ - tags?: string[] - /** Ip_ids defined from IPAM. */ - ipIds?: string[] +export interface UpdatePlacementGroupResponse { + placementGroup?: PlacementGroup } -export type GetPrivateNICRequest = { +export type UpdatePlacementGroupServersRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Instance to which the private NIC is attached. */ - serverId: string - /** Private NIC unique ID. */ - privateNicId: string + /** UUID of the placement group you want to update. */ + placementGroupId: string + /** An array of the Instances' UUIDs you want to configure. */ + servers: string[] +} + +export interface UpdatePlacementGroupServersResponse { + /** Instances attached to the placement group. */ + servers: PlacementGroupServer[] } export type UpdatePrivateNICRequest = { @@ -1769,76 +1852,64 @@ export type UpdatePrivateNICRequest = { tags?: string[] } -export type DeletePrivateNICRequest = { +export type UpdateServerRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** Instance to which the private NIC is attached. */ + /** UUID of the Instance. */ serverId: string - /** Private NIC unique ID. */ - privateNicId: string -} - -export type ListBootscriptsRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - arch?: string - title?: string - default?: boolean - public?: boolean - perPage?: number - page?: number -} - -export type GetBootscriptRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - bootscriptId: string -} - -export type GetDashboardRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - organization?: string - project?: string -} - -export type PlanBlockMigrationRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone + /** Name of the Instance. */ + name?: string + bootType?: BootType + /** Tags of the Instance. */ + tags?: string[] + volumes?: Record + /** @deprecated */ + bootscript?: string + dynamicIpRequired?: boolean /** - * The volume for which the migration plan will be generated. - * - * One-of ('resource'): at most one of 'volumeId', 'snapshotId' could be set. + * True to configure the instance so it uses the new routed IP mode (once this + * is set to True you cannot set it back to False). */ - volumeId?: string + routedIpEnabled?: boolean + /** A list of reserved IP IDs to attach to the Instance. */ + publicIps?: string[] + enableIpv6?: boolean + protected?: boolean + securityGroup?: SecurityGroupTemplate + /** Placement group ID if Instance must be part of a placement group. */ + placementGroup?: string | null + /** Instance private NICs. */ + privateNics?: string[] /** - * The snapshot for which the migration plan will be generated. + * Warning: This field has some restrictions: * - * One-of ('resource'): at most one of 'volumeId', 'snapshotId' could be set. + * - Cannot be changed if the Instance is not in `stopped` state. + * - Cannot be changed if the Instance is in a placement group. + * - Local storage requirements of the target commercial_types must be fulfilled + * (i.e. if an Instance has 80GB of local storage, it can be changed into a + * GP1-XS, which has a maximum of 150GB, but it cannot be changed into a + * DEV1-S, which has only 20GB). */ - snapshotId?: string + commercialType?: string } -export type ApplyBlockMigrationRequest = { +export interface UpdateServerResponse { + server?: Server +} + +export type UpdateVolumeRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** - * The volume to migrate, along with potentially other resources, according to - * the migration plan generated with a call to PlanBlockMigration. - * - * One-of ('resource'): at most one of 'volumeId', 'snapshotId' could be set. - */ - volumeId?: string - /** - * The snapshot to migrate, along with potentially other resources, according - * to the migration plan generated with a call to PlanBlockMigration. - * - * One-of ('resource'): at most one of 'volumeId', 'snapshotId' could be set. - */ - snapshotId?: string - /** - * A value to be retrieved from a call to PlanBlockMigration, to confirm that - * the volume and/or snapshots specified in said plan should be migrated. - */ - validationKey: string + /** UUID of the volume. */ + volumeId: string + /** Volume name. */ + name?: string + /** Tags of the volume. */ + tags?: string[] + /** Volume disk size, must be a multiple of 512. */ + size?: number +} + +export interface UpdateVolumeResponse { + volume?: Volume } diff --git a/packages/clients/src/api/ipfs/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/ipfs/v1alpha1/marshalling.gen.ts index 5b6bc992f..51174ecfc 100644 --- a/packages/clients/src/api/ipfs/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/ipfs/v1alpha1/marshalling.gen.ts @@ -28,17 +28,40 @@ import type { Volume, } from './types.gen' -const unmarshalPinCIDMeta = (data: unknown) => { +export const unmarshalName = (data: unknown): Name => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Name' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + key: data.key, + name: data.name, + nameId: data.name_id, + projectId: data.project_id, + region: data.region, + status: data.status, + tags: data.tags, + updatedAt: unmarshalDate(data.updated_at), + value: data.value, + } as Name +} + +const unmarshalPinCIDMeta = (data: unknown): PinCIDMeta => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'PinCIDMeta' failed as data isn't a dictionary.`, ) } - return { id: data.id } as PinCIDMeta + return { + id: data.id, + } as PinCIDMeta } -const unmarshalPinCID = (data: unknown) => { +const unmarshalPinCID = (data: unknown): PinCID => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'PinCID' failed as data isn't a dictionary.`, @@ -53,7 +76,7 @@ const unmarshalPinCID = (data: unknown) => { } as PinCID } -const unmarshalPinInfo = (data: unknown) => { +const unmarshalPinInfo = (data: unknown): PinInfo => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'PinInfo' failed as data isn't a dictionary.`, @@ -69,28 +92,7 @@ const unmarshalPinInfo = (data: unknown) => { } as PinInfo } -export const unmarshalName = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Name' failed as data isn't a dictionary.`, - ) - } - - return { - createdAt: unmarshalDate(data.created_at), - key: data.key, - name: data.name, - nameId: data.name_id, - projectId: data.project_id, - region: data.region, - status: data.status, - tags: data.tags, - updatedAt: unmarshalDate(data.updated_at), - value: data.value, - } as Name -} - -export const unmarshalPin = (data: unknown) => { +export const unmarshalPin = (data: unknown): Pin => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Pin' failed as data isn't a dictionary.`, @@ -107,7 +109,7 @@ export const unmarshalPin = (data: unknown) => { } as Pin } -export const unmarshalVolume = (data: unknown) => { +export const unmarshalVolume = (data: unknown): Volume => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`, @@ -127,7 +129,9 @@ export const unmarshalVolume = (data: unknown) => { } as Volume } -export const unmarshalExportKeyNameResponse = (data: unknown) => { +export const unmarshalExportKeyNameResponse = ( + data: unknown, +): ExportKeyNameResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ExportKeyNameResponse' failed as data isn't a dictionary.`, @@ -144,7 +148,9 @@ export const unmarshalExportKeyNameResponse = (data: unknown) => { } as ExportKeyNameResponse } -export const unmarshalListNamesResponse = (data: unknown) => { +export const unmarshalListNamesResponse = ( + data: unknown, +): ListNamesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNamesResponse' failed as data isn't a dictionary.`, @@ -157,7 +163,7 @@ export const unmarshalListNamesResponse = (data: unknown) => { } as ListNamesResponse } -export const unmarshalListPinsResponse = (data: unknown) => { +export const unmarshalListPinsResponse = (data: unknown): ListPinsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPinsResponse' failed as data isn't a dictionary.`, @@ -170,7 +176,9 @@ export const unmarshalListPinsResponse = (data: unknown) => { } as ListPinsResponse } -export const unmarshalListVolumesResponse = (data: unknown) => { +export const unmarshalListVolumesResponse = ( + data: unknown, +): ListVolumesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`, @@ -183,7 +191,9 @@ export const unmarshalListVolumesResponse = (data: unknown) => { } as ListVolumesResponse } -export const unmarshalReplacePinResponse = (data: unknown) => { +export const unmarshalReplacePinResponse = ( + data: unknown, +): ReplacePinResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ReplacePinResponse' failed as data isn't a dictionary.`, diff --git a/packages/clients/src/api/ipfs/v1alpha1/types.gen.ts b/packages/clients/src/api/ipfs/v1alpha1/types.gen.ts index 257507853..8823f3f0d 100644 --- a/packages/clients/src/api/ipfs/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/ipfs/v1alpha1/types.gen.ts @@ -45,28 +45,23 @@ export type PinStatus = | 'failed' | 'pinned' -export interface ExportKeyNameResponse { - nameId: string - projectId: string - createdAt?: Date - updatedAt?: Date - publicKey: string - privateKey: string -} - -export interface ListNamesResponse { - names: Name[] - totalCount: number +export interface PinCIDMeta { + id?: string } -export interface ListPinsResponse { - totalCount: number - pins: Pin[] +export interface PinCID { + cid?: string + name?: string + origins: string[] + meta?: PinCIDMeta } -export interface ListVolumesResponse { - volumes: Volume[] - totalCount: number +export interface PinInfo { + id?: string + url?: string + size?: number + progress?: number + statusDetails: PinDetails } export interface Name { @@ -79,6 +74,10 @@ export interface Name { key: string status: NameStatus value: string + /** + * Region to target. If none is passed will use default region from the + * config. + */ region: Region } @@ -91,32 +90,13 @@ export interface Pin { info?: PinInfo } -export interface PinCID { - cid?: string - name?: string - origins: string[] - meta?: PinCIDMeta -} - -export interface PinCIDMeta { - id?: string -} - -export interface PinInfo { - id?: string - url?: string - size?: number - progress?: number - statusDetails: PinDetails -} - -export interface ReplacePinResponse { - pin?: Pin -} - export interface Volume { id: string projectId: string + /** + * Region to target. If none is passed will use default region from the + * config. + */ region: Region countPin: number createdAt?: Date @@ -126,56 +106,58 @@ export interface Volume { size?: number } -export type CreateVolumeRequest = { +export type CreatePinByCIDRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Project ID. */ - projectId?: string - /** Volume name. */ - name: string + /** Volume ID on which you want to pin your content. */ + volumeId: string + /** CID containing the content you want to pin. */ + cid: string + /** Node containing the content you want to pin. */ + origins?: string[] + /** Pin name. */ + name?: string } -export type GetVolumeRequest = { +export type CreatePinByURLRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Volume ID. */ + /** Volume ID on which you want to pin your content. */ volumeId: string + /** URL containing the content you want to pin. */ + url: string + /** Pin name. */ + name?: string } -export type ListVolumesRequest = { +export type CreateVolumeRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Project ID, only volumes belonging to this project will be listed. */ + /** Project ID. */ projectId?: string - /** Sort the order of the returned volumes. */ - orderBy?: ListVolumesRequestOrderBy - /** Page number. */ - page?: number - /** Maximum number of volumes to return per page. */ - pageSize?: number + /** Volume name. */ + name: string } -export type UpdateVolumeRequest = { +export type DeletePinRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region + /** Pin ID you want to remove from the volume. */ + pinId: string /** Volume ID. */ volumeId: string - /** Volume name. */ - name?: string - /** Tags of the volume. */ - tags?: string[] } export type DeleteVolumeRequest = { @@ -188,112 +170,69 @@ export type DeleteVolumeRequest = { volumeId: string } -export type CreatePinByURLRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Volume ID on which you want to pin your content. */ - volumeId: string - /** URL containing the content you want to pin. */ - url: string - /** Pin name. */ - name?: string -} - -export type CreatePinByCIDRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** Volume ID on which you want to pin your content. */ - volumeId: string - /** CID containing the content you want to pin. */ - cid: string - /** Node containing the content you want to pin. */ - origins?: string[] - /** Pin name. */ - name?: string +export interface ExportKeyNameResponse { + nameId: string + projectId: string + createdAt?: Date + updatedAt?: Date + publicKey: string + privateKey: string } -export type ReplacePinRequest = { +export type GetPinRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Pin ID whose information you wish to replace. */ + /** Pin ID of which you want to obtain information. */ pinId: string /** Volume ID. */ volumeId: string - /** New CID you want to pin in place of the old one. */ - cid: string - /** New name to replace. */ - name?: string - /** Node containing the content you want to pin. */ - origins?: string[] } -export type GetPinRequest = { +export type GetVolumeRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Pin ID of which you want to obtain information. */ - pinId: string /** Volume ID. */ volumeId: string } -export type ListPinsRequest = { +export type IpnsApiCreateNameRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Volume ID of which you want to list the pins. */ - volumeId: string /** Project ID. */ projectId?: string - /** Organization ID. */ - organizationId?: string - /** Sort order of the returned Volume. */ - orderBy?: ListPinsRequestOrderBy - /** Page number. */ - page?: number - /** Maximum number of volumes to return per page. */ - pageSize?: number - /** List pins by status. */ - status?: PinStatus + /** Name for your records. */ + name: string + /** Value you want to associate with your records, CID or IPNS key. */ + value: string } -export type DeletePinRequest = { +export type IpnsApiDeleteNameRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Pin ID you want to remove from the volume. */ - pinId: string - /** Volume ID. */ - volumeId: string + /** Name ID you wish to delete. */ + nameId: string } -export type IpnsApiCreateNameRequest = { +export type IpnsApiExportKeyNameRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Project ID. */ - projectId?: string - /** Name for your records. */ - name: string - /** Value you want to associate with your records, CID or IPNS key. */ - value: string + /** Name ID whose keys you want to export. */ + nameId: string } export type IpnsApiGetNameRequest = { @@ -306,14 +245,20 @@ export type IpnsApiGetNameRequest = { nameId: string } -export type IpnsApiDeleteNameRequest = { +export type IpnsApiImportKeyNameRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Name ID you wish to delete. */ - nameId: string + /** Project ID. */ + projectId?: string + /** Name for your records. */ + name: string + /** Base64 private key. */ + privateKey: string + /** Value you want to associate with your records, CID or IPNS key. */ + value: string } export type IpnsApiListNamesRequest = { @@ -350,28 +295,91 @@ export type IpnsApiUpdateNameRequest = { value?: string } -export type IpnsApiExportKeyNameRequest = { +export interface ListNamesResponse { + names: Name[] + totalCount: number +} + +export type ListPinsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Name ID whose keys you want to export. */ - nameId: string + /** Volume ID of which you want to list the pins. */ + volumeId: string + /** Project ID. */ + projectId?: string + /** Organization ID. */ + organizationId?: string + /** Sort order of the returned Volume. */ + orderBy?: ListPinsRequestOrderBy + /** Page number. */ + page?: number + /** Maximum number of volumes to return per page. */ + pageSize?: number + /** List pins by status. */ + status?: PinStatus } -export type IpnsApiImportKeyNameRequest = { +export interface ListPinsResponse { + totalCount: number + pins: Pin[] +} + +export type ListVolumesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Project ID. */ + /** Project ID, only volumes belonging to this project will be listed. */ projectId?: string - /** Name for your records. */ - name: string - /** Base64 private key. */ - privateKey: string - /** Value you want to associate with your records, CID or IPNS key. */ - value: string + /** Sort the order of the returned volumes. */ + orderBy?: ListVolumesRequestOrderBy + /** Page number. */ + page?: number + /** Maximum number of volumes to return per page. */ + pageSize?: number +} + +export interface ListVolumesResponse { + volumes: Volume[] + totalCount: number +} + +export type ReplacePinRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Pin ID whose information you wish to replace. */ + pinId: string + /** Volume ID. */ + volumeId: string + /** New CID you want to pin in place of the old one. */ + cid: string + /** New name to replace. */ + name?: string + /** Node containing the content you want to pin. */ + origins?: string[] +} + +export interface ReplacePinResponse { + pin?: Pin +} + +export type UpdateVolumeRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Volume ID. */ + volumeId: string + /** Volume name. */ + name?: string + /** Tags of the volume. */ + tags?: string[] } diff --git a/packages/clients/src/api/rdb/v1/marshalling.gen.ts b/packages/clients/src/api/rdb/v1/marshalling.gen.ts index 95124f8d9..cef675246 100644 --- a/packages/clients/src/api/rdb/v1/marshalling.gen.ts +++ b/packages/clients/src/api/rdb/v1/marshalling.gen.ts @@ -93,7 +93,9 @@ import type { Volume, } from './types.gen' -const unmarshalEndpointDirectAccessDetails = (data: unknown) => { +const unmarshalEndpointDirectAccessDetails = ( + data: unknown, +): EndpointDirectAccessDetails => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'EndpointDirectAccessDetails' failed as data isn't a dictionary.`, @@ -103,7 +105,9 @@ const unmarshalEndpointDirectAccessDetails = (data: unknown) => { return {} as EndpointDirectAccessDetails } -const unmarshalEndpointLoadBalancerDetails = (data: unknown) => { +const unmarshalEndpointLoadBalancerDetails = ( + data: unknown, +): EndpointLoadBalancerDetails => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'EndpointLoadBalancerDetails' failed as data isn't a dictionary.`, @@ -113,7 +117,9 @@ const unmarshalEndpointLoadBalancerDetails = (data: unknown) => { return {} as EndpointLoadBalancerDetails } -const unmarshalEndpointPrivateNetworkDetails = (data: unknown) => { +const unmarshalEndpointPrivateNetworkDetails = ( + data: unknown, +): EndpointPrivateNetworkDetails => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`, @@ -127,7 +133,7 @@ const unmarshalEndpointPrivateNetworkDetails = (data: unknown) => { } as EndpointPrivateNetworkDetails } -export const unmarshalEndpoint = (data: unknown) => { +export const unmarshalEndpoint = (data: unknown): Endpoint => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`, @@ -152,153 +158,138 @@ export const unmarshalEndpoint = (data: unknown) => { } as Endpoint } -const unmarshalEngineSetting = (data: unknown) => { +export const unmarshalReadReplica = (data: unknown): ReadReplica => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'EngineSetting' failed as data isn't a dictionary.`, + `Unmarshalling the type 'ReadReplica' failed as data isn't a dictionary.`, ) } return { - defaultValue: data.default_value, - description: data.description, - floatMax: data.float_max, - floatMin: data.float_min, - hotConfigurable: data.hot_configurable, - intMax: data.int_max, - intMin: data.int_min, - name: data.name, - propertyType: data.property_type, - stringConstraint: data.string_constraint, - unit: data.unit, - } as EngineSetting + endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint), + id: data.id, + region: data.region, + sameZone: data.same_zone, + status: data.status, + } as ReadReplica } -const unmarshalBackupSchedule = (data: unknown) => { +export const unmarshalDatabaseBackup = (data: unknown): DatabaseBackup => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'BackupSchedule' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DatabaseBackup' failed as data isn't a dictionary.`, ) } return { - disabled: data.disabled, - frequency: data.frequency, - nextRunAt: unmarshalDate(data.next_run_at), - retention: data.retention, - } as BackupSchedule + createdAt: unmarshalDate(data.created_at), + databaseName: data.database_name, + downloadUrl: data.download_url, + downloadUrlExpiresAt: unmarshalDate(data.download_url_expires_at), + expiresAt: unmarshalDate(data.expires_at), + id: data.id, + instanceId: data.instance_id, + instanceName: data.instance_name, + name: data.name, + region: data.region, + sameRegion: data.same_region, + size: data.size, + status: data.status, + updatedAt: unmarshalDate(data.updated_at), + } as DatabaseBackup } -const unmarshalEngineVersion = (data: unknown) => { +export const unmarshalDatabase = (data: unknown): Database => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'EngineVersion' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Database' failed as data isn't a dictionary.`, ) } return { - availableInitSettings: unmarshalArrayOfObject( - data.available_init_settings, - unmarshalEngineSetting, - ), - availableSettings: unmarshalArrayOfObject( - data.available_settings, - unmarshalEngineSetting, - ), - beta: data.beta, - disabled: data.disabled, - endOfLife: unmarshalDate(data.end_of_life), + managed: data.managed, name: data.name, - version: data.version, - } as EngineVersion -} - -const unmarshalInstanceSetting = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'InstanceSetting' failed as data isn't a dictionary.`, - ) - } - - return { name: data.name, value: data.value } as InstanceSetting + owner: data.owner, + size: data.size, + } as Database } -const unmarshalLogsPolicy = (data: unknown) => { +export const unmarshalInstanceLog = (data: unknown): InstanceLog => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'LogsPolicy' failed as data isn't a dictionary.`, + `Unmarshalling the type 'InstanceLog' failed as data isn't a dictionary.`, ) } return { - maxAgeRetention: data.max_age_retention, - totalDiskRetention: data.total_disk_retention, - } as LogsPolicy + createdAt: unmarshalDate(data.created_at), + downloadUrl: data.download_url, + expiresAt: unmarshalDate(data.expires_at), + id: data.id, + nodeName: data.node_name, + region: data.region, + status: data.status, + } as InstanceLog } -const unmarshalMaintenance = (data: unknown) => { +export const unmarshalBackupSchedule = (data: unknown): BackupSchedule => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Maintenance' failed as data isn't a dictionary.`, + `Unmarshalling the type 'BackupSchedule' failed as data isn't a dictionary.`, ) } return { - closedAt: unmarshalDate(data.closed_at), - reason: data.reason, - startsAt: unmarshalDate(data.starts_at), - status: data.status, - stopsAt: unmarshalDate(data.stops_at), - } as Maintenance + disabled: data.disabled, + frequency: data.frequency, + nextRunAt: unmarshalDate(data.next_run_at), + retention: data.retention, + } as BackupSchedule } -const unmarshalNodeTypeVolumeConstraintSizes = (data: unknown) => { +const unmarshalInstanceSetting = (data: unknown): InstanceSetting => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'NodeTypeVolumeConstraintSizes' failed as data isn't a dictionary.`, + `Unmarshalling the type 'InstanceSetting' failed as data isn't a dictionary.`, ) } return { - maxSize: data.max_size, - minSize: data.min_size, - } as NodeTypeVolumeConstraintSizes + name: data.name, + value: data.value, + } as InstanceSetting } -const unmarshalNodeTypeVolumeType = (data: unknown) => { +const unmarshalLogsPolicy = (data: unknown): LogsPolicy => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`, + `Unmarshalling the type 'LogsPolicy' failed as data isn't a dictionary.`, ) } return { - chunkSize: data.chunk_size, - class: data.class, - description: data.description, - maxSize: data.max_size, - minSize: data.min_size, - type: data.type, - } as NodeTypeVolumeType + maxAgeRetention: data.max_age_retention, + totalDiskRetention: data.total_disk_retention, + } as LogsPolicy } -export const unmarshalReadReplica = (data: unknown) => { +const unmarshalMaintenance = (data: unknown): Maintenance => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ReadReplica' failed as data isn't a dictionary.`, + `Unmarshalling the type 'Maintenance' failed as data isn't a dictionary.`, ) } return { - endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint), - id: data.id, - region: data.region, - sameZone: data.same_zone, + closedAt: unmarshalDate(data.closed_at), + reason: data.reason, + startsAt: unmarshalDate(data.starts_at), status: data.status, - } as ReadReplica + stopsAt: unmarshalDate(data.stops_at), + } as Maintenance } -const unmarshalUpgradableVersion = (data: unknown) => { +const unmarshalUpgradableVersion = (data: unknown): UpgradableVersion => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'UpgradableVersion' failed as data isn't a dictionary.`, @@ -313,89 +304,21 @@ const unmarshalUpgradableVersion = (data: unknown) => { } as UpgradableVersion } -const unmarshalVolume = (data: unknown) => { +const unmarshalVolume = (data: unknown): Volume => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`, ) } - return { class: data.class, size: data.size, type: data.type } as Volume -} - -const unmarshalACLRule = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`, - ) - } - return { - action: data.action, - description: data.description, - direction: data.direction, - ip: data.ip, - port: data.port, - protocol: data.protocol, - } as ACLRule -} - -export const unmarshalDatabase = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Database' failed as data isn't a dictionary.`, - ) - } - - return { - managed: data.managed, - name: data.name, - owner: data.owner, - size: data.size, - } as Database -} - -export const unmarshalDatabaseBackup = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DatabaseBackup' failed as data isn't a dictionary.`, - ) - } - - return { - createdAt: unmarshalDate(data.created_at), - databaseName: data.database_name, - downloadUrl: data.download_url, - downloadUrlExpiresAt: unmarshalDate(data.download_url_expires_at), - expiresAt: unmarshalDate(data.expires_at), - id: data.id, - instanceId: data.instance_id, - instanceName: data.instance_name, - name: data.name, - region: data.region, - sameRegion: data.same_region, + class: data.class, size: data.size, - status: data.status, - updatedAt: unmarshalDate(data.updated_at), - } as DatabaseBackup -} - -const unmarshalDatabaseEngine = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'DatabaseEngine' failed as data isn't a dictionary.`, - ) - } - - return { - logoUrl: data.logo_url, - name: data.name, - region: data.region, - versions: unmarshalArrayOfObject(data.versions, unmarshalEngineVersion), - } as DatabaseEngine + type: data.type, + } as Volume } -export const unmarshalInstance = (data: unknown) => { +export const unmarshalInstance = (data: unknown): Instance => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Instance' failed as data isn't a dictionary.`, @@ -444,70 +367,7 @@ export const unmarshalInstance = (data: unknown) => { } as Instance } -export const unmarshalInstanceLog = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'InstanceLog' failed as data isn't a dictionary.`, - ) - } - - return { - createdAt: unmarshalDate(data.created_at), - downloadUrl: data.download_url, - expiresAt: unmarshalDate(data.expires_at), - id: data.id, - nodeName: data.node_name, - region: data.region, - status: data.status, - } as InstanceLog -} - -const unmarshalListInstanceLogsDetailsResponseInstanceLogDetail = ( - data: unknown, -) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ListInstanceLogsDetailsResponseInstanceLogDetail' failed as data isn't a dictionary.`, - ) - } - - return { - logName: data.log_name, - size: data.size, - } as ListInstanceLogsDetailsResponseInstanceLogDetail -} - -const unmarshalNodeType = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`, - ) - } - - return { - availableVolumeTypes: unmarshalArrayOfObject( - data.available_volume_types, - unmarshalNodeTypeVolumeType, - ), - beta: data.beta, - description: data.description, - disabled: data.disabled, - generation: data.generation, - instanceRange: data.instance_range, - isBssdCompatible: data.is_bssd_compatible, - isHaRequired: data.is_ha_required, - memory: data.memory, - name: data.name, - region: data.region, - stockStatus: data.stock_status, - vcpus: data.vcpus, - volumeConstraint: data.volume_constraint - ? unmarshalNodeTypeVolumeConstraintSizes(data.volume_constraint) - : undefined, - } as NodeType -} - -export const unmarshalPrivilege = (data: unknown) => { +export const unmarshalPrivilege = (data: unknown): Privilege => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Privilege' failed as data isn't a dictionary.`, @@ -521,7 +381,7 @@ export const unmarshalPrivilege = (data: unknown) => { } as Privilege } -export const unmarshalSnapshot = (data: unknown) => { +export const unmarshalSnapshot = (data: unknown): Snapshot => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`, @@ -543,17 +403,39 @@ export const unmarshalSnapshot = (data: unknown) => { } as Snapshot } -export const unmarshalUser = (data: unknown) => { +export const unmarshalUser = (data: unknown): User => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'User' failed as data isn't a dictionary.`, ) } - return { isAdmin: data.is_admin, name: data.name } as User + return { + isAdmin: data.is_admin, + name: data.name, + } as User } -export const unmarshalAddInstanceACLRulesResponse = (data: unknown) => { +export const unmarshalACLRule = (data: unknown): ACLRule => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`, + ) + } + + return { + action: data.action, + description: data.description, + direction: data.direction, + ip: data.ip, + port: data.port, + protocol: data.protocol, + } as ACLRule +} + +export const unmarshalAddInstanceACLRulesResponse = ( + data: unknown, +): AddInstanceACLRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'AddInstanceACLRulesResponse' failed as data isn't a dictionary.`, @@ -565,7 +447,9 @@ export const unmarshalAddInstanceACLRulesResponse = (data: unknown) => { } as AddInstanceACLRulesResponse } -export const unmarshalAddInstanceSettingsResponse = (data: unknown) => { +export const unmarshalAddInstanceSettingsResponse = ( + data: unknown, +): AddInstanceSettingsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'AddInstanceSettingsResponse' failed as data isn't a dictionary.`, @@ -577,7 +461,9 @@ export const unmarshalAddInstanceSettingsResponse = (data: unknown) => { } as AddInstanceSettingsResponse } -export const unmarshalDeleteInstanceACLRulesResponse = (data: unknown) => { +export const unmarshalDeleteInstanceACLRulesResponse = ( + data: unknown, +): DeleteInstanceACLRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DeleteInstanceACLRulesResponse' failed as data isn't a dictionary.`, @@ -589,7 +475,9 @@ export const unmarshalDeleteInstanceACLRulesResponse = (data: unknown) => { } as DeleteInstanceACLRulesResponse } -export const unmarshalDeleteInstanceSettingsResponse = (data: unknown) => { +export const unmarshalDeleteInstanceSettingsResponse = ( + data: unknown, +): DeleteInstanceSettingsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DeleteInstanceSettingsResponse' failed as data isn't a dictionary.`, @@ -601,7 +489,7 @@ export const unmarshalDeleteInstanceSettingsResponse = (data: unknown) => { } as DeleteInstanceSettingsResponse } -export const unmarshalInstanceMetrics = (data: unknown) => { +export const unmarshalInstanceMetrics = (data: unknown): InstanceMetrics => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'InstanceMetrics' failed as data isn't a dictionary.`, @@ -613,7 +501,9 @@ export const unmarshalInstanceMetrics = (data: unknown) => { } as InstanceMetrics } -export const unmarshalListDatabaseBackupsResponse = (data: unknown) => { +export const unmarshalListDatabaseBackupsResponse = ( + data: unknown, +): ListDatabaseBackupsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDatabaseBackupsResponse' failed as data isn't a dictionary.`, @@ -629,7 +519,70 @@ export const unmarshalListDatabaseBackupsResponse = (data: unknown) => { } as ListDatabaseBackupsResponse } -export const unmarshalListDatabaseEnginesResponse = (data: unknown) => { +const unmarshalEngineSetting = (data: unknown): EngineSetting => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'EngineSetting' failed as data isn't a dictionary.`, + ) + } + + return { + defaultValue: data.default_value, + description: data.description, + floatMax: data.float_max, + floatMin: data.float_min, + hotConfigurable: data.hot_configurable, + intMax: data.int_max, + intMin: data.int_min, + name: data.name, + propertyType: data.property_type, + stringConstraint: data.string_constraint, + unit: data.unit, + } as EngineSetting +} + +const unmarshalEngineVersion = (data: unknown): EngineVersion => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'EngineVersion' failed as data isn't a dictionary.`, + ) + } + + return { + availableInitSettings: unmarshalArrayOfObject( + data.available_init_settings, + unmarshalEngineSetting, + ), + availableSettings: unmarshalArrayOfObject( + data.available_settings, + unmarshalEngineSetting, + ), + beta: data.beta, + disabled: data.disabled, + endOfLife: unmarshalDate(data.end_of_life), + name: data.name, + version: data.version, + } as EngineVersion +} + +const unmarshalDatabaseEngine = (data: unknown): DatabaseEngine => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'DatabaseEngine' failed as data isn't a dictionary.`, + ) + } + + return { + logoUrl: data.logo_url, + name: data.name, + region: data.region, + versions: unmarshalArrayOfObject(data.versions, unmarshalEngineVersion), + } as DatabaseEngine +} + +export const unmarshalListDatabaseEnginesResponse = ( + data: unknown, +): ListDatabaseEnginesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDatabaseEnginesResponse' failed as data isn't a dictionary.`, @@ -642,7 +595,9 @@ export const unmarshalListDatabaseEnginesResponse = (data: unknown) => { } as ListDatabaseEnginesResponse } -export const unmarshalListDatabasesResponse = (data: unknown) => { +export const unmarshalListDatabasesResponse = ( + data: unknown, +): ListDatabasesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDatabasesResponse' failed as data isn't a dictionary.`, @@ -655,7 +610,9 @@ export const unmarshalListDatabasesResponse = (data: unknown) => { } as ListDatabasesResponse } -export const unmarshalListInstanceACLRulesResponse = (data: unknown) => { +export const unmarshalListInstanceACLRulesResponse = ( + data: unknown, +): ListInstanceACLRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListInstanceACLRulesResponse' failed as data isn't a dictionary.`, @@ -668,7 +625,24 @@ export const unmarshalListInstanceACLRulesResponse = (data: unknown) => { } as ListInstanceACLRulesResponse } -export const unmarshalListInstanceLogsDetailsResponse = (data: unknown) => { +const unmarshalListInstanceLogsDetailsResponseInstanceLogDetail = ( + data: unknown, +): ListInstanceLogsDetailsResponseInstanceLogDetail => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListInstanceLogsDetailsResponseInstanceLogDetail' failed as data isn't a dictionary.`, + ) + } + + return { + logName: data.log_name, + size: data.size, + } as ListInstanceLogsDetailsResponseInstanceLogDetail +} + +export const unmarshalListInstanceLogsDetailsResponse = ( + data: unknown, +): ListInstanceLogsDetailsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListInstanceLogsDetailsResponse' failed as data isn't a dictionary.`, @@ -676,42 +650,110 @@ export const unmarshalListInstanceLogsDetailsResponse = (data: unknown) => { } return { - details: unmarshalArrayOfObject( - data.details, - unmarshalListInstanceLogsDetailsResponseInstanceLogDetail, - ), - } as ListInstanceLogsDetailsResponse + details: unmarshalArrayOfObject( + data.details, + unmarshalListInstanceLogsDetailsResponseInstanceLogDetail, + ), + } as ListInstanceLogsDetailsResponse +} + +export const unmarshalListInstanceLogsResponse = ( + data: unknown, +): ListInstanceLogsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListInstanceLogsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + instanceLogs: unmarshalArrayOfObject( + data.instance_logs, + unmarshalInstanceLog, + ), + } as ListInstanceLogsResponse +} + +export const unmarshalListInstancesResponse = ( + data: unknown, +): ListInstancesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + instances: unmarshalArrayOfObject(data.instances, unmarshalInstance), + totalCount: data.total_count, + } as ListInstancesResponse +} + +const unmarshalNodeTypeVolumeConstraintSizes = ( + data: unknown, +): NodeTypeVolumeConstraintSizes => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'NodeTypeVolumeConstraintSizes' failed as data isn't a dictionary.`, + ) + } + + return { + maxSize: data.max_size, + minSize: data.min_size, + } as NodeTypeVolumeConstraintSizes } -export const unmarshalListInstanceLogsResponse = (data: unknown) => { +const unmarshalNodeTypeVolumeType = (data: unknown): NodeTypeVolumeType => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ListInstanceLogsResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`, ) } return { - instanceLogs: unmarshalArrayOfObject( - data.instance_logs, - unmarshalInstanceLog, - ), - } as ListInstanceLogsResponse + chunkSize: data.chunk_size, + class: data.class, + description: data.description, + maxSize: data.max_size, + minSize: data.min_size, + type: data.type, + } as NodeTypeVolumeType } -export const unmarshalListInstancesResponse = (data: unknown) => { +const unmarshalNodeType = (data: unknown): NodeType => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`, + `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`, ) } return { - instances: unmarshalArrayOfObject(data.instances, unmarshalInstance), - totalCount: data.total_count, - } as ListInstancesResponse + availableVolumeTypes: unmarshalArrayOfObject( + data.available_volume_types, + unmarshalNodeTypeVolumeType, + ), + beta: data.beta, + description: data.description, + disabled: data.disabled, + generation: data.generation, + instanceRange: data.instance_range, + isBssdCompatible: data.is_bssd_compatible, + isHaRequired: data.is_ha_required, + memory: data.memory, + name: data.name, + region: data.region, + stockStatus: data.stock_status, + vcpus: data.vcpus, + volumeConstraint: data.volume_constraint + ? unmarshalNodeTypeVolumeConstraintSizes(data.volume_constraint) + : undefined, + } as NodeType } -export const unmarshalListNodeTypesResponse = (data: unknown) => { +export const unmarshalListNodeTypesResponse = ( + data: unknown, +): ListNodeTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`, @@ -724,7 +766,9 @@ export const unmarshalListNodeTypesResponse = (data: unknown) => { } as ListNodeTypesResponse } -export const unmarshalListPrivilegesResponse = (data: unknown) => { +export const unmarshalListPrivilegesResponse = ( + data: unknown, +): ListPrivilegesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPrivilegesResponse' failed as data isn't a dictionary.`, @@ -737,7 +781,9 @@ export const unmarshalListPrivilegesResponse = (data: unknown) => { } as ListPrivilegesResponse } -export const unmarshalListSnapshotsResponse = (data: unknown) => { +export const unmarshalListSnapshotsResponse = ( + data: unknown, +): ListSnapshotsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`, @@ -750,7 +796,9 @@ export const unmarshalListSnapshotsResponse = (data: unknown) => { } as ListSnapshotsResponse } -export const unmarshalListUsersResponse = (data: unknown) => { +export const unmarshalListUsersResponse = ( + data: unknown, +): ListUsersResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`, @@ -763,7 +811,9 @@ export const unmarshalListUsersResponse = (data: unknown) => { } as ListUsersResponse } -export const unmarshalPrepareInstanceLogsResponse = (data: unknown) => { +export const unmarshalPrepareInstanceLogsResponse = ( + data: unknown, +): PrepareInstanceLogsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'PrepareInstanceLogsResponse' failed as data isn't a dictionary.`, @@ -778,7 +828,9 @@ export const unmarshalPrepareInstanceLogsResponse = (data: unknown) => { } as PrepareInstanceLogsResponse } -export const unmarshalSetInstanceACLRulesResponse = (data: unknown) => { +export const unmarshalSetInstanceACLRulesResponse = ( + data: unknown, +): SetInstanceACLRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetInstanceACLRulesResponse' failed as data isn't a dictionary.`, @@ -790,7 +842,9 @@ export const unmarshalSetInstanceACLRulesResponse = (data: unknown) => { } as SetInstanceACLRulesResponse } -export const unmarshalSetInstanceSettingsResponse = (data: unknown) => { +export const unmarshalSetInstanceSettingsResponse = ( + data: unknown, +): SetInstanceSettingsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetInstanceSettingsResponse' failed as data isn't a dictionary.`, @@ -802,70 +856,6 @@ export const unmarshalSetInstanceSettingsResponse = (data: unknown) => { } as SetInstanceSettingsResponse } -const marshalEndpointSpecPrivateNetworkIpamConfig = ( - request: EndpointSpecPrivateNetworkIpamConfig, - defaults: DefaultValues, -): Record => ({}) - -const marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig = ( - request: ReadReplicaEndpointSpecPrivateNetworkIpamConfig, - defaults: DefaultValues, -): Record => ({}) - -const marshalEndpointSpecLoadBalancer = ( - request: EndpointSpecLoadBalancer, - defaults: DefaultValues, -): Record => ({}) - -const marshalEndpointSpecPrivateNetwork = ( - request: EndpointSpecPrivateNetwork, - defaults: DefaultValues, -): Record => ({ - private_network_id: request.privateNetworkId, - ...resolveOneOf([ - { - param: 'service_ip', - value: request.serviceIp, - }, - { - param: 'ipam_config', - value: request.ipamConfig - ? marshalEndpointSpecPrivateNetworkIpamConfig( - request.ipamConfig, - defaults, - ) - : undefined, - }, - ]), -}) - -const marshalReadReplicaEndpointSpecDirectAccess = ( - request: ReadReplicaEndpointSpecDirectAccess, - defaults: DefaultValues, -): Record => ({}) - -const marshalReadReplicaEndpointSpecPrivateNetwork = ( - request: ReadReplicaEndpointSpecPrivateNetwork, - defaults: DefaultValues, -): Record => ({ - private_network_id: request.privateNetworkId, - ...resolveOneOf([ - { - param: 'service_ip', - value: request.serviceIp, - }, - { - param: 'ipam_config', - value: request.ipamConfig - ? marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig( - request.ipamConfig, - defaults, - ) - : undefined, - }, - ]), -}) - const marshalACLRuleRequest = ( request: ACLRuleRequest, defaults: DefaultValues, @@ -874,24 +864,11 @@ const marshalACLRuleRequest = ( ip: request.ip, }) -const marshalEndpointSpec = ( - request: EndpointSpec, +export const marshalAddInstanceACLRulesRequest = ( + request: AddInstanceACLRulesRequest, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ - { - param: 'load_balancer', - value: request.loadBalancer - ? marshalEndpointSpecLoadBalancer(request.loadBalancer, defaults) - : undefined, - }, - { - param: 'private_network', - value: request.privateNetwork - ? marshalEndpointSpecPrivateNetwork(request.privateNetwork, defaults) - : undefined, - }, - ]), + rules: request.rules.map(elt => marshalACLRuleRequest(elt, defaults)), }) const marshalInstanceSetting = ( @@ -902,55 +879,6 @@ const marshalInstanceSetting = ( value: request.value, }) -const marshalLogsPolicy = ( - request: LogsPolicy, - defaults: DefaultValues, -): Record => ({ - max_age_retention: request.maxAgeRetention, - total_disk_retention: request.totalDiskRetention, -}) - -const marshalReadReplicaEndpointSpec = ( - request: ReadReplicaEndpointSpec, - defaults: DefaultValues, -): Record => ({ - ...resolveOneOf([ - { - param: 'direct_access', - value: request.directAccess - ? marshalReadReplicaEndpointSpecDirectAccess( - request.directAccess, - defaults, - ) - : undefined, - }, - { - param: 'private_network', - value: request.privateNetwork - ? marshalReadReplicaEndpointSpecPrivateNetwork( - request.privateNetwork, - defaults, - ) - : undefined, - }, - ]), -}) - -const marshalUpgradeInstanceRequestMajorUpgradeWorkflow = ( - request: UpgradeInstanceRequestMajorUpgradeWorkflow, - defaults: DefaultValues, -): Record => ({ - upgradable_version_id: request.upgradableVersionId, - with_endpoints: request.withEndpoints, -}) - -export const marshalAddInstanceACLRulesRequest = ( - request: AddInstanceACLRulesRequest, - defaults: DefaultValues, -): Record => ({ - rules: request.rules.map(elt => marshalACLRuleRequest(elt, defaults)), -}) - export const marshalAddInstanceSettingsRequest = ( request: AddInstanceSettingsRequest, defaults: DefaultValues, @@ -983,13 +911,66 @@ export const marshalCreateDatabaseRequest = ( name: request.name, }) +const marshalEndpointSpecPrivateNetworkIpamConfig = ( + request: EndpointSpecPrivateNetworkIpamConfig, + defaults: DefaultValues, +): Record => ({}) + +const marshalEndpointSpecLoadBalancer = ( + request: EndpointSpecLoadBalancer, + defaults: DefaultValues, +): Record => ({}) + +const marshalEndpointSpecPrivateNetwork = ( + request: EndpointSpecPrivateNetwork, + defaults: DefaultValues, +): Record => ({ + private_network_id: request.privateNetworkId, + ...resolveOneOf>([ + { param: 'service_ip', value: request.serviceIp }, + { + param: 'ipam_config', + value: + request.ipamConfig !== undefined + ? marshalEndpointSpecPrivateNetworkIpamConfig( + request.ipamConfig, + defaults, + ) + : undefined, + }, + ]), +}) + +const marshalEndpointSpec = ( + request: EndpointSpec, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf([ + { + param: 'load_balancer', + value: + request.loadBalancer !== undefined + ? marshalEndpointSpecLoadBalancer(request.loadBalancer, defaults) + : undefined, + }, + { + param: 'private_network', + value: + request.privateNetwork !== undefined + ? marshalEndpointSpecPrivateNetwork(request.privateNetwork, defaults) + : undefined, + }, + ]), +}) + export const marshalCreateEndpointRequest = ( request: CreateEndpointRequest, defaults: DefaultValues, ): Record => ({ - endpoint_spec: request.endpointSpec - ? marshalEndpointSpec(request.endpointSpec, defaults) - : undefined, + endpoint_spec: + request.endpointSpec !== undefined + ? marshalEndpointSpec(request.endpointSpec, defaults) + : undefined, }) export const marshalCreateInstanceFromSnapshotRequest = ( @@ -1008,12 +989,14 @@ export const marshalCreateInstanceRequest = ( backup_same_region: request.backupSameRegion, disable_backup: request.disableBackup, engine: request.engine, - init_endpoints: request.initEndpoints - ? request.initEndpoints.map(elt => marshalEndpointSpec(elt, defaults)) - : undefined, - init_settings: request.initSettings - ? request.initSettings.map(elt => marshalInstanceSetting(elt, defaults)) - : undefined, + init_endpoints: + request.initEndpoints !== undefined + ? request.initEndpoints.map(elt => marshalEndpointSpec(elt, defaults)) + : undefined, + init_settings: + request.initSettings !== undefined + ? request.initSettings.map(elt => marshalInstanceSetting(elt, defaults)) + : undefined, is_ha_cluster: request.isHaCluster, name: request.name || randomName('ins'), node_type: request.nodeType, @@ -1021,17 +1004,75 @@ export const marshalCreateInstanceRequest = ( tags: request.tags, user_name: request.userName, volume_size: request.volumeSize, - volume_type: request.volumeType ?? 'lssd', + volume_type: request.volumeType, ...resolveOneOf([ + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + ]), +}) + +const marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig = ( + request: ReadReplicaEndpointSpecPrivateNetworkIpamConfig, + defaults: DefaultValues, +): Record => ({}) + +const marshalReadReplicaEndpointSpecDirectAccess = ( + request: ReadReplicaEndpointSpecDirectAccess, + defaults: DefaultValues, +): Record => ({}) + +const marshalReadReplicaEndpointSpecPrivateNetwork = ( + request: ReadReplicaEndpointSpecPrivateNetwork, + defaults: DefaultValues, +): Record => ({ + private_network_id: request.privateNetworkId, + ...resolveOneOf>([ + { param: 'service_ip', value: request.serviceIp }, { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, + param: 'ipam_config', + value: + request.ipamConfig !== undefined + ? marshalReadReplicaEndpointSpecPrivateNetworkIpamConfig( + request.ipamConfig, + defaults, + ) + : undefined, + }, + ]), +}) + +const marshalReadReplicaEndpointSpec = ( + request: ReadReplicaEndpointSpec, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf([ + { + param: 'direct_access', + value: + request.directAccess !== undefined + ? marshalReadReplicaEndpointSpecDirectAccess( + request.directAccess, + defaults, + ) + : undefined, + }, + { + param: 'private_network', + value: + request.privateNetwork !== undefined + ? marshalReadReplicaEndpointSpecPrivateNetwork( + request.privateNetwork, + defaults, + ) + : undefined, }, ]), }) @@ -1049,11 +1090,12 @@ export const marshalCreateReadReplicaRequest = ( request: CreateReadReplicaRequest, defaults: DefaultValues, ): Record => ({ - endpoint_spec: request.endpointSpec - ? request.endpointSpec.map(elt => - marshalReadReplicaEndpointSpec(elt, defaults), - ) - : undefined, + endpoint_spec: + request.endpointSpec !== undefined + ? request.endpointSpec.map(elt => + marshalReadReplicaEndpointSpec(elt, defaults), + ) + : undefined, instance_id: request.instanceId, same_zone: request.sameZone, }) @@ -1138,7 +1180,7 @@ export const marshalSetPrivilegeRequest = ( defaults: DefaultValues, ): Record => ({ database_name: request.databaseName, - permission: request.permission ?? 'readonly', + permission: request.permission, user_name: request.userName, }) @@ -1150,6 +1192,14 @@ export const marshalUpdateDatabaseBackupRequest = ( name: request.name, }) +const marshalLogsPolicy = ( + request: LogsPolicy, + defaults: DefaultValues, +): Record => ({ + max_age_retention: request.maxAgeRetention, + total_disk_retention: request.totalDiskRetention, +}) + export const marshalUpdateInstanceRequest = ( request: UpdateInstanceRequest, defaults: DefaultValues, @@ -1159,9 +1209,10 @@ export const marshalUpdateInstanceRequest = ( backup_schedule_retention: request.backupScheduleRetention, backup_schedule_start_hour: request.backupScheduleStartHour, is_backup_schedule_disabled: request.isBackupScheduleDisabled, - logs_policy: request.logsPolicy - ? marshalLogsPolicy(request.logsPolicy, defaults) - : undefined, + logs_policy: + request.logsPolicy !== undefined + ? marshalLogsPolicy(request.logsPolicy, defaults) + : undefined, name: request.name, tags: request.tags, }) @@ -1182,39 +1233,33 @@ export const marshalUpdateUserRequest = ( password: request.password, }) +const marshalUpgradeInstanceRequestMajorUpgradeWorkflow = ( + request: UpgradeInstanceRequestMajorUpgradeWorkflow, + defaults: DefaultValues, +): Record => ({ + upgradable_version_id: request.upgradableVersionId, + with_endpoints: request.withEndpoints, +}) + export const marshalUpgradeInstanceRequest = ( request: UpgradeInstanceRequest, defaults: DefaultValues, ): Record => ({ - ...resolveOneOf([ - { - param: 'node_type', - value: request.nodeType, - }, - { - param: 'enable_ha', - value: request.enableHa, - }, - { - param: 'volume_size', - value: request.volumeSize, - }, - { - param: 'volume_type', - value: request.volumeType, - }, - { - param: 'upgradable_version_id', - value: request.upgradableVersionId, - }, + ...resolveOneOf>([ + { param: 'node_type', value: request.nodeType }, + { param: 'enable_ha', value: request.enableHa }, + { param: 'volume_size', value: request.volumeSize }, + { param: 'volume_type', value: request.volumeType }, + { param: 'upgradable_version_id', value: request.upgradableVersionId }, { param: 'major_upgrade_workflow', - value: request.majorUpgradeWorkflow - ? marshalUpgradeInstanceRequestMajorUpgradeWorkflow( - request.majorUpgradeWorkflow, - defaults, - ) - : undefined, + value: + request.majorUpgradeWorkflow !== undefined + ? marshalUpgradeInstanceRequestMajorUpgradeWorkflow( + request.majorUpgradeWorkflow, + defaults, + ) + : undefined, }, ]), }) diff --git a/packages/clients/src/api/rdb/v1/types.gen.ts b/packages/clients/src/api/rdb/v1/types.gen.ts index 9d6da094f..9cea33a49 100644 --- a/packages/clients/src/api/rdb/v1/types.gen.ts +++ b/packages/clients/src/api/rdb/v1/types.gen.ts @@ -99,7 +99,6 @@ export type NodeTypeStock = export type Permission = 'readonly' | 'readwrite' | 'all' | 'custom' | 'none' -/** Read replica. status. */ export type ReadReplicaStatus = | 'unknown' | 'provisioning' @@ -124,114 +123,48 @@ export type StorageClass = 'unknown_storage_class' | 'lssd' | 'bssd' | 'sbs' export type VolumeType = 'lssd' | 'bssd' | 'sbs_5k' | 'sbs_15k' -export interface ACLRule { - ip: string - /** @deprecated */ - port?: number - protocol: ACLRuleProtocol - direction: ACLRuleDirection - action: ACLRuleAction - description: string -} - -export interface ACLRuleRequest { - ip: string - description: string -} - -/** Add instance acl rules response. */ -export interface AddInstanceACLRulesResponse { - /** ACL Rules enabled for the Database Instance. */ - rules: ACLRule[] -} +export interface EndpointDirectAccessDetails {} -/** Add instance settings response. */ -export interface AddInstanceSettingsResponse { - /** Settings available on the Database Instance. */ - settings: InstanceSetting[] -} +export interface EndpointLoadBalancerDetails {} -/** Backup schedule. */ -export interface BackupSchedule { - /** Frequency of the backup schedule (in hours). */ - frequency: number - /** Default retention period of backups (in days). */ - retention: number - /** Defines whether the backup schedule feature is disabled. */ - disabled: boolean - /** Next run of the backup schedule (accurate to 10 minutes). */ - nextRunAt?: Date +export interface EndpointPrivateNetworkDetails { + /** UUID of the private network. */ + privateNetworkId: string + /** CIDR notation of the endpoint IPv4 address. */ + serviceIp: string + /** Private network zone. */ + zone: Zone } -/** Database. */ -export interface Database { - /** Name of the database. */ - name: string - /** Name of the database owner. */ - owner: string - /** Defines whether the database is managed or not. */ - managed: boolean - /** Size of the database. */ - size: number -} +export interface EndpointSpecPrivateNetworkIpamConfig {} -/** Database backup. */ -export interface DatabaseBackup { - /** UUID of the database backup. */ - id: string - /** UUID of the Database Instance. */ - instanceId: string - /** Name of backed up database. */ - databaseName: string - /** Name of the backup. */ - name: string - /** Status of the backup. */ - status: DatabaseBackupStatus - /** Size of the database backup. */ - size?: number - /** Expiration date (must follow the ISO 8601 format). */ - expiresAt?: Date - /** Creation date (must follow the ISO 8601 format). */ - createdAt?: Date - /** Updated date (must follow the ISO 8601 format). */ - updatedAt?: Date - /** Name of the Database Instance of the backup. */ - instanceName: string - /** URL you can download the backup from. */ - downloadUrl?: string - /** Expiration date of the download link. */ - downloadUrlExpiresAt?: Date - /** Region of the database backup. */ - region: Region - /** Store logical backups in the same region as the source Database Instance. */ - sameRegion: boolean -} +export interface ReadReplicaEndpointSpecPrivateNetworkIpamConfig {} -/** Database engine. */ -export interface DatabaseEngine { - /** Engine name. */ +export interface EngineSetting { + /** Setting name from the database engine. */ name: string - /** Engine logo URL. */ - logoUrl: string - /** Available versions. */ - versions: EngineVersion[] - /** Region of this Database Instance. */ - region: Region -} - -/** Delete instance acl rules response. */ -export interface DeleteInstanceACLRulesResponse { - /** IP addresses defined in the ACL rules of the Database Instance. */ - rules: ACLRule[] -} - -/** Delete instance settings response. */ -export interface DeleteInstanceSettingsResponse { - /** Settings names to delete from the Database Instance. */ - settings: InstanceSetting[] + /** Value set when not specified. */ + defaultValue: string + /** Setting can be applied without restarting. */ + hotConfigurable: boolean + /** Setting description. */ + description: string + /** Setting type. */ + propertyType: EngineSettingPropertyType + /** Setting base unit. */ + unit?: string + /** Validation regex for string type settings. */ + stringConstraint?: string + /** Minimum value for int types. */ + intMin?: number + /** Maximum value for int types. */ + intMax?: number + /** Minimum value for float types. */ + floatMin?: number + /** Maximum value for float types. */ + floatMax?: number } -/** Endpoint. */ export interface Endpoint { /** UUID of the endpoint. */ id: string @@ -278,47 +211,33 @@ export interface Endpoint { hostname?: string } -export interface EndpointDirectAccessDetails {} - -export interface EndpointLoadBalancerDetails {} +export interface EndpointSpecLoadBalancer {} -/** Endpoint. private network details. */ -export interface EndpointPrivateNetworkDetails { - /** UUID of the private network. */ +export interface EndpointSpecPrivateNetwork { + /** UUID of the Private Network to be connected to the Database Instance. */ privateNetworkId: string - /** CIDR notation of the endpoint IPv4 address. */ - serviceIp: string - /** Private network zone. */ - zone: Zone -} - -/** Endpoint spec. */ -export interface EndpointSpec { /** - * Load balancer endpoint specifications. Public endpoint for Database - * Instance which is systematically present. One per RDB instance. + * Endpoint IPv4 address with a CIDR notation. Refer to the official Scaleway + * documentation to learn more about IP and subnet limitations. * - * One-of ('spec'): at most one of 'loadBalancer', 'privateNetwork' could be - * set. + * One-of ('config'): at most one of 'serviceIp', 'ipamConfig' could be set. */ - loadBalancer?: EndpointSpecLoadBalancer + serviceIp?: string /** - * Private Network endpoint specifications. One maximum per Database Instance - * or Read Replica (a Database Instance and its Read Replica can have - * different Private Networks). Cannot be updated (has to be deleted and - * recreated). + * Automated configuration of your Private Network endpoint with Scaleway IPAM + * service. One at the most per Database Instance or Read Replica (a Database + * Instance and its Read Replica can have different Private Networks). Cannot + * be updated (has to be deleted and recreated). * - * One-of ('spec'): at most one of 'loadBalancer', 'privateNetwork' could be - * set. + * One-of ('config'): at most one of 'serviceIp', 'ipamConfig' could be set. */ - privateNetwork?: EndpointSpecPrivateNetwork + ipamConfig?: EndpointSpecPrivateNetworkIpamConfig } -export interface EndpointSpecLoadBalancer {} +export interface ReadReplicaEndpointSpecDirectAccess {} -/** Endpoint spec. private network. */ -export interface EndpointSpecPrivateNetwork { - /** UUID of the Private Network to be connected to the Database Instance. */ +export interface ReadReplicaEndpointSpecPrivateNetwork { + /** UUID of the Private Network to be connected to the Read Replica. */ privateNetworkId: string /** * Endpoint IPv4 address with a CIDR notation. Refer to the official Scaleway @@ -330,43 +249,14 @@ export interface EndpointSpecPrivateNetwork { /** * Automated configuration of your Private Network endpoint with Scaleway IPAM * service. One at the most per Database Instance or Read Replica (a Database - * Instance and its Read Replica can have different Private Networks). Cannot + * Instance and its Read Replica can have different private networks). Cannot * be updated (has to be deleted and recreated). * * One-of ('config'): at most one of 'serviceIp', 'ipamConfig' could be set. */ - ipamConfig?: EndpointSpecPrivateNetworkIpamConfig -} - -export interface EndpointSpecPrivateNetworkIpamConfig {} - -/** Engine setting. */ -export interface EngineSetting { - /** Setting name from the database engine. */ - name: string - /** Value set when not specified. */ - defaultValue: string - /** Setting can be applied without restarting. */ - hotConfigurable: boolean - /** Setting description. */ - description: string - /** Setting type. */ - propertyType: EngineSettingPropertyType - /** Setting base unit. */ - unit?: string - /** Validation regex for string type settings. */ - stringConstraint?: string - /** Minimum value for int types. */ - intMin?: number - /** Maximum value for int types. */ - intMax?: number - /** Minimum value for float types. */ - floatMin?: number - /** Maximum value for float types. */ - floatMax?: number + ipamConfig?: ReadReplicaEndpointSpecPrivateNetworkIpamConfig } -/** Engine version. */ export interface EngineVersion { /** Database engine version. */ version: string @@ -384,173 +274,22 @@ export interface EngineVersion { availableInitSettings: EngineSetting[] } -/** Instance. */ -export interface Instance { - /** Creation date (must follow the ISO 8601 format). */ - createdAt?: Date - /** Volumes of the Database Instance. */ - volume?: Volume - /** Region the Database Instance is in. */ - region: Region - /** UUID of the Database Instance. */ - id: string - /** Name of the Database Instance. */ +export interface BackupSchedule { + /** Frequency of the backup schedule (in hours). */ + frequency: number + /** Default retention period of backups (in days). */ + retention: number + /** Defines whether the backup schedule feature is disabled. */ + disabled: boolean + /** Next run of the backup schedule (accurate to 10 minutes). */ + nextRunAt?: Date +} + +export interface InstanceSetting { name: string - /** Organization ID the Database Instance belongs to. */ - organizationId: string - /** Project ID the Database Instance belongs to. */ - projectId: string - /** Status of the Database Instance. */ - status: InstanceStatus - /** Database engine of the database (PostgreSQL, MySQL, ...). */ - engine: string - /** Available database engine versions for upgrade. */ - upgradableVersion: UpgradableVersion[] - /** @deprecated Endpoint of the Database Instance. */ - endpoint?: Endpoint - /** List of tags applied to the Database Instance. */ - tags: string[] - /** Advanced settings of the Database Instance. */ - settings: InstanceSetting[] - /** Backup schedule of the Database Instance. */ - backupSchedule?: BackupSchedule - /** Defines whether or not High-Availability is enabled. */ - isHaCluster: boolean - /** Read Replicas of the Database Instance. */ - readReplicas: ReadReplica[] - /** Node type of the Database Instance. */ - nodeType: string - /** List of engine settings to be set at database initialization. */ - initSettings: InstanceSetting[] - /** List of Database Instance endpoints. */ - endpoints: Endpoint[] - /** Logs policy of the Database Instance. */ - logsPolicy?: LogsPolicy - /** Store logical backups in the same region as the Database Instance. */ - backupSameRegion: boolean - /** List of Database Instance maintenance events. */ - maintenances: Maintenance[] + value: string } -/** Instance log. */ -export interface InstanceLog { - /** Presigned S3 URL to download your log file. */ - downloadUrl?: string - /** UUID of the Database Instance log. */ - id: string - /** Status of the logs in a Database Instance. */ - status: InstanceLogStatus - /** Name of the underlying node. */ - nodeName: string - /** Expiration date (must follow the ISO 8601 format). */ - expiresAt?: Date - /** Creation date (must follow the ISO 8601 format). */ - createdAt?: Date - /** Region the Database Instance is in. */ - region: Region -} - -/** Instance metrics. */ -export interface InstanceMetrics { - /** Time series of metrics of a Database Instance. */ - timeseries: TimeSeries[] -} - -export interface InstanceSetting { - name: string - value: string -} - -/** List database backups response. */ -export interface ListDatabaseBackupsResponse { - /** List of database backups. */ - databaseBackups: DatabaseBackup[] - /** Total count of database backups available. */ - totalCount: number -} - -/** List database engines response. */ -export interface ListDatabaseEnginesResponse { - /** List of the available database engines. */ - engines: DatabaseEngine[] - /** Total count of database engines available. */ - totalCount: number -} - -/** List databases response. */ -export interface ListDatabasesResponse { - /** List of the databases. */ - databases: Database[] - /** Total count of databases present on a Database Instance. */ - totalCount: number -} - -/** List instance acl rules response. */ -export interface ListInstanceACLRulesResponse { - /** List of ACL rules present on a Database Instance. */ - rules: ACLRule[] - /** Total count of ACL rules present on a Database Instance. */ - totalCount: number -} - -/** List instance logs details response. */ -export interface ListInstanceLogsDetailsResponse { - /** Remote Database Instance logs details. */ - details: ListInstanceLogsDetailsResponseInstanceLogDetail[] -} - -export interface ListInstanceLogsDetailsResponseInstanceLogDetail { - logName: string - size: number -} - -/** List instance logs response. */ -export interface ListInstanceLogsResponse { - /** Available logs in a Database Instance. */ - instanceLogs: InstanceLog[] -} - -/** List instances response. */ -export interface ListInstancesResponse { - /** List of all Database Instances available in an Organization or Project. */ - instances: Instance[] - /** Total count of Database Instances available in a Organization or Project. */ - totalCount: number -} - -/** List node types response. */ -export interface ListNodeTypesResponse { - /** Types of the node. */ - nodeTypes: NodeType[] - /** Total count of node-types available. */ - totalCount: number -} - -/** List privileges response. */ -export interface ListPrivilegesResponse { - /** Privileges of a user in a database in a Database Instance. */ - privileges: Privilege[] - /** Total count of privileges present on a database. */ - totalCount: number -} - -/** List snapshots response. */ -export interface ListSnapshotsResponse { - /** List of snapshots. */ - snapshots: Snapshot[] - /** Total count of snapshots available. */ - totalCount: number -} - -/** List users response. */ -export interface ListUsersResponse { - /** List of users in a Database Instance. */ - users: User[] - /** Total count of users present on a Database Instance. */ - totalCount: number -} - -/** Logs policy. */ export interface LogsPolicy { /** Max age (in days) of remote logs to keep on the Database Instance. */ maxAgeRetention?: number @@ -558,7 +297,6 @@ export interface LogsPolicy { totalDiskRetention?: number } -/** Maintenance. */ export interface Maintenance { /** Start date of the maintenance window. */ startsAt?: Date @@ -572,39 +310,35 @@ export interface Maintenance { status: MaintenanceStatus } -/** Node type. */ -export interface NodeType { - /** Node Type name identifier. */ - name: string - /** Current stock status for the Node Type. */ - stockStatus: NodeTypeStock - /** Current specs of the offer. */ - description: string - /** Number of virtual CPUs. */ - vcpus: number - /** Quantity of RAM. */ - memory: number - /** @deprecated {undefined} Deprecated Node Type volume constraints. */ - volumeConstraint?: NodeTypeVolumeConstraintSizes - /** @deprecated The Node Type is compliant with Block Storage. */ - isBssdCompatible?: boolean - /** The Node Type is currently disabled. */ - disabled: boolean - /** The Node Type is currently in beta. */ - beta: boolean - /** Available storage options for the Node Type. */ - availableVolumeTypes: NodeTypeVolumeType[] - /** The Node Type can be used only with high availability option. */ - isHaRequired: boolean - /** Generation associated with the NodeType offer. */ - generation: NodeTypeGeneration - /** Instance range associated with the NodeType offer. */ - instanceRange: string - /** Region the Node Type is in. */ +export interface ReadReplica { + /** UUID of the Read Replica. */ + id: string + /** Display Read Replica connection information. */ + endpoints: Endpoint[] + /** Read replica status. */ + status: ReadReplicaStatus + /** Region the Read Replica is in. */ region: Region + /** + * Whether the replica is in the same availability zone as the main instance + * nodes or not. + */ + sameZone: boolean +} + +export interface UpgradableVersion { + id: string + name: string + version: string + minorVersion: string +} + +export interface Volume { + type: VolumeType + size: number + class: StorageClass } -/** Node type. volume constraint sizes. */ export interface NodeTypeVolumeConstraintSizes { /** [deprecated] Mimimum size required for the Volume. */ minSize: number @@ -612,7 +346,6 @@ export interface NodeTypeVolumeConstraintSizes { maxSize: number } -/** Node type. volume type. */ export interface NodeTypeVolumeType { /** Volume Type. */ type: VolumeType @@ -628,40 +361,42 @@ export interface NodeTypeVolumeType { class: StorageClass } -/** Prepare instance logs response. */ -export interface PrepareInstanceLogsResponse { - /** Instance logs for a Database Instance between a start and an end date. */ - instanceLogs: InstanceLog[] +export interface ACLRuleRequest { + ip: string + description: string } -/** Privilege. */ -export interface Privilege { - /** Permission (Read, Read/Write, All, Custom). */ - permission: Permission - /** Name of the database. */ - databaseName: string - /** Name of the user. */ - userName: string +export interface ACLRule { + ip: string + /** @deprecated */ + port?: number + protocol: ACLRuleProtocol + direction: ACLRuleDirection + action: ACLRuleAction + description: string } -/** Read replica. */ -export interface ReadReplica { - /** UUID of the Read Replica. */ - id: string - /** Display Read Replica connection information. */ - endpoints: Endpoint[] - /** Read replica status. */ - status: ReadReplicaStatus - /** Region the Read Replica is in. */ - region: Region +export interface EndpointSpec { /** - * Whether the replica is in the same availability zone as the main instance - * nodes or not. + * Load balancer endpoint specifications. Public endpoint for Database + * Instance which is systematically present. One per RDB instance. + * + * One-of ('spec'): at most one of 'loadBalancer', 'privateNetwork' could be + * set. */ - sameZone: boolean + loadBalancer?: EndpointSpecLoadBalancer + /** + * Private Network endpoint specifications. One maximum per Database Instance + * or Read Replica (a Database Instance and its Read Replica can have + * different Private Networks). Cannot be updated (has to be deleted and + * recreated). + * + * One-of ('spec'): at most one of 'loadBalancer', 'privateNetwork' could be + * set. + */ + privateNetwork?: EndpointSpecPrivateNetwork } -/** Read replica endpoint spec. */ export interface ReadReplicaEndpointSpec { /** * Direct access endpoint specifications. Public endpoint reserved for Read @@ -681,55 +416,178 @@ export interface ReadReplicaEndpointSpec { privateNetwork?: ReadReplicaEndpointSpecPrivateNetwork } -export interface ReadReplicaEndpointSpecDirectAccess {} - -/** Read replica endpoint spec. private network. */ -export interface ReadReplicaEndpointSpecPrivateNetwork { - /** UUID of the Private Network to be connected to the Read Replica. */ - privateNetworkId: string - /** - * Endpoint IPv4 address with a CIDR notation. Refer to the official Scaleway - * documentation to learn more about IP and subnet limitations. - * - * One-of ('config'): at most one of 'serviceIp', 'ipamConfig' could be set. - */ - serviceIp?: string - /** - * Automated configuration of your Private Network endpoint with Scaleway IPAM - * service. One at the most per Database Instance or Read Replica (a Database - * Instance and its Read Replica can have different private networks). Cannot - * be updated (has to be deleted and recreated). - * - * One-of ('config'): at most one of 'serviceIp', 'ipamConfig' could be set. - */ - ipamConfig?: ReadReplicaEndpointSpecPrivateNetworkIpamConfig -} - -export interface ReadReplicaEndpointSpecPrivateNetworkIpamConfig {} - -/** Set instance acl rules response. */ -export interface SetInstanceACLRulesResponse { - /** ACLs rules configured for a Database Instance. */ - rules: ACLRule[] -} - -/** Set instance settings response. */ -export interface SetInstanceSettingsResponse { - /** Settings configured for a Database Instance. */ - settings: InstanceSetting[] -} - -/** Snapshot. */ -export interface Snapshot { - /** UUID of the snapshot. */ +export interface DatabaseBackup { + /** UUID of the database backup. */ id: string /** UUID of the Database Instance. */ instanceId: string - /** Name of the snapshot. */ + /** Name of backed up database. */ + databaseName: string + /** Name of the backup. */ name: string - /** Status of the snapshot. */ - status: SnapshotStatus - /** Size of the snapshot. */ + /** Status of the backup. */ + status: DatabaseBackupStatus + /** Size of the database backup. */ + size?: number + /** Expiration date (must follow the ISO 8601 format). */ + expiresAt?: Date + /** Creation date (must follow the ISO 8601 format). */ + createdAt?: Date + /** Updated date (must follow the ISO 8601 format). */ + updatedAt?: Date + /** Name of the Database Instance of the backup. */ + instanceName: string + /** URL you can download the backup from. */ + downloadUrl?: string + /** Expiration date of the download link. */ + downloadUrlExpiresAt?: Date + /** Region of the database backup. */ + region: Region + /** Store logical backups in the same region as the source Database Instance. */ + sameRegion: boolean +} + +export interface DatabaseEngine { + /** Engine name. */ + name: string + /** Engine logo URL. */ + logoUrl: string + /** Available versions. */ + versions: EngineVersion[] + /** Region of this Database Instance. */ + region: Region +} + +export interface Database { + /** Name of the database. */ + name: string + /** Name of the database owner. */ + owner: string + /** Defines whether the database is managed or not. */ + managed: boolean + /** Size of the database. */ + size: number +} + +export interface ListInstanceLogsDetailsResponseInstanceLogDetail { + logName: string + size: number +} + +export interface InstanceLog { + /** Presigned S3 URL to download your log file. */ + downloadUrl?: string + /** UUID of the Database Instance log. */ + id: string + /** Status of the logs in a Database Instance. */ + status: InstanceLogStatus + /** Name of the underlying node. */ + nodeName: string + /** Expiration date (must follow the ISO 8601 format). */ + expiresAt?: Date + /** Creation date (must follow the ISO 8601 format). */ + createdAt?: Date + /** Region the Database Instance is in. */ + region: Region +} + +export interface Instance { + /** Creation date (must follow the ISO 8601 format). */ + createdAt?: Date + /** Volumes of the Database Instance. */ + volume?: Volume + /** Region the Database Instance is in. */ + region: Region + /** UUID of the Database Instance. */ + id: string + /** Name of the Database Instance. */ + name: string + /** Organization ID the Database Instance belongs to. */ + organizationId: string + /** Project ID the Database Instance belongs to. */ + projectId: string + /** Status of the Database Instance. */ + status: InstanceStatus + /** Database engine of the database (PostgreSQL, MySQL, ...). */ + engine: string + /** Available database engine versions for upgrade. */ + upgradableVersion: UpgradableVersion[] + /** @deprecated Endpoint of the Database Instance. */ + endpoint?: Endpoint + /** List of tags applied to the Database Instance. */ + tags: string[] + /** Advanced settings of the Database Instance. */ + settings: InstanceSetting[] + /** Backup schedule of the Database Instance. */ + backupSchedule?: BackupSchedule + /** Defines whether or not High-Availability is enabled. */ + isHaCluster: boolean + /** Read Replicas of the Database Instance. */ + readReplicas: ReadReplica[] + /** Node type of the Database Instance. */ + nodeType: string + /** List of engine settings to be set at database initialization. */ + initSettings: InstanceSetting[] + /** List of Database Instance endpoints. */ + endpoints: Endpoint[] + /** Logs policy of the Database Instance. */ + logsPolicy?: LogsPolicy + /** Store logical backups in the same region as the Database Instance. */ + backupSameRegion: boolean + /** List of Database Instance maintenance events. */ + maintenances: Maintenance[] +} + +export interface NodeType { + /** Node Type name identifier. */ + name: string + /** Current stock status for the Node Type. */ + stockStatus: NodeTypeStock + /** Current specs of the offer. */ + description: string + /** Number of virtual CPUs. */ + vcpus: number + /** Quantity of RAM. */ + memory: number + /** @deprecated {undefined} Deprecated Node Type volume constraints. */ + volumeConstraint?: NodeTypeVolumeConstraintSizes + /** @deprecated The Node Type is compliant with Block Storage. */ + isBssdCompatible?: boolean + /** The Node Type is currently disabled. */ + disabled: boolean + /** The Node Type is currently in beta. */ + beta: boolean + /** Available storage options for the Node Type. */ + availableVolumeTypes: NodeTypeVolumeType[] + /** The Node Type can be used only with high availability option. */ + isHaRequired: boolean + /** Generation associated with the NodeType offer. */ + generation: NodeTypeGeneration + /** Instance range associated with the NodeType offer. */ + instanceRange: string + /** Region the Node Type is in. */ + region: Region +} + +export interface Privilege { + /** Permission (Read, Read/Write, All, Custom). */ + permission: Permission + /** Name of the database. */ + databaseName: string + /** Name of the user. */ + userName: string +} + +export interface Snapshot { + /** UUID of the snapshot. */ + id: string + /** UUID of the Database Instance. */ + instanceId: string + /** Name of the snapshot. */ + name: string + /** Status of the snapshot. */ + status: SnapshotStatus + /** Size of the snapshot. */ size?: number /** Expiration date (must follow the ISO 8601 format). */ expiresAt?: Date @@ -745,98 +603,225 @@ export interface Snapshot { region: Region } -export interface UpgradableVersion { - id: string +export interface User { + /** + * Name of the user (Length must be between 1 and 63 characters for PostgreSQL + * and between 1 and 32 characters for MySQL. First character must be an + * alphabet character (a-zA-Z). Your username cannot start with '_rdb' or in + * PostgreSQL, 'pg_'. Only a-zA-Z0-9_$- characters are accepted). + */ name: string - version: string - minorVersion: string + /** + * Defines whether or not a user got administrative privileges on the Database + * Instance. + */ + isAdmin: boolean } -/** Upgrade instance request. major upgrade workflow. */ export interface UpgradeInstanceRequestMajorUpgradeWorkflow { /** - * Update your database engine to a newer version. This will create a new - * Database Instance with same specifications as the current one and perform a - * Database Engine upgrade. + * This will create a new Database Instance with same specifications as the + * current one and perform a Database Engine upgrade. */ upgradableVersionId: string /** - * Include endpoint during the migration. At the end of the migration - * procedure this option let you migrate all your database endpoint to the - * upgraded instance. + * At the end of the migration procedure this option let you migrate all your + * database endpoint to the upgraded instance. */ withEndpoints: boolean } -/** User. */ -export interface User { +export type AddInstanceACLRulesRequest = { /** - * Name of the user (Length must be between 1 and 63 characters for PostgreSQL - * and between 1 and 32 characters for MySQL. First character must be an - * alphabet character (a-zA-Z). Your username cannot start with '_rdb' or in - * PostgreSQL, 'pg_'. Only a-zA-Z0-9_$- characters are accepted). + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Database Instance you want to add ACL rules to. */ + instanceId: string + /** ACL rules to add to the Database Instance. */ + rules: ACLRuleRequest[] +} + +export interface AddInstanceACLRulesResponse { + /** ACL Rules enabled for the Database Instance. */ + rules: ACLRule[] +} + +export type AddInstanceSettingsRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Database Instance you want to add settings to. */ + instanceId: string + /** Settings to add to the Database Instance. */ + settings: InstanceSetting[] +} + +export interface AddInstanceSettingsResponse { + /** Settings available on the Database Instance. */ + settings: InstanceSetting[] +} + +export type CloneInstanceRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. */ + region?: Region + /** UUID of the Database Instance you want to clone. */ + instanceId: string + /** Name of the Database Instance clone. */ name: string + /** Node type of the clone. */ + nodeType?: string +} + +export type CreateDatabaseBackupRequest = { /** - * Defines whether or not a user got administrative privileges on the Database - * Instance. + * Region to target. If none is passed will use default region from the + * config. */ - isAdmin: boolean + region?: Region + /** UUID of the Database Instance. */ + instanceId: string + /** Name of the database you want to back up. */ + databaseName: string + /** Name of the backup. */ + name?: string + /** Expiration date (must follow the ISO 8601 format). */ + expiresAt?: Date } -export interface Volume { - type: VolumeType - size: number - class: StorageClass +export type CreateDatabaseRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** UUID of the Database Instance where to create the database. */ + instanceId: string + /** Name of the database. */ + name: string } -export type ListDatabaseEnginesRequest = { +export type CreateEndpointRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Name of the database engine. */ + /** UUID of the Database Instance you to which you want to add an endpoint. */ + instanceId: string + /** Specification of the endpoint you want to create. */ + endpointSpec?: EndpointSpec +} + +export type CreateInstanceFromSnapshotRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Block snapshot of the Database Instance. */ + snapshotId: string + /** Name of the Database Instance created with the snapshot. */ + instanceName: string + /** + * Defines whether or not High-Availability is enabled on the new Database + * Instance. + */ + isHaCluster?: boolean + /** The node type used to restore the snapshot. */ + nodeType?: string +} + +export type CreateInstanceRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** + * @deprecated Please use project_id instead. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + organizationId?: string + /** + * The Project ID on which the Database Instance will be created. + * + * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * could be set. + */ + projectId?: string + /** Name of the Database Instance. */ name?: string - /** Version of the database engine. */ - version?: string - page?: number - pageSize?: number + /** Database engine of the Database Instance (PostgreSQL, MySQL, ...). */ + engine: string + /** Username created when the Database Instance is created. */ + userName: string + /** Password of the user. */ + password: string + /** Type of node to use for the Database Instance. */ + nodeType: string + /** Defines whether or not High-Availability is enabled. */ + isHaCluster: boolean + /** Defines whether or not backups are disabled. */ + disableBackup: boolean + /** Tags to apply to the Database Instance. */ + tags?: string[] + /** List of engine settings to be set upon Database Instance initialization. */ + initSettings?: InstanceSetting[] + /** Type of volume where data is stored (lssd, bssd, ...). */ + volumeType?: VolumeType + /** Volume size when volume_type is not lssd. */ + volumeSize: number + /** + * One or multiple EndpointSpec used to expose your Database Instance. A + * load_balancer public endpoint is systematically created. + */ + initEndpoints?: EndpointSpec[] + /** + * Defines whether to or not to store logical backups in the same region as + * the Database Instance. + */ + backupSameRegion: boolean } -export type ListNodeTypesRequest = { +export type CreateReadReplicaEndpointRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Defines whether or not to include disabled types. */ - includeDisabledTypes: boolean - page?: number - pageSize?: number + /** UUID of the Read Replica. */ + readReplicaId: string + /** Specification of the endpoint you want to create. */ + endpointSpec: ReadReplicaEndpointSpec[] } -export type ListDatabaseBackupsRequest = { +export type CreateReadReplicaRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Name of the database backups. */ - name?: string - /** Criteria to use when ordering database backups listing. */ - orderBy?: ListDatabaseBackupsRequestOrderBy - /** UUID of the Database Instance. */ - instanceId?: string - /** Organization ID of the Organization the database backups belong to. */ - organizationId?: string - /** Project ID of the Project the database backups belong to. */ - projectId?: string - page?: number - pageSize?: number + /** UUID of the Database Instance you want to create a Read Replica from. */ + instanceId: string + /** Specification of the endpoint you want to create. */ + endpointSpec?: ReadReplicaEndpointSpec[] + /** + * Defines whether to create the replica in the same availability zone as the + * main instance nodes or not. + */ + sameZone?: boolean } -export type CreateDatabaseBackupRequest = { +export type CreateSnapshotRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -844,279 +829,164 @@ export type CreateDatabaseBackupRequest = { region?: Region /** UUID of the Database Instance. */ instanceId: string - /** Name of the database you want to back up. */ - databaseName: string - /** Name of the backup. */ + /** Name of the snapshot. */ name?: string /** Expiration date (must follow the ISO 8601 format). */ expiresAt?: Date } -export type GetDatabaseBackupRequest = { +export type CreateUserRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the database backup. */ - databaseBackupId: string + /** UUID of the Database Instance in which you want to create a user. */ + instanceId: string + /** Name of the user you want to create. */ + name: string + /** Password of the user you want to create. */ + password: string + /** Defines whether the user will have administrative privileges. */ + isAdmin: boolean } -export type UpdateDatabaseBackupRequest = { +export type DeleteDatabaseBackupRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the database backup to update. */ + /** UUID of the database backup to delete. */ databaseBackupId: string - /** Name of the Database Backup. */ - name?: string - /** Expiration date (must follow the ISO 8601 format). */ - expiresAt?: Date } -export type DeleteDatabaseBackupRequest = { +export type DeleteDatabaseRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the database backup to delete. */ - databaseBackupId: string + /** UUID of the Database Instance where to delete the database. */ + instanceId: string + /** Name of the database to delete. */ + name: string } -export type RestoreDatabaseBackupRequest = { +export type DeleteEndpointRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Backup of a logical database. */ - databaseBackupId: string - /** - * Defines the destination database to restore into a specified database (the - * default destination is set to the origin database of the backup). - */ - databaseName?: string - /** Defines the Database Instance where the backup has to be restored. */ - instanceId: string + /** This endpoint can also be used to delete a Read Replica endpoint. */ + endpointId: string } -export type ExportDatabaseBackupRequest = { +export type DeleteInstanceACLRulesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the database backup you want to export. */ - databaseBackupId: string + /** UUID of the Database Instance you want to delete an ACL rule from. */ + instanceId: string + /** IP addresses defined in the ACL rules of the Database Instance. */ + aclRuleIps: string[] } -export type UpgradeInstanceRequest = { +export interface DeleteInstanceACLRulesResponse { + /** IP addresses defined in the ACL rules of the Database Instance. */ + rules: ACLRule[] +} + +export type DeleteInstanceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to upgrade. */ + /** UUID of the Database Instance to delete. */ instanceId: string - /** - * Node type of the Database Instance you want to upgrade to. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' - * could be set. - */ - nodeType?: string - /** - * Defines whether or not high availability should be enabled on the Database - * Instance. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' - * could be set. - */ - enableHa?: boolean - /** - * Increase your block storage volume size. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' - * could be set. - */ - volumeSize?: number - /** - * Change your Database Instance storage type. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' - * could be set. - */ - volumeType?: VolumeType - /** - * Update your database engine to a newer version. This will create a new - * Database Instance with same specifications as the current one and perform a - * Database Engine upgrade. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' - * could be set. - */ - upgradableVersionId?: string - /** - * Upgrade your database engine to a new major version including instance - * endpoints. - * - * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' - * could be set. - */ - majorUpgradeWorkflow?: UpgradeInstanceRequestMajorUpgradeWorkflow } -export type ListInstancesRequest = { +export type DeleteInstanceSettingsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** List Database Instances that have a given tag. */ - tags?: string[] - /** Lists Database Instances that match a name pattern. */ - name?: string - /** Criteria to use when ordering Database Instance listings. */ - orderBy?: ListInstancesRequestOrderBy - /** Please use project_id instead. */ - organizationId?: string - /** Project ID to list the Database Instance of. */ - projectId?: string - page?: number - pageSize?: number + /** UUID of the Database Instance to delete settings from. */ + instanceId: string + /** Settings names to delete. */ + settingNames: string[] } -export type GetInstanceRequest = { +export interface DeleteInstanceSettingsResponse { + /** Settings names to delete from the Database Instance. */ + settings: InstanceSetting[] +} + +export type DeleteReadReplicaRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance. */ - instanceId: string + /** UUID of the Read Replica. */ + readReplicaId: string } -export type CreateInstanceRequest = { +export type DeleteSnapshotRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** - * @deprecated Please use project_id instead. - * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. - */ - organizationId?: string - /** - * The Project ID on which the Database Instance will be created. - * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' - * could be set. - */ - projectId?: string - /** Name of the Database Instance. */ - name?: string - /** Database engine of the Database Instance (PostgreSQL, MySQL, ...). */ - engine: string - /** Username created when the Database Instance is created. */ - userName: string - /** Password of the user. */ - password: string - /** Type of node to use for the Database Instance. */ - nodeType: string - /** Defines whether or not High-Availability is enabled. */ - isHaCluster: boolean - /** Defines whether or not backups are disabled. */ - disableBackup: boolean - /** Tags to apply to the Database Instance. */ - tags?: string[] - /** List of engine settings to be set upon Database Instance initialization. */ - initSettings?: InstanceSetting[] - /** Type of volume where data is stored (lssd, bssd, ...). */ - volumeType?: VolumeType - /** Volume size when volume_type is not lssd. */ - volumeSize: number - /** - * One or multiple EndpointSpec used to expose your Database Instance. A - * load_balancer public endpoint is systematically created. - */ - initEndpoints?: EndpointSpec[] - /** - * Defines whether to or not to store logical backups in the same region as - * the Database Instance. - */ - backupSameRegion: boolean + /** UUID of the snapshot to delete. */ + snapshotId: string } -export type UpdateInstanceRequest = { +export type DeleteUserRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance to update. */ + /** UUID of the Database Instance to delete the user from. */ instanceId: string - /** In hours. */ - backupScheduleFrequency?: number - /** In days. */ - backupScheduleRetention?: number - /** Defines whether or not the backup schedule is disabled. */ - isBackupScheduleDisabled?: boolean - /** Name of the Database Instance. */ - name?: string - /** Tags of a Database Instance. */ - tags?: string[] - /** Logs policy of the Database Instance. */ - logsPolicy?: LogsPolicy - /** Store logical backups in the same region as the Database Instance. */ - backupSameRegion?: boolean - /** Defines the start time of the autobackup. */ - backupScheduleStartHour?: number + /** Name of the user. */ + name: string } -export type DeleteInstanceRequest = { +export type ExportDatabaseBackupRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance to delete. */ - instanceId: string + /** UUID of the database backup you want to export. */ + databaseBackupId: string } -export type CloneInstanceRequest = { +export type GetDatabaseBackupRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to clone. */ - instanceId: string - /** Name of the Database Instance clone. */ - name: string - /** Node type of the clone. */ - nodeType?: string + /** UUID of the database backup. */ + databaseBackupId: string } -export type RestartInstanceRequest = { +export type GetEndpointRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to restart. */ - instanceId: string + /** UUID of the endpoint you want to get. */ + endpointId: string } export type GetInstanceCertificateRequest = { @@ -1129,14 +999,14 @@ export type GetInstanceCertificateRequest = { instanceId: string } -export type RenewInstanceCertificateRequest = { +export type GetInstanceLogRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want logs of. */ - instanceId: string + /** UUID of the instance_log you want. */ + instanceLogId: string } export type GetInstanceMetricsRequest = { @@ -1155,21 +1025,14 @@ export type GetInstanceMetricsRequest = { metricName?: string } -export type CreateReadReplicaRequest = { +export type GetInstanceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to create a Read Replica from. */ + /** UUID of the Database Instance. */ instanceId: string - /** Specification of the endpoint you want to create. */ - endpointSpec?: ReadReplicaEndpointSpec[] - /** - * Defines whether to create the replica in the same availability zone as the - * main instance nodes or not. - */ - sameZone?: boolean } export type GetReadReplicaRequest = { @@ -1182,63 +1045,116 @@ export type GetReadReplicaRequest = { readReplicaId: string } -export type DeleteReadReplicaRequest = { +export type GetSnapshotRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Read Replica. */ - readReplicaId: string + /** UUID of the snapshot. */ + snapshotId: string } -export type ResetReadReplicaRequest = { +export interface InstanceMetrics { + /** Time series of metrics of a Database Instance. */ + timeseries: TimeSeries[] +} + +export type ListDatabaseBackupsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Read Replica. */ - readReplicaId: string + /** Name of the database backups. */ + name?: string + /** Criteria to use when ordering database backups listing. */ + orderBy?: ListDatabaseBackupsRequestOrderBy + /** UUID of the Database Instance. */ + instanceId?: string + /** Organization ID of the Organization the database backups belong to. */ + organizationId?: string + /** Project ID of the Project the database backups belong to. */ + projectId?: string + page?: number + pageSize?: number } -export type PromoteReadReplicaRequest = { +export interface ListDatabaseBackupsResponse { + /** List of database backups. */ + databaseBackups: DatabaseBackup[] + /** Total count of database backups available. */ + totalCount: number +} + +export type ListDatabaseEnginesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Read Replica. */ - readReplicaId: string + /** Name of the database engine. */ + name?: string + /** Version of the database engine. */ + version?: string + page?: number + pageSize?: number } -export type CreateReadReplicaEndpointRequest = { +export interface ListDatabaseEnginesResponse { + /** List of the available database engines. */ + engines: DatabaseEngine[] + /** Total count of database engines available. */ + totalCount: number +} + +export type ListDatabasesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Read Replica. */ - readReplicaId: string - /** Specification of the endpoint you want to create. */ - endpointSpec: ReadReplicaEndpointSpec[] + /** UUID of the Database Instance to list the databases of. */ + instanceId: string + /** Name of the database. */ + name?: string + /** Defines whether or not the database is managed. */ + managed?: boolean + /** User that owns this database. */ + owner?: string + /** Criteria to use when ordering database listing. */ + orderBy?: ListDatabasesRequestOrderBy + page?: number + pageSize?: number } -export type PrepareInstanceLogsRequest = { +export interface ListDatabasesResponse { + /** List of the databases. */ + databases: Database[] + /** Total count of databases present on a Database Instance. */ + totalCount: number +} + +export type ListInstanceACLRulesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want logs of. */ + /** UUID of the Database Instance. */ instanceId: string - /** Start datetime of your log. (RFC 3339 format). */ - startDate?: Date - /** End datetime of your log. (RFC 3339 format). */ - endDate?: Date + page?: number + pageSize?: number } -export type ListInstanceLogsRequest = { +export interface ListInstanceACLRulesResponse { + /** List of ACL rules present on a Database Instance. */ + rules: ACLRule[] + /** Total count of ACL rules present on a Database Instance. */ + totalCount: number +} + +export type ListInstanceLogsDetailsRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -1246,21 +1162,14 @@ export type ListInstanceLogsRequest = { region?: Region /** UUID of the Database Instance you want logs of. */ instanceId: string - /** Criteria to use when ordering Database Instance logs listing. */ - orderBy?: ListInstanceLogsRequestOrderBy } -export type GetInstanceLogRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the instance_log you want. */ - instanceLogId: string +export interface ListInstanceLogsDetailsResponse { + /** Remote Database Instance logs details. */ + details: ListInstanceLogsDetailsResponseInstanceLogDetail[] } -export type PurgeInstanceLogsRequest = { +export type ListInstanceLogsRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -1268,57 +1177,114 @@ export type PurgeInstanceLogsRequest = { region?: Region /** UUID of the Database Instance you want logs of. */ instanceId: string - /** Given log name to purge. */ - logName?: string + /** Criteria to use when ordering Database Instance logs listing. */ + orderBy?: ListInstanceLogsRequestOrderBy } -export type ListInstanceLogsDetailsRequest = { +export interface ListInstanceLogsResponse { + /** Available logs in a Database Instance. */ + instanceLogs: InstanceLog[] +} + +export type ListInstancesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want logs of. */ - instanceId: string + /** List Database Instances that have a given tag. */ + tags?: string[] + /** Lists Database Instances that match a name pattern. */ + name?: string + /** Criteria to use when ordering Database Instance listings. */ + orderBy?: ListInstancesRequestOrderBy + /** Please use project_id instead. */ + organizationId?: string + /** Project ID to list the Database Instance of. */ + projectId?: string + page?: number + pageSize?: number } -export type AddInstanceSettingsRequest = { +export interface ListInstancesResponse { + /** List of all Database Instances available in an Organization or Project. */ + instances: Instance[] + /** Total count of Database Instances available in a Organization or Project. */ + totalCount: number +} + +export type ListNodeTypesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to add settings to. */ - instanceId: string - /** Settings to add to the Database Instance. */ - settings: InstanceSetting[] + /** Defines whether or not to include disabled types. */ + includeDisabledTypes: boolean + page?: number + pageSize?: number } -export type DeleteInstanceSettingsRequest = { +export interface ListNodeTypesResponse { + /** Types of the node. */ + nodeTypes: NodeType[] + /** Total count of node-types available. */ + totalCount: number +} + +export type ListPrivilegesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance to delete settings from. */ + /** UUID of the Database Instance. */ instanceId: string - /** Settings names to delete. */ - settingNames: string[] + /** Criteria to use when ordering privileges listing. */ + orderBy?: ListPrivilegesRequestOrderBy + page?: number + pageSize?: number + /** Name of the database. */ + databaseName?: string + /** Name of the user. */ + userName?: string } -export type SetInstanceSettingsRequest = { +export interface ListPrivilegesResponse { + /** Privileges of a user in a database in a Database Instance. */ + privileges: Privilege[] + /** Total count of privileges present on a database. */ + totalCount: number +} + +export type ListSnapshotsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance where the settings must be set. */ - instanceId: string - /** Settings to define for the Database Instance. */ - settings: InstanceSetting[] + /** Name of the snapshot. */ + name?: string + /** Criteria to use when ordering snapshot listing. */ + orderBy?: ListSnapshotsRequestOrderBy + /** UUID of the Database Instance. */ + instanceId?: string + /** Organization ID the snapshots belongs to. */ + organizationId?: string + /** Project ID the snapshots belongs to. */ + projectId?: string + page?: number + pageSize?: number } -export type ListInstanceACLRulesRequest = { +export interface ListSnapshotsResponse { + /** List of snapshots. */ + snapshots: Snapshot[] + /** Total count of snapshots available. */ + totalCount: number +} + +export type ListUsersRequest = { /** * Region to target. If none is passed will use default region from the * config. @@ -1326,166 +1292,153 @@ export type ListInstanceACLRulesRequest = { region?: Region /** UUID of the Database Instance. */ instanceId: string + /** Name of the user. */ + name?: string + /** Criteria to use when requesting user listing. */ + orderBy?: ListUsersRequestOrderBy page?: number pageSize?: number } -export type AddInstanceACLRulesRequest = { +export interface ListUsersResponse { + /** List of users in a Database Instance. */ + users: User[] + /** Total count of users present on a Database Instance. */ + totalCount: number +} + +export type MigrateEndpointRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to add ACL rules to. */ + /** UUID of the endpoint you want to migrate. */ + endpointId: string + /** UUID of the instance you want to attach the endpoint to. */ instanceId: string - /** ACL rules to add to the Database Instance. */ - rules: ACLRuleRequest[] } -export type SetInstanceACLRulesRequest = { +export type PrepareInstanceLogsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance where the ACL rules must be set. */ + /** UUID of the Database Instance you want logs of. */ instanceId: string - /** ACL rules to define for the Database Instance. */ - rules: ACLRuleRequest[] + /** Start datetime of your log. (RFC 3339 format). */ + startDate?: Date + /** End datetime of your log. (RFC 3339 format). */ + endDate?: Date +} + +export interface PrepareInstanceLogsResponse { + /** Instance logs for a Database Instance between a start and an end date. */ + instanceLogs: InstanceLog[] } -export type DeleteInstanceACLRulesRequest = { +export type PromoteReadReplicaRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance you want to delete an ACL rule from. */ - instanceId: string - /** IP addresses defined in the ACL rules of the Database Instance. */ - aclRuleIps: string[] + /** UUID of the Read Replica. */ + readReplicaId: string } -export type ListUsersRequest = { +export type PurgeInstanceLogsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance. */ + /** UUID of the Database Instance you want logs of. */ instanceId: string - /** Name of the user. */ - name?: string - /** Criteria to use when requesting user listing. */ - orderBy?: ListUsersRequestOrderBy - page?: number - pageSize?: number + /** Given log name to purge. */ + logName?: string } -export type CreateUserRequest = { +export type RenewInstanceCertificateRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance in which you want to create a user. */ + /** UUID of the Database Instance you want logs of. */ instanceId: string - /** Name of the user you want to create. */ - name: string - /** Password of the user you want to create. */ - password: string - /** Defines whether the user will have administrative privileges. */ - isAdmin: boolean } -export type UpdateUserRequest = { +export type ResetReadReplicaRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance the user belongs to. */ - instanceId: string - /** Name of the database user. */ - name: string - /** Password of the database user. */ - password?: string - /** Defines whether or not this user got administrative privileges. */ - isAdmin?: boolean + /** UUID of the Read Replica. */ + readReplicaId: string } -export type DeleteUserRequest = { +export type RestartInstanceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance to delete the user from. */ + /** UUID of the Database Instance you want to restart. */ instanceId: string - /** Name of the user. */ - name: string } -export type ListDatabasesRequest = { +export type RestoreDatabaseBackupRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance to list the databases of. */ - instanceId: string - /** Name of the database. */ - name?: string - /** Defines whether or not the database is managed. */ - managed?: boolean - /** User that owns this database. */ - owner?: string - /** Criteria to use when ordering database listing. */ - orderBy?: ListDatabasesRequestOrderBy - page?: number - pageSize?: number -} - -export type CreateDatabaseRequest = { + /** Backup of a logical database. */ + databaseBackupId: string /** - * Region to target. If none is passed will use default region from the - * config. + * Defines the destination database to restore into a specified database (the + * default destination is set to the origin database of the backup). */ - region?: Region - /** UUID of the Database Instance where to create the database. */ + databaseName?: string + /** Defines the Database Instance where the backup has to be restored. */ instanceId: string - /** Name of the database. */ - name: string } -export type DeleteDatabaseRequest = { +export type SetInstanceACLRulesRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance where to delete the database. */ + /** UUID of the Database Instance where the ACL rules must be set. */ instanceId: string - /** Name of the database to delete. */ - name: string + /** ACL rules to define for the Database Instance. */ + rules: ACLRuleRequest[] } -export type ListPrivilegesRequest = { +export interface SetInstanceACLRulesResponse { + /** ACLs rules configured for a Database Instance. */ + rules: ACLRule[] +} + +export type SetInstanceSettingsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance. */ + /** UUID of the Database Instance where the settings must be set. */ instanceId: string - /** Criteria to use when ordering privileges listing. */ - orderBy?: ListPrivilegesRequestOrderBy - page?: number - pageSize?: number - /** Name of the database. */ - databaseName?: string - /** Name of the user. */ - userName?: string + /** Settings to define for the Database Instance. */ + settings: InstanceSetting[] +} + +export interface SetInstanceSettingsResponse { + /** Settings configured for a Database Instance. */ + settings: InstanceSetting[] } export type SetPrivilegeRequest = { @@ -1504,48 +1457,44 @@ export type SetPrivilegeRequest = { permission?: Permission } -export type ListSnapshotsRequest = { +export type UpdateDatabaseBackupRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Name of the snapshot. */ + /** UUID of the database backup to update. */ + databaseBackupId: string + /** Name of the Database Backup. */ name?: string - /** Criteria to use when ordering snapshot listing. */ - orderBy?: ListSnapshotsRequestOrderBy - /** UUID of the Database Instance. */ - instanceId?: string - /** Organization ID the snapshots belongs to. */ - organizationId?: string - /** Project ID the snapshots belongs to. */ - projectId?: string - page?: number - pageSize?: number -} - -export type GetSnapshotRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** UUID of the snapshot. */ - snapshotId: string + /** Expiration date (must follow the ISO 8601 format). */ + expiresAt?: Date } -export type CreateSnapshotRequest = { +export type UpdateInstanceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the Database Instance. */ + /** UUID of the Database Instance to update. */ instanceId: string - /** Name of the snapshot. */ + /** In hours. */ + backupScheduleFrequency?: number + /** In days. */ + backupScheduleRetention?: number + /** Defines whether or not the backup schedule is disabled. */ + isBackupScheduleDisabled?: boolean + /** Name of the Database Instance. */ name?: string - /** Expiration date (must follow the ISO 8601 format). */ - expiresAt?: Date + /** Tags of a Database Instance. */ + tags?: string[] + /** Logs policy of the Database Instance. */ + logsPolicy?: LogsPolicy + /** Store logical backups in the same region as the Database Instance. */ + backupSameRegion?: boolean + /** Defines the start time of the autobackup. */ + backupScheduleStartHour?: number } export type UpdateSnapshotRequest = { @@ -1562,78 +1511,79 @@ export type UpdateSnapshotRequest = { expiresAt?: Date } -export type DeleteSnapshotRequest = { +export type UpdateUserRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** UUID of the snapshot to delete. */ - snapshotId: string + /** UUID of the Database Instance the user belongs to. */ + instanceId: string + /** Name of the database user. */ + name: string + /** Password of the database user. */ + password?: string + /** Defines whether or not this user got administrative privileges. */ + isAdmin?: boolean } -export type CreateInstanceFromSnapshotRequest = { +export type UpgradeInstanceRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Block snapshot of the Database Instance. */ - snapshotId: string - /** Name of the Database Instance created with the snapshot. */ - instanceName: string + /** UUID of the Database Instance you want to upgrade. */ + instanceId: string /** - * Defines whether or not High-Availability is enabled on the new Database - * Instance. + * Node type of the Database Instance you want to upgrade to. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' + * could be set. */ - isHaCluster?: boolean - /** The node type used to restore the snapshot. */ nodeType?: string -} - -export type CreateEndpointRequest = { /** - * Region to target. If none is passed will use default region from the - * config. + * Defines whether or not high availability should be enabled on the Database + * Instance. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' + * could be set. */ - region?: Region - /** UUID of the Database Instance you to which you want to add an endpoint. */ - instanceId: string - /** Specification of the endpoint you want to create. */ - endpointSpec?: EndpointSpec -} - -export type DeleteEndpointRequest = { + enableHa?: boolean /** - * Region to target. If none is passed will use default region from the - * config. + * Increase your block storage volume size. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' + * could be set. */ - region?: Region + volumeSize?: number /** - * UUID of the endpoint you want to delete. This endpoint can also be used to - * delete a Read Replica endpoint. + * Change your Database Instance storage type. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' + * could be set. */ - endpointId: string -} - -export type GetEndpointRequest = { + volumeType?: VolumeType /** - * Region to target. If none is passed will use default region from the - * config. + * This will create a new Database Instance with same specifications as the + * current one and perform a Database Engine upgrade. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' + * could be set. */ - region?: Region - /** UUID of the endpoint you want to get. */ - endpointId: string -} - -export type MigrateEndpointRequest = { + upgradableVersionId?: string /** - * Region to target. If none is passed will use default region from the - * config. + * Upgrade your database engine to a new major version including instance + * endpoints. + * + * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', + * 'volumeSize', 'volumeType', 'upgradableVersionId', 'majorUpgradeWorkflow' + * could be set. */ - region?: Region - /** UUID of the endpoint you want to migrate. */ - endpointId: string - /** UUID of the instance you want to attach the endpoint to. */ - instanceId: string + majorUpgradeWorkflow?: UpgradeInstanceRequestMajorUpgradeWorkflow } diff --git a/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts index 94ad5a7f9..d662ddf1c 100644 --- a/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts @@ -184,7 +184,7 @@ export const marshalCreateSecretRequest = ( defaults: DefaultValues, ): Record => ({ description: request.description, - ephemeral_action: request.ephemeralAction ?? 'unknown_ephemeral_action', + ephemeral_action: request.ephemeralAction, expires_at: request.expiresAt, name: request.name, path: request.path, diff --git a/packages/clients/src/api/secret/v1alpha1/types.gen.ts b/packages/clients/src/api/secret/v1alpha1/types.gen.ts index 54072d71a..03f3d0906 100644 --- a/packages/clients/src/api/secret/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/types.gen.ts @@ -119,15 +119,9 @@ export interface Secret { type: SecretType /** Location of the secret in the directory structure. */ path: string - /** - * Expiration date of the secret. (Optional.) Date on which the secret will be - * deleted or deactivated. - */ + /** (Optional.) Date on which the secret will be deleted or deactivated. */ expiresAt?: Date - /** - * Action to be taken when the secret expires. See `Secret.EphemeralAction` - * enum for description of values. - */ + /** See `Secret.EphemeralAction` enum for description of values. */ ephemeralAction: SecretEphemeralAction /** Region of the secret. */ region: Region @@ -248,10 +242,7 @@ export type CreateSecretRequest = { * specified, the path is `/`. */ path?: string - /** - * Expiration date of the secret. (Optional.) Date on which the secret will be - * deleted or deactivated. - */ + /** (Optional.) Date on which the secret will be deleted or deactivated. */ expiresAt?: Date /** Action to be taken when the secret expires. */ ephemeralAction?: SecretEphemeralAction diff --git a/packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts index aa149d7f5..e6982e5dd 100644 --- a/packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts @@ -25,7 +25,48 @@ import type { Statistics, } from './types.gen' -const unmarshalDomainReputation = (data: unknown) => { +const unmarshalEmailTry = (data: unknown): EmailTry => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'EmailTry' failed as data isn't a dictionary.`, + ) + } + + return { + code: data.code, + message: data.message, + rank: data.rank, + triedAt: unmarshalDate(data.tried_at), + } as EmailTry +} + +export const unmarshalEmail = (data: unknown): Email => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Email' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + flags: data.flags, + id: data.id, + lastTries: unmarshalArrayOfObject(data.last_tries, unmarshalEmailTry), + mailFrom: data.mail_from, + mailRcpt: data.mail_rcpt, + messageId: data.message_id, + projectId: data.project_id, + rcptTo: data.rcpt_to, + rcptType: data.rcpt_type, + status: data.status, + statusDetails: data.status_details, + subject: data.subject, + tryCount: data.try_count, + updatedAt: unmarshalDate(data.updated_at), + } as Email +} + +const unmarshalDomainReputation = (data: unknown): DomainReputation => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DomainReputation' failed as data isn't a dictionary.`, @@ -41,7 +82,7 @@ const unmarshalDomainReputation = (data: unknown) => { } as DomainReputation } -const unmarshalDomainStatistics = (data: unknown) => { +const unmarshalDomainStatistics = (data: unknown): DomainStatistics => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DomainStatistics' failed as data isn't a dictionary.`, @@ -56,22 +97,7 @@ const unmarshalDomainStatistics = (data: unknown) => { } as DomainStatistics } -const unmarshalEmailTry = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'EmailTry' failed as data isn't a dictionary.`, - ) - } - - return { - code: data.code, - message: data.message, - rank: data.rank, - triedAt: unmarshalDate(data.tried_at), - } as EmailTry -} - -export const unmarshalDomain = (data: unknown) => { +export const unmarshalDomain = (data: unknown): Domain => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Domain' failed as data isn't a dictionary.`, @@ -101,24 +127,26 @@ export const unmarshalDomain = (data: unknown) => { } as Domain } -const unmarshalDomainLastStatusDkimRecord = (data: unknown) => { +export const unmarshalCreateEmailResponse = ( + data: unknown, +): CreateEmailResponse => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DomainLastStatusDkimRecord' failed as data isn't a dictionary.`, + `Unmarshalling the type 'CreateEmailResponse' failed as data isn't a dictionary.`, ) } return { - error: data.error, - lastValidAt: unmarshalDate(data.last_valid_at), - status: data.status, - } as DomainLastStatusDkimRecord + emails: unmarshalArrayOfObject(data.emails, unmarshalEmail), + } as CreateEmailResponse } -const unmarshalDomainLastStatusSpfRecord = (data: unknown) => { +const unmarshalDomainLastStatusDkimRecord = ( + data: unknown, +): DomainLastStatusDkimRecord => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'DomainLastStatusSpfRecord' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainLastStatusDkimRecord' failed as data isn't a dictionary.`, ) } @@ -126,48 +154,26 @@ const unmarshalDomainLastStatusSpfRecord = (data: unknown) => { error: data.error, lastValidAt: unmarshalDate(data.last_valid_at), status: data.status, - } as DomainLastStatusSpfRecord + } as DomainLastStatusDkimRecord } -export const unmarshalEmail = (data: unknown) => { +const unmarshalDomainLastStatusSpfRecord = ( + data: unknown, +): DomainLastStatusSpfRecord => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Email' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainLastStatusSpfRecord' failed as data isn't a dictionary.`, ) } return { - createdAt: unmarshalDate(data.created_at), - flags: data.flags, - id: data.id, - lastTries: unmarshalArrayOfObject(data.last_tries, unmarshalEmailTry), - mailFrom: data.mail_from, - mailRcpt: data.mail_rcpt, - messageId: data.message_id, - projectId: data.project_id, - rcptTo: data.rcpt_to, - rcptType: data.rcpt_type, + error: data.error, + lastValidAt: unmarshalDate(data.last_valid_at), status: data.status, - statusDetails: data.status_details, - subject: data.subject, - tryCount: data.try_count, - updatedAt: unmarshalDate(data.updated_at), - } as Email -} - -export const unmarshalCreateEmailResponse = (data: unknown) => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'CreateEmailResponse' failed as data isn't a dictionary.`, - ) - } - - return { - emails: unmarshalArrayOfObject(data.emails, unmarshalEmail), - } as CreateEmailResponse + } as DomainLastStatusSpfRecord } -export const unmarshalDomainLastStatus = (data: unknown) => { +export const unmarshalDomainLastStatus = (data: unknown): DomainLastStatus => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DomainLastStatus' failed as data isn't a dictionary.`, @@ -186,7 +192,9 @@ export const unmarshalDomainLastStatus = (data: unknown) => { } as DomainLastStatus } -export const unmarshalListDomainsResponse = (data: unknown) => { +export const unmarshalListDomainsResponse = ( + data: unknown, +): ListDomainsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDomainsResponse' failed as data isn't a dictionary.`, @@ -199,7 +207,9 @@ export const unmarshalListDomainsResponse = (data: unknown) => { } as ListDomainsResponse } -export const unmarshalListEmailsResponse = (data: unknown) => { +export const unmarshalListEmailsResponse = ( + data: unknown, +): ListEmailsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListEmailsResponse' failed as data isn't a dictionary.`, @@ -212,7 +222,7 @@ export const unmarshalListEmailsResponse = (data: unknown) => { } as ListEmailsResponse } -export const unmarshalStatistics = (data: unknown) => { +export const unmarshalStatistics = (data: unknown): Statistics => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Statistics' failed as data isn't a dictionary.`, @@ -229,6 +239,15 @@ export const unmarshalStatistics = (data: unknown) => { } as Statistics } +export const marshalCreateDomainRequest = ( + request: CreateDomainRequest, + defaults: DefaultValues, +): Record => ({ + accept_tos: request.acceptTos, + domain_name: request.domainName, + project_id: request.projectId ?? defaults.defaultProjectId, +}) + const marshalCreateEmailRequestAddress = ( request: CreateEmailRequestAddress, defaults: DefaultValues, @@ -246,39 +265,35 @@ const marshalCreateEmailRequestAttachment = ( type: request.type, }) -export const marshalCreateDomainRequest = ( - request: CreateDomainRequest, - defaults: DefaultValues, -): Record => ({ - accept_tos: request.acceptTos, - domain_name: request.domainName, - project_id: request.projectId ?? defaults.defaultProjectId, -}) - export const marshalCreateEmailRequest = ( request: CreateEmailRequest, defaults: DefaultValues, ): Record => ({ - attachments: request.attachments - ? request.attachments.map(elt => - marshalCreateEmailRequestAttachment(elt, defaults), - ) - : undefined, - bcc: request.bcc - ? request.bcc.map(elt => marshalCreateEmailRequestAddress(elt, defaults)) - : undefined, - cc: request.cc - ? request.cc.map(elt => marshalCreateEmailRequestAddress(elt, defaults)) - : undefined, - from: request.from - ? marshalCreateEmailRequestAddress(request.from, defaults) - : undefined, + attachments: + request.attachments !== undefined + ? request.attachments.map(elt => + marshalCreateEmailRequestAttachment(elt, defaults), + ) + : undefined, + bcc: + request.bcc !== undefined + ? request.bcc.map(elt => marshalCreateEmailRequestAddress(elt, defaults)) + : undefined, + cc: + request.cc !== undefined + ? request.cc.map(elt => marshalCreateEmailRequestAddress(elt, defaults)) + : undefined, + from: + request.from !== undefined + ? marshalCreateEmailRequestAddress(request.from, defaults) + : undefined, html: request.html, project_id: request.projectId ?? defaults.defaultProjectId, send_before: request.sendBefore, subject: request.subject, text: request.text, - to: request.to - ? request.to.map(elt => marshalCreateEmailRequestAddress(elt, defaults)) - : undefined, + to: + request.to !== undefined + ? request.to.map(elt => marshalCreateEmailRequestAddress(elt, defaults)) + : undefined, }) diff --git a/packages/clients/src/api/tem/v1alpha1/types.gen.ts b/packages/clients/src/api/tem/v1alpha1/types.gen.ts index 997ddfe9c..2b6dce10f 100644 --- a/packages/clients/src/api/tem/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/tem/v1alpha1/types.gen.ts @@ -58,99 +58,23 @@ export type ListEmailsRequestOrderBy = | 'subject_desc' | 'subject_asc' -/** Create email request. address. */ -export interface CreateEmailRequestAddress { - /** Email address. */ - email: string - /** (Optional) Name displayed. */ - name?: string -} - -/** Create email request. attachment. */ -export interface CreateEmailRequestAttachment { - /** Filename of the attachment. */ - name: string - /** MIME type of the attachment. */ - type: string - /** Content of the attachment encoded in base64. */ - content: string -} - -/** Create email response. */ -export interface CreateEmailResponse { - /** Single page of emails matching the requested criteria. */ - emails: Email[] -} - -/** Domain. */ -export interface Domain { - /** ID of the domain. */ - id: string - /** ID of the domain's Organization. */ - organizationId: string - /** ID of the domain's Project. */ - projectId: string - /** Domain name (example.com). */ - name: string - /** Status of the domain. */ - status: DomainStatus - /** Date and time of domain creation. */ - createdAt?: Date - /** Date and time of the next scheduled check. */ - nextCheckAt?: Date - /** Date and time the domain was last valid. */ - lastValidAt?: Date - /** Date and time of the domain's deletion. */ - revokedAt?: Date - /** @deprecated Error message returned if the last check failed. */ - lastError?: string - /** Snippet of the SPF record to register in the DNS zone. */ - spfConfig: string - /** DKIM public key to record in the DNS zone. */ - dkimConfig: string - /** Domain's statistics. */ - statistics?: DomainStatistics +export interface EmailTry { + /** Rank number of this attempt to send the email. */ + rank: number + /** Date of the attempt to send the email. */ + triedAt?: Date /** - * The domain's reputation is available when your domain is checked and has - * sent enough emails. + * The SMTP status code received after the attempt. 0 if the attempt did not + * reach an SMTP server. */ - reputation?: DomainReputation - region: Region -} - -/** Domain last status. */ -export interface DomainLastStatus { - /** The ID of the domain. */ - domainId: string - /** The domain name (example.com). */ - domainName: string - /** The SPF record verification data. */ - spfRecord?: DomainLastStatusSpfRecord - /** The DKIM record verification data. */ - dkimRecord?: DomainLastStatusDkimRecord -} - -/** Domain last status. dkim record. */ -export interface DomainLastStatusDkimRecord { - /** Status of the DKIM record's configuration. */ - status: DomainLastStatusRecordStatus - /** Time and date the DKIM record was last valid. */ - lastValidAt?: Date - /** An error text displays in case the record is not valid. */ - error?: string -} - -/** Domain last status. spf record. */ -export interface DomainLastStatusSpfRecord { - /** Status of the SPF record's configuration. */ - status: DomainLastStatusRecordStatus - /** Time and date the SPF record was last valid. */ - lastValidAt?: Date - /** An error text displays in case the record is not valid. */ - error?: string + code: number + /** + * The SMTP message received. If the attempt did not reach an SMTP server, the + * message returned explains what happened. + */ + message: string } -/** Domain. reputation. */ export interface DomainReputation { /** Status of your domain's reputation. */ status: DomainReputationStatus @@ -175,7 +99,22 @@ export interface DomainStatistics { canceledCount: number } -/** Email. */ +export interface CreateEmailRequestAddress { + /** Email address. */ + email: string + /** (Optional) Name displayed. */ + name?: string +} + +export interface CreateEmailRequestAttachment { + /** Filename of the attachment. */ + name: string + /** MIME type of the attachment. */ + type: string + /** Content of the attachment encoded in base64. */ + content: string +} + export interface Email { /** Technical ID of the email. */ id: string @@ -212,68 +151,95 @@ export interface Email { flags: EmailFlag[] } -/** Email. try. */ -export interface EmailTry { - /** Rank number of this attempt to send the email. */ - rank: number - /** Date of the attempt to send the email. */ - triedAt?: Date - /** - * The SMTP status code received after the attempt. 0 if the attempt did not - * reach an SMTP server. - */ - code: number - /** - * The SMTP message received. If the attempt did not reach an SMTP server, the - * message returned explains what happened. - */ - message: string -} - -/** List domains response. */ -export interface ListDomainsResponse { - /** Number of domains that match the request (without pagination). */ - totalCount: number - domains: Domain[] +export interface DomainLastStatusDkimRecord { + /** Status of the DKIM record's configuration. */ + status: DomainLastStatusRecordStatus + /** Time and date the DKIM record was last valid. */ + lastValidAt?: Date + /** An error text displays in case the record is not valid. */ + error?: string } -/** List emails response. */ -export interface ListEmailsResponse { - /** Number of emails matching the requested criteria. */ - totalCount: number - /** Single page of emails matching the requested criteria. */ - emails: Email[] +export interface DomainLastStatusSpfRecord { + /** Status of the SPF record's configuration. */ + status: DomainLastStatusRecordStatus + /** Time and date the SPF record was last valid. */ + lastValidAt?: Date + /** An error text displays in case the record is not valid. */ + error?: string } -/** Statistics. */ -export interface Statistics { - /** Total number of emails matching the requested criteria. */ - totalCount: number +export interface Domain { + /** ID of the domain. */ + id: string + /** ID of the domain's Organization. */ + organizationId: string + /** ID of the domain's Project. */ + projectId: string + /** Domain name (example.com). */ + name: string + /** Status of the domain. */ + status: DomainStatus + /** Date and time of domain creation. */ + createdAt?: Date + /** Date and time of the next scheduled check. */ + nextCheckAt?: Date + /** Date and time the domain was last valid. */ + lastValidAt?: Date + /** Date and time of the domain's deletion. */ + revokedAt?: Date + /** @deprecated Error message returned if the last check failed. */ + lastError?: string + /** Snippet of the SPF record to register in the DNS zone. */ + spfConfig: string + /** DKIM public key to record in the DNS zone. */ + dkimConfig: string + /** Domain's statistics. */ + statistics?: DomainStatistics /** - * Number of emails still in the `new` transient state. This means emails - * received from the API but not yet processed. + * The domain's reputation is available when your domain is checked and has + * sent enough emails. */ - newCount: number + reputation?: DomainReputation /** - * Number of emails still in the `sending` transient state. This means emails - * received from the API but not yet in their final status. + * Region to target. If none is passed will use default region from the + * config. */ - sendingCount: number + region: Region +} + +export type CancelEmailRequest = { /** - * Number of emails in the final `sent` state. This means emails that have - * been delivered to the target mail system. + * Region to target. If none is passed will use default region from the + * config. */ - sentCount: number + region?: Region + /** ID of the email to cancel. */ + emailId: string +} + +export type CheckDomainRequest = { /** - * Number of emails in the final `failed` state. This means emails that have - * been refused by the target mail system with a final error status. + * Region to target. If none is passed will use default region from the + * config. */ - failedCount: number + region?: Region + /** ID of the domain to check. */ + domainId: string +} + +export type CreateDomainRequest = { /** - * Number of emails in the final `canceled` state. This means emails that have - * been canceled upon request. + * Region to target. If none is passed will use default region from the + * config. */ - canceledCount: number + region?: Region + /** ID of the project to which the domain belongs. */ + projectId?: string + /** Fully qualified domain dame. */ + domainName: string + /** Accept Scaleway's Terms of Service. */ + acceptTos: boolean } export type CreateEmailRequest = { @@ -304,50 +270,50 @@ export type CreateEmailRequest = { sendBefore?: Date } -export type GetEmailRequest = { +export interface CreateEmailResponse { + /** Single page of emails matching the requested criteria. */ + emails: Email[] +} + +export interface DomainLastStatus { + /** The ID of the domain. */ + domainId: string + /** The domain name (example.com). */ + domainName: string + /** The SPF record verification data. */ + spfRecord?: DomainLastStatusSpfRecord + /** The DKIM record verification data. */ + dkimRecord?: DomainLastStatusDkimRecord +} + +export type GetDomainLastStatusRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the email to retrieve. */ - emailId: string + /** ID of the domain to delete. */ + domainId: string } -export type ListEmailsRequest = { +export type GetDomainRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - page?: number - pageSize?: number - /** (Optional) ID of the Project in which to list the emails. */ - projectId?: string - /** (Optional) ID of the domain for which to list the emails. */ - domainId?: string - /** (Optional) ID of the message for which to list the emails. */ - messageId?: string - /** (Optional) List emails created after this date. */ - since?: Date - /** (Optional) List emails created before this date. */ - until?: Date - /** (Optional) List emails sent with this sender's email address. */ - mailFrom?: string - /** @deprecated List emails sent to this recipient's email address. */ - mailTo?: string - /** (Optional) List emails sent to this recipient's email address. */ - mailRcpt?: string - /** (Optional) List emails with any of these statuses. */ - statuses?: EmailStatus[] - /** (Optional) List emails with this subject. */ - subject?: string - /** (Optional) List emails by searching to all fields. */ - search?: string - /** (Optional) List emails corresponding to specific criteria. */ - orderBy?: ListEmailsRequestOrderBy - /** (Optional) List emails containing only specific flags. */ - flags?: EmailFlag[] + /** ID of the domain. */ + domainId: string +} + +export type GetEmailRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** ID of the email to retrieve. */ + emailId: string } export type GetStatisticsRequest = { @@ -371,54 +337,69 @@ export type GetStatisticsRequest = { mailFrom?: string } -export type CancelEmailRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** ID of the email to cancel. */ - emailId: string -} - -export type CreateDomainRequest = { +export type ListDomainsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** ID of the project to which the domain belongs. */ + /** Requested page number. Value must be greater or equal to 1. */ + page?: number + /** Page size. */ + pageSize?: number projectId?: string - /** Fully qualified domain dame. */ - domainName: string - /** Accept Scaleway's Terms of Service. */ - acceptTos: boolean + status?: DomainStatus[] + organizationId?: string + name?: string } -export type GetDomainRequest = { - /** - * Region to target. If none is passed will use default region from the - * config. - */ - region?: Region - /** ID of the domain. */ - domainId: string +export interface ListDomainsResponse { + /** Number of domains that match the request (without pagination). */ + totalCount: number + domains: Domain[] } -export type ListDomainsRequest = { +export type ListEmailsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - /** Requested page number. Value must be greater or equal to 1. */ page?: number - /** Page size. */ pageSize?: number + /** (Optional) ID of the Project in which to list the emails. */ projectId?: string - status?: DomainStatus[] - organizationId?: string - name?: string + /** (Optional) ID of the domain for which to list the emails. */ + domainId?: string + /** (Optional) ID of the message for which to list the emails. */ + messageId?: string + /** (Optional) List emails created after this date. */ + since?: Date + /** (Optional) List emails created before this date. */ + until?: Date + /** (Optional) List emails sent with this sender's email address. */ + mailFrom?: string + /** @deprecated List emails sent to this recipient's email address. */ + mailTo?: string + /** (Optional) List emails sent to this recipient's email address. */ + mailRcpt?: string + /** (Optional) List emails with any of these statuses. */ + statuses?: EmailStatus[] + /** (Optional) List emails with this subject. */ + subject?: string + /** (Optional) List emails by searching to all fields. */ + search?: string + /** (Optional) List emails corresponding to specific criteria. */ + orderBy?: ListEmailsRequestOrderBy + /** (Optional) List emails containing only specific flags. */ + flags?: EmailFlag[] +} + +export interface ListEmailsResponse { + /** Number of emails matching the requested criteria. */ + totalCount: number + /** Single page of emails matching the requested criteria. */ + emails: Email[] } export type RevokeDomainRequest = { @@ -431,22 +412,32 @@ export type RevokeDomainRequest = { domainId: string } -export type CheckDomainRequest = { +export interface Statistics { + /** Total number of emails matching the requested criteria. */ + totalCount: number /** - * Region to target. If none is passed will use default region from the - * config. + * Number of emails still in the `new` transient state. This means emails + * received from the API but not yet processed. */ - region?: Region - /** ID of the domain to check. */ - domainId: string -} - -export type GetDomainLastStatusRequest = { + newCount: number /** - * Region to target. If none is passed will use default region from the - * config. + * Number of emails still in the `sending` transient state. This means emails + * received from the API but not yet in their final status. */ - region?: Region - /** ID of the domain to delete. */ - domainId: string + sendingCount: number + /** + * Number of emails in the final `sent` state. This means emails that have + * been delivered to the target mail system. + */ + sentCount: number + /** + * Number of emails in the final `failed` state. This means emails that have + * been refused by the target mail system with a final error status. + */ + failedCount: number + /** + * Number of emails in the final `canceled` state. This means emails that have + * been canceled upon request. + */ + canceledCount: number } diff --git a/packages/clients/src/api/vpcgw/v1/marshalling.gen.ts b/packages/clients/src/api/vpcgw/v1/marshalling.gen.ts index 2973a824d..f4190e04e 100644 --- a/packages/clients/src/api/vpcgw/v1/marshalling.gen.ts +++ b/packages/clients/src/api/vpcgw/v1/marshalling.gen.ts @@ -46,7 +46,7 @@ import type { UpdatePATRuleRequest, } from './types.gen' -export const unmarshalDHCP = (data: unknown) => { +export const unmarshalDHCP = (data: unknown): DHCP => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DHCP' failed as data isn't a dictionary.`, @@ -76,7 +76,7 @@ export const unmarshalDHCP = (data: unknown) => { } as DHCP } -const unmarshalIpamConfig = (data: unknown) => { +const unmarshalIpamConfig = (data: unknown): IpamConfig => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'IpamConfig' failed as data isn't a dictionary.`, @@ -89,7 +89,7 @@ const unmarshalIpamConfig = (data: unknown) => { } as IpamConfig } -export const unmarshalGatewayNetwork = (data: unknown) => { +export const unmarshalGatewayNetwork = (data: unknown): GatewayNetwork => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'GatewayNetwork' failed as data isn't a dictionary.`, @@ -115,21 +115,7 @@ export const unmarshalGatewayNetwork = (data: unknown) => { } as GatewayNetwork } -const unmarshalGatewayType = (data: unknown) => { - 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 unmarshalIP = (data: unknown) => { +export const unmarshalIP = (data: unknown): IP => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'IP' failed as data isn't a dictionary.`, @@ -150,7 +136,7 @@ export const unmarshalIP = (data: unknown) => { } as IP } -export const unmarshalDHCPEntry = (data: unknown) => { +export const unmarshalDHCPEntry = (data: unknown): DHCPEntry => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'DHCPEntry' failed as data isn't a dictionary.`, @@ -170,7 +156,21 @@ export const unmarshalDHCPEntry = (data: unknown) => { } as DHCPEntry } -export const unmarshalGateway = (data: unknown) => { +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 unmarshalGateway = (data: unknown): Gateway => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'Gateway' failed as data isn't a dictionary.`, @@ -203,7 +203,7 @@ export const unmarshalGateway = (data: unknown) => { } as Gateway } -export const unmarshalPATRule = (data: unknown) => { +export const unmarshalPATRule = (data: unknown): PATRule => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'PATRule' failed as data isn't a dictionary.`, @@ -223,7 +223,9 @@ export const unmarshalPATRule = (data: unknown) => { } as PATRule } -export const unmarshalListDHCPEntriesResponse = (data: unknown) => { +export const unmarshalListDHCPEntriesResponse = ( + data: unknown, +): ListDHCPEntriesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDHCPEntriesResponse' failed as data isn't a dictionary.`, @@ -236,7 +238,9 @@ export const unmarshalListDHCPEntriesResponse = (data: unknown) => { } as ListDHCPEntriesResponse } -export const unmarshalListDHCPsResponse = (data: unknown) => { +export const unmarshalListDHCPsResponse = ( + data: unknown, +): ListDHCPsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListDHCPsResponse' failed as data isn't a dictionary.`, @@ -249,7 +253,9 @@ export const unmarshalListDHCPsResponse = (data: unknown) => { } as ListDHCPsResponse } -export const unmarshalListGatewayNetworksResponse = (data: unknown) => { +export const unmarshalListGatewayNetworksResponse = ( + data: unknown, +): ListGatewayNetworksResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListGatewayNetworksResponse' failed as data isn't a dictionary.`, @@ -265,7 +271,9 @@ export const unmarshalListGatewayNetworksResponse = (data: unknown) => { } as ListGatewayNetworksResponse } -export const unmarshalListGatewayTypesResponse = (data: unknown) => { +export const unmarshalListGatewayTypesResponse = ( + data: unknown, +): ListGatewayTypesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListGatewayTypesResponse' failed as data isn't a dictionary.`, @@ -277,7 +285,9 @@ export const unmarshalListGatewayTypesResponse = (data: unknown) => { } as ListGatewayTypesResponse } -export const unmarshalListGatewaysResponse = (data: unknown) => { +export const unmarshalListGatewaysResponse = ( + data: unknown, +): ListGatewaysResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListGatewaysResponse' failed as data isn't a dictionary.`, @@ -290,7 +300,7 @@ export const unmarshalListGatewaysResponse = (data: unknown) => { } as ListGatewaysResponse } -export const unmarshalListIPsResponse = (data: unknown) => { +export const unmarshalListIPsResponse = (data: unknown): ListIPsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`, @@ -303,7 +313,9 @@ export const unmarshalListIPsResponse = (data: unknown) => { } as ListIPsResponse } -export const unmarshalListPATRulesResponse = (data: unknown) => { +export const unmarshalListPATRulesResponse = ( + data: unknown, +): ListPATRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListPATRulesResponse' failed as data isn't a dictionary.`, @@ -316,7 +328,9 @@ export const unmarshalListPATRulesResponse = (data: unknown) => { } as ListPATRulesResponse } -export const unmarshalSetDHCPEntriesResponse = (data: unknown) => { +export const unmarshalSetDHCPEntriesResponse = ( + data: unknown, +): SetDHCPEntriesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetDHCPEntriesResponse' failed as data isn't a dictionary.`, @@ -328,7 +342,9 @@ export const unmarshalSetDHCPEntriesResponse = (data: unknown) => { } as SetDHCPEntriesResponse } -export const unmarshalSetPATRulesResponse = (data: unknown) => { +export const unmarshalSetPATRulesResponse = ( + data: unknown, +): SetPATRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'SetPATRulesResponse' failed as data isn't a dictionary.`, @@ -360,49 +376,23 @@ export const marshalCreateDHCPRequest = ( valid_lifetime: request.validLifetime, }) -const marshalCreateGatewayNetworkRequestIpamConfig = ( - request: CreateGatewayNetworkRequestIpamConfig, - defaults: DefaultValues, -): Record => ({ - ipam_ip_id: request.ipamIpId, - push_default_route: request.pushDefaultRoute, -}) - -const marshalSetDHCPEntriesRequestEntry = ( - request: SetDHCPEntriesRequestEntry, +export const marshalCreateDHCPEntryRequest = ( + request: CreateDHCPEntryRequest, defaults: DefaultValues, ): Record => ({ + gateway_network_id: request.gatewayNetworkId, ip_address: request.ipAddress, mac_address: request.macAddress, }) -const marshalSetPATRulesRequestRule = ( - request: SetPATRulesRequestRule, - defaults: DefaultValues, -): Record => ({ - private_ip: request.privateIp, - private_port: request.privatePort, - protocol: request.protocol, - public_port: request.publicPort, -}) - -const marshalUpdateGatewayNetworkRequestIpamConfig = ( - request: UpdateGatewayNetworkRequestIpamConfig, +const marshalCreateGatewayNetworkRequestIpamConfig = ( + request: CreateGatewayNetworkRequestIpamConfig, defaults: DefaultValues, ): Record => ({ ipam_ip_id: request.ipamIpId, push_default_route: request.pushDefaultRoute, }) -export const marshalCreateDHCPEntryRequest = ( - request: CreateDHCPEntryRequest, - defaults: DefaultValues, -): Record => ({ - gateway_network_id: request.gatewayNetworkId, - ip_address: request.ipAddress, - mac_address: request.macAddress, -}) - export const marshalCreateGatewayNetworkRequest = ( request: CreateGatewayNetworkRequest, defaults: DefaultValues, @@ -411,29 +401,25 @@ export const marshalCreateGatewayNetworkRequest = ( enable_masquerade: request.enableMasquerade, gateway_id: request.gatewayId, private_network_id: request.privateNetworkId, - ...resolveOneOf([ - { - param: 'dhcp_id', - value: request.dhcpId, - }, + ...resolveOneOf>([ + { param: 'dhcp_id', value: request.dhcpId }, { param: 'dhcp', - value: request.dhcp - ? marshalCreateDHCPRequest(request.dhcp, defaults) - : undefined, - }, - { - param: 'address', - value: request.address, + value: + request.dhcp !== undefined + ? marshalCreateDHCPRequest(request.dhcp, defaults) + : undefined, }, + { param: 'address', value: request.address }, { param: 'ipam_config', - value: request.ipamConfig - ? marshalCreateGatewayNetworkRequestIpamConfig( - request.ipamConfig, - defaults, - ) - : undefined, + value: + request.ipamConfig !== undefined + ? marshalCreateGatewayNetworkRequestIpamConfig( + request.ipamConfig, + defaults, + ) + : undefined, }, ]), }) @@ -468,22 +454,41 @@ export const marshalCreatePATRuleRequest = ( gateway_id: request.gatewayId, private_ip: request.privateIp, private_port: request.privatePort, - protocol: request.protocol ?? 'unknown', + protocol: request.protocol, public_port: request.publicPort, }) +const marshalSetDHCPEntriesRequestEntry = ( + request: SetDHCPEntriesRequestEntry, + defaults: DefaultValues, +): Record => ({ + ip_address: request.ipAddress, + mac_address: request.macAddress, +}) + export const marshalSetDHCPEntriesRequest = ( request: SetDHCPEntriesRequest, defaults: DefaultValues, ): Record => ({ - dhcp_entries: request.dhcpEntries - ? request.dhcpEntries.map(elt => - marshalSetDHCPEntriesRequestEntry(elt, defaults), - ) - : undefined, + dhcp_entries: + request.dhcpEntries !== undefined + ? request.dhcpEntries.map(elt => + marshalSetDHCPEntriesRequestEntry(elt, defaults), + ) + : undefined, gateway_network_id: request.gatewayNetworkId, }) +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, @@ -520,29 +525,32 @@ export const marshalUpdateDHCPRequest = ( valid_lifetime: request.validLifetime, }) +const marshalUpdateGatewayNetworkRequestIpamConfig = ( + request: UpdateGatewayNetworkRequestIpamConfig, + defaults: DefaultValues, +): Record => ({ + ipam_ip_id: request.ipamIpId, + push_default_route: request.pushDefaultRoute, +}) + export const marshalUpdateGatewayNetworkRequest = ( request: UpdateGatewayNetworkRequest, defaults: DefaultValues, ): Record => ({ enable_dhcp: request.enableDhcp, enable_masquerade: request.enableMasquerade, - ...resolveOneOf([ - { - param: 'dhcp_id', - value: request.dhcpId, - }, - { - param: 'address', - value: request.address, - }, + ...resolveOneOf>([ + { param: 'dhcp_id', value: request.dhcpId }, + { param: 'address', value: request.address }, { param: 'ipam_config', - value: request.ipamConfig - ? marshalUpdateGatewayNetworkRequestIpamConfig( - request.ipamConfig, - defaults, - ) - : undefined, + value: + request.ipamConfig !== undefined + ? marshalUpdateGatewayNetworkRequestIpamConfig( + request.ipamConfig, + defaults, + ) + : undefined, }, ]), }) @@ -574,6 +582,6 @@ export const marshalUpdatePATRuleRequest = ( ): Record => ({ private_ip: request.privateIp, private_port: request.privatePort, - protocol: request.protocol ?? 'unknown', + protocol: request.protocol, public_port: request.publicPort, }) diff --git a/packages/clients/src/api/vpcgw/v1/types.gen.ts b/packages/clients/src/api/vpcgw/v1/types.gen.ts index 3b7cee81e..e0009712f 100644 --- a/packages/clients/src/api/vpcgw/v1/types.gen.ts +++ b/packages/clients/src/api/vpcgw/v1/types.gen.ts @@ -71,15 +71,6 @@ export type ListPATRulesRequestOrderBy = export type PATRuleProtocol = 'unknown' | 'both' | 'tcp' | 'udp' -/** Create gateway network request. ipam config. */ -export interface CreateGatewayNetworkRequestIpamConfig { - /** 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 -} - -/** Dhcp. */ export interface DHCP { /** ID of the DHCP config. */ id: string @@ -152,77 +143,13 @@ export interface DHCP { zone: Zone } -/** Dhcp entry. */ -export interface DHCPEntry { - /** DHCP entry ID. */ - id: string - /** DHCP entry creation date. */ - createdAt?: Date - /** DHCP entry last modification date. */ - updatedAt?: Date - /** Owning GatewayNetwork. */ - gatewayNetworkId: string - /** MAC address of the client device. */ - macAddress: string - /** Assigned IP address. */ - ipAddress: string - /** Hostname of the client device. */ - hostname: string - /** Entry type, either static (DHCP reservation) or dynamic (DHCP lease). */ - type: DHCPEntryType - /** Zone of this DHCP entry. */ - zone: Zone -} - -/** Gateway. */ -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 (commercial offer). */ - type?: GatewayType - /** Current status of the gateway. */ - status: GatewayStatus - /** Name of the gateway. */ - name: string - /** Tags associated with the gateway. */ - tags: string[] - /** Public IP address of the gateway. */ - ip?: IP - /** - * GatewayNetwork objects attached to the gateway (each one represents a - * connection to a Private Network). - */ - gatewayNetworks: GatewayNetwork[] - /** - * Array of DNS server IP addresses to override the gateway's default - * recursive DNS servers. - */ - upstreamDnsServers: string[] - /** 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 - /** Whether this uses non-IPAM IP configurations. */ - isLegacy: boolean - /** Zone of the gateway. */ - zone: Zone +export interface IpamConfig { + /** Defines whether the default route is enabled on that Gateway Network. */ + pushDefaultRoute: boolean + /** IPAM-booked IP ID as the Gateway's IP in this Private Network. */ + ipamIpId: string } -/** Gateway network. */ export interface GatewayNetwork { /** ID of the Public Gateway-Private Network connection. */ id: string @@ -258,7 +185,6 @@ export interface GatewayNetwork { zone: Zone } -/** Gateway type. */ export interface GatewayType { /** Public Gateway type name. */ name: string @@ -272,7 +198,6 @@ export interface GatewayType { zone: Zone } -/** Ip. */ export interface IP { /** IP address ID. */ id: string @@ -296,69 +221,145 @@ export interface IP { zone: Zone } -/** Ipam config. */ -export interface IpamConfig { - /** Defines whether the default route is enabled on that Gateway Network. */ - pushDefaultRoute: boolean - /** IPAM-booked IP ID as the Gateway's IP in this Private Network. */ - ipamIpId: string +export type CreateDHCPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Project to create the DHCP configuration in. */ + projectId?: string + /** Subnet for the DHCP server. */ + subnet: string + /** + * IP address of the DHCP server. This will be the gateway's address in the + * Private Network. Defaults to the first address of the subnet. + */ + address?: string + /** + * Low IP (inclusive) of the dynamic address pool. Must be in the config's + * subnet. Defaults to the second address of the subnet. + */ + poolLow?: string + /** + * High IP (inclusive) of the dynamic address pool. Must be in the config's + * subnet. Defaults to the last address of the subnet. + */ + poolHigh?: string + /** + * Defines whether to enable dynamic pooling of IPs. When false, only + * pre-existing DHCP reservations will be handed out. Defaults to true. + */ + enableDynamic?: boolean + /** How long DHCP entries will be valid for. Defaults to 1h (3600s). */ + validLifetime?: string + /** + * After how long a renew will be attempted. Must be 30s lower than + * `rebind_timer`. Defaults to 50m (3000s). + */ + renewTimer?: string + /** + * After how long a DHCP client will query for a new lease if previous renews + * fail. Must be 30s lower than `valid_lifetime`. Defaults to 51m (3060s). + */ + rebindTimer?: string + /** + * Defines whether the gateway should push a default route to DHCP clients or + * only hand out IPs. Defaults to true. + */ + pushDefaultRoute?: boolean + /** + * Defines whether the gateway should push custom DNS servers to clients. This + * allows for Instance hostname -> IP resolution. Defaults to true. + */ + pushDnsServer?: boolean + /** + * Array of DNS server IP addresses used to override the DNS server list + * pushed to DHCP clients, instead of the gateway itself. + */ + dnsServersOverride?: string[] + /** Array of search paths in addition to the pushed DNS configuration. */ + dnsSearch?: string[] + /** + * TLD given to hostnames in the Private Network. Allowed characters are + * `a-z0-9-.`. Defaults to the slugified Private Network name if created along + * a GatewayNetwork, or else to `priv`. + */ + dnsLocalName?: string } -/** List dhcp entries response. */ -export interface ListDHCPEntriesResponse { - /** DHCP entries in this page. */ - dhcpEntries: DHCPEntry[] - /** Total count of DHCP entries matching the filter. */ - totalCount: number +export interface CreateGatewayNetworkRequestIpamConfig { + /** 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 } -/** List dhc ps response. */ -export interface ListDHCPsResponse { - /** First page of DHCP configuration objects. */ - dhcps: DHCP[] - /** Total count of DHCP configuration objects matching the filter. */ - totalCount: number +export interface DHCPEntry { + /** DHCP entry ID. */ + id: string + /** DHCP entry creation date. */ + createdAt?: Date + /** DHCP entry last modification date. */ + updatedAt?: Date + /** Owning GatewayNetwork. */ + gatewayNetworkId: string + /** MAC address of the client device. */ + macAddress: string + /** Assigned IP address. */ + ipAddress: string + /** Hostname of the client device. */ + hostname: string + /** Entry type, either static (DHCP reservation) or dynamic (DHCP lease). */ + type: DHCPEntryType + /** Zone of this DHCP entry. */ + zone: Zone } -/** List gateway networks response. */ -export interface ListGatewayNetworksResponse { - /** GatewayNetworks on this page. */ +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 (commercial offer). */ + type?: GatewayType + /** Current status of the gateway. */ + status: GatewayStatus + /** Name of the gateway. */ + name: string + /** Tags associated with the gateway. */ + tags: string[] + /** Public IP address of the gateway. */ + ip?: IP + /** + * GatewayNetwork objects attached to the gateway (each one represents a + * connection to a Private Network). + */ gatewayNetworks: GatewayNetwork[] - /** Total GatewayNetworks count matching the filter. */ - totalCount: number -} - -/** List gateway types response. */ -export interface ListGatewayTypesResponse { - /** Available types of Public Gateway. */ - types: GatewayType[] -} - -/** List gateways response. */ -export interface ListGatewaysResponse { - /** Gateways on this page. */ - gateways: Gateway[] - /** Total count of gateways matching the filter. */ - totalCount: number -} - -/** List i ps response. */ -export interface ListIPsResponse { - /** IP addresses on this page. */ - ips: IP[] - /** Total count of IP addresses matching the filter. */ - totalCount: number -} - -/** List pat rules response. */ -export interface ListPATRulesResponse { - /** Array of PAT rules matching the filter. */ - patRules: PATRule[] - /** Total count of PAT rules matching the filter. */ - totalCount: number + /** + * Array of DNS server IP addresses to override the gateway's default + * recursive DNS servers. + */ + upstreamDnsServers: string[] + /** 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 + /** Whether this uses non-IPAM IP configurations. */ + isLegacy: boolean + /** Zone of the gateway. */ + zone: Zone } -/** Pat rule. */ export interface PATRule { /** PAT rule ID. */ id: string @@ -380,29 +381,20 @@ export interface PATRule { zone: Zone } -/** Set dhcp entries request. entry. */ export interface SetDHCPEntriesRequestEntry { /** - * MAC address to give a static entry to. MAC address to give a static entry - * to. A matching entry will be upgraded to a reservation, and a matching - * reservation will be updated. + * MAC address to give a static entry to. A matching entry will be upgraded to + * a reservation, and a matching reservation will be updated. */ macAddress: string /** IP address to give to the device. */ ipAddress: string } -/** Set dhcp entries response. */ -export interface SetDHCPEntriesResponse { - /** List of DHCP entries. */ - dhcpEntries: DHCPEntry[] -} - -/** Set pat rules request. rule. */ export interface SetPATRulesRequestRule { /** - * Public port to listen on. Public port to listen on. Uniquely identifies the - * rule, and a matching rule will be updated with the new parameters. + * 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. */ @@ -413,13 +405,6 @@ export interface SetPATRulesRequestRule { protocol: PATRuleProtocol } -/** Set pat rules response. */ -export interface SetPATRulesResponse { - /** List of PAT rules. */ - patRules: PATRule[] -} - -/** Update gateway network request. ipam config. */ export interface UpdateGatewayNetworkRequestIpamConfig { /** Enabling the default route also enables masquerading. */ pushDefaultRoute?: boolean @@ -427,39 +412,63 @@ export interface UpdateGatewayNetworkRequestIpamConfig { ipamIpId?: string } -export type ListGatewaysRequest = { +export type CreateDHCPEntryRequest = { /** 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 this type. */ - type?: string - /** - * Filter for gateways with this current status. Use `unknown` to include all - * statuses. - */ - status?: GatewayStatus - /** Filter for gateways attached to this Private nNetwork. */ - privateNetworkId?: string + /** GatewayNetwork on which to create a DHCP reservation. */ + gatewayNetworkId: string + /** MAC address to give a static entry to. */ + macAddress: string + /** IP address to give to the device. */ + ipAddress: string } -export type GetGatewayRequest = { +export type CreateGatewayNetworkRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the gateway to fetch. */ + /** Public Gateway to connect. */ gatewayId: string + /** Private Network to connect. */ + privateNetworkId: string + /** Note: this setting is ignored when passing `ipam_config`. */ + enableMasquerade: boolean + /** + * Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to + * `true`, either `dhcp_id` or `dhcp` must be present. Note: this setting is + * ignored when passing `ipam_config`. + */ + enableDhcp?: boolean + /** + * ID of an existing DHCP configuration object to use for this GatewayNetwork. + * + * One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address', + * 'ipamConfig' could be set. + */ + dhcpId?: string + /** + * New DHCP configuration object to use for this GatewayNetwork. + * + * One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address', + * 'ipamConfig' could be set. + */ + dhcp?: CreateDHCPRequest + /** + * Static IP address in CIDR format to to use without DHCP. + * + * One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address', + * 'ipamConfig' could be set. + */ + address?: string + /** + * Note: all or none of the GatewayNetworks for a single gateway can use the + * IPAM. DHCP and IPAM configurations cannot be mixed. Some products may + * require that the Public Gateway uses the IPAM, to ensure correct + * functionality. + * + * One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address', + * 'ipamConfig' could be set. + */ + ipamConfig?: CreateGatewayNetworkRequestIpamConfig } export type CreateGatewayRequest = { @@ -488,26 +497,54 @@ export type CreateGatewayRequest = { bastionPort?: number } -export type UpdateGatewayRequest = { +export type CreateIPRequest = { /** 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. */ + /** 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 DeleteDHCPEntryRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the DHCP entry to delete. */ + dhcpEntryId: string +} + +export type DeleteDHCPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** DHCP configuration ID to delete. */ + dhcpId: string +} + +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 /** - * Array of DNS server IP addresses to override the gateway's default - * recursive DNS servers. + * Defines whether to clean up attached DHCP configurations (if any, and if + * not attached to another Gateway Network). */ - upstreamDnsServers?: 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 + cleanupDhcp: boolean } export type DeleteGatewayRequest = { @@ -522,13 +559,122 @@ export type DeleteGatewayRequest = { cleanupDhcp: boolean } -export type UpgradeGatewayRequest = { +export type DeleteIPRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the gateway to upgrade. */ + /** 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 GetDHCPEntryRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the DHCP entry to fetch. */ + dhcpEntryId: string +} + +export type GetDHCPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the DHCP configuration to fetch. */ + dhcpId: 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 ListDHCPEntriesRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Order in which to return results. */ + orderBy?: ListDHCPEntriesRequestOrderBy + /** Page number. */ + page?: number + /** DHCP entries per page. */ + pageSize?: number + /** Filter for entries on this GatewayNetwork. */ + gatewayNetworkId?: string + /** Filter for entries with this MAC address. */ + macAddress?: string + /** Filter for entries with this IP address. */ + ipAddress?: string + /** Filter for entries with this hostname substring. */ + hostname?: string + /** Filter for entries of this type. */ + type?: DHCPEntryType +} + +export interface ListDHCPEntriesResponse { + /** DHCP entries in this page. */ + dhcpEntries: DHCPEntry[] + /** Total count of DHCP entries matching the filter. */ + totalCount: number +} + +export type ListDHCPsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Order in which to return results. */ + orderBy?: ListDHCPsRequestOrderBy + /** Page number. */ + page?: number + /** DHCP configurations per page. */ + pageSize?: number + /** Include only DHCP configuration objects in this Organization. */ + organizationId?: string + /** Include only DHCP configuration objects in this Project. */ + projectId?: string + /** + * Filter for DHCP configuration objects with this DHCP server IP address (the + * gateway's address in the Private Network). + */ + address?: string + /** + * Filter for DHCP configuration objects with subnets containing this IP + * address. + */ + hasAddress?: string +} + +export interface ListDHCPsResponse { + /** First page of DHCP configuration objects. */ + dhcps: DHCP[] + /** Total count of DHCP configuration objects matching the filter. */ + totalCount: number +} + export type ListGatewayNetworksRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone @@ -553,215 +699,152 @@ export type ListGatewayNetworksRequest = { status?: GatewayNetworkStatus } -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 interface ListGatewayNetworksResponse { + /** GatewayNetworks on this page. */ + gatewayNetworks: GatewayNetwork[] + /** Total GatewayNetworks count matching the filter. */ + totalCount: number } -export type CreateGatewayNetworkRequest = { +export type ListGatewayTypesRequest = { /** 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. - * Note: this setting is ignored when passing `ipam_config`. - */ - enableMasquerade: boolean - /** - * Defines whether to enable DHCP on this Private Network. Defaults to `true` - * if either `dhcp_id` or `dhcp` are present. If set to `true`, either - * `dhcp_id` or `dhcp` must be present. Note: this setting is ignored when - * passing `ipam_config`. - */ - enableDhcp?: boolean - /** - * ID of an existing DHCP configuration object to use for this GatewayNetwork. - * - * One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address', - * 'ipamConfig' could be set. - */ - dhcpId?: string - /** - * New DHCP configuration object to use for this GatewayNetwork. - * - * One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address', - * 'ipamConfig' could be set. - */ - dhcp?: CreateDHCPRequest - /** - * Static IP address in CIDR format to to use without DHCP. - * - * One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address', - * 'ipamConfig' could be set. - */ - address?: string - /** - * Auto-configure the GatewayNetwork using Scaleway's IPAM (IP address - * management service). Note: all or none of the GatewayNetworks for a single - * gateway can use the IPAM. DHCP and IPAM configurations cannot be mixed. - * Some products may require that the Public Gateway uses the IPAM, to ensure - * correct functionality. - * - * One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address', - * 'ipamConfig' could be set. - */ - ipamConfig?: CreateGatewayNetworkRequestIpamConfig } -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. - * Note: this setting is ignored when passing `ipam_config`. - */ - enableMasquerade?: boolean - /** - * Defines whether to enable DHCP on this Private Network. Defaults to `true` - * if `dhcp_id` is present. If set to `true`, `dhcp_id` must be present. Note: - * this setting is ignored when passing `ipam_config`. - */ - enableDhcp?: boolean - /** - * ID of the new DHCP configuration object to use with this GatewayNetwork. - * - * One-of ('ipConfig'): at most one of 'dhcpId', 'address', 'ipamConfig' could - * be set. - */ - dhcpId?: string - /** - * New static IP address. - * - * One-of ('ipConfig'): at most one of 'dhcpId', 'address', 'ipamConfig' could - * be set. - */ - address?: string - /** - * Auto-configure the GatewayNetwork using Scaleway's IPAM (IP address - * management service). Note: all or none of the GatewayNetworks for a single - * gateway can use the IPAM. DHCP and IPAM configurations cannot be mixed. - * Some products may require that the Public Gateway uses the IPAM, to ensure - * correct functionality. - * - * One-of ('ipConfig'): at most one of 'dhcpId', 'address', 'ipamConfig' could - * be set. - */ - ipamConfig?: UpdateGatewayNetworkRequestIpamConfig +export interface ListGatewayTypesResponse { + /** Available types of Public Gateway. */ + types: GatewayType[] } -export type DeleteGatewayNetworkRequest = { +export type ListGatewaysRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the GatewayNetwork to delete. */ - gatewayNetworkId: string + /** 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 this type. */ + type?: string /** - * Defines whether to clean up attached DHCP configurations (if any, and if - * not attached to another Gateway Network). + * Filter for gateways with this current status. Use `unknown` to include all + * statuses. */ - cleanupDhcp: boolean + status?: GatewayStatus + /** Filter for gateways attached to this Private nNetwork. */ + privateNetworkId?: string } -export type ListDHCPsRequest = { +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?: ListDHCPsRequestOrderBy + orderBy?: ListIPsRequestOrderBy /** Page number. */ page?: number - /** DHCP configurations per page. */ + /** IP addresses per page. */ pageSize?: number - /** Include only DHCP configuration objects in this Organization. */ + /** Filter for IP addresses in this Organization. */ organizationId?: string - /** Include only DHCP configuration objects in this Project. */ + /** Filter for IP addresses in this Project. */ projectId?: string - /** - * Filter for DHCP configuration objects with this DHCP server IP address (the - * gateway's address in the Private Network). - */ - address?: string - /** - * Filter for DHCP configuration objects with subnets containing this IP - * address. - */ - hasAddress?: 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 type GetDHCPRequest = { +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 - /** ID of the DHCP configuration to fetch. */ - dhcpId: string + /** Order in which to return results. */ + orderBy?: ListPATRulesRequestOrderBy + /** Page number. */ + page?: number + /** PAT rules per page. */ + pageSize?: number + /** Filter for PAT rules on this Gateway. */ + gatewayId?: string + /** Filter for PAT rules targeting this private ip. */ + privateIp?: string + /** Filter for PAT rules with this protocol. */ + protocol?: PATRuleProtocol } -export type CreateDHCPRequest = { +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 - /** Project to create the DHCP configuration in. */ - projectId?: string - /** Subnet for the DHCP server. */ - subnet: string - /** - * IP address of the DHCP server. This will be the gateway's address in the - * Private Network. Defaults to the first address of the subnet. - */ - address?: string - /** - * Low IP (inclusive) of the dynamic address pool. Must be in the config's - * subnet. Defaults to the second address of the subnet. - */ - poolLow?: string - /** - * High IP (inclusive) of the dynamic address pool. Must be in the config's - * subnet. Defaults to the last address of the subnet. - */ - poolHigh?: string - /** - * Defines whether to enable dynamic pooling of IPs. When false, only - * pre-existing DHCP reservations will be handed out. Defaults to true. - */ - enableDynamic?: boolean - /** How long DHCP entries will be valid for. Defaults to 1h (3600s). */ - validLifetime?: string - /** - * After how long a renew will be attempted. Must be 30s lower than - * `rebind_timer`. Defaults to 50m (3000s). - */ - renewTimer?: string - /** - * After how long a DHCP client will query for a new lease if previous renews - * fail. Must be 30s lower than `valid_lifetime`. Defaults to 51m (3060s). - */ - rebindTimer?: string - /** - * Defines whether the gateway should push a default route to DHCP clients or - * only hand out IPs. Defaults to true. - */ - pushDefaultRoute?: boolean - /** - * Defines whether the gateway should push custom DNS servers to clients. This - * allows for Instance hostname -> IP resolution. Defaults to true. - */ - pushDnsServer?: boolean - /** - * Array of DNS server IP addresses used to override the DNS server list - * pushed to DHCP clients, instead of the gateway itself. - */ - dnsServersOverride?: string[] - /** Array of search paths in addition to the pushed DNS configuration. */ - dnsSearch?: string[] - /** - * TLD given to hostnames in the Private Network. Allowed characters are - * `a-z0-9-.`. Defaults to the slugified Private Network name if created along - * a GatewayNetwork, or else to `priv`. - */ - dnsLocalName?: string + /** ID of the gateway to refresh SSH keys on. */ + gatewayId: string +} + +export type SetDHCPEntriesRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the Gateway Network on which to set DHCP reservation list. */ + gatewayNetworkId: string + /** New list of DHCP reservations. */ + dhcpEntries?: SetDHCPEntriesRequestEntry[] +} + +export interface SetDHCPEntriesResponse { + /** List of DHCP entries. */ + dhcpEntries: DHCPEntry[] +} + +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 UpdateDHCPEntryRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the DHCP entry to update. */ + dhcpEntryId: string + /** New IP address to give to the device. */ + ipAddress?: string } export type UpdateDHCPRequest = { @@ -828,114 +911,77 @@ export type UpdateDHCPRequest = { dnsLocalName?: string } -export type DeleteDHCPRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** DHCP configuration ID to delete. */ - dhcpId: string -} - -export type ListDHCPEntriesRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** Order in which to return results. */ - orderBy?: ListDHCPEntriesRequestOrderBy - /** Page number. */ - page?: number - /** DHCP entries per page. */ - pageSize?: number - /** Filter for entries on this GatewayNetwork. */ - gatewayNetworkId?: string - /** Filter for entries with this MAC address. */ - macAddress?: string - /** Filter for entries with this IP address. */ - ipAddress?: string - /** Filter for entries with this hostname substring. */ - hostname?: string - /** Filter for entries of this type. */ - type?: DHCPEntryType -} - -export type GetDHCPEntryRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the DHCP entry to fetch. */ - dhcpEntryId: string -} - -export type CreateDHCPEntryRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** GatewayNetwork on which to create a DHCP reservation. */ - gatewayNetworkId: string - /** MAC address to give a static entry to. */ - macAddress: string - /** IP address to give to the device. */ - ipAddress: string -} - -export type UpdateDHCPEntryRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone - /** ID of the DHCP entry to update. */ - dhcpEntryId: string - /** New IP address to give to the device. */ - ipAddress?: string -} - -export type SetDHCPEntriesRequest = { +export type UpdateGatewayNetworkRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the Gateway Network on which to set DHCP reservation list. */ + /** ID of the GatewayNetwork to update. */ gatewayNetworkId: string - /** New list of DHCP reservations. */ - dhcpEntries?: SetDHCPEntriesRequestEntry[] + /** Note: this setting is ignored when passing `ipam_config`. */ + enableMasquerade?: boolean + /** + * Defaults to `true` if `dhcp_id` is present. If set to `true`, `dhcp_id` + * must be present. Note: this setting is ignored when passing `ipam_config`. + */ + enableDhcp?: boolean + /** + * ID of the new DHCP configuration object to use with this GatewayNetwork. + * + * One-of ('ipConfig'): at most one of 'dhcpId', 'address', 'ipamConfig' could + * be set. + */ + dhcpId?: string + /** + * New static IP address. + * + * One-of ('ipConfig'): at most one of 'dhcpId', 'address', 'ipamConfig' could + * be set. + */ + address?: string + /** + * Note: all or none of the GatewayNetworks for a single gateway can use the + * IPAM. DHCP and IPAM configurations cannot be mixed. Some products may + * require that the Public Gateway uses the IPAM, to ensure correct + * functionality. + * + * One-of ('ipConfig'): at most one of 'dhcpId', 'address', 'ipamConfig' could + * be set. + */ + ipamConfig?: UpdateGatewayNetworkRequestIpamConfig } -export type DeleteDHCPEntryRequest = { +export type UpdateGatewayRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone - /** ID of the DHCP entry to delete. */ - dhcpEntryId: string + /** ID of the gateway to update. */ + gatewayId: string + /** Name for the gateway. */ + name?: string + /** Tags for the gateway. */ + tags?: string[] + /** + * Array of DNS server IP addresses to override the gateway's default + * recursive DNS servers. + */ + upstreamDnsServers?: 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 ListPATRulesRequest = { +export type UpdateIPRequest = { /** 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 this Gateway. */ + /** 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 - /** Filter for PAT rules targeting this private ip. */ - privateIp?: string - /** Filter for PAT rules with this protocol. */ - protocol?: PATRuleProtocol -} - -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 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 UpdatePATRuleRequest = { @@ -953,87 +999,9 @@ export type UpdatePATRuleRequest = { protocol?: PATRuleProtocol } -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 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 ListGatewayTypesRequest = { - /** Zone to target. If none is passed will use default zone from the config. */ - zone?: Zone -} - -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 - /** Filter for IP addresses 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 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 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 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 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 RefreshSSHKeysRequest = { +export type UpgradeGatewayRequest = { /** 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. */ + /** ID of the gateway to upgrade. */ gatewayId: string } From f6bbea6e46458af2e4960816d4e07160ec2b96ad Mon Sep 17 00:00:00 2001 From: Vincent Germain Date: Tue, 31 Oct 2023 10:42:55 +0100 Subject: [PATCH 03/10] chore: export std --- packages/clients/src/api/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/clients/src/api/index.ts b/packages/clients/src/api/index.ts index 2faaca5ae..5d4118390 100644 --- a/packages/clients/src/api/index.ts +++ b/packages/clients/src/api/index.ts @@ -22,6 +22,7 @@ export * as RDB from './rdb' export * as Redis from './redis' export * as Registry from './registry' export * as Secret from './secret' +export * as Std from './std/index.gen' export * as Test from './test' export * as TransactionalEmail from './tem' export * as VPC from './vpc' From a09f963f2cf1435f4963ac6abc661741c5024b01 Mon Sep 17 00:00:00 2001 From: Nathanael DEMACON Date: Tue, 31 Oct 2023 10:49:51 +0100 Subject: [PATCH 04/10] chore(release): publish - @scaleway/sdk@2.0.0-alpha.16 --- packages/clients/package.json | 2 +- packages/clients/src/scw/constants.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/clients/package.json b/packages/clients/package.json index fcce5b63b..81198ad64 100644 --- a/packages/clients/package.json +++ b/packages/clients/package.json @@ -1,6 +1,6 @@ { "name": "@scaleway/sdk", - "version": "2.0.0-alpha.15", + "version": "2.0.0-alpha.16", "license": "Apache-2.0", "description": "Scaleway SDK.", "keywords": [ diff --git a/packages/clients/src/scw/constants.ts b/packages/clients/src/scw/constants.ts index 53678feaa..46f846619 100644 --- a/packages/clients/src/scw/constants.ts +++ b/packages/clients/src/scw/constants.ts @@ -1,3 +1,3 @@ -export const version = 'v2.0.0-alpha.15' +export const version = 'v2.0.0-alpha.16' export const userAgent = `scaleway-sdk-js/${version}` From 4eb55849aa737cfadb92693edfe06e3e2ff28513 Mon Sep 17 00:00:00 2001 From: Vincent Germain Date: Fri, 3 Nov 2023 14:28:09 +0100 Subject: [PATCH 05/10] feat: update --- .../src/api/baremetal/v1/marshalling.gen.ts | 10 +- .../clients/src/api/baremetal/v1/types.gen.ts | 4 +- packages/clients/src/api/index.ts | 1 + .../src/api/instance/v1/marshalling.gen.ts | 80 ++++++++-------- .../clients/src/api/instance/v1/types.gen.ts | 32 +++---- packages/clients/src/api/jobs/index.ts | 1 + .../clients/src/api/jobs/v1alpha1/api.gen.ts | 4 +- .../src/api/jobs/v1alpha1/marshalling.gen.ts | 17 +++- .../src/api/jobs/v1alpha1/types.gen.ts | 92 ++++++++++--------- .../clients/src/api/k8s/v1/marshalling.gen.ts | 10 +- packages/clients/src/api/k8s/v1/types.gen.ts | 4 +- .../clients/src/api/lb/v1/marshalling.gen.ts | 60 ++++++------ packages/clients/src/api/lb/v1/types.gen.ts | 24 ++--- .../clients/src/api/rdb/v1/marshalling.gen.ts | 10 +- packages/clients/src/api/rdb/v1/types.gen.ts | 4 +- .../src/api/registry/v1/marshalling.gen.ts | 10 +- .../clients/src/api/registry/v1/types.gen.ts | 4 +- .../src/api/secret/v1alpha1/types.gen.ts | 2 + .../src/api/test/v1/marshalling.gen.ts | 10 +- packages/clients/src/api/test/v1/types.gen.ts | 4 +- 20 files changed, 201 insertions(+), 182 deletions(-) create mode 100644 packages/clients/src/api/jobs/index.ts diff --git a/packages/clients/src/api/baremetal/v1/marshalling.gen.ts b/packages/clients/src/api/baremetal/v1/marshalling.gen.ts index fe23d4309..c16ded81a 100644 --- a/packages/clients/src/api/baremetal/v1/marshalling.gen.ts +++ b/packages/clients/src/api/baremetal/v1/marshalling.gen.ts @@ -572,16 +572,16 @@ export const marshalCreateServerRequest = ( option_ids: request.optionIds, tags: request.tags, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), }) diff --git a/packages/clients/src/api/baremetal/v1/types.gen.ts b/packages/clients/src/api/baremetal/v1/types.gen.ts index 046ae63a7..283036088 100644 --- a/packages/clients/src/api/baremetal/v1/types.gen.ts +++ b/packages/clients/src/api/baremetal/v1/types.gen.ts @@ -428,14 +428,14 @@ export type CreateServerRequest = { /** * @deprecated Organization ID with which the server will be created. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string /** * Project ID with which the server will be created. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string diff --git a/packages/clients/src/api/index.ts b/packages/clients/src/api/index.ts index 5d4118390..3d2534057 100644 --- a/packages/clients/src/api/index.ts +++ b/packages/clients/src/api/index.ts @@ -14,6 +14,7 @@ export * as Instance from './instance' export * as IOT from './iot' export * as IPAM from './ipam' export * as IPFS from './ipfs' +export * as Jobs from './jobs' export * as K8S from './k8s' export * as LB from './lb' export * as Marketplace from './marketplace' diff --git a/packages/clients/src/api/instance/v1/marshalling.gen.ts b/packages/clients/src/api/instance/v1/marshalling.gen.ts index caa65d417..5eb127a03 100644 --- a/packages/clients/src/api/instance/v1/marshalling.gen.ts +++ b/packages/clients/src/api/instance/v1/marshalling.gen.ts @@ -1555,16 +1555,16 @@ const marshalVolumeTemplate = ( size: request.size, volume_type: request.volumeType, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization', - value: request.organization, - }, { default: defaults.defaultProjectId, param: 'project', value: request.project, }, + { + default: defaults.defaultOrganizationId, + param: 'organization', + value: request.organization, + }, ]), }) @@ -1589,16 +1589,16 @@ export const marshalCreateImageRequest = ( root_volume: request.rootVolume, tags: request.tags, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization', - value: request.organization, - }, { default: defaults.defaultProjectId, param: 'project', value: request.project, }, + { + default: defaults.defaultOrganizationId, + param: 'organization', + value: request.organization, + }, ]), }) @@ -1610,16 +1610,16 @@ export const marshalCreateIpRequest = ( tags: request.tags, type: request.type, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization', - value: request.organization, - }, { default: defaults.defaultProjectId, param: 'project', value: request.project, }, + { + default: defaults.defaultOrganizationId, + param: 'organization', + value: request.organization, + }, ]), }) @@ -1632,16 +1632,16 @@ export const marshalCreatePlacementGroupRequest = ( policy_type: request.policyType, tags: request.tags, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization', - value: request.organization, - }, { default: defaults.defaultProjectId, param: 'project', value: request.project, }, + { + default: defaults.defaultOrganizationId, + param: 'organization', + value: request.organization, + }, ]), }) @@ -1666,16 +1666,16 @@ export const marshalCreateSecurityGroupRequest = ( stateful: request.stateful, tags: request.tags, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization', - value: request.organization, - }, { default: defaults.defaultProjectId, param: 'project', value: request.project, }, + { + default: defaults.defaultOrganizationId, + param: 'organization', + value: request.organization, + }, ]), ...resolveOneOf([ { param: 'organization_default', value: request.organizationDefault }, @@ -1739,16 +1739,16 @@ export const marshalCreateServerRequest = ( ) : undefined, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization', - value: request.organization, - }, { default: defaults.defaultProjectId, param: 'project', value: request.project, }, + { + default: defaults.defaultOrganizationId, + param: 'organization', + value: request.organization, + }, ]), }) @@ -1764,16 +1764,16 @@ export const marshalCreateSnapshotRequest = ( volume_id: request.volumeId, volume_type: request.volumeType, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization', - value: request.organization, - }, { default: defaults.defaultProjectId, param: 'project', value: request.project, }, + { + default: defaults.defaultOrganizationId, + param: 'organization', + value: request.organization, + }, ]), }) @@ -1785,16 +1785,16 @@ export const marshalCreateVolumeRequest = ( tags: request.tags, volume_type: request.volumeType, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization', - value: request.organization, - }, { default: defaults.defaultProjectId, param: 'project', value: request.project, }, + { + default: defaults.defaultOrganizationId, + param: 'organization', + value: request.organization, + }, ]), ...resolveOneOf([ { param: 'size', value: request.size }, diff --git a/packages/clients/src/api/instance/v1/types.gen.ts b/packages/clients/src/api/instance/v1/types.gen.ts index f015a081d..6e4ec9a2b 100644 --- a/packages/clients/src/api/instance/v1/types.gen.ts +++ b/packages/clients/src/api/instance/v1/types.gen.ts @@ -381,14 +381,14 @@ export interface VolumeTemplate { /** * @deprecated Organization ID of the volume. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ organization?: string /** * Project ID of the volume. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ project?: string @@ -758,14 +758,14 @@ export type CreateImageRequest = { /** * @deprecated Organization ID of the image. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ organization?: string /** * Project ID of the image. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ project?: string @@ -785,14 +785,14 @@ export type CreateIpRequest = { /** * @deprecated Organization ID in which the IP is reserved. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ organization?: string /** * Project ID in which the IP is reserved. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ project?: string @@ -816,14 +816,14 @@ export type CreatePlacementGroupRequest = { /** * @deprecated Organization ID of the placement group. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ organization?: string /** * Project ID of the placement group. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ project?: string @@ -866,14 +866,14 @@ export type CreateSecurityGroupRequest = { /** * @deprecated Organization ID the security group belongs to. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ organization?: string /** * Project ID the security group belong to. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ project?: string @@ -963,14 +963,14 @@ export type CreateServerRequest = { /** * @deprecated Instance Organization ID. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ organization?: string /** * Instance Project ID. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ project?: string @@ -998,14 +998,14 @@ export type CreateSnapshotRequest = { /** * @deprecated Organization ID of the snapshot. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ organization?: string /** * Project ID of the snapshot. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ project?: string @@ -1035,14 +1035,14 @@ export type CreateVolumeRequest = { /** * @deprecated Volume Organization ID. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ organization?: string /** * Volume Project ID. * - * One-of ('projectIdentifier'): at most one of 'organization', 'project' + * One-of ('projectIdentifier'): at most one of 'project', 'organization' * could be set. */ project?: string diff --git a/packages/clients/src/api/jobs/index.ts b/packages/clients/src/api/jobs/index.ts new file mode 100644 index 000000000..e49bded05 --- /dev/null +++ b/packages/clients/src/api/jobs/index.ts @@ -0,0 +1 @@ +export * as v1alpha1 from './v1alpha1/index.gen' diff --git a/packages/clients/src/api/jobs/v1alpha1/api.gen.ts b/packages/clients/src/api/jobs/v1alpha1/api.gen.ts index 752ad1c29..22928cf41 100644 --- a/packages/clients/src/api/jobs/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/jobs/v1alpha1/api.gen.ts @@ -96,7 +96,7 @@ export class API extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/job-definitions`, urlParams: urlParams( - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', @@ -199,7 +199,7 @@ export class API extends ParentAPI { )}/job-runs`, urlParams: urlParams( ['job_definition_id', request.jobDefinitionId], - ['order_by', request.orderBy ?? 'created_at_asc'], + ['order_by', request.orderBy], ['page', request.page], [ 'page_size', diff --git a/packages/clients/src/api/jobs/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/jobs/v1alpha1/marshalling.gen.ts index 486f6f7a2..8be482961 100644 --- a/packages/clients/src/api/jobs/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/jobs/v1alpha1/marshalling.gen.ts @@ -16,7 +16,7 @@ import type { UpdateJobDefinitionRequest, } from './types.gen' -export const unmarshalJobDefinition = (data: unknown) => { +export const unmarshalJobDefinition = (data: unknown): JobDefinition => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'JobDefinition' failed as data isn't a dictionary.`, @@ -40,7 +40,7 @@ export const unmarshalJobDefinition = (data: unknown) => { } as JobDefinition } -export const unmarshalJobRun = (data: unknown) => { +export const unmarshalJobRun = (data: unknown): JobRun => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'JobRun' failed as data isn't a dictionary.`, @@ -61,7 +61,9 @@ export const unmarshalJobRun = (data: unknown) => { } as JobRun } -export const unmarshalListJobDefinitionsResponse = (data: unknown) => { +export const unmarshalListJobDefinitionsResponse = ( + data: unknown, +): ListJobDefinitionsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListJobDefinitionsResponse' failed as data isn't a dictionary.`, @@ -77,7 +79,9 @@ export const unmarshalListJobDefinitionsResponse = (data: unknown) => { } as ListJobDefinitionsResponse } -export const unmarshalListJobRunsResponse = (data: unknown) => { +export const unmarshalListJobRunsResponse = ( + data: unknown, +): ListJobRunsResponse => { if (!isJSONObject(data)) { throw new TypeError( `Unmarshalling the type 'ListJobRunsResponse' failed as data isn't a dictionary.`, @@ -97,7 +101,10 @@ export const marshalCreateJobDefinitionRequest = ( command: request.command, cpu_limit: request.cpuLimit, description: request.description, - environment_variables: request.environmentVariables, + environment_variables: + request.environmentVariables !== undefined + ? request.environmentVariables + : undefined, image_uri: request.imageUri, job_timeout: request.jobTimeout, memory_limit: request.memoryLimit, diff --git a/packages/clients/src/api/jobs/v1alpha1/types.gen.ts b/packages/clients/src/api/jobs/v1alpha1/types.gen.ts index 878ee45b8..10e3e2c5b 100644 --- a/packages/clients/src/api/jobs/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/jobs/v1alpha1/types.gen.ts @@ -30,6 +30,10 @@ export interface JobDefinition { environmentVariables: Record description: string jobTimeout?: string + /** + * Region to target. If none is passed will use default region from the + * config. + */ region: Region } @@ -43,25 +47,11 @@ export interface JobRun { exitCode?: number runDuration?: string errorMessage: string - region: Region -} - -export interface ListJobDefinitionsResponse { - jobDefinitions: JobDefinition[] - totalCount: number -} - -export interface ListJobRunsResponse { - jobRuns: JobRun[] - totalCount: number -} - -export type GetServiceInfoRequest = { /** * Region to target. If none is passed will use default region from the * config. */ - region?: Region + region: Region } export type CreateJobDefinitionRequest = { @@ -81,6 +71,15 @@ export type CreateJobDefinitionRequest = { jobTimeout?: string } +export type DeleteJobDefinitionRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + jobDefinitionId: string +} + export type GetJobDefinitionRequest = { /** * Region to target. If none is passed will use default region from the @@ -90,60 +89,65 @@ export type GetJobDefinitionRequest = { jobDefinitionId: string } -export type ListJobDefinitionsRequest = { +export type GetJobRunRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - page?: number - pageSize?: number - orderBy?: ListJobDefinitionsRequestOrderBy - projectId?: string + jobRunId: string } -export type UpdateJobDefinitionRequest = { +export type GetServiceInfoRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - jobDefinitionId: string - name?: string - cpuLimit?: number - memoryLimit?: number - imageUri?: string - command?: string - environmentVariables?: Record - description?: string - jobTimeout?: string } -export type DeleteJobDefinitionRequest = { +export type ListJobDefinitionsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - jobDefinitionId: string + page?: number + pageSize?: number + orderBy?: ListJobDefinitionsRequestOrderBy + projectId?: string } -export type StartJobDefinitionRequest = { +export interface ListJobDefinitionsResponse { + jobDefinitions: JobDefinition[] + totalCount: number +} + +export type ListJobRunsRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - jobDefinitionId: string + page?: number + pageSize?: number + orderBy?: ListJobRunsRequestOrderBy + jobDefinitionId?: string + projectId?: string } -export type GetJobRunRequest = { +export interface ListJobRunsResponse { + jobRuns: JobRun[] + totalCount: number +} + +export type StartJobDefinitionRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - jobRunId: string + jobDefinitionId: string } export type StopJobRunRequest = { @@ -155,15 +159,19 @@ export type StopJobRunRequest = { jobRunId: string } -export type ListJobRunsRequest = { +export type UpdateJobDefinitionRequest = { /** * Region to target. If none is passed will use default region from the * config. */ region?: Region - page?: number - pageSize?: number - orderBy?: ListJobRunsRequestOrderBy - jobDefinitionId?: string - projectId?: string + jobDefinitionId: string + name?: string + cpuLimit?: number + memoryLimit?: number + imageUri?: string + command?: string + environmentVariables?: Record + description?: string + jobTimeout?: string } diff --git a/packages/clients/src/api/k8s/v1/marshalling.gen.ts b/packages/clients/src/api/k8s/v1/marshalling.gen.ts index 73e2f1c98..b840452c3 100644 --- a/packages/clients/src/api/k8s/v1/marshalling.gen.ts +++ b/packages/clients/src/api/k8s/v1/marshalling.gen.ts @@ -528,16 +528,16 @@ export const marshalCreateClusterRequest = ( type: request.type, version: request.version, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), }) diff --git a/packages/clients/src/api/k8s/v1/types.gen.ts b/packages/clients/src/api/k8s/v1/types.gen.ts index a90516a8d..6c53c12ff 100644 --- a/packages/clients/src/api/k8s/v1/types.gen.ts +++ b/packages/clients/src/api/k8s/v1/types.gen.ts @@ -687,14 +687,14 @@ export type CreateClusterRequest = { /** * @deprecated Organization ID in which the cluster will be created. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string /** * Project ID in which the cluster will be created. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string diff --git a/packages/clients/src/api/lb/v1/marshalling.gen.ts b/packages/clients/src/api/lb/v1/marshalling.gen.ts index a367d59b8..995f57b5b 100644 --- a/packages/clients/src/api/lb/v1/marshalling.gen.ts +++ b/packages/clients/src/api/lb/v1/marshalling.gen.ts @@ -1136,16 +1136,16 @@ export const marshalCreateIpRequest = ( ): Record => ({ reverse: request.reverse, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), }) @@ -1161,16 +1161,16 @@ export const marshalCreateLbRequest = ( tags: request.tags, type: request.type, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), }) @@ -1216,16 +1216,16 @@ export const marshalCreateSubscriberRequest = ( ): Record => ({ name: request.name, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), ...resolveOneOf([ { @@ -1571,16 +1571,16 @@ export const marshalZonedApiCreateIpRequest = ( ): Record => ({ reverse: request.reverse, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), }) @@ -1596,16 +1596,16 @@ export const marshalZonedApiCreateLbRequest = ( tags: request.tags, type: request.type, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), }) @@ -1627,16 +1627,16 @@ export const marshalZonedApiCreateSubscriberRequest = ( ): Record => ({ name: request.name, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), ...resolveOneOf([ { diff --git a/packages/clients/src/api/lb/v1/types.gen.ts b/packages/clients/src/api/lb/v1/types.gen.ts index e8b9e22f9..a9e65b111 100644 --- a/packages/clients/src/api/lb/v1/types.gen.ts +++ b/packages/clients/src/api/lb/v1/types.gen.ts @@ -965,14 +965,14 @@ export type CreateIpRequest = { * @deprecated Organization ID of the Organization where the IP address should * be created. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string /** * Project ID of the Project where the IP address should be created. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string @@ -989,14 +989,14 @@ export type CreateLbRequest = { /** * @deprecated Scaleway Organization to create the Load Balancer in. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string /** * Scaleway Project to create the Load Balancer in. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string @@ -1077,14 +1077,14 @@ export type CreateSubscriberRequest = { /** * @deprecated Organization ID to create the subscriber in. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string /** * Project ID to create the subscriber in. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string @@ -2147,14 +2147,14 @@ export type ZonedApiCreateIpRequest = { * @deprecated Organization ID of the Organization where the IP address should * be created. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string /** * Project ID of the Project where the IP address should be created. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string @@ -2168,14 +2168,14 @@ export type ZonedApiCreateLbRequest = { /** * @deprecated Scaleway Organization to create the Load Balancer in. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string /** * Scaleway Project to create the Load Balancer in. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string @@ -2250,14 +2250,14 @@ export type ZonedApiCreateSubscriberRequest = { /** * @deprecated Organization ID to create the subscriber in. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string /** * Project ID to create the subscriber in. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string diff --git a/packages/clients/src/api/rdb/v1/marshalling.gen.ts b/packages/clients/src/api/rdb/v1/marshalling.gen.ts index cef675246..e4d6ad49b 100644 --- a/packages/clients/src/api/rdb/v1/marshalling.gen.ts +++ b/packages/clients/src/api/rdb/v1/marshalling.gen.ts @@ -1006,16 +1006,16 @@ export const marshalCreateInstanceRequest = ( volume_size: request.volumeSize, volume_type: request.volumeType, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), }) diff --git a/packages/clients/src/api/rdb/v1/types.gen.ts b/packages/clients/src/api/rdb/v1/types.gen.ts index 9cea33a49..9e1da424b 100644 --- a/packages/clients/src/api/rdb/v1/types.gen.ts +++ b/packages/clients/src/api/rdb/v1/types.gen.ts @@ -747,14 +747,14 @@ export type CreateInstanceRequest = { /** * @deprecated Please use project_id instead. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string /** * The Project ID on which the Database Instance will be created. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string diff --git a/packages/clients/src/api/registry/v1/marshalling.gen.ts b/packages/clients/src/api/registry/v1/marshalling.gen.ts index db5e36577..c7bf432a6 100644 --- a/packages/clients/src/api/registry/v1/marshalling.gen.ts +++ b/packages/clients/src/api/registry/v1/marshalling.gen.ts @@ -135,16 +135,16 @@ export const marshalCreateNamespaceRequest = ( is_public: request.isPublic, name: request.name || randomName('ns'), ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), }) diff --git a/packages/clients/src/api/registry/v1/types.gen.ts b/packages/clients/src/api/registry/v1/types.gen.ts index 9426c6d79..a146ca982 100644 --- a/packages/clients/src/api/registry/v1/types.gen.ts +++ b/packages/clients/src/api/registry/v1/types.gen.ts @@ -137,14 +137,14 @@ export type CreateNamespaceRequest = { /** * @deprecated Namespace owner (deprecated). * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string /** * Project ID on which the namespace will be created. * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string diff --git a/packages/clients/src/api/secret/v1alpha1/types.gen.ts b/packages/clients/src/api/secret/v1alpha1/types.gen.ts index 03f3d0906..10085fcd7 100644 --- a/packages/clients/src/api/secret/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/types.gen.ts @@ -61,6 +61,8 @@ export interface Folder { path: string /** Date and time of the folder's creation. */ createdAt?: Date + /** Region of the folder. */ + region: Region } export interface SecretVersion { diff --git a/packages/clients/src/api/test/v1/marshalling.gen.ts b/packages/clients/src/api/test/v1/marshalling.gen.ts index c32dafbc5..cbc8e7a39 100644 --- a/packages/clients/src/api/test/v1/marshalling.gen.ts +++ b/packages/clients/src/api/test/v1/marshalling.gen.ts @@ -84,16 +84,16 @@ export const marshalCreateHumanRequest = ( name: request.name, shoe_size: request.shoeSize, ...resolveOneOf([ - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, { default: defaults.defaultProjectId, param: 'project_id', value: request.projectId, }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, ]), }) diff --git a/packages/clients/src/api/test/v1/types.gen.ts b/packages/clients/src/api/test/v1/types.gen.ts index 5d66d340e..45577a67b 100644 --- a/packages/clients/src/api/test/v1/types.gen.ts +++ b/packages/clients/src/api/test/v1/types.gen.ts @@ -52,13 +52,13 @@ export type CreateHumanRequest = { /** * @deprecated * - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ organizationId?: string name: string /** - * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' + * One-of ('projectIdentifier'): at most one of 'projectId', 'organizationId' * could be set. */ projectId?: string From f6e127cc90af724b3bb736a6871a067e72b82774 Mon Sep 17 00:00:00 2001 From: Nathanael DEMACON Date: Fri, 3 Nov 2023 14:33:45 +0100 Subject: [PATCH 06/10] chore(release): publish - @scaleway/sdk@2.0.0-alpha.17 --- packages/clients/package.json | 2 +- packages/clients/src/scw/constants.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/clients/package.json b/packages/clients/package.json index 81198ad64..99a115182 100644 --- a/packages/clients/package.json +++ b/packages/clients/package.json @@ -1,6 +1,6 @@ { "name": "@scaleway/sdk", - "version": "2.0.0-alpha.16", + "version": "2.0.0-alpha.17", "license": "Apache-2.0", "description": "Scaleway SDK.", "keywords": [ diff --git a/packages/clients/src/scw/constants.ts b/packages/clients/src/scw/constants.ts index 46f846619..955619ef2 100644 --- a/packages/clients/src/scw/constants.ts +++ b/packages/clients/src/scw/constants.ts @@ -1,3 +1,3 @@ -export const version = 'v2.0.0-alpha.16' +export const version = 'v2.0.0-alpha.17' export const userAgent = `scaleway-sdk-js/${version}` From b61928183a409e9c221d50a0f4f8b30b145cda64 Mon Sep 17 00:00:00 2001 From: Vincent Germain Date: Tue, 7 Nov 2023 11:03:34 +0100 Subject: [PATCH 07/10] fix: avoid default values for nested properties --- .../src/api/iam/v1alpha1/marshalling.gen.ts | 6 +----- .../src/api/instance/v1/marshalling.gen.ts | 18 +++++------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts index 4a05a7923..d7d093f69 100644 --- a/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts @@ -500,11 +500,7 @@ const marshalRuleSpecs = ( permission_set_names: request.permissionSetNames, ...resolveOneOf([ { param: 'project_ids', value: request.projectIds }, - { - default: defaults.defaultOrganizationId, - param: 'organization_id', - value: request.organizationId, - }, + { param: 'organization_id', value: request.organizationId }, ]), }) diff --git a/packages/clients/src/api/instance/v1/marshalling.gen.ts b/packages/clients/src/api/instance/v1/marshalling.gen.ts index 5eb127a03..329b7eea7 100644 --- a/packages/clients/src/api/instance/v1/marshalling.gen.ts +++ b/packages/clients/src/api/instance/v1/marshalling.gen.ts @@ -1555,16 +1555,8 @@ const marshalVolumeTemplate = ( size: request.size, volume_type: request.volumeType, ...resolveOneOf([ - { - default: defaults.defaultProjectId, - param: 'project', - value: request.project, - }, - { - default: defaults.defaultOrganizationId, - param: 'organization', - value: request.organization, - }, + { param: 'project', value: request.project }, + { param: 'organization', value: request.organization }, ]), }) @@ -1705,8 +1697,8 @@ const marshalVolumeServerTemplate = ( boot: request.boot, id: request.id, name: request.name, - organization: request.organization ?? defaults.defaultOrganizationId, - project: request.project ?? defaults.defaultProjectId, + organization: request.organization, + project: request.project, size: request.size, volume_type: request.volumeType, }) @@ -2011,7 +2003,7 @@ const marshalSetSecurityGroupRulesRequestRule = ( ip_range: request.ipRange, position: request.position, protocol: request.protocol, - zone: request.zone ?? defaults.defaultZone, + zone: request.zone, }) export const marshalSetSecurityGroupRulesRequest = ( From 65cd5e9217cc9bccad23144834cb57b3f2277fd3 Mon Sep 17 00:00:00 2001 From: Nathanael DEMACON Date: Tue, 7 Nov 2023 11:07:20 +0100 Subject: [PATCH 08/10] chore(release): publish - @scaleway/sdk@2.0.0-alpha.18 --- packages/clients/CHANGELOG.md | 12 ++++++++++++ packages/clients/package.json | 2 +- packages/clients/src/scw/constants.ts | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/clients/CHANGELOG.md b/packages/clients/CHANGELOG.md index 876958008..7f1fa2664 100644 --- a/packages/clients/CHANGELOG.md +++ b/packages/clients/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.0.0-alpha.18](https://github.com/scaleway/scaleway-sdk-js/compare/@scaleway/sdk@1.42.0...@scaleway/sdk@2.0.0-alpha.18) (2023-11-07) + +### Features + +- generation ([d32b6ee](https://github.com/scaleway/scaleway-sdk-js/commit/d32b6eeca6300e03b4a5bb762f8ded40adcbf176)) +- update ([4eb5584](https://github.com/scaleway/scaleway-sdk-js/commit/4eb55849aa737cfadb92693edfe06e3e2ff28513)) +- v2 ([0d7ed77](https://github.com/scaleway/scaleway-sdk-js/commit/0d7ed7771ac79057ddd4ade63126582d38438851)) + +### Bug Fixes + +- avoid default values for nested properties ([b619281](https://github.com/scaleway/scaleway-sdk-js/commit/b61928183a409e9c221d50a0f4f8b30b145cda64)) + ## [1.42.0](https://github.com/scaleway/scaleway-sdk-js/compare/@scaleway/sdk@1.41.0...@scaleway/sdk@1.42.0) (2023-11-06) ### Features diff --git a/packages/clients/package.json b/packages/clients/package.json index 99a115182..6ae85fe83 100644 --- a/packages/clients/package.json +++ b/packages/clients/package.json @@ -1,6 +1,6 @@ { "name": "@scaleway/sdk", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "license": "Apache-2.0", "description": "Scaleway SDK.", "keywords": [ diff --git a/packages/clients/src/scw/constants.ts b/packages/clients/src/scw/constants.ts index 955619ef2..709da46dd 100644 --- a/packages/clients/src/scw/constants.ts +++ b/packages/clients/src/scw/constants.ts @@ -1,3 +1,3 @@ -export const version = 'v2.0.0-alpha.17' +export const version = 'v2.0.0-alpha.18' export const userAgent = `scaleway-sdk-js/${version}` From 5645dc44c77ad19eb11516552b5a63829282bf58 Mon Sep 17 00:00:00 2001 From: Vincent Germain Date: Tue, 7 Nov 2023 15:52:19 +0100 Subject: [PATCH 09/10] chore: prepare major release --- .github/workflows/deploy-package.yml | 2 +- packages/clients/CHANGELOG.md | 12 ------------ packages/clients/package.json | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/deploy-package.yml b/.github/workflows/deploy-package.yml index b94a30a09..e7d2fbaca 100644 --- a/.github/workflows/deploy-package.yml +++ b/.github/workflows/deploy-package.yml @@ -33,7 +33,7 @@ jobs: - run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: pnpm lerna publish -y --create-release github + - run: pnpm lerna publish -y --bump major --create-release github env: HUSKY: 0 GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/packages/clients/CHANGELOG.md b/packages/clients/CHANGELOG.md index 7f1fa2664..876958008 100644 --- a/packages/clients/CHANGELOG.md +++ b/packages/clients/CHANGELOG.md @@ -3,18 +3,6 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [2.0.0-alpha.18](https://github.com/scaleway/scaleway-sdk-js/compare/@scaleway/sdk@1.42.0...@scaleway/sdk@2.0.0-alpha.18) (2023-11-07) - -### Features - -- generation ([d32b6ee](https://github.com/scaleway/scaleway-sdk-js/commit/d32b6eeca6300e03b4a5bb762f8ded40adcbf176)) -- update ([4eb5584](https://github.com/scaleway/scaleway-sdk-js/commit/4eb55849aa737cfadb92693edfe06e3e2ff28513)) -- v2 ([0d7ed77](https://github.com/scaleway/scaleway-sdk-js/commit/0d7ed7771ac79057ddd4ade63126582d38438851)) - -### Bug Fixes - -- avoid default values for nested properties ([b619281](https://github.com/scaleway/scaleway-sdk-js/commit/b61928183a409e9c221d50a0f4f8b30b145cda64)) - ## [1.42.0](https://github.com/scaleway/scaleway-sdk-js/compare/@scaleway/sdk@1.41.0...@scaleway/sdk@1.42.0) (2023-11-06) ### Features diff --git a/packages/clients/package.json b/packages/clients/package.json index 6ae85fe83..b74432756 100644 --- a/packages/clients/package.json +++ b/packages/clients/package.json @@ -1,6 +1,6 @@ { "name": "@scaleway/sdk", - "version": "2.0.0-alpha.18", + "version": "1.42.0", "license": "Apache-2.0", "description": "Scaleway SDK.", "keywords": [ From 190dfb0e0b9f9c034c0e55096460ac59b5436b39 Mon Sep 17 00:00:00 2001 From: Vincent Germain Date: Tue, 7 Nov 2023 15:53:46 +0100 Subject: [PATCH 10/10] chore: prepare release --- packages/clients/src/scw/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/clients/src/scw/constants.ts b/packages/clients/src/scw/constants.ts index 709da46dd..76ff66f6c 100644 --- a/packages/clients/src/scw/constants.ts +++ b/packages/clients/src/scw/constants.ts @@ -1,3 +1,3 @@ -export const version = 'v2.0.0-alpha.18' +export const version = 'v2.0.0' export const userAgent = `scaleway-sdk-js/${version}`