Google Cloud Spanner C++ Client  1.32.0
A C++ Client Library for Google Cloud Spanner
instance_admin_stub.cc
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 #include "google/cloud/spanner/admin/internal/instance_admin_stub.h"
20 #include "google/cloud/grpc_error_delegate.h"
21 #include "google/cloud/status_or.h"
22 #include <google/longrunning/operations.grpc.pb.h>
23 #include <google/spanner/admin/instance/v1/spanner_instance_admin.grpc.pb.h>
24 #include <memory>
25 
26 namespace google {
27 namespace cloud {
28 namespace spanner_admin_internal {
29 inline namespace GOOGLE_CLOUD_CPP_GENERATED_NS {
30 
32 
33 StatusOr<google::spanner::admin::instance::v1::ListInstanceConfigsResponse>
35  grpc::ClientContext& client_context,
36  google::spanner::admin::instance::v1::ListInstanceConfigsRequest const&
37  request) {
38  google::spanner::admin::instance::v1::ListInstanceConfigsResponse response;
39  auto status =
40  grpc_stub_->ListInstanceConfigs(&client_context, request, &response);
41  if (!status.ok()) {
43  }
44  return response;
45 }
46 
47 StatusOr<google::spanner::admin::instance::v1::InstanceConfig>
49  grpc::ClientContext& client_context,
50  google::spanner::admin::instance::v1::GetInstanceConfigRequest const&
51  request) {
52  google::spanner::admin::instance::v1::InstanceConfig response;
53  auto status =
54  grpc_stub_->GetInstanceConfig(&client_context, request, &response);
55  if (!status.ok()) {
57  }
58  return response;
59 }
60 
61 StatusOr<google::spanner::admin::instance::v1::ListInstancesResponse>
63  grpc::ClientContext& client_context,
64  google::spanner::admin::instance::v1::ListInstancesRequest const& request) {
65  google::spanner::admin::instance::v1::ListInstancesResponse response;
66  auto status = grpc_stub_->ListInstances(&client_context, request, &response);
67  if (!status.ok()) {
69  }
70  return response;
71 }
72 
73 StatusOr<google::spanner::admin::instance::v1::Instance>
75  grpc::ClientContext& client_context,
76  google::spanner::admin::instance::v1::GetInstanceRequest const& request) {
77  google::spanner::admin::instance::v1::Instance response;
78  auto status = grpc_stub_->GetInstance(&client_context, request, &response);
79  if (!status.ok()) {
81  }
82  return response;
83 }
84 
85 future<StatusOr<google::longrunning::Operation>>
88  std::unique_ptr<grpc::ClientContext> context,
89  google::spanner::admin::instance::v1::CreateInstanceRequest const&
90  request) {
91  return cq.MakeUnaryRpc(
92  [this](grpc::ClientContext* context,
93  google::spanner::admin::instance::v1::CreateInstanceRequest const&
94  request,
95  grpc::CompletionQueue* cq) {
96  return grpc_stub_->AsyncCreateInstance(context, request, cq);
97  },
98  request, std::move(context));
99 }
100 
101 future<StatusOr<google::longrunning::Operation>>
104  std::unique_ptr<grpc::ClientContext> context,
105  google::spanner::admin::instance::v1::UpdateInstanceRequest const&
106  request) {
107  return cq.MakeUnaryRpc(
108  [this](grpc::ClientContext* context,
109  google::spanner::admin::instance::v1::UpdateInstanceRequest const&
110  request,
111  grpc::CompletionQueue* cq) {
112  return grpc_stub_->AsyncUpdateInstance(context, request, cq);
113  },
114  request, std::move(context));
115 }
116 
118  grpc::ClientContext& client_context,
119  google::spanner::admin::instance::v1::DeleteInstanceRequest const&
120  request) {
121  google::protobuf::Empty response;
122  auto status = grpc_stub_->DeleteInstance(&client_context, request, &response);
123  if (!status.ok()) {
125  }
127 }
128 
129 StatusOr<google::iam::v1::Policy> DefaultInstanceAdminStub::SetIamPolicy(
130  grpc::ClientContext& client_context,
131  google::iam::v1::SetIamPolicyRequest const& request) {
132  google::iam::v1::Policy response;
133  auto status = grpc_stub_->SetIamPolicy(&client_context, request, &response);
134  if (!status.ok()) {
136  }
137  return response;
138 }
139 
140 StatusOr<google::iam::v1::Policy> DefaultInstanceAdminStub::GetIamPolicy(
141  grpc::ClientContext& client_context,
142  google::iam::v1::GetIamPolicyRequest const& request) {
143  google::iam::v1::Policy response;
144  auto status = grpc_stub_->GetIamPolicy(&client_context, request, &response);
145  if (!status.ok()) {
147  }
148  return response;
149 }
150 
151 StatusOr<google::iam::v1::TestIamPermissionsResponse>
153  grpc::ClientContext& client_context,
154  google::iam::v1::TestIamPermissionsRequest const& request) {
155  google::iam::v1::TestIamPermissionsResponse response;
156  auto status =
157  grpc_stub_->TestIamPermissions(&client_context, request, &response);
158  if (!status.ok()) {
160  }
161  return response;
162 }
163 
164 future<StatusOr<google::longrunning::Operation>>
167  std::unique_ptr<grpc::ClientContext> context,
168  google::longrunning::GetOperationRequest const& request) {
169  return cq.MakeUnaryRpc(
170  [this](grpc::ClientContext* context,
171  google::longrunning::GetOperationRequest const& request,
172  grpc::CompletionQueue* cq) {
173  return operations_->AsyncGetOperation(context, request, cq);
174  },
175  request, std::move(context));
176 }
177 
180  std::unique_ptr<grpc::ClientContext> context,
181  google::longrunning::CancelOperationRequest const& request) {
182  return cq
184  [this](grpc::ClientContext* context,
185  google::longrunning::CancelOperationRequest const& request,
186  grpc::CompletionQueue* cq) {
187  return operations_->AsyncCancelOperation(context, request, cq);
188  },
189  request, std::move(context))
190  .then([](future<StatusOr<google::protobuf::Empty>> f) {
191  return f.get().status();
192  });
193 }
194 
195 } // namespace GOOGLE_CLOUD_CPP_GENERATED_NS
196 } // namespace spanner_admin_internal
197 } // namespace cloud
198 } // namespace google