From cbc655afd59b6e9420b504c5d4973f2b8a627ea2 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Thu, 4 Apr 2024 12:26:16 +0000 Subject: [PATCH 1/2] feat: update generated APIs --- .../clients/src/api/dedibox/v1/api.gen.ts | 2047 +++++++++++++++ .../clients/src/api/dedibox/v1/content.gen.ts | 71 + .../clients/src/api/dedibox/v1/index.gen.ts | 267 ++ .../src/api/dedibox/v1/marshalling.gen.ts | 1954 ++++++++++++++ .../clients/src/api/dedibox/v1/types.gen.ts | 2317 +++++++++++++++++ .../api/dedibox/v1/validation-rules.gen.ts | 626 +++++ 6 files changed, 7282 insertions(+) create mode 100644 packages/clients/src/api/dedibox/v1/api.gen.ts create mode 100644 packages/clients/src/api/dedibox/v1/content.gen.ts create mode 100644 packages/clients/src/api/dedibox/v1/index.gen.ts create mode 100644 packages/clients/src/api/dedibox/v1/marshalling.gen.ts create mode 100644 packages/clients/src/api/dedibox/v1/types.gen.ts create mode 100644 packages/clients/src/api/dedibox/v1/validation-rules.gen.ts diff --git a/packages/clients/src/api/dedibox/v1/api.gen.ts b/packages/clients/src/api/dedibox/v1/api.gen.ts new file mode 100644 index 000000000..f1263c4c4 --- /dev/null +++ b/packages/clients/src/api/dedibox/v1/api.gen.ts @@ -0,0 +1,2047 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import { + API as ParentAPI, + enrichForPagination, + urlParams, + validatePathParam, + waitForResource, +} from '../../../bridge' +import type { WaitForOptions, Zone } from '../../../bridge' +import { + BMC_ACCESS_TRANSIENT_STATUSES, + RPN_SAN_TRANSIENT_STATUSES, + RPN_V2_GROUP_TRANSIENT_STATUSES, + SERVER_INSTALL_TRANSIENT_STATUSES, + SERVER_TRANSIENT_STATUSES, +} from './content.gen' +import { + marshalAttachFailoverIPToMacAddressRequest, + marshalAttachFailoverIPsRequest, + marshalCreateFailoverIPsRequest, + marshalCreateServerRequest, + marshalDetachFailoverIPsRequest, + marshalIPv6BlockApiCreateIPv6BlockRequest, + marshalIPv6BlockApiCreateIPv6BlockSubnetRequest, + marshalIPv6BlockApiUpdateIPv6BlockRequest, + marshalInstallServerRequest, + marshalRpnSanApiAddIpRequest, + marshalRpnSanApiCreateRpnSanRequest, + marshalRpnSanApiRemoveIpRequest, + marshalRpnV1ApiAddRpnGroupMembersRequest, + marshalRpnV1ApiCreateRpnGroupRequest, + marshalRpnV1ApiDeleteRpnGroupMembersRequest, + marshalRpnV1ApiLeaveRpnGroupRequest, + marshalRpnV1ApiRpnGroupInviteRequest, + marshalRpnV1ApiUpdateRpnGroupNameRequest, + marshalRpnV2ApiAddRpnV2MembersRequest, + marshalRpnV2ApiCreateRpnV2GroupRequest, + marshalRpnV2ApiDeleteRpnV2MembersRequest, + marshalRpnV2ApiEnableRpnV2GroupCompatibilityRequest, + marshalRpnV2ApiUpdateRpnV2GroupNameRequest, + marshalRpnV2ApiUpdateRpnV2VlanForMembersRequest, + marshalStartBMCAccessRequest, + marshalStartRescueRequest, + marshalSubscribeServerOptionRequest, + marshalSubscribeStorageOptionsRequest, + marshalUpdateRaidRequest, + marshalUpdateReverseRequest, + marshalUpdateServerBackupRequest, + marshalUpdateServerRequest, + marshalUpdateServerTagsRequest, + unmarshalBMCAccess, + unmarshalBackup, + unmarshalCanOrderResponse, + unmarshalCreateFailoverIPsResponse, + unmarshalFailoverIP, + unmarshalGetIPv6BlockQuotasResponse, + unmarshalGetRemainingQuotaResponse, + unmarshalGetRpnStatusResponse, + unmarshalIP, + unmarshalIPv6Block, + unmarshalInvoice, + unmarshalListFailoverIPsResponse, + unmarshalListIPv6BlockSubnetsAvailableResponse, + unmarshalListInvoicesResponse, + unmarshalListIpsResponse, + unmarshalListOSResponse, + unmarshalListOffersResponse, + unmarshalListRefundsResponse, + unmarshalListRpnCapableSanServersResponse, + unmarshalListRpnCapableServersResponse, + unmarshalListRpnGroupMembersResponse, + unmarshalListRpnGroupsResponse, + unmarshalListRpnInvitesResponse, + unmarshalListRpnSansResponse, + unmarshalListRpnServerCapabilitiesResponse, + unmarshalListRpnV2CapableResourcesResponse, + unmarshalListRpnV2GroupLogsResponse, + unmarshalListRpnV2GroupsResponse, + unmarshalListRpnV2MembersResponse, + unmarshalListServerDisksResponse, + unmarshalListServerEventsResponse, + unmarshalListServersResponse, + unmarshalListServicesResponse, + unmarshalListSubscribableServerOptionsResponse, + unmarshalOS, + unmarshalOffer, + unmarshalRaid, + unmarshalRefund, + unmarshalRescue, + unmarshalRpnGroup, + unmarshalRpnSan, + unmarshalRpnV2Group, + unmarshalServer, + unmarshalServerDefaultPartitioning, + unmarshalServerInstall, + unmarshalService, + unmarshalSubscribeStorageOptionsResponse, +} from './marshalling.gen' +import type { + AttachFailoverIPToMacAddressRequest, + AttachFailoverIPsRequest, + BMCAccess, + Backup, + BillingApiCanOrderRequest, + BillingApiDownloadInvoiceRequest, + BillingApiDownloadRefundRequest, + BillingApiGetInvoiceRequest, + BillingApiGetRefundRequest, + BillingApiListInvoicesRequest, + BillingApiListRefundsRequest, + CanOrderResponse, + CancelServerInstallRequest, + CreateFailoverIPsRequest, + CreateFailoverIPsResponse, + CreateServerRequest, + DeleteFailoverIPRequest, + DeleteServerRequest, + DeleteServiceRequest, + DetachFailoverIPFromMacAddressRequest, + DetachFailoverIPsRequest, + FailoverIP, + GetBMCAccessRequest, + GetFailoverIPRequest, + GetIPv6BlockQuotasResponse, + GetOSRequest, + GetOfferRequest, + GetOrderedServiceRequest, + GetRaidRequest, + GetRemainingQuotaRequest, + GetRemainingQuotaResponse, + GetRescueRequest, + GetRpnStatusResponse, + GetServerBackupRequest, + GetServerDefaultPartitioningRequest, + GetServerInstallRequest, + GetServerRequest, + GetServiceRequest, + IP, + IPv6Block, + IPv6BlockApiCreateIPv6BlockRequest, + IPv6BlockApiCreateIPv6BlockSubnetRequest, + IPv6BlockApiDeleteIPv6BlockRequest, + IPv6BlockApiGetIPv6BlockQuotasRequest, + IPv6BlockApiGetIPv6BlockRequest, + IPv6BlockApiListIPv6BlockSubnetsAvailableRequest, + IPv6BlockApiUpdateIPv6BlockRequest, + InstallServerRequest, + Invoice, + ListFailoverIPsRequest, + ListFailoverIPsResponse, + ListIPv6BlockSubnetsAvailableResponse, + ListInvoicesResponse, + ListIpsResponse, + ListOSRequest, + ListOSResponse, + ListOffersRequest, + ListOffersResponse, + ListRefundsResponse, + ListRpnCapableSanServersResponse, + ListRpnCapableServersResponse, + ListRpnGroupMembersResponse, + ListRpnGroupsResponse, + ListRpnInvitesResponse, + ListRpnSansResponse, + ListRpnServerCapabilitiesResponse, + ListRpnV2CapableResourcesResponse, + ListRpnV2GroupLogsResponse, + ListRpnV2GroupsResponse, + ListRpnV2MembersResponse, + ListServerDisksRequest, + ListServerDisksResponse, + ListServerEventsRequest, + ListServerEventsResponse, + ListServersRequest, + ListServersResponse, + ListServicesRequest, + ListServicesResponse, + ListSubscribableServerOptionsRequest, + ListSubscribableServerOptionsResponse, + OS, + Offer, + Raid, + RebootServerRequest, + Refund, + Rescue, + RpnApiGetRpnStatusRequest, + RpnApiListRpnServerCapabilitiesRequest, + RpnGroup, + RpnSan, + RpnSanApiAddIpRequest, + RpnSanApiCreateRpnSanRequest, + RpnSanApiDeleteRpnSanRequest, + RpnSanApiGetRpnSanRequest, + RpnSanApiListAvailableIpsRequest, + RpnSanApiListIpsRequest, + RpnSanApiListRpnSansRequest, + RpnSanApiRemoveIpRequest, + RpnV1ApiAcceptRpnInviteRequest, + RpnV1ApiAddRpnGroupMembersRequest, + RpnV1ApiCreateRpnGroupRequest, + RpnV1ApiDeleteRpnGroupMembersRequest, + RpnV1ApiDeleteRpnGroupRequest, + RpnV1ApiGetRpnGroupRequest, + RpnV1ApiLeaveRpnGroupRequest, + RpnV1ApiListRpnCapableSanServersRequest, + RpnV1ApiListRpnCapableServersRequest, + RpnV1ApiListRpnGroupMembersRequest, + RpnV1ApiListRpnGroupsRequest, + RpnV1ApiListRpnInvitesRequest, + RpnV1ApiRefuseRpnInviteRequest, + RpnV1ApiRpnGroupInviteRequest, + RpnV1ApiUpdateRpnGroupNameRequest, + RpnV2ApiAddRpnV2MembersRequest, + RpnV2ApiCreateRpnV2GroupRequest, + RpnV2ApiDeleteRpnV2GroupRequest, + RpnV2ApiDeleteRpnV2MembersRequest, + RpnV2ApiDisableRpnV2GroupCompatibilityRequest, + RpnV2ApiEnableRpnV2GroupCompatibilityRequest, + RpnV2ApiGetRpnV2GroupRequest, + RpnV2ApiListRpnV2CapableResourcesRequest, + RpnV2ApiListRpnV2GroupLogsRequest, + RpnV2ApiListRpnV2GroupsRequest, + RpnV2ApiListRpnV2MembersRequest, + RpnV2ApiUpdateRpnV2GroupNameRequest, + RpnV2ApiUpdateRpnV2VlanForMembersRequest, + RpnV2Group, + Server, + ServerDefaultPartitioning, + ServerInstall, + Service, + StartBMCAccessRequest, + StartRescueRequest, + StartServerRequest, + StopBMCAccessRequest, + StopRescueRequest, + StopServerRequest, + SubscribeServerOptionRequest, + SubscribeStorageOptionsRequest, + SubscribeStorageOptionsResponse, + UpdateRaidRequest, + UpdateReverseRequest, + UpdateServerBackupRequest, + UpdateServerRequest, + UpdateServerTagsRequest, +} from './types.gen' + +const jsonContentHeaders = { + 'Content-Type': 'application/json; charset=utf-8', +} + +/** Dedibox Phoenix API. */ +export class API extends ParentAPI { + /** Lists the available zones of the API. */ + public static readonly LOCALITIES: Zone[] = [ + 'fr-par-1', + 'fr-par-2', + 'nl-ams-1', + ] + + protected pageOfListServers = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + [ + 'project_id', + request.projectId ?? this.client.settings.defaultProjectId, + ], + ['search', request.search], + ), + }, + unmarshalListServersResponse, + ) + + /** + * List baremetal servers for project. + * + * @param request - The request {@link ListServersRequest} + * @returns A Promise of ListServersResponse + */ + listServers = (request: Readonly = {}) => + enrichForPagination('servers', this.pageOfListServers, request) + + /** + * Get a specific baremetal server. Get the server associated with the given + * ID. + * + * @param request - The request {@link GetServerRequest} + * @returns A Promise of Server + */ + getServer = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`, + }, + unmarshalServer, + ) + + /** + * Waits for {@link Server} to be in a final state. + * + * @param request - The request {@link GetServerRequest} + * @param options - The waiting options + * @returns A Promise of Server + */ + waitForServer = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve(!SERVER_TRANSIENT_STATUSES.includes(res.status))), + this.getServer, + request, + options, + ) + + getServerBackup = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/backups`, + }, + unmarshalBackup, + ) + + updateServerBackup = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateServerBackupRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/backups`, + }, + unmarshalBackup, + ) + + protected pageOfListSubscribableServerOptions = ( + request: Readonly, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/subscribable-server-options`, + urlParams: urlParams( + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ), + }, + unmarshalListSubscribableServerOptionsResponse, + ) + + /** + * List subscribable server options. List subscribable options associated to + * the given server ID. + * + * @param request - The request {@link ListSubscribableServerOptionsRequest} + * @returns A Promise of ListSubscribableServerOptionsResponse + */ + listSubscribableServerOptions = ( + request: Readonly, + ) => + enrichForPagination( + 'serverOptions', + this.pageOfListSubscribableServerOptions, + request, + ) + + /** + * Subscribe server option. Subscribe option for the given server ID. + * + * @param request - The request {@link SubscribeServerOptionRequest} + * @returns A Promise of Service + */ + subscribeServerOption = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalSubscribeServerOptionRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/subscribe-server-option`, + }, + unmarshalService, + ) + + /** + * Create a baremetal server. Create a new baremetal server. The order return + * you a service ID to follow the provisionning status you could call + * GetService. + * + * @param request - The request {@link CreateServerRequest} + * @returns A Promise of Service + */ + createServer = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateServerRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`, + }, + unmarshalService, + ) + + /** + * Subscribe storage server option. Subscribe storage option for the given + * server ID. + * + * @param request - The request {@link SubscribeStorageOptionsRequest} + * @returns A Promise of SubscribeStorageOptionsResponse + */ + subscribeStorageOptions = ( + request: Readonly, + ) => + this.client.fetch( + { + body: JSON.stringify( + marshalSubscribeStorageOptionsRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/subscribe-storage-options`, + }, + unmarshalSubscribeStorageOptionsResponse, + ) + + /** + * Update a baremetal server. Update the server associated with the given ID. + * + * @param request - The request {@link UpdateServerRequest} + * @returns A Promise of Server + */ + updateServer = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateServerRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`, + }, + unmarshalServer, + ) + + updateServerTags = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateServerTagsRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/tags`, + }, + unmarshalServer, + ) + + /** + * Reboot a baremetal server. Reboot the server associated with the given ID, + * use boot param to reboot in rescue. + * + * @param request - The request {@link RebootServerRequest} + */ + rebootServer = (request: Readonly) => + this.client.fetch({ + body: '{}', + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`, + }) + + /** + * Start a baremetal server. Start the server associated with the given ID. + * + * @param request - The request {@link StartServerRequest} + */ + startServer = (request: Readonly) => + this.client.fetch({ + body: '{}', + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/start`, + }) + + /** + * Stop a baremetal server. Stop the server associated with the given ID. + * + * @param request - The request {@link StopServerRequest} + */ + stopServer = (request: Readonly) => + this.client.fetch({ + body: '{}', + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/stop`, + }) + + /** + * Delete a baremetal server. Delete the server associated with the given ID. + * + * @param request - The request {@link DeleteServerRequest} + */ + deleteServer = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`, + }) + + protected pageOfListServerEvents = ( + request: Readonly, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/events`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ), + }, + unmarshalListServerEventsResponse, + ) + + /** + * List server events. List events associated to the given server ID. + * + * @param request - The request {@link ListServerEventsRequest} + * @returns A Promise of ListServerEventsResponse + */ + listServerEvents = (request: Readonly) => + enrichForPagination('events', this.pageOfListServerEvents, request) + + protected pageOfListServerDisks = ( + request: Readonly, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/disks`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ), + }, + unmarshalListServerDisksResponse, + ) + + /** + * List server disks. List disks associated to the given server ID. + * + * @param request - The request {@link ListServerDisksRequest} + * @returns A Promise of ListServerDisksResponse + */ + listServerDisks = (request: Readonly) => + enrichForPagination('disks', this.pageOfListServerDisks, request) + + getOrderedService = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/ordered-services/${validatePathParam('orderedServiceId', request.orderedServiceId)}`, + }, + unmarshalService, + ) + + /** + * Get a specific service. Get the service associated with the given ID. + * + * @param request - The request {@link GetServiceRequest} + * @returns A Promise of Service + */ + getService = (request: Readonly) => + this.client.fetch( + { + body: '{}', + headers: jsonContentHeaders, + method: 'PATCH', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/services/${validatePathParam('serviceId', request.serviceId)}`, + }, + unmarshalService, + ) + + /** + * Delete a specific service. Delete the service associated with the given ID. + * + * @param request - The request {@link DeleteServiceRequest} + * @returns A Promise of Service + */ + deleteService = (request: Readonly) => + this.client.fetch( + { + method: 'DELETE', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/services/${validatePathParam('serviceId', request.serviceId)}`, + }, + unmarshalService, + ) + + protected pageOfListServices = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/services`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListServicesResponse, + ) + + /** + * List services. + * + * @param request - The request {@link ListServicesRequest} + * @returns A Promise of ListServicesResponse + */ + listServices = (request: Readonly = {}) => + enrichForPagination('services', this.pageOfListServices, request) + + /** + * Install a baremetal server. Install an OS on the server associated with the + * given ID. + * + * @param request - The request {@link InstallServerRequest} + * @returns A Promise of ServerInstall + */ + installServer = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalInstallServerRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/install`, + }, + unmarshalServerInstall, + ) + + /** + * Get a specific server installation status. Get the server installation + * status associated with the given server ID. + * + * @param request - The request {@link GetServerInstallRequest} + * @returns A Promise of ServerInstall + */ + getServerInstall = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/install`, + }, + unmarshalServerInstall, + ) + + /** + * Waits for {@link ServerInstall} to be in a final state. + * + * @param request - The request {@link GetServerInstallRequest} + * @param options - The waiting options + * @returns A Promise of ServerInstall + */ + waitForServerInstall = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve( + !SERVER_INSTALL_TRANSIENT_STATUSES.includes(res.status), + )), + this.getServerInstall, + request, + options, + ) + + /** + * Cancels the current (running) server installation. Cancels the current + * server installation associated with the given server ID. + * + * @param request - The request {@link CancelServerInstallRequest} + */ + cancelServerInstall = (request: Readonly) => + this.client.fetch({ + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/cancel-install`, + }) + + /** + * Get server default partitioning. Get the server default partitioning schema + * associated with the given server ID and OS ID. + * + * @param request - The request {@link GetServerDefaultPartitioningRequest} + * @returns A Promise of ServerDefaultPartitioning + */ + getServerDefaultPartitioning = ( + request: Readonly, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/partitioning/${validatePathParam('osId', request.osId)}`, + }, + unmarshalServerDefaultPartitioning, + ) + + /** + * Start BMC (Baseboard Management Controller) access for a given baremetal + * server. Start BMC (Baseboard Management Controller) access associated with + * the given ID. The BMC (Baseboard Management Controller) access is available + * one hour after the installation of the server. + * + * @param request - The request {@link StartBMCAccessRequest} + */ + startBMCAccess = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalStartBMCAccessRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`, + }) + + /** + * Get BMC (Baseboard Management Controller) access for a given baremetal + * server. Get the BMC (Baseboard Management Controller) access associated + * with the given ID. + * + * @param request - The request {@link GetBMCAccessRequest} + * @returns A Promise of BMCAccess + */ + getBMCAccess = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`, + }, + unmarshalBMCAccess, + ) + + /** + * Waits for {@link BMCAccess} to be in a final state. + * + * @param request - The request {@link GetBMCAccessRequest} + * @param options - The waiting options + * @returns A Promise of BMCAccess + */ + waitForBMCAccess = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve(!BMC_ACCESS_TRANSIENT_STATUSES.includes(res.status))), + this.getBMCAccess, + request, + options, + ) + + /** + * Stop BMC (Baseboard Management Controller) access for a given baremetal + * server. Stop BMC (Baseboard Management Controller) access associated with + * the given ID. + * + * @param request - The request {@link StopBMCAccessRequest} + */ + stopBMCAccess = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`, + }) + + protected pageOfListOffers = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/offers`, + urlParams: urlParams( + ['available_only', request.availableOnly], + ['catalog', request.catalog], + ['commercial_range', request.commercialRange], + ['is_failover_block', request.isFailoverBlock], + ['is_failover_ip', request.isFailoverIp], + ['is_rpn_san', request.isRpnSan], + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + [ + 'sold_in', + request.soldIn && request.soldIn.length > 0 + ? request.soldIn.join(',') + : undefined, + ], + ), + }, + unmarshalListOffersResponse, + ) + + /** + * List offers. List all available server offers. + * + * @param request - The request {@link ListOffersRequest} + * @returns A Promise of ListOffersResponse + */ + listOffers = (request: Readonly = {}) => + enrichForPagination('offers', this.pageOfListOffers, request) + + /** + * Get offer. Return specific offer for the given ID. + * + * @param request - The request {@link GetOfferRequest} + * @returns A Promise of Offer + */ + getOffer = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/offers/${validatePathParam('offerId', request.offerId)}`, + urlParams: urlParams(['project_id', request.projectId]), + }, + unmarshalOffer, + ) + + protected pageOfListOS = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ['server_id', request.serverId], + ['type', request.type], + ), + }, + unmarshalListOSResponse, + ) + + /** + * List all available OS that can be install on a baremetal server. + * + * @param request - The request {@link ListOSRequest} + * @returns A Promise of ListOSResponse + */ + listOS = (request: Readonly) => + enrichForPagination('os', this.pageOfListOS, request) + + /** + * Get an OS with a given ID. Return specific OS for the given ID. + * + * @param request - The request {@link GetOSRequest} + * @returns A Promise of OS + */ + getOS = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`, + urlParams: urlParams( + ['project_id', request.projectId], + ['server_id', request.serverId], + ), + }, + unmarshalOS, + ) + + /** + * Update reverse of ip. Update reverse of ip associated with the given ID. + * + * @param request - The request {@link UpdateReverseRequest} + * @returns A Promise of IP + */ + updateReverse = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateReverseRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/reverses/${validatePathParam('ipId', request.ipId)}`, + }, + unmarshalIP, + ) + + /** + * Order failover IPs. Order X failover IPs. + * + * @param request - The request {@link CreateFailoverIPsRequest} + * @returns A Promise of CreateFailoverIPsResponse + */ + createFailoverIPs = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateFailoverIPsRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/failover-ips`, + }, + unmarshalCreateFailoverIPsResponse, + ) + + /** + * Attach failovers on baremetal server. Attach failovers on the server + * associated with the given ID. + * + * @param request - The request {@link AttachFailoverIPsRequest} + */ + attachFailoverIPs = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalAttachFailoverIPsRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/failover-ips/attach`, + }) + + /** + * Detach failovers on baremetal server. Detach failovers on the server + * associated with the given ID. + * + * @param request - The request {@link DetachFailoverIPsRequest} + */ + detachFailoverIPs = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalDetachFailoverIPsRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/failover-ips/detach`, + }) + + /** + * Attach a failover IP to a MAC address. + * + * @param request - The request {@link AttachFailoverIPToMacAddressRequest} + * @returns A Promise of IP + */ + attachFailoverIPToMacAddress = ( + request: Readonly, + ) => + this.client.fetch( + { + body: JSON.stringify( + marshalAttachFailoverIPToMacAddressRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/failover-ips/${validatePathParam('ipId', request.ipId)}/attach-to-mac-address`, + }, + unmarshalIP, + ) + + /** + * Detach a failover IP from a MAC address. + * + * @param request - The request {@link DetachFailoverIPFromMacAddressRequest} + * @returns A Promise of IP + */ + detachFailoverIPFromMacAddress = ( + request: Readonly, + ) => + this.client.fetch( + { + body: '{}', + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/failover-ips/${validatePathParam('ipId', request.ipId)}/detach-from-mac-address`, + }, + unmarshalIP, + ) + + /** + * Delete a failover server. Delete the failover associated with the given ID. + * + * @param request - The request {@link DeleteFailoverIPRequest} + */ + deleteFailoverIP = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/failover-ips/${validatePathParam('ipId', request.ipId)}`, + }) + + protected pageOfListFailoverIPs = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/failover-ips`, + urlParams: urlParams( + ['only_available', request.onlyAvailable], + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + [ + 'project_id', + request.projectId ?? this.client.settings.defaultProjectId, + ], + ['search', request.search], + ), + }, + unmarshalListFailoverIPsResponse, + ) + + /** + * List failovers for project. List failovers servers for project. + * + * @param request - The request {@link ListFailoverIPsRequest} + * @returns A Promise of ListFailoverIPsResponse + */ + listFailoverIPs = (request: Readonly = {}) => + enrichForPagination('failoverIps', this.pageOfListFailoverIPs, request) + + /** + * Get a specific baremetal server. Get the server associated with the given + * ID. + * + * @param request - The request {@link GetFailoverIPRequest} + * @returns A Promise of FailoverIP + */ + getFailoverIP = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/failover-ips/${validatePathParam('ipId', request.ipId)}`, + }, + unmarshalFailoverIP, + ) + + /** + * Get remaining quota. + * + * @param request - The request {@link GetRemainingQuotaRequest} + * @returns A Promise of GetRemainingQuotaResponse + */ + getRemainingQuota = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/remaining-quota`, + urlParams: urlParams(['project_id', request.projectId]), + }, + unmarshalGetRemainingQuotaResponse, + ) + + /** + * Get raid. Return raid for the given server ID. + * + * @param request - The request {@link GetRaidRequest} + * @returns A Promise of Raid + */ + getRaid = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/raid`, + }, + unmarshalRaid, + ) + + /** + * Update RAID. Update RAID associated with the given server ID. + * + * @param request - The request {@link UpdateRaidRequest} + */ + updateRaid = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalUpdateRaidRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/update-raid`, + }) + + /** + * Start in rescue baremetal server. Start in rescue the server associated + * with the given ID. + * + * @param request - The request {@link StartRescueRequest} + * @returns A Promise of Rescue + */ + startRescue = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalStartRescueRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/rescue`, + }, + unmarshalRescue, + ) + + /** + * Get rescue information. Return rescue information for the given server ID. + * + * @param request - The request {@link GetRescueRequest} + * @returns A Promise of Rescue + */ + getRescue = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/rescue`, + }, + unmarshalRescue, + ) + + /** + * Stop rescue on baremetal server. Stop rescue on the server associated with + * the given ID. + * + * @param request - The request {@link StopRescueRequest} + */ + stopRescue = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/dedibox/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/rescue`, + }) +} + +/** Dedibox Phoenix Billing API. */ +export class BillingAPI extends ParentAPI { + protected pageOfListInvoices = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/invoices`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListInvoicesResponse, + ) + + listInvoices = (request: Readonly = {}) => + enrichForPagination('invoices', this.pageOfListInvoices, request) + + getInvoice = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/invoices/${validatePathParam('invoiceId', request.invoiceId)}`, + }, + unmarshalInvoice, + ) + + downloadInvoice = (request: Readonly) => + this.client.fetch({ + method: 'GET', + path: `/dedibox/v1/invoices/${validatePathParam('invoiceId', request.invoiceId)}/download`, + urlParams: urlParams(['dl', 1]), + responseType: 'blob', + }) + + protected pageOfListRefunds = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/refunds`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListRefundsResponse, + ) + + listRefunds = (request: Readonly = {}) => + enrichForPagination('refunds', this.pageOfListRefunds, request) + + getRefund = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/refunds/${validatePathParam('refundId', request.refundId)}`, + }, + unmarshalRefund, + ) + + downloadRefund = (request: Readonly) => + this.client.fetch({ + method: 'GET', + path: `/dedibox/v1/refunds/${validatePathParam('refundId', request.refundId)}/download`, + urlParams: urlParams(['dl', 1]), + responseType: 'blob', + }) + + canOrder = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/can-order`, + urlParams: urlParams([ + 'project_id', + request.projectId ?? this.client.settings.defaultProjectId, + ]), + }, + unmarshalCanOrderResponse, + ) +} + +/** Dedibox Phoenix IPv6 Block API. */ +export class IPv6BlockAPI extends ParentAPI { + /** + * Get IPv6 block quota. Get IPv6 block quota with the given project ID. /48 + * one per organization. /56 link to your number of server. /64 link to your + * number of failover IP. + * + * @param request - The request {@link IPv6BlockApiGetIPv6BlockQuotasRequest} + * @returns A Promise of GetIPv6BlockQuotasResponse + */ + getIPv6BlockQuotas = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/ipv6-block-quotas`, + urlParams: urlParams(['project_id', request.projectId]), + }, + unmarshalGetIPv6BlockQuotasResponse, + ) + + /** + * Create IPv6 block for baremetal server. Create IPv6 block associated with + * the given project ID. + * + * @param request - The request {@link IPv6BlockApiCreateIPv6BlockRequest} + * @returns A Promise of IPv6Block + */ + createIPv6Block = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + body: JSON.stringify( + marshalIPv6BlockApiCreateIPv6BlockRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/ipv6-block`, + }, + unmarshalIPv6Block, + ) + + /** + * Get a specific IPv6 block. Get the IPv6 block associated with the given ID. + * + * @param request - The request {@link IPv6BlockApiGetIPv6BlockRequest} + * @returns A Promise of IPv6Block + */ + getIPv6Block = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/ipv6-block`, + urlParams: urlParams(['project_id', request.projectId]), + }, + unmarshalIPv6Block, + ) + + /** + * Update IPv6 block. Update DNS associated to IPv6 block. If DNS is used, + * minimum of 2 is necessary and maximum of 5 (no duplicate). + * + * @param request - The request {@link IPv6BlockApiUpdateIPv6BlockRequest} + * @returns A Promise of IPv6Block + */ + updateIPv6Block = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalIPv6BlockApiUpdateIPv6BlockRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/dedibox/v1/ipv6-blocks/${validatePathParam('blockId', request.blockId)}`, + }, + unmarshalIPv6Block, + ) + + /** + * Delete IPv6 block. Delete IPv6 block subnet with the given ID. + * + * @param request - The request {@link IPv6BlockApiDeleteIPv6BlockRequest} + */ + deleteIPv6Block = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/dedibox/v1/ipv6-blocks/${validatePathParam('blockId', request.blockId)}`, + }) + + /** + * Create IPv6 block subnet. Create IPv6 block subnet for the given IP ID. /48 + * could create subnet in /56 (quota link to your number of server). /56 could + * create subnet in /64 (quota link to your number of failover IP). + * + * @param request - The request + * {@link IPv6BlockApiCreateIPv6BlockSubnetRequest} + * @returns A Promise of IPv6Block + */ + createIPv6BlockSubnet = ( + request: Readonly, + ) => + this.client.fetch( + { + body: JSON.stringify( + marshalIPv6BlockApiCreateIPv6BlockSubnetRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/ipv6-blocks/${validatePathParam('blockId', request.blockId)}/subnets`, + }, + unmarshalIPv6Block, + ) + + /** + * List available IPv6 block subnets. List all available IPv6 block subnets + * for given IP ID. + * + * @param request - The request + * {@link IPv6BlockApiListIPv6BlockSubnetsAvailableRequest} + * @returns A Promise of ListIPv6BlockSubnetsAvailableResponse + */ + listIPv6BlockSubnetsAvailable = ( + request: Readonly, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/ipv6-blocks/${validatePathParam('blockId', request.blockId)}/subnets`, + }, + unmarshalListIPv6BlockSubnetsAvailableResponse, + ) +} + +/** Dedibox Phoenix RPN API. */ +export class RpnAPI extends ParentAPI { + protected pageOfListRpnServerCapabilities = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpn/server-capabilities`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListRpnServerCapabilitiesResponse, + ) + + listRpnServerCapabilities = ( + request: Readonly = {}, + ) => + enrichForPagination( + 'servers', + this.pageOfListRpnServerCapabilities, + request, + ) + + getRpnStatus = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpn/status`, + urlParams: urlParams( + ['project_id', request.projectId], + ['rpnv1_group_id', request.rpnv1GroupId], + ['rpnv2_group_id', request.rpnv2GroupId], + ), + }, + unmarshalGetRpnStatusResponse, + ) +} + +/** Dedibox Phoenix RPN SAN API. */ +export class RpnSanAPI extends ParentAPI { + protected pageOfListRpnSans = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpn-sans`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListRpnSansResponse, + ) + + listRpnSans = (request: Readonly = {}) => + enrichForPagination('rpnSans', this.pageOfListRpnSans, request) + + getRpnSan = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpn-sans/${validatePathParam('rpnSanId', request.rpnSanId)}`, + }, + unmarshalRpnSan, + ) + + /** + * Waits for {@link RpnSan} to be in a final state. + * + * @param request - The request {@link RpnSanApiGetRpnSanRequest} + * @param options - The waiting options + * @returns A Promise of RpnSan + */ + waitForRpnSan = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve(!RPN_SAN_TRANSIENT_STATUSES.includes(res.status))), + this.getRpnSan, + request, + options, + ) + + deleteRpnSan = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/dedibox/v1/rpn-sans/${validatePathParam('rpnSanId', request.rpnSanId)}`, + }) + + createRpnSan = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalRpnSanApiCreateRpnSanRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/rpn-sans`, + }, + unmarshalService, + ) + + listIps = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpn-sans/${validatePathParam('rpnSanId', request.rpnSanId)}/ips`, + urlParams: urlParams(['type', request.type]), + }, + unmarshalListIpsResponse, + ) + + addIp = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalRpnSanApiAddIpRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/rpn-sans/${validatePathParam('rpnSanId', request.rpnSanId)}/ips`, + }) + + removeIp = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalRpnSanApiRemoveIpRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'DELETE', + path: `/dedibox/v1/rpn-sans/${validatePathParam('rpnSanId', request.rpnSanId)}/ips`, + }) + + listAvailableIps = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpn-sans/${validatePathParam('rpnSanId', request.rpnSanId)}/available-ips`, + urlParams: urlParams(['type', request.type]), + }, + unmarshalListIpsResponse, + ) +} + +/** Dedibox Phoenix RPN v1 API. */ +export class RpnV1API extends ParentAPI { + protected pageOfListRpnGroups = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv1/groups`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListRpnGroupsResponse, + ) + + listRpnGroups = (request: Readonly = {}) => + enrichForPagination('rpnGroups', this.pageOfListRpnGroups, request) + + getRpnGroup = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv1/groups/${validatePathParam('groupId', request.groupId)}`, + }, + unmarshalRpnGroup, + ) + + createRpnGroup = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalRpnV1ApiCreateRpnGroupRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/rpnv1/groups`, + }, + unmarshalRpnGroup, + ) + + deleteRpnGroup = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/dedibox/v1/rpnv1/groups/${validatePathParam('groupId', request.groupId)}`, + }) + + updateRpnGroupName = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalRpnV1ApiUpdateRpnGroupNameRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/dedibox/v1/rpnv1/groups/${validatePathParam('groupId', request.groupId)}`, + }, + unmarshalRpnGroup, + ) + + protected pageOfListRpnGroupMembers = ( + request: Readonly, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv1/groups/${validatePathParam('groupId', request.groupId)}/members`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListRpnGroupMembersResponse, + ) + + listRpnGroupMembers = ( + request: Readonly, + ) => enrichForPagination('members', this.pageOfListRpnGroupMembers, request) + + rpnGroupInvite = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalRpnV1ApiRpnGroupInviteRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/rpnv1/groups/${validatePathParam('groupId', request.groupId)}/invite`, + }) + + leaveRpnGroup = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalRpnV1ApiLeaveRpnGroupRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/rpnv1/groups/${validatePathParam('groupId', request.groupId)}/leave`, + }) + + addRpnGroupMembers = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalRpnV1ApiAddRpnGroupMembersRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/rpnv1/groups/${validatePathParam('groupId', request.groupId)}/members`, + }, + unmarshalRpnGroup, + ) + + deleteRpnGroupMembers = ( + request: Readonly, + ) => + this.client.fetch( + { + body: JSON.stringify( + marshalRpnV1ApiDeleteRpnGroupMembersRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'DELETE', + path: `/dedibox/v1/rpnv1/groups/${validatePathParam('groupId', request.groupId)}/members`, + }, + unmarshalRpnGroup, + ) + + protected pageOfListRpnCapableServers = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv1/capable-servers`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListRpnCapableServersResponse, + ) + + listRpnCapableServers = ( + request: Readonly = {}, + ) => enrichForPagination('servers', this.pageOfListRpnCapableServers, request) + + protected pageOfListRpnCapableSanServers = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv1/capable-san-servers`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListRpnCapableSanServersResponse, + ) + + listRpnCapableSanServers = ( + request: Readonly = {}, + ) => + enrichForPagination( + 'sanServers', + this.pageOfListRpnCapableSanServers, + request, + ) + + protected pageOfListRpnInvites = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv1/invites`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + [ + 'project_id', + request.projectId ?? this.client.settings.defaultProjectId, + ], + ), + }, + unmarshalListRpnInvitesResponse, + ) + + listRpnInvites = (request: Readonly = {}) => + enrichForPagination('members', this.pageOfListRpnInvites, request) + + acceptRpnInvite = (request: Readonly) => + this.client.fetch({ + method: 'POST', + path: `/dedibox/v1/rpnv1/invites/${validatePathParam('memberId', request.memberId)}/accept`, + }) + + refuseRpnInvite = (request: Readonly) => + this.client.fetch({ + method: 'POST', + path: `/dedibox/v1/rpnv1/invites/${validatePathParam('memberId', request.memberId)}/refuse`, + }) +} + +/** Dedibox Phoenix RPN v2 API. */ +export class RpnV2API extends ParentAPI { + protected pageOfListRpnV2Groups = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv2/groups`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListRpnV2GroupsResponse, + ) + + listRpnV2Groups = (request: Readonly = {}) => + enrichForPagination('rpnGroups', this.pageOfListRpnV2Groups, request) + + protected pageOfListRpnV2Members = ( + request: Readonly, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv2/groups/${validatePathParam('groupId', request.groupId)}/members`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['type', request.type], + ), + }, + unmarshalListRpnV2MembersResponse, + ) + + listRpnV2Members = (request: Readonly) => + enrichForPagination('members', this.pageOfListRpnV2Members, request) + + getRpnV2Group = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv2/groups/${validatePathParam('groupId', request.groupId)}`, + }, + unmarshalRpnV2Group, + ) + + /** + * Waits for {@link RpnV2Group} to be in a final state. + * + * @param request - The request {@link RpnV2ApiGetRpnV2GroupRequest} + * @param options - The waiting options + * @returns A Promise of RpnV2Group + */ + waitForRpnV2Group = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve( + !RPN_V2_GROUP_TRANSIENT_STATUSES.includes(res.status), + )), + this.getRpnV2Group, + request, + options, + ) + + createRpnV2Group = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalRpnV2ApiCreateRpnV2GroupRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/rpnv2/groups`, + }, + unmarshalRpnV2Group, + ) + + deleteRpnV2Group = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/dedibox/v1/rpnv2/groups/${validatePathParam('groupId', request.groupId)}`, + }) + + updateRpnV2GroupName = ( + request: Readonly, + ) => + this.client.fetch( + { + body: JSON.stringify( + marshalRpnV2ApiUpdateRpnV2GroupNameRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/dedibox/v1/rpnv2/groups/${validatePathParam('groupId', request.groupId)}`, + }, + unmarshalRpnV2Group, + ) + + addRpnV2Members = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalRpnV2ApiAddRpnV2MembersRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/rpnv2/groups/${validatePathParam('groupId', request.groupId)}/members`, + }) + + deleteRpnV2Members = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalRpnV2ApiDeleteRpnV2MembersRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'DELETE', + path: `/dedibox/v1/rpnv2/groups/${validatePathParam('groupId', request.groupId)}/members`, + }) + + protected pageOfListRpnV2CapableResources = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv2/groups/capable`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListRpnV2CapableResourcesResponse, + ) + + listRpnV2CapableResources = ( + request: Readonly = {}, + ) => + enrichForPagination( + 'servers', + this.pageOfListRpnV2CapableResources, + request, + ) + + protected pageOfListRpnV2GroupLogs = ( + request: Readonly, + ) => + this.client.fetch( + { + method: 'GET', + path: `/dedibox/v1/rpnv2/groups/${validatePathParam('groupId', request.groupId)}/logs`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ), + }, + unmarshalListRpnV2GroupLogsResponse, + ) + + listRpnV2GroupLogs = (request: Readonly) => + enrichForPagination('logs', this.pageOfListRpnV2GroupLogs, request) + + updateRpnV2VlanForMembers = ( + request: Readonly, + ) => + this.client.fetch({ + body: JSON.stringify( + marshalRpnV2ApiUpdateRpnV2VlanForMembersRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/dedibox/v1/rpnv2/groups/${validatePathParam('groupId', request.groupId)}/vlan`, + }) + + enableRpnV2GroupCompatibility = ( + request: Readonly, + ) => + this.client.fetch({ + body: JSON.stringify( + marshalRpnV2ApiEnableRpnV2GroupCompatibilityRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/rpnv2/groups/${validatePathParam('groupId', request.groupId)}/enable-compatibility`, + }) + + disableRpnV2GroupCompatibility = ( + request: Readonly, + ) => + this.client.fetch({ + body: '{}', + headers: jsonContentHeaders, + method: 'POST', + path: `/dedibox/v1/rpnv2/groups/${validatePathParam('groupId', request.groupId)}/disable-compatibility`, + }) +} diff --git a/packages/clients/src/api/dedibox/v1/content.gen.ts b/packages/clients/src/api/dedibox/v1/content.gen.ts new file mode 100644 index 000000000..3cd46d9b8 --- /dev/null +++ b/packages/clients/src/api/dedibox/v1/content.gen.ts @@ -0,0 +1,71 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import type { + BMCAccessStatus, + IPv6BlockDelegationStatus, + RpnGroupMemberStatus, + RpnSanStatus, + RpnV2GroupStatus, + RpnV2MemberStatus, + ServerInstallStatus, + ServerStatus, + ServiceProvisioningStatus, +} from './types.gen' + +/** Lists transient statutes of the enum {@link BMCAccessStatus}. */ +export const BMC_ACCESS_TRANSIENT_STATUSES: BMCAccessStatus[] = [ + 'creating', + 'deleting', +] + +/** Lists transient statutes of the enum {@link IPv6BlockDelegationStatus}. */ +export const I_PV6_BLOCK_DELEGATION_TRANSIENT_STATUSES: IPv6BlockDelegationStatus[] = + ['updating'] + +/** Lists transient statutes of the enum {@link RpnGroupMemberStatus}. */ +export const RPN_GROUP_MEMBER_TRANSIENT_STATUSES: RpnGroupMemberStatus[] = [ + 'creating', + 'deleting', +] + +/** Lists transient statutes of the enum {@link RpnSanStatus}. */ +export const RPN_SAN_TRANSIENT_STATUSES: RpnSanStatus[] = [ + 'creating', + 'deleting', +] + +/** Lists transient statutes of the enum {@link RpnV2GroupStatus}. */ +export const RPN_V2_GROUP_TRANSIENT_STATUSES: RpnV2GroupStatus[] = [ + 'creating', + 'updating', + 'deleting', +] + +/** Lists transient statutes of the enum {@link RpnV2MemberStatus}. */ +export const RPN_V2_MEMBER_TRANSIENT_STATUSES: RpnV2MemberStatus[] = [ + 'creating', + 'updating', + 'deleting', +] + +/** Lists transient statutes of the enum {@link ServerInstallStatus}. */ +export const SERVER_INSTALL_TRANSIENT_STATUSES: ServerInstallStatus[] = [ + 'booting', + 'setting_up_raid', + 'partitioning', + 'formatting', + 'installing', + 'configuring', + 'configuring_bootloader', + 'rebooting', +] + +/** Lists transient statutes of the enum {@link ServerStatus}. */ +export const SERVER_TRANSIENT_STATUSES: ServerStatus[] = [ + 'delivering', + 'installing', +] + +/** Lists transient statutes of the enum {@link ServiceProvisioningStatus}. */ +export const SERVICE_PROVISIONING_TRANSIENT_STATUSES: ServiceProvisioningStatus[] = + ['delivering', 'expiring'] diff --git a/packages/clients/src/api/dedibox/v1/index.gen.ts b/packages/clients/src/api/dedibox/v1/index.gen.ts new file mode 100644 index 000000000..6b9fba39a --- /dev/null +++ b/packages/clients/src/api/dedibox/v1/index.gen.ts @@ -0,0 +1,267 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +export { + API, + BillingAPI, + IPv6BlockAPI, + RpnAPI, + RpnSanAPI, + RpnV1API, + RpnV2API, +} from './api.gen' +export * from './content.gen' +export type { + AttachFailoverIPToMacAddressRequest, + AttachFailoverIPToMacAddressRequestMacType, + AttachFailoverIPsRequest, + BMCAccess, + BMCAccessStatus, + Backup, + BackupStatus, + BillingApiCanOrderRequest, + BillingApiDownloadInvoiceRequest, + BillingApiDownloadRefundRequest, + BillingApiGetInvoiceRequest, + BillingApiGetRefundRequest, + BillingApiListInvoicesRequest, + BillingApiListRefundsRequest, + CPU, + CanOrderResponse, + CancelServerInstallRequest, + CreateFailoverIPsRequest, + CreateFailoverIPsResponse, + CreateServerRequest, + DeleteFailoverIPRequest, + DeleteServerRequest, + DeleteServiceRequest, + DetachFailoverIPFromMacAddressRequest, + DetachFailoverIPsRequest, + Disk, + FailoverBlock, + FailoverBlockVersion, + FailoverIP, + FailoverIPInterfaceType, + FailoverIPStatus, + FailoverIPVersion, + GetBMCAccessRequest, + GetFailoverIPRequest, + GetIPv6BlockQuotasResponse, + GetIPv6BlockQuotasResponseQuota, + GetOSRequest, + GetOfferRequest, + GetOrderedServiceRequest, + GetRaidRequest, + GetRemainingQuotaRequest, + GetRemainingQuotaResponse, + GetRescueRequest, + GetRpnStatusResponse, + GetRpnStatusResponseStatus, + GetServerBackupRequest, + GetServerDefaultPartitioningRequest, + GetServerInstallRequest, + GetServerRequest, + GetServiceRequest, + IP, + IPSemantic, + IPStatus, + IPVersion, + IPv6Block, + IPv6BlockApiCreateIPv6BlockRequest, + IPv6BlockApiCreateIPv6BlockSubnetRequest, + IPv6BlockApiDeleteIPv6BlockRequest, + IPv6BlockApiGetIPv6BlockQuotasRequest, + IPv6BlockApiGetIPv6BlockRequest, + IPv6BlockApiListIPv6BlockSubnetsAvailableRequest, + IPv6BlockApiUpdateIPv6BlockRequest, + IPv6BlockDelegationStatus, + InstallPartition, + InstallServerRequest, + Invoice, + InvoicePaymentMethod, + InvoiceStatus, + InvoiceSummary, + ListFailoverIPsRequest, + ListFailoverIPsRequestOrderBy, + ListFailoverIPsResponse, + ListIPv6BlockSubnetsAvailableResponse, + ListIPv6BlockSubnetsAvailableResponseSubnet, + ListInvoicesRequestOrderBy, + ListInvoicesResponse, + ListIpsResponse, + ListOSRequest, + ListOSRequestOrderBy, + ListOSResponse, + ListOffersRequest, + ListOffersRequestOrderBy, + ListOffersResponse, + ListRefundsRequestOrderBy, + ListRefundsResponse, + ListRpnCapableSanServersRequestOrderBy, + ListRpnCapableSanServersResponse, + ListRpnCapableServersRequestOrderBy, + ListRpnCapableServersResponse, + ListRpnGroupMembersRequestOrderBy, + ListRpnGroupMembersResponse, + ListRpnGroupsRequestOrderBy, + ListRpnGroupsResponse, + ListRpnInvitesRequestOrderBy, + ListRpnInvitesResponse, + ListRpnSansRequestOrderBy, + ListRpnSansResponse, + ListRpnServerCapabilitiesRequestOrderBy, + ListRpnServerCapabilitiesResponse, + ListRpnV2CapableResourcesRequestOrderBy, + ListRpnV2CapableResourcesResponse, + ListRpnV2GroupLogsRequestOrderBy, + ListRpnV2GroupLogsResponse, + ListRpnV2GroupsRequestOrderBy, + ListRpnV2GroupsResponse, + ListRpnV2MembersRequestOrderBy, + ListRpnV2MembersRequestType, + ListRpnV2MembersResponse, + ListServerDisksRequest, + ListServerDisksRequestOrderBy, + ListServerDisksResponse, + ListServerEventsRequest, + ListServerEventsRequestOrderBy, + ListServerEventsResponse, + ListServersRequest, + ListServersRequestOrderBy, + ListServersResponse, + ListServicesRequest, + ListServicesRequestOrderBy, + ListServicesResponse, + ListSubscribableServerOptionsRequest, + ListSubscribableServerOptionsResponse, + Log, + LogAction, + LogStatus, + Memory, + MemoryType, + NetworkInterface, + NetworkInterfaceInterfaceType, + OS, + OSArch, + OSType, + Offer, + OfferAntiDosInfo, + OfferAntiDosInfoType, + OfferBackupInfo, + OfferBandwidthInfo, + OfferCatalog, + OfferFailoverBlockInfo, + OfferFailoverIpInfo, + OfferLicenseInfo, + OfferPaymentFrequency, + OfferRPNInfo, + OfferSANInfo, + OfferSANInfoType, + OfferServerInfo, + OfferServerInfoStock, + OfferServiceLevelInfo, + OfferStorageInfo, + Partition, + PartitionFileSystem, + PartitionType, + PersistentMemory, + Raid, + RaidArray, + RaidArrayRaidLevel, + RaidController, + RebootServerRequest, + Refund, + RefundMethod, + RefundStatus, + RefundSummary, + Rescue, + RescueProtocol, + RpnApiGetRpnStatusRequest, + RpnApiListRpnServerCapabilitiesRequest, + RpnGroup, + RpnGroupMember, + RpnGroupMemberStatus, + RpnGroupType, + RpnSan, + RpnSanApiAddIpRequest, + RpnSanApiCreateRpnSanRequest, + RpnSanApiDeleteRpnSanRequest, + RpnSanApiGetRpnSanRequest, + RpnSanApiListAvailableIpsRequest, + RpnSanApiListIpsRequest, + RpnSanApiListRpnSansRequest, + RpnSanApiRemoveIpRequest, + RpnSanIp, + RpnSanIpRpnV2Group, + RpnSanIpServer, + RpnSanIpType, + RpnSanServer, + RpnSanStatus, + RpnSanSummary, + RpnServerCapability, + RpnV1ApiAcceptRpnInviteRequest, + RpnV1ApiAddRpnGroupMembersRequest, + RpnV1ApiCreateRpnGroupRequest, + RpnV1ApiDeleteRpnGroupMembersRequest, + RpnV1ApiDeleteRpnGroupRequest, + RpnV1ApiGetRpnGroupRequest, + RpnV1ApiLeaveRpnGroupRequest, + RpnV1ApiListRpnCapableSanServersRequest, + RpnV1ApiListRpnCapableServersRequest, + RpnV1ApiListRpnGroupMembersRequest, + RpnV1ApiListRpnGroupsRequest, + RpnV1ApiListRpnInvitesRequest, + RpnV1ApiRefuseRpnInviteRequest, + RpnV1ApiRpnGroupInviteRequest, + RpnV1ApiUpdateRpnGroupNameRequest, + RpnV2ApiAddRpnV2MembersRequest, + RpnV2ApiCreateRpnV2GroupRequest, + RpnV2ApiDeleteRpnV2GroupRequest, + RpnV2ApiDeleteRpnV2MembersRequest, + RpnV2ApiDisableRpnV2GroupCompatibilityRequest, + RpnV2ApiEnableRpnV2GroupCompatibilityRequest, + RpnV2ApiGetRpnV2GroupRequest, + RpnV2ApiListRpnV2CapableResourcesRequest, + RpnV2ApiListRpnV2GroupLogsRequest, + RpnV2ApiListRpnV2GroupsRequest, + RpnV2ApiListRpnV2MembersRequest, + RpnV2ApiUpdateRpnV2GroupNameRequest, + RpnV2ApiUpdateRpnV2VlanForMembersRequest, + RpnV2Group, + RpnV2GroupStatus, + RpnV2GroupSubnet, + RpnV2GroupType, + RpnV2Member, + RpnV2MemberStatus, + Server, + ServerDefaultPartitioning, + ServerDisk, + ServerDiskType, + ServerEvent, + ServerInstall, + ServerInstallStatus, + ServerLocation, + ServerOption, + ServerStatus, + ServerSummary, + Service, + ServiceLevel, + ServiceLevelLevel, + ServiceProvisioningStatus, + ServiceType, + StartBMCAccessRequest, + StartRescueRequest, + StartServerRequest, + StopBMCAccessRequest, + StopRescueRequest, + StopServerRequest, + SubscribeServerOptionRequest, + SubscribeStorageOptionsRequest, + SubscribeStorageOptionsResponse, + UpdatableRaidArray, + UpdateRaidRequest, + UpdateReverseRequest, + UpdateServerBackupRequest, + UpdateServerRequest, + UpdateServerTagsRequest, +} from './types.gen' +export * as ValidationRules from './validation-rules.gen' diff --git a/packages/clients/src/api/dedibox/v1/marshalling.gen.ts b/packages/clients/src/api/dedibox/v1/marshalling.gen.ts new file mode 100644 index 000000000..05ccd6c2f --- /dev/null +++ b/packages/clients/src/api/dedibox/v1/marshalling.gen.ts @@ -0,0 +1,1954 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import { + isJSONObject, + unmarshalArrayOfObject, + unmarshalDate, + unmarshalMoney, +} from '../../../bridge' +import type { DefaultValues } from '../../../bridge' +import type { + AttachFailoverIPToMacAddressRequest, + AttachFailoverIPsRequest, + BMCAccess, + Backup, + CPU, + CanOrderResponse, + CreateFailoverIPsRequest, + CreateFailoverIPsResponse, + CreateServerRequest, + DetachFailoverIPsRequest, + Disk, + FailoverBlock, + FailoverIP, + GetIPv6BlockQuotasResponse, + GetIPv6BlockQuotasResponseQuota, + GetRemainingQuotaResponse, + GetRpnStatusResponse, + IP, + IPv6Block, + IPv6BlockApiCreateIPv6BlockRequest, + IPv6BlockApiCreateIPv6BlockSubnetRequest, + IPv6BlockApiUpdateIPv6BlockRequest, + InstallPartition, + InstallServerRequest, + Invoice, + InvoiceSummary, + ListFailoverIPsResponse, + ListIPv6BlockSubnetsAvailableResponse, + ListIPv6BlockSubnetsAvailableResponseSubnet, + ListInvoicesResponse, + ListIpsResponse, + ListOSResponse, + ListOffersResponse, + ListRefundsResponse, + ListRpnCapableSanServersResponse, + ListRpnCapableServersResponse, + ListRpnGroupMembersResponse, + ListRpnGroupsResponse, + ListRpnInvitesResponse, + ListRpnSansResponse, + ListRpnServerCapabilitiesResponse, + ListRpnV2CapableResourcesResponse, + ListRpnV2GroupLogsResponse, + ListRpnV2GroupsResponse, + ListRpnV2MembersResponse, + ListServerDisksResponse, + ListServerEventsResponse, + ListServersResponse, + ListServicesResponse, + ListSubscribableServerOptionsResponse, + Log, + Memory, + NetworkInterface, + OS, + Offer, + OfferAntiDosInfo, + OfferBackupInfo, + OfferBandwidthInfo, + OfferFailoverBlockInfo, + OfferFailoverIpInfo, + OfferLicenseInfo, + OfferRPNInfo, + OfferSANInfo, + OfferServerInfo, + OfferServiceLevelInfo, + OfferStorageInfo, + Partition, + PersistentMemory, + Raid, + RaidArray, + RaidController, + Refund, + RefundSummary, + Rescue, + RpnGroup, + RpnGroupMember, + RpnSan, + RpnSanApiAddIpRequest, + RpnSanApiCreateRpnSanRequest, + RpnSanApiRemoveIpRequest, + RpnSanIp, + RpnSanIpRpnV2Group, + RpnSanIpServer, + RpnSanServer, + RpnSanSummary, + RpnServerCapability, + RpnV1ApiAddRpnGroupMembersRequest, + RpnV1ApiCreateRpnGroupRequest, + RpnV1ApiDeleteRpnGroupMembersRequest, + RpnV1ApiLeaveRpnGroupRequest, + RpnV1ApiRpnGroupInviteRequest, + RpnV1ApiUpdateRpnGroupNameRequest, + RpnV2ApiAddRpnV2MembersRequest, + RpnV2ApiCreateRpnV2GroupRequest, + RpnV2ApiDeleteRpnV2MembersRequest, + RpnV2ApiEnableRpnV2GroupCompatibilityRequest, + RpnV2ApiUpdateRpnV2GroupNameRequest, + RpnV2ApiUpdateRpnV2VlanForMembersRequest, + RpnV2Group, + RpnV2GroupSubnet, + RpnV2Member, + Server, + ServerDefaultPartitioning, + ServerDisk, + ServerEvent, + ServerInstall, + ServerLocation, + ServerOption, + ServerSummary, + Service, + ServiceLevel, + StartBMCAccessRequest, + StartRescueRequest, + SubscribeServerOptionRequest, + SubscribeStorageOptionsRequest, + SubscribeStorageOptionsResponse, + UpdatableRaidArray, + UpdateRaidRequest, + UpdateReverseRequest, + UpdateServerBackupRequest, + UpdateServerRequest, + UpdateServerTagsRequest, +} from './types.gen' + +export const unmarshalIP = (data: unknown): IP => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'IP' failed as data isn't a dictionary.`, + ) + } + + return { + address: data.address, + cidr: data.cidr, + gateway: data.gateway, + ipId: data.ip_id, + netmask: data.netmask, + reverse: data.reverse, + semantic: data.semantic, + status: data.status, + version: data.version, + } as IP +} + +const unmarshalCPU = (data: unknown): CPU => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'CPU' failed as data isn't a dictionary.`, + ) + } + + return { + coreCount: data.core_count, + frequency: data.frequency, + name: data.name, + threadCount: data.thread_count, + } as CPU +} + +const unmarshalDisk = (data: unknown): Disk => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Disk' failed as data isn't a dictionary.`, + ) + } + + return { + capacity: data.capacity, + type: data.type, + } as Disk +} + +const unmarshalMemory = (data: unknown): Memory => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Memory' failed as data isn't a dictionary.`, + ) + } + + return { + capacity: data.capacity, + frequency: data.frequency, + isEcc: data.is_ecc, + type: data.type, + } as Memory +} + +const unmarshalPersistentMemory = (data: unknown): PersistentMemory => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'PersistentMemory' failed as data isn't a dictionary.`, + ) + } + + return { + capacity: data.capacity, + frequency: data.frequency, + model: data.model, + } as PersistentMemory +} + +const unmarshalRaidController = (data: unknown): RaidController => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RaidController' failed as data isn't a dictionary.`, + ) + } + + return { + model: data.model, + raidLevel: data.raid_level, + } as RaidController +} + +const unmarshalOfferAntiDosInfo = (data: unknown): OfferAntiDosInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferAntiDosInfo' failed as data isn't a dictionary.`, + ) + } + + return { + type: data.type, + } as OfferAntiDosInfo +} + +const unmarshalOfferBackupInfo = (data: unknown): OfferBackupInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferBackupInfo' failed as data isn't a dictionary.`, + ) + } + + return { + size: data.size, + } as OfferBackupInfo +} + +const unmarshalOfferBandwidthInfo = (data: unknown): OfferBandwidthInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferBandwidthInfo' failed as data isn't a dictionary.`, + ) + } + + return { + speed: data.speed, + } as OfferBandwidthInfo +} + +const unmarshalOfferFailoverBlockInfo = ( + data: unknown, +): OfferFailoverBlockInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferFailoverBlockInfo' failed as data isn't a dictionary.`, + ) + } + + return { + onetimeFees: data.onetime_fees + ? unmarshalOffer(data.onetime_fees) + : undefined, + } as OfferFailoverBlockInfo +} + +const unmarshalOfferFailoverIpInfo = (data: unknown): OfferFailoverIpInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferFailoverIpInfo' failed as data isn't a dictionary.`, + ) + } + + return { + onetimeFees: data.onetime_fees + ? unmarshalOffer(data.onetime_fees) + : undefined, + } as OfferFailoverIpInfo +} + +const unmarshalOfferLicenseInfo = (data: unknown): OfferLicenseInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferLicenseInfo' failed as data isn't a dictionary.`, + ) + } + + return { + boundToIp: data.bound_to_ip, + } as OfferLicenseInfo +} + +const unmarshalOfferRPNInfo = (data: unknown): OfferRPNInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferRPNInfo' failed as data isn't a dictionary.`, + ) + } + + return { + speed: data.speed, + } as OfferRPNInfo +} + +const unmarshalOfferSANInfo = (data: unknown): OfferSANInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferSANInfo' failed as data isn't a dictionary.`, + ) + } + + return { + deviceType: data.device_type, + ha: data.ha, + size: data.size, + } as OfferSANInfo +} + +const unmarshalOfferServerInfo = (data: unknown): OfferServerInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferServerInfo' failed as data isn't a dictionary.`, + ) + } + + return { + availableOptions: unmarshalArrayOfObject( + data.available_options, + unmarshalOffer, + ), + bandwidth: data.bandwidth, + commercialRange: data.commercial_range, + connectivity: data.connectivity, + cpus: unmarshalArrayOfObject(data.cpus, unmarshalCPU), + disks: unmarshalArrayOfObject(data.disks, unmarshalDisk), + memories: unmarshalArrayOfObject(data.memories, unmarshalMemory), + onetimeFees: data.onetime_fees + ? unmarshalOffer(data.onetime_fees) + : undefined, + persistentMemories: unmarshalArrayOfObject( + data.persistent_memories, + unmarshalPersistentMemory, + ), + raidControllers: unmarshalArrayOfObject( + data.raid_controllers, + unmarshalRaidController, + ), + rpnVersion: data.rpn_version, + stock: data.stock, + stockByDatacenter: data.stock_by_datacenter, + } as OfferServerInfo +} + +const unmarshalOfferServiceLevelInfo = ( + data: unknown, +): OfferServiceLevelInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferServiceLevelInfo' failed as data isn't a dictionary.`, + ) + } + + return { + antidos: data.antidos, + availableOptions: unmarshalArrayOfObject( + data.available_options, + unmarshalOffer, + ), + customization: data.customization, + extraFailoverQuota: data.extra_failover_quota, + git: data.git, + highRpnBandwidth: data.high_rpn_bandwidth, + prioritySupport: data.priority_support, + salesSupport: data.sales_support, + sla: data.sla, + supportPhone: data.support_phone, + supportTicket: data.support_ticket, + } as OfferServiceLevelInfo +} + +const unmarshalOfferStorageInfo = (data: unknown): OfferStorageInfo => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OfferStorageInfo' failed as data isn't a dictionary.`, + ) + } + + return { + maxQuota: data.max_quota, + size: data.size, + } as OfferStorageInfo +} + +export const unmarshalOffer = (data: unknown): Offer => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Offer' failed as data isn't a dictionary.`, + ) + } + + return { + antidosInfo: data.antidos_info + ? unmarshalOfferAntiDosInfo(data.antidos_info) + : undefined, + backupInfo: data.backup_info + ? unmarshalOfferBackupInfo(data.backup_info) + : undefined, + bandwidthInfo: data.bandwidth_info + ? unmarshalOfferBandwidthInfo(data.bandwidth_info) + : undefined, + catalog: data.catalog, + failoverBlockInfo: data.failover_block_info + ? unmarshalOfferFailoverBlockInfo(data.failover_block_info) + : undefined, + failoverIpInfo: data.failover_ip_info + ? unmarshalOfferFailoverIpInfo(data.failover_ip_info) + : undefined, + id: data.id, + licenseInfo: data.license_info + ? unmarshalOfferLicenseInfo(data.license_info) + : undefined, + name: data.name, + paymentFrequency: data.payment_frequency, + pricing: data.pricing ? unmarshalMoney(data.pricing) : undefined, + rpnInfo: data.rpn_info ? unmarshalOfferRPNInfo(data.rpn_info) : undefined, + sanInfo: data.san_info ? unmarshalOfferSANInfo(data.san_info) : undefined, + serverInfo: data.server_info + ? unmarshalOfferServerInfo(data.server_info) + : undefined, + serviceLevelInfo: data.service_level_info + ? unmarshalOfferServiceLevelInfo(data.service_level_info) + : undefined, + storageInfo: data.storage_info + ? unmarshalOfferStorageInfo(data.storage_info) + : undefined, + usbStorageInfo: data.usb_storage_info + ? unmarshalOfferStorageInfo(data.usb_storage_info) + : undefined, + } as Offer +} + +export const unmarshalOS = (data: unknown): OS => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'OS' failed as data isn't a dictionary.`, + ) + } + + return { + allowCustomPartitioning: data.allow_custom_partitioning, + allowSshKeys: data.allow_ssh_keys, + allowedFilesystems: data.allowed_filesystems, + arch: data.arch, + displayName: data.display_name, + hostnameMaxLength: data.hostname_max_length, + hostnameRegex: data.hostname_regex, + id: data.id, + licenseOffers: unmarshalArrayOfObject(data.license_offers, unmarshalOffer), + maxPartitions: data.max_partitions, + name: data.name, + panelPasswordRegex: data.panel_password_regex, + passwordRegex: data.password_regex, + releasedAt: unmarshalDate(data.released_at), + requiresAdminPassword: data.requires_admin_password, + requiresLicense: data.requires_license, + requiresPanelPassword: data.requires_panel_password, + requiresUser: data.requires_user, + requiresValidHostname: data.requires_valid_hostname, + type: data.type, + version: data.version, + } as OS +} + +export const unmarshalRpnSan = (data: unknown): RpnSan => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnSan' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + datacenterName: data.datacenter_name, + deliveredAt: unmarshalDate(data.delivered_at), + expiresAt: unmarshalDate(data.expires_at), + id: data.id, + iqn: data.iqn, + iqnSuffix: data.iqn_suffix, + offer: data.offer ? unmarshalOffer(data.offer) : undefined, + offerId: data.offer_id, + offerName: data.offer_name, + organizationId: data.organization_id, + projectId: data.project_id, + rpnv1Compatible: data.rpnv1_compatible, + rpnv1Implicit: data.rpnv1_implicit, + serverHostname: data.server_hostname, + status: data.status, + storageSize: data.storage_size, + terminatedAt: unmarshalDate(data.terminated_at), + } as RpnSan +} + +export const unmarshalRpnGroup = (data: unknown): RpnGroup => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnGroup' failed as data isn't a dictionary.`, + ) + } + + return { + active: data.active, + createdAt: unmarshalDate(data.created_at), + id: data.id, + membersCount: data.members_count, + name: data.name, + organizationId: data.organization_id, + owner: data.owner, + projectId: data.project_id, + type: data.type, + } as RpnGroup +} + +const unmarshalNetworkInterface = (data: unknown): NetworkInterface => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'NetworkInterface' failed as data isn't a dictionary.`, + ) + } + + return { + cardId: data.card_id, + deviceId: data.device_id, + ips: unmarshalArrayOfObject(data.ips, unmarshalIP), + mac: data.mac, + type: data.type, + } as NetworkInterface +} + +const unmarshalServerLocation = (data: unknown): ServerLocation => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerLocation' failed as data isn't a dictionary.`, + ) + } + + return { + datacenterName: data.datacenter_name, + rack: data.rack, + room: data.room, + } as ServerLocation +} + +const unmarshalServerOption = (data: unknown): ServerOption => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerOption' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + expiredAt: unmarshalDate(data.expired_at), + offer: data.offer ? unmarshalOffer(data.offer) : undefined, + options: unmarshalArrayOfObject(data.options, unmarshalServerOption), + updatedAt: unmarshalDate(data.updated_at), + } as ServerOption +} + +const unmarshalServiceLevel = (data: unknown): ServiceLevel => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServiceLevel' failed as data isn't a dictionary.`, + ) + } + + return { + level: data.level, + offerId: data.offer_id, + } as ServiceLevel +} + +export const unmarshalServer = (data: unknown): Server => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Server' failed as data isn't a dictionary.`, + ) + } + + return { + abuseContact: data.abuse_contact, + createdAt: unmarshalDate(data.created_at), + expiredAt: unmarshalDate(data.expired_at), + hasBmc: data.has_bmc, + hostname: data.hostname, + id: data.id, + interfaces: unmarshalArrayOfObject( + data.interfaces, + unmarshalNetworkInterface, + ), + ipv6Slaac: data.ipv6_slaac, + isOutsourced: data.is_outsourced, + isRpnv2Member: data.is_rpnv2_member, + level: data.level ? unmarshalServiceLevel(data.level) : undefined, + location: data.location + ? unmarshalServerLocation(data.location) + : undefined, + offer: data.offer ? unmarshalOffer(data.offer) : undefined, + options: unmarshalArrayOfObject(data.options, unmarshalServerOption), + organizationId: data.organization_id, + os: data.os ? unmarshalOS(data.os) : undefined, + projectId: data.project_id, + qinq: data.qinq, + rebootedAt: unmarshalDate(data.rebooted_at), + rescueOs: data.rescue_os ? unmarshalOS(data.rescue_os) : undefined, + status: data.status, + tags: data.tags, + updatedAt: unmarshalDate(data.updated_at), + zone: data.zone, + } as Server +} + +const unmarshalRpnV2GroupSubnet = (data: unknown): RpnV2GroupSubnet => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnV2GroupSubnet' failed as data isn't a dictionary.`, + ) + } + + return { + address: data.address, + cidr: data.cidr, + } as RpnV2GroupSubnet +} + +export const unmarshalRpnV2Group = (data: unknown): RpnV2Group => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnV2Group' failed as data isn't a dictionary.`, + ) + } + + return { + compatibleRpnv1: data.compatible_rpnv1, + gateway: data.gateway, + id: data.id, + membersCount: data.members_count, + name: data.name, + organizationId: data.organization_id, + owner: data.owner, + projectId: data.project_id, + rpnv1Group: data.rpnv1_group + ? unmarshalRpnGroup(data.rpnv1_group) + : undefined, + status: data.status, + subnet: data.subnet ? unmarshalRpnV2GroupSubnet(data.subnet) : undefined, + type: data.type, + } as RpnV2Group +} + +export const unmarshalService = (data: unknown): Service => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Service' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + deliveredAt: unmarshalDate(data.delivered_at), + expiresAt: unmarshalDate(data.expires_at), + id: data.id, + offer: data.offer ? unmarshalOffer(data.offer) : undefined, + provisioningStatus: data.provisioning_status, + resourceId: data.resource_id, + terminatedAt: unmarshalDate(data.terminated_at), + type: data.type, + } as Service +} + +const unmarshalFailoverBlock = (data: unknown): FailoverBlock => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'FailoverBlock' failed as data isn't a dictionary.`, + ) + } + + return { + address: data.address, + cidr: data.cidr, + gatewayIp: data.gateway_ip, + id: data.id, + ipVersion: data.ip_version, + nameservers: data.nameservers, + netmask: data.netmask, + } as FailoverBlock +} + +export const unmarshalFailoverIP = (data: unknown): FailoverIP => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'FailoverIP' failed as data isn't a dictionary.`, + ) + } + + return { + address: data.address, + block: data.block ? unmarshalFailoverBlock(data.block) : undefined, + cidr: data.cidr, + gatewayIp: data.gateway_ip, + id: data.id, + ipVersion: data.ip_version, + mac: data.mac, + netmask: data.netmask, + reverse: data.reverse, + serverId: data.server_id, + serverZone: data.server_zone, + status: data.status, + type: data.type, + } as FailoverIP +} + +export const unmarshalBMCAccess = (data: unknown): BMCAccess => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'BMCAccess' failed as data isn't a dictionary.`, + ) + } + + return { + expiresAt: unmarshalDate(data.expires_at), + login: data.login, + password: data.password, + status: data.status, + url: data.url, + } as BMCAccess +} + +export const unmarshalBackup = (data: unknown): Backup => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Backup' failed as data isn't a dictionary.`, + ) + } + + return { + aclEnabled: data.acl_enabled, + autologin: data.autologin, + id: data.id, + login: data.login, + quotaFiles: data.quota_files, + quotaFilesUsed: data.quota_files_used, + quotaSpace: data.quota_space, + quotaSpaceUsed: data.quota_space_used, + server: data.server, + status: data.status, + } as Backup +} + +export const unmarshalCanOrderResponse = (data: unknown): CanOrderResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'CanOrderResponse' failed as data isn't a dictionary.`, + ) + } + + return { + billingOk: data.billing_ok, + canOrder: data.can_order, + emailConfirmed: data.email_confirmed, + message: data.message, + paymentMode: data.payment_mode, + phoneConfirmed: data.phone_confirmed, + quotaOk: data.quota_ok, + userConfirmed: data.user_confirmed, + } as CanOrderResponse +} + +export const unmarshalCreateFailoverIPsResponse = ( + data: unknown, +): CreateFailoverIPsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'CreateFailoverIPsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + services: unmarshalArrayOfObject(data.services, unmarshalService), + totalCount: data.total_count, + } as CreateFailoverIPsResponse +} + +const unmarshalGetIPv6BlockQuotasResponseQuota = ( + data: unknown, +): GetIPv6BlockQuotasResponseQuota => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetIPv6BlockQuotasResponseQuota' failed as data isn't a dictionary.`, + ) + } + + return { + cidr: data.cidr, + quota: data.quota, + } as GetIPv6BlockQuotasResponseQuota +} + +export const unmarshalGetIPv6BlockQuotasResponse = ( + data: unknown, +): GetIPv6BlockQuotasResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetIPv6BlockQuotasResponse' failed as data isn't a dictionary.`, + ) + } + + return { + quotas: unmarshalArrayOfObject( + data.quotas, + unmarshalGetIPv6BlockQuotasResponseQuota, + ), + totalCount: data.total_count, + } as GetIPv6BlockQuotasResponse +} + +export const unmarshalGetRemainingQuotaResponse = ( + data: unknown, +): GetRemainingQuotaResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetRemainingQuotaResponse' failed as data isn't a dictionary.`, + ) + } + + return { + failoverBlockQuota: data.failover_block_quota, + failoverBlockRemainingQuota: data.failover_block_remaining_quota, + failoverIpQuota: data.failover_ip_quota, + failoverIpRemainingQuota: data.failover_ip_remaining_quota, + } as GetRemainingQuotaResponse +} + +export const unmarshalGetRpnStatusResponse = ( + data: unknown, +): GetRpnStatusResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetRpnStatusResponse' failed as data isn't a dictionary.`, + ) + } + + return { + operationsLeft: data.operations_left, + status: data.status, + } as GetRpnStatusResponse +} + +export const unmarshalIPv6Block = (data: unknown): IPv6Block => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'IPv6Block' failed as data isn't a dictionary.`, + ) + } + + return { + address: data.address, + cidr: data.cidr, + delegationStatus: data.delegation_status, + duid: data.duid, + id: data.id, + nameservers: data.nameservers, + subnets: unmarshalArrayOfObject(data.subnets, unmarshalIPv6Block), + } as IPv6Block +} + +export const unmarshalInvoice = (data: unknown): Invoice => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Invoice' failed as data isn't a dictionary.`, + ) + } + + return { + content: data.content, + createdAt: unmarshalDate(data.created_at), + id: data.id, + paidAt: unmarshalDate(data.paid_at), + paymentMethod: data.payment_method, + status: data.status, + totalWithTaxes: data.total_with_taxes + ? unmarshalMoney(data.total_with_taxes) + : undefined, + totalWithoutTaxes: data.total_without_taxes + ? unmarshalMoney(data.total_without_taxes) + : undefined, + transactionId: data.transaction_id, + } as Invoice +} + +export const unmarshalListFailoverIPsResponse = ( + data: unknown, +): ListFailoverIPsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListFailoverIPsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + failoverIps: unmarshalArrayOfObject(data.failover_ips, unmarshalFailoverIP), + totalCount: data.total_count, + } as ListFailoverIPsResponse +} + +const unmarshalListIPv6BlockSubnetsAvailableResponseSubnet = ( + data: unknown, +): ListIPv6BlockSubnetsAvailableResponseSubnet => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListIPv6BlockSubnetsAvailableResponseSubnet' failed as data isn't a dictionary.`, + ) + } + + return { + address: data.address, + cidr: data.cidr, + } as ListIPv6BlockSubnetsAvailableResponseSubnet +} + +export const unmarshalListIPv6BlockSubnetsAvailableResponse = ( + data: unknown, +): ListIPv6BlockSubnetsAvailableResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListIPv6BlockSubnetsAvailableResponse' failed as data isn't a dictionary.`, + ) + } + + return { + subnetAvailables: unmarshalArrayOfObject( + data.subnet_availables, + unmarshalListIPv6BlockSubnetsAvailableResponseSubnet, + ), + totalCount: data.total_count, + } as ListIPv6BlockSubnetsAvailableResponse +} + +const unmarshalInvoiceSummary = (data: unknown): InvoiceSummary => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'InvoiceSummary' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + id: data.id, + paidAt: unmarshalDate(data.paid_at), + paymentMethod: data.payment_method, + status: data.status, + totalWithTaxes: data.total_with_taxes + ? unmarshalMoney(data.total_with_taxes) + : undefined, + totalWithoutTaxes: data.total_without_taxes + ? unmarshalMoney(data.total_without_taxes) + : undefined, + transactionId: data.transaction_id, + } as InvoiceSummary +} + +export const unmarshalListInvoicesResponse = ( + data: unknown, +): ListInvoicesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + invoices: unmarshalArrayOfObject(data.invoices, unmarshalInvoiceSummary), + totalCount: data.total_count, + } as ListInvoicesResponse +} + +const unmarshalRpnSanIpRpnV2Group = (data: unknown): RpnSanIpRpnV2Group => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnSanIpRpnV2Group' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + name: data.name, + } as RpnSanIpRpnV2Group +} + +const unmarshalRpnSanIpServer = (data: unknown): RpnSanIpServer => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnSanIpServer' failed as data isn't a dictionary.`, + ) + } + + return { + datacenterName: data.datacenter_name, + hostname: data.hostname, + id: data.id, + } as RpnSanIpServer +} + +const unmarshalRpnSanIp = (data: unknown): RpnSanIp => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnSanIp' failed as data isn't a dictionary.`, + ) + } + + return { + ip: data.ip ? unmarshalIP(data.ip) : undefined, + rpnv2Group: data.rpnv2_group + ? unmarshalRpnSanIpRpnV2Group(data.rpnv2_group) + : undefined, + server: data.server ? unmarshalRpnSanIpServer(data.server) : undefined, + type: data.type, + } as RpnSanIp +} + +export const unmarshalListIpsResponse = (data: unknown): ListIpsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListIpsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + ips: unmarshalArrayOfObject(data.ips, unmarshalRpnSanIp), + totalCount: data.total_count, + } as ListIpsResponse +} + +export const unmarshalListOSResponse = (data: unknown): ListOSResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`, + ) + } + + return { + os: unmarshalArrayOfObject(data.os, unmarshalOS), + totalCount: data.total_count, + } as ListOSResponse +} + +export const unmarshalListOffersResponse = ( + data: unknown, +): ListOffersResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListOffersResponse' failed as data isn't a dictionary.`, + ) + } + + return { + offers: unmarshalArrayOfObject(data.offers, unmarshalOffer), + totalCount: data.total_count, + } as ListOffersResponse +} + +const unmarshalRefundSummary = (data: unknown): RefundSummary => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RefundSummary' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + id: data.id, + method: data.method, + refundedAt: unmarshalDate(data.refunded_at), + status: data.status, + totalWithTaxes: data.total_with_taxes + ? unmarshalMoney(data.total_with_taxes) + : undefined, + totalWithoutTaxes: data.total_without_taxes + ? unmarshalMoney(data.total_without_taxes) + : undefined, + } as RefundSummary +} + +export const unmarshalListRefundsResponse = ( + data: unknown, +): ListRefundsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRefundsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + refunds: unmarshalArrayOfObject(data.refunds, unmarshalRefundSummary), + totalCount: data.total_count, + } as ListRefundsResponse +} + +const unmarshalRpnSanServer = (data: unknown): RpnSanServer => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnSanServer' failed as data isn't a dictionary.`, + ) + } + + return { + datacenterName: data.datacenter_name, + hostname: data.hostname, + id: data.id, + sans: unmarshalArrayOfObject(data.sans, unmarshalRpnSan), + zone: data.zone, + } as RpnSanServer +} + +export const unmarshalListRpnCapableSanServersResponse = ( + data: unknown, +): ListRpnCapableSanServersResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnCapableSanServersResponse' failed as data isn't a dictionary.`, + ) + } + + return { + sanServers: unmarshalArrayOfObject(data.san_servers, unmarshalRpnSanServer), + totalCount: data.total_count, + } as ListRpnCapableSanServersResponse +} + +export const unmarshalListRpnCapableServersResponse = ( + data: unknown, +): ListRpnCapableServersResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnCapableServersResponse' failed as data isn't a dictionary.`, + ) + } + + return { + servers: unmarshalArrayOfObject(data.servers, unmarshalServer), + totalCount: data.total_count, + } as ListRpnCapableServersResponse +} + +const unmarshalRpnGroupMember = (data: unknown): RpnGroupMember => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnGroupMember' failed as data isn't a dictionary.`, + ) + } + + return { + groupId: data.group_id, + groupName: data.group_name, + groupOwner: data.group_owner, + id: data.id, + owner: data.owner, + sanServer: data.san_server + ? unmarshalRpnSanServer(data.san_server) + : undefined, + server: data.server ? unmarshalServer(data.server) : undefined, + speed: data.speed, + status: data.status, + } as RpnGroupMember +} + +export const unmarshalListRpnGroupMembersResponse = ( + data: unknown, +): ListRpnGroupMembersResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnGroupMembersResponse' failed as data isn't a dictionary.`, + ) + } + + return { + members: unmarshalArrayOfObject(data.members, unmarshalRpnGroupMember), + totalCount: data.total_count, + } as ListRpnGroupMembersResponse +} + +export const unmarshalListRpnGroupsResponse = ( + data: unknown, +): ListRpnGroupsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnGroupsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + rpnGroups: unmarshalArrayOfObject(data.rpn_groups, unmarshalRpnGroup), + totalCount: data.total_count, + } as ListRpnGroupsResponse +} + +export const unmarshalListRpnInvitesResponse = ( + data: unknown, +): ListRpnInvitesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnInvitesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + members: unmarshalArrayOfObject(data.members, unmarshalRpnGroupMember), + totalCount: data.total_count, + } as ListRpnInvitesResponse +} + +const unmarshalRpnSanSummary = (data: unknown): RpnSanSummary => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnSanSummary' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + datacenterName: data.datacenter_name, + deliveredAt: unmarshalDate(data.delivered_at), + expiresAt: unmarshalDate(data.expires_at), + id: data.id, + iqnSuffix: data.iqn_suffix, + offerId: data.offer_id, + offerName: data.offer_name, + organizationId: data.organization_id, + projectId: data.project_id, + rpnv1Compatible: data.rpnv1_compatible, + rpnv1Implicit: data.rpnv1_implicit, + serverHostname: data.server_hostname, + status: data.status, + storageSize: data.storage_size, + terminatedAt: unmarshalDate(data.terminated_at), + } as RpnSanSummary +} + +export const unmarshalListRpnSansResponse = ( + data: unknown, +): ListRpnSansResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnSansResponse' failed as data isn't a dictionary.`, + ) + } + + return { + rpnSans: unmarshalArrayOfObject(data.rpn_sans, unmarshalRpnSanSummary), + totalCount: data.total_count, + } as ListRpnSansResponse +} + +const unmarshalRpnServerCapability = (data: unknown): RpnServerCapability => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnServerCapability' failed as data isn't a dictionary.`, + ) + } + + return { + canJoinQinqGroup: data.can_join_qinq_group, + canJoinRpnv2Group: data.can_join_rpnv2_group, + compatibleQinq: data.compatible_qinq, + datacenterName: data.datacenter_name, + hostname: data.hostname, + id: data.id, + ipAddress: data.ip_address, + rpnVersion: data.rpn_version, + rpnv1GroupCount: data.rpnv1_group_count, + rpnv2GroupCount: data.rpnv2_group_count, + zone: data.zone, + } as RpnServerCapability +} + +export const unmarshalListRpnServerCapabilitiesResponse = ( + data: unknown, +): ListRpnServerCapabilitiesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnServerCapabilitiesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + servers: unmarshalArrayOfObject(data.servers, unmarshalRpnServerCapability), + totalCount: data.total_count, + } as ListRpnServerCapabilitiesResponse +} + +export const unmarshalListRpnV2CapableResourcesResponse = ( + data: unknown, +): ListRpnV2CapableResourcesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnV2CapableResourcesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + servers: unmarshalArrayOfObject(data.servers, unmarshalServer), + totalCount: data.total_count, + } as ListRpnV2CapableResourcesResponse +} + +const unmarshalRpnV2Member = (data: unknown): RpnV2Member => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RpnV2Member' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + rpnv1Group: data.rpnv1_group + ? unmarshalRpnGroup(data.rpnv1_group) + : undefined, + server: data.server ? unmarshalServer(data.server) : undefined, + speed: data.speed, + status: data.status, + vlan: data.vlan, + } as RpnV2Member +} + +const unmarshalLog = (data: unknown): Log => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Log' failed as data isn't a dictionary.`, + ) + } + + return { + action: data.action, + createdAt: unmarshalDate(data.created_at), + finishedAt: unmarshalDate(data.finished_at), + group: data.group ? unmarshalRpnV2Group(data.group) : undefined, + id: data.id, + member: data.member ? unmarshalRpnV2Member(data.member) : undefined, + status: data.status, + } as Log +} + +export const unmarshalListRpnV2GroupLogsResponse = ( + data: unknown, +): ListRpnV2GroupLogsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnV2GroupLogsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + logs: unmarshalArrayOfObject(data.logs, unmarshalLog), + totalCount: data.total_count, + } as ListRpnV2GroupLogsResponse +} + +export const unmarshalListRpnV2GroupsResponse = ( + data: unknown, +): ListRpnV2GroupsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnV2GroupsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + rpnGroups: unmarshalArrayOfObject(data.rpn_groups, unmarshalRpnV2Group), + totalCount: data.total_count, + } as ListRpnV2GroupsResponse +} + +export const unmarshalListRpnV2MembersResponse = ( + data: unknown, +): ListRpnV2MembersResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListRpnV2MembersResponse' failed as data isn't a dictionary.`, + ) + } + + return { + members: unmarshalArrayOfObject(data.members, unmarshalRpnV2Member), + totalCount: data.total_count, + } as ListRpnV2MembersResponse +} + +const unmarshalServerDisk = (data: unknown): ServerDisk => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerDisk' failed as data isn't a dictionary.`, + ) + } + + return { + capacity: data.capacity, + connector: data.connector, + id: data.id, + isAddon: data.is_addon, + type: data.type, + } as ServerDisk +} + +export const unmarshalListServerDisksResponse = ( + data: unknown, +): ListServerDisksResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListServerDisksResponse' failed as data isn't a dictionary.`, + ) + } + + return { + disks: unmarshalArrayOfObject(data.disks, unmarshalServerDisk), + totalCount: data.total_count, + } as ListServerDisksResponse +} + +const unmarshalServerEvent = (data: unknown): ServerEvent => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerEvent' failed as data isn't a dictionary.`, + ) + } + + return { + date: unmarshalDate(data.date), + description: data.description, + eventId: data.event_id, + } as ServerEvent +} + +export const unmarshalListServerEventsResponse = ( + data: unknown, +): ListServerEventsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListServerEventsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + events: unmarshalArrayOfObject(data.events, unmarshalServerEvent), + totalCount: data.total_count, + } as ListServerEventsResponse +} + +const unmarshalServerSummary = (data: unknown): ServerSummary => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerSummary' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + datacenterName: data.datacenter_name, + expiredAt: unmarshalDate(data.expired_at), + hostname: data.hostname, + id: data.id, + interfaces: unmarshalArrayOfObject( + data.interfaces, + unmarshalNetworkInterface, + ), + isOutsourced: data.is_outsourced, + level: data.level ? unmarshalServiceLevel(data.level) : undefined, + offerId: data.offer_id, + offerName: data.offer_name, + organizationId: data.organization_id, + osId: data.os_id, + projectId: data.project_id, + qinq: data.qinq, + rpnVersion: data.rpn_version, + status: data.status, + updatedAt: unmarshalDate(data.updated_at), + zone: data.zone, + } as ServerSummary +} + +export const unmarshalListServersResponse = ( + data: unknown, +): ListServersResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`, + ) + } + + return { + servers: unmarshalArrayOfObject(data.servers, unmarshalServerSummary), + totalCount: data.total_count, + } as ListServersResponse +} + +export const unmarshalListServicesResponse = ( + data: unknown, +): ListServicesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListServicesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + services: unmarshalArrayOfObject(data.services, unmarshalService), + totalCount: data.total_count, + } as ListServicesResponse +} + +export const unmarshalListSubscribableServerOptionsResponse = ( + data: unknown, +): ListSubscribableServerOptionsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListSubscribableServerOptionsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + serverOptions: unmarshalArrayOfObject(data.server_options, unmarshalOffer), + totalCount: data.total_count, + } as ListSubscribableServerOptionsResponse +} + +const unmarshalRaidArray = (data: unknown): RaidArray => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'RaidArray' failed as data isn't a dictionary.`, + ) + } + + return { + disks: unmarshalArrayOfObject(data.disks, unmarshalServerDisk), + raidLevel: data.raid_level, + } as RaidArray +} + +export const unmarshalRaid = (data: unknown): Raid => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Raid' failed as data isn't a dictionary.`, + ) + } + + return { + raidArrays: unmarshalArrayOfObject(data.raid_arrays, unmarshalRaidArray), + } as Raid +} + +export const unmarshalRefund = (data: unknown): Refund => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Refund' failed as data isn't a dictionary.`, + ) + } + + return { + content: data.content, + createdAt: unmarshalDate(data.created_at), + id: data.id, + method: data.method, + refundedAt: unmarshalDate(data.refunded_at), + status: data.status, + totalWithTaxes: data.total_with_taxes + ? unmarshalMoney(data.total_with_taxes) + : undefined, + totalWithoutTaxes: data.total_without_taxes + ? unmarshalMoney(data.total_without_taxes) + : undefined, + } as Refund +} + +export const unmarshalRescue = (data: unknown): Rescue => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Rescue' failed as data isn't a dictionary.`, + ) + } + + return { + login: data.login, + osId: data.os_id, + password: data.password, + protocol: data.protocol, + } as Rescue +} + +const unmarshalPartition = (data: unknown): Partition => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Partition' failed as data isn't a dictionary.`, + ) + } + + return { + capacity: data.capacity, + connectors: data.connectors, + fileSystem: data.file_system, + mountPoint: data.mount_point, + raidLevel: data.raid_level, + type: data.type, + } as Partition +} + +export const unmarshalServerDefaultPartitioning = ( + data: unknown, +): ServerDefaultPartitioning => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerDefaultPartitioning' failed as data isn't a dictionary.`, + ) + } + + return { + partitions: unmarshalArrayOfObject(data.partitions, unmarshalPartition), + } as ServerDefaultPartitioning +} + +export const unmarshalServerInstall = (data: unknown): ServerInstall => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ServerInstall' failed as data isn't a dictionary.`, + ) + } + + return { + hostname: data.hostname, + osId: data.os_id, + panelUrl: data.panel_url, + partitions: unmarshalArrayOfObject(data.partitions, unmarshalPartition), + sshKeyIds: data.ssh_key_ids, + status: data.status, + userLogin: data.user_login, + } as ServerInstall +} + +export const unmarshalSubscribeStorageOptionsResponse = ( + data: unknown, +): SubscribeStorageOptionsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'SubscribeStorageOptionsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + services: unmarshalArrayOfObject(data.services, unmarshalService), + } as SubscribeStorageOptionsResponse +} + +export const marshalAttachFailoverIPToMacAddressRequest = ( + request: AttachFailoverIPToMacAddressRequest, + defaults: DefaultValues, +): Record => ({ + mac: request.mac, + type: request.type, +}) + +export const marshalAttachFailoverIPsRequest = ( + request: AttachFailoverIPsRequest, + defaults: DefaultValues, +): Record => ({ + fips_ids: request.fipsIds, + server_id: request.serverId, +}) + +export const marshalCreateFailoverIPsRequest = ( + request: CreateFailoverIPsRequest, + defaults: DefaultValues, +): Record => ({ + offer_id: request.offerId, + project_id: request.projectId ?? defaults.defaultProjectId, + quantity: request.quantity, +}) + +export const marshalCreateServerRequest = ( + request: CreateServerRequest, + defaults: DefaultValues, +): Record => ({ + datacenter_name: request.datacenterName, + offer_id: request.offerId, + project_id: request.projectId ?? defaults.defaultProjectId, + server_option_ids: request.serverOptionIds, +}) + +export const marshalDetachFailoverIPsRequest = ( + request: DetachFailoverIPsRequest, + defaults: DefaultValues, +): Record => ({ + fips_ids: request.fipsIds, +}) + +export const marshalIPv6BlockApiCreateIPv6BlockRequest = ( + request: IPv6BlockApiCreateIPv6BlockRequest, + defaults: DefaultValues, +): Record => ({ + project_id: request.projectId ?? defaults.defaultProjectId, +}) + +export const marshalIPv6BlockApiCreateIPv6BlockSubnetRequest = ( + request: IPv6BlockApiCreateIPv6BlockSubnetRequest, + defaults: DefaultValues, +): Record => ({ + address: request.address, + cidr: request.cidr, +}) + +export const marshalIPv6BlockApiUpdateIPv6BlockRequest = ( + request: IPv6BlockApiUpdateIPv6BlockRequest, + defaults: DefaultValues, +): Record => ({ + nameservers: request.nameservers, +}) + +const marshalInstallPartition = ( + request: InstallPartition, + defaults: DefaultValues, +): Record => ({ + capacity: request.capacity, + connectors: request.connectors, + file_system: request.fileSystem, + mount_point: request.mountPoint, + raid_level: request.raidLevel, +}) + +export const marshalInstallServerRequest = ( + request: InstallServerRequest, + defaults: DefaultValues, +): Record => ({ + hostname: request.hostname, + ip_id: request.ipId, + license_offer_id: request.licenseOfferId, + os_id: request.osId, + panel_password: request.panelPassword, + partitions: + request.partitions !== undefined + ? request.partitions.map(elt => marshalInstallPartition(elt, defaults)) + : undefined, + root_password: request.rootPassword, + ssh_key_ids: request.sshKeyIds, + user_login: request.userLogin, + user_password: request.userPassword, +}) + +export const marshalRpnSanApiAddIpRequest = ( + request: RpnSanApiAddIpRequest, + defaults: DefaultValues, +): Record => ({ + ip_ids: request.ipIds, +}) + +export const marshalRpnSanApiCreateRpnSanRequest = ( + request: RpnSanApiCreateRpnSanRequest, + defaults: DefaultValues, +): Record => ({ + offer_id: request.offerId, + project_id: request.projectId ?? defaults.defaultProjectId, +}) + +export const marshalRpnSanApiRemoveIpRequest = ( + request: RpnSanApiRemoveIpRequest, + defaults: DefaultValues, +): Record => ({ + ip_ids: request.ipIds, +}) + +export const marshalRpnV1ApiAddRpnGroupMembersRequest = ( + request: RpnV1ApiAddRpnGroupMembersRequest, + defaults: DefaultValues, +): Record => ({ + san_server_ids: request.sanServerIds, + server_ids: request.serverIds, +}) + +export const marshalRpnV1ApiCreateRpnGroupRequest = ( + request: RpnV1ApiCreateRpnGroupRequest, + defaults: DefaultValues, +): Record => ({ + name: request.name, + project_id: request.projectId ?? defaults.defaultProjectId, + san_server_ids: request.sanServerIds, + server_ids: request.serverIds, +}) + +export const marshalRpnV1ApiDeleteRpnGroupMembersRequest = ( + request: RpnV1ApiDeleteRpnGroupMembersRequest, + defaults: DefaultValues, +): Record => ({ + member_ids: request.memberIds, +}) + +export const marshalRpnV1ApiLeaveRpnGroupRequest = ( + request: RpnV1ApiLeaveRpnGroupRequest, + defaults: DefaultValues, +): Record => ({ + member_ids: request.memberIds, + project_id: request.projectId ?? defaults.defaultProjectId, +}) + +export const marshalRpnV1ApiRpnGroupInviteRequest = ( + request: RpnV1ApiRpnGroupInviteRequest, + defaults: DefaultValues, +): Record => ({ + project_id: request.projectId ?? defaults.defaultProjectId, + server_ids: request.serverIds, +}) + +export const marshalRpnV1ApiUpdateRpnGroupNameRequest = ( + request: RpnV1ApiUpdateRpnGroupNameRequest, + defaults: DefaultValues, +): Record => ({ + name: request.name, +}) + +export const marshalRpnV2ApiAddRpnV2MembersRequest = ( + request: RpnV2ApiAddRpnV2MembersRequest, + defaults: DefaultValues, +): Record => ({ + servers: request.servers, +}) + +export const marshalRpnV2ApiCreateRpnV2GroupRequest = ( + request: RpnV2ApiCreateRpnV2GroupRequest, + defaults: DefaultValues, +): Record => ({ + name: request.name, + project_id: request.projectId ?? defaults.defaultProjectId, + servers: request.servers, + type: request.type, +}) + +export const marshalRpnV2ApiDeleteRpnV2MembersRequest = ( + request: RpnV2ApiDeleteRpnV2MembersRequest, + defaults: DefaultValues, +): Record => ({ + member_ids: request.memberIds, +}) + +export const marshalRpnV2ApiEnableRpnV2GroupCompatibilityRequest = ( + request: RpnV2ApiEnableRpnV2GroupCompatibilityRequest, + defaults: DefaultValues, +): Record => ({ + rpnv1_group_id: request.rpnv1GroupId, +}) + +export const marshalRpnV2ApiUpdateRpnV2GroupNameRequest = ( + request: RpnV2ApiUpdateRpnV2GroupNameRequest, + defaults: DefaultValues, +): Record => ({ + name: request.name, +}) + +export const marshalRpnV2ApiUpdateRpnV2VlanForMembersRequest = ( + request: RpnV2ApiUpdateRpnV2VlanForMembersRequest, + defaults: DefaultValues, +): Record => ({ + member_ids: request.memberIds, + vlan: request.vlan, +}) + +export const marshalStartBMCAccessRequest = ( + request: StartBMCAccessRequest, + defaults: DefaultValues, +): Record => ({ + ip: request.ip, +}) + +export const marshalStartRescueRequest = ( + request: StartRescueRequest, + defaults: DefaultValues, +): Record => ({ + os_id: request.osId, +}) + +export const marshalSubscribeServerOptionRequest = ( + request: SubscribeServerOptionRequest, + defaults: DefaultValues, +): Record => ({ + option_id: request.optionId, +}) + +export const marshalSubscribeStorageOptionsRequest = ( + request: SubscribeStorageOptionsRequest, + defaults: DefaultValues, +): Record => ({ + options_ids: request.optionsIds, +}) + +const marshalUpdatableRaidArray = ( + request: UpdatableRaidArray, + defaults: DefaultValues, +): Record => ({ + disk_ids: request.diskIds, + raid_level: request.raidLevel, +}) + +export const marshalUpdateRaidRequest = ( + request: UpdateRaidRequest, + defaults: DefaultValues, +): Record => ({ + raid_arrays: request.raidArrays.map(elt => + marshalUpdatableRaidArray(elt, defaults), + ), +}) + +export const marshalUpdateReverseRequest = ( + request: UpdateReverseRequest, + defaults: DefaultValues, +): Record => ({ + reverse: request.reverse, +}) + +export const marshalUpdateServerBackupRequest = ( + request: UpdateServerBackupRequest, + defaults: DefaultValues, +): Record => ({ + acl_enabled: request.aclEnabled, + autologin: request.autologin, + password: request.password, +}) + +export const marshalUpdateServerRequest = ( + request: UpdateServerRequest, + defaults: DefaultValues, +): Record => ({ + enable_ipv6: request.enableIpv6, + hostname: request.hostname, +}) + +export const marshalUpdateServerTagsRequest = ( + request: UpdateServerTagsRequest, + defaults: DefaultValues, +): Record => ({ + tags: request.tags, +}) diff --git a/packages/clients/src/api/dedibox/v1/types.gen.ts b/packages/clients/src/api/dedibox/v1/types.gen.ts new file mode 100644 index 000000000..1b840b1d8 --- /dev/null +++ b/packages/clients/src/api/dedibox/v1/types.gen.ts @@ -0,0 +1,2317 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import type { Money, Zone } from '../../../bridge' + +export type AttachFailoverIPToMacAddressRequestMacType = + | 'mac_type_unknown' + | 'vmware' + | 'kvm' + | 'xen' + +export type BMCAccessStatus = 'unknown' | 'creating' | 'created' | 'deleting' + +export type BackupStatus = + | 'unknown_backup_status' + | 'uninitialized' + | 'inactive' + | 'ready' + +export type FailoverBlockVersion = 'unknown_version' | 'ipv4' | 'ipv6' + +export type FailoverIPInterfaceType = 'unknown' | 'normal' | 'ipmi' | 'virtual' + +export type FailoverIPStatus = 'unknown_status' | 'ready' | 'busy' | 'locked' + +export type FailoverIPVersion = 'unknown_version' | 'ipv4' | 'ipv6' + +export type GetRpnStatusResponseStatus = + | 'unknown_status' + | 'busy' + | 'operational' + +export type IPSemantic = + | 'unknown' + | 'proxad' + | 'ext' + | 'public' + | 'private' + | 'ipmi' + | 'adm' + | 'redirect' + | 'migration' + +export type IPStatus = 'unknown_status' | 'ready' | 'busy' | 'locked' + +export type IPVersion = 'ipv4' | 'ipv6' + +export type IPv6BlockDelegationStatus = 'unknown_status' | 'updating' | 'done' + +export type InvoicePaymentMethod = + | 'unknown_payment_method' + | 'credit_card' + | 'amex' + | 'paypal' + | 'transfer' + | 'direct_debit' + +export type InvoiceStatus = + | 'unknown_invoice_status' + | 'unpaid' + | 'paid' + | 'errored' + +export type ListFailoverIPsRequestOrderBy = 'ip_asc' | 'ip_desc' + +export type ListInvoicesRequestOrderBy = 'created_at_asc' | 'created_at_desc' + +export type ListOSRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'released_at_asc' + | 'released_at_desc' + +export type ListOffersRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'name_asc' + | 'name_desc' + | 'price_asc' + | 'price_desc' + +export type ListRefundsRequestOrderBy = 'created_at_asc' | 'created_at_desc' + +export type ListRpnCapableSanServersRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + +export type ListRpnCapableServersRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + +export type ListRpnGroupMembersRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + +export type ListRpnGroupsRequestOrderBy = 'created_at_asc' | 'created_at_desc' + +export type ListRpnInvitesRequestOrderBy = 'created_at_asc' | 'created_at_desc' + +export type ListRpnSansRequestOrderBy = 'created_at_asc' | 'created_at_desc' + +export type ListRpnServerCapabilitiesRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + +export type ListRpnV2CapableResourcesRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + +export type ListRpnV2GroupLogsRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + +export type ListRpnV2GroupsRequestOrderBy = 'created_at_asc' | 'created_at_desc' + +export type ListRpnV2MembersRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + +export type ListRpnV2MembersRequestType = + | 'unknown_type' + | 'rpnv1_group' + | 'server' + +export type ListServerDisksRequestOrderBy = 'created_at_asc' | 'created_at_desc' + +export type ListServerEventsRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + +export type ListServersRequestOrderBy = 'created_at_asc' | 'created_at_desc' + +export type ListServicesRequestOrderBy = 'created_at_asc' | 'created_at_desc' + +export type LogAction = + | 'unknown_log_action' + | 'group_created' + | 'group_deleted' + | 'members_added' + | 'members_deleted' + | 'description_updated' + | 'rpnv1_members_added' + | 'rpnv1_members_deleted' + | 'vlan_updated' + | 'vlan_updated_on_all_servers' + +export type LogStatus = + | 'unknown_log_status' + | 'success' + | 'in_progress' + | 'error' + +export type MemoryType = 'ddr2' | 'ddr3' | 'ddr4' + +export type NetworkInterfaceInterfaceType = + | 'unknown' + | 'normal' + | 'ipmi' + | 'virtual' + +export type OSArch = 'unknown_arch' | 'amd64' | 'x86' | 'arm' | 'arm64' + +export type OSType = + | 'unknown_type' + | 'server' + | 'virtu' + | 'panel' + | 'desktop' + | 'custom' + | 'rescue' + +export type OfferAntiDosInfoType = 'minimal' | 'preventive' | 'curative' + +export type OfferCatalog = + | 'all' + | 'default' + | 'beta' + | 'reseller' + | 'premium' + | 'volume' + | 'admin' + | 'inactive' + +export type OfferPaymentFrequency = 'monthly' | 'oneshot' + +export type OfferSANInfoType = 'hdd' | 'ssd' + +export type OfferServerInfoStock = 'empty' | 'low' | 'available' + +export type PartitionFileSystem = + | 'unknown' + | 'efi' + | 'swap' + | 'ext4' + | 'ext3' + | 'ext2' + | 'xfs' + | 'ntfs' + | 'fat32' + | 'ufs' + +export type PartitionType = 'primary' | 'extended' | 'logical' + +export type RaidArrayRaidLevel = + | 'no_raid' + | 'raid0' + | 'raid1' + | 'raid5' + | 'raid6' + | 'raid10' + +export type RefundMethod = + | 'unknown_refund_method' + | 'credit_card' + | 'amex' + | 'paypal' + | 'transfer' + +export type RefundStatus = + | 'unknown_refund_status' + | 'unpaid' + | 'paid' + | 'errored' + +export type RescueProtocol = 'vnc' | 'ssh' + +export type RpnGroupMemberStatus = + | 'unknown_rpn_member_status' + | 'pending_invitation' + | 'active' + | 'creating' + | 'deleting' + | 'deleted' + +export type RpnGroupType = 'unknown' | 'local' | 'shared' + +export type RpnSanIpType = 'unknown' | 'server_ip' | 'rpnv2_subnet' + +export type RpnSanStatus = + | 'unknown_status' + | 'creating' + | 'active' + | 'deleting' + | 'maintenance' + +export type RpnV2GroupStatus = + | 'unknown_group_status' + | 'creating' + | 'active' + | 'updating' + | 'deleting' + +export type RpnV2GroupType = 'unknown_type' | 'standard' | 'qinq' + +export type RpnV2MemberStatus = + | 'unknown_member_status' + | 'creating' + | 'active' + | 'updating' + | 'deleting' + +export type ServerDiskType = 'sata' | 'ssd' | 'sas' | 'sshd' | 'usb' | 'nvme' + +export type ServerInstallStatus = + | 'unknown' + | 'booting' + | 'setting_up_raid' + | 'partitioning' + | 'formatting' + | 'installing' + | 'configuring' + | 'configuring_bootloader' + | 'rebooting' + | 'installed' + +export type ServerStatus = + | 'unknown' + | 'delivering' + | 'installing' + | 'ready' + | 'stopped' + | 'error' + | 'locked' + | 'rescue' + | 'busy' + +export type ServiceLevelLevel = 'unknown' | 'basic' | 'business' + +export type ServiceProvisioningStatus = + | 'unknown' + | 'delivering' + | 'ready' + | 'error' + | 'expiring' + | 'expired' + +export type ServiceType = 'unknown_type' | 'service' | 'order' + +export interface OfferAntiDosInfo { + type: OfferAntiDosInfoType +} + +export interface OfferBackupInfo { + size: number +} + +export interface OfferBandwidthInfo { + speed: number +} + +export interface OfferLicenseInfo { + boundToIp: boolean +} + +export interface OfferRPNInfo { + speed: number +} + +export interface OfferSANInfo { + /** SAN size (in bytes). */ + size: number + /** High availabilty offer. */ + ha: boolean + /** Type of SAN device (hdd / ssd). */ + deviceType: OfferSANInfoType +} + +export interface OfferStorageInfo { + maxQuota: number + size: number +} + +export interface IP { + /** ID of the IP. */ + ipId: string + /** Address of the IP. */ + address: string + /** Reverse IP value. */ + reverse: string + /** Version of IP (v4 or v6). */ + version: IPVersion + /** Classless InterDomain Routing notation of the IP. */ + cidr: number + /** Network mask of IP. */ + netmask: string + /** Semantic of IP. */ + semantic: IPSemantic + /** Gateway of IP. */ + gateway: string + /** Status of the IP. */ + status: IPStatus +} + +export interface Offer { + /** ID of the offer. */ + id: number + /** Name of the offer. */ + name: string + /** Catalog of the offer. */ + catalog: OfferCatalog + /** Payment frequency of the offer. */ + paymentFrequency: OfferPaymentFrequency + /** Price of the offer. */ + pricing?: Money + /** + * Server info if it is a server offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + serverInfo?: OfferServerInfo + /** + * Service level info if it is a service level offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + serviceLevelInfo?: OfferServiceLevelInfo + /** + * RPN info if it is a RPN offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + rpnInfo?: OfferRPNInfo + /** + * SAN info if it is a SAN offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + sanInfo?: OfferSANInfo + /** + * AntiDOS info if it is a antiDOS offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + antidosInfo?: OfferAntiDosInfo + /** + * Backup info if it is a backup offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + backupInfo?: OfferBackupInfo + /** + * USB storage info if it is a USB storage offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + usbStorageInfo?: OfferStorageInfo + /** + * Storage info if it is a storage offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + storageInfo?: OfferStorageInfo + /** + * License info if it is a license offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + licenseInfo?: OfferLicenseInfo + /** + * Failover IP info if it is a failover IP offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + failoverIpInfo?: OfferFailoverIpInfo + /** + * Failover block info if it is a failover block offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + failoverBlockInfo?: OfferFailoverBlockInfo + /** + * Bandwidth info if it is a bandwidth offer. + * + * One-of ('offerInfo'): at most one of 'serverInfo', 'serviceLevelInfo', + * 'rpnInfo', 'sanInfo', 'antidosInfo', 'backupInfo', 'usbStorageInfo', + * 'storageInfo', 'licenseInfo', 'failoverIpInfo', 'failoverBlockInfo', + * 'bandwidthInfo' could be set. + */ + bandwidthInfo?: OfferBandwidthInfo +} + +export interface NetworkInterface { + /** Card ID of the network interface. */ + cardId: number + /** Device ID of the network interface. */ + deviceId: number + /** MAC address of the network interface. */ + mac: string + /** Network interface type. */ + type: NetworkInterfaceInterfaceType + /** IPs of the network interface. */ + ips: IP[] +} + +export interface OS { + /** ID of the OS. */ + id: number + /** Name of the OS. */ + name: string + /** Type of the OS. */ + type: OSType + /** Version of the OS. */ + version: string + /** Architecture of the OS. */ + arch: OSArch + /** True if the OS allow custom partitioning. */ + allowCustomPartitioning: boolean + /** True if the OS allow SSH Keys. */ + allowSshKeys: boolean + /** True if the OS requires user. */ + requiresUser: boolean + /** True if the OS requires admin password. */ + requiresAdminPassword: boolean + /** True if the OS requires panel password. */ + requiresPanelPassword: boolean + /** True if the OS allow file systems. */ + allowedFilesystems: PartitionFileSystem[] + /** True if the OS requires license. */ + requiresLicense: boolean + /** License offers available with the OS. */ + licenseOffers: Offer[] + /** Maximum number of partitions which can be created. */ + maxPartitions?: number + /** Display name of the OS. */ + displayName: string + /** Regex used to validate the installation passwords. */ + passwordRegex: string + /** Regex used to validate the panel installation password. */ + panelPasswordRegex?: string + /** + * If both requires_valid_hostname & hostname_regex are set, it means that at + * least one of the criterias must be valid. + */ + requiresValidHostname?: boolean + /** + * If both requires_valid_hostname & hostname_regex are set, it means that at + * least one of the criterias must be valid. + */ + hostnameRegex?: string + /** Hostname max length. */ + hostnameMaxLength: number + /** OS release date. */ + releasedAt?: Date +} + +export interface ServerLocation { + rack: string + room: string + datacenterName: string +} + +export interface ServerOption { + offer?: Offer + createdAt?: Date + updatedAt?: Date + expiredAt?: Date + options: ServerOption[] +} + +export interface ServiceLevel { + /** Offer ID of service level. */ + offerId: number + /** Level type of service level. */ + level: ServiceLevelLevel +} + +export interface RpnSan { + /** RPN SAN ID. */ + id: number + /** Datacenter location. */ + datacenterName: string + /** Organization ID. */ + organizationId: string + /** Project ID. */ + projectId: string + /** RPN SAN server hostname. */ + serverHostname: string + /** IQN suffix. */ + iqnSuffix: string + /** Date of creation of the RPN SAN. */ + createdAt?: Date + /** Offer ID. */ + offerId: number + /** Offer description. */ + offerName: string + /** Status. */ + status: RpnSanStatus + /** RPN SAN storage size. */ + storageSize: number + iqn: string + offer?: Offer + /** True if the SAN is compatible with the RPNv1 technology. */ + rpnv1Compatible: boolean + /** + * True if the offer supports the RPNv1 implicitly, false if it must to be + * added to a group to support RPNv1. + */ + rpnv1Implicit: boolean + /** RPN SAN delivery date. */ + deliveredAt?: Date + /** RPN SAN termination date. */ + terminatedAt?: Date + /** RPN SAN expiration date. */ + expiresAt?: Date +} + +export interface RpnGroup { + /** Rpn group member ID. */ + id: number + /** Rpn group name. */ + name: string + /** Rpn group type (local or shared). */ + type: RpnGroupType + /** Whether the group is active or not. */ + active: boolean + /** Rpn group creation date. */ + createdAt?: Date + /** RPN group owner. */ + owner: string + /** Total number of members. */ + membersCount: number + /** Rpn group organization ID. */ + organizationId: string + /** Rpn group project ID. */ + projectId: string +} + +export interface RpnV2GroupSubnet { + address: string + cidr: number +} + +export interface Server { + /** ID of the server. */ + id: number + /** Organization ID the server is attached to. */ + organizationId: string + /** Project ID the server is attached to. */ + projectId: string + /** Hostname of the server. */ + hostname: string + /** Date of last reboot of the server. */ + rebootedAt?: Date + /** Date of creation of the server. */ + createdAt?: Date + /** Date of last modification of the server. */ + updatedAt?: Date + /** Date of release of the server. */ + expiredAt?: Date + /** Offer of the server. */ + offer?: Offer + /** Status of the server. */ + status: ServerStatus + /** Location of the server. */ + location?: ServerLocation + /** Abuse contact of the server. */ + abuseContact: string + /** OS installed on the server. */ + os?: OS + /** Network interfaces of the server. */ + interfaces: NetworkInterface[] + /** The zone in which is the server. */ + zone: Zone + /** Options subscribe on the server. */ + options: ServerOption[] + /** Service level of the server. */ + level?: ServiceLevel + /** Boolean if the server has a BMC. */ + hasBmc: boolean + /** Rescue OS of the server. */ + rescueOs?: OS + /** Array of customs tags attached to the server. */ + tags: string[] + /** Whether the server is outsourced or not. */ + isOutsourced: boolean + /** Whether or not you can enable/disable the IPv6. */ + ipv6Slaac: boolean + /** Whether the server is compatible with QinQ. */ + qinq: boolean + /** Whether or not the server is already part of an rpnv2 group. */ + isRpnv2Member: boolean +} + +export interface FailoverBlock { + /** ID of the failover block. */ + id: number + /** IP of the failover block. */ + address: string + /** Name servers. */ + nameservers: string[] + /** IP version of the failover block. */ + ipVersion: FailoverBlockVersion + /** Classless InterDomain Routing notation of the failover block. */ + cidr: number + /** Netmask of the failover block. */ + netmask: string + /** Gateway IP of the failover block. */ + gatewayIp: string +} + +export interface RpnSanIpRpnV2Group { + id: number + name: string +} + +export interface RpnSanIpServer { + id: number + hostname: string + datacenterName: string +} + +export interface RpnSanServer { + /** The RPN SAN server ID. */ + id: number + /** The RPN SAN server datacenter name. */ + datacenterName: string + /** The RPN SAN server hostname. */ + hostname: string + /** RPN SANs linked to the RPN SAN server. */ + sans: RpnSan[] + /** The RPN SAN server zone. */ + zone: Zone +} + +export interface RpnV2Group { + /** RPN V2 group ID. */ + id: number + /** RPN V2 group name. */ + name: string + /** Whether or not the RPN V1 compatibility was enabled. */ + compatibleRpnv1: boolean + /** Organization ID of the RPN V2 group. */ + organizationId: string + /** Project ID of the RPN V2 group. */ + projectId: string + /** RPN V2 group type (qing / standard). */ + type: RpnV2GroupType + /** RPN V2 group status. */ + status: RpnV2GroupStatus + /** RPN V2 group owner. */ + owner: string + /** Total number of members. */ + membersCount: number + /** RPN V2 subnet. */ + subnet?: RpnV2GroupSubnet + /** RPN V2 gateway. */ + gateway: string + /** The RPNv1 group (if the compatibility was enabled). */ + rpnv1Group?: RpnGroup +} + +export interface RpnV2Member { + /** RPN V2 member ID. */ + id: number + /** RPN V2 member status. */ + status: RpnV2MemberStatus + /** RPN V2 member VLAN. */ + vlan: string + /** + * Server behind the member (may be empty). + * + * One-of ('resource'): at most one of 'server', 'rpnv1Group' could be set. + */ + server?: Server + /** + * RPN V1 group member. + * + * One-of ('resource'): at most one of 'server', 'rpnv1Group' could be set. + */ + rpnv1Group?: RpnGroup + /** RPN speed. */ + speed?: number +} + +export interface ServerDisk { + id: number + connector: string + type: ServerDiskType + capacity: number + isAddon: boolean +} + +export interface Service { + /** ID of the service. */ + id: number + /** Resource ID of the service. */ + resourceId?: number + /** Provisioning status of the service. */ + provisioningStatus: ServiceProvisioningStatus + /** Offer of the service. */ + offer?: Offer + /** Creation date of the service. */ + createdAt?: Date + /** Delivery date of the service. */ + deliveredAt?: Date + /** Terminatation date of the service. */ + terminatedAt?: Date + /** Expiration date of the service. */ + expiresAt?: Date + /** Service type, either order or service. */ + type: ServiceType +} + +export interface GetIPv6BlockQuotasResponseQuota { + quota: number + cidr: number +} + +export interface InstallPartition { + /** File system of the installation partition. */ + fileSystem: PartitionFileSystem + /** Mount point of the installation partition. */ + mountPoint?: string + /** RAID level of the installation partition. */ + raidLevel: RaidArrayRaidLevel + /** Capacity of the installation partition. */ + capacity: number + /** Connectors of the installation partition. */ + connectors: string[] +} + +export interface FailoverIP { + /** ID of the failover IP. */ + id: number + /** IP of the failover IP. */ + address: string + /** Reverse IP value. */ + reverse: string + /** IP version of the failover IP. */ + ipVersion: FailoverIPVersion + /** Classless InterDomain Routing notation of the failover IP. */ + cidr: number + /** Netmask of the failover IP. */ + netmask: string + /** Gateway IP of the failover IP. */ + gatewayIp: string + /** MAC address of the IP failover. */ + mac?: string + /** Server ID linked to the IP failover. */ + serverId?: number + /** Status of the IP failover. */ + status: FailoverIPStatus + /** Block of the IP failover. */ + block?: FailoverBlock + /** The interface type. */ + type: FailoverIPInterfaceType + /** The server zone (if assigned). */ + serverZone?: string +} + +export interface ListIPv6BlockSubnetsAvailableResponseSubnet { + address: string + cidr: number +} + +export interface InvoiceSummary { + id: number + totalWithTaxes?: Money + totalWithoutTaxes?: Money + createdAt?: Date + paidAt?: Date + status: InvoiceStatus + paymentMethod: InvoicePaymentMethod + transactionId: number +} + +export interface RpnSanIp { + /** + * Basic server information behind the IP. + * + * One-of ('rpnSanIp'): at most one of 'server', 'rpnv2Group' could be set. + */ + server?: RpnSanIpServer + /** + * Basic RPNv2 group information behind the IP. + * + * One-of ('rpnSanIp'): at most one of 'server', 'rpnv2Group' could be set. + */ + rpnv2Group?: RpnSanIpRpnV2Group + /** An IP object. */ + ip?: IP + /** IP type (server | rpnv2_subnet). */ + type: RpnSanIpType +} + +export interface RefundSummary { + id: number + totalWithTaxes?: Money + totalWithoutTaxes?: Money + createdAt?: Date + refundedAt?: Date + status: RefundStatus + method: RefundMethod +} + +export interface RpnGroupMember { + /** Rpn group member ID. */ + id: number + /** RPN group member status. */ + status: RpnGroupMemberStatus + /** Authorized RPN SAN server. */ + sanServer?: RpnSanServer + /** Authorized rpn v1 capable server. */ + server?: Server + /** RPN group ID. */ + groupId: number + /** RPN group name. */ + groupName: string + /** RPN group owner. */ + groupOwner: string + /** RPN speed. */ + speed?: number + /** RPN member owner. */ + owner: string +} + +export interface RpnSanSummary { + /** RPN SAN ID. */ + id: number + /** Datacenter location. */ + datacenterName: string + /** Organization ID. */ + organizationId: string + /** Project ID. */ + projectId: string + /** RPN SAN server hostname. */ + serverHostname: string + /** IQN suffix. */ + iqnSuffix: string + /** Date of creation of the RPN SAN. */ + createdAt?: Date + /** Offer ID. */ + offerId: number + /** Offer description. */ + offerName: string + /** Status. */ + status: RpnSanStatus + /** RPN SAN storage size. */ + storageSize: number + /** True if the SAN is compatible with the RPNv1 technology. */ + rpnv1Compatible: boolean + /** + * True if the offer supports the RPNv1 implicitly, false if it must to be + * added to a group to support RPNv1. + */ + rpnv1Implicit: boolean + /** RPN SAN delivery date. */ + deliveredAt?: Date + /** RPN SAN termination date. */ + terminatedAt?: Date + /** RPN SAN expiration date. */ + expiresAt?: Date +} + +export interface RpnServerCapability { + /** Server ID. */ + id: number + /** Server hostname. */ + hostname: string + /** Server datacenter name. */ + datacenterName: string + /** Server zone. */ + zone: Zone + /** Private IP address (if rpn compatiblle). */ + ipAddress?: string + /** Supported rpn version. */ + rpnVersion?: number + /** True if server is compatible with QinQ protocol (rpn v2). */ + compatibleQinq: boolean + /** True if server can join a QinQ group. */ + canJoinQinqGroup: boolean + /** Times server is linked in a rpnv1 group. */ + rpnv1GroupCount: number + /** Times server is linked in a rpnv2 group. */ + rpnv2GroupCount: number + /** True if server can join an rpnv2 group. */ + canJoinRpnv2Group: boolean +} + +export interface Log { + /** RPN V2 log ID. */ + id: number + /** RPN V2 group. */ + group?: RpnV2Group + /** RPN V2 member (if appliable). */ + member?: RpnV2Member + /** Which action was performed. */ + action: LogAction + /** Action status. */ + status: LogStatus + /** Creation date. */ + createdAt?: Date + /** Completion date. */ + finishedAt?: Date +} + +export interface ServerEvent { + /** ID of the event. */ + eventId: number + /** Descriptiion of the event. */ + description: string + /** Date of the event. */ + date?: Date +} + +export interface ServerSummary { + /** ID of the server. */ + id: number + /** Datacenter of the server. */ + datacenterName: string + /** Organization ID the server is attached to. */ + organizationId: string + /** Project ID the server is attached to. */ + projectId: string + /** Hostname of the server. */ + hostname: string + /** Date of creation of the server. */ + createdAt?: Date + /** Date of last modification of the server. */ + updatedAt?: Date + /** Date of release of the server. */ + expiredAt?: Date + /** Offer ID of the server. */ + offerId: number + /** Offer name of the server. */ + offerName: string + /** Status of the server. */ + status: ServerStatus + /** OS ID installed on server. */ + osId?: number + /** Network interfaces of the server. */ + interfaces: NetworkInterface[] + /** The zone in which is the server. */ + zone: Zone + /** Service level of the server. */ + level?: ServiceLevel + /** Whether the server is outsourced or not. */ + isOutsourced: boolean + /** Whether the server is compatible with QinQ. */ + qinq: boolean + /** Supported RPN version. */ + rpnVersion?: number +} + +export interface CPU { + /** Name of CPU. */ + name: string + /** Number of cores of the CPU. */ + coreCount: number + /** Number of threads of the CPU. */ + threadCount: number + /** Frequency of the CPU. */ + frequency: number +} + +export interface Disk { + /** Capacity of the disk. */ + capacity: number + /** Type of the disk. */ + type: ServerDiskType +} + +export interface Memory { + /** Capacity of the memory. */ + capacity: number + /** Type of the memory. */ + type: MemoryType + /** Frequency of the memory. */ + frequency: number + /** True if the memory is an error-correcting code memory. */ + isEcc: boolean +} + +export interface PersistentMemory { + /** Capacity of the persistent memory. */ + capacity: number + /** Frequency of the persistent memory. */ + frequency: number + /** Model of the persistent memory. */ + model: string +} + +export interface RaidController { + /** Model of the RAID controller. */ + model: string + /** RAID level of the RAID controller. */ + raidLevel: string[] +} + +export interface RaidArray { + /** The RAID level. */ + raidLevel: RaidArrayRaidLevel + /** Disks on the RAID controller. */ + disks: ServerDisk[] +} + +export interface Partition { + /** Type of the partition. */ + type: PartitionType + /** File system of the partition. */ + fileSystem: PartitionFileSystem + /** Mount point of the partition. */ + mountPoint?: string + /** Raid level of the partition. */ + raidLevel: RaidArrayRaidLevel + /** Capacity of the partition. */ + capacity: number + /** Connectors of the partition. */ + connectors: string[] +} + +export interface UpdatableRaidArray { + /** The RAID level. */ + raidLevel: RaidArrayRaidLevel + /** The list of Disk ID of the updatable RAID. */ + diskIds: number[] +} + +export type AttachFailoverIPToMacAddressRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the failover IP. */ + ipId: number + /** A mac type. */ + type?: AttachFailoverIPToMacAddressRequestMacType + /** A valid mac address (existing or not). */ + mac?: string +} + +export type AttachFailoverIPsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server. */ + serverId: number + /** List of ID of failovers IP to attach. */ + fipsIds: number[] +} + +export interface BMCAccess { + /** URL to access to the server console. */ + url: string + /** + * The login to use for the BMC (Baseboard Management Controller) access + * authentification. + */ + login: string + /** + * The password to use for the BMC (Baseboard Management Controller) access + * authentification. + */ + password: string + /** + * The date after which the BMC (Baseboard Management Controller) access will + * be closed. + */ + expiresAt?: Date + /** Status of the connection. */ + status: BMCAccessStatus +} + +export interface Backup { + /** ID of the backup. */ + id: number + /** Login of the backup. */ + login: string + /** Server of the backup. */ + server: string + /** Status of the backup. */ + status: BackupStatus + /** ACL enable boolean of the backup. */ + aclEnabled: boolean + /** Autologin boolean of the backup. */ + autologin: boolean + /** Total quota space of the backup. */ + quotaSpace: number + /** Quota space used of the backup. */ + quotaSpaceUsed: number + /** Total quota files of the backup. */ + quotaFiles: number + /** Quota files used of the backup. */ + quotaFilesUsed: number +} + +export type BillingApiCanOrderRequest = { + projectId?: string +} + +export type BillingApiDownloadInvoiceRequest = { + invoiceId: number +} + +export type BillingApiDownloadRefundRequest = { + refundId: number +} + +export type BillingApiGetInvoiceRequest = { + invoiceId: number +} + +export type BillingApiGetRefundRequest = { + refundId: number +} + +export type BillingApiListInvoicesRequest = { + page?: number + pageSize?: number + orderBy?: ListInvoicesRequestOrderBy + projectId?: string +} + +export type BillingApiListRefundsRequest = { + page?: number + pageSize?: number + orderBy?: ListRefundsRequestOrderBy + projectId?: string +} + +export interface CanOrderResponse { + canOrder: boolean + message?: string + quotaOk: boolean + phoneConfirmed: boolean + emailConfirmed: boolean + userConfirmed: boolean + paymentMode: boolean + billingOk: boolean +} + +export type CancelServerInstallRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID of the server to cancel install. */ + serverId: number +} + +export type CreateFailoverIPsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Failover IP offer ID. */ + offerId: number + /** Project ID. */ + projectId?: string + /** Quantity. */ + quantity: number +} + +export interface CreateFailoverIPsResponse { + totalCount: number + services: Service[] +} + +export type CreateServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Offer ID of the new server. */ + offerId: number + /** Server option IDs of the new server. */ + serverOptionIds: number[] + /** Project ID of the new server. */ + projectId?: string + /** Datacenter name of the new server. */ + datacenterName?: string +} + +export type DeleteFailoverIPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the failover IP to delete. */ + ipId: number +} + +export type DeleteServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID to delete. */ + serverId: number +} + +export type DeleteServiceRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the service. */ + serviceId: number +} + +export type DetachFailoverIPFromMacAddressRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the failover IP. */ + ipId: number +} + +export type DetachFailoverIPsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** List of IDs of failovers IP to detach. */ + fipsIds: number[] +} + +export type GetBMCAccessRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server to get BMC access. */ + serverId: number +} + +export type GetFailoverIPRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the failover IP. */ + ipId: number +} + +export interface GetIPv6BlockQuotasResponse { + /** Quota for each CIDR of IPv6 block. */ + quotas: GetIPv6BlockQuotasResponseQuota[] + /** Total count of quotas. */ + totalCount: number +} + +export type GetOSRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the OS. */ + osId: number + /** ID of the server. */ + serverId: number + /** Project ID. */ + projectId?: string +} + +export type GetOfferRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of offer. */ + offerId: number + /** Project ID. */ + projectId?: string +} + +export type GetOrderedServiceRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + orderedServiceId: number +} + +export type GetRaidRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server. */ + serverId: number +} + +export type GetRemainingQuotaRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Project ID. */ + projectId?: string +} + +export interface GetRemainingQuotaResponse { + /** Current failover IP quota. */ + failoverIpQuota: number + /** Remaining failover IP quota. */ + failoverIpRemainingQuota: number + /** Current failover block quota. */ + failoverBlockQuota: number + /** Remaining failover block quota. */ + failoverBlockRemainingQuota: number +} + +export type GetRescueRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server to get rescue. */ + serverId: number +} + +export interface GetRpnStatusResponse { + /** If status = 'operational', you can perform rpn actions in write. */ + status: GetRpnStatusResponseStatus + /** Number of operations left to perform before being operational. */ + operationsLeft?: number +} + +export type GetServerBackupRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID of the backup. */ + serverId: number +} + +export type GetServerDefaultPartitioningRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server. */ + serverId: number + /** OS ID of the default partitioning. */ + osId: number +} + +export type GetServerInstallRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID of the server to install. */ + serverId: number +} + +export type GetServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server. */ + serverId: number +} + +export type GetServiceRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the service. */ + serviceId: number +} + +export interface IPv6Block { + /** ID of the IPv6. */ + id: number + /** Address of the IPv6. */ + address: string + /** DUID of the IPv6. */ + duid: string + /** DNS linked to the IPv6. */ + nameservers: string[] + /** Classless InterDomain Routing notation of the IPv6. */ + cidr: number + /** All IPv6 subnets. */ + subnets: IPv6Block[] + /** The nameservers delegation status. */ + delegationStatus: IPv6BlockDelegationStatus +} + +export type IPv6BlockApiCreateIPv6BlockRequest = { + /** ID of the project. */ + projectId?: string +} + +export type IPv6BlockApiCreateIPv6BlockSubnetRequest = { + /** ID of the IPv6 block. */ + blockId: number + /** Address of the IPv6. */ + address: string + /** Classless InterDomain Routing notation of the IPv6. */ + cidr: number +} + +export type IPv6BlockApiDeleteIPv6BlockRequest = { + /** ID of the IPv6 block to delete. */ + blockId: number +} + +export type IPv6BlockApiGetIPv6BlockQuotasRequest = { + /** ID of the project. */ + projectId?: string +} + +export type IPv6BlockApiGetIPv6BlockRequest = { + /** ID of the project. */ + projectId?: string +} + +export type IPv6BlockApiListIPv6BlockSubnetsAvailableRequest = { + /** ID of the IPv6 block. */ + blockId: number +} + +export type IPv6BlockApiUpdateIPv6BlockRequest = { + /** ID of the IPv6 block. */ + blockId: number + /** DNS to link to the IPv6. */ + nameservers?: string[] +} + +export type InstallServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID to install. */ + serverId: number + /** OS ID to install on the server. */ + osId: number + /** Hostname of the server. */ + hostname: string + /** User to install on the server. */ + userLogin?: string + /** User password to install on the server. */ + userPassword?: string + /** Panel password to install on the server. */ + panelPassword?: string + /** Root password to install on the server. */ + rootPassword?: string + /** Partitions to install on the server. */ + partitions?: InstallPartition[] + /** SSH key IDs authorized on the server. */ + sshKeyIds?: string[] + /** Offer ID of license to install on server. */ + licenseOfferId?: number + /** IP to link at the license to install on server. */ + ipId?: number +} + +export interface Invoice { + id: number + totalWithTaxes?: Money + totalWithoutTaxes?: Money + createdAt?: Date + paidAt?: Date + status: InvoiceStatus + paymentMethod: InvoicePaymentMethod + content: string + transactionId: number +} + +export type ListFailoverIPsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Page number. */ + page?: number + /** Number of failovers IP per page. */ + pageSize?: number + /** Order of the failovers IP. */ + orderBy?: ListFailoverIPsRequestOrderBy + /** Filter failovers IP by project ID. */ + projectId?: string + /** Filter failovers IP which matching with this field. */ + search?: string + /** + * True: return all failovers IP not attached on server false: return all + * failovers IP attached on server. + */ + onlyAvailable?: boolean +} + +export interface ListFailoverIPsResponse { + /** Total count of matching failovers IP. */ + totalCount: number + /** List of failover IPs that match filters. */ + failoverIps: FailoverIP[] +} + +export interface ListIPv6BlockSubnetsAvailableResponse { + /** All available address and CIDR available in subnet. */ + subnetAvailables: ListIPv6BlockSubnetsAvailableResponseSubnet[] + /** Total count of available subnets. */ + totalCount: number +} + +export interface ListInvoicesResponse { + totalCount: number + invoices: InvoiceSummary[] +} + +export interface ListIpsResponse { + /** Total count of authorized IPs. */ + totalCount: number + /** List of authorized IPs. */ + ips: RpnSanIp[] +} + +export type ListOSRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Page number. */ + page?: number + /** Number of OS per page. */ + pageSize?: number + /** Order of the OS. */ + orderBy?: ListOSRequestOrderBy + /** Type of the OS. */ + type?: OSType + /** Filter OS by compatible server ID. */ + serverId: number + /** Project ID. */ + projectId?: string +} + +export interface ListOSResponse { + /** Total count of matching OS. */ + totalCount: number + /** OS that match filters. */ + os: OS[] +} + +export type ListOffersRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Page number. */ + page?: number + /** Number of offer per page. */ + pageSize?: number + /** Order of the offers. */ + orderBy?: ListOffersRequestOrderBy + /** Filter on commercial range. */ + commercialRange?: string + /** Filter on catalog. */ + catalog?: OfferCatalog + /** Project ID. */ + projectId?: string + /** Get the current failover IP offer. */ + isFailoverIp?: boolean + /** Get the current failover IP block offer. */ + isFailoverBlock?: boolean + /** Filter offers depending on their datacenter. */ + soldIn?: string[] + /** Set this filter to true to only return available offers. */ + availableOnly?: boolean + /** Get the RPN SAN offers. */ + isRpnSan?: boolean +} + +export interface ListOffersResponse { + /** Total count of matching offers. */ + totalCount: number + /** Offers that match filters. */ + offers: Offer[] +} + +export interface ListRefundsResponse { + totalCount: number + refunds: RefundSummary[] +} + +export interface ListRpnCapableSanServersResponse { + /** Total count of rpn capable san servers. */ + totalCount: number + /** List of san servers. */ + sanServers: RpnSanServer[] +} + +export interface ListRpnCapableServersResponse { + /** Total count of rpn capable servers. */ + totalCount: number + /** List of servers. */ + servers: Server[] +} + +export interface ListRpnGroupMembersResponse { + /** Total count of rpn v1 group members. */ + totalCount: number + /** List of rpn v1 group members. */ + members: RpnGroupMember[] +} + +export interface ListRpnGroupsResponse { + /** Total count of rpn groups. */ + totalCount: number + /** List of rpn v1 groups. */ + rpnGroups: RpnGroup[] +} + +export interface ListRpnInvitesResponse { + /** Total count of invites. */ + totalCount: number + /** List of invites. */ + members: RpnGroupMember[] +} + +export interface ListRpnSansResponse { + /** Total count of matching RPN SANs. */ + totalCount: number + /** List of RPN SANs that match filters. */ + rpnSans: RpnSanSummary[] +} + +export interface ListRpnServerCapabilitiesResponse { + /** Total count of servers. */ + totalCount: number + /** List of servers and their RPN capabilities. */ + servers: RpnServerCapability[] +} + +export interface ListRpnV2CapableResourcesResponse { + /** Total count of matching rpn v2 capable resources. */ + totalCount: number + /** List of rpn v2 capable resources that match filters. */ + servers: Server[] +} + +export interface ListRpnV2GroupLogsResponse { + /** Total count of matching rpn v2 logs. */ + totalCount: number + /** List of rpn v2 logs that match filters. */ + logs: Log[] +} + +export interface ListRpnV2GroupsResponse { + /** Total count of matching rpn v2 groups. */ + totalCount: number + /** List of rpn v2 groups that match filters. */ + rpnGroups: RpnV2Group[] +} + +export interface ListRpnV2MembersResponse { + /** Total count of matching rpn v2 group members. */ + totalCount: number + /** List of rpn v2 group members that match filters. */ + members: RpnV2Member[] +} + +export type ListServerDisksRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID of the server disks. */ + serverId: number + /** Page number. */ + page?: number + /** Number of server disk per page. */ + pageSize?: number + /** Order of the server disks. */ + orderBy?: ListServerDisksRequestOrderBy +} + +export interface ListServerDisksResponse { + /** Total count of matching server disks. */ + totalCount: number + /** Server disks that match filters. */ + disks: ServerDisk[] +} + +export type ListServerEventsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID of the server events. */ + serverId: number + /** Page number. */ + page?: number + /** Number of server event per page. */ + pageSize?: number + /** Order of the server events. */ + orderBy?: ListServerEventsRequestOrderBy +} + +export interface ListServerEventsResponse { + /** Total count of matching server events. */ + totalCount: number + /** Server events that match filters. */ + events: ServerEvent[] +} + +export type ListServersRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Page number. */ + page?: number + /** Number of server per page. */ + pageSize?: number + /** Order of the servers. */ + orderBy?: ListServersRequestOrderBy + /** Filter servers by project ID. */ + projectId?: string + /** Filter servers by hostname. */ + search?: string +} + +export interface ListServersResponse { + /** Total count of matching servers. */ + totalCount: number + /** Servers that match filters. */ + servers: ServerSummary[] +} + +export type ListServicesRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Page number. */ + page?: number + /** Number of service per page. */ + pageSize?: number + /** Order of the services. */ + orderBy?: ListServicesRequestOrderBy + /** Project ID. */ + projectId?: string +} + +export interface ListServicesResponse { + /** Total count of matching services. */ + totalCount: number + /** Services that match filters. */ + services: Service[] +} + +export type ListSubscribableServerOptionsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID of the subscribable server options. */ + serverId: number + /** Page number. */ + page?: number + /** Number of subscribable server option per page. */ + pageSize?: number +} + +export interface ListSubscribableServerOptionsResponse { + /** Total count of matching subscribable server options. */ + totalCount: number + /** Server options that match filters. */ + serverOptions: Offer[] +} + +export interface OfferFailoverBlockInfo { + onetimeFees?: Offer +} + +export interface OfferFailoverIpInfo { + onetimeFees?: Offer +} + +export interface OfferServerInfo { + bandwidth: number + stock: OfferServerInfoStock + commercialRange: string + disks: Disk[] + cpus: CPU[] + memories: Memory[] + persistentMemories: PersistentMemory[] + raidControllers: RaidController[] + availableOptions: Offer[] + rpnVersion?: number + connectivity: number + onetimeFees?: Offer + stockByDatacenter: Record +} + +export interface OfferServiceLevelInfo { + supportTicket: boolean + supportPhone: boolean + salesSupport: boolean + git: string + sla: number + prioritySupport: boolean + highRpnBandwidth: boolean + customization: boolean + antidos: boolean + extraFailoverQuota: number + availableOptions: Offer[] +} + +export interface Raid { + /** Details about the RAID controller. */ + raidArrays: RaidArray[] +} + +export type RebootServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID to reboot. */ + serverId: number +} + +export interface Refund { + id: number + totalWithTaxes?: Money + totalWithoutTaxes?: Money + createdAt?: Date + refundedAt?: Date + status: RefundStatus + method: RefundMethod + content: string +} + +export interface Rescue { + /** OS ID of the rescue. */ + osId: number + /** Login of the rescue. */ + login: string + /** Password of the rescue. */ + password: string + /** Protocol of the resuce. */ + protocol: RescueProtocol +} + +export type RpnApiGetRpnStatusRequest = { + /** A project ID. */ + projectId?: string + /** An RPN v1 group ID. */ + rpnv1GroupId?: number + /** An RPN v2 group ID. */ + rpnv2GroupId?: number +} + +export type RpnApiListRpnServerCapabilitiesRequest = { + /** Page number. */ + page?: number + /** Number of servers per page. */ + pageSize?: number + /** Order of the servers. */ + orderBy?: ListRpnServerCapabilitiesRequestOrderBy + /** Filter servers by project ID. */ + projectId?: string +} + +export type RpnSanApiAddIpRequest = { + /** RPN SAN ID. */ + rpnSanId: number + /** An array of IP ID. */ + ipIds: number[] +} + +export type RpnSanApiCreateRpnSanRequest = { + /** Offer ID. */ + offerId: number + /** Your project ID. */ + projectId?: string +} + +export type RpnSanApiDeleteRpnSanRequest = { + /** RPN SAN ID. */ + rpnSanId: number +} + +export type RpnSanApiGetRpnSanRequest = { + /** RPN SAN ID. */ + rpnSanId: number +} + +export type RpnSanApiListAvailableIpsRequest = { + /** RPN SAN ID. */ + rpnSanId: number + /** Filter by IP type (server | rpnv2_subnet). */ + type?: RpnSanIpType +} + +export type RpnSanApiListIpsRequest = { + /** RPN SAN ID. */ + rpnSanId: number + /** Filter by IP type (server | rpnv2_subnet). */ + type?: RpnSanIpType +} + +export type RpnSanApiListRpnSansRequest = { + /** Page number. */ + page?: number + /** Number of RPN SANs per page. */ + pageSize?: number + /** Order of the RPN SANs. */ + orderBy?: ListRpnSansRequestOrderBy + /** Filter RPN SANs by project ID. */ + projectId?: string +} + +export type RpnSanApiRemoveIpRequest = { + /** RPN SAN ID. */ + rpnSanId: number + /** An array of IP ID. */ + ipIds: number[] +} + +export type RpnV1ApiAcceptRpnInviteRequest = { + /** The member ID. */ + memberId: number +} + +export type RpnV1ApiAddRpnGroupMembersRequest = { + /** The rpn v1 group ID. */ + groupId: number + /** A collection of rpn v1 capable server IDs. */ + serverIds?: number[] + /** A collection of rpn v1 capable RPN SAN server IDs. */ + sanServerIds?: number[] +} + +export type RpnV1ApiCreateRpnGroupRequest = { + /** Rpn v1 group name. */ + name: string + /** A collection of rpn v1 capable servers. */ + serverIds?: number[] + /** A collection of rpn v1 capable rpn sans servers. */ + sanServerIds?: number[] + /** A project ID. */ + projectId?: string +} + +export type RpnV1ApiDeleteRpnGroupMembersRequest = { + /** The rpn v1 group ID. */ + groupId: number + /** A collection of rpn v1 group members IDs. */ + memberIds: number[] +} + +export type RpnV1ApiDeleteRpnGroupRequest = { + /** Rpn v1 group ID. */ + groupId: number +} + +export type RpnV1ApiGetRpnGroupRequest = { + /** Rpn v1 group ID. */ + groupId: number +} + +export type RpnV1ApiLeaveRpnGroupRequest = { + /** The RPN V1 group ID. */ + groupId: number + /** A project ID. */ + projectId?: string + /** A collection of rpn v1 group members IDs. */ + memberIds: number[] +} + +export type RpnV1ApiListRpnCapableSanServersRequest = { + /** Page number. */ + page?: number + /** Number of rpn capable resources per page. */ + pageSize?: number + /** Order of the rpn capable resources. */ + orderBy?: ListRpnCapableSanServersRequestOrderBy + /** Filter rpn capable resources by project ID. */ + projectId?: string +} + +export type RpnV1ApiListRpnCapableServersRequest = { + /** Page number. */ + page?: number + /** Number of rpn capable resources per page. */ + pageSize?: number + /** Order of the rpn capable resources. */ + orderBy?: ListRpnCapableServersRequestOrderBy + /** Filter rpn capable resources by project ID. */ + projectId?: string +} + +export type RpnV1ApiListRpnGroupMembersRequest = { + /** Filter rpn v1 group members by group ID. */ + groupId: number + /** Page number. */ + page?: number + /** Number of rpn v1 group members per page. */ + pageSize?: number + /** Order of the rpn v1 group members. */ + orderBy?: ListRpnGroupMembersRequestOrderBy + /** A project ID. */ + projectId?: string +} + +export type RpnV1ApiListRpnGroupsRequest = { + /** Page number. */ + page?: number + /** Number of rpn v1 groups per page. */ + pageSize?: number + /** Order of the rpn v1 groups. */ + orderBy?: ListRpnGroupsRequestOrderBy + /** Filter rpn v1 groups by project ID. */ + projectId?: string +} + +export type RpnV1ApiListRpnInvitesRequest = { + /** Page number. */ + page?: number + /** Number of rpn capable resources per page. */ + pageSize?: number + /** Order of the rpn capable resources. */ + orderBy?: ListRpnInvitesRequestOrderBy + /** Filter rpn capable resources by project ID. */ + projectId?: string +} + +export type RpnV1ApiRefuseRpnInviteRequest = { + /** The member ID. */ + memberId: number +} + +export type RpnV1ApiRpnGroupInviteRequest = { + /** The RPN V1 group ID. */ + groupId: number + /** A collection of external server IDs. */ + serverIds: number[] + /** A project ID. */ + projectId?: string +} + +export type RpnV1ApiUpdateRpnGroupNameRequest = { + /** Rpn v1 group ID. */ + groupId: number + /** New rpn v1 group name. */ + name?: string +} + +export type RpnV2ApiAddRpnV2MembersRequest = { + /** RPN V2 group ID. */ + groupId: number + /** A collection of server IDs. */ + servers: number[] +} + +export type RpnV2ApiCreateRpnV2GroupRequest = { + /** Project ID of the RPN V2 group. */ + projectId?: string + /** RPN V2 group type (qing / standard). */ + type?: RpnV2GroupType + /** RPN V2 group name. */ + name: string + /** A collection of server IDs. */ + servers: number[] +} + +export type RpnV2ApiDeleteRpnV2GroupRequest = { + /** RPN V2 group ID. */ + groupId: number +} + +export type RpnV2ApiDeleteRpnV2MembersRequest = { + /** RPN V2 group ID. */ + groupId: number + /** A collection of member IDs. */ + memberIds: number[] +} + +export type RpnV2ApiDisableRpnV2GroupCompatibilityRequest = { + /** RPN V2 group ID. */ + groupId: number +} + +export type RpnV2ApiEnableRpnV2GroupCompatibilityRequest = { + /** RPN V2 group ID. */ + groupId: number + /** RPN V1 group ID. */ + rpnv1GroupId: number +} + +export type RpnV2ApiGetRpnV2GroupRequest = { + /** RPN V2 group ID. */ + groupId: number +} + +export type RpnV2ApiListRpnV2CapableResourcesRequest = { + /** Page number. */ + page?: number + /** Number of rpn v2 capable resources per page. */ + pageSize?: number + /** Order of the rpn v2 capable resources. */ + orderBy?: ListRpnV2CapableResourcesRequestOrderBy + /** Filter rpn v2 capable resources by project ID. */ + projectId?: string +} + +export type RpnV2ApiListRpnV2GroupLogsRequest = { + /** RPN V2 group ID. */ + groupId: number + /** Page number. */ + page?: number + /** Number of rpn v2 group logs per page. */ + pageSize?: number + /** Order of the rpn v2 group logs. */ + orderBy?: ListRpnV2GroupLogsRequestOrderBy +} + +export type RpnV2ApiListRpnV2GroupsRequest = { + /** Page number. */ + page?: number + /** Number of rpn v2 groups per page. */ + pageSize?: number + /** Order of the rpn v2 groups. */ + orderBy?: ListRpnV2GroupsRequestOrderBy + /** Filter rpn v2 groups by project ID. */ + projectId?: string +} + +export type RpnV2ApiListRpnV2MembersRequest = { + /** RPN V2 group ID. */ + groupId: number + /** Page number. */ + page?: number + /** Number of rpn v2 group members per page. */ + pageSize?: number + /** Order of the rpn v2 group members. */ + orderBy?: ListRpnV2MembersRequestOrderBy + /** Filter members by type. */ + type?: ListRpnV2MembersRequestType +} + +export type RpnV2ApiUpdateRpnV2GroupNameRequest = { + /** RPN V2 group ID. */ + groupId: number + /** RPN V2 group name. */ + name?: string +} + +export type RpnV2ApiUpdateRpnV2VlanForMembersRequest = { + /** RPN V2 group ID. */ + groupId: number + /** RPN V2 member IDs. */ + memberIds: number[] + /** Min: 0. Max: 3967. */ + vlan?: number +} + +export interface ServerDefaultPartitioning { + /** Default partitions. */ + partitions: Partition[] +} + +export interface ServerInstall { + osId: number + hostname: string + userLogin?: string + partitions: Partition[] + sshKeyIds: string[] + status: ServerInstallStatus + panelUrl?: string +} + +export type StartBMCAccessRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server to start the BMC access. */ + serverId: number + /** The IP authorized to connect to the given server. */ + ip: string +} + +export type StartRescueRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server to start rescue. */ + serverId: number + /** OS ID to use to start rescue. */ + osId: number +} + +export type StartServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID to start. */ + serverId: number +} + +export type StopBMCAccessRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server to stop BMC access. */ + serverId: number +} + +export type StopRescueRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server to stop rescue. */ + serverId: number +} + +export type StopServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID to stop. */ + serverId: number +} + +export type SubscribeServerOptionRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID to subscribe server option. */ + serverId: number + /** Option ID to subscribe. */ + optionId: number +} + +export type SubscribeStorageOptionsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID of the storage options to subscribe. */ + serverId: number + /** Option IDs of the storage options to subscribe. */ + optionsIds: number[] +} + +export interface SubscribeStorageOptionsResponse { + /** Services subscribe storage options. */ + services: Service[] +} + +export type UpdateRaidRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the server. */ + serverId: number + /** RAIDs to update. */ + raidArrays: UpdatableRaidArray[] +} + +export type UpdateReverseRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** ID of the IP. */ + ipId: number + /** Reverse to apply on the IP. */ + reverse: string +} + +export type UpdateServerBackupRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID to update backup. */ + serverId: number + /** Password of the server backup. */ + password?: string + /** Autologin of the server backup. */ + autologin?: boolean + /** Boolean to enable or disable ACL. */ + aclEnabled?: boolean +} + +export type UpdateServerRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID to update. */ + serverId: number + /** Hostname of the server to update. */ + hostname?: string + /** Flag to enable or not the IPv6 of server. */ + enableIpv6?: boolean +} + +export type UpdateServerTagsRequest = { + /** Zone to target. If none is passed will use default zone from the config. */ + zone?: Zone + /** Server ID to update the tags. */ + serverId: number + /** Tags of server to update. */ + tags?: string[] +} diff --git a/packages/clients/src/api/dedibox/v1/validation-rules.gen.ts b/packages/clients/src/api/dedibox/v1/validation-rules.gen.ts new file mode 100644 index 000000000..a412d972a --- /dev/null +++ b/packages/clients/src/api/dedibox/v1/validation-rules.gen.ts @@ -0,0 +1,626 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. + +export const AttachFailoverIPToMacAddressRequest = { + ipId: { + greaterThan: 0, + }, +} + +export const AttachFailoverIPsRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const BillingApiDownloadInvoiceRequest = { + invoiceId: { + greaterThan: 0, + }, +} + +export const BillingApiDownloadRefundRequest = { + refundId: { + greaterThan: 0, + }, +} + +export const BillingApiGetInvoiceRequest = { + invoiceId: { + greaterThan: 0, + }, +} + +export const BillingApiGetRefundRequest = { + refundId: { + greaterThan: 0, + }, +} + +export const BillingApiListInvoicesRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const BillingApiListRefundsRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const CancelServerInstallRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const DeleteFailoverIPRequest = { + ipId: { + greaterThan: 0, + }, +} + +export const DeleteServerRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const DeleteServiceRequest = { + serviceId: { + greaterThan: 0, + }, +} + +export const DetachFailoverIPFromMacAddressRequest = { + ipId: { + greaterThan: 0, + }, +} + +export const GetBMCAccessRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const GetFailoverIPRequest = { + ipId: { + greaterThan: 0, + }, +} + +export const GetOSRequest = { + osId: { + greaterThan: 0, + }, + serverId: { + greaterThan: 0, + }, +} + +export const GetOfferRequest = { + offerId: { + greaterThan: 0, + }, +} + +export const GetOrderedServiceRequest = { + orderedServiceId: { + greaterThan: 0, + }, +} + +export const GetRaidRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const GetRescueRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const GetServerBackupRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const GetServerInstallRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const GetServerRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const GetServiceRequest = { + serviceId: { + greaterThan: 0, + }, +} + +export const IPv6Block = { + id: { + greaterThan: 0, + }, +} + +export const IPv6BlockApiCreateIPv6BlockSubnetRequest = { + blockId: { + greaterThan: 0, + }, +} + +export const IPv6BlockApiDeleteIPv6BlockRequest = { + blockId: { + greaterThan: 0, + }, +} + +export const IPv6BlockApiListIPv6BlockSubnetsAvailableRequest = { + blockId: { + greaterThan: 0, + }, +} + +export const IPv6BlockApiUpdateIPv6BlockRequest = { + blockId: { + greaterThan: 0, + }, +} + +export const InstallServerRequest = { + osId: { + greaterThan: 0, + }, + serverId: { + greaterThan: 0, + }, +} + +export const ListFailoverIPsRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const ListOSRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, + serverId: { + greaterThan: 0, + }, +} + +export const ListOffersRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const ListServerDisksRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, + serverId: { + greaterThan: 0, + }, +} + +export const ListServerEventsRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, + serverId: { + greaterThan: 0, + }, +} + +export const ListServersRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const ListServicesRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const ListSubscribableServerOptionsRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, + serverId: { + greaterThan: 0, + }, +} + +export const RebootServerRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const RpnApiListRpnServerCapabilitiesRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnSanApiAddIpRequest = { + rpnSanId: { + greaterThan: 0, + }, +} + +export const RpnSanApiDeleteRpnSanRequest = { + rpnSanId: { + greaterThan: 0, + }, +} + +export const RpnSanApiGetRpnSanRequest = { + rpnSanId: { + greaterThan: 0, + }, +} + +export const RpnSanApiListAvailableIpsRequest = { + rpnSanId: { + greaterThan: 0, + }, +} + +export const RpnSanApiListIpsRequest = { + rpnSanId: { + greaterThan: 0, + }, +} + +export const RpnSanApiListRpnSansRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnSanApiRemoveIpRequest = { + rpnSanId: { + greaterThan: 0, + }, +} + +export const RpnV1ApiAcceptRpnInviteRequest = { + memberId: { + greaterThan: 0, + }, +} + +export const RpnV1ApiAddRpnGroupMembersRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV1ApiDeleteRpnGroupMembersRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV1ApiDeleteRpnGroupRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV1ApiGetRpnGroupRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV1ApiLeaveRpnGroupRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV1ApiListRpnCapableSanServersRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnV1ApiListRpnCapableServersRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnV1ApiListRpnGroupMembersRequest = { + groupId: { + greaterThan: 0, + }, + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnV1ApiListRpnGroupsRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnV1ApiListRpnInvitesRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnV1ApiRefuseRpnInviteRequest = { + memberId: { + greaterThan: 0, + }, +} + +export const RpnV1ApiRpnGroupInviteRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV1ApiUpdateRpnGroupNameRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV2ApiAddRpnV2MembersRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV2ApiDeleteRpnV2GroupRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV2ApiDeleteRpnV2MembersRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV2ApiDisableRpnV2GroupCompatibilityRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV2ApiEnableRpnV2GroupCompatibilityRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV2ApiGetRpnV2GroupRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV2ApiListRpnV2CapableResourcesRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnV2ApiListRpnV2GroupLogsRequest = { + groupId: { + greaterThan: 0, + }, + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnV2ApiListRpnV2GroupsRequest = { + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnV2ApiListRpnV2MembersRequest = { + groupId: { + greaterThan: 0, + }, + page: { + greaterThan: 0, + }, + pageSize: { + greaterThan: 0, + lessThanOrEqual: 100, + }, +} + +export const RpnV2ApiUpdateRpnV2GroupNameRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const RpnV2ApiUpdateRpnV2VlanForMembersRequest = { + groupId: { + greaterThan: 0, + }, +} + +export const StartRescueRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const StartServerRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const StopBMCAccessRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const StopRescueRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const StopServerRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const SubscribeServerOptionRequest = { + optionId: { + greaterThan: 0, + }, + serverId: { + greaterThan: 0, + }, +} + +export const SubscribeStorageOptionsRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const UpdateRaidRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const UpdateReverseRequest = { + ipId: { + greaterThan: 0, + }, +} + +export const UpdateServerBackupRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const UpdateServerRequest = { + serverId: { + greaterThan: 0, + }, +} + +export const UpdateServerTagsRequest = { + serverId: { + greaterThan: 0, + }, +} From c955d2d47131810067f173bbdbef25c0eb11e1c7 Mon Sep 17 00:00:00 2001 From: Vincent Germain Date: Thu, 4 Apr 2024 14:38:52 +0200 Subject: [PATCH 2/2] fix: resolve eslint issues --- .eslintrc | 7 +++++++ packages/clients/src/api/dedibox/index.ts | 1 + packages/clients/src/api/index.ts | 1 + 3 files changed, 9 insertions(+) create mode 100644 packages/clients/src/api/dedibox/index.ts diff --git a/.eslintrc b/.eslintrc index 63de74bcd..eca667a54 100644 --- a/.eslintrc +++ b/.eslintrc @@ -34,6 +34,13 @@ "rules": { "eslint-disable import/no-extraneous-dependencies": "off" } + }, + { + "files": ["packages/clients/src/api/dedibox/v1/*.ts"], + "rules": { + "no-use-before-define": "off", + "@typescript-eslint/no-use-before-define": "off" + } } ] } diff --git a/packages/clients/src/api/dedibox/index.ts b/packages/clients/src/api/dedibox/index.ts new file mode 100644 index 000000000..73ddaf23c --- /dev/null +++ b/packages/clients/src/api/dedibox/index.ts @@ -0,0 +1 @@ +export * as v1 from './v1/index.gen' diff --git a/packages/clients/src/api/index.ts b/packages/clients/src/api/index.ts index d26ced32c..55dfa54de 100644 --- a/packages/clients/src/api/index.ts +++ b/packages/clients/src/api/index.ts @@ -5,6 +5,7 @@ export * as Billing from './billing' export * as Block from './block' export * as Cockpit from './cockpit' export * as Container from './container' +export * as Dedibox from './dedibox' export * as DocumentDB from './document_db' export * as Domain from './domain' export * as FlexibleIP from './flexibleip'