@scaleway/sdk 2.50.0 → 2.52.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.
Files changed (91) hide show
  1. package/dist/api/applesilicon/v1alpha1/marshalling.gen.cjs +1 -0
  2. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +1 -0
  3. package/dist/api/applesilicon/v1alpha1/types.gen.d.ts +8 -0
  4. package/dist/api/baremetal/v1/index.gen.d.ts +1 -1
  5. package/dist/api/baremetal/v1/marshalling.gen.cjs +15 -1
  6. package/dist/api/baremetal/v1/marshalling.gen.js +15 -1
  7. package/dist/api/baremetal/v1/types.gen.d.ts +12 -3
  8. package/dist/api/block/v1alpha1/api.gen.cjs +3 -0
  9. package/dist/api/block/v1alpha1/api.gen.js +3 -0
  10. package/dist/api/container/v1beta1/index.gen.d.ts +1 -1
  11. package/dist/api/container/v1beta1/marshalling.gen.cjs +21 -0
  12. package/dist/api/container/v1beta1/marshalling.gen.js +21 -0
  13. package/dist/api/container/v1beta1/types.gen.d.ts +30 -2
  14. package/dist/api/container/v1beta1/validation-rules.gen.cjs +2 -0
  15. package/dist/api/container/v1beta1/validation-rules.gen.d.ts +1 -0
  16. package/dist/api/container/v1beta1/validation-rules.gen.js +2 -0
  17. package/dist/api/edge_services/v1alpha1/api.gen.cjs +27 -2
  18. package/dist/api/edge_services/v1alpha1/api.gen.d.ts +10 -3
  19. package/dist/api/edge_services/v1alpha1/api.gen.js +28 -3
  20. package/dist/api/edge_services/v1alpha1/index.gen.d.ts +1 -1
  21. package/dist/api/edge_services/v1alpha1/marshalling.gen.cjs +31 -0
  22. package/dist/api/edge_services/v1alpha1/marshalling.gen.d.ts +3 -1
  23. package/dist/api/edge_services/v1alpha1/marshalling.gen.js +31 -0
  24. package/dist/api/edge_services/v1alpha1/types.gen.d.ts +47 -9
  25. package/dist/api/iam/v1alpha1/api.gen.cjs +11 -0
  26. package/dist/api/iam/v1alpha1/api.gen.d.ts +2 -1
  27. package/dist/api/iam/v1alpha1/api.gen.js +12 -1
  28. package/dist/api/iam/v1alpha1/index.gen.d.ts +1 -1
  29. package/dist/api/iam/v1alpha1/marshalling.gen.cjs +6 -0
  30. package/dist/api/iam/v1alpha1/marshalling.gen.d.ts +2 -1
  31. package/dist/api/iam/v1alpha1/marshalling.gen.js +6 -0
  32. package/dist/api/iam/v1alpha1/types.gen.d.ts +25 -18
  33. package/dist/api/iam/v1alpha1/validation-rules.gen.cjs +7 -0
  34. package/dist/api/iam/v1alpha1/validation-rules.gen.d.ts +6 -0
  35. package/dist/api/iam/v1alpha1/validation-rules.gen.js +8 -1
  36. package/dist/api/index.gen.d.ts +2 -1
  37. package/dist/api/inference/v1beta1/validation-rules.gen.cjs +1 -1
  38. package/dist/api/inference/v1beta1/validation-rules.gen.js +1 -1
  39. package/dist/api/instance/v1/api.gen.cjs +0 -37
  40. package/dist/api/instance/v1/api.gen.d.ts +1 -21
  41. package/dist/api/instance/v1/api.gen.js +1 -38
  42. package/dist/api/instance/v1/index.gen.d.ts +1 -1
  43. package/dist/api/instance/v1/marshalling.gen.cjs +1 -28
  44. package/dist/api/instance/v1/marshalling.gen.d.ts +1 -3
  45. package/dist/api/instance/v1/marshalling.gen.js +1 -28
  46. package/dist/api/instance/v1/types.gen.d.ts +9 -53
  47. package/dist/api/instance/v1/types.private.gen.d.ts +1 -3
  48. package/dist/api/jobs/v1alpha1/api.gen.cjs +13 -0
  49. package/dist/api/jobs/v1alpha1/api.gen.d.ts +8 -1
  50. package/dist/api/jobs/v1alpha1/api.gen.js +14 -1
  51. package/dist/api/jobs/v1alpha1/index.gen.d.ts +1 -1
  52. package/dist/api/jobs/v1alpha1/marshalling.gen.cjs +11 -0
  53. package/dist/api/jobs/v1alpha1/marshalling.gen.d.ts +2 -1
  54. package/dist/api/jobs/v1alpha1/marshalling.gen.js +11 -0
  55. package/dist/api/jobs/v1alpha1/types.gen.d.ts +10 -0
  56. package/dist/api/jobs/v1alpha1/validation-rules.gen.cjs +2 -2
  57. package/dist/api/jobs/v1alpha1/validation-rules.gen.js +2 -2
  58. package/dist/api/k8s/v1/api.gen.cjs +0 -16
  59. package/dist/api/k8s/v1/api.gen.d.ts +1 -9
  60. package/dist/api/k8s/v1/api.gen.js +0 -16
  61. package/dist/api/k8s/v1/index.gen.d.ts +1 -1
  62. package/dist/api/k8s/v1/types.gen.d.ts +0 -9
  63. package/dist/api/k8s/v1/validation-rules.gen.cjs +8 -16
  64. package/dist/api/k8s/v1/validation-rules.gen.d.ts +0 -8
  65. package/dist/api/k8s/v1/validation-rules.gen.js +8 -16
  66. package/dist/api/mongodb/index.gen.cjs +4 -0
  67. package/dist/api/mongodb/index.gen.d.ts +5 -0
  68. package/dist/api/mongodb/index.gen.js +4 -0
  69. package/dist/api/mongodb/v1alpha1/api.gen.cjs +393 -0
  70. package/dist/api/mongodb/v1alpha1/api.gen.d.ts +203 -0
  71. package/dist/api/mongodb/v1alpha1/api.gen.js +393 -0
  72. package/dist/api/mongodb/v1alpha1/content.gen.cjs +16 -0
  73. package/dist/api/mongodb/v1alpha1/content.gen.d.ts +5 -0
  74. package/dist/api/mongodb/v1alpha1/content.gen.js +16 -0
  75. package/dist/api/mongodb/v1alpha1/index.gen.cjs +9 -0
  76. package/dist/api/mongodb/v1alpha1/index.gen.d.ts +4 -0
  77. package/dist/api/mongodb/v1alpha1/index.gen.js +9 -0
  78. package/dist/api/mongodb/v1alpha1/marshalling.gen.cjs +327 -0
  79. package/dist/api/mongodb/v1alpha1/marshalling.gen.d.ts +19 -0
  80. package/dist/api/mongodb/v1alpha1/marshalling.gen.js +327 -0
  81. package/dist/api/mongodb/v1alpha1/types.gen.d.ts +461 -0
  82. package/dist/api/mongodb/v1alpha1/validation-rules.gen.cjs +147 -0
  83. package/dist/api/mongodb/v1alpha1/validation-rules.gen.d.ts +134 -0
  84. package/dist/api/mongodb/v1alpha1/validation-rules.gen.js +147 -0
  85. package/dist/api/webhosting/v1alpha1/types.gen.d.ts +1 -1
  86. package/dist/index.cjs +16 -14
  87. package/dist/index.js +16 -14
  88. package/dist/scw/constants.cjs +1 -1
  89. package/dist/scw/constants.d.ts +2 -2
  90. package/dist/scw/constants.js +1 -1
  91. package/package.json +2 -2
@@ -0,0 +1,393 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const intervalRetrier = require("../../../internal/async/interval-retrier.cjs");
4
+ const api = require("../../../scw/api.cjs");
5
+ const marshalling = require("../../../helpers/marshalling.cjs");
6
+ require("../../../vendor/base64/index.cjs");
7
+ const resourcePaginator = require("../../../scw/fetch/resource-paginator.cjs");
8
+ const content_gen = require("./content.gen.cjs");
9
+ const marshalling_gen = require("./marshalling.gen.cjs");
10
+ const jsonContentHeaders = {
11
+ "Content-Type": "application/json; charset=utf-8"
12
+ };
13
+ class API extends api.API {
14
+ /** Lists the available regions of the API. */
15
+ static LOCALITIES = ["fr-par", "nl-ams", "pl-waw"];
16
+ pageOfListNodeTypes = (request = {}) => this.client.fetch(
17
+ {
18
+ method: "GET",
19
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/node-types`,
20
+ urlParams: marshalling.urlParams(
21
+ ["include_disabled_types", request.includeDisabledTypes],
22
+ ["page", request.page],
23
+ [
24
+ "page_size",
25
+ request.pageSize ?? this.client.settings.defaultPageSize
26
+ ]
27
+ )
28
+ },
29
+ marshalling_gen.unmarshalListNodeTypesResponse
30
+ );
31
+ /**
32
+ * List available node types.
33
+ *
34
+ * @param request - The request {@link ListNodeTypesRequest}
35
+ * @returns A Promise of ListNodeTypesResponse
36
+ */
37
+ listNodeTypes = (request = {}) => resourcePaginator.enrichForPagination("nodeTypes", this.pageOfListNodeTypes, request);
38
+ pageOfListVersions = (request = {}) => this.client.fetch(
39
+ {
40
+ method: "GET",
41
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions`,
42
+ urlParams: marshalling.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 MongoDB™ versions.
55
+ *
56
+ * @param request - The request {@link ListVersionsRequest}
57
+ * @returns A Promise of ListVersionsResponse
58
+ */
59
+ listVersions = (request = {}) => resourcePaginator.enrichForPagination("versions", this.pageOfListVersions, request);
60
+ pageOfListInstances = (request = {}) => this.client.fetch(
61
+ {
62
+ method: "GET",
63
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances`,
64
+ urlParams: marshalling.urlParams(
65
+ ["name", request.name],
66
+ ["order_by", request.orderBy],
67
+ [
68
+ "organization_id",
69
+ request.organizationId ?? this.client.settings.defaultOrganizationId
70
+ ],
71
+ ["page", request.page],
72
+ [
73
+ "page_size",
74
+ request.pageSize ?? this.client.settings.defaultPageSize
75
+ ],
76
+ [
77
+ "project_id",
78
+ request.projectId ?? this.client.settings.defaultProjectId
79
+ ],
80
+ ["tags", request.tags]
81
+ )
82
+ },
83
+ marshalling_gen.unmarshalListInstancesResponse
84
+ );
85
+ /**
86
+ * List MongoDB™ Database Instances. List all MongoDB™ Database Instances in
87
+ * the specified region, for a given Scaleway Project. By default, the
88
+ * MongoDB™ Database Instances returned in the list are ordered by creation
89
+ * date in ascending order, though this can be modified via the order_by
90
+ * field. You can define additional parameters for your query, such as `tags`
91
+ * and `name`. For the `name` parameter, the value you include will be checked
92
+ * against the whole name string to see if it includes the string you put in
93
+ * the parameter.
94
+ *
95
+ * @param request - The request {@link ListInstancesRequest}
96
+ * @returns A Promise of ListInstancesResponse
97
+ */
98
+ listInstances = (request = {}) => resourcePaginator.enrichForPagination("instances", this.pageOfListInstances, request);
99
+ /**
100
+ * Get a MongoDB™ Database Instance. Retrieve information about a given
101
+ * MongoDB™ Database Instance, specified by the `region` and `instance_id`
102
+ * parameters. Its full details, including name, status, IP address and port,
103
+ * are returned in the response object.
104
+ *
105
+ * @param request - The request {@link GetInstanceRequest}
106
+ * @returns A Promise of Instance
107
+ */
108
+ getInstance = (request) => this.client.fetch(
109
+ {
110
+ method: "GET",
111
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${marshalling.validatePathParam("instanceId", request.instanceId)}`
112
+ },
113
+ marshalling_gen.unmarshalInstance
114
+ );
115
+ /**
116
+ * Waits for {@link Instance} to be in a final state.
117
+ *
118
+ * @param request - The request {@link GetInstanceRequest}
119
+ * @param options - The waiting options
120
+ * @returns A Promise of Instance
121
+ */
122
+ waitForInstance = (request, options) => intervalRetrier.waitForResource(
123
+ options?.stop ?? ((res) => Promise.resolve(!content_gen.INSTANCE_TRANSIENT_STATUSES.includes(res.status))),
124
+ this.getInstance,
125
+ request,
126
+ options
127
+ );
128
+ /**
129
+ * Create a MongoDB™ Database Instance. Create a new MongoDB™ Database
130
+ * Instance.
131
+ *
132
+ * @param request - The request {@link CreateInstanceRequest}
133
+ * @returns A Promise of Instance
134
+ */
135
+ createInstance = (request) => this.client.fetch(
136
+ {
137
+ body: JSON.stringify(
138
+ marshalling_gen.marshalCreateInstanceRequest(request, this.client.settings)
139
+ ),
140
+ headers: jsonContentHeaders,
141
+ method: "POST",
142
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances`
143
+ },
144
+ marshalling_gen.unmarshalInstance
145
+ );
146
+ /**
147
+ * Update a MongoDB™ Database Instance. Update the parameters of a MongoDB™
148
+ * Database Instance.
149
+ *
150
+ * @param request - The request {@link UpdateInstanceRequest}
151
+ * @returns A Promise of Instance
152
+ */
153
+ updateInstance = (request) => this.client.fetch(
154
+ {
155
+ body: JSON.stringify(
156
+ marshalling_gen.marshalUpdateInstanceRequest(request, this.client.settings)
157
+ ),
158
+ headers: jsonContentHeaders,
159
+ method: "PATCH",
160
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${marshalling.validatePathParam("instanceId", request.instanceId)}`
161
+ },
162
+ marshalling_gen.unmarshalInstance
163
+ );
164
+ /**
165
+ * Delete a MongoDB™ Database Instance. Delete a given MongoDB™ Database
166
+ * Instance, specified by the `region` and `instance_id` parameters. Deleting
167
+ * a MongoDB™ Database Instance is permanent, and cannot be undone. Note that
168
+ * upon deletion all your data will be lost.
169
+ *
170
+ * @param request - The request {@link DeleteInstanceRequest}
171
+ * @returns A Promise of Instance
172
+ */
173
+ deleteInstance = (request) => this.client.fetch(
174
+ {
175
+ method: "DELETE",
176
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${marshalling.validatePathParam("instanceId", request.instanceId)}`
177
+ },
178
+ marshalling_gen.unmarshalInstance
179
+ );
180
+ /**
181
+ * Upgrade a Database Instance. Upgrade your current Database Instance
182
+ * specifications like volume size.
183
+ *
184
+ * @param request - The request {@link UpgradeInstanceRequest}
185
+ * @returns A Promise of Instance
186
+ */
187
+ upgradeInstance = (request) => this.client.fetch(
188
+ {
189
+ body: JSON.stringify(
190
+ marshalling_gen.marshalUpgradeInstanceRequest(request, this.client.settings)
191
+ ),
192
+ headers: jsonContentHeaders,
193
+ method: "POST",
194
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${marshalling.validatePathParam("instanceId", request.instanceId)}/upgrade`
195
+ },
196
+ marshalling_gen.unmarshalInstance
197
+ );
198
+ /**
199
+ * Get the certificate of a Database Instance. Retrieve the certificate of a
200
+ * given Database Instance, specified by the `instance_id` parameter.
201
+ *
202
+ * @param request - The request {@link GetInstanceCertificateRequest}
203
+ * @returns A Promise of Blob
204
+ */
205
+ getInstanceCertificate = (request) => this.client.fetch({
206
+ method: "GET",
207
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${marshalling.validatePathParam("instanceId", request.instanceId)}/certificate`,
208
+ urlParams: marshalling.urlParams(["dl", 1]),
209
+ responseType: "blob"
210
+ });
211
+ /**
212
+ * Create a Database Instance snapshot. Create a new snapshot of a Database
213
+ * Instance. You must define the `name` and `instance_id` parameters in the
214
+ * request.
215
+ *
216
+ * @param request - The request {@link CreateSnapshotRequest}
217
+ * @returns A Promise of Snapshot
218
+ */
219
+ createSnapshot = (request) => this.client.fetch(
220
+ {
221
+ body: JSON.stringify(
222
+ marshalling_gen.marshalCreateSnapshotRequest(request, this.client.settings)
223
+ ),
224
+ headers: jsonContentHeaders,
225
+ method: "POST",
226
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${marshalling.validatePathParam("instanceId", request.instanceId)}/snapshots`
227
+ },
228
+ marshalling_gen.unmarshalSnapshot
229
+ );
230
+ /**
231
+ * Get a Database Instance snapshot. Retrieve information about a given
232
+ * snapshot of a Database Instance. You must specify, in the endpoint, the
233
+ * `snapshot_id` parameter of the snapshot you want to retrieve.
234
+ *
235
+ * @param request - The request {@link GetSnapshotRequest}
236
+ * @returns A Promise of Snapshot
237
+ */
238
+ getSnapshot = (request) => this.client.fetch(
239
+ {
240
+ method: "GET",
241
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${marshalling.validatePathParam("snapshotId", request.snapshotId)}`
242
+ },
243
+ marshalling_gen.unmarshalSnapshot
244
+ );
245
+ /**
246
+ * Waits for {@link Snapshot} to be in a final state.
247
+ *
248
+ * @param request - The request {@link GetSnapshotRequest}
249
+ * @param options - The waiting options
250
+ * @returns A Promise of Snapshot
251
+ */
252
+ waitForSnapshot = (request, options) => intervalRetrier.waitForResource(
253
+ options?.stop ?? ((res) => Promise.resolve(!content_gen.SNAPSHOT_TRANSIENT_STATUSES.includes(res.status))),
254
+ this.getSnapshot,
255
+ request,
256
+ options
257
+ );
258
+ /**
259
+ * Update a Database Instance snapshot. Update the parameters of a snapshot of
260
+ * a Database Instance. You can update the `name` and `expires_at`
261
+ * parameters.
262
+ *
263
+ * @param request - The request {@link UpdateSnapshotRequest}
264
+ * @returns A Promise of Snapshot
265
+ */
266
+ updateSnapshot = (request) => this.client.fetch(
267
+ {
268
+ body: JSON.stringify(
269
+ marshalling_gen.marshalUpdateSnapshotRequest(request, this.client.settings)
270
+ ),
271
+ headers: jsonContentHeaders,
272
+ method: "POST",
273
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${marshalling.validatePathParam("snapshotId", request.snapshotId)}`
274
+ },
275
+ marshalling_gen.unmarshalSnapshot
276
+ );
277
+ /**
278
+ * Restore a Database Instance snapshot. Restore a given snapshot of a
279
+ * Database Instance. You must specify, in the endpoint, the `snapshot_id`
280
+ * parameter of the snapshot you want to restore, the `instance_name` of the
281
+ * new Database Instance, `node_type` of the new Database Instance and
282
+ * `node_number` of the new Database Instance.
283
+ *
284
+ * @param request - The request {@link RestoreSnapshotRequest}
285
+ * @returns A Promise of Instance
286
+ */
287
+ restoreSnapshot = (request) => this.client.fetch(
288
+ {
289
+ body: JSON.stringify(
290
+ marshalling_gen.marshalRestoreSnapshotRequest(request, this.client.settings)
291
+ ),
292
+ headers: jsonContentHeaders,
293
+ method: "POST",
294
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${marshalling.validatePathParam("snapshotId", request.snapshotId)}/restore`
295
+ },
296
+ marshalling_gen.unmarshalInstance
297
+ );
298
+ pageOfListSnapshots = (request = {}) => this.client.fetch(
299
+ {
300
+ method: "GET",
301
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots`,
302
+ urlParams: marshalling.urlParams(
303
+ ["instance_id", request.instanceId],
304
+ ["name", request.name],
305
+ ["order_by", request.orderBy],
306
+ [
307
+ "organization_id",
308
+ request.organizationId ?? this.client.settings.defaultOrganizationId
309
+ ],
310
+ ["page", request.page],
311
+ [
312
+ "page_size",
313
+ request.pageSize ?? this.client.settings.defaultPageSize
314
+ ],
315
+ [
316
+ "project_id",
317
+ request.projectId ?? this.client.settings.defaultProjectId
318
+ ]
319
+ )
320
+ },
321
+ marshalling_gen.unmarshalListSnapshotsResponse
322
+ );
323
+ /**
324
+ * List snapshots. List snapshots. You can include the `instance_id` or
325
+ * `project_id` in your query to get the list of snapshots for specific
326
+ * Database Instances and/or Projects. By default, the details returned in the
327
+ * list are ordered by creation date in ascending order, though this can be
328
+ * modified via the `order_by` field.
329
+ *
330
+ * @param request - The request {@link ListSnapshotsRequest}
331
+ * @returns A Promise of ListSnapshotsResponse
332
+ */
333
+ listSnapshots = (request = {}) => resourcePaginator.enrichForPagination("snapshots", this.pageOfListSnapshots, request);
334
+ /**
335
+ * Delete a Database Instance snapshot. Delete a given snapshot of a Database
336
+ * Instance. You must specify, in the endpoint, the `snapshot_id` parameter of
337
+ * the snapshot you want to delete.
338
+ *
339
+ * @param request - The request {@link DeleteSnapshotRequest}
340
+ * @returns A Promise of Snapshot
341
+ */
342
+ deleteSnapshot = (request) => this.client.fetch(
343
+ {
344
+ method: "DELETE",
345
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/snapshots/${marshalling.validatePathParam("snapshotId", request.snapshotId)}`
346
+ },
347
+ marshalling_gen.unmarshalSnapshot
348
+ );
349
+ pageOfListUsers = (request) => this.client.fetch(
350
+ {
351
+ method: "GET",
352
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${marshalling.validatePathParam("instanceId", request.instanceId)}/users`,
353
+ urlParams: marshalling.urlParams(
354
+ ["name", request.name],
355
+ ["order_by", request.orderBy],
356
+ ["page", request.page],
357
+ [
358
+ "page_size",
359
+ request.pageSize ?? this.client.settings.defaultPageSize
360
+ ]
361
+ )
362
+ },
363
+ marshalling_gen.unmarshalListUsersResponse
364
+ );
365
+ /**
366
+ * List users of a Database Instance. List all users of a given Database
367
+ * Instance.
368
+ *
369
+ * @param request - The request {@link ListUsersRequest}
370
+ * @returns A Promise of ListUsersResponse
371
+ */
372
+ listUsers = (request) => resourcePaginator.enrichForPagination("users", this.pageOfListUsers, request);
373
+ /**
374
+ * Update a user on a Database Instance. Update the parameters of a user on a
375
+ * Database Instance. You can update the `password` parameter, but you cannot
376
+ * change the name of the user.
377
+ *
378
+ * @param request - The request {@link UpdateUserRequest}
379
+ * @returns A Promise of User
380
+ */
381
+ updateUser = (request) => this.client.fetch(
382
+ {
383
+ body: JSON.stringify(
384
+ marshalling_gen.marshalUpdateUserRequest(request, this.client.settings)
385
+ ),
386
+ headers: jsonContentHeaders,
387
+ method: "PATCH",
388
+ path: `/mongodb/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/instances/${marshalling.validatePathParam("instanceId", request.instanceId)}/users/${marshalling.validatePathParam("name", request.name)}`
389
+ },
390
+ marshalling_gen.unmarshalUser
391
+ );
392
+ }
393
+ exports.API = API;
@@ -0,0 +1,203 @@
1
+ import { API as ParentAPI } from '../../../bridge';
2
+ import type { Region, WaitForOptions } from '../../../bridge';
3
+ import type { CreateInstanceRequest, CreateSnapshotRequest, DeleteInstanceRequest, DeleteSnapshotRequest, GetInstanceCertificateRequest, GetInstanceRequest, GetSnapshotRequest, Instance, ListInstancesRequest, ListInstancesResponse, ListNodeTypesRequest, ListNodeTypesResponse, ListSnapshotsRequest, ListSnapshotsResponse, ListUsersRequest, ListUsersResponse, ListVersionsRequest, ListVersionsResponse, RestoreSnapshotRequest, Snapshot, UpdateInstanceRequest, UpdateSnapshotRequest, UpdateUserRequest, UpgradeInstanceRequest, User } from './types.gen';
4
+ /**
5
+ * Managed Database for MongoDB.
6
+ *
7
+ * This API allows you to manage your Managed Databases for MongoDB.
8
+ */
9
+ export declare class API extends ParentAPI {
10
+ /** Lists the available regions of the API. */
11
+ static readonly LOCALITIES: Region[];
12
+ protected pageOfListNodeTypes: (request?: Readonly<ListNodeTypesRequest>) => Promise<ListNodeTypesResponse>;
13
+ /**
14
+ * List available node types.
15
+ *
16
+ * @param request - The request {@link ListNodeTypesRequest}
17
+ * @returns A Promise of ListNodeTypesResponse
18
+ */
19
+ listNodeTypes: (request?: Readonly<ListNodeTypesRequest>) => Promise<ListNodeTypesResponse> & {
20
+ all: () => Promise<import("./types.gen").NodeType[]>;
21
+ [Symbol.asyncIterator]: () => AsyncGenerator<import("./types.gen").NodeType[], void, void>;
22
+ };
23
+ protected pageOfListVersions: (request?: Readonly<ListVersionsRequest>) => Promise<ListVersionsResponse>;
24
+ /**
25
+ * List available MongoDB™ versions.
26
+ *
27
+ * @param request - The request {@link ListVersionsRequest}
28
+ * @returns A Promise of ListVersionsResponse
29
+ */
30
+ listVersions: (request?: Readonly<ListVersionsRequest>) => Promise<ListVersionsResponse> & {
31
+ all: () => Promise<import("./types.gen").Version[]>;
32
+ [Symbol.asyncIterator]: () => AsyncGenerator<import("./types.gen").Version[], void, void>;
33
+ };
34
+ protected pageOfListInstances: (request?: Readonly<ListInstancesRequest>) => Promise<ListInstancesResponse>;
35
+ /**
36
+ * List MongoDB™ Database Instances. List all MongoDB™ Database Instances in
37
+ * the specified region, for a given Scaleway Project. By default, the
38
+ * MongoDB™ Database Instances returned in the list are ordered by creation
39
+ * date in ascending order, though this can be modified via the order_by
40
+ * field. You can define additional parameters for your query, such as `tags`
41
+ * and `name`. For the `name` parameter, the value you include will be checked
42
+ * against the whole name string to see if it includes the string you put in
43
+ * the parameter.
44
+ *
45
+ * @param request - The request {@link ListInstancesRequest}
46
+ * @returns A Promise of ListInstancesResponse
47
+ */
48
+ listInstances: (request?: Readonly<ListInstancesRequest>) => Promise<ListInstancesResponse> & {
49
+ all: () => Promise<Instance[]>;
50
+ [Symbol.asyncIterator]: () => AsyncGenerator<Instance[], void, void>;
51
+ };
52
+ /**
53
+ * Get a MongoDB™ Database Instance. Retrieve information about a given
54
+ * MongoDB™ Database Instance, specified by the `region` and `instance_id`
55
+ * parameters. Its full details, including name, status, IP address and port,
56
+ * are returned in the response object.
57
+ *
58
+ * @param request - The request {@link GetInstanceRequest}
59
+ * @returns A Promise of Instance
60
+ */
61
+ getInstance: (request: Readonly<GetInstanceRequest>) => Promise<Instance>;
62
+ /**
63
+ * Waits for {@link Instance} to be in a final state.
64
+ *
65
+ * @param request - The request {@link GetInstanceRequest}
66
+ * @param options - The waiting options
67
+ * @returns A Promise of Instance
68
+ */
69
+ waitForInstance: (request: Readonly<GetInstanceRequest>, options?: Readonly<WaitForOptions<Instance>>) => Promise<Instance>;
70
+ /**
71
+ * Create a MongoDB™ Database Instance. Create a new MongoDB™ Database
72
+ * Instance.
73
+ *
74
+ * @param request - The request {@link CreateInstanceRequest}
75
+ * @returns A Promise of Instance
76
+ */
77
+ createInstance: (request: Readonly<CreateInstanceRequest>) => Promise<Instance>;
78
+ /**
79
+ * Update a MongoDB™ Database Instance. Update the parameters of a MongoDB™
80
+ * Database Instance.
81
+ *
82
+ * @param request - The request {@link UpdateInstanceRequest}
83
+ * @returns A Promise of Instance
84
+ */
85
+ updateInstance: (request: Readonly<UpdateInstanceRequest>) => Promise<Instance>;
86
+ /**
87
+ * Delete a MongoDB™ Database Instance. Delete a given MongoDB™ Database
88
+ * Instance, specified by the `region` and `instance_id` parameters. Deleting
89
+ * a MongoDB™ Database Instance is permanent, and cannot be undone. Note that
90
+ * upon deletion all your data will be lost.
91
+ *
92
+ * @param request - The request {@link DeleteInstanceRequest}
93
+ * @returns A Promise of Instance
94
+ */
95
+ deleteInstance: (request: Readonly<DeleteInstanceRequest>) => Promise<Instance>;
96
+ /**
97
+ * Upgrade a Database Instance. Upgrade your current Database Instance
98
+ * specifications like volume size.
99
+ *
100
+ * @param request - The request {@link UpgradeInstanceRequest}
101
+ * @returns A Promise of Instance
102
+ */
103
+ upgradeInstance: (request: Readonly<UpgradeInstanceRequest>) => Promise<Instance>;
104
+ /**
105
+ * Get the certificate of a Database Instance. Retrieve the certificate of a
106
+ * given Database Instance, specified by the `instance_id` parameter.
107
+ *
108
+ * @param request - The request {@link GetInstanceCertificateRequest}
109
+ * @returns A Promise of Blob
110
+ */
111
+ getInstanceCertificate: (request: Readonly<GetInstanceCertificateRequest>) => Promise<Blob>;
112
+ /**
113
+ * Create a Database Instance snapshot. Create a new snapshot of a Database
114
+ * Instance. You must define the `name` and `instance_id` parameters in the
115
+ * request.
116
+ *
117
+ * @param request - The request {@link CreateSnapshotRequest}
118
+ * @returns A Promise of Snapshot
119
+ */
120
+ createSnapshot: (request: Readonly<CreateSnapshotRequest>) => Promise<Snapshot>;
121
+ /**
122
+ * Get a Database Instance snapshot. Retrieve information about a given
123
+ * snapshot of a Database Instance. You must specify, in the endpoint, the
124
+ * `snapshot_id` parameter of the snapshot you want to retrieve.
125
+ *
126
+ * @param request - The request {@link GetSnapshotRequest}
127
+ * @returns A Promise of Snapshot
128
+ */
129
+ getSnapshot: (request: Readonly<GetSnapshotRequest>) => Promise<Snapshot>;
130
+ /**
131
+ * Waits for {@link Snapshot} to be in a final state.
132
+ *
133
+ * @param request - The request {@link GetSnapshotRequest}
134
+ * @param options - The waiting options
135
+ * @returns A Promise of Snapshot
136
+ */
137
+ waitForSnapshot: (request: Readonly<GetSnapshotRequest>, options?: Readonly<WaitForOptions<Snapshot>>) => Promise<Snapshot>;
138
+ /**
139
+ * Update a Database Instance snapshot. Update the parameters of a snapshot of
140
+ * a Database Instance. You can update the `name` and `expires_at`
141
+ * parameters.
142
+ *
143
+ * @param request - The request {@link UpdateSnapshotRequest}
144
+ * @returns A Promise of Snapshot
145
+ */
146
+ updateSnapshot: (request: Readonly<UpdateSnapshotRequest>) => Promise<Snapshot>;
147
+ /**
148
+ * Restore a Database Instance snapshot. Restore a given snapshot of a
149
+ * Database Instance. You must specify, in the endpoint, the `snapshot_id`
150
+ * parameter of the snapshot you want to restore, the `instance_name` of the
151
+ * new Database Instance, `node_type` of the new Database Instance and
152
+ * `node_number` of the new Database Instance.
153
+ *
154
+ * @param request - The request {@link RestoreSnapshotRequest}
155
+ * @returns A Promise of Instance
156
+ */
157
+ restoreSnapshot: (request: Readonly<RestoreSnapshotRequest>) => Promise<Instance>;
158
+ protected pageOfListSnapshots: (request?: Readonly<ListSnapshotsRequest>) => Promise<ListSnapshotsResponse>;
159
+ /**
160
+ * List snapshots. List snapshots. You can include the `instance_id` or
161
+ * `project_id` in your query to get the list of snapshots for specific
162
+ * Database Instances and/or Projects. By default, the details returned in the
163
+ * list are ordered by creation date in ascending order, though this can be
164
+ * modified via the `order_by` field.
165
+ *
166
+ * @param request - The request {@link ListSnapshotsRequest}
167
+ * @returns A Promise of ListSnapshotsResponse
168
+ */
169
+ listSnapshots: (request?: Readonly<ListSnapshotsRequest>) => Promise<ListSnapshotsResponse> & {
170
+ all: () => Promise<Snapshot[]>;
171
+ [Symbol.asyncIterator]: () => AsyncGenerator<Snapshot[], void, void>;
172
+ };
173
+ /**
174
+ * Delete a Database Instance snapshot. Delete a given snapshot of a Database
175
+ * Instance. You must specify, in the endpoint, the `snapshot_id` parameter of
176
+ * the snapshot you want to delete.
177
+ *
178
+ * @param request - The request {@link DeleteSnapshotRequest}
179
+ * @returns A Promise of Snapshot
180
+ */
181
+ deleteSnapshot: (request: Readonly<DeleteSnapshotRequest>) => Promise<Snapshot>;
182
+ protected pageOfListUsers: (request: Readonly<ListUsersRequest>) => Promise<ListUsersResponse>;
183
+ /**
184
+ * List users of a Database Instance. List all users of a given Database
185
+ * Instance.
186
+ *
187
+ * @param request - The request {@link ListUsersRequest}
188
+ * @returns A Promise of ListUsersResponse
189
+ */
190
+ listUsers: (request: Readonly<ListUsersRequest>) => Promise<ListUsersResponse> & {
191
+ all: () => Promise<User[]>;
192
+ [Symbol.asyncIterator]: () => AsyncGenerator<User[], void, void>;
193
+ };
194
+ /**
195
+ * Update a user on a Database Instance. Update the parameters of a user on a
196
+ * Database Instance. You can update the `password` parameter, but you cannot
197
+ * change the name of the user.
198
+ *
199
+ * @param request - The request {@link UpdateUserRequest}
200
+ * @returns A Promise of User
201
+ */
202
+ updateUser: (request: Readonly<UpdateUserRequest>) => Promise<User>;
203
+ }