@scaleway/sdk-iam 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/dist/index.gen.cjs +4 -0
- package/dist/index.gen.d.ts +5 -0
- package/dist/index.gen.js +4 -0
- package/dist/v1alpha1/api.gen.cjs +1000 -0
- package/dist/v1alpha1/api.gen.d.ts +438 -0
- package/dist/v1alpha1/api.gen.js +1000 -0
- package/dist/v1alpha1/index.gen.cjs +56 -0
- package/dist/v1alpha1/index.gen.d.ts +4 -0
- package/dist/v1alpha1/index.gen.js +56 -0
- package/dist/v1alpha1/marshalling.gen.cjs +683 -0
- package/dist/v1alpha1/marshalling.gen.d.ts +51 -0
- package/dist/v1alpha1/marshalling.gen.js +683 -0
- package/dist/v1alpha1/types.gen.d.ts +1720 -0
- package/dist/v1alpha1/validation-rules.gen.cjs +307 -0
- package/dist/v1alpha1/validation-rules.gen.d.ts +276 -0
- package/dist/v1alpha1/validation-rules.gen.js +307 -0
- package/package.json +51 -0
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
import randomName from "@scaleway/random-name";
|
|
2
|
+
import { resolveOneOf, isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
|
|
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
|
+
};
|
|
19
|
+
};
|
|
20
|
+
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
|
+
};
|
|
41
|
+
};
|
|
42
|
+
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
|
+
};
|
|
61
|
+
};
|
|
62
|
+
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
|
+
};
|
|
82
|
+
};
|
|
83
|
+
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
|
+
};
|
|
100
|
+
};
|
|
101
|
+
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
|
+
};
|
|
140
|
+
};
|
|
141
|
+
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
|
+
};
|
|
157
|
+
};
|
|
158
|
+
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
|
+
};
|
|
175
|
+
};
|
|
176
|
+
const unmarshalUser = (data) => {
|
|
177
|
+
if (!isJSONObject(data)) {
|
|
178
|
+
throw new TypeError(
|
|
179
|
+
`Unmarshalling the type 'User' failed as data isn't a dictionary.`
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
accountRootUserId: data.account_root_user_id,
|
|
184
|
+
createdAt: unmarshalDate(data.created_at),
|
|
185
|
+
deletable: data.deletable,
|
|
186
|
+
email: data.email,
|
|
187
|
+
firstName: data.first_name,
|
|
188
|
+
id: data.id,
|
|
189
|
+
lastLoginAt: unmarshalDate(data.last_login_at),
|
|
190
|
+
lastName: data.last_name,
|
|
191
|
+
locale: data.locale,
|
|
192
|
+
locked: data.locked,
|
|
193
|
+
mfa: data.mfa,
|
|
194
|
+
organizationId: data.organization_id,
|
|
195
|
+
phoneNumber: data.phone_number,
|
|
196
|
+
status: data.status,
|
|
197
|
+
tags: data.tags,
|
|
198
|
+
twoFactorEnabled: data.two_factor_enabled,
|
|
199
|
+
type: data.type,
|
|
200
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
201
|
+
username: data.username
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
const unmarshalEncodedJWT = (data) => {
|
|
205
|
+
if (!isJSONObject(data)) {
|
|
206
|
+
throw new TypeError(
|
|
207
|
+
`Unmarshalling the type 'EncodedJWT' failed as data isn't a dictionary.`
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
jwt: data.jwt ? unmarshalJWT(data.jwt) : void 0,
|
|
212
|
+
renewToken: data.renew_token,
|
|
213
|
+
token: data.token
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
const unmarshalConnectionConnectedOrganization = (data) => {
|
|
217
|
+
if (!isJSONObject(data)) {
|
|
218
|
+
throw new TypeError(
|
|
219
|
+
`Unmarshalling the type 'ConnectionConnectedOrganization' failed as data isn't a dictionary.`
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
id: data.id,
|
|
224
|
+
locked: data.locked,
|
|
225
|
+
name: data.name
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
const unmarshalConnectionConnectedUser = (data) => {
|
|
229
|
+
if (!isJSONObject(data)) {
|
|
230
|
+
throw new TypeError(
|
|
231
|
+
`Unmarshalling the type 'ConnectionConnectedUser' failed as data isn't a dictionary.`
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
return {
|
|
235
|
+
id: data.id,
|
|
236
|
+
type: data.type,
|
|
237
|
+
username: data.username
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
const unmarshalConnection = (data) => {
|
|
241
|
+
if (!isJSONObject(data)) {
|
|
242
|
+
throw new TypeError(
|
|
243
|
+
`Unmarshalling the type 'Connection' failed as data isn't a dictionary.`
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
organization: data.organization ? unmarshalConnectionConnectedOrganization(data.organization) : void 0,
|
|
248
|
+
user: data.user ? unmarshalConnectionConnectedUser(data.user) : void 0
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
const unmarshalGetUserConnectionsResponse = (data) => {
|
|
252
|
+
if (!isJSONObject(data)) {
|
|
253
|
+
throw new TypeError(
|
|
254
|
+
`Unmarshalling the type 'GetUserConnectionsResponse' failed as data isn't a dictionary.`
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
connections: unmarshalArrayOfObject(data.connections, unmarshalConnection)
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
const unmarshalListAPIKeysResponse = (data) => {
|
|
262
|
+
if (!isJSONObject(data)) {
|
|
263
|
+
throw new TypeError(
|
|
264
|
+
`Unmarshalling the type 'ListAPIKeysResponse' failed as data isn't a dictionary.`
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
apiKeys: unmarshalArrayOfObject(data.api_keys, unmarshalAPIKey),
|
|
269
|
+
totalCount: data.total_count
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
const unmarshalListApplicationsResponse = (data) => {
|
|
273
|
+
if (!isJSONObject(data)) {
|
|
274
|
+
throw new TypeError(
|
|
275
|
+
`Unmarshalling the type 'ListApplicationsResponse' failed as data isn't a dictionary.`
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
applications: unmarshalArrayOfObject(
|
|
280
|
+
data.applications,
|
|
281
|
+
unmarshalApplication
|
|
282
|
+
),
|
|
283
|
+
totalCount: data.total_count
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
const unmarshalGracePeriod = (data) => {
|
|
287
|
+
if (!isJSONObject(data)) {
|
|
288
|
+
throw new TypeError(
|
|
289
|
+
`Unmarshalling the type 'GracePeriod' failed as data isn't a dictionary.`
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
return {
|
|
293
|
+
createdAt: unmarshalDate(data.created_at),
|
|
294
|
+
expiresAt: unmarshalDate(data.expires_at),
|
|
295
|
+
type: data.type
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
const unmarshalListGracePeriodsResponse = (data) => {
|
|
299
|
+
if (!isJSONObject(data)) {
|
|
300
|
+
throw new TypeError(
|
|
301
|
+
`Unmarshalling the type 'ListGracePeriodsResponse' failed as data isn't a dictionary.`
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
return {
|
|
305
|
+
gracePeriods: unmarshalArrayOfObject(
|
|
306
|
+
data.grace_periods,
|
|
307
|
+
unmarshalGracePeriod
|
|
308
|
+
)
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
const unmarshalListGroupsResponse = (data) => {
|
|
312
|
+
if (!isJSONObject(data)) {
|
|
313
|
+
throw new TypeError(
|
|
314
|
+
`Unmarshalling the type 'ListGroupsResponse' failed as data isn't a dictionary.`
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
groups: unmarshalArrayOfObject(data.groups, unmarshalGroup),
|
|
319
|
+
totalCount: data.total_count
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
const unmarshalListJWTsResponse = (data) => {
|
|
323
|
+
if (!isJSONObject(data)) {
|
|
324
|
+
throw new TypeError(
|
|
325
|
+
`Unmarshalling the type 'ListJWTsResponse' failed as data isn't a dictionary.`
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
jwts: unmarshalArrayOfObject(data.jwts, unmarshalJWT),
|
|
330
|
+
totalCount: data.total_count
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
const unmarshalListLogsResponse = (data) => {
|
|
334
|
+
if (!isJSONObject(data)) {
|
|
335
|
+
throw new TypeError(
|
|
336
|
+
`Unmarshalling the type 'ListLogsResponse' failed as data isn't a dictionary.`
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
return {
|
|
340
|
+
logs: unmarshalArrayOfObject(data.logs, unmarshalLog),
|
|
341
|
+
totalCount: data.total_count
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
const unmarshalPermissionSet = (data) => {
|
|
345
|
+
if (!isJSONObject(data)) {
|
|
346
|
+
throw new TypeError(
|
|
347
|
+
`Unmarshalling the type 'PermissionSet' failed as data isn't a dictionary.`
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
categories: data.categories,
|
|
352
|
+
description: data.description,
|
|
353
|
+
id: data.id,
|
|
354
|
+
name: data.name,
|
|
355
|
+
scopeType: data.scope_type
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
const unmarshalListPermissionSetsResponse = (data) => {
|
|
359
|
+
if (!isJSONObject(data)) {
|
|
360
|
+
throw new TypeError(
|
|
361
|
+
`Unmarshalling the type 'ListPermissionSetsResponse' failed as data isn't a dictionary.`
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
return {
|
|
365
|
+
permissionSets: unmarshalArrayOfObject(
|
|
366
|
+
data.permission_sets,
|
|
367
|
+
unmarshalPermissionSet
|
|
368
|
+
),
|
|
369
|
+
totalCount: data.total_count
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
const unmarshalListPoliciesResponse = (data) => {
|
|
373
|
+
if (!isJSONObject(data)) {
|
|
374
|
+
throw new TypeError(
|
|
375
|
+
`Unmarshalling the type 'ListPoliciesResponse' failed as data isn't a dictionary.`
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
return {
|
|
379
|
+
policies: unmarshalArrayOfObject(data.policies, unmarshalPolicy),
|
|
380
|
+
totalCount: data.total_count
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
const unmarshalListQuotaResponse = (data) => {
|
|
384
|
+
if (!isJSONObject(data)) {
|
|
385
|
+
throw new TypeError(
|
|
386
|
+
`Unmarshalling the type 'ListQuotaResponse' failed as data isn't a dictionary.`
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
return {
|
|
390
|
+
quota: unmarshalArrayOfObject(data.quota, unmarshalQuotum),
|
|
391
|
+
totalCount: data.total_count
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
const unmarshalRule = (data) => {
|
|
395
|
+
if (!isJSONObject(data)) {
|
|
396
|
+
throw new TypeError(
|
|
397
|
+
`Unmarshalling the type 'Rule' failed as data isn't a dictionary.`
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
return {
|
|
401
|
+
accountRootUserId: data.account_root_user_id,
|
|
402
|
+
condition: data.condition,
|
|
403
|
+
id: data.id,
|
|
404
|
+
organizationId: data.organization_id,
|
|
405
|
+
permissionSetNames: data.permission_set_names,
|
|
406
|
+
permissionSetsScopeType: data.permission_sets_scope_type,
|
|
407
|
+
projectIds: data.project_ids
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
const unmarshalListRulesResponse = (data) => {
|
|
411
|
+
if (!isJSONObject(data)) {
|
|
412
|
+
throw new TypeError(
|
|
413
|
+
`Unmarshalling the type 'ListRulesResponse' failed as data isn't a dictionary.`
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
return {
|
|
417
|
+
rules: unmarshalArrayOfObject(data.rules, unmarshalRule),
|
|
418
|
+
totalCount: data.total_count
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
const unmarshalListSSHKeysResponse = (data) => {
|
|
422
|
+
if (!isJSONObject(data)) {
|
|
423
|
+
throw new TypeError(
|
|
424
|
+
`Unmarshalling the type 'ListSSHKeysResponse' failed as data isn't a dictionary.`
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
return {
|
|
428
|
+
sshKeys: unmarshalArrayOfObject(data.ssh_keys, unmarshalSSHKey),
|
|
429
|
+
totalCount: data.total_count
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
const unmarshalListUsersResponse = (data) => {
|
|
433
|
+
if (!isJSONObject(data)) {
|
|
434
|
+
throw new TypeError(
|
|
435
|
+
`Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
return {
|
|
439
|
+
totalCount: data.total_count,
|
|
440
|
+
users: unmarshalArrayOfObject(data.users, unmarshalUser)
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
const unmarshalMFAOTP = (data) => {
|
|
444
|
+
if (!isJSONObject(data)) {
|
|
445
|
+
throw new TypeError(
|
|
446
|
+
`Unmarshalling the type 'MFAOTP' failed as data isn't a dictionary.`
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
return {
|
|
450
|
+
secret: data.secret
|
|
451
|
+
};
|
|
452
|
+
};
|
|
453
|
+
const unmarshalOrganizationSecuritySettings = (data) => {
|
|
454
|
+
if (!isJSONObject(data)) {
|
|
455
|
+
throw new TypeError(
|
|
456
|
+
`Unmarshalling the type 'OrganizationSecuritySettings' failed as data isn't a dictionary.`
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
return {
|
|
460
|
+
enforcePasswordRenewal: data.enforce_password_renewal,
|
|
461
|
+
gracePeriodDuration: data.grace_period_duration,
|
|
462
|
+
loginAttemptsBeforeLocked: data.login_attempts_before_locked
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
const unmarshalSetRulesResponse = (data) => {
|
|
466
|
+
if (!isJSONObject(data)) {
|
|
467
|
+
throw new TypeError(
|
|
468
|
+
`Unmarshalling the type 'SetRulesResponse' failed as data isn't a dictionary.`
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
rules: unmarshalArrayOfObject(data.rules, unmarshalRule)
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
const unmarshalValidateUserMFAOTPResponse = (data) => {
|
|
476
|
+
if (!isJSONObject(data)) {
|
|
477
|
+
throw new TypeError(
|
|
478
|
+
`Unmarshalling the type 'ValidateUserMFAOTPResponse' failed as data isn't a dictionary.`
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
return {
|
|
482
|
+
recoveryCodes: data.recovery_codes
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
const marshalAddGroupMemberRequest = (request, defaults) => ({
|
|
486
|
+
...resolveOneOf([
|
|
487
|
+
{ param: "user_id", value: request.userId },
|
|
488
|
+
{ param: "application_id", value: request.applicationId }
|
|
489
|
+
])
|
|
490
|
+
});
|
|
491
|
+
const marshalAddGroupMembersRequest = (request, defaults) => ({
|
|
492
|
+
application_ids: request.applicationIds,
|
|
493
|
+
user_ids: request.userIds
|
|
494
|
+
});
|
|
495
|
+
const marshalCreateAPIKeyRequest = (request, defaults) => ({
|
|
496
|
+
default_project_id: request.defaultProjectId,
|
|
497
|
+
description: request.description,
|
|
498
|
+
expires_at: request.expiresAt,
|
|
499
|
+
...resolveOneOf([
|
|
500
|
+
{ param: "application_id", value: request.applicationId },
|
|
501
|
+
{ param: "user_id", value: request.userId }
|
|
502
|
+
])
|
|
503
|
+
});
|
|
504
|
+
const marshalCreateApplicationRequest = (request, defaults) => ({
|
|
505
|
+
description: request.description,
|
|
506
|
+
name: request.name || randomName("app"),
|
|
507
|
+
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
|
|
508
|
+
tags: request.tags
|
|
509
|
+
});
|
|
510
|
+
const marshalCreateGroupRequest = (request, defaults) => ({
|
|
511
|
+
description: request.description,
|
|
512
|
+
name: request.name || randomName("grp"),
|
|
513
|
+
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
|
|
514
|
+
tags: request.tags
|
|
515
|
+
});
|
|
516
|
+
const marshalCreateJWTRequest = (request, defaults) => ({
|
|
517
|
+
referrer: request.referrer,
|
|
518
|
+
user_id: request.userId
|
|
519
|
+
});
|
|
520
|
+
const marshalRuleSpecs = (request, defaults) => ({
|
|
521
|
+
condition: request.condition,
|
|
522
|
+
permission_set_names: request.permissionSetNames,
|
|
523
|
+
...resolveOneOf([
|
|
524
|
+
{ param: "project_ids", value: request.projectIds },
|
|
525
|
+
{ param: "organization_id", value: request.organizationId }
|
|
526
|
+
])
|
|
527
|
+
});
|
|
528
|
+
const marshalCreatePolicyRequest = (request, defaults) => ({
|
|
529
|
+
description: request.description,
|
|
530
|
+
name: request.name || randomName("pol"),
|
|
531
|
+
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
|
|
532
|
+
rules: request.rules !== void 0 ? request.rules.map((elt) => marshalRuleSpecs(elt)) : void 0,
|
|
533
|
+
tags: request.tags,
|
|
534
|
+
...resolveOneOf([
|
|
535
|
+
{ param: "user_id", value: request.userId },
|
|
536
|
+
{ param: "group_id", value: request.groupId },
|
|
537
|
+
{ param: "application_id", value: request.applicationId },
|
|
538
|
+
{ param: "no_principal", value: request.noPrincipal }
|
|
539
|
+
])
|
|
540
|
+
});
|
|
541
|
+
const marshalCreateSSHKeyRequest = (request, defaults) => ({
|
|
542
|
+
name: request.name || randomName("key"),
|
|
543
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
544
|
+
public_key: request.publicKey
|
|
545
|
+
});
|
|
546
|
+
const marshalCreateUserRequestMember = (request, defaults) => ({
|
|
547
|
+
email: request.email,
|
|
548
|
+
first_name: request.firstName,
|
|
549
|
+
last_name: request.lastName,
|
|
550
|
+
locale: request.locale,
|
|
551
|
+
password: request.password,
|
|
552
|
+
phone_number: request.phoneNumber,
|
|
553
|
+
send_password_email: request.sendPasswordEmail,
|
|
554
|
+
send_welcome_email: request.sendWelcomeEmail,
|
|
555
|
+
username: request.username
|
|
556
|
+
});
|
|
557
|
+
const marshalCreateUserRequest = (request, defaults) => ({
|
|
558
|
+
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
|
|
559
|
+
tags: request.tags,
|
|
560
|
+
...resolveOneOf([
|
|
561
|
+
{ param: "email", value: request.email },
|
|
562
|
+
{
|
|
563
|
+
param: "member",
|
|
564
|
+
value: request.member !== void 0 ? marshalCreateUserRequestMember(request.member) : void 0
|
|
565
|
+
}
|
|
566
|
+
])
|
|
567
|
+
});
|
|
568
|
+
const marshalRemoveGroupMemberRequest = (request, defaults) => ({
|
|
569
|
+
...resolveOneOf([
|
|
570
|
+
{ param: "user_id", value: request.userId },
|
|
571
|
+
{ param: "application_id", value: request.applicationId }
|
|
572
|
+
])
|
|
573
|
+
});
|
|
574
|
+
const marshalSetGroupMembersRequest = (request, defaults) => ({
|
|
575
|
+
application_ids: request.applicationIds,
|
|
576
|
+
user_ids: request.userIds
|
|
577
|
+
});
|
|
578
|
+
const marshalSetRulesRequest = (request, defaults) => ({
|
|
579
|
+
policy_id: request.policyId,
|
|
580
|
+
rules: request.rules.map((elt) => marshalRuleSpecs(elt))
|
|
581
|
+
});
|
|
582
|
+
const marshalUpdateAPIKeyRequest = (request, defaults) => ({
|
|
583
|
+
default_project_id: request.defaultProjectId,
|
|
584
|
+
description: request.description
|
|
585
|
+
});
|
|
586
|
+
const marshalUpdateApplicationRequest = (request, defaults) => ({
|
|
587
|
+
description: request.description,
|
|
588
|
+
name: request.name,
|
|
589
|
+
tags: request.tags
|
|
590
|
+
});
|
|
591
|
+
const marshalUpdateGroupRequest = (request, defaults) => ({
|
|
592
|
+
description: request.description,
|
|
593
|
+
name: request.name,
|
|
594
|
+
tags: request.tags
|
|
595
|
+
});
|
|
596
|
+
const marshalUpdateOrganizationSecuritySettingsRequest = (request, defaults) => ({
|
|
597
|
+
enforce_password_renewal: request.enforcePasswordRenewal,
|
|
598
|
+
grace_period_duration: request.gracePeriodDuration,
|
|
599
|
+
login_attempts_before_locked: request.loginAttemptsBeforeLocked
|
|
600
|
+
});
|
|
601
|
+
const marshalUpdatePolicyRequest = (request, defaults) => ({
|
|
602
|
+
description: request.description,
|
|
603
|
+
name: request.name,
|
|
604
|
+
tags: request.tags,
|
|
605
|
+
...resolveOneOf([
|
|
606
|
+
{ param: "user_id", value: request.userId },
|
|
607
|
+
{ param: "group_id", value: request.groupId },
|
|
608
|
+
{ param: "application_id", value: request.applicationId },
|
|
609
|
+
{ param: "no_principal", value: request.noPrincipal }
|
|
610
|
+
])
|
|
611
|
+
});
|
|
612
|
+
const marshalUpdateSSHKeyRequest = (request, defaults) => ({
|
|
613
|
+
disabled: request.disabled,
|
|
614
|
+
name: request.name
|
|
615
|
+
});
|
|
616
|
+
const marshalUpdateUserPasswordRequest = (request, defaults) => ({
|
|
617
|
+
password: request.password
|
|
618
|
+
});
|
|
619
|
+
const marshalUpdateUserRequest = (request, defaults) => ({
|
|
620
|
+
email: request.email,
|
|
621
|
+
first_name: request.firstName,
|
|
622
|
+
last_name: request.lastName,
|
|
623
|
+
locale: request.locale,
|
|
624
|
+
phone_number: request.phoneNumber,
|
|
625
|
+
tags: request.tags
|
|
626
|
+
});
|
|
627
|
+
const marshalUpdateUserUsernameRequest = (request, defaults) => ({
|
|
628
|
+
username: request.username
|
|
629
|
+
});
|
|
630
|
+
const marshalValidateUserMFAOTPRequest = (request, defaults) => ({
|
|
631
|
+
one_time_password: request.oneTimePassword
|
|
632
|
+
});
|
|
633
|
+
export {
|
|
634
|
+
marshalAddGroupMemberRequest,
|
|
635
|
+
marshalAddGroupMembersRequest,
|
|
636
|
+
marshalCreateAPIKeyRequest,
|
|
637
|
+
marshalCreateApplicationRequest,
|
|
638
|
+
marshalCreateGroupRequest,
|
|
639
|
+
marshalCreateJWTRequest,
|
|
640
|
+
marshalCreatePolicyRequest,
|
|
641
|
+
marshalCreateSSHKeyRequest,
|
|
642
|
+
marshalCreateUserRequest,
|
|
643
|
+
marshalRemoveGroupMemberRequest,
|
|
644
|
+
marshalSetGroupMembersRequest,
|
|
645
|
+
marshalSetRulesRequest,
|
|
646
|
+
marshalUpdateAPIKeyRequest,
|
|
647
|
+
marshalUpdateApplicationRequest,
|
|
648
|
+
marshalUpdateGroupRequest,
|
|
649
|
+
marshalUpdateOrganizationSecuritySettingsRequest,
|
|
650
|
+
marshalUpdatePolicyRequest,
|
|
651
|
+
marshalUpdateSSHKeyRequest,
|
|
652
|
+
marshalUpdateUserPasswordRequest,
|
|
653
|
+
marshalUpdateUserRequest,
|
|
654
|
+
marshalUpdateUserUsernameRequest,
|
|
655
|
+
marshalValidateUserMFAOTPRequest,
|
|
656
|
+
unmarshalAPIKey,
|
|
657
|
+
unmarshalApplication,
|
|
658
|
+
unmarshalEncodedJWT,
|
|
659
|
+
unmarshalGetUserConnectionsResponse,
|
|
660
|
+
unmarshalGroup,
|
|
661
|
+
unmarshalJWT,
|
|
662
|
+
unmarshalListAPIKeysResponse,
|
|
663
|
+
unmarshalListApplicationsResponse,
|
|
664
|
+
unmarshalListGracePeriodsResponse,
|
|
665
|
+
unmarshalListGroupsResponse,
|
|
666
|
+
unmarshalListJWTsResponse,
|
|
667
|
+
unmarshalListLogsResponse,
|
|
668
|
+
unmarshalListPermissionSetsResponse,
|
|
669
|
+
unmarshalListPoliciesResponse,
|
|
670
|
+
unmarshalListQuotaResponse,
|
|
671
|
+
unmarshalListRulesResponse,
|
|
672
|
+
unmarshalListSSHKeysResponse,
|
|
673
|
+
unmarshalListUsersResponse,
|
|
674
|
+
unmarshalLog,
|
|
675
|
+
unmarshalMFAOTP,
|
|
676
|
+
unmarshalOrganizationSecuritySettings,
|
|
677
|
+
unmarshalPolicy,
|
|
678
|
+
unmarshalQuotum,
|
|
679
|
+
unmarshalSSHKey,
|
|
680
|
+
unmarshalSetRulesResponse,
|
|
681
|
+
unmarshalUser,
|
|
682
|
+
unmarshalValidateUserMFAOTPResponse
|
|
683
|
+
};
|