Skip to content

Commit 9be8437

Browse files
authored
feat(instance): move EncryptedRdpPassword elements to Server (#1298)
1 parent 41c840e commit 9be8437

File tree

5 files changed

+31
-85
lines changed

5 files changed

+31
-85
lines changed

packages/clients/src/api/instance/v1/api.gen.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import {
5555
unmarshalExportSnapshotResponse,
5656
unmarshalGetBootscriptResponse,
5757
unmarshalGetDashboardResponse,
58-
unmarshalGetEncryptedRdpPasswordResponse,
5958
unmarshalGetImageResponse,
6059
unmarshalGetIpResponse,
6160
unmarshalGetPlacementGroupResponse,
@@ -124,7 +123,6 @@ import type {
124123
CreateSnapshotResponse,
125124
CreateVolumeRequest,
126125
CreateVolumeResponse,
127-
DeleteEncryptedRdpPasswordRequest,
128126
DeleteImageRequest,
129127
DeleteIpRequest,
130128
DeletePlacementGroupRequest,
@@ -143,8 +141,6 @@ import type {
143141
GetBootscriptResponse,
144142
GetDashboardRequest,
145143
GetDashboardResponse,
146-
GetEncryptedRdpPasswordRequest,
147-
GetEncryptedRdpPasswordResponse,
148144
GetImageRequest,
149145
GetImageResponse,
150146
GetIpRequest,
@@ -1626,37 +1622,4 @@ export class API extends ParentAPI {
16261622
method: 'POST',
16271623
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/block-migration/apply`,
16281624
})
1629-
1630-
/**
1631-
* Get the encrypted RDP password. Get the initial administrator password for
1632-
* Windows RDP. This password is encrypted using the SSH RSA key specified at
1633-
* the time of Instance creation.
1634-
*
1635-
* @param request - The request {@link GetEncryptedRdpPasswordRequest}
1636-
* @returns A Promise of GetEncryptedRdpPasswordResponse
1637-
*/
1638-
getEncryptedRdpPassword = (
1639-
request: Readonly<GetEncryptedRdpPasswordRequest>,
1640-
) =>
1641-
this.client.fetch<GetEncryptedRdpPasswordResponse>(
1642-
{
1643-
method: 'GET',
1644-
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/encrypted_rdp_password`,
1645-
},
1646-
unmarshalGetEncryptedRdpPasswordResponse,
1647-
)
1648-
1649-
/**
1650-
* Delete the encrypted RDP password. Delete the initial administrator
1651-
* password for Windows RDP.
1652-
*
1653-
* @param request - The request {@link DeleteEncryptedRdpPasswordRequest}
1654-
*/
1655-
deleteEncryptedRdpPassword = (
1656-
request: Readonly<DeleteEncryptedRdpPasswordRequest>,
1657-
) =>
1658-
this.client.fetch<void>({
1659-
method: 'DELETE',
1660-
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/encrypted_rdp_password`,
1661-
})
16621625
}

packages/clients/src/api/instance/v1/index.gen.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export type {
2929
CreateVolumeRequest,
3030
CreateVolumeResponse,
3131
Dashboard,
32-
DeleteEncryptedRdpPasswordRequest,
3332
DeleteImageRequest,
3433
DeleteIpRequest,
3534
DeletePlacementGroupRequest,
@@ -48,8 +47,6 @@ export type {
4847
GetBootscriptResponse,
4948
GetDashboardRequest,
5049
GetDashboardResponse,
51-
GetEncryptedRdpPasswordRequest,
52-
GetEncryptedRdpPasswordResponse,
5350
GetImageRequest,
5451
GetImageResponse,
5552
GetIpRequest,

packages/clients/src/api/instance/v1/marshalling.gen.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import type {
3939
ExportSnapshotResponse,
4040
GetBootscriptResponse,
4141
GetDashboardResponse,
42-
GetEncryptedRdpPasswordResponse,
4342
GetImageResponse,
4443
GetIpResponse,
4544
GetPlacementGroupResponse,
@@ -395,6 +394,8 @@ const unmarshalServer = (data: unknown): Server => {
395394
}
396395

397396
return {
397+
adminPasswordEncryptedValue: data.admin_password_encrypted_value,
398+
adminPasswordEncryptionSshKeyId: data.admin_password_encryption_ssh_key_id,
398399
allowedActions: data.allowed_actions,
399400
arch: data.arch,
400401
bootType: data.boot_type,
@@ -801,23 +802,6 @@ export const unmarshalGetDashboardResponse = (
801802
} as GetDashboardResponse
802803
}
803804

804-
export const unmarshalGetEncryptedRdpPasswordResponse = (
805-
data: unknown,
806-
): GetEncryptedRdpPasswordResponse => {
807-
if (!isJSONObject(data)) {
808-
throw new TypeError(
809-
`Unmarshalling the type 'GetEncryptedRdpPasswordResponse' failed as data isn't a dictionary.`,
810-
)
811-
}
812-
813-
return {
814-
adminPasswordEncryptionSshKeyDescription:
815-
data.admin_password_encryption_ssh_key_description,
816-
adminPasswordEncryptionSshKeyId: data.admin_password_encryption_ssh_key_id,
817-
value: data.value,
818-
} as GetEncryptedRdpPasswordResponse
819-
}
820-
821805
export const unmarshalGetImageResponse = (data: unknown): GetImageResponse => {
822806
if (!isJSONObject(data)) {
823807
throw new TypeError(
@@ -2267,6 +2251,7 @@ export const marshalSetServerRequest = (
22672251
request: SetServerRequest,
22682252
defaults: DefaultValues,
22692253
): Record<string, unknown> => ({
2254+
admin_password_encryption_ssh_key_id: request.adminPasswordEncryptionSshKeyId,
22702255
allowed_actions:
22712256
request.allowedActions !== undefined ? request.allowedActions : undefined,
22722257
arch: request.arch,
@@ -2467,6 +2452,7 @@ export const marshalUpdateServerRequest = (
24672452
request: UpdateServerRequest,
24682453
defaults: DefaultValues,
24692454
): Record<string, unknown> => ({
2455+
admin_password_encryption_ssh_key_id: request.adminPasswordEncryptionSshKeyId,
24702456
boot_type: request.bootType,
24712457
bootscript: request.bootscript,
24722458
commercial_type: request.commercialType,

packages/clients/src/api/instance/v1/types.gen.ts

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,18 @@ export interface Server {
464464
privateNics: PrivateNIC[]
465465
/** Zone in which the Instance is located. */
466466
zone: Zone
467+
/**
468+
* The public_key value of this key is used to encrypt the admin password.
469+
* When set to an empty string, reset this value and
470+
* admin_password_encrypted_value to an empty string so a new password may be
471+
* generated.
472+
*/
473+
adminPasswordEncryptionSshKeyId?: string
474+
/**
475+
* This value is reset when admin_password_encryption_ssh_key_id is set to an
476+
* empty string.
477+
*/
478+
adminPasswordEncryptedValue?: string
467479
}
468480

469481
export interface VolumeTemplate {
@@ -1035,10 +1047,7 @@ export type CreateServerRequest = {
10351047
securityGroup?: string
10361048
/** Placement group ID if Instance must be part of a placement group. */
10371049
placementGroup?: string
1038-
/**
1039-
* UUID of the SSH RSA key that will be used to encrypt the initial admin
1040-
* password for OS requiring it. Mandatory for Windows OS.
1041-
*/
1050+
/** The public_key value of this key is used to encrypt the admin password. */
10421051
adminPasswordEncryptionSshKeyId?: string
10431052
}
10441053

@@ -1128,13 +1137,6 @@ export interface CreateVolumeResponse {
11281137
volume?: Volume
11291138
}
11301139

1131-
export type DeleteEncryptedRdpPasswordRequest = {
1132-
/** Zone to target. If none is passed will use default zone from the config. */
1133-
zone?: Zone
1134-
/** UUID of the Instance. */
1135-
serverId: string
1136-
}
1137-
11381140
export type DeleteImageRequest = {
11391141
/** Zone to target. If none is passed will use default zone from the config. */
11401142
zone?: Zone
@@ -1255,22 +1257,6 @@ export interface GetDashboardResponse {
12551257
dashboard?: Dashboard
12561258
}
12571259

1258-
export type GetEncryptedRdpPasswordRequest = {
1259-
/** Zone to target. If none is passed will use default zone from the config. */
1260-
zone?: Zone
1261-
/** UUID of the Instance. */
1262-
serverId: string
1263-
}
1264-
1265-
export interface GetEncryptedRdpPasswordResponse {
1266-
/** The encrypted RDP password. */
1267-
value?: string
1268-
/** The description of the SSH key used for ciphering. */
1269-
adminPasswordEncryptionSshKeyDescription?: string
1270-
/** The UUID of the SSH key used for ciphering. */
1271-
adminPasswordEncryptionSshKeyId?: string
1272-
}
1273-
12741260
export type GetImageRequest = {
12751261
/** Zone to target. If none is passed will use default zone from the config. */
12761262
zone?: Zone
@@ -2068,6 +2054,13 @@ export type UpdateServerRequest = {
20682054
* DEV1-S, which has only 20GB).
20692055
*/
20702056
commercialType?: string
2057+
/**
2058+
* The public_key value of this key is used to encrypt the admin password.
2059+
* When set to an empty string, reset this value and
2060+
* admin_password_encrypted_value to an empty string so a new password may be
2061+
* generated.
2062+
*/
2063+
adminPasswordEncryptionSshKeyId?: string
20712064
}
20722065

20732066
export interface UpdateServerResponse {

packages/clients/src/api/instance/v1/types.private.gen.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ export type SetServerRequest = {
177177
placementGroup?: PlacementGroup
178178
/** Instance private NICs. */
179179
privateNics?: PrivateNIC[]
180+
/**
181+
* The public_key value of this key is used to encrypt the admin password.
182+
* When set to an empty string, reset this value and
183+
* admin_password_encrypted_value to an empty string so a new password may be
184+
* generated.
185+
*/
186+
adminPasswordEncryptionSshKeyId?: string
180187
}
181188

182189
export interface SetServerResponse {

0 commit comments

Comments
 (0)