@scaleway/sdk-iam 2.3.0 → 2.4.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,937 +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 ? data.status : void 0,
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(
351
- data.applications,
352
- unmarshalApplication
353
- ),
354
- totalCount: data.total_count
355
- };
356
- };
357
- const unmarshalGracePeriod = (data) => {
358
- if (!isJSONObject(data)) {
359
- throw new TypeError(
360
- `Unmarshalling the type 'GracePeriod' failed as data isn't a dictionary.`
361
- );
362
- }
363
- return {
364
- createdAt: unmarshalDate(data.created_at),
365
- expiresAt: unmarshalDate(data.expires_at),
366
- type: data.type
367
- };
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
+ };
368
263
  };
369
264
  const unmarshalListGracePeriodsResponse = (data) => {
370
- if (!isJSONObject(data)) {
371
- throw new TypeError(
372
- `Unmarshalling the type 'ListGracePeriodsResponse' failed as data isn't a dictionary.`
373
- );
374
- }
375
- return {
376
- gracePeriods: unmarshalArrayOfObject(
377
- data.grace_periods,
378
- unmarshalGracePeriod
379
- )
380
- };
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) };
381
267
  };
382
268
  const unmarshalListGroupsResponse = (data) => {
383
- if (!isJSONObject(data)) {
384
- throw new TypeError(
385
- `Unmarshalling the type 'ListGroupsResponse' failed as data isn't a dictionary.`
386
- );
387
- }
388
- return {
389
- groups: unmarshalArrayOfObject(data.groups, unmarshalGroup),
390
- totalCount: data.total_count
391
- };
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
+ };
392
274
  };
393
275
  const unmarshalListJWTsResponse = (data) => {
394
- if (!isJSONObject(data)) {
395
- throw new TypeError(
396
- `Unmarshalling the type 'ListJWTsResponse' failed as data isn't a dictionary.`
397
- );
398
- }
399
- return {
400
- jwts: unmarshalArrayOfObject(data.jwts, unmarshalJWT),
401
- totalCount: data.total_count
402
- };
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
+ };
403
281
  };
404
282
  const unmarshalListLogsResponse = (data) => {
405
- if (!isJSONObject(data)) {
406
- throw new TypeError(
407
- `Unmarshalling the type 'ListLogsResponse' failed as data isn't a dictionary.`
408
- );
409
- }
410
- return {
411
- logs: unmarshalArrayOfObject(data.logs, unmarshalLog),
412
- totalCount: data.total_count
413
- };
414
- };
415
- const unmarshalPermissionSet = (data) => {
416
- if (!isJSONObject(data)) {
417
- throw new TypeError(
418
- `Unmarshalling the type 'PermissionSet' failed as data isn't a dictionary.`
419
- );
420
- }
421
- return {
422
- categories: data.categories,
423
- description: data.description,
424
- id: data.id,
425
- name: data.name,
426
- scopeType: data.scope_type
427
- };
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
+ };
428
298
  };
429
299
  const unmarshalListPermissionSetsResponse = (data) => {
430
- if (!isJSONObject(data)) {
431
- throw new TypeError(
432
- `Unmarshalling the type 'ListPermissionSetsResponse' failed as data isn't a dictionary.`
433
- );
434
- }
435
- return {
436
- permissionSets: unmarshalArrayOfObject(
437
- data.permission_sets,
438
- unmarshalPermissionSet
439
- ),
440
- totalCount: data.total_count
441
- };
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
+ };
442
305
  };
443
306
  const unmarshalListPoliciesResponse = (data) => {
444
- if (!isJSONObject(data)) {
445
- throw new TypeError(
446
- `Unmarshalling the type 'ListPoliciesResponse' failed as data isn't a dictionary.`
447
- );
448
- }
449
- return {
450
- policies: unmarshalArrayOfObject(data.policies, unmarshalPolicy),
451
- totalCount: data.total_count
452
- };
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
+ };
453
312
  };
454
313
  const unmarshalListQuotaResponse = (data) => {
455
- if (!isJSONObject(data)) {
456
- throw new TypeError(
457
- `Unmarshalling the type 'ListQuotaResponse' failed as data isn't a dictionary.`
458
- );
459
- }
460
- return {
461
- quota: unmarshalArrayOfObject(data.quota, unmarshalQuotum),
462
- totalCount: data.total_count
463
- };
464
- };
465
- const unmarshalRule = (data) => {
466
- if (!isJSONObject(data)) {
467
- throw new TypeError(
468
- `Unmarshalling the type 'Rule' failed as data isn't a dictionary.`
469
- );
470
- }
471
- return {
472
- accountRootUserId: data.account_root_user_id,
473
- condition: data.condition,
474
- id: data.id,
475
- organizationId: data.organization_id,
476
- permissionSetNames: data.permission_set_names,
477
- permissionSetsScopeType: data.permission_sets_scope_type,
478
- projectIds: data.project_ids
479
- };
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
+ };
480
331
  };
481
332
  const unmarshalListRulesResponse = (data) => {
482
- if (!isJSONObject(data)) {
483
- throw new TypeError(
484
- `Unmarshalling the type 'ListRulesResponse' failed as data isn't a dictionary.`
485
- );
486
- }
487
- return {
488
- rules: unmarshalArrayOfObject(data.rules, unmarshalRule),
489
- totalCount: data.total_count
490
- };
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
+ };
491
338
  };
492
339
  const unmarshalListSSHKeysResponse = (data) => {
493
- if (!isJSONObject(data)) {
494
- throw new TypeError(
495
- `Unmarshalling the type 'ListSSHKeysResponse' failed as data isn't a dictionary.`
496
- );
497
- }
498
- return {
499
- sshKeys: unmarshalArrayOfObject(data.ssh_keys, unmarshalSSHKey),
500
- totalCount: data.total_count
501
- };
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
+ };
502
345
  };
503
346
  const unmarshalListSamlCertificatesResponse = (data) => {
504
- if (!isJSONObject(data)) {
505
- throw new TypeError(
506
- `Unmarshalling the type 'ListSamlCertificatesResponse' failed as data isn't a dictionary.`
507
- );
508
- }
509
- return {
510
- certificates: unmarshalArrayOfObject(
511
- data.certificates,
512
- unmarshalSamlCertificate
513
- )
514
- };
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) };
515
349
  };
516
350
  const unmarshalListScimTokensResponse = (data) => {
517
- if (!isJSONObject(data)) {
518
- throw new TypeError(
519
- `Unmarshalling the type 'ListScimTokensResponse' failed as data isn't a dictionary.`
520
- );
521
- }
522
- return {
523
- scimTokens: unmarshalArrayOfObject(data.scim_tokens, unmarshalScimToken),
524
- totalCount: data.total_count
525
- };
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
+ };
526
356
  };
527
357
  const unmarshalListUserWebAuthnAuthenticatorsResponse = (data) => {
528
- if (!isJSONObject(data)) {
529
- throw new TypeError(
530
- `Unmarshalling the type 'ListUserWebAuthnAuthenticatorsResponse' failed as data isn't a dictionary.`
531
- );
532
- }
533
- return {
534
- authenticators: unmarshalArrayOfObject(
535
- data.authenticators,
536
- unmarshalWebAuthnAuthenticator
537
- ),
538
- totalCount: data.total_count
539
- };
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
+ };
540
363
  };
541
364
  const unmarshalListUsersResponse = (data) => {
542
- if (!isJSONObject(data)) {
543
- throw new TypeError(
544
- `Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`
545
- );
546
- }
547
- return {
548
- totalCount: data.total_count,
549
- users: unmarshalArrayOfObject(data.users, unmarshalUser)
550
- };
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
+ };
551
370
  };
552
371
  const unmarshalMFAOTP = (data) => {
553
- if (!isJSONObject(data)) {
554
- throw new TypeError(
555
- `Unmarshalling the type 'MFAOTP' failed as data isn't a dictionary.`
556
- );
557
- }
558
- return {
559
- secret: data.secret
560
- };
372
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'MFAOTP' failed as data isn't a dictionary.`);
373
+ return { secret: data.secret };
561
374
  };
562
375
  const unmarshalOrganization = (data) => {
563
- if (!isJSONObject(data)) {
564
- throw new TypeError(
565
- `Unmarshalling the type 'Organization' failed as data isn't a dictionary.`
566
- );
567
- }
568
- return {
569
- alias: data.alias,
570
- id: data.id,
571
- loginMagicCodeEnabled: data.login_magic_code_enabled,
572
- loginOauth2Enabled: data.login_oauth2_enabled,
573
- loginPasswordEnabled: data.login_password_enabled,
574
- loginSamlEnabled: data.login_saml_enabled,
575
- name: data.name
576
- };
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
+ };
577
386
  };
578
387
  const unmarshalOrganizationSecuritySettings = (data) => {
579
- if (!isJSONObject(data)) {
580
- throw new TypeError(
581
- `Unmarshalling the type 'OrganizationSecuritySettings' failed as data isn't a dictionary.`
582
- );
583
- }
584
- return {
585
- enforcePasswordRenewal: data.enforce_password_renewal,
586
- gracePeriodDuration: data.grace_period_duration,
587
- loginAttemptsBeforeLocked: data.login_attempts_before_locked,
588
- maxApiKeyExpirationDuration: data.max_api_key_expiration_duration,
589
- maxLoginSessionDuration: data.max_login_session_duration
590
- };
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
+ };
591
396
  };
592
397
  const unmarshalParseSamlMetadataResponse = (data) => {
593
- if (!isJSONObject(data)) {
594
- throw new TypeError(
595
- `Unmarshalling the type 'ParseSamlMetadataResponse' failed as data isn't a dictionary.`
596
- );
597
- }
598
- return {
599
- entityId: data.entity_id,
600
- signingCertificates: data.signing_certificates,
601
- singleSignOnUrl: data.single_sign_on_url
602
- };
603
- };
604
- const unmarshalSamlServiceProvider = (data) => {
605
- if (!isJSONObject(data)) {
606
- throw new TypeError(
607
- `Unmarshalling the type 'SamlServiceProvider' failed as data isn't a dictionary.`
608
- );
609
- }
610
- return {
611
- assertionConsumerServiceUrl: data.assertion_consumer_service_url,
612
- entityId: data.entity_id
613
- };
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
+ };
614
411
  };
615
412
  const unmarshalSaml = (data) => {
616
- if (!isJSONObject(data)) {
617
- throw new TypeError(
618
- `Unmarshalling the type 'Saml' failed as data isn't a dictionary.`
619
- );
620
- }
621
- return {
622
- entityId: data.entity_id,
623
- id: data.id,
624
- serviceProvider: data.service_provider ? unmarshalSamlServiceProvider(data.service_provider) : void 0,
625
- singleSignOnUrl: data.single_sign_on_url,
626
- status: data.status
627
- };
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
+ };
628
421
  };
629
422
  const unmarshalScim = (data) => {
630
- if (!isJSONObject(data)) {
631
- throw new TypeError(
632
- `Unmarshalling the type 'Scim' failed as data isn't a dictionary.`
633
- );
634
- }
635
- return {
636
- createdAt: unmarshalDate(data.created_at),
637
- id: data.id
638
- };
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
+ };
639
428
  };
640
429
  const unmarshalSetRulesResponse = (data) => {
641
- if (!isJSONObject(data)) {
642
- throw new TypeError(
643
- `Unmarshalling the type 'SetRulesResponse' failed as data isn't a dictionary.`
644
- );
645
- }
646
- return {
647
- rules: unmarshalArrayOfObject(data.rules, unmarshalRule)
648
- };
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) };
649
432
  };
650
433
  const unmarshalStartUserWebAuthnRegistrationResponse = (data) => {
651
- if (!isJSONObject(data)) {
652
- throw new TypeError(
653
- `Unmarshalling the type 'StartUserWebAuthnRegistrationResponse' failed as data isn't a dictionary.`
654
- );
655
- }
656
- return {
657
- ceremonyId: data.ceremony_id,
658
- challenge: data.challenge,
659
- excludeCredentials: data.exclude_credentials,
660
- publicKeyAlgorithms: data.public_key_algorithms,
661
- timeout: data.timeout
662
- };
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
+ };
663
442
  };
664
443
  const unmarshalValidateUserMFAOTPResponse = (data) => {
665
- if (!isJSONObject(data)) {
666
- throw new TypeError(
667
- `Unmarshalling the type 'ValidateUserMFAOTPResponse' failed as data isn't a dictionary.`
668
- );
669
- }
670
- return {
671
- recoveryCodes: data.recovery_codes
672
- };
673
- };
674
- const marshalAddGroupMemberRequest = (request, defaults) => ({
675
- ...resolveOneOf([
676
- { param: "user_id", value: request.userId },
677
- { param: "application_id", value: request.applicationId }
678
- ])
679
- });
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
+ }]) });
680
454
  const marshalAddGroupMembersRequest = (request, defaults) => ({
681
- application_ids: request.applicationIds,
682
- user_ids: request.userIds
455
+ application_ids: request.applicationIds,
456
+ user_ids: request.userIds
683
457
  });
684
458
  const marshalAddSamlCertificateRequest = (request, defaults) => ({
685
- content: request.content,
686
- type: request.type
459
+ content: request.content,
460
+ type: request.type
687
461
  });
688
462
  const marshalCreateAPIKeyRequest = (request, defaults) => ({
689
- default_project_id: request.defaultProjectId,
690
- description: request.description,
691
- expires_at: request.expiresAt,
692
- ...resolveOneOf([
693
- { param: "application_id", value: request.applicationId },
694
- { param: "user_id", value: request.userId }
695
- ])
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
+ }])
696
473
  });
697
474
  const marshalCreateApplicationRequest = (request, defaults) => ({
698
- description: request.description,
699
- name: request.name || randomName("app"),
700
- organization_id: request.organizationId ?? defaults.defaultOrganizationId,
701
- tags: request.tags
475
+ description: request.description,
476
+ name: request.name || randomName("app"),
477
+ organization_id: request.organizationId ?? defaults.defaultOrganizationId,
478
+ tags: request.tags
702
479
  });
703
480
  const marshalCreateGroupRequest = (request, defaults) => ({
704
- description: request.description,
705
- name: request.name || randomName("grp"),
706
- organization_id: request.organizationId ?? defaults.defaultOrganizationId,
707
- tags: request.tags
481
+ description: request.description,
482
+ name: request.name || randomName("grp"),
483
+ organization_id: request.organizationId ?? defaults.defaultOrganizationId,
484
+ tags: request.tags
708
485
  });
709
486
  const marshalCreateJWTRequest = (request, defaults) => ({
710
- referrer: request.referrer,
711
- user_id: request.userId
712
- });
713
- const marshalRuleSpecs = (request, defaults) => ({
714
- condition: request.condition,
715
- permission_set_names: request.permissionSetNames,
716
- ...resolveOneOf([
717
- { param: "project_ids", value: request.projectIds },
718
- { param: "organization_id", value: request.organizationId }
719
- ])
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
+ }])
720
500
  });
721
501
  const marshalCreatePolicyRequest = (request, defaults) => ({
722
- description: request.description,
723
- name: request.name || randomName("pol"),
724
- organization_id: request.organizationId ?? defaults.defaultOrganizationId,
725
- rules: request.rules !== void 0 ? request.rules.map((elt) => marshalRuleSpecs(elt)) : void 0,
726
- tags: request.tags,
727
- ...resolveOneOf([
728
- { param: "user_id", value: request.userId },
729
- { param: "group_id", value: request.groupId },
730
- { param: "application_id", value: request.applicationId },
731
- { param: "no_principal", value: request.noPrincipal }
732
- ])
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
+ ])
733
525
  });
734
526
  const marshalCreateSSHKeyRequest = (request, defaults) => ({
735
- name: request.name || randomName("key"),
736
- project_id: request.projectId ?? defaults.defaultProjectId,
737
- public_key: request.publicKey
738
- });
739
- const marshalCreateUserRequestMember = (request, defaults) => ({
740
- email: request.email,
741
- first_name: request.firstName,
742
- last_name: request.lastName,
743
- locale: request.locale,
744
- password: request.password,
745
- phone_number: request.phoneNumber,
746
- send_password_email: request.sendPasswordEmail,
747
- send_welcome_email: request.sendWelcomeEmail,
748
- 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
749
541
  });
750
542
  const marshalCreateUserRequest = (request, defaults) => ({
751
- organization_id: request.organizationId ?? defaults.defaultOrganizationId,
752
- tags: request.tags,
753
- ...resolveOneOf([
754
- { param: "email", value: request.email },
755
- {
756
- param: "member",
757
- value: request.member !== void 0 ? marshalCreateUserRequestMember(request.member) : void 0
758
- }
759
- ])
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
+ }])
760
552
  });
761
553
  const marshalFinishUserWebAuthnRegistrationRequest = (request, defaults) => ({
762
- attestation_object: request.attestationObject,
763
- authenticator_data: request.authenticatorData,
764
- authenticator_name: request.authenticatorName,
765
- ceremony_id: request.ceremonyId,
766
- client_data_json: request.clientDataJson,
767
- origin: request.origin,
768
- public_key: request.publicKey,
769
- public_key_algorithm: request.publicKeyAlgorithm,
770
- raw_id: request.rawId
771
- });
772
- const marshalJoinUserConnectionRequest = (request, defaults) => ({
773
- token: request.token
774
- });
775
- const marshalParseSamlMetadataRequest = async (request, defaults) => ({
776
- file: await marshalBlobToScwFile(request.file)
777
- });
778
- const marshalRemoveGroupMemberRequest = (request, defaults) => ({
779
- ...resolveOneOf([
780
- { param: "user_id", value: request.userId },
781
- { param: "application_id", value: request.applicationId }
782
- ])
783
- });
784
- const marshalRemoveUserConnectionRequest = (request, defaults) => ({
785
- target_user_id: request.targetUserId
786
- });
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 });
787
574
  const marshalSetGroupMembersRequest = (request, defaults) => ({
788
- application_ids: request.applicationIds,
789
- user_ids: request.userIds
790
- });
791
- const marshalSetOrganizationAliasRequest = (request, defaults) => ({
792
- alias: request.alias
575
+ application_ids: request.applicationIds,
576
+ user_ids: request.userIds
793
577
  });
578
+ const marshalSetOrganizationAliasRequest = (request, defaults) => ({ alias: request.alias });
794
579
  const marshalSetRulesRequest = (request, defaults) => ({
795
- policy_id: request.policyId,
796
- rules: request.rules.map((elt) => marshalRuleSpecs(elt))
580
+ policy_id: request.policyId,
581
+ rules: request.rules.map((elt) => marshalRuleSpecs(elt, defaults))
797
582
  });
798
583
  const marshalUpdateAPIKeyRequest = (request, defaults) => ({
799
- default_project_id: request.defaultProjectId,
800
- description: request.description,
801
- expires_at: request.expiresAt
584
+ default_project_id: request.defaultProjectId,
585
+ description: request.description,
586
+ expires_at: request.expiresAt
802
587
  });
803
588
  const marshalUpdateApplicationRequest = (request, defaults) => ({
804
- description: request.description,
805
- name: request.name,
806
- tags: request.tags
589
+ description: request.description,
590
+ name: request.name,
591
+ tags: request.tags
807
592
  });
808
593
  const marshalUpdateGroupRequest = (request, defaults) => ({
809
- description: request.description,
810
- name: request.name,
811
- tags: request.tags
594
+ description: request.description,
595
+ name: request.name,
596
+ tags: request.tags
812
597
  });
813
598
  const marshalUpdateOrganizationLoginMethodsRequest = (request, defaults) => ({
814
- login_magic_code_enabled: request.loginMagicCodeEnabled,
815
- login_oauth2_enabled: request.loginOauth2Enabled,
816
- login_password_enabled: request.loginPasswordEnabled,
817
- 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
818
603
  });
819
604
  const marshalUpdateOrganizationSecuritySettingsRequest = (request, defaults) => ({
820
- enforce_password_renewal: request.enforcePasswordRenewal,
821
- grace_period_duration: request.gracePeriodDuration,
822
- login_attempts_before_locked: request.loginAttemptsBeforeLocked,
823
- max_api_key_expiration_duration: request.maxApiKeyExpirationDuration,
824
- 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
825
610
  });
826
611
  const marshalUpdatePolicyRequest = (request, defaults) => ({
827
- description: request.description,
828
- name: request.name,
829
- tags: request.tags,
830
- ...resolveOneOf([
831
- { param: "user_id", value: request.userId },
832
- { param: "group_id", value: request.groupId },
833
- { param: "application_id", value: request.applicationId },
834
- { param: "no_principal", value: request.noPrincipal }
835
- ])
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
+ ])
836
633
  });
837
634
  const marshalUpdateSSHKeyRequest = (request, defaults) => ({
838
- disabled: request.disabled,
839
- name: request.name
635
+ disabled: request.disabled,
636
+ name: request.name
840
637
  });
841
638
  const marshalUpdateSamlRequest = (request, defaults) => ({
842
- entity_id: request.entityId,
843
- single_sign_on_url: request.singleSignOnUrl
844
- });
845
- const marshalUpdateUserPasswordRequest = (request, defaults) => ({
846
- password: request.password
639
+ entity_id: request.entityId,
640
+ single_sign_on_url: request.singleSignOnUrl
847
641
  });
642
+ const marshalUpdateUserPasswordRequest = (request, defaults) => ({ password: request.password });
848
643
  const marshalUpdateUserRequest = (request, defaults) => ({
849
- email: request.email,
850
- first_name: request.firstName,
851
- last_name: request.lastName,
852
- locale: request.locale,
853
- phone_number: request.phoneNumber,
854
- tags: request.tags
855
- });
856
- const marshalUpdateUserUsernameRequest = (request, defaults) => ({
857
- username: request.username
858
- });
859
- const marshalUpdateWebAuthnAuthenticatorRequest = (request, defaults) => ({
860
- authenticator_name: request.authenticatorName
861
- });
862
- const marshalValidateUserMFAOTPRequest = (request, defaults) => ({
863
- one_time_password: request.oneTimePassword
864
- });
865
- export {
866
- marshalAddGroupMemberRequest,
867
- marshalAddGroupMembersRequest,
868
- marshalAddSamlCertificateRequest,
869
- marshalCreateAPIKeyRequest,
870
- marshalCreateApplicationRequest,
871
- marshalCreateGroupRequest,
872
- marshalCreateJWTRequest,
873
- marshalCreatePolicyRequest,
874
- marshalCreateSSHKeyRequest,
875
- marshalCreateUserRequest,
876
- marshalFinishUserWebAuthnRegistrationRequest,
877
- marshalJoinUserConnectionRequest,
878
- marshalParseSamlMetadataRequest,
879
- marshalRemoveGroupMemberRequest,
880
- marshalRemoveUserConnectionRequest,
881
- marshalSetGroupMembersRequest,
882
- marshalSetOrganizationAliasRequest,
883
- marshalSetRulesRequest,
884
- marshalUpdateAPIKeyRequest,
885
- marshalUpdateApplicationRequest,
886
- marshalUpdateGroupRequest,
887
- marshalUpdateOrganizationLoginMethodsRequest,
888
- marshalUpdateOrganizationSecuritySettingsRequest,
889
- marshalUpdatePolicyRequest,
890
- marshalUpdateSSHKeyRequest,
891
- marshalUpdateSamlRequest,
892
- marshalUpdateUserPasswordRequest,
893
- marshalUpdateUserRequest,
894
- marshalUpdateUserUsernameRequest,
895
- marshalUpdateWebAuthnAuthenticatorRequest,
896
- marshalValidateUserMFAOTPRequest,
897
- unmarshalAPIKey,
898
- unmarshalApplication,
899
- unmarshalCreateScimTokenResponse,
900
- unmarshalEncodedJWT,
901
- unmarshalFinishUserWebAuthnRegistrationResponse,
902
- unmarshalGetUserConnectionsResponse,
903
- unmarshalGroup,
904
- unmarshalInitiateUserConnectionResponse,
905
- unmarshalJWT,
906
- unmarshalListAPIKeysResponse,
907
- unmarshalListApplicationsResponse,
908
- unmarshalListGracePeriodsResponse,
909
- unmarshalListGroupsResponse,
910
- unmarshalListJWTsResponse,
911
- unmarshalListLogsResponse,
912
- unmarshalListPermissionSetsResponse,
913
- unmarshalListPoliciesResponse,
914
- unmarshalListQuotaResponse,
915
- unmarshalListRulesResponse,
916
- unmarshalListSSHKeysResponse,
917
- unmarshalListSamlCertificatesResponse,
918
- unmarshalListScimTokensResponse,
919
- unmarshalListUserWebAuthnAuthenticatorsResponse,
920
- unmarshalListUsersResponse,
921
- unmarshalLog,
922
- unmarshalMFAOTP,
923
- unmarshalOrganization,
924
- unmarshalOrganizationSecuritySettings,
925
- unmarshalParseSamlMetadataResponse,
926
- unmarshalPolicy,
927
- unmarshalQuotum,
928
- unmarshalSSHKey,
929
- unmarshalSaml,
930
- unmarshalSamlCertificate,
931
- unmarshalScim,
932
- unmarshalSetRulesResponse,
933
- unmarshalStartUserWebAuthnRegistrationResponse,
934
- unmarshalUser,
935
- unmarshalValidateUserMFAOTPResponse,
936
- unmarshalWebAuthnAuthenticator
937
- };
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 };