@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,376 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const randomName = require("@scaleway/random-name");
4
- const sdkClient = require("@scaleway/sdk-client");
5
- const unmarshalEndpointPrivateNetworkDetails = (data) => {
6
- if (!sdkClient.isJSONObject(data)) {
7
- throw new TypeError(
8
- `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
9
- );
10
- }
11
- return {
12
- privateNetworkId: data.private_network_id
13
- };
14
- };
15
- const unmarshalEndpointPublicDetails = (data) => {
16
- if (!sdkClient.isJSONObject(data)) {
17
- throw new TypeError(
18
- `Unmarshalling the type 'EndpointPublicDetails' failed as data isn't a dictionary.`
19
- );
20
- }
21
- return {};
22
- };
23
- const unmarshalEndpoint = (data) => {
24
- if (!sdkClient.isJSONObject(data)) {
25
- throw new TypeError(
26
- `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
27
- );
28
- }
29
- return {
30
- dnsRecords: data.dns_records,
31
- id: data.id,
32
- ips: data.ips,
33
- port: data.port,
34
- privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
35
- public: data.public ? unmarshalEndpointPublicDetails(data.public) : void 0
36
- };
37
- };
38
- const unmarshalInstanceSetting = (data) => {
39
- if (!sdkClient.isJSONObject(data)) {
40
- throw new TypeError(
41
- `Unmarshalling the type 'InstanceSetting' failed as data isn't a dictionary.`
42
- );
43
- }
44
- return {
45
- name: data.name,
46
- value: data.value
47
- };
48
- };
49
- const unmarshalInstanceSnapshotSchedule = (data) => {
50
- if (!sdkClient.isJSONObject(data)) {
51
- throw new TypeError(
52
- `Unmarshalling the type 'InstanceSnapshotSchedule' failed as data isn't a dictionary.`
53
- );
54
- }
55
- return {
56
- enabled: data.enabled,
57
- frequencyHours: data.frequency_hours,
58
- lastRun: sdkClient.unmarshalDate(data.last_run),
59
- nextUpdate: sdkClient.unmarshalDate(data.next_update),
60
- retentionDays: data.retention_days
61
- };
62
- };
63
- const unmarshalVolume = (data) => {
64
- if (!sdkClient.isJSONObject(data)) {
65
- throw new TypeError(
66
- `Unmarshalling the type 'Volume' failed as data isn't a dictionary.`
67
- );
68
- }
69
- return {
70
- size: data.size,
71
- type: data.type
72
- };
73
- };
74
- const unmarshalInstance = (data) => {
75
- if (!sdkClient.isJSONObject(data)) {
76
- throw new TypeError(
77
- `Unmarshalling the type 'Instance' failed as data isn't a dictionary.`
78
- );
79
- }
80
- return {
81
- createdAt: sdkClient.unmarshalDate(data.created_at),
82
- endpoints: sdkClient.unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
83
- id: data.id,
84
- name: data.name,
85
- nodeNumber: data.node_number,
86
- nodeType: data.node_type,
87
- projectId: data.project_id,
88
- region: data.region,
89
- settings: sdkClient.unmarshalArrayOfObject(data.settings, unmarshalInstanceSetting),
90
- snapshotSchedule: data.snapshot_schedule ? unmarshalInstanceSnapshotSchedule(data.snapshot_schedule) : void 0,
91
- status: data.status,
92
- tags: data.tags,
93
- version: data.version,
94
- volume: data.volume ? unmarshalVolume(data.volume) : void 0
95
- };
96
- };
97
- const unmarshalSnapshotVolumeType = (data) => {
98
- if (!sdkClient.isJSONObject(data)) {
99
- throw new TypeError(
100
- `Unmarshalling the type 'SnapshotVolumeType' failed as data isn't a dictionary.`
101
- );
102
- }
103
- return {
104
- type: data.type
105
- };
106
- };
107
- const unmarshalSnapshot = (data) => {
108
- if (!sdkClient.isJSONObject(data)) {
109
- throw new TypeError(
110
- `Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`
111
- );
112
- }
113
- return {
114
- createdAt: sdkClient.unmarshalDate(data.created_at),
115
- expiresAt: sdkClient.unmarshalDate(data.expires_at),
116
- id: data.id,
117
- instanceId: data.instance_id,
118
- instanceName: data.instance_name,
119
- name: data.name,
120
- nodeType: data.node_type,
121
- region: data.region,
122
- size: data.size,
123
- status: data.status,
124
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
125
- volumeType: data.volume_type ? unmarshalSnapshotVolumeType(data.volume_type) : void 0
126
- };
127
- };
128
- const unmarshalUserRole = (data) => {
129
- if (!sdkClient.isJSONObject(data)) {
130
- throw new TypeError(
131
- `Unmarshalling the type 'UserRole' failed as data isn't a dictionary.`
132
- );
133
- }
134
- return {
135
- anyDatabase: data.any_database,
136
- database: data.database,
137
- role: data.role
138
- };
139
- };
140
- const unmarshalUser = (data) => {
141
- if (!sdkClient.isJSONObject(data)) {
142
- throw new TypeError(
143
- `Unmarshalling the type 'User' failed as data isn't a dictionary.`
144
- );
145
- }
146
- return {
147
- name: data.name,
148
- roles: sdkClient.unmarshalArrayOfObject(data.roles, unmarshalUserRole)
149
- };
150
- };
151
- const unmarshalListInstancesResponse = (data) => {
152
- if (!sdkClient.isJSONObject(data)) {
153
- throw new TypeError(
154
- `Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary.`
155
- );
156
- }
157
- return {
158
- instances: sdkClient.unmarshalArrayOfObject(data.instances, unmarshalInstance),
159
- totalCount: data.total_count
160
- };
161
- };
162
- const unmarshalNodeTypeVolumeType = (data) => {
163
- if (!sdkClient.isJSONObject(data)) {
164
- throw new TypeError(
165
- `Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`
166
- );
167
- }
168
- return {
169
- chunkSize: data.chunk_size,
170
- description: data.description,
171
- maxSize: data.max_size,
172
- minSize: data.min_size,
173
- type: data.type
174
- };
175
- };
176
- const unmarshalNodeType = (data) => {
177
- if (!sdkClient.isJSONObject(data)) {
178
- throw new TypeError(
179
- `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
180
- );
181
- }
182
- return {
183
- availableVolumeTypes: sdkClient.unmarshalArrayOfObject(
184
- data.available_volume_types,
185
- unmarshalNodeTypeVolumeType
186
- ),
187
- beta: data.beta,
188
- description: data.description,
189
- disabled: data.disabled,
190
- instanceRange: data.instance_range,
191
- memory: data.memory,
192
- name: data.name,
193
- stockStatus: data.stock_status,
194
- vcpus: data.vcpus
195
- };
196
- };
197
- const unmarshalListNodeTypesResponse = (data) => {
198
- if (!sdkClient.isJSONObject(data)) {
199
- throw new TypeError(
200
- `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
201
- );
202
- }
203
- return {
204
- nodeTypes: sdkClient.unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
205
- totalCount: data.total_count
206
- };
207
- };
208
- const unmarshalListSnapshotsResponse = (data) => {
209
- if (!sdkClient.isJSONObject(data)) {
210
- throw new TypeError(
211
- `Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`
212
- );
213
- }
214
- return {
215
- snapshots: sdkClient.unmarshalArrayOfObject(data.snapshots, unmarshalSnapshot),
216
- totalCount: data.total_count
217
- };
218
- };
219
- const unmarshalListUsersResponse = (data) => {
220
- if (!sdkClient.isJSONObject(data)) {
221
- throw new TypeError(
222
- `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`
223
- );
224
- }
225
- return {
226
- totalCount: data.total_count,
227
- users: sdkClient.unmarshalArrayOfObject(data.users, unmarshalUser)
228
- };
229
- };
230
- const unmarshalSetting = (data) => {
231
- if (!sdkClient.isJSONObject(data)) {
232
- throw new TypeError(
233
- `Unmarshalling the type 'Setting' failed as data isn't a dictionary.`
234
- );
235
- }
236
- return {
237
- defaultValue: data.default_value,
238
- description: data.description,
239
- floatMax: data.float_max,
240
- floatMin: data.float_min,
241
- hotConfigurable: data.hot_configurable,
242
- intMax: data.int_max,
243
- intMin: data.int_min,
244
- name: data.name,
245
- propertyType: data.property_type,
246
- stringConstraint: data.string_constraint,
247
- unit: data.unit
248
- };
249
- };
250
- const unmarshalVersion = (data) => {
251
- if (!sdkClient.isJSONObject(data)) {
252
- throw new TypeError(
253
- `Unmarshalling the type 'Version' failed as data isn't a dictionary.`
254
- );
255
- }
256
- return {
257
- availableSettings: sdkClient.unmarshalArrayOfObject(
258
- data.available_settings,
259
- unmarshalSetting
260
- ),
261
- endOfLifeAt: sdkClient.unmarshalDate(data.end_of_life_at),
262
- version: data.version
263
- };
264
- };
265
- const unmarshalListVersionsResponse = (data) => {
266
- if (!sdkClient.isJSONObject(data)) {
267
- throw new TypeError(
268
- `Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`
269
- );
270
- }
271
- return {
272
- totalCount: data.total_count,
273
- versions: sdkClient.unmarshalArrayOfObject(data.versions, unmarshalVersion)
274
- };
275
- };
276
- const marshalEndpointSpecPrivateNetworkDetails = (request, defaults) => ({
277
- private_network_id: request.privateNetworkId
278
- });
279
- const marshalEndpointSpecPublicDetails = (request, defaults) => ({});
280
- const marshalEndpointSpec = (request, defaults) => ({
281
- ...sdkClient.resolveOneOf([
282
- {
283
- param: "public",
284
- value: request.public !== void 0 ? marshalEndpointSpecPublicDetails(request.public) : void 0
285
- },
286
- {
287
- param: "private_network",
288
- value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetworkDetails(
289
- request.privateNetwork
290
- ) : void 0
291
- }
292
- ])
293
- });
294
- const marshalCreateEndpointRequest = (request, defaults) => ({
295
- endpoint: marshalEndpointSpec(request.endpoint),
296
- instance_id: request.instanceId
297
- });
298
- const marshalCreateInstanceRequestVolumeDetails = (request, defaults) => ({
299
- volume_size: request.volumeSize,
300
- volume_type: request.volumeType
301
- });
302
- const marshalCreateInstanceRequest = (request, defaults) => ({
303
- endpoints: request.endpoints !== void 0 ? request.endpoints.map((elt) => marshalEndpointSpec(elt)) : void 0,
304
- name: request.name || randomName("mgdb"),
305
- node_number: request.nodeNumber,
306
- node_type: request.nodeType,
307
- password: request.password,
308
- project_id: request.projectId ?? defaults.defaultProjectId,
309
- tags: request.tags,
310
- user_name: request.userName,
311
- version: request.version,
312
- volume: request.volume !== void 0 ? marshalCreateInstanceRequestVolumeDetails(request.volume) : void 0
313
- });
314
- const marshalCreateSnapshotRequest = (request, defaults) => ({
315
- expires_at: request.expiresAt,
316
- name: request.name
317
- });
318
- const marshalCreateUserRequest = (request, defaults) => ({
319
- name: request.name,
320
- password: request.password
321
- });
322
- const marshalRestoreSnapshotRequestVolumeDetails = (request, defaults) => ({
323
- volume_type: request.volumeType
324
- });
325
- const marshalRestoreSnapshotRequest = (request, defaults) => ({
326
- instance_name: request.instanceName,
327
- node_number: request.nodeNumber,
328
- node_type: request.nodeType,
329
- volume: marshalRestoreSnapshotRequestVolumeDetails(request.volume)
330
- });
331
- const marshalUserRole = (request, defaults) => ({
332
- role: request.role,
333
- ...sdkClient.resolveOneOf([
334
- { param: "database", value: request.database },
335
- { param: "any_database", value: request.anyDatabase }
336
- ])
337
- });
338
- const marshalSetUserRoleRequest = (request, defaults) => ({
339
- roles: request.roles !== void 0 ? request.roles.map((elt) => marshalUserRole(elt)) : void 0,
340
- user_name: request.userName
341
- });
342
- const marshalUpdateInstanceRequest = (request, defaults) => ({
343
- name: request.name,
344
- tags: request.tags
345
- });
346
- const marshalUpdateSnapshotRequest = (request, defaults) => ({
347
- expires_at: request.expiresAt,
348
- name: request.name
349
- });
350
- const marshalUpdateUserRequest = (request, defaults) => ({
351
- password: request.password
352
- });
353
- const marshalUpgradeInstanceRequest = (request, defaults) => ({
354
- ...sdkClient.resolveOneOf([{ param: "volume_size", value: request.volumeSize }])
355
- });
356
- exports.marshalCreateEndpointRequest = marshalCreateEndpointRequest;
357
- exports.marshalCreateInstanceRequest = marshalCreateInstanceRequest;
358
- exports.marshalCreateSnapshotRequest = marshalCreateSnapshotRequest;
359
- exports.marshalCreateUserRequest = marshalCreateUserRequest;
360
- exports.marshalRestoreSnapshotRequest = marshalRestoreSnapshotRequest;
361
- exports.marshalSetUserRoleRequest = marshalSetUserRoleRequest;
362
- exports.marshalUpdateInstanceRequest = marshalUpdateInstanceRequest;
363
- exports.marshalUpdateSnapshotRequest = marshalUpdateSnapshotRequest;
364
- exports.marshalUpdateUserRequest = marshalUpdateUserRequest;
365
- exports.marshalUpgradeInstanceRequest = marshalUpgradeInstanceRequest;
366
- exports.unmarshalEndpoint = unmarshalEndpoint;
367
- exports.unmarshalInstance = unmarshalInstance;
368
- exports.unmarshalInstanceSetting = unmarshalInstanceSetting;
369
- exports.unmarshalListInstancesResponse = unmarshalListInstancesResponse;
370
- exports.unmarshalListNodeTypesResponse = unmarshalListNodeTypesResponse;
371
- exports.unmarshalListSnapshotsResponse = unmarshalListSnapshotsResponse;
372
- exports.unmarshalListUsersResponse = unmarshalListUsersResponse;
373
- exports.unmarshalListVersionsResponse = unmarshalListVersionsResponse;
374
- exports.unmarshalSnapshot = unmarshalSnapshot;
375
- exports.unmarshalUser = unmarshalUser;
376
- exports.unmarshalVolume = unmarshalVolume;
@@ -1,175 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const CreateInstanceRequest = {
4
- name: {
5
- maxLength: 255,
6
- minLength: 1,
7
- pattern: /^[A-Za-z0-9\-_]+$/
8
- },
9
- nodeNumber: {
10
- greaterThanOrEqual: 1,
11
- lessThanOrEqual: 3
12
- },
13
- nodeType: {
14
- maxLength: 128,
15
- minLength: 1,
16
- pattern: /^[A-Za-z0-9\-_]+$/
17
- },
18
- password: {
19
- maxLength: 128,
20
- minLength: 8
21
- },
22
- userName: {
23
- maxLength: 63,
24
- minLength: 1,
25
- pattern: /^[a-zA-Z0-9_\-]*$/
26
- },
27
- version: {
28
- pattern: /^[0-9]+\.[0-9]+\.[0-9]+$/
29
- }
30
- };
31
- const CreateSnapshotRequest = {
32
- name: {
33
- maxLength: 255,
34
- minLength: 1,
35
- pattern: /^[A-Za-z0-9\-_]+$/
36
- }
37
- };
38
- const CreateUserRequest = {
39
- name: {
40
- maxLength: 63,
41
- minLength: 1,
42
- pattern: /^[a-zA-Z0-9_\-]*$/
43
- },
44
- password: {
45
- maxLength: 128,
46
- minLength: 8
47
- }
48
- };
49
- const DeleteUserRequest = {
50
- name: {
51
- maxLength: 63,
52
- minLength: 1,
53
- pattern: /^[a-zA-Z0-9_\-]*$/
54
- }
55
- };
56
- const ListInstancesRequest = {
57
- name: {
58
- maxLength: 255,
59
- minLength: 1,
60
- pattern: /^[A-Za-z0-9\-_]+$/
61
- },
62
- page: {
63
- greaterThanOrEqual: 1
64
- },
65
- pageSize: {
66
- greaterThanOrEqual: 1,
67
- lessThanOrEqual: 100
68
- }
69
- };
70
- const ListNodeTypesRequest = {
71
- page: {
72
- greaterThanOrEqual: 1
73
- },
74
- pageSize: {
75
- greaterThanOrEqual: 1,
76
- lessThanOrEqual: 100
77
- }
78
- };
79
- const ListSnapshotsRequest = {
80
- name: {
81
- maxLength: 255,
82
- minLength: 1,
83
- pattern: /^[A-Za-z0-9\-_]+$/
84
- },
85
- page: {
86
- greaterThanOrEqual: 1
87
- },
88
- pageSize: {
89
- greaterThanOrEqual: 1,
90
- lessThanOrEqual: 100
91
- }
92
- };
93
- const ListUsersRequest = {
94
- name: {
95
- maxLength: 63,
96
- minLength: 1,
97
- pattern: /^[a-zA-Z0-9_\-]*$/
98
- },
99
- page: {
100
- greaterThanOrEqual: 1
101
- },
102
- pageSize: {
103
- greaterThanOrEqual: 1,
104
- lessThanOrEqual: 100
105
- }
106
- };
107
- const ListVersionsRequest = {
108
- page: {
109
- greaterThanOrEqual: 1
110
- },
111
- pageSize: {
112
- greaterThanOrEqual: 1,
113
- lessThanOrEqual: 100
114
- },
115
- version: {
116
- pattern: /^[0-9]+\.[0-9]+\.[0-9]+$/
117
- }
118
- };
119
- const RestoreSnapshotRequest = {
120
- instanceName: {
121
- maxLength: 255,
122
- minLength: 1,
123
- pattern: /^[A-Za-z0-9\-_]+$/
124
- },
125
- nodeNumber: {
126
- greaterThanOrEqual: 1,
127
- lessThanOrEqual: 3
128
- }
129
- };
130
- const SetUserRoleRequest = {
131
- userName: {
132
- maxLength: 63,
133
- minLength: 1,
134
- pattern: /^[a-zA-Z0-9_\-]*$/
135
- }
136
- };
137
- const UpdateInstanceRequest = {
138
- name: {
139
- maxLength: 255,
140
- minLength: 1,
141
- pattern: /^[A-Za-z0-9\-_]+$/
142
- }
143
- };
144
- const UpdateSnapshotRequest = {
145
- name: {
146
- maxLength: 255,
147
- minLength: 1,
148
- pattern: /^[A-Za-z0-9\-_]+$/
149
- }
150
- };
151
- const UpdateUserRequest = {
152
- name: {
153
- maxLength: 63,
154
- minLength: 1,
155
- pattern: /^[a-zA-Z0-9_\-]*$/
156
- },
157
- password: {
158
- maxLength: 128,
159
- minLength: 8
160
- }
161
- };
162
- exports.CreateInstanceRequest = CreateInstanceRequest;
163
- exports.CreateSnapshotRequest = CreateSnapshotRequest;
164
- exports.CreateUserRequest = CreateUserRequest;
165
- exports.DeleteUserRequest = DeleteUserRequest;
166
- exports.ListInstancesRequest = ListInstancesRequest;
167
- exports.ListNodeTypesRequest = ListNodeTypesRequest;
168
- exports.ListSnapshotsRequest = ListSnapshotsRequest;
169
- exports.ListUsersRequest = ListUsersRequest;
170
- exports.ListVersionsRequest = ListVersionsRequest;
171
- exports.RestoreSnapshotRequest = RestoreSnapshotRequest;
172
- exports.SetUserRoleRequest = SetUserRoleRequest;
173
- exports.UpdateInstanceRequest = UpdateInstanceRequest;
174
- exports.UpdateSnapshotRequest = UpdateSnapshotRequest;
175
- exports.UpdateUserRequest = UpdateUserRequest;