Google Cloud Spanner C++ Client  1.42.0
A C++ Client Library for Google Cloud Spanner
instance_admin_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/spanner/admin/instance/v1/spanner_instance_admin.proto
18 
19 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_ADMIN_INSTANCE_ADMIN_CONNECTION_H
20 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_ADMIN_INSTANCE_ADMIN_CONNECTION_H
21 
22 #include "google/cloud/spanner/admin/instance_admin_connection_idempotency_policy.h"
23 #include "google/cloud/spanner/admin/internal/instance_admin_retry_traits.h"
24 #include "google/cloud/spanner/admin/internal/instance_admin_stub.h"
25 #include "google/cloud/backoff_policy.h"
26 #include "google/cloud/future.h"
27 #include "google/cloud/options.h"
28 #include "google/cloud/polling_policy.h"
29 #include "google/cloud/status_or.h"
30 #include "google/cloud/stream_range.h"
31 #include "google/cloud/version.h"
32 #include <google/longrunning/operations.grpc.pb.h>
33 #include <memory>
34 
35 namespace google {
36 namespace cloud {
37 namespace spanner_admin {
39 
40 using InstanceAdminRetryPolicy =
41  ::google::cloud::internal::TraitBasedRetryPolicy<
42  spanner_admin_internal::InstanceAdminRetryTraits>;
43 
44 using InstanceAdminLimitedTimeRetryPolicy =
45  ::google::cloud::internal::LimitedTimeRetryPolicy<
46  spanner_admin_internal::InstanceAdminRetryTraits>;
47 
48 using InstanceAdminLimitedErrorCountRetryPolicy =
49  ::google::cloud::internal::LimitedErrorCountRetryPolicy<
50  spanner_admin_internal::InstanceAdminRetryTraits>;
51 
52 /**
53  * The `InstanceAdminConnection` object for `InstanceAdminClient`.
54  *
55  * This interface defines virtual methods for each of the user-facing overload
56  * sets in `InstanceAdminClient`. This allows users to inject custom behavior
57  * (e.g., with a Google Mock object) when writing tests that use objects of type
58  * `InstanceAdminClient`.
59  *
60  * To create a concrete instance, see `MakeInstanceAdminConnection()`.
61  *
62  * For mocking, see `spanner_admin_mocks::MockInstanceAdminConnection`.
63  */
65  public:
66  virtual ~InstanceAdminConnection() = 0;
67 
68  virtual Options options() { return Options{}; }
69 
70  virtual StreamRange<google::spanner::admin::instance::v1::InstanceConfig>
72  google::spanner::admin::instance::v1::ListInstanceConfigsRequest request);
73 
74  virtual StatusOr<google::spanner::admin::instance::v1::InstanceConfig>
76  google::spanner::admin::instance::v1::GetInstanceConfigRequest const&
77  request);
78 
79  virtual StreamRange<google::spanner::admin::instance::v1::Instance>
81  google::spanner::admin::instance::v1::ListInstancesRequest request);
82 
83  virtual StatusOr<google::spanner::admin::instance::v1::Instance> GetInstance(
84  google::spanner::admin::instance::v1::GetInstanceRequest const& request);
85 
86  virtual future<StatusOr<google::spanner::admin::instance::v1::Instance>>
88  google::spanner::admin::instance::v1::CreateInstanceRequest const&
89  request);
90 
91  virtual future<StatusOr<google::spanner::admin::instance::v1::Instance>>
93  google::spanner::admin::instance::v1::UpdateInstanceRequest const&
94  request);
95 
97  google::spanner::admin::instance::v1::DeleteInstanceRequest const&
98  request);
99 
100  virtual StatusOr<google::iam::v1::Policy> SetIamPolicy(
101  google::iam::v1::SetIamPolicyRequest const& request);
102 
103  virtual StatusOr<google::iam::v1::Policy> GetIamPolicy(
104  google::iam::v1::GetIamPolicyRequest const& request);
105 
106  virtual StatusOr<google::iam::v1::TestIamPermissionsResponse>
107  TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const& request);
108 };
109 
110 /**
111  * A factory function to construct an object of type `InstanceAdminConnection`.
112  *
113  * The returned connection object should not be used directly; instead it
114  * should be passed as an argument to the constructor of InstanceAdminClient,
115  * and that class used instead.
116  *
117  * The optional @p opts argument may be used to configure aspects of the
118  * returned `InstanceAdminConnection`. Expected options are any of the types in
119  * the following option lists:
120  *
121  * - `google::cloud::CommonOptionList`
122  * - `google::cloud::GrpcOptionList`
123  * - `google::cloud::spanner_admin::InstanceAdminPolicyOptionList`
124  *
125  * @note Unrecognized options will be ignored. To debug issues with options set
126  * `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` in the environment and unexpected
127  * options will be logged.
128  *
129  * @param options (optional) Configure the `InstanceAdminConnection` created by
130  * this function.
131  */
133  Options options = {});
134 
136 namespace gcpcxxV1 = GOOGLE_CLOUD_CPP_NS; // NOLINT(misc-unused-alias-decls)
137 } // namespace spanner_admin
138 } // namespace cloud
139 } // namespace google
140 
141 namespace google {
142 namespace cloud {
143 namespace spanner_admin_internal {
145 
146 std::shared_ptr<spanner_admin::InstanceAdminConnection>
147 MakeInstanceAdminConnection(std::shared_ptr<InstanceAdminStub> stub,
148  Options options);
149 
151 namespace gcpcxxV1 = GOOGLE_CLOUD_CPP_NS; // NOLINT(misc-unused-alias-decls)
152 } // namespace spanner_admin_internal
153 } // namespace cloud
154 } // namespace google
155 
156 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_ADMIN_INSTANCE_ADMIN_CONNECTION_H