@scaleway/sdk-mongodb 2.7.0 → 2.8.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.
@@ -1,15 +1,15 @@
1
1
  import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
2
2
  import randomName from "@scaleway/random-name";
3
3
  //#region src/v1/marshalling.gen.ts
4
- var unmarshalEndpointPrivateNetworkDetails = (data) => {
4
+ const unmarshalEndpointPrivateNetworkDetails = (data) => {
5
5
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`);
6
6
  return { privateNetworkId: data.private_network_id };
7
7
  };
8
- var unmarshalEndpointPublicNetworkDetails = (data) => {
8
+ const unmarshalEndpointPublicNetworkDetails = (data) => {
9
9
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EndpointPublicNetworkDetails' failed as data isn't a dictionary.`);
10
10
  return {};
11
11
  };
12
- var unmarshalEndpoint = (data) => {
12
+ const unmarshalEndpoint = (data) => {
13
13
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`);
14
14
  return {
15
15
  dnsRecord: data.dns_record,
@@ -19,14 +19,14 @@ var unmarshalEndpoint = (data) => {
19
19
  publicNetwork: data.public_network ? unmarshalEndpointPublicNetworkDetails(data.public_network) : void 0
20
20
  };
21
21
  };
22
- var unmarshalInstanceSetting = (data) => {
22
+ const unmarshalInstanceSetting = (data) => {
23
23
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InstanceSetting' failed as data isn't a dictionary.`);
24
24
  return {
25
25
  name: data.name,
26
26
  value: data.value
27
27
  };
28
28
  };
29
- var unmarshalInstanceSnapshotSchedule = (data) => {
29
+ const unmarshalInstanceSnapshotSchedule = (data) => {
30
30
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InstanceSnapshotSchedule' failed as data isn't a dictionary.`);
31
31
  return {
32
32
  enabled: data.enabled,
@@ -36,14 +36,14 @@ var unmarshalInstanceSnapshotSchedule = (data) => {
36
36
  retentionDays: data.retention_days
37
37
  };
38
38
  };
39
- var unmarshalVolume = (data) => {
39
+ const unmarshalVolume = (data) => {
40
40
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
41
41
  return {
42
42
  sizeBytes: data.size_bytes,
43
43
  type: data.type
44
44
  };
45
45
  };
46
- var unmarshalInstance = (data) => {
46
+ const unmarshalInstance = (data) => {
47
47
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Instance' failed as data isn't a dictionary.`);
48
48
  return {
49
49
  createdAt: unmarshalDate(data.created_at),
@@ -63,22 +63,22 @@ var unmarshalInstance = (data) => {
63
63
  volume: data.volume ? unmarshalVolume(data.volume) : void 0
64
64
  };
65
65
  };
66
- var unmarshalEngineUpgrade = (data) => {
66
+ const unmarshalEngineUpgrade = (data) => {
67
67
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EngineUpgrade' failed as data isn't a dictionary.`);
68
68
  return { newVersionId: data.new_version_id };
69
69
  };
70
- var unmarshalServiceUpdate = (data) => {
70
+ const unmarshalServiceUpdate = (data) => {
71
71
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ServiceUpdate' failed as data isn't a dictionary.`);
72
72
  return { serviceName: data.service_name };
73
73
  };
74
- var unmarshalWorkflow = (data) => {
74
+ const unmarshalWorkflow = (data) => {
75
75
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Workflow' failed as data isn't a dictionary.`);
76
76
  return {
77
77
  engineUpgrade: data.engine_upgrade ? unmarshalEngineUpgrade(data.engine_upgrade) : void 0,
78
78
  serviceUpdate: data.service_update ? unmarshalServiceUpdate(data.service_update) : void 0
79
79
  };
80
80
  };
81
- var unmarshalMaintenance = (data) => {
81
+ const unmarshalMaintenance = (data) => {
82
82
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Maintenance' failed as data isn't a dictionary.`);
83
83
  return {
84
84
  appliedAt: unmarshalDate(data.applied_at),
@@ -94,7 +94,7 @@ var unmarshalMaintenance = (data) => {
94
94
  workflow: data.workflow ? unmarshalWorkflow(data.workflow) : void 0
95
95
  };
96
96
  };
97
- var unmarshalSnapshot = (data) => {
97
+ const unmarshalSnapshot = (data) => {
98
98
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`);
99
99
  return {
100
100
  createdAt: unmarshalDate(data.created_at),
@@ -111,7 +111,7 @@ var unmarshalSnapshot = (data) => {
111
111
  volumeType: data.volume_type
112
112
  };
113
113
  };
114
- var unmarshalUserRole = (data) => {
114
+ const unmarshalUserRole = (data) => {
115
115
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'UserRole' failed as data isn't a dictionary.`);
116
116
  return {
117
117
  anyDatabase: data.any_database,
@@ -119,39 +119,39 @@ var unmarshalUserRole = (data) => {
119
119
  role: data.role
120
120
  };
121
121
  };
122
- var unmarshalUser = (data) => {
122
+ const unmarshalUser = (data) => {
123
123
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'User' failed as data isn't a dictionary.`);
124
124
  return {
125
125
  name: data.name,
126
126
  roles: unmarshalArrayOfObject(data.roles, unmarshalUserRole)
127
127
  };
128
128
  };
129
- var unmarshalDatabase = (data) => {
129
+ const unmarshalDatabase = (data) => {
130
130
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Database' failed as data isn't a dictionary.`);
131
131
  return { name: data.name };
132
132
  };
133
- var unmarshalListDatabasesResponse = (data) => {
133
+ const unmarshalListDatabasesResponse = (data) => {
134
134
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDatabasesResponse' failed as data isn't a dictionary.`);
135
135
  return {
136
136
  databases: unmarshalArrayOfObject(data.databases, unmarshalDatabase),
137
137
  totalCount: data.total_count
138
138
  };
139
139
  };
140
- var unmarshalListInstancesResponse = (data) => {
140
+ const unmarshalListInstancesResponse = (data) => {
141
141
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`);
142
142
  return {
143
143
  instances: unmarshalArrayOfObject(data.instances, unmarshalInstance),
144
144
  totalCount: data.total_count
145
145
  };
146
146
  };
147
- var unmarshalListMaintenancesResponse = (data) => {
147
+ const unmarshalListMaintenancesResponse = (data) => {
148
148
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListMaintenancesResponse' failed as data isn't a dictionary.`);
149
149
  return {
150
150
  maintenances: unmarshalArrayOfObject(data.maintenances, unmarshalMaintenance),
151
151
  totalCount: data.total_count
152
152
  };
153
153
  };
154
- var unmarshalNodeTypeVolumeType = (data) => {
154
+ const unmarshalNodeTypeVolumeType = (data) => {
155
155
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`);
156
156
  return {
157
157
  chunkSizeBytes: data.chunk_size_bytes,
@@ -161,7 +161,7 @@ var unmarshalNodeTypeVolumeType = (data) => {
161
161
  type: data.type
162
162
  };
163
163
  };
164
- var unmarshalNodeType = (data) => {
164
+ const unmarshalNodeType = (data) => {
165
165
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`);
166
166
  return {
167
167
  availableVolumeTypes: unmarshalArrayOfObject(data.available_volume_types, unmarshalNodeTypeVolumeType),
@@ -175,59 +175,59 @@ var unmarshalNodeType = (data) => {
175
175
  vcpus: data.vcpus
176
176
  };
177
177
  };
178
- var unmarshalListNodeTypesResponse = (data) => {
178
+ const unmarshalListNodeTypesResponse = (data) => {
179
179
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`);
180
180
  return {
181
181
  nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
182
182
  totalCount: data.total_count
183
183
  };
184
184
  };
185
- var unmarshalListSnapshotsResponse = (data) => {
185
+ const unmarshalListSnapshotsResponse = (data) => {
186
186
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
187
187
  return {
188
188
  snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
189
189
  totalCount: data.total_count
190
190
  };
191
191
  };
192
- var unmarshalListUsersResponse = (data) => {
192
+ const unmarshalListUsersResponse = (data) => {
193
193
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`);
194
194
  return {
195
195
  totalCount: data.total_count,
196
196
  users: unmarshalArrayOfObject(data.users, unmarshalUser)
197
197
  };
198
198
  };
199
- var unmarshalVersion = (data) => {
199
+ const unmarshalVersion = (data) => {
200
200
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Version' failed as data isn't a dictionary.`);
201
201
  return {
202
202
  endOfLifeAt: unmarshalDate(data.end_of_life_at),
203
203
  version: data.version
204
204
  };
205
205
  };
206
- var unmarshalListVersionsResponse = (data) => {
206
+ const unmarshalListVersionsResponse = (data) => {
207
207
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`);
208
208
  return {
209
209
  totalCount: data.total_count,
210
210
  versions: unmarshalArrayOfObject(data.versions, unmarshalVersion)
211
211
  };
212
212
  };
213
- var marshalEndpointSpecPrivateNetworkDetails = (request, defaults) => ({ private_network_id: request.privateNetworkId });
214
- var marshalEndpointSpecPublicNetworkDetails = (request, defaults) => ({});
215
- var marshalEndpointSpec = (request, defaults) => ({ ...resolveOneOf([{
213
+ const marshalEndpointSpecPrivateNetworkDetails = (request, defaults) => ({ private_network_id: request.privateNetworkId });
214
+ const marshalEndpointSpecPublicNetworkDetails = (request, defaults) => ({});
215
+ const marshalEndpointSpec = (request, defaults) => ({ ...resolveOneOf([{
216
216
  param: "public_network",
217
217
  value: request.publicNetwork !== void 0 ? marshalEndpointSpecPublicNetworkDetails(request.publicNetwork, defaults) : void 0
218
218
  }, {
219
219
  param: "private_network",
220
220
  value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetworkDetails(request.privateNetwork, defaults) : void 0
221
221
  }]) });
222
- var marshalCreateEndpointRequest = (request, defaults) => ({
222
+ const marshalCreateEndpointRequest = (request, defaults) => ({
223
223
  endpoint: marshalEndpointSpec(request.endpoint, defaults),
224
224
  instance_id: request.instanceId
225
225
  });
226
- var marshalVolume = (request, defaults) => ({
226
+ const marshalVolume = (request, defaults) => ({
227
227
  size_bytes: request.sizeBytes,
228
228
  type: request.type
229
229
  });
230
- var marshalCreateInstanceRequest = (request, defaults) => ({
230
+ const marshalCreateInstanceRequest = (request, defaults) => ({
231
231
  endpoints: request.endpoints !== void 0 ? request.endpoints.map((elt) => marshalEndpointSpec(elt, defaults)) : void 0,
232
232
  name: request.name || randomName("mgdb"),
233
233
  node_amount: request.nodeAmount,
@@ -239,22 +239,22 @@ var marshalCreateInstanceRequest = (request, defaults) => ({
239
239
  version: request.version,
240
240
  volume: request.volume !== void 0 ? marshalVolume(request.volume, defaults) : void 0
241
241
  });
242
- var marshalCreateSnapshotRequest = (request, defaults) => ({
242
+ const marshalCreateSnapshotRequest = (request, defaults) => ({
243
243
  expires_at: request.expiresAt,
244
244
  instance_id: request.instanceId,
245
245
  name: request.name
246
246
  });
247
- var marshalCreateUserRequest = (request, defaults) => ({
247
+ const marshalCreateUserRequest = (request, defaults) => ({
248
248
  name: request.name,
249
249
  password: request.password
250
250
  });
251
- var marshalRestoreSnapshotRequest = (request, defaults) => ({
251
+ const marshalRestoreSnapshotRequest = (request, defaults) => ({
252
252
  instance_name: request.instanceName,
253
253
  node_amount: request.nodeAmount,
254
254
  node_type: request.nodeType,
255
255
  volume_type: request.volumeType
256
256
  });
257
- var marshalUserRole = (request, defaults) => ({
257
+ const marshalUserRole = (request, defaults) => ({
258
258
  role: request.role,
259
259
  ...resolveOneOf([{
260
260
  param: "database_name",
@@ -264,23 +264,23 @@ var marshalUserRole = (request, defaults) => ({
264
264
  value: request.anyDatabase
265
265
  }])
266
266
  });
267
- var marshalSetUserRoleRequest = (request, defaults) => ({
267
+ const marshalSetUserRoleRequest = (request, defaults) => ({
268
268
  roles: request.roles !== void 0 ? request.roles.map((elt) => marshalUserRole(elt, defaults)) : void 0,
269
269
  user_name: request.userName
270
270
  });
271
- var marshalUpdateInstanceRequest = (request, defaults) => ({
271
+ const marshalUpdateInstanceRequest = (request, defaults) => ({
272
272
  is_snapshot_schedule_enabled: request.isSnapshotScheduleEnabled,
273
273
  name: request.name,
274
274
  snapshot_schedule_frequency_hours: request.snapshotScheduleFrequencyHours,
275
275
  snapshot_schedule_retention_days: request.snapshotScheduleRetentionDays,
276
276
  tags: request.tags
277
277
  });
278
- var marshalUpdateSnapshotRequest = (request, defaults) => ({
278
+ const marshalUpdateSnapshotRequest = (request, defaults) => ({
279
279
  expires_at: request.expiresAt,
280
280
  name: request.name
281
281
  });
282
- var marshalUpdateUserRequest = (request, defaults) => ({ password: request.password });
283
- var marshalUpgradeInstanceRequest = (request, defaults) => ({ ...resolveOneOf([{
282
+ const marshalUpdateUserRequest = (request, defaults) => ({ password: request.password });
283
+ const marshalUpgradeInstanceRequest = (request, defaults) => ({ ...resolveOneOf([{
284
284
  param: "volume_size_bytes",
285
285
  value: request.volumeSizeBytes
286
286
  }, {
@@ -1,5 +1,5 @@
1
1
  //#region src/v1/metadata.gen.ts
2
- var queriesMetadata = {
2
+ const queriesMetadata = {
3
3
  namespace: "mongodb",
4
4
  version: "v1",
5
5
  folderName: "mongodbv1",
@@ -19,7 +19,7 @@ var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({
19
19
  UpdateUserRequest: () => UpdateUserRequest,
20
20
  Volume: () => Volume
21
21
  });
22
- var CreateInstanceRequest = {
22
+ const CreateInstanceRequest = {
23
23
  name: {
24
24
  maxLength: 255,
25
25
  minLength: 1,
@@ -45,12 +45,12 @@ var CreateInstanceRequest = {
45
45
  },
46
46
  version: { pattern: /^[0-9]+\.[0-9]+$/ }
47
47
  };
48
- var CreateSnapshotRequest = { name: {
48
+ const CreateSnapshotRequest = { name: {
49
49
  maxLength: 255,
50
50
  minLength: 1,
51
51
  pattern: /^[A-Za-z0-9\-_]+$/
52
52
  } };
53
- var CreateUserRequest = {
53
+ const CreateUserRequest = {
54
54
  name: {
55
55
  maxLength: 63,
56
56
  minLength: 1,
@@ -61,19 +61,19 @@ var CreateUserRequest = {
61
61
  minLength: 8
62
62
  }
63
63
  };
64
- var DeleteUserRequest = { name: {
64
+ const DeleteUserRequest = { name: {
65
65
  maxLength: 63,
66
66
  minLength: 1,
67
67
  pattern: /^[a-zA-Z0-9_\-]*$/
68
68
  } };
69
- var ListDatabasesRequest = {
69
+ const ListDatabasesRequest = {
70
70
  page: { greaterThanOrEqual: 1 },
71
71
  pageSize: {
72
72
  greaterThanOrEqual: 1,
73
73
  lessThanOrEqual: 100
74
74
  }
75
75
  };
76
- var ListInstancesRequest = {
76
+ const ListInstancesRequest = {
77
77
  name: {
78
78
  maxLength: 255,
79
79
  minLength: 1,
@@ -85,21 +85,21 @@ var ListInstancesRequest = {
85
85
  lessThanOrEqual: 100
86
86
  }
87
87
  };
88
- var ListMaintenancesRequest = {
88
+ const ListMaintenancesRequest = {
89
89
  page: { greaterThanOrEqual: 1 },
90
90
  pageSize: {
91
91
  greaterThanOrEqual: 1,
92
92
  lessThanOrEqual: 100
93
93
  }
94
94
  };
95
- var ListNodeTypesRequest = {
95
+ const ListNodeTypesRequest = {
96
96
  page: { greaterThanOrEqual: 1 },
97
97
  pageSize: {
98
98
  greaterThanOrEqual: 1,
99
99
  lessThanOrEqual: 100
100
100
  }
101
101
  };
102
- var ListSnapshotsRequest = {
102
+ const ListSnapshotsRequest = {
103
103
  name: {
104
104
  maxLength: 255,
105
105
  minLength: 1,
@@ -111,7 +111,7 @@ var ListSnapshotsRequest = {
111
111
  lessThanOrEqual: 100
112
112
  }
113
113
  };
114
- var ListUsersRequest = {
114
+ const ListUsersRequest = {
115
115
  name: {
116
116
  maxLength: 63,
117
117
  minLength: 1,
@@ -123,7 +123,7 @@ var ListUsersRequest = {
123
123
  lessThanOrEqual: 100
124
124
  }
125
125
  };
126
- var ListVersionsRequest = {
126
+ const ListVersionsRequest = {
127
127
  page: { greaterThanOrEqual: 1 },
128
128
  pageSize: {
129
129
  greaterThanOrEqual: 1,
@@ -131,7 +131,7 @@ var ListVersionsRequest = {
131
131
  },
132
132
  version: { pattern: /^[0-9]+\.[0-9]+$/ }
133
133
  };
134
- var RestoreSnapshotRequest = {
134
+ const RestoreSnapshotRequest = {
135
135
  instanceName: {
136
136
  maxLength: 255,
137
137
  minLength: 1,
@@ -142,12 +142,12 @@ var RestoreSnapshotRequest = {
142
142
  lessThanOrEqual: 3
143
143
  }
144
144
  };
145
- var SetUserRoleRequest = { userName: {
145
+ const SetUserRoleRequest = { userName: {
146
146
  maxLength: 63,
147
147
  minLength: 1,
148
148
  pattern: /^[a-zA-Z0-9_\-]*$/
149
149
  } };
150
- var UpdateInstanceRequest = {
150
+ const UpdateInstanceRequest = {
151
151
  name: {
152
152
  maxLength: 255,
153
153
  minLength: 1,
@@ -162,12 +162,12 @@ var UpdateInstanceRequest = {
162
162
  lessThanOrEqual: 365
163
163
  }
164
164
  };
165
- var UpdateSnapshotRequest = { name: {
165
+ const UpdateSnapshotRequest = { name: {
166
166
  maxLength: 255,
167
167
  minLength: 1,
168
168
  pattern: /^[A-Za-z0-9\-_]+$/
169
169
  } };
170
- var UpdateUserRequest = {
170
+ const UpdateUserRequest = {
171
171
  name: {
172
172
  maxLength: 63,
173
173
  minLength: 1,
@@ -178,6 +178,6 @@ var UpdateUserRequest = {
178
178
  minLength: 8
179
179
  }
180
180
  };
181
- var Volume = { sizeBytes: { greaterThanOrEqual: 1e9 } };
181
+ const Volume = { sizeBytes: { greaterThanOrEqual: 1e9 } };
182
182
  //#endregion
183
183
  export { CreateInstanceRequest, CreateSnapshotRequest, CreateUserRequest, DeleteUserRequest, ListDatabasesRequest, ListInstancesRequest, ListMaintenancesRequest, ListNodeTypesRequest, ListSnapshotsRequest, ListUsersRequest, ListVersionsRequest, RestoreSnapshotRequest, SetUserRoleRequest, UpdateInstanceRequest, UpdateSnapshotRequest, UpdateUserRequest, Volume, validation_rules_gen_exports };
@@ -59,7 +59,7 @@ export declare class API extends ParentAPI {
59
59
  * @param options - The waiting options
60
60
  * @returns A Promise of Instance
61
61
  */
62
- waitForInstance: (request: Readonly<GetInstanceRequest>, options?: Readonly<WaitForOptions<Instance>>) => Promise<Instance>;
62
+ waitForInstance: (request: Readonly<GetInstanceRequest>, options?: Readonly<WaitForOptions<Instance>> | undefined) => Promise<Instance>;
63
63
  /**
64
64
  * Create a MongoDB® Database Instance. Create a new MongoDB® Database Instance.
65
65
  *
@@ -116,7 +116,7 @@ export declare class API extends ParentAPI {
116
116
  * @param options - The waiting options
117
117
  * @returns A Promise of Snapshot
118
118
  */
119
- waitForSnapshot: (request: Readonly<GetSnapshotRequest>, options?: Readonly<WaitForOptions<Snapshot>>) => Promise<Snapshot>;
119
+ waitForSnapshot: (request: Readonly<GetSnapshotRequest>, options?: Readonly<WaitForOptions<Snapshot>> | undefined) => Promise<Snapshot>;
120
120
  /**
121
121
  * Update a Database Instance snapshot. Update the parameters of a snapshot of a Database Instance. You can update the `name` and `expires_at` parameters.
122
122
  *