@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.
@@ -0,0 +1,1000 @@
1
+ import { API as API$1, urlParams, enrichForPagination, validatePathParam, resolveOneOf } from "@scaleway/sdk-client";
2
+ import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHKey, marshalUpdateSSHKeyRequest, unmarshalListUsersResponse, unmarshalUser, marshalUpdateUserRequest, marshalCreateUserRequest, marshalUpdateUserUsernameRequest, marshalUpdateUserPasswordRequest, unmarshalMFAOTP, marshalValidateUserMFAOTPRequest, unmarshalValidateUserMFAOTPResponse, unmarshalListGracePeriodsResponse, unmarshalGetUserConnectionsResponse, unmarshalListApplicationsResponse, marshalCreateApplicationRequest, unmarshalApplication, marshalUpdateApplicationRequest, unmarshalListGroupsResponse, marshalCreateGroupRequest, unmarshalGroup, marshalUpdateGroupRequest, marshalSetGroupMembersRequest, marshalAddGroupMemberRequest, marshalAddGroupMembersRequest, marshalRemoveGroupMemberRequest, unmarshalListPoliciesResponse, marshalCreatePolicyRequest, unmarshalPolicy, marshalUpdatePolicyRequest, marshalSetRulesRequest, unmarshalSetRulesResponse, unmarshalListRulesResponse, unmarshalListPermissionSetsResponse, unmarshalListAPIKeysResponse, marshalCreateAPIKeyRequest, unmarshalAPIKey, marshalUpdateAPIKeyRequest, unmarshalListQuotaResponse, unmarshalQuotum, unmarshalListJWTsResponse, marshalCreateJWTRequest, unmarshalEncodedJWT, unmarshalJWT, unmarshalListLogsResponse, unmarshalLog, unmarshalOrganizationSecuritySettings, marshalUpdateOrganizationSecuritySettingsRequest } from "./marshalling.gen.js";
3
+ const jsonContentHeaders = {
4
+ "Content-Type": "application/json; charset=utf-8"
5
+ };
6
+ class API extends API$1 {
7
+ pageOfListSSHKeys = (request = {}) => this.client.fetch(
8
+ {
9
+ method: "GET",
10
+ path: `/iam/v1alpha1/ssh-keys`,
11
+ urlParams: urlParams(
12
+ ["disabled", request.disabled],
13
+ ["name", request.name],
14
+ ["order_by", request.orderBy],
15
+ ["organization_id", request.organizationId],
16
+ ["page", request.page],
17
+ [
18
+ "page_size",
19
+ request.pageSize ?? this.client.settings.defaultPageSize
20
+ ],
21
+ ["project_id", request.projectId]
22
+ )
23
+ },
24
+ unmarshalListSSHKeysResponse
25
+ );
26
+ /**
27
+ * List SSH keys. List SSH keys. By default, the SSH keys listed are ordered by creation date in ascending order. This can be modified via the `order_by` field. You can define additional parameters for your query such as `organization_id`, `name`, `project_id` and `disabled`.
28
+ *
29
+ * @param request - The request {@link ListSSHKeysRequest}
30
+ * @returns A Promise of ListSSHKeysResponse
31
+ */
32
+ listSSHKeys = (request = {}) => enrichForPagination("sshKeys", this.pageOfListSSHKeys, request);
33
+ /**
34
+ * Create an SSH key. Add a new SSH key to a Scaleway Project. You must specify the `name`, `public_key` and `project_id`.
35
+ *
36
+ * @param request - The request {@link CreateSSHKeyRequest}
37
+ * @returns A Promise of SSHKey
38
+ */
39
+ createSSHKey = (request) => this.client.fetch(
40
+ {
41
+ body: JSON.stringify(
42
+ marshalCreateSSHKeyRequest(request, this.client.settings)
43
+ ),
44
+ headers: jsonContentHeaders,
45
+ method: "POST",
46
+ path: `/iam/v1alpha1/ssh-keys`
47
+ },
48
+ unmarshalSSHKey
49
+ );
50
+ /**
51
+ * Get an SSH key. Retrieve information about a given SSH key, specified by the `ssh_key_id` parameter. The SSH key's full details, including `id`, `name`, `public_key`, and `project_id` are returned in the response.
52
+ *
53
+ * @param request - The request {@link GetSSHKeyRequest}
54
+ * @returns A Promise of SSHKey
55
+ */
56
+ getSSHKey = (request) => this.client.fetch(
57
+ {
58
+ method: "GET",
59
+ path: `/iam/v1alpha1/ssh-keys/${validatePathParam("sshKeyId", request.sshKeyId)}`
60
+ },
61
+ unmarshalSSHKey
62
+ );
63
+ /**
64
+ * Update an SSH key. Update the parameters of an SSH key, including `name` and `disable`.
65
+ *
66
+ * @param request - The request {@link UpdateSSHKeyRequest}
67
+ * @returns A Promise of SSHKey
68
+ */
69
+ updateSSHKey = (request) => this.client.fetch(
70
+ {
71
+ body: JSON.stringify(
72
+ marshalUpdateSSHKeyRequest(request, this.client.settings)
73
+ ),
74
+ headers: jsonContentHeaders,
75
+ method: "PATCH",
76
+ path: `/iam/v1alpha1/ssh-keys/${validatePathParam("sshKeyId", request.sshKeyId)}`
77
+ },
78
+ unmarshalSSHKey
79
+ );
80
+ /**
81
+ * Delete an SSH key. Delete a given SSH key, specified by the `ssh_key_id`. Deleting an SSH is permanent, and cannot be undone. Note that you might need to update any configurations that used the SSH key.
82
+ *
83
+ * @param request - The request {@link DeleteSSHKeyRequest}
84
+ */
85
+ deleteSSHKey = (request) => this.client.fetch({
86
+ method: "DELETE",
87
+ path: `/iam/v1alpha1/ssh-keys/${validatePathParam("sshKeyId", request.sshKeyId)}`
88
+ });
89
+ pageOfListUsers = (request = {}) => this.client.fetch(
90
+ {
91
+ method: "GET",
92
+ path: `/iam/v1alpha1/users`,
93
+ urlParams: urlParams(
94
+ ["mfa", request.mfa],
95
+ ["order_by", request.orderBy],
96
+ [
97
+ "organization_id",
98
+ request.organizationId ?? this.client.settings.defaultOrganizationId
99
+ ],
100
+ ["page", request.page],
101
+ [
102
+ "page_size",
103
+ request.pageSize ?? this.client.settings.defaultPageSize
104
+ ],
105
+ ["tag", request.tag],
106
+ ["type", request.type],
107
+ ["user_ids", request.userIds]
108
+ )
109
+ },
110
+ unmarshalListUsersResponse
111
+ );
112
+ /**
113
+ * List users of an Organization. List the users of an Organization. By default, the users listed are ordered by creation date in ascending order. This can be modified via the `order_by` field. You must define the `organization_id` in the query path of your request. You can also define additional parameters for your query such as `user_ids`.
114
+ *
115
+ * @param request - The request {@link ListUsersRequest}
116
+ * @returns A Promise of ListUsersResponse
117
+ */
118
+ listUsers = (request = {}) => enrichForPagination("users", this.pageOfListUsers, request);
119
+ /**
120
+ * Get a given user. Retrieve information about a user, specified by the `user_id` parameter. The user's full details, including `id`, `email`, `organization_id`, `status` and `mfa` are returned in the response.
121
+ *
122
+ * @param request - The request {@link GetUserRequest}
123
+ * @returns A Promise of User
124
+ */
125
+ getUser = (request) => this.client.fetch(
126
+ {
127
+ method: "GET",
128
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}`
129
+ },
130
+ unmarshalUser
131
+ );
132
+ /**
133
+ * Update a user. Update the parameters of a user, including `tags`.
134
+ *
135
+ * @param request - The request {@link UpdateUserRequest}
136
+ * @returns A Promise of User
137
+ */
138
+ updateUser = (request) => this.client.fetch(
139
+ {
140
+ body: JSON.stringify(
141
+ marshalUpdateUserRequest(request, this.client.settings)
142
+ ),
143
+ headers: jsonContentHeaders,
144
+ method: "PATCH",
145
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}`
146
+ },
147
+ unmarshalUser
148
+ );
149
+ /**
150
+ * Delete a guest user from an Organization. Remove a user from an Organization in which they are a guest. You must define the `user_id` in your request. Note that removing a user from an Organization automatically deletes their API keys, and any policies directly attached to them become orphaned.
151
+ *
152
+ * @param request - The request {@link DeleteUserRequest}
153
+ */
154
+ deleteUser = (request) => this.client.fetch({
155
+ method: "DELETE",
156
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}`
157
+ });
158
+ /**
159
+ * Create a new user. Create a new user. You must define the `organization_id` in your request. If you are adding a member, enter the member's details. If you are adding a guest, you must define the `email` and not add the member attribute.
160
+ *
161
+ * @param request - The request {@link CreateUserRequest}
162
+ * @returns A Promise of User
163
+ */
164
+ createUser = (request = {}) => this.client.fetch(
165
+ {
166
+ body: JSON.stringify(
167
+ marshalCreateUserRequest(request, this.client.settings)
168
+ ),
169
+ headers: jsonContentHeaders,
170
+ method: "POST",
171
+ path: `/iam/v1alpha1/users`
172
+ },
173
+ unmarshalUser
174
+ );
175
+ /**
176
+ * Update an user's username.. Update an user's username.
177
+ *
178
+ * @param request - The request {@link UpdateUserUsernameRequest}
179
+ * @returns A Promise of User
180
+ */
181
+ updateUserUsername = (request) => this.client.fetch(
182
+ {
183
+ body: JSON.stringify(
184
+ marshalUpdateUserUsernameRequest(request, this.client.settings)
185
+ ),
186
+ headers: jsonContentHeaders,
187
+ method: "POST",
188
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}/update-username`
189
+ },
190
+ unmarshalUser
191
+ );
192
+ /**
193
+ * Update an user's password.. Update an user's password.
194
+ *
195
+ * @param request - The request {@link UpdateUserPasswordRequest}
196
+ * @returns A Promise of User
197
+ */
198
+ updateUserPassword = (request) => this.client.fetch(
199
+ {
200
+ body: JSON.stringify(
201
+ marshalUpdateUserPasswordRequest(request, this.client.settings)
202
+ ),
203
+ headers: jsonContentHeaders,
204
+ method: "POST",
205
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}/update-password`
206
+ },
207
+ unmarshalUser
208
+ );
209
+ /**
210
+ * Create a MFA OTP.. Create a MFA OTP.
211
+ *
212
+ * @param request - The request {@link CreateUserMFAOTPRequest}
213
+ * @returns A Promise of MFAOTP
214
+ */
215
+ createUserMFAOTP = (request) => this.client.fetch(
216
+ {
217
+ body: "{}",
218
+ headers: jsonContentHeaders,
219
+ method: "POST",
220
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}/mfa-otp`
221
+ },
222
+ unmarshalMFAOTP
223
+ );
224
+ /**
225
+ * Validate a MFA OTP.. Validate a MFA OTP.
226
+ *
227
+ * @param request - The request {@link ValidateUserMFAOTPRequest}
228
+ * @returns A Promise of ValidateUserMFAOTPResponse
229
+ */
230
+ validateUserMFAOTP = (request) => this.client.fetch(
231
+ {
232
+ body: JSON.stringify(
233
+ marshalValidateUserMFAOTPRequest(request, this.client.settings)
234
+ ),
235
+ headers: jsonContentHeaders,
236
+ method: "POST",
237
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}/validate-mfa-otp`
238
+ },
239
+ unmarshalValidateUserMFAOTPResponse
240
+ );
241
+ /**
242
+ * Delete a MFA OTP.. Delete a MFA OTP.
243
+ *
244
+ * @param request - The request {@link DeleteUserMFAOTPRequest}
245
+ */
246
+ deleteUserMFAOTP = (request) => this.client.fetch({
247
+ body: "{}",
248
+ headers: jsonContentHeaders,
249
+ method: "DELETE",
250
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}/mfa-otp`
251
+ });
252
+ /**
253
+ * Lock a member. Lock a member. A locked member cannot log in or use API keys until the locked status is removed.
254
+ *
255
+ * @param request - The request {@link LockUserRequest}
256
+ * @returns A Promise of User
257
+ */
258
+ lockUser = (request) => this.client.fetch(
259
+ {
260
+ body: "{}",
261
+ headers: jsonContentHeaders,
262
+ method: "POST",
263
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}/lock`
264
+ },
265
+ unmarshalUser
266
+ );
267
+ /**
268
+ * Unlock a member.
269
+ *
270
+ * @param request - The request {@link UnlockUserRequest}
271
+ * @returns A Promise of User
272
+ */
273
+ unlockUser = (request) => this.client.fetch(
274
+ {
275
+ body: "{}",
276
+ headers: jsonContentHeaders,
277
+ method: "POST",
278
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}/unlock`
279
+ },
280
+ unmarshalUser
281
+ );
282
+ /**
283
+ * List grace periods of a member. List the grace periods of a member.
284
+ *
285
+ * @param request - The request {@link ListGracePeriodsRequest}
286
+ * @returns A Promise of ListGracePeriodsResponse
287
+ */
288
+ listGracePeriods = (request = {}) => this.client.fetch(
289
+ {
290
+ method: "GET",
291
+ path: `/iam/v1alpha1/grace-periods`,
292
+ urlParams: urlParams(["user_id", request.userId])
293
+ },
294
+ unmarshalListGracePeriodsResponse
295
+ );
296
+ getUserConnections = (request) => this.client.fetch(
297
+ {
298
+ method: "GET",
299
+ path: `/iam/v1alpha1/users/${validatePathParam("userId", request.userId)}/connections`
300
+ },
301
+ unmarshalGetUserConnectionsResponse
302
+ );
303
+ pageOfListApplications = (request = {}) => this.client.fetch(
304
+ {
305
+ method: "GET",
306
+ path: `/iam/v1alpha1/applications`,
307
+ urlParams: urlParams(
308
+ ["application_ids", request.applicationIds],
309
+ ["editable", request.editable],
310
+ ["name", request.name],
311
+ ["order_by", request.orderBy],
312
+ [
313
+ "organization_id",
314
+ request.organizationId ?? this.client.settings.defaultOrganizationId
315
+ ],
316
+ ["page", request.page],
317
+ [
318
+ "page_size",
319
+ request.pageSize ?? this.client.settings.defaultPageSize
320
+ ],
321
+ ["tag", request.tag]
322
+ )
323
+ },
324
+ unmarshalListApplicationsResponse
325
+ );
326
+ /**
327
+ * List applications of an Organization. List the applications of an Organization. By default, the applications listed are ordered by creation date in ascending order. This can be modified via the `order_by` field. You must define the `organization_id` in the query path of your request. You can also define additional parameters for your query such as `application_ids`.
328
+ *
329
+ * @param request - The request {@link ListApplicationsRequest}
330
+ * @returns A Promise of ListApplicationsResponse
331
+ */
332
+ listApplications = (request = {}) => enrichForPagination("applications", this.pageOfListApplications, request);
333
+ /**
334
+ * Create a new application. Create a new application. You must define the `name` parameter in the request.
335
+ *
336
+ * @param request - The request {@link CreateApplicationRequest}
337
+ * @returns A Promise of Application
338
+ */
339
+ createApplication = (request) => this.client.fetch(
340
+ {
341
+ body: JSON.stringify(
342
+ marshalCreateApplicationRequest(request, this.client.settings)
343
+ ),
344
+ headers: jsonContentHeaders,
345
+ method: "POST",
346
+ path: `/iam/v1alpha1/applications`
347
+ },
348
+ unmarshalApplication
349
+ );
350
+ /**
351
+ * Get a given application. Retrieve information about an application, specified by the `application_id` parameter. The application's full details, including `id`, `email`, `organization_id`, `status` and `two_factor_enabled` are returned in the response.
352
+ *
353
+ * @param request - The request {@link GetApplicationRequest}
354
+ * @returns A Promise of Application
355
+ */
356
+ getApplication = (request) => this.client.fetch(
357
+ {
358
+ method: "GET",
359
+ path: `/iam/v1alpha1/applications/${validatePathParam("applicationId", request.applicationId)}`
360
+ },
361
+ unmarshalApplication
362
+ );
363
+ /**
364
+ * Update an application. Update the parameters of an application, including `name` and `description`.
365
+ *
366
+ * @param request - The request {@link UpdateApplicationRequest}
367
+ * @returns A Promise of Application
368
+ */
369
+ updateApplication = (request) => this.client.fetch(
370
+ {
371
+ body: JSON.stringify(
372
+ marshalUpdateApplicationRequest(request, this.client.settings)
373
+ ),
374
+ headers: jsonContentHeaders,
375
+ method: "PATCH",
376
+ path: `/iam/v1alpha1/applications/${validatePathParam("applicationId", request.applicationId)}`
377
+ },
378
+ unmarshalApplication
379
+ );
380
+ /**
381
+ * Delete an application. Delete an application. Note that this action is irreversible and will automatically delete the application's API keys. Policies attached to users and applications via this group will no longer apply.
382
+ *
383
+ * @param request - The request {@link DeleteApplicationRequest}
384
+ */
385
+ deleteApplication = (request) => this.client.fetch({
386
+ method: "DELETE",
387
+ path: `/iam/v1alpha1/applications/${validatePathParam("applicationId", request.applicationId)}`
388
+ });
389
+ pageOfListGroups = (request = {}) => this.client.fetch(
390
+ {
391
+ method: "GET",
392
+ path: `/iam/v1alpha1/groups`,
393
+ urlParams: urlParams(
394
+ ["application_ids", request.applicationIds],
395
+ ["group_ids", request.groupIds],
396
+ ["name", request.name],
397
+ ["order_by", request.orderBy],
398
+ [
399
+ "organization_id",
400
+ request.organizationId ?? this.client.settings.defaultOrganizationId
401
+ ],
402
+ ["page", request.page],
403
+ [
404
+ "page_size",
405
+ request.pageSize ?? this.client.settings.defaultPageSize
406
+ ],
407
+ ["tag", request.tag],
408
+ ["user_ids", request.userIds]
409
+ )
410
+ },
411
+ unmarshalListGroupsResponse
412
+ );
413
+ /**
414
+ * List groups. List groups. By default, the groups listed are ordered by creation date in ascending order. This can be modified via the `order_by` field. You can define additional parameters to filter your query. Use `user_ids` or `application_ids` to list all groups certain users or applications belong to.
415
+ *
416
+ * @param request - The request {@link ListGroupsRequest}
417
+ * @returns A Promise of ListGroupsResponse
418
+ */
419
+ listGroups = (request = {}) => enrichForPagination("groups", this.pageOfListGroups, request);
420
+ /**
421
+ * Create a group. Create a new group. You must define the `name` and `organization_id` parameters in the request.
422
+ *
423
+ * @param request - The request {@link CreateGroupRequest}
424
+ * @returns A Promise of Group
425
+ */
426
+ createGroup = (request) => this.client.fetch(
427
+ {
428
+ body: JSON.stringify(
429
+ marshalCreateGroupRequest(request, this.client.settings)
430
+ ),
431
+ headers: jsonContentHeaders,
432
+ method: "POST",
433
+ path: `/iam/v1alpha1/groups`
434
+ },
435
+ unmarshalGroup
436
+ );
437
+ /**
438
+ * Get a group. Retrieve information about a given group, specified by the `group_id` parameter. The group's full details, including `user_ids` and `application_ids` are returned in the response.
439
+ *
440
+ * @param request - The request {@link GetGroupRequest}
441
+ * @returns A Promise of Group
442
+ */
443
+ getGroup = (request) => this.client.fetch(
444
+ {
445
+ method: "GET",
446
+ path: `/iam/v1alpha1/groups/${validatePathParam("groupId", request.groupId)}`
447
+ },
448
+ unmarshalGroup
449
+ );
450
+ /**
451
+ * Update a group. Update the parameters of group, including `name` and `description`.
452
+ *
453
+ * @param request - The request {@link UpdateGroupRequest}
454
+ * @returns A Promise of Group
455
+ */
456
+ updateGroup = (request) => this.client.fetch(
457
+ {
458
+ body: JSON.stringify(
459
+ marshalUpdateGroupRequest(request, this.client.settings)
460
+ ),
461
+ headers: jsonContentHeaders,
462
+ method: "PATCH",
463
+ path: `/iam/v1alpha1/groups/${validatePathParam("groupId", request.groupId)}`
464
+ },
465
+ unmarshalGroup
466
+ );
467
+ /**
468
+ * Overwrite users and applications of a group. Overwrite users and applications configuration in a group. Any information that you add using this command will overwrite the previous configuration.
469
+ *
470
+ * @param request - The request {@link SetGroupMembersRequest}
471
+ * @returns A Promise of Group
472
+ */
473
+ setGroupMembers = (request) => this.client.fetch(
474
+ {
475
+ body: JSON.stringify(
476
+ marshalSetGroupMembersRequest(request, this.client.settings)
477
+ ),
478
+ headers: jsonContentHeaders,
479
+ method: "PUT",
480
+ path: `/iam/v1alpha1/groups/${validatePathParam("groupId", request.groupId)}/members`
481
+ },
482
+ unmarshalGroup
483
+ );
484
+ /**
485
+ * Add a user or an application to a group. Add a user or an application to a group. You can specify a `user_id` and `application_id` in the body of your request. Note that you can only add one of each per request.
486
+ *
487
+ * @param request - The request {@link AddGroupMemberRequest}
488
+ * @returns A Promise of Group
489
+ */
490
+ addGroupMember = (request) => this.client.fetch(
491
+ {
492
+ body: JSON.stringify(
493
+ marshalAddGroupMemberRequest(request, this.client.settings)
494
+ ),
495
+ headers: jsonContentHeaders,
496
+ method: "POST",
497
+ path: `/iam/v1alpha1/groups/${validatePathParam("groupId", request.groupId)}/add-member`
498
+ },
499
+ unmarshalGroup
500
+ );
501
+ /**
502
+ * Add multiple users and applications to a group. Add multiple users and applications to a group in a single call. You can specify an array of `user_id`s and `application_id`s. Note that any existing users and applications in the group will remain. To add new users/applications and delete pre-existing ones, use the [Overwrite users and applications of a group](#path-groups-overwrite-users-and-applications-of-a-group) method.
503
+ *
504
+ * @param request - The request {@link AddGroupMembersRequest}
505
+ * @returns A Promise of Group
506
+ */
507
+ addGroupMembers = (request) => this.client.fetch(
508
+ {
509
+ body: JSON.stringify(
510
+ marshalAddGroupMembersRequest(request, this.client.settings)
511
+ ),
512
+ headers: jsonContentHeaders,
513
+ method: "POST",
514
+ path: `/iam/v1alpha1/groups/${validatePathParam("groupId", request.groupId)}/add-members`
515
+ },
516
+ unmarshalGroup
517
+ );
518
+ /**
519
+ * Remove a user or an application from a group. Remove a user or an application from a group. You can specify a `user_id` and `application_id` in the body of your request. Note that you can only remove one of each per request. Removing a user from a group means that any permissions given to them via the group (i.e. from an attached policy) will no longer apply. Be sure you want to remove these permissions from the user before proceeding.
520
+ *
521
+ * @param request - The request {@link RemoveGroupMemberRequest}
522
+ * @returns A Promise of Group
523
+ */
524
+ removeGroupMember = (request) => this.client.fetch(
525
+ {
526
+ body: JSON.stringify(
527
+ marshalRemoveGroupMemberRequest(request, this.client.settings)
528
+ ),
529
+ headers: jsonContentHeaders,
530
+ method: "POST",
531
+ path: `/iam/v1alpha1/groups/${validatePathParam("groupId", request.groupId)}/remove-member`
532
+ },
533
+ unmarshalGroup
534
+ );
535
+ /**
536
+ * Delete a group. Delete a group. Note that this action is irreversible and could delete permissions for group members. Policies attached to users and applications via this group will no longer apply.
537
+ *
538
+ * @param request - The request {@link DeleteGroupRequest}
539
+ */
540
+ deleteGroup = (request) => this.client.fetch({
541
+ method: "DELETE",
542
+ path: `/iam/v1alpha1/groups/${validatePathParam("groupId", request.groupId)}`
543
+ });
544
+ pageOfListPolicies = (request = {}) => this.client.fetch(
545
+ {
546
+ method: "GET",
547
+ path: `/iam/v1alpha1/policies`,
548
+ urlParams: urlParams(
549
+ ["application_ids", request.applicationIds],
550
+ ["editable", request.editable],
551
+ ["group_ids", request.groupIds],
552
+ ["no_principal", request.noPrincipal],
553
+ ["order_by", request.orderBy],
554
+ [
555
+ "organization_id",
556
+ request.organizationId ?? this.client.settings.defaultOrganizationId
557
+ ],
558
+ ["page", request.page],
559
+ [
560
+ "page_size",
561
+ request.pageSize ?? this.client.settings.defaultPageSize
562
+ ],
563
+ ["policy_ids", request.policyIds],
564
+ ["policy_name", request.policyName],
565
+ ["tag", request.tag],
566
+ ["user_ids", request.userIds]
567
+ )
568
+ },
569
+ unmarshalListPoliciesResponse
570
+ );
571
+ /**
572
+ * List policies of an Organization. List the policies of an Organization. By default, the policies listed are ordered by creation date in ascending order. This can be modified via the `order_by` field. You must define the `organization_id` in the query path of your request. You can also define additional parameters to filter your query, such as `user_ids`, `groups_ids`, `application_ids`, and `policy_name`.
573
+ *
574
+ * @param request - The request {@link ListPoliciesRequest}
575
+ * @returns A Promise of ListPoliciesResponse
576
+ */
577
+ listPolicies = (request = {}) => enrichForPagination("policies", this.pageOfListPolicies, request);
578
+ /**
579
+ * Create a new policy. Create a new application. You must define the `name` parameter in the request. You can specify parameters such as `user_id`, `groups_id`, `application_id`, `no_principal`, `rules` and its child attributes.
580
+ *
581
+ * @param request - The request {@link CreatePolicyRequest}
582
+ * @returns A Promise of Policy
583
+ */
584
+ createPolicy = (request) => this.client.fetch(
585
+ {
586
+ body: JSON.stringify(
587
+ marshalCreatePolicyRequest(request, this.client.settings)
588
+ ),
589
+ headers: jsonContentHeaders,
590
+ method: "POST",
591
+ path: `/iam/v1alpha1/policies`
592
+ },
593
+ unmarshalPolicy
594
+ );
595
+ /**
596
+ * Get an existing policy. Retrieve information about a policy, speficified by the `policy_id` parameter. The policy's full details, including `id`, `name`, `organization_id`, `nb_rules` and `nb_scopes`, `nb_permission_sets` are returned in the response.
597
+ *
598
+ * @param request - The request {@link GetPolicyRequest}
599
+ * @returns A Promise of Policy
600
+ */
601
+ getPolicy = (request) => this.client.fetch(
602
+ {
603
+ method: "GET",
604
+ path: `/iam/v1alpha1/policies/${validatePathParam("policyId", request.policyId)}`
605
+ },
606
+ unmarshalPolicy
607
+ );
608
+ /**
609
+ * Update an existing policy. Update the parameters of a policy, including `name`, `description`, `user_id`, `group_id`, `application_id` and `no_principal`.
610
+ *
611
+ * @param request - The request {@link UpdatePolicyRequest}
612
+ * @returns A Promise of Policy
613
+ */
614
+ updatePolicy = (request) => this.client.fetch(
615
+ {
616
+ body: JSON.stringify(
617
+ marshalUpdatePolicyRequest(request, this.client.settings)
618
+ ),
619
+ headers: jsonContentHeaders,
620
+ method: "PATCH",
621
+ path: `/iam/v1alpha1/policies/${validatePathParam("policyId", request.policyId)}`
622
+ },
623
+ unmarshalPolicy
624
+ );
625
+ /**
626
+ * Delete a policy. Delete a policy. You must define specify the `policy_id` parameter in your request. Note that when deleting a policy, all permissions it gives to its principal (user, group or application) will be revoked.
627
+ *
628
+ * @param request - The request {@link DeletePolicyRequest}
629
+ */
630
+ deletePolicy = (request) => this.client.fetch({
631
+ method: "DELETE",
632
+ path: `/iam/v1alpha1/policies/${validatePathParam("policyId", request.policyId)}`
633
+ });
634
+ /**
635
+ * Clone a policy. Clone a policy. You must define specify the `policy_id` parameter in your request.
636
+ *
637
+ * @param request - The request {@link ClonePolicyRequest}
638
+ * @returns A Promise of Policy
639
+ */
640
+ clonePolicy = (request) => this.client.fetch(
641
+ {
642
+ body: "{}",
643
+ headers: jsonContentHeaders,
644
+ method: "POST",
645
+ path: `/iam/v1alpha1/policies/${validatePathParam("policyId", request.policyId)}/clone`
646
+ },
647
+ unmarshalPolicy
648
+ );
649
+ /**
650
+ * Set rules of a given policy. Overwrite the rules of a given policy. Any information that you add using this command will overwrite the previous configuration. If you include some of the rules you already had in your previous configuration in your new one, but you change their order, the new order of display will apply. While policy rules are ordered, they have no impact on the access logic of IAM because rules are allow-only.
651
+ *
652
+ * @param request - The request {@link SetRulesRequest}
653
+ * @returns A Promise of SetRulesResponse
654
+ */
655
+ setRules = (request) => this.client.fetch(
656
+ {
657
+ body: JSON.stringify(
658
+ marshalSetRulesRequest(request, this.client.settings)
659
+ ),
660
+ headers: jsonContentHeaders,
661
+ method: "PUT",
662
+ path: `/iam/v1alpha1/rules`
663
+ },
664
+ unmarshalSetRulesResponse
665
+ );
666
+ pageOfListRules = (request) => this.client.fetch(
667
+ {
668
+ method: "GET",
669
+ path: `/iam/v1alpha1/rules`,
670
+ urlParams: urlParams(
671
+ ["page", request.page],
672
+ [
673
+ "page_size",
674
+ request.pageSize ?? this.client.settings.defaultPageSize
675
+ ],
676
+ ["policy_id", request.policyId]
677
+ )
678
+ },
679
+ unmarshalListRulesResponse
680
+ );
681
+ /**
682
+ * List rules of a given policy. List the rules of a given policy. By default, the rules listed are ordered by creation date in ascending order. This can be modified via the `order_by` field. You must define the `policy_id` in the query path of your request.
683
+ *
684
+ * @param request - The request {@link ListRulesRequest}
685
+ * @returns A Promise of ListRulesResponse
686
+ */
687
+ listRules = (request) => enrichForPagination("rules", this.pageOfListRules, request);
688
+ pageOfListPermissionSets = (request = {}) => this.client.fetch(
689
+ {
690
+ method: "GET",
691
+ path: `/iam/v1alpha1/permission-sets`,
692
+ urlParams: urlParams(
693
+ ["order_by", request.orderBy],
694
+ [
695
+ "organization_id",
696
+ request.organizationId ?? this.client.settings.defaultOrganizationId
697
+ ],
698
+ ["page", request.page],
699
+ [
700
+ "page_size",
701
+ request.pageSize ?? this.client.settings.defaultPageSize
702
+ ]
703
+ )
704
+ },
705
+ unmarshalListPermissionSetsResponse
706
+ );
707
+ /**
708
+ * List permission sets. List permission sets available for given Organization. You must define the `organization_id` in the query path of your request.
709
+ *
710
+ * @param request - The request {@link ListPermissionSetsRequest}
711
+ * @returns A Promise of ListPermissionSetsResponse
712
+ */
713
+ listPermissionSets = (request = {}) => enrichForPagination(
714
+ "permissionSets",
715
+ this.pageOfListPermissionSets,
716
+ request
717
+ );
718
+ pageOfListAPIKeys = (request = {}) => this.client.fetch(
719
+ {
720
+ method: "GET",
721
+ path: `/iam/v1alpha1/api-keys`,
722
+ urlParams: urlParams(
723
+ ["access_key", request.accessKey],
724
+ ["access_keys", request.accessKeys],
725
+ ["bearer_id", request.bearerId],
726
+ ["bearer_type", request.bearerType],
727
+ ["description", request.description],
728
+ ["editable", request.editable],
729
+ ["expired", request.expired],
730
+ ["order_by", request.orderBy],
731
+ [
732
+ "organization_id",
733
+ request.organizationId ?? this.client.settings.defaultOrganizationId
734
+ ],
735
+ ["page", request.page],
736
+ [
737
+ "page_size",
738
+ request.pageSize ?? this.client.settings.defaultPageSize
739
+ ],
740
+ ...Object.entries(
741
+ resolveOneOf([
742
+ { param: "application_id", value: request.applicationId },
743
+ { param: "user_id", value: request.userId }
744
+ ])
745
+ )
746
+ )
747
+ },
748
+ unmarshalListAPIKeysResponse
749
+ );
750
+ /**
751
+ * List API keys. List API keys. By default, the API keys listed are ordered by creation date in ascending order. This can be modified via the `order_by` field. You can define additional parameters for your query such as `editable`, `expired`, `access_key` and `bearer_id`.
752
+ *
753
+ * @param request - The request {@link ListAPIKeysRequest}
754
+ * @returns A Promise of ListAPIKeysResponse
755
+ */
756
+ listAPIKeys = (request = {}) => enrichForPagination("apiKeys", this.pageOfListAPIKeys, request);
757
+ /**
758
+ * Create an API key. Create an API key. You must specify the `application_id` or the `user_id` and the description. You can also specify the `default_project_id`, which is the Project ID of your preferred Project, to use with Object Storage. The `access_key` and `secret_key` values are returned in the response. Note that the secret key is only shown once. Make sure that you copy and store both keys somewhere safe.
759
+ *
760
+ * @param request - The request {@link CreateAPIKeyRequest}
761
+ * @returns A Promise of APIKey
762
+ */
763
+ createAPIKey = (request) => this.client.fetch(
764
+ {
765
+ body: JSON.stringify(
766
+ marshalCreateAPIKeyRequest(request, this.client.settings)
767
+ ),
768
+ headers: jsonContentHeaders,
769
+ method: "POST",
770
+ path: `/iam/v1alpha1/api-keys`
771
+ },
772
+ unmarshalAPIKey
773
+ );
774
+ /**
775
+ * Get an API key. Retrieve information about an API key, specified by the `access_key` parameter. The API key's details, including either the `user_id` or `application_id` of its bearer are returned in the response. Note that the string value for the `secret_key` is nullable, and therefore is not displayed in the response. The `secret_key` value is only displayed upon API key creation.
776
+ *
777
+ * @param request - The request {@link GetAPIKeyRequest}
778
+ * @returns A Promise of APIKey
779
+ */
780
+ getAPIKey = (request) => this.client.fetch(
781
+ {
782
+ method: "GET",
783
+ path: `/iam/v1alpha1/api-keys/${validatePathParam("accessKey", request.accessKey)}`
784
+ },
785
+ unmarshalAPIKey
786
+ );
787
+ /**
788
+ * Update an API key. Update the parameters of an API key, including `default_project_id` and `description`.
789
+ *
790
+ * @param request - The request {@link UpdateAPIKeyRequest}
791
+ * @returns A Promise of APIKey
792
+ */
793
+ updateAPIKey = (request) => this.client.fetch(
794
+ {
795
+ body: JSON.stringify(
796
+ marshalUpdateAPIKeyRequest(request, this.client.settings)
797
+ ),
798
+ headers: jsonContentHeaders,
799
+ method: "PATCH",
800
+ path: `/iam/v1alpha1/api-keys/${validatePathParam("accessKey", request.accessKey)}`
801
+ },
802
+ unmarshalAPIKey
803
+ );
804
+ /**
805
+ * Delete an API key. Delete an API key. Note that this action is irreversible and cannot be undone. Make sure you update any configurations using the API keys you delete.
806
+ *
807
+ * @param request - The request {@link DeleteAPIKeyRequest}
808
+ */
809
+ deleteAPIKey = (request) => this.client.fetch({
810
+ method: "DELETE",
811
+ path: `/iam/v1alpha1/api-keys/${validatePathParam("accessKey", request.accessKey)}`
812
+ });
813
+ pageOfListQuota = (request = {}) => this.client.fetch(
814
+ {
815
+ method: "GET",
816
+ path: `/iam/v1alpha1/quota`,
817
+ urlParams: urlParams(
818
+ ["order_by", request.orderBy],
819
+ [
820
+ "organization_id",
821
+ request.organizationId ?? this.client.settings.defaultOrganizationId
822
+ ],
823
+ ["page", request.page],
824
+ [
825
+ "page_size",
826
+ request.pageSize ?? this.client.settings.defaultPageSize
827
+ ],
828
+ ["quotum_names", request.quotumNames]
829
+ )
830
+ },
831
+ unmarshalListQuotaResponse
832
+ );
833
+ /**
834
+ * List all quotas in the Organization. List all product and features quota for an Organization, with their associated limits. By default, the quota listed are ordered by creation date in ascending order. This can be modified via the `order_by` field. You must define the `organization_id` in the query path of your request.
835
+ *
836
+ * @param request - The request {@link ListQuotaRequest}
837
+ * @returns A Promise of ListQuotaResponse
838
+ */
839
+ listQuota = (request = {}) => enrichForPagination("quota", this.pageOfListQuota, request);
840
+ /**
841
+ * Get a quota in the Organization. Retrieve information about a resource quota, specified by the `quotum_name` parameter. The quota's `limit`, or whether it is unlimited, is returned in the response.
842
+ *
843
+ * @param request - The request {@link GetQuotumRequest}
844
+ * @returns A Promise of Quotum
845
+ */
846
+ getQuotum = (request) => this.client.fetch(
847
+ {
848
+ method: "GET",
849
+ path: `/iam/v1alpha1/quota/${validatePathParam("quotumName", request.quotumName)}`,
850
+ urlParams: urlParams([
851
+ "organization_id",
852
+ request.organizationId ?? this.client.settings.defaultOrganizationId
853
+ ])
854
+ },
855
+ unmarshalQuotum
856
+ );
857
+ pageOfListJWTs = (request) => this.client.fetch(
858
+ {
859
+ method: "GET",
860
+ path: `/iam/v1alpha1/jwts`,
861
+ urlParams: urlParams(
862
+ ["audience_id", request.audienceId],
863
+ ["expired", request.expired],
864
+ ["order_by", request.orderBy],
865
+ ["page", request.page],
866
+ [
867
+ "page_size",
868
+ request.pageSize ?? this.client.settings.defaultPageSize
869
+ ]
870
+ )
871
+ },
872
+ unmarshalListJWTsResponse
873
+ );
874
+ /**
875
+ * List JWTs.
876
+ *
877
+ * @param request - The request {@link ListJWTsRequest}
878
+ * @returns A Promise of ListJWTsResponse
879
+ */
880
+ listJWTs = (request) => enrichForPagination("jwts", this.pageOfListJWTs, request);
881
+ /**
882
+ * Create a JWT.
883
+ *
884
+ * @param request - The request {@link CreateJWTRequest}
885
+ * @returns A Promise of EncodedJWT
886
+ */
887
+ createJWT = (request) => this.client.fetch(
888
+ {
889
+ body: JSON.stringify(
890
+ marshalCreateJWTRequest(request, this.client.settings)
891
+ ),
892
+ headers: jsonContentHeaders,
893
+ method: "POST",
894
+ path: `/iam/v1alpha1/jwts`
895
+ },
896
+ unmarshalEncodedJWT
897
+ );
898
+ /**
899
+ * Get a JWT.
900
+ *
901
+ * @param request - The request {@link GetJWTRequest}
902
+ * @returns A Promise of JWT
903
+ */
904
+ getJWT = (request) => this.client.fetch(
905
+ {
906
+ method: "GET",
907
+ path: `/iam/v1alpha1/jwts/${validatePathParam("jti", request.jti)}`
908
+ },
909
+ unmarshalJWT
910
+ );
911
+ /**
912
+ * Delete a JWT.
913
+ *
914
+ * @param request - The request {@link DeleteJWTRequest}
915
+ */
916
+ deleteJWT = (request) => this.client.fetch({
917
+ method: "DELETE",
918
+ path: `/iam/v1alpha1/jwts/${validatePathParam("jti", request.jti)}`
919
+ });
920
+ pageOfListLogs = (request = {}) => this.client.fetch(
921
+ {
922
+ method: "GET",
923
+ path: `/iam/v1alpha1/logs`,
924
+ urlParams: urlParams(
925
+ ["action", request.action],
926
+ ["created_after", request.createdAfter],
927
+ ["created_before", request.createdBefore],
928
+ ["order_by", request.orderBy],
929
+ [
930
+ "organization_id",
931
+ request.organizationId ?? this.client.settings.defaultOrganizationId
932
+ ],
933
+ ["page", request.page],
934
+ [
935
+ "page_size",
936
+ request.pageSize ?? this.client.settings.defaultPageSize
937
+ ],
938
+ ["resource_type", request.resourceType],
939
+ ["search", request.search]
940
+ )
941
+ },
942
+ unmarshalListLogsResponse
943
+ );
944
+ /**
945
+ * List logs. List logs available for given Organization. You must define the `organization_id` in the query path of your request.
946
+ *
947
+ * @param request - The request {@link ListLogsRequest}
948
+ * @returns A Promise of ListLogsResponse
949
+ */
950
+ listLogs = (request = {}) => enrichForPagination("logs", this.pageOfListLogs, request);
951
+ /**
952
+ * Get a log. Retrieve information about a log, specified by the `log_id` parameter. The log's full details, including `id`, `ip`, `user_agent`, `action`, `bearer_id`, `resource_type` and `resource_id` are returned in the response.
953
+ *
954
+ * @param request - The request {@link GetLogRequest}
955
+ * @returns A Promise of Log
956
+ */
957
+ getLog = (request) => this.client.fetch(
958
+ {
959
+ method: "GET",
960
+ path: `/iam/v1alpha1/logs/${validatePathParam("logId", request.logId)}`
961
+ },
962
+ unmarshalLog
963
+ );
964
+ /**
965
+ * Get security settings of an Organization. Retrieve information about the security settings of an Organization, specified by the `organization_id` parameter.
966
+ *
967
+ * @param request - The request {@link GetOrganizationSecuritySettingsRequest}
968
+ * @returns A Promise of OrganizationSecuritySettings
969
+ */
970
+ getOrganizationSecuritySettings = (request = {}) => this.client.fetch(
971
+ {
972
+ method: "GET",
973
+ path: `/iam/v1alpha1/organizations/${validatePathParam("organizationId", request.organizationId ?? this.client.settings.defaultOrganizationId)}/security-settings`
974
+ },
975
+ unmarshalOrganizationSecuritySettings
976
+ );
977
+ /**
978
+ * Update the security settings of an Organization.
979
+ *
980
+ * @param request - The request {@link UpdateOrganizationSecuritySettingsRequest}
981
+ * @returns A Promise of OrganizationSecuritySettings
982
+ */
983
+ updateOrganizationSecuritySettings = (request = {}) => this.client.fetch(
984
+ {
985
+ body: JSON.stringify(
986
+ marshalUpdateOrganizationSecuritySettingsRequest(
987
+ request,
988
+ this.client.settings
989
+ )
990
+ ),
991
+ headers: jsonContentHeaders,
992
+ method: "PATCH",
993
+ path: `/iam/v1alpha1/organizations/${validatePathParam("organizationId", request.organizationId ?? this.client.settings.defaultOrganizationId)}/security-settings`
994
+ },
995
+ unmarshalOrganizationSecuritySettings
996
+ );
997
+ }
998
+ export {
999
+ API
1000
+ };