From 88b47986f40d2b3957dd593a613c703b57dee392 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Tue, 21 May 2024 14:10:13 +0000 Subject: [PATCH] feat: update generated APIs --- .../clients/src/api/instance/v1/api.gen.ts | 37 +++++++++++++++++++ .../clients/src/api/instance/v1/index.gen.ts | 3 ++ .../src/api/instance/v1/marshalling.gen.ts | 19 ++++++++++ .../clients/src/api/instance/v1/types.gen.ts | 28 ++++++++++++++ 4 files changed, 87 insertions(+) diff --git a/packages/clients/src/api/instance/v1/api.gen.ts b/packages/clients/src/api/instance/v1/api.gen.ts index 4fc8bcd6b..ac19b5856 100644 --- a/packages/clients/src/api/instance/v1/api.gen.ts +++ b/packages/clients/src/api/instance/v1/api.gen.ts @@ -55,6 +55,7 @@ import { unmarshalExportSnapshotResponse, unmarshalGetBootscriptResponse, unmarshalGetDashboardResponse, + unmarshalGetEncryptedRdpPasswordResponse, unmarshalGetImageResponse, unmarshalGetIpResponse, unmarshalGetPlacementGroupResponse, @@ -123,6 +124,7 @@ import type { CreateSnapshotResponse, CreateVolumeRequest, CreateVolumeResponse, + DeleteEncryptedRdpPasswordRequest, DeleteImageRequest, DeleteIpRequest, DeletePlacementGroupRequest, @@ -141,6 +143,8 @@ import type { GetBootscriptResponse, GetDashboardRequest, GetDashboardResponse, + GetEncryptedRdpPasswordRequest, + GetEncryptedRdpPasswordResponse, GetImageRequest, GetImageResponse, GetIpRequest, @@ -1622,4 +1626,37 @@ export class API extends ParentAPI { method: 'POST', path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/block-migration/apply`, }) + + /** + * Get the encrypted RDP password. Get the initial administrator password for + * Windows RDP. This password is encrypted using the SSH RSA key specified at + * the time of Instance creation. + * + * @param request - The request {@link GetEncryptedRdpPasswordRequest} + * @returns A Promise of GetEncryptedRdpPasswordResponse + */ + getEncryptedRdpPassword = ( + request: Readonly, + ) => + this.client.fetch( + { + method: 'GET', + path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/encrypted_rdp_password`, + }, + unmarshalGetEncryptedRdpPasswordResponse, + ) + + /** + * Delete the encrypted RDP password. Delete the initial administrator + * password for Windows RDP. + * + * @param request - The request {@link DeleteEncryptedRdpPasswordRequest} + */ + deleteEncryptedRdpPassword = ( + request: Readonly, + ) => + this.client.fetch({ + method: 'DELETE', + path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/encrypted_rdp_password`, + }) } diff --git a/packages/clients/src/api/instance/v1/index.gen.ts b/packages/clients/src/api/instance/v1/index.gen.ts index 34e0654d2..f0a83fa8e 100644 --- a/packages/clients/src/api/instance/v1/index.gen.ts +++ b/packages/clients/src/api/instance/v1/index.gen.ts @@ -29,6 +29,7 @@ export type { CreateVolumeRequest, CreateVolumeResponse, Dashboard, + DeleteEncryptedRdpPasswordRequest, DeleteImageRequest, DeleteIpRequest, DeletePlacementGroupRequest, @@ -47,6 +48,8 @@ export type { GetBootscriptResponse, GetDashboardRequest, GetDashboardResponse, + GetEncryptedRdpPasswordRequest, + GetEncryptedRdpPasswordResponse, GetImageRequest, GetImageResponse, GetIpRequest, diff --git a/packages/clients/src/api/instance/v1/marshalling.gen.ts b/packages/clients/src/api/instance/v1/marshalling.gen.ts index 86b7e44d3..01b800d88 100644 --- a/packages/clients/src/api/instance/v1/marshalling.gen.ts +++ b/packages/clients/src/api/instance/v1/marshalling.gen.ts @@ -39,6 +39,7 @@ import type { ExportSnapshotResponse, GetBootscriptResponse, GetDashboardResponse, + GetEncryptedRdpPasswordResponse, GetImageResponse, GetIpResponse, GetPlacementGroupResponse, @@ -800,6 +801,23 @@ export const unmarshalGetDashboardResponse = ( } as GetDashboardResponse } +export const unmarshalGetEncryptedRdpPasswordResponse = ( + data: unknown, +): GetEncryptedRdpPasswordResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetEncryptedRdpPasswordResponse' failed as data isn't a dictionary.`, + ) + } + + return { + adminPasswordEncryptionSshKeyDescription: + data.admin_password_encryption_ssh_key_description, + adminPasswordEncryptionSshKeyId: data.admin_password_encryption_ssh_key_id, + value: data.value, + } as GetEncryptedRdpPasswordResponse +} + export const unmarshalGetImageResponse = (data: unknown): GetImageResponse => { if (!isJSONObject(data)) { throw new TypeError( @@ -1818,6 +1836,7 @@ export const marshalCreateServerRequest = ( request: CreateServerRequest, defaults: DefaultValues, ): Record => ({ + admin_password_encryption_ssh_key_id: request.adminPasswordEncryptionSshKeyId, boot_type: request.bootType, bootscript: request.bootscript, commercial_type: request.commercialType, diff --git a/packages/clients/src/api/instance/v1/types.gen.ts b/packages/clients/src/api/instance/v1/types.gen.ts index 4fa478ae1..50daffcdd 100644 --- a/packages/clients/src/api/instance/v1/types.gen.ts +++ b/packages/clients/src/api/instance/v1/types.gen.ts @@ -1035,6 +1035,11 @@ export type CreateServerRequest = { securityGroup?: string /** Placement group ID if Instance must be part of a placement group. */ placementGroup?: string + /** + * UUID of the SSH RSA key that will be used to encrypt the initial admin + * password for OS requiring it. Mandatory for Windows OS. + */ + adminPasswordEncryptionSshKeyId?: string } export interface CreateServerResponse { @@ -1123,6 +1128,13 @@ export interface CreateVolumeResponse { volume?: Volume } +export type DeleteEncryptedRdpPasswordRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the Instance. */ + serverId: string +} + export type DeleteImageRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone @@ -1243,6 +1255,22 @@ export interface GetDashboardResponse { dashboard?: Dashboard } +export type GetEncryptedRdpPasswordRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** UUID of the Instance. */ + serverId: string +} + +export interface GetEncryptedRdpPasswordResponse { + /** The encrypted RDP password. */ + value?: string + /** The description of the SSH key used for ciphering. */ + adminPasswordEncryptionSshKeyDescription?: string + /** The UUID of the SSH key used for ciphering. */ + adminPasswordEncryptionSshKeyId?: string +} + export type GetImageRequest = { /** Zone to target. If none is passed will use default zone from the config. */ zone?: Zone