@scaleway/sdk-iam 2.3.1 → 2.5.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,973 +1,654 @@
1
+ import { isJSONObject, marshalBlobToScwFile, resolveOneOf, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
1
2
  import randomName from "@scaleway/random-name";
2
- import { resolveOneOf, marshalBlobToScwFile, isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
3
3
  const unmarshalJWT = (data) => {
4
- if (!isJSONObject(data)) {
5
- throw new TypeError(
6
- `Unmarshalling the type 'JWT' failed as data isn't a dictionary.`
7
- );
8
- }
9
- return {
10
- audienceId: data.audience_id,
11
- createdAt: unmarshalDate(data.created_at),
12
- expiresAt: unmarshalDate(data.expires_at),
13
- ip: data.ip,
14
- issuerId: data.issuer_id,
15
- jti: data.jti,
16
- updatedAt: unmarshalDate(data.updated_at),
17
- userAgent: data.user_agent
18
- };
4
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'JWT' failed as data isn't a dictionary.`);
5
+ return {
6
+ audienceId: data.audience_id,
7
+ createdAt: unmarshalDate(data.created_at),
8
+ expiresAt: unmarshalDate(data.expires_at),
9
+ ip: data.ip,
10
+ issuerId: data.issuer_id,
11
+ jti: data.jti,
12
+ updatedAt: unmarshalDate(data.updated_at),
13
+ userAgent: data.user_agent
14
+ };
19
15
  };
20
16
  const unmarshalAPIKey = (data) => {
21
- if (!isJSONObject(data)) {
22
- throw new TypeError(
23
- `Unmarshalling the type 'APIKey' failed as data isn't a dictionary.`
24
- );
25
- }
26
- return {
27
- accessKey: data.access_key,
28
- applicationId: data.application_id,
29
- createdAt: unmarshalDate(data.created_at),
30
- creationIp: data.creation_ip,
31
- defaultProjectId: data.default_project_id,
32
- deletable: data.deletable,
33
- description: data.description,
34
- editable: data.editable,
35
- expiresAt: unmarshalDate(data.expires_at),
36
- managed: data.managed,
37
- secretKey: data.secret_key,
38
- updatedAt: unmarshalDate(data.updated_at),
39
- userId: data.user_id
40
- };
17
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'APIKey' failed as data isn't a dictionary.`);
18
+ return {
19
+ accessKey: data.access_key,
20
+ applicationId: data.application_id,
21
+ createdAt: unmarshalDate(data.created_at),
22
+ creationIp: data.creation_ip,
23
+ defaultProjectId: data.default_project_id,
24
+ deletable: data.deletable,
25
+ description: data.description,
26
+ editable: data.editable,
27
+ expiresAt: unmarshalDate(data.expires_at),
28
+ managed: data.managed,
29
+ secretKey: data.secret_key,
30
+ updatedAt: unmarshalDate(data.updated_at),
31
+ userId: data.user_id
32
+ };
41
33
  };
42
34
  const unmarshalApplication = (data) => {
43
- if (!isJSONObject(data)) {
44
- throw new TypeError(
45
- `Unmarshalling the type 'Application' failed as data isn't a dictionary.`
46
- );
47
- }
48
- return {
49
- createdAt: unmarshalDate(data.created_at),
50
- deletable: data.deletable,
51
- description: data.description,
52
- editable: data.editable,
53
- id: data.id,
54
- managed: data.managed,
55
- name: data.name,
56
- nbApiKeys: data.nb_api_keys,
57
- organizationId: data.organization_id,
58
- tags: data.tags,
59
- updatedAt: unmarshalDate(data.updated_at)
60
- };
35
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Application' failed as data isn't a dictionary.`);
36
+ return {
37
+ createdAt: unmarshalDate(data.created_at),
38
+ deletable: data.deletable,
39
+ description: data.description,
40
+ editable: data.editable,
41
+ id: data.id,
42
+ managed: data.managed,
43
+ name: data.name,
44
+ nbApiKeys: data.nb_api_keys,
45
+ organizationId: data.organization_id,
46
+ tags: data.tags,
47
+ updatedAt: unmarshalDate(data.updated_at)
48
+ };
61
49
  };
62
50
  const unmarshalGroup = (data) => {
63
- if (!isJSONObject(data)) {
64
- throw new TypeError(
65
- `Unmarshalling the type 'Group' failed as data isn't a dictionary.`
66
- );
67
- }
68
- return {
69
- applicationIds: data.application_ids,
70
- createdAt: unmarshalDate(data.created_at),
71
- deletable: data.deletable,
72
- description: data.description,
73
- editable: data.editable,
74
- id: data.id,
75
- managed: data.managed,
76
- name: data.name,
77
- organizationId: data.organization_id,
78
- tags: data.tags,
79
- updatedAt: unmarshalDate(data.updated_at),
80
- userIds: data.user_ids
81
- };
51
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Group' failed as data isn't a dictionary.`);
52
+ return {
53
+ applicationIds: data.application_ids,
54
+ createdAt: unmarshalDate(data.created_at),
55
+ deletable: data.deletable,
56
+ description: data.description,
57
+ editable: data.editable,
58
+ id: data.id,
59
+ managed: data.managed,
60
+ name: data.name,
61
+ organizationId: data.organization_id,
62
+ tags: data.tags,
63
+ updatedAt: unmarshalDate(data.updated_at),
64
+ userIds: data.user_ids
65
+ };
82
66
  };
83
67
  const unmarshalLog = (data) => {
84
- if (!isJSONObject(data)) {
85
- throw new TypeError(
86
- `Unmarshalling the type 'Log' failed as data isn't a dictionary.`
87
- );
88
- }
89
- return {
90
- action: data.action,
91
- bearerId: data.bearer_id,
92
- createdAt: unmarshalDate(data.created_at),
93
- id: data.id,
94
- ip: data.ip,
95
- organizationId: data.organization_id,
96
- resourceId: data.resource_id,
97
- resourceType: data.resource_type,
98
- userAgent: data.user_agent
99
- };
68
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Log' failed as data isn't a dictionary.`);
69
+ return {
70
+ action: data.action,
71
+ bearerId: data.bearer_id,
72
+ createdAt: unmarshalDate(data.created_at),
73
+ id: data.id,
74
+ ip: data.ip,
75
+ organizationId: data.organization_id,
76
+ resourceId: data.resource_id,
77
+ resourceType: data.resource_type,
78
+ userAgent: data.user_agent
79
+ };
100
80
  };
101
81
  const unmarshalPolicy = (data) => {
102
- if (!isJSONObject(data)) {
103
- throw new TypeError(
104
- `Unmarshalling the type 'Policy' failed as data isn't a dictionary.`
105
- );
106
- }
107
- return {
108
- applicationId: data.application_id,
109
- createdAt: unmarshalDate(data.created_at),
110
- deletable: data.deletable,
111
- description: data.description,
112
- editable: data.editable,
113
- groupId: data.group_id,
114
- id: data.id,
115
- managed: data.managed,
116
- name: data.name,
117
- nbPermissionSets: data.nb_permission_sets,
118
- nbRules: data.nb_rules,
119
- nbScopes: data.nb_scopes,
120
- noPrincipal: data.no_principal,
121
- organizationId: data.organization_id,
122
- tags: data.tags,
123
- updatedAt: unmarshalDate(data.updated_at),
124
- userId: data.user_id
125
- };
126
- };
127
- const unmarshalQuotumLimit = (data) => {
128
- if (!isJSONObject(data)) {
129
- throw new TypeError(
130
- `Unmarshalling the type 'QuotumLimit' failed as data isn't a dictionary.`
131
- );
132
- }
133
- return {
134
- global: data.global,
135
- limit: data.limit,
136
- region: data.region,
137
- unlimited: data.unlimited,
138
- zone: data.zone
139
- };
82
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Policy' failed as data isn't a dictionary.`);
83
+ return {
84
+ applicationId: data.application_id,
85
+ createdAt: unmarshalDate(data.created_at),
86
+ deletable: data.deletable,
87
+ description: data.description,
88
+ editable: data.editable,
89
+ groupId: data.group_id,
90
+ id: data.id,
91
+ managed: data.managed,
92
+ name: data.name,
93
+ nbPermissionSets: data.nb_permission_sets,
94
+ nbRules: data.nb_rules,
95
+ nbScopes: data.nb_scopes,
96
+ noPrincipal: data.no_principal,
97
+ organizationId: data.organization_id,
98
+ tags: data.tags,
99
+ updatedAt: unmarshalDate(data.updated_at),
100
+ userId: data.user_id
101
+ };
102
+ };
103
+ var unmarshalQuotumLimit = (data) => {
104
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'QuotumLimit' failed as data isn't a dictionary.`);
105
+ return {
106
+ global: data.global,
107
+ limit: data.limit,
108
+ region: data.region,
109
+ unlimited: data.unlimited,
110
+ zone: data.zone
111
+ };
140
112
  };
141
113
  const unmarshalQuotum = (data) => {
142
- if (!isJSONObject(data)) {
143
- throw new TypeError(
144
- `Unmarshalling the type 'Quotum' failed as data isn't a dictionary.`
145
- );
146
- }
147
- return {
148
- description: data.description,
149
- limit: data.limit,
150
- limits: unmarshalArrayOfObject(data.limits, unmarshalQuotumLimit),
151
- localityType: data.locality_type,
152
- name: data.name,
153
- prettyName: data.pretty_name,
154
- unit: data.unit,
155
- unlimited: data.unlimited
156
- };
114
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Quotum' failed as data isn't a dictionary.`);
115
+ return {
116
+ description: data.description,
117
+ limit: data.limit,
118
+ limits: unmarshalArrayOfObject(data.limits, unmarshalQuotumLimit),
119
+ localityType: data.locality_type,
120
+ name: data.name,
121
+ prettyName: data.pretty_name,
122
+ unit: data.unit,
123
+ unlimited: data.unlimited
124
+ };
157
125
  };
158
126
  const unmarshalSSHKey = (data) => {
159
- if (!isJSONObject(data)) {
160
- throw new TypeError(
161
- `Unmarshalling the type 'SSHKey' failed as data isn't a dictionary.`
162
- );
163
- }
164
- return {
165
- createdAt: unmarshalDate(data.created_at),
166
- disabled: data.disabled,
167
- fingerprint: data.fingerprint,
168
- id: data.id,
169
- name: data.name,
170
- organizationId: data.organization_id,
171
- projectId: data.project_id,
172
- publicKey: data.public_key,
173
- updatedAt: unmarshalDate(data.updated_at)
174
- };
127
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SSHKey' failed as data isn't a dictionary.`);
128
+ return {
129
+ createdAt: unmarshalDate(data.created_at),
130
+ disabled: data.disabled,
131
+ fingerprint: data.fingerprint,
132
+ id: data.id,
133
+ name: data.name,
134
+ organizationId: data.organization_id,
135
+ projectId: data.project_id,
136
+ publicKey: data.public_key,
137
+ updatedAt: unmarshalDate(data.updated_at)
138
+ };
175
139
  };
176
140
  const unmarshalSamlCertificate = (data) => {
177
- if (!isJSONObject(data)) {
178
- throw new TypeError(
179
- `Unmarshalling the type 'SamlCertificate' failed as data isn't a dictionary.`
180
- );
181
- }
182
- return {
183
- content: data.content,
184
- expiresAt: unmarshalDate(data.expires_at),
185
- id: data.id,
186
- origin: data.origin,
187
- type: data.type
188
- };
141
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SamlCertificate' failed as data isn't a dictionary.`);
142
+ return {
143
+ content: data.content,
144
+ expiresAt: unmarshalDate(data.expires_at),
145
+ id: data.id,
146
+ origin: data.origin,
147
+ type: data.type
148
+ };
189
149
  };
190
150
  const unmarshalWebAuthnAuthenticator = (data) => {
191
- if (!isJSONObject(data)) {
192
- throw new TypeError(
193
- `Unmarshalling the type 'WebAuthnAuthenticator' failed as data isn't a dictionary.`
194
- );
195
- }
196
- return {
197
- createdAt: unmarshalDate(data.created_at),
198
- id: data.id,
199
- lastLoginAt: unmarshalDate(data.last_login_at),
200
- name: data.name
201
- };
151
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'WebAuthnAuthenticator' failed as data isn't a dictionary.`);
152
+ return {
153
+ createdAt: unmarshalDate(data.created_at),
154
+ id: data.id,
155
+ lastLoginAt: unmarshalDate(data.last_login_at),
156
+ name: data.name
157
+ };
202
158
  };
203
159
  const unmarshalUser = (data) => {
204
- if (!isJSONObject(data)) {
205
- throw new TypeError(
206
- `Unmarshalling the type 'User' failed as data isn't a dictionary.`
207
- );
208
- }
209
- return {
210
- accountRootUserId: data.account_root_user_id,
211
- createdAt: unmarshalDate(data.created_at),
212
- deletable: data.deletable,
213
- email: data.email,
214
- firstName: data.first_name,
215
- id: data.id,
216
- lastLoginAt: unmarshalDate(data.last_login_at),
217
- lastName: data.last_name,
218
- locale: data.locale,
219
- locked: data.locked,
220
- mfa: data.mfa,
221
- organizationId: data.organization_id,
222
- phoneNumber: data.phone_number,
223
- status: data.status ? data.status : void 0,
224
- tags: data.tags,
225
- twoFactorEnabled: data.two_factor_enabled,
226
- type: data.type,
227
- updatedAt: unmarshalDate(data.updated_at),
228
- username: data.username
229
- };
230
- };
231
- const unmarshalScimToken = (data) => {
232
- if (!isJSONObject(data)) {
233
- throw new TypeError(
234
- `Unmarshalling the type 'ScimToken' failed as data isn't a dictionary.`
235
- );
236
- }
237
- return {
238
- createdAt: unmarshalDate(data.created_at),
239
- expiresAt: unmarshalDate(data.expires_at),
240
- id: data.id,
241
- scimId: data.scim_id
242
- };
160
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'User' failed as data isn't a dictionary.`);
161
+ return {
162
+ accountRootUserId: data.account_root_user_id,
163
+ createdAt: unmarshalDate(data.created_at),
164
+ deletable: data.deletable,
165
+ email: data.email,
166
+ firstName: data.first_name,
167
+ id: data.id,
168
+ lastLoginAt: unmarshalDate(data.last_login_at),
169
+ lastName: data.last_name,
170
+ locale: data.locale,
171
+ locked: data.locked,
172
+ mfa: data.mfa,
173
+ organizationId: data.organization_id,
174
+ phoneNumber: data.phone_number,
175
+ status: data.status,
176
+ tags: data.tags,
177
+ twoFactorEnabled: data.two_factor_enabled,
178
+ type: data.type,
179
+ updatedAt: unmarshalDate(data.updated_at),
180
+ username: data.username
181
+ };
182
+ };
183
+ var unmarshalScimToken = (data) => {
184
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ScimToken' failed as data isn't a dictionary.`);
185
+ return {
186
+ createdAt: unmarshalDate(data.created_at),
187
+ expiresAt: unmarshalDate(data.expires_at),
188
+ id: data.id,
189
+ scimId: data.scim_id
190
+ };
243
191
  };
244
192
  const unmarshalCreateScimTokenResponse = (data) => {
245
- if (!isJSONObject(data)) {
246
- throw new TypeError(
247
- `Unmarshalling the type 'CreateScimTokenResponse' failed as data isn't a dictionary.`
248
- );
249
- }
250
- return {
251
- bearerToken: data.bearer_token,
252
- token: data.token ? unmarshalScimToken(data.token) : void 0
253
- };
193
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'CreateScimTokenResponse' failed as data isn't a dictionary.`);
194
+ return {
195
+ bearerToken: data.bearer_token,
196
+ token: data.token ? unmarshalScimToken(data.token) : void 0
197
+ };
254
198
  };
255
199
  const unmarshalEncodedJWT = (data) => {
256
- if (!isJSONObject(data)) {
257
- throw new TypeError(
258
- `Unmarshalling the type 'EncodedJWT' failed as data isn't a dictionary.`
259
- );
260
- }
261
- return {
262
- jwt: data.jwt ? unmarshalJWT(data.jwt) : void 0,
263
- renewToken: data.renew_token,
264
- token: data.token
265
- };
200
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EncodedJWT' failed as data isn't a dictionary.`);
201
+ return {
202
+ jwt: data.jwt ? unmarshalJWT(data.jwt) : void 0,
203
+ renewToken: data.renew_token,
204
+ token: data.token
205
+ };
266
206
  };
267
207
  const unmarshalFinishUserWebAuthnRegistrationResponse = (data) => {
268
- if (!isJSONObject(data)) {
269
- throw new TypeError(
270
- `Unmarshalling the type 'FinishUserWebAuthnRegistrationResponse' failed as data isn't a dictionary.`
271
- );
272
- }
273
- return {
274
- authenticatorId: data.authenticator_id
275
- };
276
- };
277
- const unmarshalConnectionConnectedOrganization = (data) => {
278
- if (!isJSONObject(data)) {
279
- throw new TypeError(
280
- `Unmarshalling the type 'ConnectionConnectedOrganization' failed as data isn't a dictionary.`
281
- );
282
- }
283
- return {
284
- id: data.id,
285
- locked: data.locked,
286
- name: data.name
287
- };
288
- };
289
- const unmarshalConnectionConnectedUser = (data) => {
290
- if (!isJSONObject(data)) {
291
- throw new TypeError(
292
- `Unmarshalling the type 'ConnectionConnectedUser' failed as data isn't a dictionary.`
293
- );
294
- }
295
- return {
296
- id: data.id,
297
- type: data.type,
298
- username: data.username
299
- };
300
- };
301
- const unmarshalConnection = (data) => {
302
- if (!isJSONObject(data)) {
303
- throw new TypeError(
304
- `Unmarshalling the type 'Connection' failed as data isn't a dictionary.`
305
- );
306
- }
307
- return {
308
- organization: data.organization ? unmarshalConnectionConnectedOrganization(data.organization) : void 0,
309
- user: data.user ? unmarshalConnectionConnectedUser(data.user) : void 0
310
- };
208
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'FinishUserWebAuthnRegistrationResponse' failed as data isn't a dictionary.`);
209
+ return { authenticatorId: data.authenticator_id };
210
+ };
211
+ var unmarshalConnectionConnectedOrganization = (data) => {
212
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ConnectionConnectedOrganization' failed as data isn't a dictionary.`);
213
+ return {
214
+ id: data.id,
215
+ locked: data.locked,
216
+ name: data.name
217
+ };
218
+ };
219
+ var unmarshalConnectionConnectedUser = (data) => {
220
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ConnectionConnectedUser' failed as data isn't a dictionary.`);
221
+ return {
222
+ id: data.id,
223
+ type: data.type,
224
+ username: data.username
225
+ };
226
+ };
227
+ var unmarshalConnection = (data) => {
228
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Connection' failed as data isn't a dictionary.`);
229
+ return {
230
+ organization: data.organization ? unmarshalConnectionConnectedOrganization(data.organization) : void 0,
231
+ user: data.user ? unmarshalConnectionConnectedUser(data.user) : void 0
232
+ };
311
233
  };
312
234
  const unmarshalGetUserConnectionsResponse = (data) => {
313
- if (!isJSONObject(data)) {
314
- throw new TypeError(
315
- `Unmarshalling the type 'GetUserConnectionsResponse' failed as data isn't a dictionary.`
316
- );
317
- }
318
- return {
319
- connections: unmarshalArrayOfObject(data.connections, unmarshalConnection)
320
- };
235
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GetUserConnectionsResponse' failed as data isn't a dictionary.`);
236
+ return { connections: unmarshalArrayOfObject(data.connections, unmarshalConnection) };
321
237
  };
322
238
  const unmarshalInitiateUserConnectionResponse = (data) => {
323
- if (!isJSONObject(data)) {
324
- throw new TypeError(
325
- `Unmarshalling the type 'InitiateUserConnectionResponse' failed as data isn't a dictionary.`
326
- );
327
- }
328
- return {
329
- token: data.token
330
- };
239
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InitiateUserConnectionResponse' failed as data isn't a dictionary.`);
240
+ return { token: data.token };
331
241
  };
332
242
  const unmarshalListAPIKeysResponse = (data) => {
333
- if (!isJSONObject(data)) {
334
- throw new TypeError(
335
- `Unmarshalling the type 'ListAPIKeysResponse' failed as data isn't a dictionary.`
336
- );
337
- }
338
- return {
339
- apiKeys: unmarshalArrayOfObject(data.api_keys, unmarshalAPIKey),
340
- totalCount: data.total_count
341
- };
243
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListAPIKeysResponse' failed as data isn't a dictionary.`);
244
+ return {
245
+ apiKeys: unmarshalArrayOfObject(data.api_keys, unmarshalAPIKey),
246
+ totalCount: data.total_count
247
+ };
342
248
  };
343
249
  const unmarshalListApplicationsResponse = (data) => {
344
- if (!isJSONObject(data)) {
345
- throw new TypeError(
346
- `Unmarshalling the type 'ListApplicationsResponse' failed as data isn't a dictionary.`
347
- );
348
- }
349
- return {
350
- applications: unmarshalArrayOfObject(data.applications, unmarshalApplication),
351
- totalCount: data.total_count
352
- };
353
- };
354
- const unmarshalGracePeriod = (data) => {
355
- if (!isJSONObject(data)) {
356
- throw new TypeError(
357
- `Unmarshalling the type 'GracePeriod' failed as data isn't a dictionary.`
358
- );
359
- }
360
- return {
361
- createdAt: unmarshalDate(data.created_at),
362
- expiresAt: unmarshalDate(data.expires_at),
363
- type: data.type
364
- };
250
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListApplicationsResponse' failed as data isn't a dictionary.`);
251
+ return {
252
+ applications: unmarshalArrayOfObject(data.applications, unmarshalApplication),
253
+ totalCount: data.total_count
254
+ };
255
+ };
256
+ var unmarshalGracePeriod = (data) => {
257
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GracePeriod' failed as data isn't a dictionary.`);
258
+ return {
259
+ createdAt: unmarshalDate(data.created_at),
260
+ expiresAt: unmarshalDate(data.expires_at),
261
+ type: data.type
262
+ };
365
263
  };
366
264
  const unmarshalListGracePeriodsResponse = (data) => {
367
- if (!isJSONObject(data)) {
368
- throw new TypeError(
369
- `Unmarshalling the type 'ListGracePeriodsResponse' failed as data isn't a dictionary.`
370
- );
371
- }
372
- return {
373
- gracePeriods: unmarshalArrayOfObject(data.grace_periods, unmarshalGracePeriod)
374
- };
265
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListGracePeriodsResponse' failed as data isn't a dictionary.`);
266
+ return { gracePeriods: unmarshalArrayOfObject(data.grace_periods, unmarshalGracePeriod) };
375
267
  };
376
268
  const unmarshalListGroupsResponse = (data) => {
377
- if (!isJSONObject(data)) {
378
- throw new TypeError(
379
- `Unmarshalling the type 'ListGroupsResponse' failed as data isn't a dictionary.`
380
- );
381
- }
382
- return {
383
- groups: unmarshalArrayOfObject(data.groups, unmarshalGroup),
384
- totalCount: data.total_count
385
- };
269
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListGroupsResponse' failed as data isn't a dictionary.`);
270
+ return {
271
+ groups: unmarshalArrayOfObject(data.groups, unmarshalGroup),
272
+ totalCount: data.total_count
273
+ };
386
274
  };
387
275
  const unmarshalListJWTsResponse = (data) => {
388
- if (!isJSONObject(data)) {
389
- throw new TypeError(
390
- `Unmarshalling the type 'ListJWTsResponse' failed as data isn't a dictionary.`
391
- );
392
- }
393
- return {
394
- jwts: unmarshalArrayOfObject(data.jwts, unmarshalJWT),
395
- totalCount: data.total_count
396
- };
276
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListJWTsResponse' failed as data isn't a dictionary.`);
277
+ return {
278
+ jwts: unmarshalArrayOfObject(data.jwts, unmarshalJWT),
279
+ totalCount: data.total_count
280
+ };
397
281
  };
398
282
  const unmarshalListLogsResponse = (data) => {
399
- if (!isJSONObject(data)) {
400
- throw new TypeError(
401
- `Unmarshalling the type 'ListLogsResponse' failed as data isn't a dictionary.`
402
- );
403
- }
404
- return {
405
- logs: unmarshalArrayOfObject(data.logs, unmarshalLog),
406
- totalCount: data.total_count
407
- };
408
- };
409
- const unmarshalPermissionSet = (data) => {
410
- if (!isJSONObject(data)) {
411
- throw new TypeError(
412
- `Unmarshalling the type 'PermissionSet' failed as data isn't a dictionary.`
413
- );
414
- }
415
- return {
416
- categories: data.categories,
417
- description: data.description,
418
- id: data.id,
419
- name: data.name,
420
- scopeType: data.scope_type
421
- };
283
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListLogsResponse' failed as data isn't a dictionary.`);
284
+ return {
285
+ logs: unmarshalArrayOfObject(data.logs, unmarshalLog),
286
+ totalCount: data.total_count
287
+ };
288
+ };
289
+ var unmarshalPermissionSet = (data) => {
290
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PermissionSet' failed as data isn't a dictionary.`);
291
+ return {
292
+ categories: data.categories,
293
+ description: data.description,
294
+ id: data.id,
295
+ name: data.name,
296
+ scopeType: data.scope_type
297
+ };
422
298
  };
423
299
  const unmarshalListPermissionSetsResponse = (data) => {
424
- if (!isJSONObject(data)) {
425
- throw new TypeError(
426
- `Unmarshalling the type 'ListPermissionSetsResponse' failed as data isn't a dictionary.`
427
- );
428
- }
429
- return {
430
- permissionSets: unmarshalArrayOfObject(data.permission_sets, unmarshalPermissionSet),
431
- totalCount: data.total_count
432
- };
300
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListPermissionSetsResponse' failed as data isn't a dictionary.`);
301
+ return {
302
+ permissionSets: unmarshalArrayOfObject(data.permission_sets, unmarshalPermissionSet),
303
+ totalCount: data.total_count
304
+ };
433
305
  };
434
306
  const unmarshalListPoliciesResponse = (data) => {
435
- if (!isJSONObject(data)) {
436
- throw new TypeError(
437
- `Unmarshalling the type 'ListPoliciesResponse' failed as data isn't a dictionary.`
438
- );
439
- }
440
- return {
441
- policies: unmarshalArrayOfObject(data.policies, unmarshalPolicy),
442
- totalCount: data.total_count
443
- };
307
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListPoliciesResponse' failed as data isn't a dictionary.`);
308
+ return {
309
+ policies: unmarshalArrayOfObject(data.policies, unmarshalPolicy),
310
+ totalCount: data.total_count
311
+ };
444
312
  };
445
313
  const unmarshalListQuotaResponse = (data) => {
446
- if (!isJSONObject(data)) {
447
- throw new TypeError(
448
- `Unmarshalling the type 'ListQuotaResponse' failed as data isn't a dictionary.`
449
- );
450
- }
451
- return {
452
- quota: unmarshalArrayOfObject(data.quota, unmarshalQuotum),
453
- totalCount: data.total_count
454
- };
455
- };
456
- const unmarshalRule = (data) => {
457
- if (!isJSONObject(data)) {
458
- throw new TypeError(
459
- `Unmarshalling the type 'Rule' failed as data isn't a dictionary.`
460
- );
461
- }
462
- return {
463
- accountRootUserId: data.account_root_user_id,
464
- condition: data.condition,
465
- id: data.id,
466
- organizationId: data.organization_id,
467
- permissionSetNames: data.permission_set_names,
468
- permissionSetsScopeType: data.permission_sets_scope_type,
469
- projectIds: data.project_ids
470
- };
314
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListQuotaResponse' failed as data isn't a dictionary.`);
315
+ return {
316
+ quota: unmarshalArrayOfObject(data.quota, unmarshalQuotum),
317
+ totalCount: data.total_count
318
+ };
319
+ };
320
+ var unmarshalRule = (data) => {
321
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Rule' failed as data isn't a dictionary.`);
322
+ return {
323
+ accountRootUserId: data.account_root_user_id,
324
+ condition: data.condition,
325
+ id: data.id,
326
+ organizationId: data.organization_id,
327
+ permissionSetNames: data.permission_set_names,
328
+ permissionSetsScopeType: data.permission_sets_scope_type,
329
+ projectIds: data.project_ids
330
+ };
471
331
  };
472
332
  const unmarshalListRulesResponse = (data) => {
473
- if (!isJSONObject(data)) {
474
- throw new TypeError(
475
- `Unmarshalling the type 'ListRulesResponse' failed as data isn't a dictionary.`
476
- );
477
- }
478
- return {
479
- rules: unmarshalArrayOfObject(data.rules, unmarshalRule),
480
- totalCount: data.total_count
481
- };
333
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListRulesResponse' failed as data isn't a dictionary.`);
334
+ return {
335
+ rules: unmarshalArrayOfObject(data.rules, unmarshalRule),
336
+ totalCount: data.total_count
337
+ };
482
338
  };
483
339
  const unmarshalListSSHKeysResponse = (data) => {
484
- if (!isJSONObject(data)) {
485
- throw new TypeError(
486
- `Unmarshalling the type 'ListSSHKeysResponse' failed as data isn't a dictionary.`
487
- );
488
- }
489
- return {
490
- sshKeys: unmarshalArrayOfObject(data.ssh_keys, unmarshalSSHKey),
491
- totalCount: data.total_count
492
- };
340
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSSHKeysResponse' failed as data isn't a dictionary.`);
341
+ return {
342
+ sshKeys: unmarshalArrayOfObject(data.ssh_keys, unmarshalSSHKey),
343
+ totalCount: data.total_count
344
+ };
493
345
  };
494
346
  const unmarshalListSamlCertificatesResponse = (data) => {
495
- if (!isJSONObject(data)) {
496
- throw new TypeError(
497
- `Unmarshalling the type 'ListSamlCertificatesResponse' failed as data isn't a dictionary.`
498
- );
499
- }
500
- return {
501
- certificates: unmarshalArrayOfObject(data.certificates, unmarshalSamlCertificate)
502
- };
347
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSamlCertificatesResponse' failed as data isn't a dictionary.`);
348
+ return { certificates: unmarshalArrayOfObject(data.certificates, unmarshalSamlCertificate) };
503
349
  };
504
350
  const unmarshalListScimTokensResponse = (data) => {
505
- if (!isJSONObject(data)) {
506
- throw new TypeError(
507
- `Unmarshalling the type 'ListScimTokensResponse' failed as data isn't a dictionary.`
508
- );
509
- }
510
- return {
511
- scimTokens: unmarshalArrayOfObject(data.scim_tokens, unmarshalScimToken),
512
- totalCount: data.total_count
513
- };
351
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListScimTokensResponse' failed as data isn't a dictionary.`);
352
+ return {
353
+ scimTokens: unmarshalArrayOfObject(data.scim_tokens, unmarshalScimToken),
354
+ totalCount: data.total_count
355
+ };
514
356
  };
515
357
  const unmarshalListUserWebAuthnAuthenticatorsResponse = (data) => {
516
- if (!isJSONObject(data)) {
517
- throw new TypeError(
518
- `Unmarshalling the type 'ListUserWebAuthnAuthenticatorsResponse' failed as data isn't a dictionary.`
519
- );
520
- }
521
- return {
522
- authenticators: unmarshalArrayOfObject(data.authenticators, unmarshalWebAuthnAuthenticator),
523
- totalCount: data.total_count
524
- };
358
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListUserWebAuthnAuthenticatorsResponse' failed as data isn't a dictionary.`);
359
+ return {
360
+ authenticators: unmarshalArrayOfObject(data.authenticators, unmarshalWebAuthnAuthenticator),
361
+ totalCount: data.total_count
362
+ };
525
363
  };
526
364
  const unmarshalListUsersResponse = (data) => {
527
- if (!isJSONObject(data)) {
528
- throw new TypeError(
529
- `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`
530
- );
531
- }
532
- return {
533
- totalCount: data.total_count,
534
- users: unmarshalArrayOfObject(data.users, unmarshalUser)
535
- };
365
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`);
366
+ return {
367
+ totalCount: data.total_count,
368
+ users: unmarshalArrayOfObject(data.users, unmarshalUser)
369
+ };
536
370
  };
537
371
  const unmarshalMFAOTP = (data) => {
538
- if (!isJSONObject(data)) {
539
- throw new TypeError(
540
- `Unmarshalling the type 'MFAOTP' failed as data isn't a dictionary.`
541
- );
542
- }
543
- return {
544
- secret: data.secret
545
- };
372
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'MFAOTP' failed as data isn't a dictionary.`);
373
+ return { secret: data.secret };
546
374
  };
547
375
  const unmarshalOrganization = (data) => {
548
- if (!isJSONObject(data)) {
549
- throw new TypeError(
550
- `Unmarshalling the type 'Organization' failed as data isn't a dictionary.`
551
- );
552
- }
553
- return {
554
- alias: data.alias,
555
- id: data.id,
556
- loginMagicCodeEnabled: data.login_magic_code_enabled,
557
- loginOauth2Enabled: data.login_oauth2_enabled,
558
- loginPasswordEnabled: data.login_password_enabled,
559
- loginSamlEnabled: data.login_saml_enabled,
560
- name: data.name
561
- };
376
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Organization' failed as data isn't a dictionary.`);
377
+ return {
378
+ alias: data.alias,
379
+ id: data.id,
380
+ loginMagicCodeEnabled: data.login_magic_code_enabled,
381
+ loginOauth2Enabled: data.login_oauth2_enabled,
382
+ loginPasswordEnabled: data.login_password_enabled,
383
+ loginSamlEnabled: data.login_saml_enabled,
384
+ name: data.name
385
+ };
562
386
  };
563
387
  const unmarshalOrganizationSecuritySettings = (data) => {
564
- if (!isJSONObject(data)) {
565
- throw new TypeError(
566
- `Unmarshalling the type 'OrganizationSecuritySettings' failed as data isn't a dictionary.`
567
- );
568
- }
569
- return {
570
- enforcePasswordRenewal: data.enforce_password_renewal,
571
- gracePeriodDuration: data.grace_period_duration,
572
- loginAttemptsBeforeLocked: data.login_attempts_before_locked,
573
- maxApiKeyExpirationDuration: data.max_api_key_expiration_duration,
574
- maxLoginSessionDuration: data.max_login_session_duration
575
- };
388
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'OrganizationSecuritySettings' failed as data isn't a dictionary.`);
389
+ return {
390
+ enforcePasswordRenewal: data.enforce_password_renewal,
391
+ gracePeriodDuration: data.grace_period_duration,
392
+ loginAttemptsBeforeLocked: data.login_attempts_before_locked,
393
+ maxApiKeyExpirationDuration: data.max_api_key_expiration_duration,
394
+ maxLoginSessionDuration: data.max_login_session_duration
395
+ };
576
396
  };
577
397
  const unmarshalParseSamlMetadataResponse = (data) => {
578
- if (!isJSONObject(data)) {
579
- throw new TypeError(
580
- `Unmarshalling the type 'ParseSamlMetadataResponse' failed as data isn't a dictionary.`
581
- );
582
- }
583
- return {
584
- entityId: data.entity_id,
585
- signingCertificates: data.signing_certificates,
586
- singleSignOnUrl: data.single_sign_on_url
587
- };
588
- };
589
- const unmarshalSamlServiceProvider = (data) => {
590
- if (!isJSONObject(data)) {
591
- throw new TypeError(
592
- `Unmarshalling the type 'SamlServiceProvider' failed as data isn't a dictionary.`
593
- );
594
- }
595
- return {
596
- assertionConsumerServiceUrl: data.assertion_consumer_service_url,
597
- entityId: data.entity_id
598
- };
398
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ParseSamlMetadataResponse' failed as data isn't a dictionary.`);
399
+ return {
400
+ entityId: data.entity_id,
401
+ signingCertificates: data.signing_certificates,
402
+ singleSignOnUrl: data.single_sign_on_url
403
+ };
404
+ };
405
+ var unmarshalSamlServiceProvider = (data) => {
406
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SamlServiceProvider' failed as data isn't a dictionary.`);
407
+ return {
408
+ assertionConsumerServiceUrl: data.assertion_consumer_service_url,
409
+ entityId: data.entity_id
410
+ };
599
411
  };
600
412
  const unmarshalSaml = (data) => {
601
- if (!isJSONObject(data)) {
602
- throw new TypeError(
603
- `Unmarshalling the type 'Saml' failed as data isn't a dictionary.`
604
- );
605
- }
606
- return {
607
- entityId: data.entity_id,
608
- id: data.id,
609
- serviceProvider: data.service_provider ? unmarshalSamlServiceProvider(data.service_provider) : void 0,
610
- singleSignOnUrl: data.single_sign_on_url,
611
- status: data.status
612
- };
413
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Saml' failed as data isn't a dictionary.`);
414
+ return {
415
+ entityId: data.entity_id,
416
+ id: data.id,
417
+ serviceProvider: data.service_provider ? unmarshalSamlServiceProvider(data.service_provider) : void 0,
418
+ singleSignOnUrl: data.single_sign_on_url,
419
+ status: data.status
420
+ };
613
421
  };
614
422
  const unmarshalScim = (data) => {
615
- if (!isJSONObject(data)) {
616
- throw new TypeError(
617
- `Unmarshalling the type 'Scim' failed as data isn't a dictionary.`
618
- );
619
- }
620
- return {
621
- createdAt: unmarshalDate(data.created_at),
622
- id: data.id
623
- };
423
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Scim' failed as data isn't a dictionary.`);
424
+ return {
425
+ createdAt: unmarshalDate(data.created_at),
426
+ id: data.id
427
+ };
624
428
  };
625
429
  const unmarshalSetRulesResponse = (data) => {
626
- if (!isJSONObject(data)) {
627
- throw new TypeError(
628
- `Unmarshalling the type 'SetRulesResponse' failed as data isn't a dictionary.`
629
- );
630
- }
631
- return {
632
- rules: unmarshalArrayOfObject(data.rules, unmarshalRule)
633
- };
430
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetRulesResponse' failed as data isn't a dictionary.`);
431
+ return { rules: unmarshalArrayOfObject(data.rules, unmarshalRule) };
634
432
  };
635
433
  const unmarshalStartUserWebAuthnRegistrationResponse = (data) => {
636
- if (!isJSONObject(data)) {
637
- throw new TypeError(
638
- `Unmarshalling the type 'StartUserWebAuthnRegistrationResponse' failed as data isn't a dictionary.`
639
- );
640
- }
641
- return {
642
- ceremonyId: data.ceremony_id,
643
- challenge: data.challenge,
644
- excludeCredentials: data.exclude_credentials,
645
- publicKeyAlgorithms: data.public_key_algorithms,
646
- timeout: data.timeout
647
- };
434
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'StartUserWebAuthnRegistrationResponse' failed as data isn't a dictionary.`);
435
+ return {
436
+ ceremonyId: data.ceremony_id,
437
+ challenge: data.challenge,
438
+ excludeCredentials: data.exclude_credentials,
439
+ publicKeyAlgorithms: data.public_key_algorithms,
440
+ timeout: data.timeout
441
+ };
648
442
  };
649
443
  const unmarshalValidateUserMFAOTPResponse = (data) => {
650
- if (!isJSONObject(data)) {
651
- throw new TypeError(
652
- `Unmarshalling the type 'ValidateUserMFAOTPResponse' failed as data isn't a dictionary.`
653
- );
654
- }
655
- return {
656
- recoveryCodes: data.recovery_codes
657
- };
658
- };
659
- const marshalAddGroupMemberRequest = (request, defaults) => ({
660
- ...resolveOneOf([
661
- {
662
- param: "user_id",
663
- value: request.userId
664
- },
665
- {
666
- param: "application_id",
667
- value: request.applicationId
668
- }
669
- ])
670
- });
444
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ValidateUserMFAOTPResponse' failed as data isn't a dictionary.`);
445
+ return { recoveryCodes: data.recovery_codes };
446
+ };
447
+ const marshalAddGroupMemberRequest = (request, defaults) => ({ ...resolveOneOf([{
448
+ param: "user_id",
449
+ value: request.userId
450
+ }, {
451
+ param: "application_id",
452
+ value: request.applicationId
453
+ }]) });
671
454
  const marshalAddGroupMembersRequest = (request, defaults) => ({
672
- application_ids: request.applicationIds,
673
- user_ids: request.userIds
455
+ application_ids: request.applicationIds,
456
+ user_ids: request.userIds
674
457
  });
675
458
  const marshalAddSamlCertificateRequest = (request, defaults) => ({
676
- content: request.content,
677
- type: request.type
459
+ content: request.content,
460
+ type: request.type
678
461
  });
679
462
  const marshalCreateAPIKeyRequest = (request, defaults) => ({
680
- default_project_id: request.defaultProjectId,
681
- description: request.description,
682
- expires_at: request.expiresAt,
683
- ...resolveOneOf([
684
- {
685
- param: "application_id",
686
- value: request.applicationId
687
- },
688
- {
689
- param: "user_id",
690
- value: request.userId
691
- }
692
- ])
463
+ default_project_id: request.defaultProjectId,
464
+ description: request.description,
465
+ expires_at: request.expiresAt,
466
+ ...resolveOneOf([{
467
+ param: "application_id",
468
+ value: request.applicationId
469
+ }, {
470
+ param: "user_id",
471
+ value: request.userId
472
+ }])
693
473
  });
694
474
  const marshalCreateApplicationRequest = (request, defaults) => ({
695
- description: request.description,
696
- name: request.name || randomName("app"),
697
- organization_id: request.organizationId ?? defaults.defaultOrganizationId,
698
- tags: request.tags
475
+ description: request.description,
476
+ name: request.name || randomName("app"),
477
+ organization_id: request.organizationId ?? defaults.defaultOrganizationId,
478
+ tags: request.tags
699
479
  });
700
480
  const marshalCreateGroupRequest = (request, defaults) => ({
701
- description: request.description,
702
- name: request.name || randomName("grp"),
703
- organization_id: request.organizationId ?? defaults.defaultOrganizationId,
704
- tags: request.tags
481
+ description: request.description,
482
+ name: request.name || randomName("grp"),
483
+ organization_id: request.organizationId ?? defaults.defaultOrganizationId,
484
+ tags: request.tags
705
485
  });
706
486
  const marshalCreateJWTRequest = (request, defaults) => ({
707
- referrer: request.referrer,
708
- user_id: request.userId
709
- });
710
- const marshalRuleSpecs = (request, defaults) => ({
711
- condition: request.condition,
712
- permission_set_names: request.permissionSetNames,
713
- ...resolveOneOf([
714
- {
715
- param: "project_ids",
716
- value: request.projectIds
717
- },
718
- {
719
- param: "organization_id",
720
- value: request.organizationId
721
- }
722
- ])
487
+ referrer: request.referrer,
488
+ user_id: request.userId
489
+ });
490
+ var marshalRuleSpecs = (request, defaults) => ({
491
+ condition: request.condition,
492
+ permission_set_names: request.permissionSetNames,
493
+ ...resolveOneOf([{
494
+ param: "project_ids",
495
+ value: request.projectIds
496
+ }, {
497
+ param: "organization_id",
498
+ value: request.organizationId
499
+ }])
723
500
  });
724
501
  const marshalCreatePolicyRequest = (request, defaults) => ({
725
- description: request.description,
726
- name: request.name || randomName("pol"),
727
- organization_id: request.organizationId ?? defaults.defaultOrganizationId,
728
- rules: request.rules !== void 0 ? request.rules.map((elt) => marshalRuleSpecs(elt)) : void 0,
729
- tags: request.tags,
730
- ...resolveOneOf([
731
- {
732
- param: "user_id",
733
- value: request.userId
734
- },
735
- {
736
- param: "group_id",
737
- value: request.groupId
738
- },
739
- {
740
- param: "application_id",
741
- value: request.applicationId
742
- },
743
- {
744
- param: "no_principal",
745
- value: request.noPrincipal
746
- }
747
- ])
502
+ description: request.description,
503
+ name: request.name || randomName("pol"),
504
+ organization_id: request.organizationId ?? defaults.defaultOrganizationId,
505
+ rules: request.rules !== void 0 ? request.rules.map((elt) => marshalRuleSpecs(elt, defaults)) : void 0,
506
+ tags: request.tags,
507
+ ...resolveOneOf([
508
+ {
509
+ param: "user_id",
510
+ value: request.userId
511
+ },
512
+ {
513
+ param: "group_id",
514
+ value: request.groupId
515
+ },
516
+ {
517
+ param: "application_id",
518
+ value: request.applicationId
519
+ },
520
+ {
521
+ param: "no_principal",
522
+ value: request.noPrincipal
523
+ }
524
+ ])
748
525
  });
749
526
  const marshalCreateSSHKeyRequest = (request, defaults) => ({
750
- name: request.name || randomName("key"),
751
- project_id: request.projectId ?? defaults.defaultProjectId,
752
- public_key: request.publicKey
753
- });
754
- const marshalCreateUserRequestMember = (request, defaults) => ({
755
- email: request.email,
756
- first_name: request.firstName,
757
- last_name: request.lastName,
758
- locale: request.locale,
759
- password: request.password,
760
- phone_number: request.phoneNumber,
761
- send_password_email: request.sendPasswordEmail,
762
- send_welcome_email: request.sendWelcomeEmail,
763
- username: request.username
527
+ name: request.name || randomName("key"),
528
+ project_id: request.projectId ?? defaults.defaultProjectId,
529
+ public_key: request.publicKey
530
+ });
531
+ var marshalCreateUserRequestMember = (request, defaults) => ({
532
+ email: request.email,
533
+ first_name: request.firstName,
534
+ last_name: request.lastName,
535
+ locale: request.locale,
536
+ password: request.password,
537
+ phone_number: request.phoneNumber,
538
+ send_password_email: request.sendPasswordEmail,
539
+ send_welcome_email: request.sendWelcomeEmail,
540
+ username: request.username
764
541
  });
765
542
  const marshalCreateUserRequest = (request, defaults) => ({
766
- organization_id: request.organizationId ?? defaults.defaultOrganizationId,
767
- tags: request.tags,
768
- ...resolveOneOf([
769
- {
770
- param: "email",
771
- value: request.email
772
- },
773
- {
774
- param: "member",
775
- value: request.member !== void 0 ? marshalCreateUserRequestMember(request.member) : void 0
776
- }
777
- ])
543
+ organization_id: request.organizationId ?? defaults.defaultOrganizationId,
544
+ tags: request.tags,
545
+ ...resolveOneOf([{
546
+ param: "email",
547
+ value: request.email
548
+ }, {
549
+ param: "member",
550
+ value: request.member !== void 0 ? marshalCreateUserRequestMember(request.member, defaults) : void 0
551
+ }])
778
552
  });
779
553
  const marshalFinishUserWebAuthnRegistrationRequest = (request, defaults) => ({
780
- attestation_object: request.attestationObject,
781
- authenticator_data: request.authenticatorData,
782
- authenticator_name: request.authenticatorName,
783
- ceremony_id: request.ceremonyId,
784
- client_data_json: request.clientDataJson,
785
- origin: request.origin,
786
- public_key: request.publicKey,
787
- public_key_algorithm: request.publicKeyAlgorithm,
788
- raw_id: request.rawId
789
- });
790
- const marshalJoinUserConnectionRequest = (request, defaults) => ({
791
- token: request.token
792
- });
793
- const marshalParseSamlMetadataRequest = async (request, defaults) => ({
794
- file: await marshalBlobToScwFile(request.file)
795
- });
796
- const marshalRemoveGroupMemberRequest = (request, defaults) => ({
797
- ...resolveOneOf([
798
- {
799
- param: "user_id",
800
- value: request.userId
801
- },
802
- {
803
- param: "application_id",
804
- value: request.applicationId
805
- }
806
- ])
807
- });
808
- const marshalRemoveUserConnectionRequest = (request, defaults) => ({
809
- target_user_id: request.targetUserId
810
- });
554
+ attestation_object: request.attestationObject,
555
+ authenticator_data: request.authenticatorData,
556
+ authenticator_name: request.authenticatorName,
557
+ ceremony_id: request.ceremonyId,
558
+ client_data_json: request.clientDataJson,
559
+ origin: request.origin,
560
+ public_key: request.publicKey,
561
+ public_key_algorithm: request.publicKeyAlgorithm,
562
+ raw_id: request.rawId
563
+ });
564
+ const marshalJoinUserConnectionRequest = (request, defaults) => ({ token: request.token });
565
+ const marshalParseSamlMetadataRequest = async (request, defaults) => ({ file: await marshalBlobToScwFile(request.file) });
566
+ const marshalRemoveGroupMemberRequest = (request, defaults) => ({ ...resolveOneOf([{
567
+ param: "user_id",
568
+ value: request.userId
569
+ }, {
570
+ param: "application_id",
571
+ value: request.applicationId
572
+ }]) });
573
+ const marshalRemoveUserConnectionRequest = (request, defaults) => ({ target_user_id: request.targetUserId });
811
574
  const marshalSetGroupMembersRequest = (request, defaults) => ({
812
- application_ids: request.applicationIds,
813
- user_ids: request.userIds
814
- });
815
- const marshalSetOrganizationAliasRequest = (request, defaults) => ({
816
- alias: request.alias
575
+ application_ids: request.applicationIds,
576
+ user_ids: request.userIds
817
577
  });
578
+ const marshalSetOrganizationAliasRequest = (request, defaults) => ({ alias: request.alias });
818
579
  const marshalSetRulesRequest = (request, defaults) => ({
819
- policy_id: request.policyId,
820
- rules: request.rules.map((elt) => marshalRuleSpecs(elt))
580
+ policy_id: request.policyId,
581
+ rules: request.rules.map((elt) => marshalRuleSpecs(elt, defaults))
821
582
  });
822
583
  const marshalUpdateAPIKeyRequest = (request, defaults) => ({
823
- default_project_id: request.defaultProjectId,
824
- description: request.description,
825
- expires_at: request.expiresAt
584
+ default_project_id: request.defaultProjectId,
585
+ description: request.description,
586
+ expires_at: request.expiresAt
826
587
  });
827
588
  const marshalUpdateApplicationRequest = (request, defaults) => ({
828
- description: request.description,
829
- name: request.name,
830
- tags: request.tags
589
+ description: request.description,
590
+ name: request.name,
591
+ tags: request.tags
831
592
  });
832
593
  const marshalUpdateGroupRequest = (request, defaults) => ({
833
- description: request.description,
834
- name: request.name,
835
- tags: request.tags
594
+ description: request.description,
595
+ name: request.name,
596
+ tags: request.tags
836
597
  });
837
598
  const marshalUpdateOrganizationLoginMethodsRequest = (request, defaults) => ({
838
- login_magic_code_enabled: request.loginMagicCodeEnabled,
839
- login_oauth2_enabled: request.loginOauth2Enabled,
840
- login_password_enabled: request.loginPasswordEnabled,
841
- login_saml_enabled: request.loginSamlEnabled
599
+ login_magic_code_enabled: request.loginMagicCodeEnabled,
600
+ login_oauth2_enabled: request.loginOauth2Enabled,
601
+ login_password_enabled: request.loginPasswordEnabled,
602
+ login_saml_enabled: request.loginSamlEnabled
842
603
  });
843
604
  const marshalUpdateOrganizationSecuritySettingsRequest = (request, defaults) => ({
844
- enforce_password_renewal: request.enforcePasswordRenewal,
845
- grace_period_duration: request.gracePeriodDuration,
846
- login_attempts_before_locked: request.loginAttemptsBeforeLocked,
847
- max_api_key_expiration_duration: request.maxApiKeyExpirationDuration,
848
- max_login_session_duration: request.maxLoginSessionDuration
605
+ enforce_password_renewal: request.enforcePasswordRenewal,
606
+ grace_period_duration: request.gracePeriodDuration,
607
+ login_attempts_before_locked: request.loginAttemptsBeforeLocked,
608
+ max_api_key_expiration_duration: request.maxApiKeyExpirationDuration,
609
+ max_login_session_duration: request.maxLoginSessionDuration
849
610
  });
850
611
  const marshalUpdatePolicyRequest = (request, defaults) => ({
851
- description: request.description,
852
- name: request.name,
853
- tags: request.tags,
854
- ...resolveOneOf([
855
- {
856
- param: "user_id",
857
- value: request.userId
858
- },
859
- {
860
- param: "group_id",
861
- value: request.groupId
862
- },
863
- {
864
- param: "application_id",
865
- value: request.applicationId
866
- },
867
- {
868
- param: "no_principal",
869
- value: request.noPrincipal
870
- }
871
- ])
612
+ description: request.description,
613
+ name: request.name,
614
+ tags: request.tags,
615
+ ...resolveOneOf([
616
+ {
617
+ param: "user_id",
618
+ value: request.userId
619
+ },
620
+ {
621
+ param: "group_id",
622
+ value: request.groupId
623
+ },
624
+ {
625
+ param: "application_id",
626
+ value: request.applicationId
627
+ },
628
+ {
629
+ param: "no_principal",
630
+ value: request.noPrincipal
631
+ }
632
+ ])
872
633
  });
873
634
  const marshalUpdateSSHKeyRequest = (request, defaults) => ({
874
- disabled: request.disabled,
875
- name: request.name
635
+ disabled: request.disabled,
636
+ name: request.name
876
637
  });
877
638
  const marshalUpdateSamlRequest = (request, defaults) => ({
878
- entity_id: request.entityId,
879
- single_sign_on_url: request.singleSignOnUrl
880
- });
881
- const marshalUpdateUserPasswordRequest = (request, defaults) => ({
882
- password: request.password
639
+ entity_id: request.entityId,
640
+ single_sign_on_url: request.singleSignOnUrl
883
641
  });
642
+ const marshalUpdateUserPasswordRequest = (request, defaults) => ({ password: request.password });
884
643
  const marshalUpdateUserRequest = (request, defaults) => ({
885
- email: request.email,
886
- first_name: request.firstName,
887
- last_name: request.lastName,
888
- locale: request.locale,
889
- phone_number: request.phoneNumber,
890
- tags: request.tags
891
- });
892
- const marshalUpdateUserUsernameRequest = (request, defaults) => ({
893
- username: request.username
894
- });
895
- const marshalUpdateWebAuthnAuthenticatorRequest = (request, defaults) => ({
896
- authenticator_name: request.authenticatorName
897
- });
898
- const marshalValidateUserMFAOTPRequest = (request, defaults) => ({
899
- one_time_password: request.oneTimePassword
900
- });
901
- export {
902
- marshalAddGroupMemberRequest,
903
- marshalAddGroupMembersRequest,
904
- marshalAddSamlCertificateRequest,
905
- marshalCreateAPIKeyRequest,
906
- marshalCreateApplicationRequest,
907
- marshalCreateGroupRequest,
908
- marshalCreateJWTRequest,
909
- marshalCreatePolicyRequest,
910
- marshalCreateSSHKeyRequest,
911
- marshalCreateUserRequest,
912
- marshalFinishUserWebAuthnRegistrationRequest,
913
- marshalJoinUserConnectionRequest,
914
- marshalParseSamlMetadataRequest,
915
- marshalRemoveGroupMemberRequest,
916
- marshalRemoveUserConnectionRequest,
917
- marshalSetGroupMembersRequest,
918
- marshalSetOrganizationAliasRequest,
919
- marshalSetRulesRequest,
920
- marshalUpdateAPIKeyRequest,
921
- marshalUpdateApplicationRequest,
922
- marshalUpdateGroupRequest,
923
- marshalUpdateOrganizationLoginMethodsRequest,
924
- marshalUpdateOrganizationSecuritySettingsRequest,
925
- marshalUpdatePolicyRequest,
926
- marshalUpdateSSHKeyRequest,
927
- marshalUpdateSamlRequest,
928
- marshalUpdateUserPasswordRequest,
929
- marshalUpdateUserRequest,
930
- marshalUpdateUserUsernameRequest,
931
- marshalUpdateWebAuthnAuthenticatorRequest,
932
- marshalValidateUserMFAOTPRequest,
933
- unmarshalAPIKey,
934
- unmarshalApplication,
935
- unmarshalCreateScimTokenResponse,
936
- unmarshalEncodedJWT,
937
- unmarshalFinishUserWebAuthnRegistrationResponse,
938
- unmarshalGetUserConnectionsResponse,
939
- unmarshalGroup,
940
- unmarshalInitiateUserConnectionResponse,
941
- unmarshalJWT,
942
- unmarshalListAPIKeysResponse,
943
- unmarshalListApplicationsResponse,
944
- unmarshalListGracePeriodsResponse,
945
- unmarshalListGroupsResponse,
946
- unmarshalListJWTsResponse,
947
- unmarshalListLogsResponse,
948
- unmarshalListPermissionSetsResponse,
949
- unmarshalListPoliciesResponse,
950
- unmarshalListQuotaResponse,
951
- unmarshalListRulesResponse,
952
- unmarshalListSSHKeysResponse,
953
- unmarshalListSamlCertificatesResponse,
954
- unmarshalListScimTokensResponse,
955
- unmarshalListUserWebAuthnAuthenticatorsResponse,
956
- unmarshalListUsersResponse,
957
- unmarshalLog,
958
- unmarshalMFAOTP,
959
- unmarshalOrganization,
960
- unmarshalOrganizationSecuritySettings,
961
- unmarshalParseSamlMetadataResponse,
962
- unmarshalPolicy,
963
- unmarshalQuotum,
964
- unmarshalSSHKey,
965
- unmarshalSaml,
966
- unmarshalSamlCertificate,
967
- unmarshalScim,
968
- unmarshalSetRulesResponse,
969
- unmarshalStartUserWebAuthnRegistrationResponse,
970
- unmarshalUser,
971
- unmarshalValidateUserMFAOTPResponse,
972
- unmarshalWebAuthnAuthenticator
973
- };
644
+ email: request.email,
645
+ first_name: request.firstName,
646
+ last_name: request.lastName,
647
+ locale: request.locale,
648
+ phone_number: request.phoneNumber,
649
+ tags: request.tags
650
+ });
651
+ const marshalUpdateUserUsernameRequest = (request, defaults) => ({ username: request.username });
652
+ const marshalUpdateWebAuthnAuthenticatorRequest = (request, defaults) => ({ authenticator_name: request.authenticatorName });
653
+ const marshalValidateUserMFAOTPRequest = (request, defaults) => ({ one_time_password: request.oneTimePassword });
654
+ export { marshalAddGroupMemberRequest, marshalAddGroupMembersRequest, marshalAddSamlCertificateRequest, marshalCreateAPIKeyRequest, marshalCreateApplicationRequest, marshalCreateGroupRequest, marshalCreateJWTRequest, marshalCreatePolicyRequest, marshalCreateSSHKeyRequest, marshalCreateUserRequest, marshalFinishUserWebAuthnRegistrationRequest, marshalJoinUserConnectionRequest, marshalParseSamlMetadataRequest, marshalRemoveGroupMemberRequest, marshalRemoveUserConnectionRequest, marshalSetGroupMembersRequest, marshalSetOrganizationAliasRequest, marshalSetRulesRequest, marshalUpdateAPIKeyRequest, marshalUpdateApplicationRequest, marshalUpdateGroupRequest, marshalUpdateOrganizationLoginMethodsRequest, marshalUpdateOrganizationSecuritySettingsRequest, marshalUpdatePolicyRequest, marshalUpdateSSHKeyRequest, marshalUpdateSamlRequest, marshalUpdateUserPasswordRequest, marshalUpdateUserRequest, marshalUpdateUserUsernameRequest, marshalUpdateWebAuthnAuthenticatorRequest, marshalValidateUserMFAOTPRequest, unmarshalAPIKey, unmarshalApplication, unmarshalCreateScimTokenResponse, unmarshalEncodedJWT, unmarshalFinishUserWebAuthnRegistrationResponse, unmarshalGetUserConnectionsResponse, unmarshalGroup, unmarshalInitiateUserConnectionResponse, unmarshalJWT, unmarshalListAPIKeysResponse, unmarshalListApplicationsResponse, unmarshalListGracePeriodsResponse, unmarshalListGroupsResponse, unmarshalListJWTsResponse, unmarshalListLogsResponse, unmarshalListPermissionSetsResponse, unmarshalListPoliciesResponse, unmarshalListQuotaResponse, unmarshalListRulesResponse, unmarshalListSSHKeysResponse, unmarshalListSamlCertificatesResponse, unmarshalListScimTokensResponse, unmarshalListUserWebAuthnAuthenticatorsResponse, unmarshalListUsersResponse, unmarshalLog, unmarshalMFAOTP, unmarshalOrganization, unmarshalOrganizationSecuritySettings, unmarshalParseSamlMetadataResponse, unmarshalPolicy, unmarshalQuotum, unmarshalSSHKey, unmarshalSaml, unmarshalSamlCertificate, unmarshalScim, unmarshalSetRulesResponse, unmarshalStartUserWebAuthnRegistrationResponse, unmarshalUser, unmarshalValidateUserMFAOTPResponse, unmarshalWebAuthnAuthenticator };