Skip to content

Commit 5e49fb9

Browse files
committed
feat(instance): create CheckQuotasOrganizationBlockMigration endpoint
1 parent f04a200 commit 5e49fb9

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { Zone } from '../../../bridge'
1010
import {
1111
marshalApplyBlockMigrationRequest,
1212
marshalAttachServerVolumeRequest,
13+
marshalCheckBlockMigrationOrganizationQuotasRequest,
1314
marshalCreateImageRequest,
1415
marshalCreateIpRequest,
1516
marshalCreatePlacementGroupRequest,
@@ -103,6 +104,7 @@ import type {
103104
ApplyBlockMigrationRequest,
104105
AttachServerVolumeRequest,
105106
AttachServerVolumeResponse,
107+
CheckBlockMigrationOrganizationQuotasRequest,
106108
CreateImageRequest,
107109
CreateImageResponse,
108110
CreateIpRequest,
@@ -1588,4 +1590,19 @@ export class API extends ParentAPI {
15881590
method: 'POST',
15891591
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/block-migration/apply`,
15901592
})
1593+
1594+
checkBlockMigrationOrganizationQuotas = (
1595+
request: Readonly<CheckBlockMigrationOrganizationQuotasRequest> = {},
1596+
) =>
1597+
this.client.fetch<void>({
1598+
body: JSON.stringify(
1599+
marshalCheckBlockMigrationOrganizationQuotasRequest(
1600+
request,
1601+
this.client.settings,
1602+
),
1603+
),
1604+
headers: jsonContentHeaders,
1605+
method: 'POST',
1606+
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/block-migration/check-organization-quotas`,
1607+
})
15911608
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ export class InstanceV1UtilsAPI extends API {
266266
zone: request.zone,
267267
}).then(res => validateNotUndefined(res.server?.volumes))
268268

269-
const newVolumes: Record<string, { id: string; name: string | undefined }> = {}
269+
const newVolumes: Record<string, { id: string; name: string | undefined }> =
270+
{}
270271
for (const [key, server] of Object.entries(volumes)) {
271272
newVolumes[key] = { id: server.id, name: server.name }
272273
}
@@ -322,7 +323,8 @@ export class InstanceV1UtilsAPI extends API {
322323
.then(res => validateNotUndefined(res.server))
323324

324325
// Remove volume.
325-
const newVolumes: Record<string, { id: string; name: string | undefined }> = {}
326+
const newVolumes: Record<string, { id: string; name: string | undefined }> =
327+
{}
326328
for (const [key, volume] of Object.entries(server.volumes)) {
327329
if (volume.id !== request.volumeId) {
328330
newVolumes[key] = { id: volume.id, name: volume.name }

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type {
1010
AttachServerVolumeResponse,
1111
BootType,
1212
Bootscript,
13+
CheckBlockMigrationOrganizationQuotasRequest,
1314
CreateImageRequest,
1415
CreateImageResponse,
1516
CreateIpRequest,

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type {
1414
AttachServerVolumeRequest,
1515
AttachServerVolumeResponse,
1616
Bootscript,
17+
CheckBlockMigrationOrganizationQuotasRequest,
1718
CreateImageRequest,
1819
CreateImageResponse,
1920
CreateIpRequest,
@@ -1624,6 +1625,13 @@ export const marshalAttachServerVolumeRequest = (
16241625
volume_type: request.volumeType,
16251626
})
16261627

1628+
export const marshalCheckBlockMigrationOrganizationQuotasRequest = (
1629+
request: CheckBlockMigrationOrganizationQuotasRequest,
1630+
defaults: DefaultValues,
1631+
): Record<string, unknown> => ({
1632+
organization: request.organization ?? defaults.defaultOrganizationId,
1633+
})
1634+
16271635
const marshalVolumeTemplate = (
16281636
request: VolumeTemplate,
16291637
defaults: DefaultValues,

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,12 @@ export interface AttachServerVolumeResponse {
801801
server?: Server
802802
}
803803

804+
export type CheckBlockMigrationOrganizationQuotasRequest = {
805+
/** Zone to target. If none is passed will use default zone from the config. */
806+
zone?: Zone
807+
organization?: string
808+
}
809+
804810
export type CreateImageRequest = {
805811
/** Zone to target. If none is passed will use default zone from the config. */
806812
zone?: Zone

0 commit comments

Comments
 (0)