@scaleway/sdk-mongodb 1.3.0 → 2.1.1

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.
@@ -1,421 +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
- pageOfListNodeTypes = (request = {}) => this.client.fetch(
18
- {
19
- method: "GET",
20
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/node-types`,
21
- urlParams: sdkClient.urlParams(
22
- ["include_disabled_types", request.includeDisabledTypes],
23
- ["page", request.page],
24
- [
25
- "page_size",
26
- request.pageSize ?? this.client.settings.defaultPageSize
27
- ]
28
- )
29
- },
30
- marshalling_gen.unmarshalListNodeTypesResponse
31
- );
32
- /**
33
- * List available node types.
34
- *
35
- * @param request - The request {@link ListNodeTypesRequest}
36
- * @returns A Promise of ListNodeTypesResponse
37
- */
38
- listNodeTypes = (request = {}) => sdkClient.enrichForPagination("nodeTypes", this.pageOfListNodeTypes, request);
39
- pageOfListVersions = (request = {}) => this.client.fetch(
40
- {
41
- method: "GET",
42
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions`,
43
- urlParams: sdkClient.urlParams(
44
- ["page", request.page],
45
- [
46
- "page_size",
47
- request.pageSize ?? this.client.settings.defaultPageSize
48
- ],
49
- ["version", request.version]
50
- )
51
- },
52
- marshalling_gen.unmarshalListVersionsResponse
53
- );
54
- /**
55
- * List available MongoDB® versions.
56
- *
57
- * @param request - The request {@link ListVersionsRequest}
58
- * @returns A Promise of ListVersionsResponse
59
- */
60
- listVersions = (request = {}) => sdkClient.enrichForPagination("versions", this.pageOfListVersions, request);
61
- pageOfListInstances = (request = {}) => this.client.fetch(
62
- {
63
- method: "GET",
64
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances`,
65
- urlParams: sdkClient.urlParams(
66
- ["name", request.name],
67
- ["order_by", request.orderBy],
68
- ["organization_id", request.organizationId],
69
- ["page", request.page],
70
- [
71
- "page_size",
72
- request.pageSize ?? this.client.settings.defaultPageSize
73
- ],
74
- ["project_id", request.projectId],
75
- ["tags", request.tags]
76
- )
77
- },
78
- marshalling_gen.unmarshalListInstancesResponse
79
- );
80
- /**
81
- * 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.
82
- *
83
- * @param request - The request {@link ListInstancesRequest}
84
- * @returns A Promise of ListInstancesResponse
85
- */
86
- listInstances = (request = {}) => sdkClient.enrichForPagination("instances", this.pageOfListInstances, request);
87
- /**
88
- * 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.
89
- *
90
- * @param request - The request {@link GetInstanceRequest}
91
- * @returns A Promise of Instance
92
- */
93
- getInstance = (request) => this.client.fetch(
94
- {
95
- method: "GET",
96
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}`
97
- },
98
- marshalling_gen.unmarshalInstance
99
- );
100
- /**
101
- * Waits for {@link Instance} to be in a final state.
102
- *
103
- * @param request - The request {@link GetInstanceRequest}
104
- * @param options - The waiting options
105
- * @returns A Promise of Instance
106
- */
107
- waitForInstance = (request, options) => sdkClient.waitForResource(
108
- options?.stop ?? ((res) => Promise.resolve(
109
- !content_gen.INSTANCE_TRANSIENT_STATUSES.includes(res.status)
110
- )),
111
- this.getInstance,
112
- request,
113
- options
114
- );
115
- /**
116
- * Create a MongoDB® Database Instance. Create a new MongoDB® Database Instance.
117
- *
118
- * @param request - The request {@link CreateInstanceRequest}
119
- * @returns A Promise of Instance
120
- */
121
- createInstance = (request) => this.client.fetch(
122
- {
123
- body: JSON.stringify(
124
- marshalling_gen.marshalCreateInstanceRequest(request, this.client.settings)
125
- ),
126
- headers: jsonContentHeaders,
127
- method: "POST",
128
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances`
129
- },
130
- marshalling_gen.unmarshalInstance
131
- );
132
- /**
133
- * Update a MongoDB® Database Instance. Update the parameters of a MongoDB® Database Instance.
134
- *
135
- * @param request - The request {@link UpdateInstanceRequest}
136
- * @returns A Promise of Instance
137
- */
138
- updateInstance = (request) => this.client.fetch(
139
- {
140
- body: JSON.stringify(
141
- marshalling_gen.marshalUpdateInstanceRequest(request, this.client.settings)
142
- ),
143
- headers: jsonContentHeaders,
144
- method: "PATCH",
145
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}`
146
- },
147
- marshalling_gen.unmarshalInstance
148
- );
149
- /**
150
- * 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.
151
- *
152
- * @param request - The request {@link DeleteInstanceRequest}
153
- * @returns A Promise of Instance
154
- */
155
- deleteInstance = (request) => this.client.fetch(
156
- {
157
- method: "DELETE",
158
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}`
159
- },
160
- marshalling_gen.unmarshalInstance
161
- );
162
- /**
163
- * Upgrade a Database Instance. Upgrade your current Database Instance specifications like volume size.
164
- *
165
- * @param request - The request {@link UpgradeInstanceRequest}
166
- * @returns A Promise of Instance
167
- */
168
- upgradeInstance = (request) => this.client.fetch(
169
- {
170
- body: JSON.stringify(
171
- marshalling_gen.marshalUpgradeInstanceRequest(request, this.client.settings)
172
- ),
173
- headers: jsonContentHeaders,
174
- method: "POST",
175
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}/upgrade`
176
- },
177
- marshalling_gen.unmarshalInstance
178
- );
179
- /**
180
- * Get the certificate of a Database Instance. Retrieve the certificate of a given Database Instance, specified by the `instance_id` parameter.
181
- *
182
- * @param request - The request {@link GetInstanceCertificateRequest}
183
- * @returns A Promise of Blob
184
- */
185
- getInstanceCertificate = (request) => this.client.fetch({
186
- method: "GET",
187
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}/certificate`,
188
- urlParams: sdkClient.urlParams(["dl", 1]),
189
- responseType: "blob"
190
- });
191
- /**
192
- * 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.
193
- *
194
- * @param request - The request {@link CreateSnapshotRequest}
195
- * @returns A Promise of Snapshot
196
- */
197
- createSnapshot = (request) => this.client.fetch(
198
- {
199
- body: JSON.stringify(
200
- marshalling_gen.marshalCreateSnapshotRequest(request, this.client.settings)
201
- ),
202
- headers: jsonContentHeaders,
203
- method: "POST",
204
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}/snapshots`
205
- },
206
- marshalling_gen.unmarshalSnapshot
207
- );
208
- /**
209
- * 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.
210
- *
211
- * @param request - The request {@link GetSnapshotRequest}
212
- * @returns A Promise of Snapshot
213
- */
214
- getSnapshot = (request) => this.client.fetch(
215
- {
216
- method: "GET",
217
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}`
218
- },
219
- marshalling_gen.unmarshalSnapshot
220
- );
221
- /**
222
- * Waits for {@link Snapshot} to be in a final state.
223
- *
224
- * @param request - The request {@link GetSnapshotRequest}
225
- * @param options - The waiting options
226
- * @returns A Promise of Snapshot
227
- */
228
- waitForSnapshot = (request, options) => sdkClient.waitForResource(
229
- options?.stop ?? ((res) => Promise.resolve(
230
- !content_gen.SNAPSHOT_TRANSIENT_STATUSES.includes(res.status)
231
- )),
232
- this.getSnapshot,
233
- request,
234
- options
235
- );
236
- /**
237
- * Update a Database Instance snapshot. Update the parameters of a snapshot of a Database Instance. You can update the `name` and `expires_at` parameters.
238
- *
239
- * @param request - The request {@link UpdateSnapshotRequest}
240
- * @returns A Promise of Snapshot
241
- */
242
- updateSnapshot = (request) => this.client.fetch(
243
- {
244
- body: JSON.stringify(
245
- marshalling_gen.marshalUpdateSnapshotRequest(request, this.client.settings)
246
- ),
247
- headers: jsonContentHeaders,
248
- method: "POST",
249
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}`
250
- },
251
- marshalling_gen.unmarshalSnapshot
252
- );
253
- /**
254
- * 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_number` of the new Database Instance.
255
- *
256
- * @param request - The request {@link RestoreSnapshotRequest}
257
- * @returns A Promise of Instance
258
- */
259
- restoreSnapshot = (request) => this.client.fetch(
260
- {
261
- body: JSON.stringify(
262
- marshalling_gen.marshalRestoreSnapshotRequest(request, this.client.settings)
263
- ),
264
- headers: jsonContentHeaders,
265
- method: "POST",
266
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}/restore`
267
- },
268
- marshalling_gen.unmarshalInstance
269
- );
270
- pageOfListSnapshots = (request = {}) => this.client.fetch(
271
- {
272
- method: "GET",
273
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots`,
274
- urlParams: sdkClient.urlParams(
275
- ["instance_id", request.instanceId],
276
- ["name", request.name],
277
- ["order_by", request.orderBy],
278
- ["organization_id", request.organizationId],
279
- ["page", request.page],
280
- [
281
- "page_size",
282
- request.pageSize ?? this.client.settings.defaultPageSize
283
- ],
284
- ["project_id", request.projectId]
285
- )
286
- },
287
- marshalling_gen.unmarshalListSnapshotsResponse
288
- );
289
- /**
290
- * 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.
291
- *
292
- * @param request - The request {@link ListSnapshotsRequest}
293
- * @returns A Promise of ListSnapshotsResponse
294
- */
295
- listSnapshots = (request = {}) => sdkClient.enrichForPagination("snapshots", this.pageOfListSnapshots, request);
296
- /**
297
- * 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.
298
- *
299
- * @param request - The request {@link DeleteSnapshotRequest}
300
- * @returns A Promise of Snapshot
301
- */
302
- deleteSnapshot = (request) => this.client.fetch(
303
- {
304
- method: "DELETE",
305
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${sdkClient.validatePathParam("snapshotId", request.snapshotId)}`
306
- },
307
- marshalling_gen.unmarshalSnapshot
308
- );
309
- pageOfListUsers = (request) => this.client.fetch(
310
- {
311
- method: "GET",
312
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}/users`,
313
- urlParams: sdkClient.urlParams(
314
- ["name", request.name],
315
- ["order_by", request.orderBy],
316
- ["page", request.page],
317
- [
318
- "page_size",
319
- request.pageSize ?? this.client.settings.defaultPageSize
320
- ]
321
- )
322
- },
323
- marshalling_gen.unmarshalListUsersResponse
324
- );
325
- /**
326
- * List users of a Database Instance. List all users of a given Database Instance.
327
- *
328
- * @param request - The request {@link ListUsersRequest}
329
- * @returns A Promise of ListUsersResponse
330
- */
331
- listUsers = (request) => sdkClient.enrichForPagination("users", this.pageOfListUsers, request);
332
- /**
333
- * 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.
334
- *
335
- * @param request - The request {@link CreateUserRequest}
336
- * @returns A Promise of User
337
- */
338
- createUser = (request) => this.client.fetch(
339
- {
340
- body: JSON.stringify(
341
- marshalling_gen.marshalCreateUserRequest(request, this.client.settings)
342
- ),
343
- headers: jsonContentHeaders,
344
- method: "POST",
345
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}/users`
346
- },
347
- marshalling_gen.unmarshalUser
348
- );
349
- /**
350
- * 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.
351
- *
352
- * @param request - The request {@link UpdateUserRequest}
353
- * @returns A Promise of User
354
- */
355
- updateUser = (request) => this.client.fetch(
356
- {
357
- body: JSON.stringify(
358
- marshalling_gen.marshalUpdateUserRequest(request, this.client.settings)
359
- ),
360
- headers: jsonContentHeaders,
361
- method: "PATCH",
362
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}/users/${sdkClient.validatePathParam("name", request.name)}`
363
- },
364
- marshalling_gen.unmarshalUser
365
- );
366
- /**
367
- * Delete a user on a Database Instance. Delete an existing user on a Database Instance.
368
- *
369
- * @param request - The request {@link DeleteUserRequest}
370
- */
371
- deleteUser = (request) => this.client.fetch({
372
- body: "{}",
373
- headers: jsonContentHeaders,
374
- method: "DELETE",
375
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}/users/${sdkClient.validatePathParam("name", request.name)}`
376
- });
377
- /**
378
- * Apply user roles. Apply preset roles for a user in a Database Instance.
379
- *
380
- * @param request - The request {@link SetUserRoleRequest}
381
- * @returns A Promise of User
382
- */
383
- setUserRole = (request) => this.client.fetch(
384
- {
385
- body: JSON.stringify(
386
- marshalling_gen.marshalSetUserRoleRequest(request, this.client.settings)
387
- ),
388
- headers: jsonContentHeaders,
389
- method: "PUT",
390
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${sdkClient.validatePathParam("instanceId", request.instanceId)}/roles`
391
- },
392
- marshalling_gen.unmarshalUser
393
- );
394
- /**
395
- * 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.
396
- *
397
- * @param request - The request {@link DeleteEndpointRequest}
398
- */
399
- deleteEndpoint = (request) => this.client.fetch({
400
- method: "DELETE",
401
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${sdkClient.validatePathParam("endpointId", request.endpointId)}`
402
- });
403
- /**
404
- * 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.
405
- *
406
- * @param request - The request {@link CreateEndpointRequest}
407
- * @returns A Promise of Endpoint
408
- */
409
- createEndpoint = (request) => this.client.fetch(
410
- {
411
- body: JSON.stringify(
412
- marshalling_gen.marshalCreateEndpointRequest(request, this.client.settings)
413
- ),
414
- headers: jsonContentHeaders,
415
- method: "POST",
416
- path: `/mongodb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints`
417
- },
418
- marshalling_gen.unmarshalEndpoint
419
- );
420
- }
421
- exports.API = API;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const INSTANCE_TRANSIENT_STATUSES = [
4
- "provisioning",
5
- "configuring",
6
- "deleting",
7
- "initializing",
8
- "snapshotting"
9
- ];
10
- const SNAPSHOT_TRANSIENT_STATUSES = [
11
- "creating",
12
- "restoring",
13
- "deleting"
14
- ];
15
- exports.INSTANCE_TRANSIENT_STATUSES = INSTANCE_TRANSIENT_STATUSES;
16
- exports.SNAPSHOT_TRANSIENT_STATUSES = SNAPSHOT_TRANSIENT_STATUSES;
@@ -1,31 +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.INSTANCE_TRANSIENT_STATUSES = content_gen.INSTANCE_TRANSIENT_STATUSES;
9
- exports.SNAPSHOT_TRANSIENT_STATUSES = content_gen.SNAPSHOT_TRANSIENT_STATUSES;
10
- exports.marshalCreateEndpointRequest = marshalling_gen.marshalCreateEndpointRequest;
11
- exports.marshalCreateInstanceRequest = marshalling_gen.marshalCreateInstanceRequest;
12
- exports.marshalCreateSnapshotRequest = marshalling_gen.marshalCreateSnapshotRequest;
13
- exports.marshalCreateUserRequest = marshalling_gen.marshalCreateUserRequest;
14
- exports.marshalRestoreSnapshotRequest = marshalling_gen.marshalRestoreSnapshotRequest;
15
- exports.marshalSetUserRoleRequest = marshalling_gen.marshalSetUserRoleRequest;
16
- exports.marshalUpdateInstanceRequest = marshalling_gen.marshalUpdateInstanceRequest;
17
- exports.marshalUpdateSnapshotRequest = marshalling_gen.marshalUpdateSnapshotRequest;
18
- exports.marshalUpdateUserRequest = marshalling_gen.marshalUpdateUserRequest;
19
- exports.marshalUpgradeInstanceRequest = marshalling_gen.marshalUpgradeInstanceRequest;
20
- exports.unmarshalEndpoint = marshalling_gen.unmarshalEndpoint;
21
- exports.unmarshalInstance = marshalling_gen.unmarshalInstance;
22
- exports.unmarshalInstanceSetting = marshalling_gen.unmarshalInstanceSetting;
23
- exports.unmarshalListInstancesResponse = marshalling_gen.unmarshalListInstancesResponse;
24
- exports.unmarshalListNodeTypesResponse = marshalling_gen.unmarshalListNodeTypesResponse;
25
- exports.unmarshalListSnapshotsResponse = marshalling_gen.unmarshalListSnapshotsResponse;
26
- exports.unmarshalListUsersResponse = marshalling_gen.unmarshalListUsersResponse;
27
- exports.unmarshalListVersionsResponse = marshalling_gen.unmarshalListVersionsResponse;
28
- exports.unmarshalSnapshot = marshalling_gen.unmarshalSnapshot;
29
- exports.unmarshalUser = marshalling_gen.unmarshalUser;
30
- exports.unmarshalVolume = marshalling_gen.unmarshalVolume;
31
- exports.ValidationRules = validationRules_gen;