From c3fe9481594da35828859887306b048ae18185b7 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Thu, 10 Nov 2022 08:49:02 +0000 Subject: [PATCH] feat: update generated APIs --- packages/clients/src/api/rdb/v1/api.gen.ts | 4 +-- .../clients/src/api/rdb/v1/marshalling.gen.ts | 24 ++++++++++++++++++ packages/clients/src/api/rdb/v1/types.gen.ts | 25 ++++++++++++++++--- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/packages/clients/src/api/rdb/v1/api.gen.ts b/packages/clients/src/api/rdb/v1/api.gen.ts index 9bfbc9959..7b831aba9 100644 --- a/packages/clients/src/api/rdb/v1/api.gen.ts +++ b/packages/clients/src/api/rdb/v1/api.gen.ts @@ -431,8 +431,8 @@ export class RdbV1GenAPI extends API { ) /** - * Upgrade your current `node_type` or enable high availability on your - * standalone database instance. + * Upgrade your current instance specifications like node type, high + * availability, volume, or db engine version. * * @param request - The request {@link UpgradeInstanceRequest} * @returns A Promise of Instance diff --git a/packages/clients/src/api/rdb/v1/marshalling.gen.ts b/packages/clients/src/api/rdb/v1/marshalling.gen.ts index 3022987a8..54885e26d 100644 --- a/packages/clients/src/api/rdb/v1/marshalling.gen.ts +++ b/packages/clients/src/api/rdb/v1/marshalling.gen.ts @@ -83,6 +83,7 @@ import type { UpdateInstanceRequest, UpdateSnapshotRequest, UpdateUserRequest, + UpgradableVersion, UpgradeInstanceRequest, User, Volume, @@ -290,6 +291,21 @@ export const unmarshalReadReplica = (data: unknown) => { } as ReadReplica } +const unmarshalUpgradableVersion = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'UpgradableVersion' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + minorVersion: data.minor_version, + name: data.name, + version: data.version, + } as UpgradableVersion +} + const unmarshalVolume = (data: unknown) => { if (!isJSONObject(data)) { throw new TypeError( @@ -413,6 +429,10 @@ export const unmarshalInstance = (data: unknown) => { settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting), status: data.status, tags: data.tags, + upgradableVersion: unmarshalArrayOfObject( + data.upgradable_version, + unmarshalUpgradableVersion, + ), volume: data.volume ? unmarshalVolume(data.volume) : undefined, } as Instance } @@ -1118,5 +1138,9 @@ export const marshalUpgradeInstanceRequest = ( param: 'volume_type', value: request.volumeType, }, + { + param: 'upgradable_version_id', + value: request.upgradableVersionId, + }, ]), }) diff --git a/packages/clients/src/api/rdb/v1/types.gen.ts b/packages/clients/src/api/rdb/v1/types.gen.ts index 94eda173c..8b5833a5b 100644 --- a/packages/clients/src/api/rdb/v1/types.gen.ts +++ b/packages/clients/src/api/rdb/v1/types.gen.ts @@ -368,6 +368,8 @@ export interface Instance { status: InstanceStatus /** Database engine of the database (PostgreSQL, MySQL, ...) */ engine: string + /** Available database engine versions for upgrade */ + upgradableVersion: Array /** @deprecated Endpoint of the instance */ endpoint?: Endpoint /** List of tags applied to the instance */ @@ -679,6 +681,13 @@ export interface Snapshot { region: Region } +export interface UpgradableVersion { + id: string + name: string + version: string + minorVersion: string +} + /** User */ export interface User { /** @@ -805,30 +814,38 @@ export type UpgradeInstanceRequest = { * Node type of the instance you want to upgrade to. * * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType' could be set. + * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. */ nodeType?: string /** * Set to true to enable high availability on your instance. * * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType' could be set. + * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. */ enableHa?: boolean /** * Increase your block storage volume size. * * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType' could be set. + * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. */ volumeSize?: number /** * Change your instance storage type. * * One-of ('upgradeTarget'): at most one of 'nodeType', 'enableHa', - * 'volumeSize', 'volumeType' could be set. + * 'volumeSize', 'volumeType', 'upgradableVersionId' could be set. */ volumeType?: VolumeType + /** + * This will create a new Database Instance with same instance specification + * 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. + */ + upgradableVersionId?: string } export type ListInstancesRequest = {