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