@scaleway/sdk-datawarehouse 1.2.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @scaleway/sdk-datawarehouse
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-datawarehouse.svg)](https://www.npmjs.com/package/@scaleway/sdk-datawarehouse)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-datawarehouse.svg)](https://www.npmjs.com/package/@scaleway/sdk-datawarehouse)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-datawarehouse.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Datawarehouse API.
8
+
9
+ > **Note**
10
+ > This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @scaleway/sdk-datawarehouse @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-datawarehouse @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-datawarehouse @scaleway/sdk-client
28
+ ```
29
+
30
+ ## Getting Started
31
+
32
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
33
+
34
+ ### Basic Usage
35
+
36
+ ```typescript
37
+ import { createClient } from '@scaleway/sdk-client'
38
+ import { Datawarehouse } from '@scaleway/sdk-datawarehouse'
39
+
40
+ const client = createClient({
41
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
42
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultRegion: 'fr-par',
45
+ defaultZone: 'fr-par-1',
46
+ })
47
+
48
+ const api = new Datawarehouse.v1.API(client)
49
+
50
+ // Use the API
51
+ // Example: await api.listServers()
52
+ ```
53
+
54
+ ### Using Configuration Loader
55
+
56
+ For a simpler setup, you can load credentials from the configuration file or environment variables:
57
+
58
+ ```typescript
59
+ import { createClient } from '@scaleway/sdk-client'
60
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
61
+ import { Datawarehouse } from '@scaleway/sdk-datawarehouse'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Datawarehouse.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Datawarehouse API Documentation](https://www.scaleway.com/en/developers/api/datawarehouse/)
72
+ - 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
73
+ - 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
74
+
75
+ ## Features
76
+
77
+ - ✅ Full TypeScript support with complete type definitions
78
+ - ✅ Promise-based API
79
+ - ✅ Automatic pagination helpers
80
+ - ✅ Built-in error handling
81
+ - ✅ Compatible with Node.js ≥ 20
82
+
83
+ ## Support
84
+
85
+ We love feedback! Feel free to reach us on:
86
+ - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
+ - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
+
89
+ ## Contributing
90
+
91
+ This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
92
+
93
+ ## License
94
+
95
+ This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
+
@@ -1,5 +1,5 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
3
  import type { CreateDatabaseRequest, CreateDeploymentRequest, CreateEndpointRequest, CreateUserRequest, Database, DeleteDatabaseRequest, DeleteDeploymentRequest, DeleteEndpointRequest, DeleteUserRequest, Deployment, Endpoint, GetDeploymentCertificateRequest, GetDeploymentRequest, ListDatabasesRequest, ListDatabasesResponse, ListDeploymentsRequest, ListDeploymentsResponse, ListPresetsRequest, ListPresetsResponse, ListUsersRequest, ListUsersResponse, ListVersionsRequest, ListVersionsResponse, UpdateDeploymentRequest, UpdateUserRequest, User } from './types.gen.js';
4
4
  /**
5
5
  * Data Warehouse API.
@@ -3,7 +3,8 @@ const DEPLOYMENT_TRANSIENT_STATUSES = [
3
3
  "configuring",
4
4
  "deleting",
5
5
  "locking",
6
- "unlocking"
6
+ "unlocking",
7
+ "deploying"
7
8
  ];
8
9
  export {
9
10
  DEPLOYMENT_TRANSIENT_STATUSES
@@ -1,5 +1,5 @@
1
1
  import type { Region as ScwRegion } from '@scaleway/sdk-client';
2
- export type DeploymentStatus = 'unknown_status' | 'ready' | 'creating' | 'configuring' | 'deleting' | 'error' | 'locked' | 'locking' | 'unlocking';
2
+ export type DeploymentStatus = 'unknown_status' | 'ready' | 'creating' | 'configuring' | 'deleting' | 'error' | 'locked' | 'locking' | 'unlocking' | 'deploying';
3
3
  export type EndpointServiceProtocol = 'unknown_protocol' | 'tcp' | 'https' | 'mysql';
4
4
  export type ListDatabasesRequestOrderBy = 'name_asc' | 'name_desc' | 'size_asc' | 'size_desc';
5
5
  export type ListDeploymentsRequestOrderBy = 'created_at_desc' | 'created_at_asc' | 'name_asc' | 'name_desc';
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-datawarehouse",
3
- "version": "1.2.0",
3
+ "version": "2.2.0",
4
4
  "description": "Scaleway SDK datawarehouse",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
+ "README.md",
7
8
  "dist"
8
9
  ],
9
10
  "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/index.gen.d.ts",
13
- "import": "./dist/index.gen.js",
14
- "require": "./dist/index.gen.cjs",
15
14
  "default": "./dist/index.gen.js"
16
15
  },
17
16
  "./*": {
18
17
  "types": "./dist/*/index.gen.d.ts",
19
- "import": "./dist/*/index.gen.js",
20
- "require": "./dist/*/index.gen.cjs",
21
18
  "default": "./dist/*/index.gen.js"
22
19
  }
23
20
  },
@@ -26,17 +23,17 @@
26
23
  "directory": "packages_generated/datawarehouse"
27
24
  },
28
25
  "engines": {
29
- "node": ">=20.18.3"
26
+ "node": ">=20.19.6"
30
27
  },
31
28
  "dependencies": {
32
- "@scaleway/random-name": "5.1.1",
33
- "@scaleway/sdk-std": "1.2.0"
29
+ "@scaleway/random-name": "5.1.2",
30
+ "@scaleway/sdk-std": "2.1.0"
34
31
  },
35
32
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.3"
33
+ "@scaleway/sdk-client": "^2.1.0"
37
34
  },
38
35
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.3"
36
+ "@scaleway/sdk-client": "^2.1.0"
40
37
  },
41
38
  "scripts": {
42
39
  "package:check": "pnpm publint",
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index_gen = require("./v1beta1/index.gen.cjs");
4
- exports.Datawarehousev1beta1 = index_gen;
@@ -1,311 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const content_gen = require("./content.gen.cjs");
5
- const marshalling_gen = require("./marshalling.gen.cjs");
6
- const jsonContentHeaders = {
7
- "Content-Type": "application/json; charset=utf-8"
8
- };
9
- class API extends sdkClient.API {
10
- /**
11
- * Locality of this API.
12
- * type ∈ {'zone','region','global','unspecified'}
13
- */
14
- static LOCALITY = sdkClient.toApiLocality({
15
- regions: ["fr-par"]
16
- });
17
- pageOfListPresets = (request = {}) => this.client.fetch(
18
- {
19
- method: "GET",
20
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/presets`,
21
- urlParams: sdkClient.urlParams(
22
- ["page", request.page],
23
- [
24
- "page_size",
25
- request.pageSize ?? this.client.settings.defaultPageSize
26
- ]
27
- )
28
- },
29
- marshalling_gen.unmarshalListPresetsResponse
30
- );
31
- /**
32
- * List available presets.
33
- *
34
- * @param request - The request {@link ListPresetsRequest}
35
- * @returns A Promise of ListPresetsResponse
36
- */
37
- listPresets = (request = {}) => sdkClient.enrichForPagination("presets", this.pageOfListPresets, request);
38
- pageOfListVersions = (request = {}) => this.client.fetch(
39
- {
40
- method: "GET",
41
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions`,
42
- urlParams: sdkClient.urlParams(
43
- ["page", request.page],
44
- [
45
- "page_size",
46
- request.pageSize ?? this.client.settings.defaultPageSize
47
- ],
48
- ["version", request.version]
49
- )
50
- },
51
- marshalling_gen.unmarshalListVersionsResponse
52
- );
53
- /**
54
- * List available ClickHouse® versions.
55
- *
56
- * @param request - The request {@link ListVersionsRequest}
57
- * @returns A Promise of ListVersionsResponse
58
- */
59
- listVersions = (request = {}) => sdkClient.enrichForPagination("versions", this.pageOfListVersions, request);
60
- pageOfListDeployments = (request = {}) => this.client.fetch(
61
- {
62
- method: "GET",
63
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments`,
64
- urlParams: sdkClient.urlParams(
65
- ["name", request.name],
66
- ["order_by", request.orderBy],
67
- ["organization_id", request.organizationId],
68
- ["page", request.page],
69
- [
70
- "page_size",
71
- request.pageSize ?? this.client.settings.defaultPageSize
72
- ],
73
- ["project_id", request.projectId],
74
- ["tags", request.tags]
75
- )
76
- },
77
- marshalling_gen.unmarshalListDeploymentsResponse
78
- );
79
- /**
80
- * List deployments. List all deployments in the specified region, for a given Scaleway Project. By default, the deployments 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 provide will be checked against the whole name string to see if it includes the string you put in the parameter.
81
- *
82
- * @param request - The request {@link ListDeploymentsRequest}
83
- * @returns A Promise of ListDeploymentsResponse
84
- */
85
- listDeployments = (request = {}) => sdkClient.enrichForPagination("deployments", this.pageOfListDeployments, request);
86
- /**
87
- * Get a deployment. Retrieve information about a given deployment, specified by the `region` and `deployment_id` parameters. Its full details, including name, status are returned in the response object.
88
- *
89
- * @param request - The request {@link GetDeploymentRequest}
90
- * @returns A Promise of Deployment
91
- */
92
- getDeployment = (request) => this.client.fetch(
93
- {
94
- method: "GET",
95
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}`
96
- },
97
- marshalling_gen.unmarshalDeployment
98
- );
99
- /**
100
- * Waits for {@link Deployment} to be in a final state.
101
- *
102
- * @param request - The request {@link GetDeploymentRequest}
103
- * @param options - The waiting options
104
- * @returns A Promise of Deployment
105
- */
106
- waitForDeployment = (request, options) => sdkClient.waitForResource(
107
- options?.stop ?? ((res) => Promise.resolve(
108
- !content_gen.DEPLOYMENT_TRANSIENT_STATUSES.includes(res.status)
109
- )),
110
- this.getDeployment,
111
- request,
112
- options
113
- );
114
- /**
115
- * Create a deployment. Create a new deployment.
116
- *
117
- * @param request - The request {@link CreateDeploymentRequest}
118
- * @returns A Promise of Deployment
119
- */
120
- createDeployment = (request) => this.client.fetch(
121
- {
122
- body: JSON.stringify(
123
- marshalling_gen.marshalCreateDeploymentRequest(request, this.client.settings)
124
- ),
125
- headers: jsonContentHeaders,
126
- method: "POST",
127
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments`
128
- },
129
- marshalling_gen.unmarshalDeployment
130
- );
131
- /**
132
- * Update a deployment. Update the parameters of a deployment.
133
- *
134
- * @param request - The request {@link UpdateDeploymentRequest}
135
- * @returns A Promise of Deployment
136
- */
137
- updateDeployment = (request) => this.client.fetch(
138
- {
139
- body: JSON.stringify(
140
- marshalling_gen.marshalUpdateDeploymentRequest(request, this.client.settings)
141
- ),
142
- headers: jsonContentHeaders,
143
- method: "PATCH",
144
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}`
145
- },
146
- marshalling_gen.unmarshalDeployment
147
- );
148
- /**
149
- * Delete a deployment. Delete a given deployment, specified by the `region` and `deployment_id` parameters. Deleting a deployment is permanent, and cannot be undone. Upon deletion, all your data will be lost.
150
- *
151
- * @param request - The request {@link DeleteDeploymentRequest}
152
- * @returns A Promise of Deployment
153
- */
154
- deleteDeployment = (request) => this.client.fetch(
155
- {
156
- method: "DELETE",
157
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}`
158
- },
159
- marshalling_gen.unmarshalDeployment
160
- );
161
- getDeploymentCertificate = (request) => this.client.fetch({
162
- method: "GET",
163
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}/certificate`,
164
- urlParams: sdkClient.urlParams(["dl", 1]),
165
- responseType: "blob"
166
- });
167
- pageOfListUsers = (request) => this.client.fetch(
168
- {
169
- method: "GET",
170
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}/users`,
171
- urlParams: sdkClient.urlParams(
172
- ["name", request.name],
173
- ["order_by", request.orderBy],
174
- ["page", request.page],
175
- [
176
- "page_size",
177
- request.pageSize ?? this.client.settings.defaultPageSize
178
- ]
179
- )
180
- },
181
- marshalling_gen.unmarshalListUsersResponse
182
- );
183
- /**
184
- * List users associated with a deployment.
185
- *
186
- * @param request - The request {@link ListUsersRequest}
187
- * @returns A Promise of ListUsersResponse
188
- */
189
- listUsers = (request) => sdkClient.enrichForPagination("users", this.pageOfListUsers, request);
190
- /**
191
- * Create a new user for a deployment.
192
- *
193
- * @param request - The request {@link CreateUserRequest}
194
- * @returns A Promise of User
195
- */
196
- createUser = (request) => this.client.fetch(
197
- {
198
- body: JSON.stringify(
199
- marshalling_gen.marshalCreateUserRequest(request, this.client.settings)
200
- ),
201
- headers: jsonContentHeaders,
202
- method: "POST",
203
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}/users`
204
- },
205
- marshalling_gen.unmarshalUser
206
- );
207
- /**
208
- * Update an existing user for a deployment.
209
- *
210
- * @param request - The request {@link UpdateUserRequest}
211
- * @returns A Promise of User
212
- */
213
- updateUser = (request) => this.client.fetch(
214
- {
215
- body: JSON.stringify(
216
- marshalling_gen.marshalUpdateUserRequest(request, this.client.settings)
217
- ),
218
- headers: jsonContentHeaders,
219
- method: "PATCH",
220
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}/users/${sdkClient.validatePathParam("name", request.name)}`
221
- },
222
- marshalling_gen.unmarshalUser
223
- );
224
- /**
225
- * Delete a user from a deployment.
226
- *
227
- * @param request - The request {@link DeleteUserRequest}
228
- */
229
- deleteUser = (request) => this.client.fetch({
230
- body: "{}",
231
- headers: jsonContentHeaders,
232
- method: "DELETE",
233
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}/users/${sdkClient.validatePathParam("name", request.name)}`
234
- });
235
- /**
236
- * Delete an endpoint from a deployment.
237
- *
238
- * @param request - The request {@link DeleteEndpointRequest}
239
- */
240
- deleteEndpoint = (request) => this.client.fetch({
241
- method: "DELETE",
242
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${sdkClient.validatePathParam("endpointId", request.endpointId)}`
243
- });
244
- /**
245
- * Create a new endpoint for a deployment.
246
- *
247
- * @param request - The request {@link CreateEndpointRequest}
248
- * @returns A Promise of Endpoint
249
- */
250
- createEndpoint = (request) => this.client.fetch(
251
- {
252
- body: JSON.stringify(
253
- marshalling_gen.marshalCreateEndpointRequest(request, this.client.settings)
254
- ),
255
- headers: jsonContentHeaders,
256
- method: "POST",
257
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints`
258
- },
259
- marshalling_gen.unmarshalEndpoint
260
- );
261
- pageOfListDatabases = (request) => this.client.fetch(
262
- {
263
- method: "GET",
264
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}/databases`,
265
- urlParams: sdkClient.urlParams(
266
- ["name", request.name],
267
- ["order_by", request.orderBy],
268
- ["page", request.page],
269
- [
270
- "page_size",
271
- request.pageSize ?? this.client.settings.defaultPageSize
272
- ]
273
- )
274
- },
275
- marshalling_gen.unmarshalListDatabasesResponse
276
- );
277
- /**
278
- * List databases within a deployment.
279
- *
280
- * @param request - The request {@link ListDatabasesRequest}
281
- * @returns A Promise of ListDatabasesResponse
282
- */
283
- listDatabases = (request) => sdkClient.enrichForPagination("databases", this.pageOfListDatabases, request);
284
- /**
285
- * Create a new database within a deployment.
286
- *
287
- * @param request - The request {@link CreateDatabaseRequest}
288
- * @returns A Promise of Database
289
- */
290
- createDatabase = (request) => this.client.fetch(
291
- {
292
- body: JSON.stringify(
293
- marshalling_gen.marshalCreateDatabaseRequest(request, this.client.settings)
294
- ),
295
- headers: jsonContentHeaders,
296
- method: "POST",
297
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}/databases`
298
- },
299
- marshalling_gen.unmarshalDatabase
300
- );
301
- /**
302
- * Delete a database from a deployment.
303
- *
304
- * @param request - The request {@link DeleteDatabaseRequest}
305
- */
306
- deleteDatabase = (request) => this.client.fetch({
307
- method: "DELETE",
308
- path: `/datawarehouse/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}/databases/${sdkClient.validatePathParam("name", request.name)}`
309
- });
310
- }
311
- exports.API = API;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const DEPLOYMENT_TRANSIENT_STATUSES = [
4
- "creating",
5
- "configuring",
6
- "deleting",
7
- "locking",
8
- "unlocking"
9
- ];
10
- exports.DEPLOYMENT_TRANSIENT_STATUSES = DEPLOYMENT_TRANSIENT_STATUSES;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const api_gen = require("./api.gen.cjs");
4
- const content_gen = require("./content.gen.cjs");
5
- const marshalling_gen = require("./marshalling.gen.cjs");
6
- const validationRules_gen = require("./validation-rules.gen.cjs");
7
- exports.API = api_gen.API;
8
- exports.DEPLOYMENT_TRANSIENT_STATUSES = content_gen.DEPLOYMENT_TRANSIENT_STATUSES;
9
- exports.marshalCreateDatabaseRequest = marshalling_gen.marshalCreateDatabaseRequest;
10
- exports.marshalCreateDeploymentRequest = marshalling_gen.marshalCreateDeploymentRequest;
11
- exports.marshalCreateEndpointRequest = marshalling_gen.marshalCreateEndpointRequest;
12
- exports.marshalCreateUserRequest = marshalling_gen.marshalCreateUserRequest;
13
- exports.marshalUpdateDeploymentRequest = marshalling_gen.marshalUpdateDeploymentRequest;
14
- exports.marshalUpdateUserRequest = marshalling_gen.marshalUpdateUserRequest;
15
- exports.unmarshalDatabase = marshalling_gen.unmarshalDatabase;
16
- exports.unmarshalDeployment = marshalling_gen.unmarshalDeployment;
17
- exports.unmarshalEndpoint = marshalling_gen.unmarshalEndpoint;
18
- exports.unmarshalListDatabasesResponse = marshalling_gen.unmarshalListDatabasesResponse;
19
- exports.unmarshalListDeploymentsResponse = marshalling_gen.unmarshalListDeploymentsResponse;
20
- exports.unmarshalListPresetsResponse = marshalling_gen.unmarshalListPresetsResponse;
21
- exports.unmarshalListUsersResponse = marshalling_gen.unmarshalListUsersResponse;
22
- exports.unmarshalListVersionsResponse = marshalling_gen.unmarshalListVersionsResponse;
23
- exports.unmarshalUser = marshalling_gen.unmarshalUser;
24
- exports.ValidationRules = validationRules_gen;
@@ -1,241 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const unmarshalEndpointPrivateNetworkDetails = (data) => {
5
- if (!sdkClient.isJSONObject(data)) {
6
- throw new TypeError(
7
- `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
8
- );
9
- }
10
- return {
11
- privateNetworkId: data.private_network_id
12
- };
13
- };
14
- const unmarshalEndpointPublicDetails = (data) => {
15
- if (!sdkClient.isJSONObject(data)) {
16
- throw new TypeError(
17
- `Unmarshalling the type 'EndpointPublicDetails' failed as data isn't a dictionary.`
18
- );
19
- }
20
- return {};
21
- };
22
- const unmarshalEndpointService = (data) => {
23
- if (!sdkClient.isJSONObject(data)) {
24
- throw new TypeError(
25
- `Unmarshalling the type 'EndpointService' failed as data isn't a dictionary.`
26
- );
27
- }
28
- return {
29
- port: data.port,
30
- protocol: data.protocol
31
- };
32
- };
33
- const unmarshalEndpoint = (data) => {
34
- if (!sdkClient.isJSONObject(data)) {
35
- throw new TypeError(
36
- `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
37
- );
38
- }
39
- return {
40
- dnsRecord: data.dns_record,
41
- id: data.id,
42
- privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
43
- public: data.public ? unmarshalEndpointPublicDetails(data.public) : void 0,
44
- services: sdkClient.unmarshalArrayOfObject(data.services, unmarshalEndpointService)
45
- };
46
- };
47
- const unmarshalDatabase = (data) => {
48
- if (!sdkClient.isJSONObject(data)) {
49
- throw new TypeError(
50
- `Unmarshalling the type 'Database' failed as data isn't a dictionary.`
51
- );
52
- }
53
- return {
54
- name: data.name,
55
- size: data.size
56
- };
57
- };
58
- const unmarshalDeployment = (data) => {
59
- if (!sdkClient.isJSONObject(data)) {
60
- throw new TypeError(
61
- `Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`
62
- );
63
- }
64
- return {
65
- cpuMax: data.cpu_max,
66
- cpuMin: data.cpu_min,
67
- createdAt: sdkClient.unmarshalDate(data.created_at),
68
- endpoints: sdkClient.unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
69
- id: data.id,
70
- name: data.name,
71
- organizationId: data.organization_id,
72
- projectId: data.project_id,
73
- ramPerCpu: data.ram_per_cpu,
74
- region: data.region,
75
- replicaCount: data.replica_count,
76
- status: data.status,
77
- tags: data.tags,
78
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
79
- version: data.version
80
- };
81
- };
82
- const unmarshalUser = (data) => {
83
- if (!sdkClient.isJSONObject(data)) {
84
- throw new TypeError(
85
- `Unmarshalling the type 'User' failed as data isn't a dictionary.`
86
- );
87
- }
88
- return {
89
- isAdmin: data.is_admin,
90
- name: data.name
91
- };
92
- };
93
- const unmarshalListDatabasesResponse = (data) => {
94
- if (!sdkClient.isJSONObject(data)) {
95
- throw new TypeError(
96
- `Unmarshalling the type 'ListDatabasesResponse' failed as data isn't a dictionary.`
97
- );
98
- }
99
- return {
100
- databases: sdkClient.unmarshalArrayOfObject(data.databases, unmarshalDatabase),
101
- totalCount: data.total_count
102
- };
103
- };
104
- const unmarshalListDeploymentsResponse = (data) => {
105
- if (!sdkClient.isJSONObject(data)) {
106
- throw new TypeError(
107
- `Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`
108
- );
109
- }
110
- return {
111
- deployments: sdkClient.unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
112
- totalCount: data.total_count
113
- };
114
- };
115
- const unmarshalPreset = (data) => {
116
- if (!sdkClient.isJSONObject(data)) {
117
- throw new TypeError(
118
- `Unmarshalling the type 'Preset' failed as data isn't a dictionary.`
119
- );
120
- }
121
- return {
122
- category: data.category,
123
- cpuMax: data.cpu_max,
124
- cpuMin: data.cpu_min,
125
- name: data.name,
126
- ramPerCpu: data.ram_per_cpu,
127
- replicaCount: data.replica_count
128
- };
129
- };
130
- const unmarshalListPresetsResponse = (data) => {
131
- if (!sdkClient.isJSONObject(data)) {
132
- throw new TypeError(
133
- `Unmarshalling the type 'ListPresetsResponse' failed as data isn't a dictionary.`
134
- );
135
- }
136
- return {
137
- presets: sdkClient.unmarshalArrayOfObject(data.presets, unmarshalPreset),
138
- totalCount: data.total_count
139
- };
140
- };
141
- const unmarshalListUsersResponse = (data) => {
142
- if (!sdkClient.isJSONObject(data)) {
143
- throw new TypeError(
144
- `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`
145
- );
146
- }
147
- return {
148
- totalCount: data.total_count,
149
- users: sdkClient.unmarshalArrayOfObject(data.users, unmarshalUser)
150
- };
151
- };
152
- const unmarshalVersion = (data) => {
153
- if (!sdkClient.isJSONObject(data)) {
154
- throw new TypeError(
155
- `Unmarshalling the type 'Version' failed as data isn't a dictionary.`
156
- );
157
- }
158
- return {
159
- endOfLifeAt: sdkClient.unmarshalDate(data.end_of_life_at),
160
- version: data.version
161
- };
162
- };
163
- const unmarshalListVersionsResponse = (data) => {
164
- if (!sdkClient.isJSONObject(data)) {
165
- throw new TypeError(
166
- `Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`
167
- );
168
- }
169
- return {
170
- totalCount: data.total_count,
171
- versions: sdkClient.unmarshalArrayOfObject(data.versions, unmarshalVersion)
172
- };
173
- };
174
- const marshalCreateDatabaseRequest = (request, defaults) => ({
175
- name: request.name
176
- });
177
- const marshalEndpointSpecPrivateNetworkDetails = (request, defaults) => ({
178
- private_network_id: request.privateNetworkId
179
- });
180
- const marshalEndpointSpecPublicDetails = (request, defaults) => ({});
181
- const marshalEndpointSpec = (request, defaults) => ({
182
- ...sdkClient.resolveOneOf([
183
- {
184
- param: "public",
185
- value: request.public !== void 0 ? marshalEndpointSpecPublicDetails(request.public) : void 0
186
- },
187
- {
188
- param: "private_network",
189
- value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetworkDetails(
190
- request.privateNetwork
191
- ) : void 0
192
- }
193
- ])
194
- });
195
- const marshalCreateDeploymentRequest = (request, defaults) => ({
196
- cpu_max: request.cpuMax,
197
- cpu_min: request.cpuMin,
198
- endpoints: request.endpoints !== void 0 ? request.endpoints.map((elt) => marshalEndpointSpec(elt)) : void 0,
199
- name: request.name,
200
- password: request.password,
201
- project_id: request.projectId ?? defaults.defaultProjectId,
202
- ram_per_cpu: request.ramPerCpu,
203
- replica_count: request.replicaCount,
204
- tags: request.tags,
205
- version: request.version
206
- });
207
- const marshalCreateEndpointRequest = (request, defaults) => ({
208
- deployment_id: request.deploymentId,
209
- endpoint: request.endpoint !== void 0 ? marshalEndpointSpec(request.endpoint) : void 0
210
- });
211
- const marshalCreateUserRequest = (request, defaults) => ({
212
- is_admin: request.isAdmin,
213
- name: request.name,
214
- password: request.password
215
- });
216
- const marshalUpdateDeploymentRequest = (request, defaults) => ({
217
- cpu_max: request.cpuMax,
218
- cpu_min: request.cpuMin,
219
- name: request.name,
220
- replica_count: request.replicaCount,
221
- tags: request.tags
222
- });
223
- const marshalUpdateUserRequest = (request, defaults) => ({
224
- is_admin: request.isAdmin,
225
- password: request.password
226
- });
227
- exports.marshalCreateDatabaseRequest = marshalCreateDatabaseRequest;
228
- exports.marshalCreateDeploymentRequest = marshalCreateDeploymentRequest;
229
- exports.marshalCreateEndpointRequest = marshalCreateEndpointRequest;
230
- exports.marshalCreateUserRequest = marshalCreateUserRequest;
231
- exports.marshalUpdateDeploymentRequest = marshalUpdateDeploymentRequest;
232
- exports.marshalUpdateUserRequest = marshalUpdateUserRequest;
233
- exports.unmarshalDatabase = unmarshalDatabase;
234
- exports.unmarshalDeployment = unmarshalDeployment;
235
- exports.unmarshalEndpoint = unmarshalEndpoint;
236
- exports.unmarshalListDatabasesResponse = unmarshalListDatabasesResponse;
237
- exports.unmarshalListDeploymentsResponse = unmarshalListDeploymentsResponse;
238
- exports.unmarshalListPresetsResponse = unmarshalListPresetsResponse;
239
- exports.unmarshalListUsersResponse = unmarshalListUsersResponse;
240
- exports.unmarshalListVersionsResponse = unmarshalListVersionsResponse;
241
- exports.unmarshalUser = unmarshalUser;
@@ -1,183 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const CreateDatabaseRequest = {
4
- name: {
5
- maxLength: 63,
6
- minLength: 1,
7
- pattern: /^[a-z][a-zA-Z0-9_\-]*$/
8
- }
9
- };
10
- const CreateDeploymentRequest = {
11
- cpuMax: {
12
- greaterThanOrEqual: 1,
13
- lessThanOrEqual: 15
14
- },
15
- cpuMin: {
16
- greaterThanOrEqual: 1,
17
- lessThanOrEqual: 15
18
- },
19
- name: {
20
- maxLength: 255,
21
- minLength: 1,
22
- pattern: /^[A-Za-z0-9-_]+$/
23
- },
24
- password: {
25
- maxLength: 50,
26
- minLength: 12
27
- },
28
- replicaCount: {
29
- greaterThanOrEqual: 1,
30
- lessThanOrEqual: 6
31
- },
32
- version: {
33
- maxLength: 10,
34
- minLength: 1,
35
- pattern: /^v[0-9]+$/
36
- }
37
- };
38
- const CreateUserRequest = {
39
- name: {
40
- maxLength: 63,
41
- minLength: 1,
42
- pattern: /^[a-z][a-zA-Z0-9_\-]*$/
43
- },
44
- password: {
45
- maxLength: 50,
46
- minLength: 12
47
- }
48
- };
49
- const DeleteDatabaseRequest = {
50
- name: {
51
- maxLength: 63,
52
- minLength: 1,
53
- pattern: /^[a-z][a-zA-Z0-9_\-]*$/
54
- }
55
- };
56
- const DeleteUserRequest = {
57
- name: {
58
- maxLength: 63,
59
- minLength: 1,
60
- pattern: /^[a-z][a-zA-Z0-9_\-]*$/
61
- }
62
- };
63
- const Deployment = {
64
- cpuMax: {
65
- greaterThanOrEqual: 1,
66
- lessThanOrEqual: 15
67
- },
68
- cpuMin: {
69
- lessThanOrEqual: 15
70
- },
71
- name: {
72
- maxLength: 63,
73
- minLength: 1
74
- }
75
- };
76
- const ListDatabasesRequest = {
77
- name: {
78
- maxLength: 63,
79
- minLength: 1,
80
- pattern: /^[a-z][a-zA-Z0-9_\-]*$/
81
- },
82
- page: {
83
- greaterThanOrEqual: 1
84
- },
85
- pageSize: {
86
- greaterThanOrEqual: 1,
87
- lessThanOrEqual: 100
88
- }
89
- };
90
- const ListDeploymentsRequest = {
91
- name: {
92
- maxLength: 255,
93
- minLength: 1,
94
- pattern: /^[A-Za-z0-9-_]+$/
95
- },
96
- page: {
97
- greaterThanOrEqual: 1
98
- },
99
- pageSize: {
100
- greaterThanOrEqual: 1,
101
- lessThanOrEqual: 100
102
- }
103
- };
104
- const ListPresetsRequest = {
105
- page: {
106
- greaterThanOrEqual: 1
107
- },
108
- pageSize: {
109
- greaterThanOrEqual: 1,
110
- lessThanOrEqual: 100
111
- }
112
- };
113
- const ListUsersRequest = {
114
- name: {
115
- maxLength: 63,
116
- minLength: 1,
117
- pattern: /^[a-zA-Z0-9_\-]*$/
118
- },
119
- page: {
120
- greaterThanOrEqual: 1
121
- },
122
- pageSize: {
123
- greaterThanOrEqual: 1,
124
- lessThanOrEqual: 100
125
- }
126
- };
127
- const ListVersionsRequest = {
128
- page: {
129
- greaterThanOrEqual: 1
130
- },
131
- pageSize: {
132
- greaterThanOrEqual: 1,
133
- lessThanOrEqual: 100
134
- },
135
- version: {
136
- maxLength: 10,
137
- minLength: 1,
138
- pattern: /^v[0-9]+$/
139
- }
140
- };
141
- const UpdateDeploymentRequest = {
142
- cpuMax: {
143
- greaterThanOrEqual: 1,
144
- lessThanOrEqual: 15
145
- },
146
- cpuMin: {
147
- greaterThanOrEqual: 1,
148
- lessThanOrEqual: 15
149
- },
150
- name: {
151
- maxLength: 255,
152
- minLength: 1,
153
- pattern: /^[A-Za-z0-9-_]+$/
154
- },
155
- replicaCount: {
156
- greaterThanOrEqual: 1,
157
- lessThanOrEqual: 6
158
- }
159
- };
160
- const UpdateUserRequest = {
161
- name: {
162
- maxLength: 63,
163
- minLength: 1,
164
- pattern: /^[a-z][a-zA-Z0-9_\-]*$/
165
- },
166
- password: {
167
- maxLength: 50,
168
- minLength: 12
169
- }
170
- };
171
- exports.CreateDatabaseRequest = CreateDatabaseRequest;
172
- exports.CreateDeploymentRequest = CreateDeploymentRequest;
173
- exports.CreateUserRequest = CreateUserRequest;
174
- exports.DeleteDatabaseRequest = DeleteDatabaseRequest;
175
- exports.DeleteUserRequest = DeleteUserRequest;
176
- exports.Deployment = Deployment;
177
- exports.ListDatabasesRequest = ListDatabasesRequest;
178
- exports.ListDeploymentsRequest = ListDeploymentsRequest;
179
- exports.ListPresetsRequest = ListPresetsRequest;
180
- exports.ListUsersRequest = ListUsersRequest;
181
- exports.ListVersionsRequest = ListVersionsRequest;
182
- exports.UpdateDeploymentRequest = UpdateDeploymentRequest;
183
- exports.UpdateUserRequest = UpdateUserRequest;