-
Notifications
You must be signed in to change notification settings - Fork 385
/
Copy pathiam_client.h
745 lines (696 loc) · 35.9 KB
/
iam_client.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/iam/admin/v1/iam.proto
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_IAM_CLIENT_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_IAM_CLIENT_H
#include "google/cloud/iam/iam_connection.h"
#include "google/cloud/future.h"
#include "google/cloud/iam_updater.h"
#include "google/cloud/options.h"
#include "google/cloud/polling_policy.h"
#include "google/cloud/status_or.h"
#include "google/cloud/version.h"
#include <memory>
namespace google {
namespace cloud {
namespace iam {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
/**
* Creates and manages Identity and Access Management (IAM) resources.
*
* You can use this service to work with all of the following resources:
*
* * **Service accounts**, which identify an application or a virtual machine
* (VM) instance rather than a person
* * **Service account keys**, which service accounts use to authenticate with
* Google APIs
* * **IAM policies for service accounts**, which specify the roles that a
* member has for the service account
* * **IAM custom roles**, which help you limit the number of permissions that
* you grant to members
*
* In addition, you can use this service to complete the following tasks, among
* others:
*
* * Test whether a service account can use specific permissions
* * Check which roles you can grant for a specific resource
* * Lint, or validate, condition expressions in an IAM policy
*/
class IAMClient {
public:
explicit IAMClient(std::shared_ptr<IAMConnection> connection);
~IAMClient();
//@{
// @name Copy and move support
IAMClient(IAMClient const&) = default;
IAMClient& operator=(IAMClient const&) = default;
IAMClient(IAMClient&&) = default;
IAMClient& operator=(IAMClient&&) = default;
//@}
//@{
// @name Equality
friend bool operator==(IAMClient const& a, IAMClient const& b) {
return a.connection_ == b.connection_;
}
friend bool operator!=(IAMClient const& a, IAMClient const& b) {
return !(a == b);
}
//@}
/**
* Lists every [ServiceAccount][google.iam.admin.v1.ServiceAccount] that
* belongs to a specific project.
*
* @param name Required. The resource name of the project associated with the
* service accounts, such as `projects/my-project-123`.
* @return
* [google::iam::admin::v1::ServiceAccount](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L461)
*/
StreamRange<google::iam::admin::v1::ServiceAccount> ListServiceAccounts(
std::string const& name);
/**
* Gets a [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* @param name Required. The resource name of the service account in the
* following format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. Using
* `-` as a wildcard for the `PROJECT_ID` will infer the project from the
* account. The `ACCOUNT` value can be the `email` address or the `unique_id`
* of the service account.
* @return
* [google::iam::admin::v1::ServiceAccount](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L461)
*/
StatusOr<google::iam::admin::v1::ServiceAccount> GetServiceAccount(
std::string const& name);
/**
* Creates a [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* @param name Required. The resource name of the project associated with the
* service accounts, such as `projects/my-project-123`.
* @param account_id Required. The account id that is used to generate the
* service account email address and a stable unique id. It is unique within a
* project, must be 6-30 characters long, and match the regular expression
* `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
* @param service_account The
* [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to create.
* Currently, only the following values are user assignable: `display_name`
* and `description`.
* @return
* [google::iam::admin::v1::ServiceAccount](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L461)
*/
StatusOr<google::iam::admin::v1::ServiceAccount> CreateServiceAccount(
std::string const& name, std::string const& account_id,
google::iam::admin::v1::ServiceAccount const& service_account);
/**
* Deletes a [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* **Warning:** After you delete a service account, you might not be able to
* undelete it. If you know that you need to re-enable the service account in
* the future, use
* [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount]
* instead.
*
* If you delete a service account, IAM permanently removes the service
* account 30 days later. Google Cloud cannot recover the service account
* after it is permanently removed, even if you file a support request.
*
* To help avoid unplanned outages, we recommend that you disable the service
* account before you delete it. Use
* [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount] to
* disable the service account, then wait at least 24 hours and watch for
* unintended consequences. If there are no unintended consequences, you can
* delete the service account.
*
* @param name Required. The resource name of the service account in the
* following format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. Using
* `-` as a wildcard for the `PROJECT_ID` will infer the project from the
* account. The `ACCOUNT` value can be the `email` address or the `unique_id`
* of the service account.
*/
Status DeleteServiceAccount(std::string const& name);
/**
* Lists every [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey] for
* a service account.
*
* @param name Required. The resource name of the service account in the
* following format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. Using
* `-` as a wildcard for the `PROJECT_ID`, will infer the project from the
* account. The `ACCOUNT` value can be the `email` address or the `unique_id`
* of the service account.
* @param key_types Filters the types of keys the user wants to include in
* the list response. Duplicate key types are not allowed. If no key type is
* provided, all keys are returned.
* @return
* [google::iam::admin::v1::ListServiceAccountKeysResponse](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L692)
*/
StatusOr<google::iam::admin::v1::ListServiceAccountKeysResponse>
ListServiceAccountKeys(
std::string const& name,
std::vector<
google::iam::admin::v1::ListServiceAccountKeysRequest::KeyType> const&
key_types);
/**
* Gets a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].
*
* @param name Required. The resource name of the service account key in the
* following format:
* `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
* Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
* the account. The `ACCOUNT` value can be the `email` address or the
* `unique_id` of the service account.
* @param public_key_type The output format of the public key requested.
* X509_PEM is the default output format.
* @return
* [google::iam::admin::v1::ServiceAccountKey](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L741)
*/
StatusOr<google::iam::admin::v1::ServiceAccountKey> GetServiceAccountKey(
std::string const& name,
google::iam::admin::v1::ServiceAccountPublicKeyType public_key_type);
/**
* Creates a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].
*
* @param name Required. The resource name of the service account in the
* following format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. Using
* `-` as a wildcard for the `PROJECT_ID` will infer the project from the
* account. The `ACCOUNT` value can be the `email` address or the `unique_id`
* of the service account.
* @param private_key_type The output format of the private key. The default
* value is `TYPE_GOOGLE_CREDENTIALS_FILE`, which is the Google Credentials
* File format.
* @param key_algorithm Which type of key and algorithm to use for the key.
* The default is currently a 2K RSA key. However this may change in the
* future.
* @return
* [google::iam::admin::v1::ServiceAccountKey](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L741)
*/
StatusOr<google::iam::admin::v1::ServiceAccountKey> CreateServiceAccountKey(
std::string const& name,
google::iam::admin::v1::ServiceAccountPrivateKeyType private_key_type,
google::iam::admin::v1::ServiceAccountKeyAlgorithm key_algorithm);
/**
* Deletes a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].
* Deleting a service account key does not revoke short-lived credentials that
* have been issued based on the service account key.
*
* @param name Required. The resource name of the service account key in the
* following format:
* `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
* Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
* the account. The `ACCOUNT` value can be the `email` address or the
* `unique_id` of the service account.
*/
Status DeleteServiceAccountKey(std::string const& name);
/**
* Gets the IAM policy that is attached to a
* [ServiceAccount][google.iam.admin.v1.ServiceAccount]. This IAM policy
* specifies which members have access to the service account.
*
* This method does not tell you whether the service account has been granted
* any roles on other resources. To check whether a service account has role
* grants on a resource, use the `getIamPolicy` method for that resource. For
* example, to view the role grants for a project, call the Resource Manager
* API's
* [`projects.getIamPolicy`](https://cloud.google.com/resource-manager/reference/rest/v1/projects/getIamPolicy)
* method.
*
* @param resource REQUIRED: The resource for which the policy is being
* requested. See the operation documentation for the appropriate value for
* this field.
* @return
* [google::iam::v1::Policy](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/v1/policy.proto#L88)
*/
StatusOr<google::iam::v1::Policy> GetIamPolicy(std::string const& resource);
/**
* Sets the IAM policy that is attached to a
* [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* Use this method to grant or revoke access to the service account. For
* example, you could grant a member the ability to impersonate the service
* account.
*
* This method does not enable the service account to access other resources.
* To grant roles to a service account on a resource, follow these steps:
*
* 1. Call the resource's `getIamPolicy` method to get its current IAM policy.
* 2. Edit the policy so that it binds the service account to an IAM role for
* the resource.
* 3. Call the resource's `setIamPolicy` method to update its IAM policy.
*
* For detailed instructions, see
* [Granting roles to a service account for specific
* resources](https://cloud.google.com/iam/help/service-accounts/granting-access-to-service-accounts).
*
* @param resource REQUIRED: The resource for which the policy is being
* specified. See the operation documentation for the appropriate value for
* this field.
* @param policy REQUIRED: The complete policy to be applied to the
* `resource`. The size of the policy is limited to a few 10s of KB. An empty
* policy is a valid policy but certain Cloud Platform services (such as
* Projects) might reject them.
* @return
* [google::iam::v1::Policy](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/v1/policy.proto#L88)
*/
StatusOr<google::iam::v1::Policy> SetIamPolicy(
std::string const& resource, google::iam::v1::Policy const& policy);
/**
* Updates the IAM policy for @p resource using an optimistic concurrency
* control loop.
*
* The loop fetches the current policy for @p resource, and passes it to @p
* updater, which should return the new policy. This new policy should use the
* current etag so that the read-modify-write cycle can detect races and rerun
* the update when there is a mismatch. If the new policy does not have an
* etag, the existing policy will be blindly overwritten. If @p updater does
* not yield a policy, the control loop is terminated and kCancelled is
* returned.
*
* @param resource Required. The resource for which the policy is being
* specified. See the operation documentation for the appropriate value for
* this field.
* @param updater Required. Functor to map the current policy to a new one.
* @param options Optional. Options to control the loop. Expected options
* are:
* - `IAMBackoffPolicyOption`
* @return google::iam::v1::Policy
*/
StatusOr<google::iam::v1::Policy> SetIamPolicy(std::string const& resource,
IamUpdater const& updater,
Options options = {});
/**
* Tests whether the caller has the specified permissions on a
* [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* @param resource REQUIRED: The resource for which the policy detail is
* being requested. See the operation documentation for the appropriate value
* for this field.
* @param permissions The set of permissions to check for the `resource`.
* Permissions with wildcards (such as '*' or 'storage.*') are not allowed.
* For more information see [IAM
* Overview](https://cloud.google.com/iam/docs/overview#permissions).
* @return
* [google::iam::v1::TestIamPermissionsResponse](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/v1/iam_policy.proto#L141)
*/
StatusOr<google::iam::v1::TestIamPermissionsResponse> TestIamPermissions(
std::string const& resource, std::vector<std::string> const& permissions);
/**
* Lists roles that can be granted on a Google Cloud resource. A role is
* grantable if the IAM policy for the resource can contain bindings to the
* role.
*
* @param full_resource_name Required. The full resource name to query from
* the list of grantable roles. The name follows the Google Cloud Platform
* resource format. For example, a Cloud Platform project with id `my-project`
* will be named
* `//cloudresourcemanager.googleapis.com/projects/my-project`.
* @return
* [google::iam::admin::v1::Role](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1004)
*/
StreamRange<google::iam::admin::v1::Role> QueryGrantableRoles(
std::string const& full_resource_name);
/**
* Lists every [ServiceAccount][google.iam.admin.v1.ServiceAccount] that
* belongs to a specific project.
*
* @param request
* [google::iam::admin::v1::ListServiceAccountsRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L544)
* @return
* [google::iam::admin::v1::ServiceAccount](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L461)
*/
StreamRange<google::iam::admin::v1::ServiceAccount> ListServiceAccounts(
google::iam::admin::v1::ListServiceAccountsRequest request);
/**
* Gets a [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* @param request
* [google::iam::admin::v1::GetServiceAccountRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L579)
* @return
* [google::iam::admin::v1::ServiceAccount](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L461)
*/
StatusOr<google::iam::admin::v1::ServiceAccount> GetServiceAccount(
google::iam::admin::v1::GetServiceAccountRequest const& request);
/**
* Creates a [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* @param request
* [google::iam::admin::v1::CreateServiceAccountRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L521)
* @return
* [google::iam::admin::v1::ServiceAccount](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L461)
*/
StatusOr<google::iam::admin::v1::ServiceAccount> CreateServiceAccount(
google::iam::admin::v1::CreateServiceAccountRequest const& request);
/**
* Patches a [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* @param request
* [google::iam::admin::v1::PatchServiceAccountRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L616)
* @return
* [google::iam::admin::v1::ServiceAccount](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L461)
*/
StatusOr<google::iam::admin::v1::ServiceAccount> PatchServiceAccount(
google::iam::admin::v1::PatchServiceAccountRequest const& request);
/**
* Deletes a [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* **Warning:** After you delete a service account, you might not be able to
* undelete it. If you know that you need to re-enable the service account in
* the future, use
* [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount]
* instead.
*
* If you delete a service account, IAM permanently removes the service
* account 30 days later. Google Cloud cannot recover the service account
* after it is permanently removed, even if you file a support request.
*
* To help avoid unplanned outages, we recommend that you disable the service
* account before you delete it. Use
* [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount] to
* disable the service account, then wait at least 24 hours and watch for
* unintended consequences. If there are no unintended consequences, you can
* delete the service account.
*
* @param request
* [google::iam::admin::v1::DeleteServiceAccountRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L594)
*/
Status DeleteServiceAccount(
google::iam::admin::v1::DeleteServiceAccountRequest const& request);
/**
* Restores a deleted [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* **Important:** It is not always possible to restore a deleted service
* account. Use this method only as a last resort.
*
* After you delete a service account, IAM permanently removes the service
* account 30 days later. There is no way to restore a deleted service account
* that has been permanently removed.
*
* @param request
* [google::iam::admin::v1::UndeleteServiceAccountRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L623)
* @return
* [google::iam::admin::v1::UndeleteServiceAccountResponse](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L631)
*/
StatusOr<google::iam::admin::v1::UndeleteServiceAccountResponse>
UndeleteServiceAccount(
google::iam::admin::v1::UndeleteServiceAccountRequest const& request);
/**
* Enables a [ServiceAccount][google.iam.admin.v1.ServiceAccount] that was
* disabled by
* [DisableServiceAccount][google.iam.admin.v1.IAM.DisableServiceAccount].
*
* If the service account is already enabled, then this method has no effect.
*
* If the service account was disabled by other means—for example, if Google
* disabled the service account because it was compromised—you cannot use this
* method to enable the service account.
*
* @param request
* [google::iam::admin::v1::EnableServiceAccountRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L637)
*/
Status EnableServiceAccount(
google::iam::admin::v1::EnableServiceAccountRequest const& request);
/**
* Disables a [ServiceAccount][google.iam.admin.v1.ServiceAccount]
* immediately.
*
* If an application uses the service account to authenticate, that
* application can no longer call Google APIs or access Google Cloud
* resources. Existing access tokens for the service account are rejected, and
* requests for new access tokens will fail.
*
* To re-enable the service account, use
* [EnableServiceAccount][google.iam.admin.v1.IAM.EnableServiceAccount]. After
* you re-enable the service account, its existing access tokens will be
* accepted, and you can request new access tokens.
*
* To help avoid unplanned outages, we recommend that you disable the service
* account before you delete it. Use this method to disable the service
* account, then wait at least 24 hours and watch for unintended consequences.
* If there are no unintended consequences, you can delete the service account
* with [DeleteServiceAccount][google.iam.admin.v1.IAM.DeleteServiceAccount].
*
* @param request
* [google::iam::admin::v1::DisableServiceAccountRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L647)
*/
Status DisableServiceAccount(
google::iam::admin::v1::DisableServiceAccountRequest const& request);
/**
* Lists every [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey] for
* a service account.
*
* @param request
* [google::iam::admin::v1::ListServiceAccountKeysRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L657)
* @return
* [google::iam::admin::v1::ListServiceAccountKeysResponse](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L692)
*/
StatusOr<google::iam::admin::v1::ListServiceAccountKeysResponse>
ListServiceAccountKeys(
google::iam::admin::v1::ListServiceAccountKeysRequest const& request);
/**
* Gets a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].
*
* @param request
* [google::iam::admin::v1::GetServiceAccountKeyRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L698)
* @return
* [google::iam::admin::v1::ServiceAccountKey](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L741)
*/
StatusOr<google::iam::admin::v1::ServiceAccountKey> GetServiceAccountKey(
google::iam::admin::v1::GetServiceAccountKeyRequest const& request);
/**
* Creates a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].
*
* @param request
* [google::iam::admin::v1::CreateServiceAccountKeyRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L791)
* @return
* [google::iam::admin::v1::ServiceAccountKey](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L741)
*/
StatusOr<google::iam::admin::v1::ServiceAccountKey> CreateServiceAccountKey(
google::iam::admin::v1::CreateServiceAccountKeyRequest const& request);
/**
* Creates a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey], using
* a public key that you provide.
*
* @param request
* [google::iam::admin::v1::UploadServiceAccountKeyRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L816)
* @return
* [google::iam::admin::v1::ServiceAccountKey](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L741)
*/
StatusOr<google::iam::admin::v1::ServiceAccountKey> UploadServiceAccountKey(
google::iam::admin::v1::UploadServiceAccountKeyRequest const& request);
/**
* Deletes a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].
* Deleting a service account key does not revoke short-lived credentials that
* have been issued based on the service account key.
*
* @param request
* [google::iam::admin::v1::DeleteServiceAccountKeyRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L832)
*/
Status DeleteServiceAccountKey(
google::iam::admin::v1::DeleteServiceAccountKeyRequest const& request);
/**
* Gets the IAM policy that is attached to a
* [ServiceAccount][google.iam.admin.v1.ServiceAccount]. This IAM policy
* specifies which members have access to the service account.
*
* This method does not tell you whether the service account has been granted
* any roles on other resources. To check whether a service account has role
* grants on a resource, use the `getIamPolicy` method for that resource. For
* example, to view the role grants for a project, call the Resource Manager
* API's
* [`projects.getIamPolicy`](https://cloud.google.com/resource-manager/reference/rest/v1/projects/getIamPolicy)
* method.
*
* @param request
* [google::iam::v1::GetIamPolicyRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/v1/iam_policy.proto#L113)
* @return
* [google::iam::v1::Policy](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/v1/policy.proto#L88)
*/
StatusOr<google::iam::v1::Policy> GetIamPolicy(
google::iam::v1::GetIamPolicyRequest const& request);
/**
* Sets the IAM policy that is attached to a
* [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* Use this method to grant or revoke access to the service account. For
* example, you could grant a member the ability to impersonate the service
* account.
*
* This method does not enable the service account to access other resources.
* To grant roles to a service account on a resource, follow these steps:
*
* 1. Call the resource's `getIamPolicy` method to get its current IAM policy.
* 2. Edit the policy so that it binds the service account to an IAM role for
* the resource.
* 3. Call the resource's `setIamPolicy` method to update its IAM policy.
*
* For detailed instructions, see
* [Granting roles to a service account for specific
* resources](https://cloud.google.com/iam/help/service-accounts/granting-access-to-service-accounts).
*
* @param request
* [google::iam::v1::SetIamPolicyRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/v1/iam_policy.proto#L98)
* @return
* [google::iam::v1::Policy](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/v1/policy.proto#L88)
*/
StatusOr<google::iam::v1::Policy> SetIamPolicy(
google::iam::v1::SetIamPolicyRequest const& request);
/**
* Tests whether the caller has the specified permissions on a
* [ServiceAccount][google.iam.admin.v1.ServiceAccount].
*
* @param request
* [google::iam::v1::TestIamPermissionsRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/v1/iam_policy.proto#L126)
* @return
* [google::iam::v1::TestIamPermissionsResponse](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/v1/iam_policy.proto#L141)
*/
StatusOr<google::iam::v1::TestIamPermissionsResponse> TestIamPermissions(
google::iam::v1::TestIamPermissionsRequest const& request);
/**
* Lists roles that can be granted on a Google Cloud resource. A role is
* grantable if the IAM policy for the resource can contain bindings to the
* role.
*
* @param request
* [google::iam::admin::v1::QueryGrantableRolesRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1062)
* @return
* [google::iam::admin::v1::Role](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1004)
*/
StreamRange<google::iam::admin::v1::Role> QueryGrantableRoles(
google::iam::admin::v1::QueryGrantableRolesRequest request);
/**
* Lists every predefined [Role][google.iam.admin.v1.Role] that IAM supports,
* or every custom role that is defined for an organization or project.
*
* @param request
* [google::iam::admin::v1::ListRolesRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1093)
* @return
* [google::iam::admin::v1::Role](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1004)
*/
StreamRange<google::iam::admin::v1::Role> ListRoles(
google::iam::admin::v1::ListRolesRequest request);
/**
* Gets the definition of a [Role][google.iam.admin.v1.Role].
*
* @param request
* [google::iam::admin::v1::GetRoleRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1152)
* @return
* [google::iam::admin::v1::Role](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1004)
*/
StatusOr<google::iam::admin::v1::Role> GetRole(
google::iam::admin::v1::GetRoleRequest const& request);
/**
* Creates a new custom [Role][google.iam.admin.v1.Role].
*
* @param request
* [google::iam::admin::v1::CreateRoleRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1184)
* @return
* [google::iam::admin::v1::Role](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1004)
*/
StatusOr<google::iam::admin::v1::Role> CreateRole(
google::iam::admin::v1::CreateRoleRequest const& request);
/**
* Updates the definition of a custom [Role][google.iam.admin.v1.Role].
*
* @param request
* [google::iam::admin::v1::UpdateRoleRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1219)
* @return
* [google::iam::admin::v1::Role](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1004)
*/
StatusOr<google::iam::admin::v1::Role> UpdateRole(
google::iam::admin::v1::UpdateRoleRequest const& request);
/**
* Deletes a custom [Role][google.iam.admin.v1.Role].
*
* When you delete a custom role, the following changes occur immediately:
*
* * You cannot bind a member to the custom role in an IAM
* [Policy][google.iam.v1.Policy].
* * Existing bindings to the custom role are not changed, but they have no
* effect.
* * By default, the response from
* [ListRoles][google.iam.admin.v1.IAM.ListRoles] does not include the custom
* role.
*
* You have 7 days to undelete the custom role. After 7 days, the following
* changes occur:
*
* * The custom role is permanently deleted and cannot be recovered.
* * If an IAM policy contains a binding to the custom role, the binding is
* permanently removed.
*
* @param request
* [google::iam::admin::v1::DeleteRoleRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1250)
* @return
* [google::iam::admin::v1::Role](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1004)
*/
StatusOr<google::iam::admin::v1::Role> DeleteRole(
google::iam::admin::v1::DeleteRoleRequest const& request);
/**
* Undeletes a custom [Role][google.iam.admin.v1.Role].
*
* @param request
* [google::iam::admin::v1::UndeleteRoleRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1278)
* @return
* [google::iam::admin::v1::Role](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1004)
*/
StatusOr<google::iam::admin::v1::Role> UndeleteRole(
google::iam::admin::v1::UndeleteRoleRequest const& request);
/**
* Lists every permission that you can test on a resource. A permission is
* testable if you can check whether a member has that permission on the
* resource.
*
* @param request
* [google::iam::admin::v1::QueryTestablePermissionsRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1361)
* @return
* [google::iam::admin::v1::Permission](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1306)
*/
StreamRange<google::iam::admin::v1::Permission> QueryTestablePermissions(
google::iam::admin::v1::QueryTestablePermissionsRequest request);
/**
* Returns a list of services that allow you to opt into audit logs that are
* not generated by default.
*
* To learn more about audit logs, see the [Logging
* documentation](https://cloud.google.com/logging/docs/audit).
*
* @param request
* [google::iam::admin::v1::QueryAuditableServicesRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1391)
* @return
* [google::iam::admin::v1::QueryAuditableServicesResponse](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1402)
*/
StatusOr<google::iam::admin::v1::QueryAuditableServicesResponse>
QueryAuditableServices(
google::iam::admin::v1::QueryAuditableServicesRequest const& request);
/**
* Lints, or validates, an IAM policy. Currently checks the
* [google.iam.v1.Binding.condition][google.iam.v1.Binding.condition] field,
* which contains a condition expression for a role binding.
*
* Successful calls to this method always return an HTTP `200 OK` status code,
* even if the linter detects an issue in the IAM policy.
*
* @param request
* [google::iam::admin::v1::LintPolicyRequest](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1415)
* @return
* [google::iam::admin::v1::LintPolicyResponse](https://github.com/googleapis/googleapis/blob/9bac62dbc7a1f7b19baf578d6fbb550dbaff0d49/google/iam/admin/v1/iam.proto#L1513)
*/
StatusOr<google::iam::admin::v1::LintPolicyResponse> LintPolicy(
google::iam::admin::v1::LintPolicyRequest const& request);
private:
std::shared_ptr<IAMConnection> connection_;
};
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace iam
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_IAM_CLIENT_H