Google Cloud IAM C++ Client  2.2.1
A C++ Client Library for Google Cloud IAM
iam_connection.h
Go to the documentation of this file.
1 // Copyright 2021 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 // Generated by the Codegen C++ plugin.
16 // If you make any local changes, they will be lost.
17 // source: google/iam/admin/v1/iam.proto
18 
19 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_IAM_CONNECTION_H
20 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_IAM_CONNECTION_H
21 
22 #include "google/cloud/iam/iam_connection_idempotency_policy.h"
23 #include "google/cloud/iam/internal/iam_retry_traits.h"
24 #include "google/cloud/iam/internal/iam_stub.h"
25 #include "google/cloud/backoff_policy.h"
26 #include "google/cloud/options.h"
27 #include "google/cloud/status_or.h"
28 #include "google/cloud/stream_range.h"
29 #include "google/cloud/version.h"
30 #include <memory>
31 
32 namespace google {
33 namespace cloud {
34 namespace iam {
36 
37 using IAMRetryPolicy = ::google::cloud::internal::TraitBasedRetryPolicy<
38  iam_internal::IAMRetryTraits>;
39 
40 using IAMLimitedTimeRetryPolicy =
41  ::google::cloud::internal::LimitedTimeRetryPolicy<
42  iam_internal::IAMRetryTraits>;
43 
44 using IAMLimitedErrorCountRetryPolicy =
45  ::google::cloud::internal::LimitedErrorCountRetryPolicy<
46  iam_internal::IAMRetryTraits>;
47 
48 /**
49  * The `IAMConnection` object for `IAMClient`.
50  *
51  * This interface defines virtual methods for each of the user-facing overload
52  * sets in `IAMClient`. This allows users to inject custom behavior
53  * (e.g., with a Google Mock object) when writing tests that use objects of type
54  * `IAMClient`.
55  *
56  * To create a concrete instance, see `MakeIAMConnection()`.
57  *
58  * For mocking, see `iam_mocks::MockIAMConnection`.
59  */
61  public:
62  virtual ~IAMConnection() = 0;
63 
64  virtual Options options() { return Options{}; }
65 
66  virtual StreamRange<google::iam::admin::v1::ServiceAccount>
68  google::iam::admin::v1::ListServiceAccountsRequest request);
69 
70  virtual StatusOr<google::iam::admin::v1::ServiceAccount> GetServiceAccount(
71  google::iam::admin::v1::GetServiceAccountRequest const& request);
72 
73  virtual StatusOr<google::iam::admin::v1::ServiceAccount> CreateServiceAccount(
74  google::iam::admin::v1::CreateServiceAccountRequest const& request);
75 
76  virtual StatusOr<google::iam::admin::v1::ServiceAccount> PatchServiceAccount(
77  google::iam::admin::v1::PatchServiceAccountRequest const& request);
78 
80  google::iam::admin::v1::DeleteServiceAccountRequest const& request);
81 
82  virtual StatusOr<google::iam::admin::v1::UndeleteServiceAccountResponse>
84  google::iam::admin::v1::UndeleteServiceAccountRequest const& request);
85 
87  google::iam::admin::v1::EnableServiceAccountRequest const& request);
88 
90  google::iam::admin::v1::DisableServiceAccountRequest const& request);
91 
92  virtual StatusOr<google::iam::admin::v1::ListServiceAccountKeysResponse>
94  google::iam::admin::v1::ListServiceAccountKeysRequest const& request);
95 
96  virtual StatusOr<google::iam::admin::v1::ServiceAccountKey>
98  google::iam::admin::v1::GetServiceAccountKeyRequest const& request);
99 
100  virtual StatusOr<google::iam::admin::v1::ServiceAccountKey>
102  google::iam::admin::v1::CreateServiceAccountKeyRequest const& request);
103 
104  virtual StatusOr<google::iam::admin::v1::ServiceAccountKey>
106  google::iam::admin::v1::UploadServiceAccountKeyRequest const& request);
107 
109  google::iam::admin::v1::DeleteServiceAccountKeyRequest const& request);
110 
111  virtual StatusOr<google::iam::v1::Policy> GetIamPolicy(
112  google::iam::v1::GetIamPolicyRequest const& request);
113 
114  virtual StatusOr<google::iam::v1::Policy> SetIamPolicy(
115  google::iam::v1::SetIamPolicyRequest const& request);
116 
117  virtual StatusOr<google::iam::v1::TestIamPermissionsResponse>
118  TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const& request);
119 
120  virtual StreamRange<google::iam::admin::v1::Role> QueryGrantableRoles(
121  google::iam::admin::v1::QueryGrantableRolesRequest request);
122 
123  virtual StreamRange<google::iam::admin::v1::Role> ListRoles(
124  google::iam::admin::v1::ListRolesRequest request);
125 
126  virtual StatusOr<google::iam::admin::v1::Role> GetRole(
127  google::iam::admin::v1::GetRoleRequest const& request);
128 
129  virtual StatusOr<google::iam::admin::v1::Role> CreateRole(
130  google::iam::admin::v1::CreateRoleRequest const& request);
131 
132  virtual StatusOr<google::iam::admin::v1::Role> UpdateRole(
133  google::iam::admin::v1::UpdateRoleRequest const& request);
134 
135  virtual StatusOr<google::iam::admin::v1::Role> DeleteRole(
136  google::iam::admin::v1::DeleteRoleRequest const& request);
137 
138  virtual StatusOr<google::iam::admin::v1::Role> UndeleteRole(
139  google::iam::admin::v1::UndeleteRoleRequest const& request);
140 
141  virtual StreamRange<google::iam::admin::v1::Permission>
143  google::iam::admin::v1::QueryTestablePermissionsRequest request);
144 
145  virtual StatusOr<google::iam::admin::v1::QueryAuditableServicesResponse>
147  google::iam::admin::v1::QueryAuditableServicesRequest const& request);
148 
149  virtual StatusOr<google::iam::admin::v1::LintPolicyResponse> LintPolicy(
150  google::iam::admin::v1::LintPolicyRequest const& request);
151 };
152 
153 /**
154  * A factory function to construct an object of type `IAMConnection`.
155  *
156  * The returned connection object should not be used directly; instead it
157  * should be passed as an argument to the constructor of IAMClient.
158  *
159  * The optional @p options argument may be used to configure aspects of the
160  * returned `IAMConnection`. Expected options are any of the types in
161  * the following option lists:
162  *
163  * - `google::cloud::CommonOptionList`
164  * - `google::cloud::GrpcOptionList`
165  * - `google::cloud::UnifiedCredentialsOptionList`
166  * - `google::cloud::iam::IAMPolicyOptionList`
167  *
168  * @note Unexpected options will be ignored. To log unexpected options instead,
169  * set `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` in the environment.
170  *
171  * @param options (optional) Configure the `IAMConnection` created by
172  * this function.
173  */
174 std::shared_ptr<IAMConnection> MakeIAMConnection(Options options = {});
175 
177 namespace gcpcxxV1 = GOOGLE_CLOUD_CPP_NS; // NOLINT(misc-unused-alias-decls)
178 } // namespace iam
179 } // namespace cloud
180 } // namespace google
181 
182 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_IAM_CONNECTION_H