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
18 changes: 18 additions & 0 deletions packages/clients/src/api/baremetal/v1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import type {
ListServersResponse,
ListSettingsRequest,
ListSettingsResponse,
MigrateServerToMonthlyOfferRequest,
OS,
Offer,
Option,
Expand Down Expand Up @@ -517,6 +518,23 @@ export class API extends ParentAPI {
unmarshalServer,
)

/**
* Migrate server offer. Migrate server with hourly offer to monthly offer.
*
* @param request - The request {@link MigrateServerToMonthlyOfferRequest}
* @returns A Promise of Server
*/
migrateServerToMonthlyOffer = (
request: Readonly<MigrateServerToMonthlyOfferRequest>,
) =>
this.client.fetch<Server>(
{
method: 'POST',
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/migrate-offer-monthly`,
},
unmarshalServer,
)

protected pageOfListOffers = (request: Readonly<ListOffersRequest> = {}) =>
this.client.fetch<ListOffersResponse>(
{
Expand Down
1 change: 1 addition & 0 deletions packages/clients/src/api/baremetal/v1/content.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export const SERVER_TRANSIENT_STATUSES: ServerStatus[] = [
'deleting',
'ordered',
'resetting',
'migrating',
]
1 change: 1 addition & 0 deletions packages/clients/src/api/baremetal/v1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export type {
ListSettingsRequestOrderBy,
ListSettingsResponse,
Memory,
MigrateServerToMonthlyOfferRequest,
OS,
OSOSField,
Offer,
Expand Down
1 change: 1 addition & 0 deletions packages/clients/src/api/baremetal/v1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ export const unmarshalOffer = (data: unknown): Offer => {
incompatibleOsIds: data.incompatible_os_ids,
maxBandwidth: data.max_bandwidth,
memories: unmarshalArrayOfObject(data.memories, unmarshalMemory),
monthlyOfferId: data.monthly_offer_id,
name: data.name,
operationPath: data.operation_path,
options: unmarshalArrayOfObject(data.options, unmarshalOfferOptionOffer),
Expand Down
10 changes: 10 additions & 0 deletions packages/clients/src/api/baremetal/v1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export type ServerStatus =
| 'out_of_stock'
| 'ordered'
| 'resetting'
| 'migrating'

export type SettingType = 'unknown' | 'smtp'

Expand Down Expand Up @@ -479,6 +480,8 @@ export interface Offer {
tags: string[]
/** GPU specifications of the offer. */
gpus: GPU[]
/** Exist only for hourly offers, to migrate to the monthly offer. */
monthlyOfferId?: string
}

export interface Option {
Expand Down Expand Up @@ -900,6 +903,13 @@ export interface ListSettingsResponse {
settings: Setting[]
}

export type MigrateServerToMonthlyOfferRequest = {
/** Zone to target. If none is passed will use default zone from the config. */
zone?: ScwZone
/** ID of the server. */
serverId: string
}

export type PrivateNetworkApiAddServerPrivateNetworkRequest = {
/** Zone to target. If none is passed will use default zone from the config. */
zone?: ScwZone
Expand Down
Loading