diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 0fdcc78b7..75e02e2d4 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -29,3 +29,5 @@ export type { Money, ScwFile, TimeSeries } from './scw/custom-types' export * as Errors from './scw/errors/standard' export type { Region, Zone } from './scw/locality' export * from './internals' +export { toApiLocality } from './scw/locality' +export type { ApiLocality } from './scw/locality' diff --git a/packages_generated/applesilicon/src/v1alpha1/api.gen.ts b/packages_generated/applesilicon/src/v1alpha1/api.gen.ts index 44e13d811..5ec4eafdb 100644 --- a/packages_generated/applesilicon/src/v1alpha1/api.gen.ts +++ b/packages_generated/applesilicon/src/v1alpha1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Zone as ScwZone, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES as SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES_APPLESILICON, SERVER_TRANSIENT_STATUSES as SERVER_TRANSIENT_STATUSES_APPLESILICON, @@ -73,8 +74,13 @@ const jsonContentHeaders = { This API allows you to manage your Apple silicon machines. */ export class API extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = ['fr-par-3'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: ['fr-par-3'], + }) /** * List server types. List all technical details about Apple silicon server types available in the specified zone. Since there is only one Availability Zone for Apple silicon servers, the targeted value is `fr-par-3`. @@ -332,8 +338,13 @@ export class API extends ParentAPI { * Apple silicon - Private Networks API. */ export class PrivateNetworkAPI extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = ['fr-par-1', 'fr-par-3'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: ['fr-par-1', 'fr-par-3'], + }) getServerPrivateNetwork = ( request: Readonly, diff --git a/packages_generated/audit_trail/src/v1alpha1/api.gen.ts b/packages_generated/audit_trail/src/v1alpha1/api.gen.ts index b8001301b..10a6668af 100644 --- a/packages_generated/audit_trail/src/v1alpha1/api.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/api.gen.ts @@ -2,10 +2,11 @@ // If you have any remark or suggestion do not hesitate to open an issue. import { API as ParentAPI, + toApiLocality, urlParams, validatePathParam, } from '@scaleway/sdk-client' -import type { Region as ScwRegion } from '@scaleway/sdk-client' +import type { ApiLocality } from '@scaleway/sdk-client' import { unmarshalListEventsResponse, unmarshalListProductsResponse, @@ -23,8 +24,13 @@ import type { This API allows you to ensure accountability and security by recording events and changes performed within your Scaleway Organization. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par', 'nl-ams'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams'], + }) /** * List events. Retrieve the list of Audit Trail events for a Scaleway Organization and/or Project. You must specify the `organization_id` and optionally, the `project_id`. diff --git a/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts b/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts index 575906994..b7956f7d5 100644 --- a/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/marshalling.gen.ts @@ -117,6 +117,7 @@ const unmarshalSecretManagerSecretInfo = ( } return { + keyId: data.key_id, path: data.path, } as SecretManagerSecretInfo } diff --git a/packages_generated/audit_trail/src/v1alpha1/types.gen.ts b/packages_generated/audit_trail/src/v1alpha1/types.gen.ts index a1b8f41cf..f61c54bc8 100644 --- a/packages_generated/audit_trail/src/v1alpha1/types.gen.ts +++ b/packages_generated/audit_trail/src/v1alpha1/types.gen.ts @@ -51,6 +51,7 @@ export interface KubernetesPoolInfo { export interface SecretManagerSecretInfo { path: string + keyId?: string } export interface SecretManagerSecretVersionInfo { diff --git a/packages_generated/baremetal/src/v1/api.gen.ts b/packages_generated/baremetal/src/v1/api.gen.ts index 063922a81..2213555ba 100644 --- a/packages_generated/baremetal/src/v1/api.gen.ts +++ b/packages_generated/baremetal/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Zone as ScwZone, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { SERVER_TRANSIENT_STATUSES as SERVER_TRANSIENT_STATUSES_BAREMETAL } from './content.gen' import { marshalAddOptionServerRequest, @@ -104,15 +105,20 @@ const jsonContentHeaders = { This API allows you to manage your Elastic Metal servers. */ export class API extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'nl-ams-1', - 'nl-ams-2', - 'pl-waw-2', - 'pl-waw-3', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: [ + 'fr-par-1', + 'fr-par-2', + 'nl-ams-1', + 'nl-ams-2', + 'pl-waw-2', + 'pl-waw-3', + ], + }) protected pageOfListServers = (request: Readonly = {}) => this.client.fetch( @@ -690,8 +696,13 @@ After adding the BMC option, you need to Get Remote Access to get the login/pass * Elastic Metal - Private Network API. */ export class PrivateNetworkAPI extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = ['fr-par-2'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: ['fr-par-2'], + }) /** * Add a server to a Private Network. diff --git a/packages_generated/baremetal/src/v3/api.gen.ts b/packages_generated/baremetal/src/v3/api.gen.ts index a55d42196..8af542d30 100644 --- a/packages_generated/baremetal/src/v3/api.gen.ts +++ b/packages_generated/baremetal/src/v3/api.gen.ts @@ -3,10 +3,11 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, } from '@scaleway/sdk-client' -import type { Zone as ScwZone } from '@scaleway/sdk-client' +import type { ApiLocality } from '@scaleway/sdk-client' import { marshalPrivateNetworkApiAddServerPrivateNetworkRequest, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, @@ -32,15 +33,20 @@ const jsonContentHeaders = { * Elastic Metal - Private Networks API. */ export class PrivateNetworkAPI extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'nl-ams-1', - 'nl-ams-2', - 'pl-waw-2', - 'pl-waw-3', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: [ + 'fr-par-1', + 'fr-par-2', + 'nl-ams-1', + 'nl-ams-2', + 'pl-waw-2', + 'pl-waw-3', + ], + }) /** * Add a server to a Private Network. Add an Elastic Metal server to a Private Network. diff --git a/packages_generated/block/src/v1/api.gen.ts b/packages_generated/block/src/v1/api.gen.ts index 117503bd1..e8556e393 100644 --- a/packages_generated/block/src/v1/api.gen.ts +++ b/packages_generated/block/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Zone as ScwZone, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { SNAPSHOT_TRANSIENT_STATUSES as SNAPSHOT_TRANSIENT_STATUSES_BLOCK, VOLUME_TRANSIENT_STATUSES as VOLUME_TRANSIENT_STATUSES_BLOCK, @@ -56,18 +57,23 @@ const jsonContentHeaders = { This API allows you to manage your Block Storage volumes. */ export class API extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'fr-par-3', - 'nl-ams-1', - 'nl-ams-2', - 'nl-ams-3', - 'pl-waw-1', - 'pl-waw-2', - 'pl-waw-3', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: [ + 'fr-par-1', + 'fr-par-2', + 'fr-par-3', + 'nl-ams-1', + 'nl-ams-2', + 'nl-ams-3', + 'pl-waw-1', + 'pl-waw-2', + 'pl-waw-3', + ], + }) protected pageOfListVolumeTypes = ( request: Readonly = {}, diff --git a/packages_generated/block/src/v1alpha1/api.gen.ts b/packages_generated/block/src/v1alpha1/api.gen.ts index b956172b9..e2a2406f5 100644 --- a/packages_generated/block/src/v1alpha1/api.gen.ts +++ b/packages_generated/block/src/v1alpha1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Zone as ScwZone, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { SNAPSHOT_TRANSIENT_STATUSES as SNAPSHOT_TRANSIENT_STATUSES_BLOCK, VOLUME_TRANSIENT_STATUSES as VOLUME_TRANSIENT_STATUSES_BLOCK, @@ -58,18 +59,23 @@ const jsonContentHeaders = { This API allows you to manage your Block Storage volumes. */ export class API extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'fr-par-3', - 'nl-ams-1', - 'nl-ams-2', - 'nl-ams-3', - 'pl-waw-1', - 'pl-waw-2', - 'pl-waw-3', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: [ + 'fr-par-1', + 'fr-par-2', + 'fr-par-3', + 'nl-ams-1', + 'nl-ams-2', + 'nl-ams-3', + 'pl-waw-1', + 'pl-waw-2', + 'pl-waw-3', + ], + }) protected pageOfListVolumeTypes = ( request: Readonly = {}, diff --git a/packages_generated/cockpit/src/v1/api.gen.ts b/packages_generated/cockpit/src/v1/api.gen.ts index 61624b2a8..3f7638a8b 100644 --- a/packages_generated/cockpit/src/v1/api.gen.ts +++ b/packages_generated/cockpit/src/v1/api.gen.ts @@ -3,10 +3,11 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, } from '@scaleway/sdk-client' -import type { Region as ScwRegion } from '@scaleway/sdk-client' +import type { ApiLocality } from '@scaleway/sdk-client' import { marshalGlobalApiCreateGrafanaUserRequest, marshalGlobalApiResetGrafanaUserPasswordRequest, @@ -386,12 +387,13 @@ Deprecated: retention is now managed at the data source level. The Cockpit API allows you to create data sources and Cockpit tokens to store and query data types such as metrics, logs, and traces. You can also push your data into Cockpit, and send alerts to your contact points when your resources may require your attention, using the regional Alert manager. */ export class RegionalAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) /** * Get the Cockpit configuration. @@ -409,10 +411,7 @@ export class RegionalAPI extends ParentAPI { ) /** - * Create a data source. You must specify the data source type upon creation. Available data source types include: - - metrics - - logs - - traces + * Create a data source. You must specify the data source name and type (metrics, logs, traces) upon creation. The name of the data source will then be used as reference to name the associated Grafana data source. * * @param request - The request {@link RegionalApiCreateDataSourceRequest} @@ -450,7 +449,7 @@ The name of the data source will then be used as reference to name the associate ) /** - * Delete a data source. Delete a given data source, specified by the data source ID. Note that deleting a data source is irreversible, and cannot be undone. + * Delete a data source. Delete a given data source. Note that this action will permanently delete this data source and any data associated with it. * * @param request - The request {@link RegionalApiDeleteDataSourceRequest} */ @@ -487,7 +486,6 @@ The name of the data source will then be used as reference to name the associate /** * List data sources. Retrieve the list of data sources available in the specified region. By default, the data sources returned in the list are ordered by creation date, in ascending order. -You can list data sources by Project, type and origin. * * @param request - The request {@link RegionalApiListDataSourcesRequest} * @returns A Promise of ListDataSourcesResponse @@ -497,7 +495,7 @@ You can list data sources by Project, type and origin. ) => enrichForPagination('dataSources', this.pageOfListDataSources, request) /** - * Update a data source. Update a given data source name, specified by the data source ID. + * Update a data source. Update a given data source attributes (name and/or retention_days). * * @param request - The request {@link RegionalApiUpdateDataSourceRequest} * @returns A Promise of DataSource @@ -519,7 +517,7 @@ You can list data sources by Project, type and origin. ) /** - * Get data source usage overview. Retrieve the data source usage overview per type for the specified Project. + * Get data source usage overview. Retrieve the volume of data ingested for each of your data sources in the specified project and region. * * @param request - The request {@link RegionalApiGetUsageOverviewRequest} * @returns A Promise of UsageOverview diff --git a/packages_generated/cockpit/src/v1/types.gen.ts b/packages_generated/cockpit/src/v1/types.gen.ts index aa4bfc11b..7f049ebeb 100644 --- a/packages_generated/cockpit/src/v1/types.gen.ts +++ b/packages_generated/cockpit/src/v1/types.gen.ts @@ -191,7 +191,7 @@ export interface DataSource { */ synchronizedWithGrafana: boolean /** - * BETA - Duration for which the data will be retained in the data source. + * Duration for which the data will be retained in the data source. */ retentionDays: number /** @@ -754,7 +754,7 @@ export type RegionalApiCreateDataSourceRequest = { */ type?: DataSourceType /** - * Default values are 30 days for metrics, 7 days for logs and traces. + * Default values are 31 days for metrics, 7 days for logs and traces. */ retentionDays?: number } @@ -1053,11 +1053,11 @@ export type RegionalApiListDataSourcesRequest = { */ projectId?: string /** - * Origin to filter for, only data sources with matching origin will be returned. + * Origin to filter for, only data sources with matching origin will be returned. If omitted, all types will be returned. */ origin?: DataSourceOrigin /** - * Types to filter for, only data sources with matching types will be returned. + * Types to filter for (metrics, logs, traces), only data sources with matching types will be returned. If omitted, all types will be returned. */ types?: DataSourceType[] } @@ -1147,7 +1147,7 @@ export type RegionalApiUpdateDataSourceRequest = { */ name?: string /** - * BETA - Duration for which the data will be retained in the data source. + * Duration for which the data will be retained in the data source. */ retentionDays?: number } diff --git a/packages_generated/container/src/v1beta1/api.gen.ts b/packages_generated/container/src/v1beta1/api.gen.ts index 944278dd8..c62bd20f7 100644 --- a/packages_generated/container/src/v1beta1/api.gen.ts +++ b/packages_generated/container/src/v1beta1/api.gen.ts @@ -4,11 +4,12 @@ import { API as ParentAPI, enrichForPagination, resolveOneOf, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { CONTAINER_TRANSIENT_STATUSES as CONTAINER_TRANSIENT_STATUSES_CONTAINER, CRON_TRANSIENT_STATUSES as CRON_TRANSIENT_STATUSES_CONTAINER, @@ -95,12 +96,13 @@ const jsonContentHeaders = { This API allows you to manage your Serverless Containers. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListNamespaces = ( request: Readonly = {}, diff --git a/packages_generated/container/src/v1beta1/validation-rules.gen.ts b/packages_generated/container/src/v1beta1/validation-rules.gen.ts index e50fd5e5c..05cd059fa 100644 --- a/packages_generated/container/src/v1beta1/validation-rules.gen.ts +++ b/packages_generated/container/src/v1beta1/validation-rules.gen.ts @@ -50,6 +50,12 @@ export const CreateTriggerRequestMnqSqsClientConfig = { }, } +export const UpdateContainerRequest = { + privateNetworkId: { + ignoreEmpty: true, + }, +} + export const UpdateTriggerRequest = { description: { maxLength: 255, diff --git a/packages_generated/dedibox/src/v1/api.gen.ts b/packages_generated/dedibox/src/v1/api.gen.ts index 8579d7a17..58bcd7aa6 100644 --- a/packages_generated/dedibox/src/v1/api.gen.ts +++ b/packages_generated/dedibox/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Zone as ScwZone, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { BMC_ACCESS_TRANSIENT_STATUSES as BMC_ACCESS_TRANSIENT_STATUSES_DEDIBOX, RPN_SAN_TRANSIENT_STATUSES as RPN_SAN_TRANSIENT_STATUSES_DEDIBOX, @@ -253,12 +254,13 @@ const jsonContentHeaders = { * Dedibox Phoenix API. */ export class API extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'nl-ams-1', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: ['fr-par-1', 'fr-par-2', 'nl-ams-1'], + }) protected pageOfListServers = (request: Readonly = {}) => this.client.fetch( diff --git a/packages_generated/file/src/v1alpha1/api.gen.ts b/packages_generated/file/src/v1alpha1/api.gen.ts index 491f99ec1..ab9ccaca3 100644 --- a/packages_generated/file/src/v1alpha1/api.gen.ts +++ b/packages_generated/file/src/v1alpha1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { FILE_SYSTEM_TRANSIENT_STATUSES as FILE_SYSTEM_TRANSIENT_STATUSES_FILE } from './content.gen' import { marshalCreateFileSystemRequest, @@ -38,8 +39,13 @@ const jsonContentHeaders = { This API allows you to manage your File Storage resources. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par'], + }) /** * Get filesystem details. Retrieve all properties and current status of a specific filesystem identified by its ID. diff --git a/packages_generated/flexibleip/src/v1alpha1/api.gen.ts b/packages_generated/flexibleip/src/v1alpha1/api.gen.ts index 0b87cb722..3a0266377 100644 --- a/packages_generated/flexibleip/src/v1alpha1/api.gen.ts +++ b/packages_generated/flexibleip/src/v1alpha1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Zone as ScwZone, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { FLEXIBLE_IP_TRANSIENT_STATUSES as FLEXIBLE_IP_TRANSIENT_STATUSES_FLEXIBLEIP } from './content.gen' import { marshalAttachFlexibleIPRequest, @@ -50,15 +51,20 @@ const jsonContentHeaders = { This API allows you to manage your Elastic Metal servers' flexible public IP addresses. */ export class API extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'nl-ams-1', - 'nl-ams-2', - 'pl-waw-2', - 'pl-waw-3', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: [ + 'fr-par-1', + 'fr-par-2', + 'nl-ams-1', + 'nl-ams-2', + 'pl-waw-2', + 'pl-waw-3', + ], + }) /** * Create a new flexible IP. Generate a new flexible IP within a given zone, specifying its configuration including Project ID and description. diff --git a/packages_generated/function/src/v1beta1/api.gen.ts b/packages_generated/function/src/v1beta1/api.gen.ts index 592eb51c2..56ac87842 100644 --- a/packages_generated/function/src/v1beta1/api.gen.ts +++ b/packages_generated/function/src/v1beta1/api.gen.ts @@ -4,11 +4,12 @@ import { API as ParentAPI, enrichForPagination, resolveOneOf, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { CRON_TRANSIENT_STATUSES as CRON_TRANSIENT_STATUSES_FUNCTION, DOMAIN_TRANSIENT_STATUSES as DOMAIN_TRANSIENT_STATUSES_FUNCTION, @@ -104,12 +105,13 @@ const jsonContentHeaders = { This API allows you to manage your Serverless Functions. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListNamespaces = ( request: Readonly = {}, diff --git a/packages_generated/function/src/v1beta1/validation-rules.gen.ts b/packages_generated/function/src/v1beta1/validation-rules.gen.ts index 7b45e4e11..6d2159f1c 100644 --- a/packages_generated/function/src/v1beta1/validation-rules.gen.ts +++ b/packages_generated/function/src/v1beta1/validation-rules.gen.ts @@ -34,6 +34,12 @@ export const CreateTriggerRequestMnqSqsClientConfig = { }, } +export const UpdateFunctionRequest = { + privateNetworkId: { + ignoreEmpty: true, + }, +} + export const UpdateTriggerRequest = { description: { maxLength: 255, diff --git a/packages_generated/inference/src/v1/api.gen.ts b/packages_generated/inference/src/v1/api.gen.ts index b6957c9ae..00833a50d 100644 --- a/packages_generated/inference/src/v1/api.gen.ts +++ b/packages_generated/inference/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { DEPLOYMENT_TRANSIENT_STATUSES as DEPLOYMENT_TRANSIENT_STATUSES_INFERENCE, MODEL_TRANSIENT_STATUSES as MODEL_TRANSIENT_STATUSES_INFERENCE, @@ -58,8 +59,13 @@ const jsonContentHeaders = { This API allows you to handle your Managed Inference services. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par'], + }) protected pageOfListDeployments = ( request: Readonly = {}, diff --git a/packages_generated/inference/src/v1beta1/api.gen.ts b/packages_generated/inference/src/v1beta1/api.gen.ts index 810321f83..be16591f3 100644 --- a/packages_generated/inference/src/v1beta1/api.gen.ts +++ b/packages_generated/inference/src/v1beta1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { DEPLOYMENT_TRANSIENT_STATUSES as DEPLOYMENT_TRANSIENT_STATUSES_INFERENCE } from './content.gen' import { marshalAddDeploymentACLRulesRequest, @@ -67,8 +68,13 @@ const jsonContentHeaders = { This API allows you to manage your Inference services. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par'], + }) protected pageOfListDeployments = ( request: Readonly = {}, diff --git a/packages_generated/instance/src/v1/api.gen.ts b/packages_generated/instance/src/v1/api.gen.ts index 6f2bee4a4..ef2b643a5 100644 --- a/packages_generated/instance/src/v1/api.gen.ts +++ b/packages_generated/instance/src/v1/api.gen.ts @@ -3,10 +3,11 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, } from '@scaleway/sdk-client' -import type { Zone as ScwZone } from '@scaleway/sdk-client' +import type { ApiLocality } from '@scaleway/sdk-client' import { marshalApplyBlockMigrationRequest, marshalAttachServerFileSystemRequest, @@ -253,18 +254,23 @@ const jsonContentHeaders = { This API allows you to manage your CPU and GPU Instances. */ export class API extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'fr-par-3', - 'nl-ams-1', - 'nl-ams-2', - 'nl-ams-3', - 'pl-waw-1', - 'pl-waw-2', - 'pl-waw-3', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: [ + 'fr-par-1', + 'fr-par-2', + 'fr-par-3', + 'nl-ams-1', + 'nl-ams-2', + 'nl-ams-3', + 'pl-waw-1', + 'pl-waw-2', + 'pl-waw-3', + ], + }) /** * Get availability. Get availability for all Instance types. diff --git a/packages_generated/interlink/src/v1beta1/api.gen.ts b/packages_generated/interlink/src/v1beta1/api.gen.ts index 1a211ddc8..f5dddb062 100644 --- a/packages_generated/interlink/src/v1beta1/api.gen.ts +++ b/packages_generated/interlink/src/v1beta1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { DEDICATED_CONNECTION_TRANSIENT_STATUSES as DEDICATED_CONNECTION_TRANSIENT_STATUSES_INTERLINK, LINK_TRANSIENT_STATUSES as LINK_TRANSIENT_STATUSES_INTERLINK, @@ -76,12 +77,13 @@ const jsonContentHeaders = { This API allows you to manage your Scaleway InterLink, to connect your on-premises infrastructure with your Scaleway VPC. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListDedicatedConnections = ( request: Readonly = {}, diff --git a/packages_generated/iot/src/v1/api.gen.ts b/packages_generated/iot/src/v1/api.gen.ts index 456a61c3a..b7d835e7e 100644 --- a/packages_generated/iot/src/v1/api.gen.ts +++ b/packages_generated/iot/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { HUB_TRANSIENT_STATUSES as HUB_TRANSIENT_STATUSES_IOT } from './content.gen' import { marshalCreateDeviceRequest, @@ -107,8 +108,13 @@ const jsonContentHeaders = { This API allows you to manage your IoT hubs and devices. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par'], + }) protected pageOfListHubs = (request: Readonly = {}) => this.client.fetch( diff --git a/packages_generated/ipam/src/v1/api.gen.ts b/packages_generated/ipam/src/v1/api.gen.ts index 31c88c0c1..d96ab859e 100644 --- a/packages_generated/ipam/src/v1/api.gen.ts +++ b/packages_generated/ipam/src/v1/api.gen.ts @@ -4,10 +4,11 @@ import { API as ParentAPI, enrichForPagination, resolveOneOf, + toApiLocality, urlParams, validatePathParam, } from '@scaleway/sdk-client' -import type { Region as ScwRegion } from '@scaleway/sdk-client' +import type { ApiLocality } from '@scaleway/sdk-client' import { marshalAttachIPRequest, marshalBookIPRequest, @@ -42,12 +43,13 @@ const jsonContentHeaders = { This API allows you to manage your Scaleway IP addresses with our IP Address Management tool. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) /** * Reserve a new IP. Reserve a new IP from the specified source. Currently IPs can only be reserved from a Private Network. diff --git a/packages_generated/jobs/src/v1alpha1/api.gen.ts b/packages_generated/jobs/src/v1alpha1/api.gen.ts index 561f8cea2..230c236f8 100644 --- a/packages_generated/jobs/src/v1alpha1/api.gen.ts +++ b/packages_generated/jobs/src/v1alpha1/api.gen.ts @@ -3,10 +3,11 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, } from '@scaleway/sdk-client' -import type { Region as ScwRegion } from '@scaleway/sdk-client' +import type { ApiLocality } from '@scaleway/sdk-client' import { marshalCreateJobDefinitionRequest, marshalCreateJobDefinitionSecretsRequest, @@ -63,12 +64,13 @@ const jsonContentHeaders = { This API allows you to manage your Serverless Jobs. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) /** * Create a new job definition in a specified Project. diff --git a/packages_generated/k8s/src/v1/api.gen.ts b/packages_generated/k8s/src/v1/api.gen.ts index 3ccbc6807..f670c3e41 100644 --- a/packages_generated/k8s/src/v1/api.gen.ts +++ b/packages_generated/k8s/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { CLUSTER_TRANSIENT_STATUSES as CLUSTER_TRANSIENT_STATUSES_K8S, NODE_TRANSIENT_STATUSES as NODE_TRANSIENT_STATUSES_K8S, @@ -105,12 +106,13 @@ const jsonContentHeaders = { This API allows you to manage Kubernetes Kapsule and Kosmos clusters. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListClusters = ( request: Readonly = {}, diff --git a/packages_generated/key_manager/src/v1alpha1/api.gen.ts b/packages_generated/key_manager/src/v1alpha1/api.gen.ts index da1795c84..f5ecc099f 100644 --- a/packages_generated/key_manager/src/v1alpha1/api.gen.ts +++ b/packages_generated/key_manager/src/v1alpha1/api.gen.ts @@ -3,10 +3,11 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, } from '@scaleway/sdk-client' -import type { Region as ScwRegion } from '@scaleway/sdk-client' +import type { ApiLocality } from '@scaleway/sdk-client' import { marshalCreateKeyRequest, marshalDecryptRequest, @@ -45,6 +46,7 @@ import type { ListKeysResponse, ProtectKeyRequest, PublicKey, + RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, @@ -64,12 +66,13 @@ const jsonContentHeaders = { This API allows you to create, manage and use cryptographic keys in a centralized and secure service. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) /** * Create a key. Create a key in a given region specified by the `region` parameter. Keys only support symmetric encryption. You can use keys to encrypt or decrypt arbitrary payloads, or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**. @@ -235,7 +238,7 @@ export class API extends ParentAPI { unmarshalKey, ) - protected pageOfListKeys = (request: Readonly = {}) => + protected pageOfListKeys = (request: Readonly) => this.client.fetch( { method: 'GET', @@ -250,6 +253,7 @@ export class API extends ParentAPI { request.pageSize ?? this.client.settings.defaultPageSize, ], ['project_id', request.projectId], + ['scheduled_for_deletion', request.scheduledForDeletion], ['tags', request.tags], ['usage', request.usage], ), @@ -263,7 +267,7 @@ export class API extends ParentAPI { * @param request - The request {@link ListKeysRequest} * @returns A Promise of ListKeysResponse */ - listKeys = (request: Readonly = {}) => + listKeys = (request: Readonly) => enrichForPagination('keys', this.pageOfListKeys, request) /** @@ -392,4 +396,21 @@ The data encryption key is returned in plaintext and ciphertext but it should on method: 'POST', path: `/key-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam('keyId', request.keyId)}/delete-key-material`, }) + + /** + * Restore a key. Restore a key and all its rotations scheduled for deletion specified by the `region` and `key_id` parameters. + * + * @param request - The request {@link RestoreKeyRequest} + * @returns A Promise of Key + */ + restoreKey = (request: Readonly) => + this.client.fetch( + { + body: '{}', + headers: jsonContentHeaders, + method: 'POST', + path: `/key-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam('keyId', request.keyId)}/restore`, + }, + unmarshalKey, + ) } diff --git a/packages_generated/key_manager/src/v1alpha1/index.gen.ts b/packages_generated/key_manager/src/v1alpha1/index.gen.ts index 361f17108..86ba77426 100644 --- a/packages_generated/key_manager/src/v1alpha1/index.gen.ts +++ b/packages_generated/key_manager/src/v1alpha1/index.gen.ts @@ -32,6 +32,7 @@ export type { ListKeysResponse, ProtectKeyRequest, PublicKey, + RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, diff --git a/packages_generated/key_manager/src/v1alpha1/marshalling.gen.ts b/packages_generated/key_manager/src/v1alpha1/marshalling.gen.ts index a743b4345..21d8ab313 100644 --- a/packages_generated/key_manager/src/v1alpha1/marshalling.gen.ts +++ b/packages_generated/key_manager/src/v1alpha1/marshalling.gen.ts @@ -70,6 +70,7 @@ export const unmarshalKey = (data: unknown): Key => { return { createdAt: unmarshalDate(data.created_at), + deletionRequestedAt: unmarshalDate(data.deletion_requested_at), description: data.description, id: data.id, locked: data.locked, diff --git a/packages_generated/key_manager/src/v1alpha1/types.gen.ts b/packages_generated/key_manager/src/v1alpha1/types.gen.ts index 55336f0a7..b79001b37 100644 --- a/packages_generated/key_manager/src/v1alpha1/types.gen.ts +++ b/packages_generated/key_manager/src/v1alpha1/types.gen.ts @@ -140,6 +140,10 @@ export interface Key { * Refer to the `Key.Origin` enum for a description of values. */ origin: KeyOrigin + /** + * Returns the time at which deletion was requested. + */ + deletionRequestedAt?: Date /** * Region where the key is stored. */ @@ -405,6 +409,10 @@ export type ListKeysRequest = { * Select from symmetric encryption, asymmetric encryption, or asymmetric signing. */ usage?: ListKeysRequestUsage + /** + * Filter keys based on their deletion status. By default, only keys not scheduled for deletion are returned in the output. + */ + scheduledForDeletion: boolean } export interface ListKeysResponse { @@ -433,6 +441,14 @@ export interface PublicKey { pem: string } +export type RestoreKeyRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + keyId: string +} + export type RotateKeyRequest = { /** * Region to target. If none is passed will use default region from the config. diff --git a/packages_generated/lb/src/v1/api.gen.ts b/packages_generated/lb/src/v1/api.gen.ts index ed125ba72..2b583688b 100644 --- a/packages_generated/lb/src/v1/api.gen.ts +++ b/packages_generated/lb/src/v1/api.gen.ts @@ -3,15 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { - Region as ScwRegion, - Zone as ScwZone, - WaitForOptions, -} from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { CERTIFICATE_TRANSIENT_STATUSES as CERTIFICATE_TRANSIENT_STATUSES_LB, LB_TRANSIENT_STATUSES as LB_TRANSIENT_STATUSES_LB, @@ -232,17 +229,22 @@ const jsonContentHeaders = { This API allows you to manage your Scaleway Load Balancer services. */ export class ZonedAPI extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'nl-ams-1', - 'nl-ams-2', - 'nl-ams-3', - 'pl-waw-1', - 'pl-waw-2', - 'pl-waw-3', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: [ + 'fr-par-1', + 'fr-par-2', + 'nl-ams-1', + 'nl-ams-2', + 'nl-ams-3', + 'pl-waw-1', + 'pl-waw-2', + 'pl-waw-3', + ], + }) protected pageOfListLbs = (request: Readonly = {}) => this.client.fetch( @@ -1362,12 +1364,13 @@ export class ZonedAPI extends ParentAPI { This API allows you to manage your Load Balancers. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListLbs = (request: Readonly = {}) => this.client.fetch( diff --git a/packages_generated/mnq/src/v1beta1/api.gen.ts b/packages_generated/mnq/src/v1beta1/api.gen.ts index e984146a9..044f580a3 100644 --- a/packages_generated/mnq/src/v1beta1/api.gen.ts +++ b/packages_generated/mnq/src/v1beta1/api.gen.ts @@ -3,10 +3,11 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, } from '@scaleway/sdk-client' -import type { Region as ScwRegion } from '@scaleway/sdk-client' +import type { ApiLocality } from '@scaleway/sdk-client' import { marshalNatsApiCreateNatsAccountRequest, marshalNatsApiCreateNatsCredentialsRequest, @@ -78,8 +79,13 @@ const jsonContentHeaders = { This API allows you to manage Scaleway NATS accounts. */ export class NatsAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par', 'nl-ams'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams'], + }) /** * Create a NATS account. Create a NATS account associated with a Project. @@ -271,8 +277,13 @@ export class NatsAPI extends ParentAPI { This API allows you to manage your Scaleway Topics and Events. */ export class SnsAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par', 'nl-ams'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams'], + }) /** * Activate Topics and Events. Activate Topics and Events for the specified Project ID. Topics and Events must be activated before any usage. Activating Topics and Events does not trigger any billing, and you can deactivate at any time. @@ -449,8 +460,13 @@ export class SnsAPI extends ParentAPI { This API allows you to manage your Scaleway Queues. */ export class SqsAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par', 'nl-ams'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams'], + }) /** * Activate Queues. Activate Queues for the specified Project ID. Queues must be activated before any usage such as creating credentials and queues. Activating Queues does not trigger any billing, and you can deactivate at any time. diff --git a/packages_generated/mongodb/src/index.gen.ts b/packages_generated/mongodb/src/index.gen.ts index cc0a66b26..bb4cb5db0 100644 --- a/packages_generated/mongodb/src/index.gen.ts +++ b/packages_generated/mongodb/src/index.gen.ts @@ -3,4 +3,5 @@ * PLEASE DO NOT EDIT HERE */ +export * as Mongodbv1 from './v1/index.gen' export * as Mongodbv1alpha1 from './v1alpha1/index.gen' diff --git a/packages_generated/mongodb/src/v1/api.gen.ts b/packages_generated/mongodb/src/v1/api.gen.ts new file mode 100644 index 000000000..987f6423f --- /dev/null +++ b/packages_generated/mongodb/src/v1/api.gen.ts @@ -0,0 +1,565 @@ +// 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, + toApiLocality, + urlParams, + validatePathParam, + waitForResource, +} from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' +import { + INSTANCE_TRANSIENT_STATUSES as INSTANCE_TRANSIENT_STATUSES_MONGODB, + SNAPSHOT_TRANSIENT_STATUSES as SNAPSHOT_TRANSIENT_STATUSES_MONGODB, +} from './content.gen' +import { + marshalCreateEndpointRequest, + marshalCreateInstanceRequest, + marshalCreateSnapshotRequest, + marshalCreateUserRequest, + marshalRestoreSnapshotRequest, + marshalSetUserRoleRequest, + marshalUpdateInstanceRequest, + marshalUpdateSnapshotRequest, + marshalUpdateUserRequest, + marshalUpgradeInstanceRequest, + unmarshalEndpoint, + unmarshalInstance, + unmarshalListInstancesResponse, + unmarshalListNodeTypesResponse, + unmarshalListSnapshotsResponse, + unmarshalListUsersResponse, + unmarshalListVersionsResponse, + unmarshalSnapshot, + unmarshalUser, +} from './marshalling.gen' +import type { + CreateEndpointRequest, + CreateInstanceRequest, + CreateSnapshotRequest, + CreateUserRequest, + DeleteEndpointRequest, + DeleteInstanceRequest, + DeleteSnapshotRequest, + DeleteUserRequest, + Endpoint, + GetInstanceCertificateRequest, + GetInstanceRequest, + GetSnapshotRequest, + Instance, + ListInstancesRequest, + ListInstancesResponse, + ListNodeTypesRequest, + ListNodeTypesResponse, + ListSnapshotsRequest, + ListSnapshotsResponse, + ListUsersRequest, + ListUsersResponse, + ListVersionsRequest, + ListVersionsResponse, + RestoreSnapshotRequest, + SetUserRoleRequest, + Snapshot, + UpdateInstanceRequest, + UpdateSnapshotRequest, + UpdateUserRequest, + UpgradeInstanceRequest, + User, +} from './types.gen' + +const jsonContentHeaders = { + 'Content-Type': 'application/json; charset=utf-8', +} + +/** + * Managed MongoDB®. + +This API allows you to manage your Managed Databases for MongoDB®. + */ +export class API extends ParentAPI { + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par'], + }) + + protected pageOfListNodeTypes = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/node-types`, + urlParams: urlParams( + ['include_disabled', request.includeDisabled], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ), + }, + unmarshalListNodeTypesResponse, + ) + + /** + * List available node types. + * + * @param request - The request {@link ListNodeTypesRequest} + * @returns A Promise of ListNodeTypesResponse + */ + listNodeTypes = (request: Readonly = {}) => + enrichForPagination('nodeTypes', this.pageOfListNodeTypes, request) + + protected pageOfListVersions = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/versions`, + urlParams: urlParams( + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['version', request.version], + ), + }, + unmarshalListVersionsResponse, + ) + + /** + * List available MongoDB® major versions. + * + * @param request - The request {@link ListVersionsRequest} + * @returns A Promise of ListVersionsResponse + */ + listVersions = (request: Readonly = {}) => + enrichForPagination('versions', this.pageOfListVersions, request) + + protected pageOfListInstances = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances`, + urlParams: urlParams( + ['name', request.name], + ['order_by', request.orderBy], + ['organization_id', request.organizationId], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ['tags', request.tags], + ), + }, + unmarshalListInstancesResponse, + ) + + /** + * List MongoDB® Database Instances. List all MongoDB® Database Instances in the specified region. By default, the MongoDB® Database Instances returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `tags` and `name`. For the `name` parameter, the value you include will be checked against the whole name string to see if it includes the string you put in the parameter. + * + * @param request - The request {@link ListInstancesRequest} + * @returns A Promise of ListInstancesResponse + */ + listInstances = (request: Readonly = {}) => + enrichForPagination('instances', this.pageOfListInstances, request) + + /** + * Get a MongoDB® Database Instance. Retrieve information about a given MongoDB® Database Instance, specified by the `region` and `instance_id` parameters. Its full details, including name, status, IP address and port, are returned in the response object. + * + * @param request - The request {@link GetInstanceRequest} + * @returns A Promise of Instance + */ + getInstance = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}`, + }, + unmarshalInstance, + ) + + /** + * Waits for {@link Instance} to be in a final state. + * + * @param request - The request {@link GetInstanceRequest} + * @param options - The waiting options + * @returns A Promise of Instance + */ + waitForInstance = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve( + !INSTANCE_TRANSIENT_STATUSES_MONGODB.includes(res.status), + )), + this.getInstance, + request, + options, + ) + + /** + * Create a MongoDB® Database Instance. Create a new MongoDB® Database Instance. + * + * @param request - The request {@link CreateInstanceRequest} + * @returns A Promise of Instance + */ + createInstance = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateInstanceRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances`, + }, + unmarshalInstance, + ) + + /** + * Update a MongoDB® Database Instance. Update the parameters of a MongoDB® Database Instance. + * + * @param request - The request {@link UpdateInstanceRequest} + * @returns A Promise of Instance + */ + updateInstance = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateInstanceRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}`, + }, + unmarshalInstance, + ) + + /** + * Delete a MongoDB® Database Instance. Delete a given MongoDB® Database Instance, specified by the `region` and `instance_id` parameters. Deleting a MongoDB® Database Instance is permanent, and cannot be undone. Note that upon deletion all your data will be lost. + * + * @param request - The request {@link DeleteInstanceRequest} + * @returns A Promise of Instance + */ + deleteInstance = (request: Readonly) => + this.client.fetch( + { + method: 'DELETE', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}`, + }, + unmarshalInstance, + ) + + /** + * Upgrade a Database Instance. Upgrade your current Database Instance specifications like volume size. + * + * @param request - The request {@link UpgradeInstanceRequest} + * @returns A Promise of Instance + */ + upgradeInstance = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpgradeInstanceRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/upgrade`, + }, + unmarshalInstance, + ) + + /** + * Get the certificate of a Database Instance. Retrieve the certificate of a given Database Instance, specified by the `instance_id` parameter. + * + * @param request - The request {@link GetInstanceCertificateRequest} + * @returns A Promise of Blob + */ + getInstanceCertificate = (request: Readonly) => + this.client.fetch({ + method: 'GET', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/certificate`, + urlParams: urlParams(['dl', 1]), + responseType: 'blob', + }) + + /** + * Create a Database Instance snapshot. Create a new snapshot of a Database Instance. You must define the `name` and `instance_id` parameters in the request. + * + * @param request - The request {@link CreateSnapshotRequest} + * @returns A Promise of Snapshot + */ + createSnapshot = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateSnapshotRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots`, + }, + unmarshalSnapshot, + ) + + /** + * Get a Database Instance snapshot. Retrieve information about a given snapshot of a Database Instance. You must specify, in the endpoint, the `snapshot_id` parameter of the snapshot you want to retrieve. + * + * @param request - The request {@link GetSnapshotRequest} + * @returns A Promise of Snapshot + */ + getSnapshot = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`, + }, + unmarshalSnapshot, + ) + + /** + * Waits for {@link Snapshot} to be in a final state. + * + * @param request - The request {@link GetSnapshotRequest} + * @param options - The waiting options + * @returns A Promise of Snapshot + */ + waitForSnapshot = ( + request: Readonly, + options?: Readonly>, + ) => + waitForResource( + options?.stop ?? + (res => + Promise.resolve( + !SNAPSHOT_TRANSIENT_STATUSES_MONGODB.includes(res.status), + )), + this.getSnapshot, + request, + options, + ) + + /** + * Update a Database Instance snapshot. Update the parameters of a snapshot of a Database Instance. You can update the `name` and `expires_at` parameters. + * + * @param request - The request {@link UpdateSnapshotRequest} + * @returns A Promise of Snapshot + */ + updateSnapshot = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateSnapshotRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`, + }, + unmarshalSnapshot, + ) + + /** + * Restore a Database Instance snapshot. Restore a given snapshot of a Database Instance. You must specify, in the endpoint, the `snapshot_id` parameter of the snapshot you want to restore, the `instance_name` of the new Database Instance, `node_type` of the new Database Instance and `node_amount` of the new Database Instance. + * + * @param request - The request {@link RestoreSnapshotRequest} + * @returns A Promise of Instance + */ + restoreSnapshot = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalRestoreSnapshotRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}/restore`, + }, + unmarshalInstance, + ) + + protected pageOfListSnapshots = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots`, + urlParams: urlParams( + ['instance_id', request.instanceId], + ['name', request.name], + ['order_by', request.orderBy], + ['organization_id', request.organizationId], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ), + }, + unmarshalListSnapshotsResponse, + ) + + /** + * List snapshots. List snapshots. You can include the `instance_id` or `project_id` in your query to get the list of snapshots for specific Database Instances and/or Projects. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. + * + * @param request - The request {@link ListSnapshotsRequest} + * @returns A Promise of ListSnapshotsResponse + */ + listSnapshots = (request: Readonly = {}) => + enrichForPagination('snapshots', this.pageOfListSnapshots, request) + + /** + * Delete a Database Instance snapshot. Delete a given snapshot of a Database Instance. You must specify, in the endpoint, the `snapshot_id` parameter of the snapshot you want to delete. + * + * @param request - The request {@link DeleteSnapshotRequest} + * @returns A Promise of Snapshot + */ + deleteSnapshot = (request: Readonly) => + this.client.fetch( + { + method: 'DELETE', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`, + }, + unmarshalSnapshot, + ) + + protected pageOfListUsers = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/users`, + urlParams: urlParams( + ['name', request.name], + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ), + }, + unmarshalListUsersResponse, + ) + + /** + * List users of a Database Instance. List all users of a given Database Instance. + * + * @param request - The request {@link ListUsersRequest} + * @returns A Promise of ListUsersResponse + */ + listUsers = (request: Readonly) => + enrichForPagination('users', this.pageOfListUsers, request) + + /** + * Create an user on a Database Instance. Create an user on a Database Instance. You must define the `name`, `password` of the user and `instance_id` parameters in the request. + * + * @param request - The request {@link CreateUserRequest} + * @returns A Promise of User + */ + createUser = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateUserRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/users`, + }, + unmarshalUser, + ) + + /** + * Update a user on a Database Instance. Update the parameters of a user on a Database Instance. You can update the `password` parameter, but you cannot change the name of the user. + * + * @param request - The request {@link UpdateUserRequest} + * @returns A Promise of User + */ + updateUser = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateUserRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/users/${validatePathParam('name', request.name)}`, + }, + unmarshalUser, + ) + + /** + * Delete a user on a Database Instance. Delete an existing user on a Database Instance. + * + * @param request - The request {@link DeleteUserRequest} + */ + deleteUser = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/users/${validatePathParam('name', request.name)}`, + }) + + /** + * Apply user roles. Apply preset roles for a user in a Database Instance. + * + * @param request - The request {@link SetUserRoleRequest} + * @returns A Promise of User + */ + setUserRole = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalSetUserRoleRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PUT', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/set-user-roles`, + }, + unmarshalUser, + ) + + /** + * Delete a Database Instance endpoint. Delete the endpoint of a Database Instance. You must specify the `endpoint_id` parameter of the endpoint you want to delete. Note that you might need to update any environment configurations that point to the deleted endpoint. + * + * @param request - The request {@link DeleteEndpointRequest} + */ + deleteEndpoint = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam('endpointId', request.endpointId)}`, + }) + + /** + * Create a new Instance endpoint. Create a new endpoint for a MongoDB® Database Instance. You can add `public_network` or `private_network` specifications to the body of the request. + * + * @param request - The request {@link CreateEndpointRequest} + * @returns A Promise of Endpoint + */ + createEndpoint = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateEndpointRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/mongodb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints`, + }, + unmarshalEndpoint, + ) +} diff --git a/packages_generated/mongodb/src/v1/content.gen.ts b/packages_generated/mongodb/src/v1/content.gen.ts new file mode 100644 index 000000000..9b9df80fd --- /dev/null +++ b/packages_generated/mongodb/src/v1/content.gen.ts @@ -0,0 +1,19 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import type { InstanceStatus, SnapshotStatus } from './types.gen' + +/** Lists transient statutes of the enum {@link InstanceStatus}. */ +export const INSTANCE_TRANSIENT_STATUSES: InstanceStatus[] = [ + 'provisioning', + 'configuring', + 'deleting', + 'initializing', + 'snapshotting', +] + +/** Lists transient statutes of the enum {@link SnapshotStatus}. */ +export const SNAPSHOT_TRANSIENT_STATUSES: SnapshotStatus[] = [ + 'creating', + 'restoring', + 'deleting', +] diff --git a/packages_generated/mongodb/src/v1/index.gen.ts b/packages_generated/mongodb/src/v1/index.gen.ts new file mode 100644 index 000000000..252c81fb2 --- /dev/null +++ b/packages_generated/mongodb/src/v1/index.gen.ts @@ -0,0 +1,58 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +export { API } from './api.gen' +export * from './content.gen' +export * from './marshalling.gen' +export type { + CreateEndpointRequest, + CreateInstanceRequest, + CreateSnapshotRequest, + CreateUserRequest, + DeleteEndpointRequest, + DeleteInstanceRequest, + DeleteSnapshotRequest, + DeleteUserRequest, + Endpoint, + EndpointPrivateNetworkDetails, + EndpointPublicNetworkDetails, + EndpointSpec, + EndpointSpecPrivateNetworkDetails, + EndpointSpecPublicNetworkDetails, + GetInstanceCertificateRequest, + GetInstanceRequest, + GetSnapshotRequest, + Instance, + InstanceSnapshotSchedule, + InstanceStatus, + ListInstancesRequest, + ListInstancesRequestOrderBy, + ListInstancesResponse, + ListNodeTypesRequest, + ListNodeTypesResponse, + ListSnapshotsRequest, + ListSnapshotsRequestOrderBy, + ListSnapshotsResponse, + ListUsersRequest, + ListUsersRequestOrderBy, + ListUsersResponse, + ListVersionsRequest, + ListVersionsResponse, + NodeType, + NodeTypeStock, + NodeTypeVolumeType, + RestoreSnapshotRequest, + SetUserRoleRequest, + Snapshot, + SnapshotStatus, + UpdateInstanceRequest, + UpdateSnapshotRequest, + UpdateUserRequest, + UpgradeInstanceRequest, + User, + UserRole, + UserRoleRole, + Version, + Volume, + VolumeType, +} from './types.gen' +export * as ValidationRules from './validation-rules.gen' diff --git a/packages_generated/mongodb/src/v1/marshalling.gen.ts b/packages_generated/mongodb/src/v1/marshalling.gen.ts new file mode 100644 index 000000000..74bea5f77 --- /dev/null +++ b/packages_generated/mongodb/src/v1/marshalling.gen.ts @@ -0,0 +1,485 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import randomName from '@scaleway/random-name' +import { + isJSONObject, + resolveOneOf, + unmarshalArrayOfObject, + unmarshalDate, +} from '@scaleway/sdk-client' +import type { DefaultValues } from '@scaleway/sdk-client' +import type { + CreateEndpointRequest, + CreateInstanceRequest, + CreateSnapshotRequest, + CreateUserRequest, + Endpoint, + EndpointPrivateNetworkDetails, + EndpointPublicNetworkDetails, + EndpointSpec, + EndpointSpecPrivateNetworkDetails, + EndpointSpecPublicNetworkDetails, + Instance, + InstanceSnapshotSchedule, + ListInstancesResponse, + ListNodeTypesResponse, + ListSnapshotsResponse, + ListUsersResponse, + ListVersionsResponse, + NodeType, + NodeTypeVolumeType, + RestoreSnapshotRequest, + SetUserRoleRequest, + Snapshot, + UpdateInstanceRequest, + UpdateSnapshotRequest, + UpdateUserRequest, + UpgradeInstanceRequest, + User, + UserRole, + Version, + Volume, +} from './types.gen' + +const unmarshalEndpointPrivateNetworkDetails = ( + data: unknown, +): EndpointPrivateNetworkDetails => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`, + ) + } + + return { + privateNetworkId: data.private_network_id, + } as EndpointPrivateNetworkDetails +} + +const unmarshalEndpointPublicNetworkDetails = ( + data: unknown, +): EndpointPublicNetworkDetails => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'EndpointPublicNetworkDetails' failed as data isn't a dictionary.`, + ) + } + + return {} as EndpointPublicNetworkDetails +} + +export const unmarshalEndpoint = (data: unknown): Endpoint => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`, + ) + } + + return { + dnsRecord: data.dns_record, + id: data.id, + port: data.port, + privateNetwork: data.private_network + ? unmarshalEndpointPrivateNetworkDetails(data.private_network) + : undefined, + publicNetwork: data.public_network + ? unmarshalEndpointPublicNetworkDetails(data.public_network) + : undefined, + } as Endpoint +} + +const unmarshalInstanceSnapshotSchedule = ( + data: unknown, +): InstanceSnapshotSchedule => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'InstanceSnapshotSchedule' failed as data isn't a dictionary.`, + ) + } + + return { + enabled: data.enabled, + frequencyHours: data.frequency_hours, + lastRun: unmarshalDate(data.last_run), + nextUpdate: unmarshalDate(data.next_update), + retentionDays: data.retention_days, + } as InstanceSnapshotSchedule +} + +const unmarshalVolume = (data: unknown): Volume => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`, + ) + } + + return { + sizeBytes: data.size_bytes, + type: data.type, + } as Volume +} + +export const unmarshalInstance = (data: unknown): Instance => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Instance' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint), + id: data.id, + name: data.name, + nodeAmount: data.node_amount, + nodeType: data.node_type, + organizationId: data.organization_id, + projectId: data.project_id, + region: data.region, + snapshotSchedule: data.snapshot_schedule + ? unmarshalInstanceSnapshotSchedule(data.snapshot_schedule) + : undefined, + status: data.status, + tags: data.tags, + version: data.version, + volume: data.volume ? unmarshalVolume(data.volume) : undefined, + } as Instance +} + +export const unmarshalSnapshot = (data: unknown): Snapshot => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + expiresAt: unmarshalDate(data.expires_at), + id: data.id, + instanceId: data.instance_id, + instanceName: data.instance_name, + name: data.name, + nodeType: data.node_type, + region: data.region, + sizeBytes: data.size_bytes, + status: data.status, + updatedAt: unmarshalDate(data.updated_at), + volumeType: data.volume_type, + } as Snapshot +} + +const unmarshalUserRole = (data: unknown): UserRole => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'UserRole' failed as data isn't a dictionary.`, + ) + } + + return { + anyDatabase: data.any_database, + databaseName: data.database_name, + role: data.role, + } as UserRole +} + +export const unmarshalUser = (data: unknown): User => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'User' failed as data isn't a dictionary.`, + ) + } + + return { + name: data.name, + roles: unmarshalArrayOfObject(data.roles, unmarshalUserRole), + } as User +} + +export const unmarshalListInstancesResponse = ( + data: unknown, +): ListInstancesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + instances: unmarshalArrayOfObject(data.instances, unmarshalInstance), + totalCount: data.total_count, + } as ListInstancesResponse +} + +const unmarshalNodeTypeVolumeType = (data: unknown): NodeTypeVolumeType => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`, + ) + } + + return { + chunkSizeBytes: data.chunk_size_bytes, + description: data.description, + maxSizeBytes: data.max_size_bytes, + minSizeBytes: data.min_size_bytes, + type: data.type, + } as NodeTypeVolumeType +} + +const unmarshalNodeType = (data: unknown): NodeType => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`, + ) + } + + return { + availableVolumeTypes: unmarshalArrayOfObject( + data.available_volume_types, + unmarshalNodeTypeVolumeType, + ), + beta: data.beta, + description: data.description, + disabled: data.disabled, + instanceRange: data.instance_range, + memoryBytes: data.memory_bytes, + name: data.name, + stockStatus: data.stock_status, + vcpus: data.vcpus, + } as NodeType +} + +export const unmarshalListNodeTypesResponse = ( + data: unknown, +): ListNodeTypesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType), + totalCount: data.total_count, + } as ListNodeTypesResponse +} + +export const unmarshalListSnapshotsResponse = ( + data: unknown, +): ListSnapshotsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot), + totalCount: data.total_count, + } as ListSnapshotsResponse +} + +export const unmarshalListUsersResponse = ( + data: unknown, +): ListUsersResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`, + ) + } + + return { + totalCount: data.total_count, + users: unmarshalArrayOfObject(data.users, unmarshalUser), + } as ListUsersResponse +} + +const unmarshalVersion = (data: unknown): Version => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Version' failed as data isn't a dictionary.`, + ) + } + + return { + endOfLifeAt: unmarshalDate(data.end_of_life_at), + version: data.version, + } as Version +} + +export const unmarshalListVersionsResponse = ( + data: unknown, +): ListVersionsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + totalCount: data.total_count, + versions: unmarshalArrayOfObject(data.versions, unmarshalVersion), + } as ListVersionsResponse +} + +const marshalEndpointSpecPrivateNetworkDetails = ( + request: EndpointSpecPrivateNetworkDetails, + defaults: DefaultValues, +): Record => ({ + private_network_id: request.privateNetworkId, +}) + +const marshalEndpointSpecPublicNetworkDetails = ( + request: EndpointSpecPublicNetworkDetails, + defaults: DefaultValues, +): Record => ({}) + +const marshalEndpointSpec = ( + request: EndpointSpec, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf([ + { + param: 'public_network', + value: + request.publicNetwork !== undefined + ? marshalEndpointSpecPublicNetworkDetails( + request.publicNetwork, + defaults, + ) + : undefined, + }, + { + param: 'private_network', + value: + request.privateNetwork !== undefined + ? marshalEndpointSpecPrivateNetworkDetails( + request.privateNetwork, + defaults, + ) + : undefined, + }, + ]), +}) + +export const marshalCreateEndpointRequest = ( + request: CreateEndpointRequest, + defaults: DefaultValues, +): Record => ({ + endpoint: marshalEndpointSpec(request.endpoint, defaults), + instance_id: request.instanceId, +}) + +const marshalVolume = ( + request: Volume, + defaults: DefaultValues, +): Record => ({ + size_bytes: request.sizeBytes, + type: request.type, +}) + +export const marshalCreateInstanceRequest = ( + request: CreateInstanceRequest, + defaults: DefaultValues, +): Record => ({ + endpoints: + request.endpoints !== undefined + ? request.endpoints.map(elt => marshalEndpointSpec(elt, defaults)) + : undefined, + name: request.name || randomName('mgdb'), + node_amount: request.nodeAmount, + node_type: request.nodeType, + password: request.password, + project_id: request.projectId ?? defaults.defaultProjectId, + tags: request.tags, + user_name: request.userName, + version: request.version, + volume: + request.volume !== undefined + ? marshalVolume(request.volume, defaults) + : undefined, +}) + +export const marshalCreateSnapshotRequest = ( + request: CreateSnapshotRequest, + defaults: DefaultValues, +): Record => ({ + expires_at: request.expiresAt, + instance_id: request.instanceId, + name: request.name, +}) + +export const marshalCreateUserRequest = ( + request: CreateUserRequest, + defaults: DefaultValues, +): Record => ({ + name: request.name, + password: request.password, +}) + +export const marshalRestoreSnapshotRequest = ( + request: RestoreSnapshotRequest, + defaults: DefaultValues, +): Record => ({ + instance_name: request.instanceName, + node_amount: request.nodeAmount, + node_type: request.nodeType, + volume_type: request.volumeType, +}) + +const marshalUserRole = ( + request: UserRole, + defaults: DefaultValues, +): Record => ({ + role: request.role, + ...resolveOneOf([ + { param: 'database_name', value: request.databaseName }, + { param: 'any_database', value: request.anyDatabase }, + ]), +}) + +export const marshalSetUserRoleRequest = ( + request: SetUserRoleRequest, + defaults: DefaultValues, +): Record => ({ + roles: + request.roles !== undefined + ? request.roles.map(elt => marshalUserRole(elt, defaults)) + : undefined, + user_name: request.userName, +}) + +export const marshalUpdateInstanceRequest = ( + request: UpdateInstanceRequest, + defaults: DefaultValues, +): Record => ({ + is_snapshot_schedule_enabled: request.isSnapshotScheduleEnabled, + name: request.name, + snapshot_schedule_frequency_hours: request.snapshotScheduleFrequencyHours, + snapshot_schedule_retention_days: request.snapshotScheduleRetentionDays, + tags: request.tags, +}) + +export const marshalUpdateSnapshotRequest = ( + request: UpdateSnapshotRequest, + defaults: DefaultValues, +): Record => ({ + expires_at: request.expiresAt, + name: request.name, +}) + +export const marshalUpdateUserRequest = ( + request: UpdateUserRequest, + defaults: DefaultValues, +): Record => ({ + password: request.password, +}) + +export const marshalUpgradeInstanceRequest = ( + request: UpgradeInstanceRequest, + defaults: DefaultValues, +): Record => ({ + ...resolveOneOf([ + { param: 'volume_size_bytes', value: request.volumeSizeBytes }, + ]), +}) diff --git a/packages_generated/mongodb/src/v1/types.gen.ts b/packages_generated/mongodb/src/v1/types.gen.ts new file mode 100644 index 000000000..c38f1437e --- /dev/null +++ b/packages_generated/mongodb/src/v1/types.gen.ts @@ -0,0 +1,822 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import type { Region as ScwRegion } from '@scaleway/sdk-client' + +export type InstanceStatus = + | 'unknown_status' + | 'ready' + | 'provisioning' + | 'configuring' + | 'deleting' + | 'error' + | 'initializing' + | 'locked' + | 'snapshotting' + +export type ListInstancesRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'name_asc' + | 'name_desc' + | 'status_asc' + | 'status_desc' + +export type ListSnapshotsRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'name_asc' + | 'name_desc' + | 'expires_at_asc' + | 'expires_at_desc' + +export type ListUsersRequestOrderBy = 'name_asc' | 'name_desc' + +export type NodeTypeStock = + | 'unknown_stock' + | 'low_stock' + | 'out_of_stock' + | 'available' + +export type SnapshotStatus = + | 'unknown_status' + | 'creating' + | 'ready' + | 'restoring' + | 'deleting' + | 'error' + | 'locked' + +export type UserRoleRole = + | 'unknown_role' + | 'read' + | 'read_write' + | 'db_admin' + | 'sync' + +export type VolumeType = 'unknown_type' | 'sbs_5k' | 'sbs_15k' + +/** + * Private Network details. + */ +export interface EndpointPrivateNetworkDetails { + /** + * UUID of the Private Network. + */ + privateNetworkId: string +} + +/** + * Public Access details. + */ +export interface EndpointPublicNetworkDetails {} + +export interface EndpointSpecPrivateNetworkDetails { + /** + * UUID of the Private Network. + */ + privateNetworkId: string +} + +export interface EndpointSpecPublicNetworkDetails {} + +export interface Endpoint { + /** + * UUID of the endpoint. + */ + id: string + /** + * List of DNS records of the endpoint. + */ + dnsRecord: string + /** + * TCP port of the endpoint. + */ + port: number + /** + * Private Network endpoint details. + * + * One-of ('details'): at most one of 'privateNetwork', 'publicNetwork' could be set. + */ + privateNetwork?: EndpointPrivateNetworkDetails + /** + * Public Network endpoint details. + * + * One-of ('details'): at most one of 'privateNetwork', 'publicNetwork' could be set. + */ + publicNetwork?: EndpointPublicNetworkDetails +} + +export interface InstanceSnapshotSchedule { + frequencyHours: number + retentionDays: number + enabled: boolean + nextUpdate?: Date + lastRun?: Date +} + +export interface Volume { + /** + * Type of volume where data is stored. + */ + type: VolumeType + /** + * Volume size. + */ + sizeBytes: number +} + +export interface NodeTypeVolumeType { + /** + * Volume Type. + */ + type: VolumeType + /** + * The description of the volume. + */ + description: string + /** + * Minimum size required for the volume. + */ + minSizeBytes: number + /** + * Maximum size required for the volume. + */ + maxSizeBytes: number + /** + * Minimum increment level for a Block Storage volume size. + */ + chunkSizeBytes: number +} + +export interface UserRole { + /** + * Name of the preset role. + */ + role: UserRoleRole + /** + * Name of the database on which the preset role will be used. + * + * One-of ('scope'): at most one of 'databaseName', 'anyDatabase' could be set. + */ + databaseName?: string + /** + * Flag to enable the preset role in all databases. + * + * One-of ('scope'): at most one of 'databaseName', 'anyDatabase' could be set. + */ + anyDatabase?: boolean +} + +export interface EndpointSpec { + /** + * + * One-of ('details'): at most one of 'publicNetwork', 'privateNetwork' could be set. + */ + publicNetwork?: EndpointSpecPublicNetworkDetails + /** + * + * One-of ('details'): at most one of 'publicNetwork', 'privateNetwork' could be set. + */ + privateNetwork?: EndpointSpecPrivateNetworkDetails +} + +export interface Instance { + /** + * UUID of the Database Instance. + */ + id: string + /** + * Name of the Database Instance. + */ + name: string + /** + * Project ID the Database Instance belongs to. + */ + projectId: string + /** + * Organization ID the Database Instance belongs to. + */ + organizationId: string + /** + * Status of the Database Instance. + */ + status: InstanceStatus + /** + * MongoDB® major engine version of the Database Instance. + */ + version: string + /** + * List of tags applied to the Database Instance. + */ + tags: string[] + /** + * Number of node in the Database Instance. + */ + nodeAmount: number + /** + * Node type of the Database Instance. + */ + nodeType: string + /** + * Volumes of the Database Instance. + */ + volume?: Volume + /** + * List of Database Instance endpoints. + */ + endpoints: Endpoint[] + /** + * Creation date (must follow the ISO 8601 format). + */ + createdAt?: Date + /** + * Region the Database Instance is in. + */ + region: ScwRegion + /** + * Snapshot schedule configuration of the Database Instance. + */ + snapshotSchedule?: InstanceSnapshotSchedule +} + +export interface NodeType { + /** + * Node type name identifier. + */ + name: string + /** + * Current stock status for the node type. + */ + stockStatus: NodeTypeStock + /** + * Current specs of the offer. + */ + description: string + /** + * Number of virtual CPUs. + */ + vcpus: number + /** + * Quantity of RAM. + */ + memoryBytes: number + /** + * Available storage options for the node type. + */ + availableVolumeTypes: NodeTypeVolumeType[] + /** + * The node type is currently disabled. + */ + disabled: boolean + /** + * The node type is currently in beta. + */ + beta: boolean + /** + * Instance range associated with the node type offer. + */ + instanceRange: string +} + +export interface Snapshot { + /** + * UUID of the snapshot. + */ + id: string + /** + * UUID of the Database Instance. + */ + instanceId?: string + /** + * Name of the snapshot. + */ + name: string + /** + * Status of the snapshot. + */ + status: SnapshotStatus + /** + * Size of the snapshot. + */ + sizeBytes: number + /** + * Expiration date (must follow the ISO 8601 format). + */ + expiresAt?: Date + /** + * Creation date (must follow the ISO 8601 format). + */ + createdAt?: Date + /** + * Updated date (must follow the ISO 8601 format). + */ + updatedAt?: Date + /** + * Name of the Database Instance of the snapshot. + */ + instanceName: string + /** + * Source node type. + */ + nodeType: string + /** + * Type of volume where data is stored - sbs_5k or sbs_15k. + */ + volumeType: VolumeType + /** + * Region of the snapshot. + */ + region: ScwRegion +} + +export interface User { + /** + * Name of the user (Length must be between 1 and 63 characters. First character must be an alphabet character (a-zA-Z). Only a-zA-Z0-9_$- characters are accepted). + */ + name: string + /** + * List of roles assigned to the user, along with the corresponding database where each role is granted. + */ + roles: UserRole[] +} + +export interface Version { + /** + * MongoDB® major engine version. + */ + version: string + /** + * Date of End of Life. + */ + endOfLifeAt?: Date +} + +export type CreateEndpointRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance. + */ + instanceId: string + /** + * EndpointSpec used to expose your Database Instance. + */ + endpoint: EndpointSpec +} + +export type CreateInstanceRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * The Project ID on which the Database Instance will be created. + */ + projectId?: string + /** + * Name of the Database Instance. + */ + name?: string + /** + * Major version of the MongoDB® engine. + */ + version: string + /** + * Tags to apply to the Database Instance. + */ + tags?: string[] + /** + * Number of node to use for the Database Instance. + */ + nodeAmount: number + /** + * Type of node to use for the Database Instance. + */ + nodeType: string + /** + * Username created when the Database Instance is created. + */ + userName: string + /** + * Password of the initial user. + */ + password: string + /** + * Instance volume information. + */ + volume?: Volume + /** + * One or multiple EndpointSpec used to expose your Database Instance. + */ + endpoints?: EndpointSpec[] +} + +export type CreateSnapshotRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance to snapshot. + */ + instanceId: string + /** + * Name of the snapshot. + */ + name: string + /** + * Expiration date of the snapshot (must follow the ISO 8601 format). + */ + expiresAt?: Date +} + +export type CreateUserRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance the user belongs to. + */ + instanceId: string + /** + * Name of the database user. + */ + name: string + /** + * Password of the database user. + */ + password: string +} + +export type DeleteEndpointRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Endpoint to delete. + */ + endpointId: string +} + +export type DeleteInstanceRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance to delete. + */ + instanceId: string +} + +export type DeleteSnapshotRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the snapshot. + */ + snapshotId: string +} + +export type DeleteUserRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance the user belongs to. + */ + instanceId: string + /** + * Name of the database user. + */ + name: string +} + +export type GetInstanceCertificateRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance. + */ + instanceId: string +} + +export type GetInstanceRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance. + */ + instanceId: string +} + +export type GetSnapshotRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the snapshot. + */ + snapshotId: string +} + +export type ListInstancesRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * List Database Instances that have a given tag. + */ + tags?: string[] + /** + * Lists Database Instances that match a name pattern. + */ + name?: string + /** + * Criteria to use when ordering Database Instance listings. + */ + orderBy?: ListInstancesRequestOrderBy + /** + * Organization ID of the Database Instance. + */ + organizationId?: string + /** + * Project ID to list the instances of. + */ + projectId?: string + page?: number + pageSize?: number +} + +export interface ListInstancesResponse { + /** + * List of all Database Instances available in an Organization or Project. + */ + instances: Instance[] + /** + * Total count of Database Instances available in an Organization or Project. + */ + totalCount: number +} + +export type ListNodeTypesRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * Defines whether or not to include disabled types. + */ + includeDisabled?: boolean + page?: number + pageSize?: number +} + +export interface ListNodeTypesResponse { + /** + * Types of the node. + */ + nodeTypes: NodeType[] + /** + * Total count of node-types available. + */ + totalCount: number +} + +export type ListSnapshotsRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * Instance ID the snapshots belongs to. + */ + instanceId?: string + /** + * Lists database snapshots that match a name pattern. + */ + name?: string + /** + * Criteria to use when ordering snapshot listings. + */ + orderBy?: ListSnapshotsRequestOrderBy + /** + * Organization ID the snapshots belongs to. + */ + organizationId?: string + /** + * Project ID to list the snapshots of. + */ + projectId?: string + page?: number + pageSize?: number +} + +export interface ListSnapshotsResponse { + /** + * List of all database snapshots available in an Organization or Project. + */ + snapshots: Snapshot[] + /** + * Total count of database snapshots available in a Organization or Project. + */ + totalCount: number +} + +export type ListUsersRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance. + */ + instanceId: string + /** + * Name of the user. + */ + name?: string + /** + * Criteria to use when requesting user listing. + */ + orderBy?: ListUsersRequestOrderBy + page?: number + pageSize?: number +} + +export interface ListUsersResponse { + /** + * List of users in a Database Instance. + */ + users: User[] + /** + * Total count of users present on a Database Instance. + */ + totalCount: number +} + +export type ListVersionsRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + version?: string + page?: number + pageSize?: number +} + +export interface ListVersionsResponse { + /** + * Available MongoDB® major engine version. + */ + versions: Version[] + /** + * Total count of MongoDB® major engine version available. + */ + totalCount: number +} + +export type RestoreSnapshotRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the snapshot. + */ + snapshotId: string + /** + * Name of the new Database Instance. + */ + instanceName: string + /** + * Node type to use for the new Database Instance. + */ + nodeType: string + /** + * Number of nodes to use for the new Database Instance. + */ + nodeAmount: number + /** + * Instance volume type. + */ + volumeType: VolumeType +} + +export type SetUserRoleRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance the user belongs to. + */ + instanceId: string + /** + * Name of the database user. + */ + userName: string + /** + * List of roles assigned to the user, along with the corresponding database where each role is granted. + */ + roles?: UserRole[] +} + +export type UpdateInstanceRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance to update. + */ + instanceId: string + /** + * Name of the Database Instance. + */ + name?: string + /** + * Tags of a Database Instance. + */ + tags?: string[] + /** + * In hours. + */ + snapshotScheduleFrequencyHours?: number + /** + * In days. + */ + snapshotScheduleRetentionDays?: number + /** + * Defines whether or not the snapshot schedule is enabled. + */ + isSnapshotScheduleEnabled?: boolean +} + +export type UpdateSnapshotRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Snapshot. + */ + snapshotId: string + /** + * Name of the snapshot. + */ + name?: string + /** + * Expiration date of the snapshot (must follow the ISO 8601 format). + */ + expiresAt?: Date +} + +export type UpdateUserRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance the user belongs to. + */ + instanceId: string + /** + * Name of the database user. + */ + name: string + /** + * Password of the database user. + */ + password?: string +} + +export type UpgradeInstanceRequest = { + /** + * Region to target. If none is passed will use default region from the config. + */ + region?: ScwRegion + /** + * UUID of the Database Instance you want to upgrade. + */ + instanceId: string + /** + * Increase your Block Storage volume size. + * + * One-of ('upgradeTarget'): at most one of 'volumeSizeBytes' could be set. + */ + volumeSizeBytes?: number +} diff --git a/packages_generated/mongodb/src/v1/validation-rules.gen.ts b/packages_generated/mongodb/src/v1/validation-rules.gen.ts new file mode 100644 index 000000000..005c4c489 --- /dev/null +++ b/packages_generated/mongodb/src/v1/validation-rules.gen.ts @@ -0,0 +1,189 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. + +export const CreateInstanceRequest = { + name: { + maxLength: 255, + minLength: 1, + pattern: /^[A-Za-z0-9\-_]+$/, + }, + nodeAmount: { + greaterThanOrEqual: 1, + lessThanOrEqual: 3, + }, + nodeType: { + maxLength: 128, + minLength: 1, + pattern: /^[A-Za-z0-9\-_]+$/, + }, + password: { + maxLength: 128, + minLength: 8, + }, + userName: { + maxLength: 63, + minLength: 1, + pattern: /^[a-zA-Z0-9_\-]*$/, + }, + version: { + pattern: /^[0-9]+\.[0-9]+$/, + }, +} + +export const CreateSnapshotRequest = { + name: { + maxLength: 255, + minLength: 1, + pattern: /^[A-Za-z0-9\-_]+$/, + }, +} + +export const CreateUserRequest = { + name: { + maxLength: 63, + minLength: 1, + pattern: /^[a-zA-Z0-9_\-]*$/, + }, + password: { + maxLength: 128, + minLength: 8, + }, +} + +export const DeleteUserRequest = { + name: { + maxLength: 63, + minLength: 1, + pattern: /^[a-zA-Z0-9_\-]*$/, + }, +} + +export const ListInstancesRequest = { + name: { + maxLength: 255, + minLength: 1, + pattern: /^[A-Za-z0-9\-_]+$/, + }, + page: { + greaterThanOrEqual: 1, + }, + pageSize: { + greaterThanOrEqual: 1, + lessThanOrEqual: 100, + }, +} + +export const ListNodeTypesRequest = { + page: { + greaterThanOrEqual: 1, + }, + pageSize: { + greaterThanOrEqual: 1, + lessThanOrEqual: 100, + }, +} + +export const ListSnapshotsRequest = { + name: { + maxLength: 255, + minLength: 1, + pattern: /^[A-Za-z0-9\-_]+$/, + }, + page: { + greaterThanOrEqual: 1, + }, + pageSize: { + greaterThanOrEqual: 1, + lessThanOrEqual: 100, + }, +} + +export const ListUsersRequest = { + name: { + maxLength: 63, + minLength: 1, + pattern: /^[a-zA-Z0-9_\-]*$/, + }, + page: { + greaterThanOrEqual: 1, + }, + pageSize: { + greaterThanOrEqual: 1, + lessThanOrEqual: 100, + }, +} + +export const ListVersionsRequest = { + page: { + greaterThanOrEqual: 1, + }, + pageSize: { + greaterThanOrEqual: 1, + lessThanOrEqual: 100, + }, + version: { + pattern: /^[0-9]+\.[0-9]+$/, + }, +} + +export const RestoreSnapshotRequest = { + instanceName: { + maxLength: 255, + minLength: 1, + pattern: /^[A-Za-z0-9\-_]+$/, + }, + nodeAmount: { + greaterThanOrEqual: 1, + lessThanOrEqual: 3, + }, +} + +export const SetUserRoleRequest = { + userName: { + maxLength: 63, + minLength: 1, + pattern: /^[a-zA-Z0-9_\-]*$/, + }, +} + +export const UpdateInstanceRequest = { + name: { + maxLength: 255, + minLength: 1, + pattern: /^[A-Za-z0-9\-_]+$/, + }, + snapshotScheduleFrequencyHours: { + greaterThanOrEqual: 1, + lessThanOrEqual: 24, + }, + snapshotScheduleRetentionDays: { + greaterThanOrEqual: 1, + lessThanOrEqual: 365, + }, +} + +export const UpdateSnapshotRequest = { + name: { + maxLength: 255, + minLength: 1, + pattern: /^[A-Za-z0-9\-_]+$/, + }, +} + +export const UpdateUserRequest = { + name: { + maxLength: 63, + minLength: 1, + pattern: /^[a-zA-Z0-9_\-]*$/, + }, + password: { + maxLength: 128, + minLength: 8, + }, +} + +export const Volume = { + sizeBytes: { + greaterThanOrEqual: 1000000000, + }, +} diff --git a/packages_generated/mongodb/src/v1alpha1/api.gen.ts b/packages_generated/mongodb/src/v1alpha1/api.gen.ts index c908f3f8c..10297b9d5 100644 --- a/packages_generated/mongodb/src/v1alpha1/api.gen.ts +++ b/packages_generated/mongodb/src/v1alpha1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { INSTANCE_TRANSIENT_STATUSES as INSTANCE_TRANSIENT_STATUSES_MONGODB, SNAPSHOT_TRANSIENT_STATUSES as SNAPSHOT_TRANSIENT_STATUSES_MONGODB, @@ -77,8 +78,13 @@ const jsonContentHeaders = { This API allows you to manage your Managed Databases for MongoDB®. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par'], + }) protected pageOfListNodeTypes = ( request: Readonly = {}, diff --git a/packages_generated/mongodb/src/v1alpha1/index.gen.ts b/packages_generated/mongodb/src/v1alpha1/index.gen.ts index b876115c8..ea5e44888 100644 --- a/packages_generated/mongodb/src/v1alpha1/index.gen.ts +++ b/packages_generated/mongodb/src/v1alpha1/index.gen.ts @@ -24,6 +24,7 @@ export type { GetSnapshotRequest, Instance, InstanceSetting, + InstanceSnapshotSchedule, InstanceStatus, ListInstancesRequest, ListInstancesRequestOrderBy, diff --git a/packages_generated/mongodb/src/v1alpha1/marshalling.gen.ts b/packages_generated/mongodb/src/v1alpha1/marshalling.gen.ts index f1697acbb..e0698966b 100644 --- a/packages_generated/mongodb/src/v1alpha1/marshalling.gen.ts +++ b/packages_generated/mongodb/src/v1alpha1/marshalling.gen.ts @@ -22,6 +22,7 @@ import type { EndpointSpecPublicDetails, Instance, InstanceSetting, + InstanceSnapshotSchedule, ListInstancesResponse, ListNodeTypesResponse, ListSnapshotsResponse, @@ -105,6 +106,24 @@ export const unmarshalInstanceSetting = (data: unknown): InstanceSetting => { } as InstanceSetting } +export const unmarshalInstanceSnapshotSchedule = ( + data: unknown, +): InstanceSnapshotSchedule => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'InstanceSnapshotSchedule' failed as data isn't a dictionary.`, + ) + } + + return { + enabled: data.enabled, + frequencyHours: data.frequency_hours, + lastRun: unmarshalDate(data.last_run), + nextUpdate: unmarshalDate(data.next_update), + retentionDays: data.retention_days, + } as InstanceSnapshotSchedule +} + export const unmarshalVolume = (data: unknown): Volume => { if (!isJSONObject(data)) { throw new TypeError( @@ -135,6 +154,9 @@ export const unmarshalInstance = (data: unknown): Instance => { projectId: data.project_id, region: data.region, settings: unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting), + snapshotSchedule: data.snapshot_schedule + ? unmarshalInstanceSnapshotSchedule(data.snapshot_schedule) + : undefined, status: data.status, tags: data.tags, version: data.version, diff --git a/packages_generated/mongodb/src/v1alpha1/types.gen.ts b/packages_generated/mongodb/src/v1alpha1/types.gen.ts index 77c5b84f9..1f71a0b2c 100644 --- a/packages_generated/mongodb/src/v1alpha1/types.gen.ts +++ b/packages_generated/mongodb/src/v1alpha1/types.gen.ts @@ -120,6 +120,14 @@ export interface InstanceSetting { value: string } +export interface InstanceSnapshotSchedule { + frequencyHours: number + retentionDays: number + enabled: boolean + nextUpdate?: Date + lastRun?: Date +} + export interface Volume { /** * Type of volume where data is stored. @@ -297,6 +305,10 @@ export interface Instance { * Creation date (must follow the ISO 8601 format). */ createdAt?: Date + /** + * Snapshot schedule configuration of the Database Instance. + */ + snapshotSchedule?: InstanceSnapshotSchedule /** * Region the Database Instance is in. */ diff --git a/packages_generated/rdb/src/v1/api.gen.ts b/packages_generated/rdb/src/v1/api.gen.ts index 650725375..cf6bfd086 100644 --- a/packages_generated/rdb/src/v1/api.gen.ts +++ b/packages_generated/rdb/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { DATABASE_BACKUP_TRANSIENT_STATUSES as DATABASE_BACKUP_TRANSIENT_STATUSES_RDB, INSTANCE_LOG_TRANSIENT_STATUSES as INSTANCE_LOG_TRANSIENT_STATUSES_RDB, @@ -172,12 +173,13 @@ const jsonContentHeaders = { This API allows you to manage your Managed Databases for PostgreSQL and MySQL. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListDatabaseEngines = ( request: Readonly = {}, diff --git a/packages_generated/redis/src/v1/api.gen.ts b/packages_generated/redis/src/v1/api.gen.ts index 1db67290a..0eec685ac 100644 --- a/packages_generated/redis/src/v1/api.gen.ts +++ b/packages_generated/redis/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Zone as ScwZone, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { CLUSTER_TRANSIENT_STATUSES as CLUSTER_TRANSIENT_STATUSES_REDIS } from './content.gen' import { marshalAddAclRulesRequest, @@ -81,15 +82,20 @@ const jsonContentHeaders = { This API allows you to manage your Managed Databases for Redis™. */ export class API extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'nl-ams-1', - 'nl-ams-2', - 'pl-waw-1', - 'pl-waw-2', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: [ + 'fr-par-1', + 'fr-par-2', + 'nl-ams-1', + 'nl-ams-2', + 'pl-waw-1', + 'pl-waw-2', + ], + }) /** * Create a Redis™ Database Instance. Create a new Redis™ Database Instance (Redis™ cluster). You must set the `zone`, `project_id`, `version`, `node_type`, `user_name` and `password` parameters. Optionally you can define `acl_rules`, `endpoints`, `tls_enabled` and `cluster_settings`. diff --git a/packages_generated/registry/src/v1/api.gen.ts b/packages_generated/registry/src/v1/api.gen.ts index f70fc185a..c86861b30 100644 --- a/packages_generated/registry/src/v1/api.gen.ts +++ b/packages_generated/registry/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { IMAGE_TRANSIENT_STATUSES as IMAGE_TRANSIENT_STATUSES_REGISTRY, NAMESPACE_TRANSIENT_STATUSES as NAMESPACE_TRANSIENT_STATUSES_REGISTRY, @@ -55,12 +56,13 @@ const jsonContentHeaders = { This API allows you to manage your Container Registry resources. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListNamespaces = ( request: Readonly = {}, diff --git a/packages_generated/secret/src/v1beta1/api.gen.ts b/packages_generated/secret/src/v1beta1/api.gen.ts index 555dae0ed..7fc2b8d08 100644 --- a/packages_generated/secret/src/v1beta1/api.gen.ts +++ b/packages_generated/secret/src/v1beta1/api.gen.ts @@ -3,10 +3,11 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, } from '@scaleway/sdk-client' -import type { Region as ScwRegion } from '@scaleway/sdk-client' +import type { ApiLocality } from '@scaleway/sdk-client' import { marshalAddSecretOwnerRequest, marshalCreateSecretRequest, @@ -65,12 +66,13 @@ const jsonContentHeaders = { This API allows you to manage your Secret Manager services, for storing, accessing and sharing sensitive data such as passwords, API keys and certificates. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) /** * Create a secret. Create a secret in a given region specified by the `region` parameter. diff --git a/packages_generated/serverless_sqldb/src/v1alpha1/api.gen.ts b/packages_generated/serverless_sqldb/src/v1alpha1/api.gen.ts index dd87cfde6..add4cb95a 100644 --- a/packages_generated/serverless_sqldb/src/v1alpha1/api.gen.ts +++ b/packages_generated/serverless_sqldb/src/v1alpha1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { DATABASE_TRANSIENT_STATUSES as DATABASE_TRANSIENT_STATUSES_SERVERLESS_SQLDB } from './content.gen' import { marshalCreateDatabaseRequest, @@ -44,8 +45,13 @@ const jsonContentHeaders = { This API allows you to manage your Serverless SQL Databases. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par'], + }) /** * Create a new Serverless SQL Database. You must provide the following parameters: `organization_id`, `project_id`, `name`, `cpu_min`, `cpu_max`. You can also provide `from_backup_id` to create a database from a backup. diff --git a/packages_generated/tem/src/v1alpha1/api.gen.ts b/packages_generated/tem/src/v1alpha1/api.gen.ts index 5acc10114..6bf49f9ee 100644 --- a/packages_generated/tem/src/v1alpha1/api.gen.ts +++ b/packages_generated/tem/src/v1alpha1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { DOMAIN_TRANSIENT_STATUSES as DOMAIN_TRANSIENT_STATUSES_TEM, EMAIL_TRANSIENT_STATUSES as EMAIL_TRANSIENT_STATUSES_TEM, @@ -99,8 +100,13 @@ const jsonContentHeaders = { This API allows you to manage your Transactional Email services. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = ['fr-par'] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par'], + }) /** * Send an email. You must specify the `region`, the sender and the recipient's information and the `project_id` to send an email from a checked domain. The subject of the email must contain at least 6 characters. diff --git a/packages_generated/vpc/src/v2/api.gen.ts b/packages_generated/vpc/src/v2/api.gen.ts index b9e2dbc5a..ff3636879 100644 --- a/packages_generated/vpc/src/v2/api.gen.ts +++ b/packages_generated/vpc/src/v2/api.gen.ts @@ -3,10 +3,11 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, } from '@scaleway/sdk-client' -import type { Region as ScwRegion } from '@scaleway/sdk-client' +import type { ApiLocality } from '@scaleway/sdk-client' import { marshalAddSubnetsRequest, marshalCreatePrivateNetworkRequest, @@ -73,12 +74,13 @@ const jsonContentHeaders = { This API allows you to manage your Virtual Private Clouds (VPCs) and Private Networks. */ export class API extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListVPCs = (request: Readonly = {}) => this.client.fetch( diff --git a/packages_generated/vpcgw/src/v1/api.gen.ts b/packages_generated/vpcgw/src/v1/api.gen.ts index c0ea9746e..8c4689234 100644 --- a/packages_generated/vpcgw/src/v1/api.gen.ts +++ b/packages_generated/vpcgw/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Zone as ScwZone, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { GATEWAY_NETWORK_TRANSIENT_STATUSES as GATEWAY_NETWORK_TRANSIENT_STATUSES_VPCGW, GATEWAY_TRANSIENT_STATUSES as GATEWAY_TRANSIENT_STATUSES_VPCGW, @@ -109,17 +110,22 @@ const jsonContentHeaders = { This API allows you to manage your Public Gateways. */ export class API extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'nl-ams-1', - 'nl-ams-2', - 'nl-ams-3', - 'pl-waw-1', - 'pl-waw-2', - 'pl-waw-3', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: [ + 'fr-par-1', + 'fr-par-2', + 'nl-ams-1', + 'nl-ams-2', + 'nl-ams-3', + 'pl-waw-1', + 'pl-waw-2', + 'pl-waw-3', + ], + }) protected pageOfListGateways = ( request: Readonly = {}, diff --git a/packages_generated/vpcgw/src/v2/api.gen.ts b/packages_generated/vpcgw/src/v2/api.gen.ts index 1e33603fd..6a9dee7b9 100644 --- a/packages_generated/vpcgw/src/v2/api.gen.ts +++ b/packages_generated/vpcgw/src/v2/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Zone as ScwZone, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { GATEWAY_NETWORK_TRANSIENT_STATUSES as GATEWAY_NETWORK_TRANSIENT_STATUSES_VPCGW, GATEWAY_TRANSIENT_STATUSES as GATEWAY_TRANSIENT_STATUSES_VPCGW, @@ -90,17 +91,22 @@ const jsonContentHeaders = { This API allows you to manage your Public Gateways. */ export class API extends ParentAPI { - /** Lists the available zones of the API. */ - public static readonly LOCALITIES: ScwZone[] = [ - 'fr-par-1', - 'fr-par-2', - 'nl-ams-1', - 'nl-ams-2', - 'nl-ams-3', - 'pl-waw-1', - 'pl-waw-2', - 'pl-waw-3', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + zones: [ + 'fr-par-1', + 'fr-par-2', + 'nl-ams-1', + 'nl-ams-2', + 'nl-ams-3', + 'pl-waw-1', + 'pl-waw-2', + 'pl-waw-3', + ], + }) protected pageOfListGateways = ( request: Readonly = {}, diff --git a/packages_generated/webhosting/src/v1/api.gen.ts b/packages_generated/webhosting/src/v1/api.gen.ts index c702a59b6..0c8e4cc04 100644 --- a/packages_generated/webhosting/src/v1/api.gen.ts +++ b/packages_generated/webhosting/src/v1/api.gen.ts @@ -3,11 +3,12 @@ import { API as ParentAPI, enrichForPagination, + toApiLocality, urlParams, validatePathParam, waitForResource, } from '@scaleway/sdk-client' -import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client' +import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client' import { DOMAIN_TRANSIENT_STATUSES as DOMAIN_TRANSIENT_STATUSES_WEBHOSTING, HOSTING_TRANSIENT_STATUSES as HOSTING_TRANSIENT_STATUSES_WEBHOSTING, @@ -116,12 +117,13 @@ const jsonContentHeaders = { This API allows you to manage your Web Hosting services. */ export class ControlPanelAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListControlPanels = ( request: Readonly = {}, @@ -159,12 +161,13 @@ export class ControlPanelAPI extends ParentAPI { This API allows you to manage your databases and database users for your Web Hosting services. */ export class DatabaseAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) /** * "Create a new database within your hosting plan". @@ -410,12 +413,13 @@ export class DatabaseAPI extends ParentAPI { This API allows you to manage your Web Hosting services. */ export class DnsAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) /** * Get DNS records. Get the set of DNS records of a specified domain associated with a Web Hosting plan's domain. @@ -548,12 +552,13 @@ export class DnsAPI extends ParentAPI { This API allows you to manage your offer for your Web Hosting services. */ export class OfferAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListOffers = ( request: Readonly = {}, @@ -592,12 +597,13 @@ export class OfferAPI extends ParentAPI { This API allows you to manage your Web Hosting services. */ export class HostingAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) /** * Order a Web Hosting plan. Order a Web Hosting plan, specifying the offer type required via the `offer_id` parameter. @@ -783,12 +789,13 @@ export class HostingAPI extends ParentAPI { This API allows you to manage your FTP accounts for your Web Hosting services. */ export class FtpAccountAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) /** * Create a new FTP account within your hosting plan.. Create a new FTP account within your hosting plan. @@ -885,12 +892,13 @@ export class FtpAccountAPI extends ParentAPI { This API allows you to manage your mail accounts for your Web Hosting services. */ export class MailAccountAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) /** * Create a new mail account within your hosting plan.. Create a new mail account within your hosting plan. @@ -1001,12 +1009,13 @@ export class MailAccountAPI extends ParentAPI { This API allows you to manage your websites for your Web Hosting services. */ export class WebsiteAPI extends ParentAPI { - /** Lists the available regions of the API. */ - public static readonly LOCALITIES: ScwRegion[] = [ - 'fr-par', - 'nl-ams', - 'pl-waw', - ] + /** + * Locality of this API. + * type ∈ {'zone','region','global','unspecified'} + */ + public static readonly LOCALITY: ApiLocality = toApiLocality({ + regions: ['fr-par', 'nl-ams', 'pl-waw'], + }) protected pageOfListWebsites = ( request: Readonly,