Google Cloud BigQuery C++ Client 2.10.1
A C++ Client Library for Google Cloud BigQuery
Loading...
Searching...
No Matches
connection_client.h
1// Copyright 2022 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/cloud/bigquery/connection/v1/connection.proto
18
19#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_CONNECTION_V1_CONNECTION_CLIENT_H
20#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_CONNECTION_V1_CONNECTION_CLIENT_H
21
22#include "google/cloud/bigquery/connection/v1/connection_connection.h"
23#include "google/cloud/future.h"
24#include "google/cloud/options.h"
25#include "google/cloud/polling_policy.h"
26#include "google/cloud/status_or.h"
27#include "google/cloud/version.h"
28#include <memory>
29
30namespace google {
31namespace cloud {
32namespace bigquery_connection_v1 {
33GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
34
35///
36/// Manages external data source connections and credentials.
37///
38/// @par Equality
39///
40/// Instances of this class created via copy-construction or copy-assignment
41/// always compare equal. Instances created with equal
42/// `std::shared_ptr<*Connection>` objects compare equal. Objects that compare
43/// equal share the same underlying resources.
44///
45/// @par Performance
46///
47/// Creating a new instance of this class is a relatively expensive operation,
48/// new objects establish new connections to the service. In contrast,
49/// copy-construction, move-construction, and the corresponding assignment
50/// operations are relatively efficient as the copies share all underlying
51/// resources.
52///
53/// @par Thread Safety
54///
55/// Concurrent access to different instances of this class, even if they compare
56/// equal, is guaranteed to work. Two or more threads operating on the same
57/// instance of this class is not guaranteed to work. Since copy-construction
58/// and move-construction is a relatively efficient operation, consider using
59/// such a copy when using this class from multiple threads.
60///
62 public:
64 std::shared_ptr<ConnectionServiceConnection> connection,
65 Options opts = {});
67
68 ///@{
69 /// @name Copy and move support
74 ///@}
75
76 ///@{
77 /// @name Equality
78 friend bool operator==(ConnectionServiceClient const& a,
79 ConnectionServiceClient const& b) {
80 return a.connection_ == b.connection_;
81 }
82 friend bool operator!=(ConnectionServiceClient const& a,
83 ConnectionServiceClient const& b) {
84 return !(a == b);
85 }
86 ///@}
87
88 ///
89 /// Creates a new connection.
90 ///
91 /// @param parent Required. Parent resource name.
92 /// Must be in the format `projects/{project_id}/locations/{location_id}`
93 /// @param connection Required. Connection to create.
94 /// @param connection_id Optional. Connection id that should be assigned to
95 /// the created connection.
96 /// @param opts Optional. Override the class-level options, such as retry and
97 /// backoff policies.
98 /// @return
99 /// @googleapis_link{google::cloud::bigquery::connection::v1::Connection,google/cloud/bigquery/connection/v1/connection.proto#L231}
100 ///
101 /// [google.cloud.bigquery.connection.v1.Connection]:
102 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L231}
103 /// [google.cloud.bigquery.connection.v1.CreateConnectionRequest]:
104 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L138}
105 ///
106 StatusOr<google::cloud::bigquery::connection::v1::Connection>
108 std::string const& parent,
109 google::cloud::bigquery::connection::v1::Connection const& connection,
110 std::string const& connection_id, Options opts = {});
111
112 ///
113 /// Creates a new connection.
114 ///
115 /// @param request
116 /// @googleapis_link{google::cloud::bigquery::connection::v1::CreateConnectionRequest,google/cloud/bigquery/connection/v1/connection.proto#L138}
117 /// @param opts Optional. Override the class-level options, such as retry and
118 /// backoff policies.
119 /// @return
120 /// @googleapis_link{google::cloud::bigquery::connection::v1::Connection,google/cloud/bigquery/connection/v1/connection.proto#L231}
121 ///
122 /// [google.cloud.bigquery.connection.v1.Connection]:
123 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L231}
124 /// [google.cloud.bigquery.connection.v1.CreateConnectionRequest]:
125 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L138}
126 ///
127 StatusOr<google::cloud::bigquery::connection::v1::Connection>
129 google::cloud::bigquery::connection::v1::CreateConnectionRequest const&
130 request,
131 Options opts = {});
132
133 ///
134 /// Returns specified connection.
135 ///
136 /// @param name Required. Name of the requested connection, for example:
137 /// `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
138 /// @param opts Optional. Override the class-level options, such as retry and
139 /// backoff policies.
140 /// @return
141 /// @googleapis_link{google::cloud::bigquery::connection::v1::Connection,google/cloud/bigquery/connection/v1/connection.proto#L231}
142 ///
143 /// [google.cloud.bigquery.connection.v1.Connection]:
144 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L231}
145 /// [google.cloud.bigquery.connection.v1.GetConnectionRequest]:
146 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L157}
147 ///
148 StatusOr<google::cloud::bigquery::connection::v1::Connection> GetConnection(
149 std::string const& name, Options opts = {});
150
151 ///
152 /// Returns specified connection.
153 ///
154 /// @param request
155 /// @googleapis_link{google::cloud::bigquery::connection::v1::GetConnectionRequest,google/cloud/bigquery/connection/v1/connection.proto#L157}
156 /// @param opts Optional. Override the class-level options, such as retry and
157 /// backoff policies.
158 /// @return
159 /// @googleapis_link{google::cloud::bigquery::connection::v1::Connection,google/cloud/bigquery/connection/v1/connection.proto#L231}
160 ///
161 /// [google.cloud.bigquery.connection.v1.Connection]:
162 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L231}
163 /// [google.cloud.bigquery.connection.v1.GetConnectionRequest]:
164 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L157}
165 ///
166 StatusOr<google::cloud::bigquery::connection::v1::Connection> GetConnection(
167 google::cloud::bigquery::connection::v1::GetConnectionRequest const&
168 request,
169 Options opts = {});
170
171 ///
172 /// Returns a list of connections in the given project.
173 ///
174 /// @param parent Required. Parent resource name.
175 /// Must be in the form: `projects/{project_id}/locations/{location_id}`
176 /// @param opts Optional. Override the class-level options, such as retry and
177 /// backoff policies.
178 /// @return
179 /// @googleapis_link{google::cloud::bigquery::connection::v1::Connection,google/cloud/bigquery/connection/v1/connection.proto#L231}
180 ///
181 /// [google.cloud.bigquery.connection.v1.Connection]:
182 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L231}
183 /// [google.cloud.bigquery.connection.v1.ListConnectionsRequest]:
184 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L170}
185 ///
186 StreamRange<google::cloud::bigquery::connection::v1::Connection>
187 ListConnections(std::string const& parent, Options opts = {});
188
189 ///
190 /// Returns a list of connections in the given project.
191 ///
192 /// @param request
193 /// @googleapis_link{google::cloud::bigquery::connection::v1::ListConnectionsRequest,google/cloud/bigquery/connection/v1/connection.proto#L170}
194 /// @param opts Optional. Override the class-level options, such as retry and
195 /// backoff policies.
196 /// @return
197 /// @googleapis_link{google::cloud::bigquery::connection::v1::Connection,google/cloud/bigquery/connection/v1/connection.proto#L231}
198 ///
199 /// [google.cloud.bigquery.connection.v1.Connection]:
200 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L231}
201 /// [google.cloud.bigquery.connection.v1.ListConnectionsRequest]:
202 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L170}
203 ///
204 StreamRange<google::cloud::bigquery::connection::v1::Connection>
206 google::cloud::bigquery::connection::v1::ListConnectionsRequest request,
207 Options opts = {});
208
209 ///
210 /// Updates the specified connection. For security reasons, also resets
211 /// credential if connection properties are in the update field mask.
212 ///
213 /// @param name Required. Name of the connection to update, for example:
214 /// `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
215 /// @param connection Required. Connection containing the updated fields.
216 /// @param update_mask Required. Update mask for the connection fields to be
217 /// updated.
218 /// @param opts Optional. Override the class-level options, such as retry and
219 /// backoff policies.
220 /// @return
221 /// @googleapis_link{google::cloud::bigquery::connection::v1::Connection,google/cloud/bigquery/connection/v1/connection.proto#L231}
222 ///
223 /// [google.cloud.bigquery.connection.v1.Connection]:
224 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L231}
225 /// [google.cloud.bigquery.connection.v1.UpdateConnectionRequest]:
226 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L199}
227 ///
228 StatusOr<google::cloud::bigquery::connection::v1::Connection>
230 std::string const& name,
231 google::cloud::bigquery::connection::v1::Connection const& connection,
232 google::protobuf::FieldMask const& update_mask, Options opts = {});
233
234 ///
235 /// Updates the specified connection. For security reasons, also resets
236 /// credential if connection properties are in the update field mask.
237 ///
238 /// @param request
239 /// @googleapis_link{google::cloud::bigquery::connection::v1::UpdateConnectionRequest,google/cloud/bigquery/connection/v1/connection.proto#L199}
240 /// @param opts Optional. Override the class-level options, such as retry and
241 /// backoff policies.
242 /// @return
243 /// @googleapis_link{google::cloud::bigquery::connection::v1::Connection,google/cloud/bigquery/connection/v1/connection.proto#L231}
244 ///
245 /// [google.cloud.bigquery.connection.v1.Connection]:
246 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L231}
247 /// [google.cloud.bigquery.connection.v1.UpdateConnectionRequest]:
248 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L199}
249 ///
250 StatusOr<google::cloud::bigquery::connection::v1::Connection>
252 google::cloud::bigquery::connection::v1::UpdateConnectionRequest const&
253 request,
254 Options opts = {});
255
256 ///
257 /// Deletes connection and associated credential.
258 ///
259 /// @param name Required. Name of the deleted connection, for example:
260 /// `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
261 /// @param opts Optional. Override the class-level options, such as retry and
262 /// backoff policies.
263 ///
264 /// [google.cloud.bigquery.connection.v1.DeleteConnectionRequest]:
265 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L218}
266 ///
267 Status DeleteConnection(std::string const& name, Options opts = {});
268
269 ///
270 /// Deletes connection and associated credential.
271 ///
272 /// @param request
273 /// @googleapis_link{google::cloud::bigquery::connection::v1::DeleteConnectionRequest,google/cloud/bigquery/connection/v1/connection.proto#L218}
274 /// @param opts Optional. Override the class-level options, such as retry and
275 /// backoff policies.
276 ///
277 /// [google.cloud.bigquery.connection.v1.DeleteConnectionRequest]:
278 /// @googleapis_reference_link{google/cloud/bigquery/connection/v1/connection.proto#L218}
279 ///
281 google::cloud::bigquery::connection::v1::DeleteConnectionRequest const&
282 request,
283 Options opts = {});
284
285 ///
286 /// Gets the access control policy for a resource.
287 /// Returns an empty policy if the resource exists and does not have a policy
288 /// set.
289 ///
290 /// @param resource REQUIRED: The resource for which the policy is being
291 /// requested.
292 /// See the operation documentation for the appropriate value for this field.
293 /// @param options OPTIONAL: A `GetPolicyOptions` object for specifying
294 /// options to
295 /// `GetIamPolicy`.
296 /// @param opts Optional. Override the class-level options, such as retry and
297 /// backoff policies.
298 /// @return
299 /// @googleapis_link{google::iam::v1::Policy,google/iam/v1/policy.proto#L98}
300 ///
301 /// [google.iam.v1.GetIamPolicyRequest]:
302 /// @googleapis_reference_link{google/iam/v1/iam_policy.proto#L123}
303 /// [google.iam.v1.Policy]:
304 /// @googleapis_reference_link{google/iam/v1/policy.proto#L98}
305 ///
306 StatusOr<google::iam::v1::Policy> GetIamPolicy(
307 std::string const& resource,
308 google::iam::v1::GetPolicyOptions const& options, Options opts = {});
309
310 ///
311 /// Gets the access control policy for a resource.
312 /// Returns an empty policy if the resource exists and does not have a policy
313 /// set.
314 ///
315 /// @param request
316 /// @googleapis_link{google::iam::v1::GetIamPolicyRequest,google/iam/v1/iam_policy.proto#L123}
317 /// @param opts Optional. Override the class-level options, such as retry and
318 /// backoff policies.
319 /// @return
320 /// @googleapis_link{google::iam::v1::Policy,google/iam/v1/policy.proto#L98}
321 ///
322 /// [google.iam.v1.GetIamPolicyRequest]:
323 /// @googleapis_reference_link{google/iam/v1/iam_policy.proto#L123}
324 /// [google.iam.v1.Policy]:
325 /// @googleapis_reference_link{google/iam/v1/policy.proto#L98}
326 ///
327 StatusOr<google::iam::v1::Policy> GetIamPolicy(
328 google::iam::v1::GetIamPolicyRequest const& request, Options opts = {});
329
330 ///
331 /// Sets the access control policy on the specified resource. Replaces any
332 /// existing policy.
333 ///
334 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
335 /// errors.
336 ///
337 /// @param resource REQUIRED: The resource for which the policy is being
338 /// specified.
339 /// See the operation documentation for the appropriate value for this field.
340 /// @param policy REQUIRED: The complete policy to be applied to the
341 /// `resource`. The size of
342 /// the policy is limited to a few 10s of KB. An empty policy is a
343 /// valid policy but certain Cloud Platform services (such as Projects)
344 /// might reject them.
345 /// @param opts Optional. Override the class-level options, such as retry and
346 /// backoff policies.
347 /// @return
348 /// @googleapis_link{google::iam::v1::Policy,google/iam/v1/policy.proto#L98}
349 ///
350 /// [google.iam.v1.Policy]:
351 /// @googleapis_reference_link{google/iam/v1/policy.proto#L98}
352 /// [google.iam.v1.SetIamPolicyRequest]:
353 /// @googleapis_reference_link{google/iam/v1/iam_policy.proto#L101}
354 ///
355 StatusOr<google::iam::v1::Policy> SetIamPolicy(
356 std::string const& resource, google::iam::v1::Policy const& policy,
357 Options opts = {});
358
359 ///
360 /// Sets the access control policy on the specified resource. Replaces any
361 /// existing policy.
362 ///
363 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
364 /// errors.
365 ///
366 /// @param request
367 /// @googleapis_link{google::iam::v1::SetIamPolicyRequest,google/iam/v1/iam_policy.proto#L101}
368 /// @param opts Optional. Override the class-level options, such as retry and
369 /// backoff policies.
370 /// @return
371 /// @googleapis_link{google::iam::v1::Policy,google/iam/v1/policy.proto#L98}
372 ///
373 /// [google.iam.v1.Policy]:
374 /// @googleapis_reference_link{google/iam/v1/policy.proto#L98}
375 /// [google.iam.v1.SetIamPolicyRequest]:
376 /// @googleapis_reference_link{google/iam/v1/iam_policy.proto#L101}
377 ///
378 StatusOr<google::iam::v1::Policy> SetIamPolicy(
379 google::iam::v1::SetIamPolicyRequest const& request, Options opts = {});
380
381 ///
382 /// Returns permissions that a caller has on the specified resource.
383 /// If the resource does not exist, this will return an empty set of
384 /// permissions, not a `NOT_FOUND` error.
385 ///
386 /// Note: This operation is designed to be used for building permission-aware
387 /// UIs and command-line tools, not for authorization checking. This operation
388 /// may "fail open" without warning.
389 ///
390 /// @param resource REQUIRED: The resource for which the policy detail is
391 /// being requested.
392 /// See the operation documentation for the appropriate value for this field.
393 /// @param permissions The set of permissions to check for the `resource`.
394 /// Permissions with
395 /// wildcards (such as '*' or 'storage.*') are not allowed. For more
396 /// information see
397 /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
398 /// @param opts Optional. Override the class-level options, such as retry and
399 /// backoff policies.
400 /// @return
401 /// @googleapis_link{google::iam::v1::TestIamPermissionsResponse,google/iam/v1/iam_policy.proto#L151}
402 ///
403 /// [google.iam.v1.TestIamPermissionsRequest]:
404 /// @googleapis_reference_link{google/iam/v1/iam_policy.proto#L136}
405 /// [google.iam.v1.TestIamPermissionsResponse]:
406 /// @googleapis_reference_link{google/iam/v1/iam_policy.proto#L151}
407 ///
408 StatusOr<google::iam::v1::TestIamPermissionsResponse> TestIamPermissions(
409 std::string const& resource, std::vector<std::string> const& permissions,
410 Options opts = {});
411
412 ///
413 /// Returns permissions that a caller has on the specified resource.
414 /// If the resource does not exist, this will return an empty set of
415 /// permissions, not a `NOT_FOUND` error.
416 ///
417 /// Note: This operation is designed to be used for building permission-aware
418 /// UIs and command-line tools, not for authorization checking. This operation
419 /// may "fail open" without warning.
420 ///
421 /// @param request
422 /// @googleapis_link{google::iam::v1::TestIamPermissionsRequest,google/iam/v1/iam_policy.proto#L136}
423 /// @param opts Optional. Override the class-level options, such as retry and
424 /// backoff policies.
425 /// @return
426 /// @googleapis_link{google::iam::v1::TestIamPermissionsResponse,google/iam/v1/iam_policy.proto#L151}
427 ///
428 /// [google.iam.v1.TestIamPermissionsRequest]:
429 /// @googleapis_reference_link{google/iam/v1/iam_policy.proto#L136}
430 /// [google.iam.v1.TestIamPermissionsResponse]:
431 /// @googleapis_reference_link{google/iam/v1/iam_policy.proto#L151}
432 ///
433 StatusOr<google::iam::v1::TestIamPermissionsResponse> TestIamPermissions(
434 google::iam::v1::TestIamPermissionsRequest const& request,
435 Options opts = {});
436
437 private:
438 std::shared_ptr<ConnectionServiceConnection> connection_;
439 Options options_;
440};
441
442GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
443} // namespace bigquery_connection_v1
444} // namespace cloud
445} // namespace google
446
447#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_CONNECTION_V1_CONNECTION_CLIENT_H
Manages external data source connections and credentials.
Definition: connection_client.h:61
Status DeleteConnection(google::cloud::bigquery::connection::v1::DeleteConnectionRequest const &request, Options opts={})
Deletes connection and associated credential.
StatusOr< google::cloud::bigquery::connection::v1::Connection > CreateConnection(google::cloud::bigquery::connection::v1::CreateConnectionRequest const &request, Options opts={})
Creates a new connection.
friend bool operator==(ConnectionServiceClient const &a, ConnectionServiceClient const &b)
Definition: connection_client.h:78
StatusOr< google::cloud::bigquery::connection::v1::Connection > CreateConnection(std::string const &parent, google::cloud::bigquery::connection::v1::Connection const &connection, std::string const &connection_id, Options opts={})
Creates a new connection.
StreamRange< google::cloud::bigquery::connection::v1::Connection > ListConnections(google::cloud::bigquery::connection::v1::ListConnectionsRequest request, Options opts={})
Returns a list of connections in the given project.
StatusOr< google::iam::v1::TestIamPermissionsResponse > TestIamPermissions(std::string const &resource, std::vector< std::string > const &permissions, Options opts={})
Returns permissions that a caller has on the specified resource.
StatusOr< google::iam::v1::Policy > SetIamPolicy(std::string const &resource, google::iam::v1::Policy const &policy, Options opts={})
Sets the access control policy on the specified resource.
ConnectionServiceClient & operator=(ConnectionServiceClient const &)=default
StatusOr< google::iam::v1::TestIamPermissionsResponse > TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const &request, Options opts={})
Returns permissions that a caller has on the specified resource.
StatusOr< google::iam::v1::Policy > GetIamPolicy(std::string const &resource, google::iam::v1::GetPolicyOptions const &options, Options opts={})
Gets the access control policy for a resource.
StatusOr< google::cloud::bigquery::connection::v1::Connection > GetConnection(std::string const &name, Options opts={})
Returns specified connection.
ConnectionServiceClient(ConnectionServiceClient const &)=default
Status DeleteConnection(std::string const &name, Options opts={})
Deletes connection and associated credential.
StatusOr< google::iam::v1::Policy > GetIamPolicy(google::iam::v1::GetIamPolicyRequest const &request, Options opts={})
Gets the access control policy for a resource.
ConnectionServiceClient & operator=(ConnectionServiceClient &&)=default
StatusOr< google::iam::v1::Policy > SetIamPolicy(google::iam::v1::SetIamPolicyRequest const &request, Options opts={})
Sets the access control policy on the specified resource.
ConnectionServiceClient(ConnectionServiceClient &&)=default
ConnectionServiceClient(std::shared_ptr< ConnectionServiceConnection > connection, Options opts={})
StatusOr< google::cloud::bigquery::connection::v1::Connection > UpdateConnection(google::cloud::bigquery::connection::v1::UpdateConnectionRequest const &request, Options opts={})
Updates the specified connection.
StatusOr< google::cloud::bigquery::connection::v1::Connection > GetConnection(google::cloud::bigquery::connection::v1::GetConnectionRequest const &request, Options opts={})
Returns specified connection.
StatusOr< google::cloud::bigquery::connection::v1::Connection > UpdateConnection(std::string const &name, google::cloud::bigquery::connection::v1::Connection const &connection, google::protobuf::FieldMask const &update_mask, Options opts={})
Updates the specified connection.
StreamRange< google::cloud::bigquery::connection::v1::Connection > ListConnections(std::string const &parent, Options opts={})
Returns a list of connections in the given project.
friend bool operator!=(ConnectionServiceClient const &a, ConnectionServiceClient const &b)
Definition: connection_client.h:82
The ConnectionServiceConnection object for ConnectionServiceClient.
Definition: connection_connection.h:62
Definition: connection_client.h:32
Definition: analytics_hub_client.h:30