Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions packages/clients/src/api/instance/v1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import type { Zone } from '../../../bridge'
import {
marshalApplyBlockMigrationRequest,
marshalAttachServerVolumeRequest,
marshalCreateImageRequest,
marshalCreateIpRequest,
marshalCreatePlacementGroupRequest,
Expand All @@ -18,6 +19,7 @@ import {
marshalCreateServerRequest,
marshalCreateSnapshotRequest,
marshalCreateVolumeRequest,
marshalDetachServerVolumeRequest,
marshalExportSnapshotRequest,
marshalPlanBlockMigrationRequest,
marshalServerActionRequest,
Expand All @@ -35,6 +37,7 @@ import {
marshalUpdatePrivateNICRequest,
marshalUpdateServerRequest,
marshalUpdateVolumeRequest,
unmarshalAttachServerVolumeResponse,
unmarshalCreateImageResponse,
unmarshalCreateIpResponse,
unmarshalCreatePlacementGroupResponse,
Expand All @@ -44,6 +47,7 @@ import {
unmarshalCreateServerResponse,
unmarshalCreateSnapshotResponse,
unmarshalCreateVolumeResponse,
unmarshalDetachServerVolumeResponse,
unmarshalExportSnapshotResponse,
unmarshalGetBootscriptResponse,
unmarshalGetDashboardResponse,
Expand Down Expand Up @@ -91,6 +95,8 @@ import {
} from './marshalling.gen'
import type {
ApplyBlockMigrationRequest,
AttachServerVolumeRequest,
AttachServerVolumeResponse,
CreateImageRequest,
CreateImageResponse,
CreateIpRequest,
Expand Down Expand Up @@ -119,6 +125,8 @@ import type {
DeleteServerUserDataRequest,
DeleteSnapshotRequest,
DeleteVolumeRequest,
DetachServerVolumeRequest,
DetachServerVolumeResponse,
ExportSnapshotRequest,
ExportSnapshotResponse,
GetBootscriptRequest,
Expand Down Expand Up @@ -526,6 +534,56 @@ export class API extends ParentAPI {
)}/user_data/${validatePathParam('key', request.key)}`,
})

/**
* Attach a volume to a server.
*
* @param request - The request {@link AttachServerVolumeRequest}
* @returns A Promise of AttachServerVolumeResponse
*/
attachServerVolume = (request: Readonly<AttachServerVolumeRequest>) =>
this.client.fetch<AttachServerVolumeResponse>(
{
body: JSON.stringify(
marshalAttachServerVolumeRequest(request, this.client.settings),
),
headers: jsonContentHeaders,
method: 'POST',
path: `/instance/v1/zones/${validatePathParam(
'zone',
request.zone ?? this.client.settings.defaultZone,
)}/servers/${validatePathParam(
'serverId',
request.serverId,
)}/attach-volume`,
},
unmarshalAttachServerVolumeResponse,
)

/**
* Detach a volume from a server.
*
* @param request - The request {@link DetachServerVolumeRequest}
* @returns A Promise of DetachServerVolumeResponse
*/
detachServerVolume = (request: Readonly<DetachServerVolumeRequest>) =>
this.client.fetch<DetachServerVolumeResponse>(
{
body: JSON.stringify(
marshalDetachServerVolumeRequest(request, this.client.settings),
),
headers: jsonContentHeaders,
method: 'POST',
path: `/instance/v1/zones/${validatePathParam(
'zone',
request.zone ?? this.client.settings.defaultZone,
)}/servers/${validatePathParam(
'serverId',
request.serverId,
)}/detach-volume`,
},
unmarshalDetachServerVolumeResponse,
)

protected pageOfListImages = (request: Readonly<ListImagesRequest> = {}) =>
this.client.fetch<ListImagesResponse>(
{
Expand Down
5 changes: 5 additions & 0 deletions packages/clients/src/api/instance/v1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export * from './content.gen'
export type {
ApplyBlockMigrationRequest,
Arch,
AttachServerVolumeRequest,
AttachServerVolumeRequestVolumeType,
AttachServerVolumeResponse,
BootType,
Bootscript,
CreateImageRequest,
Expand Down Expand Up @@ -36,6 +39,8 @@ export type {
DeleteServerUserDataRequest,
DeleteSnapshotRequest,
DeleteVolumeRequest,
DetachServerVolumeRequest,
DetachServerVolumeResponse,
ExportSnapshotRequest,
ExportSnapshotResponse,
GetBootscriptRequest,
Expand Down
Loading