Skip to content

Commit e63d151

Browse files
authored
feat(bigqueryconnection): generate library (#8290)
1 parent 21cb427 commit e63d151

30 files changed

Lines changed: 2752 additions & 3 deletions

ci/cloudbuild/builds/cmake-install.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ expected_dirs+=(
6060
./include/google/appengine/logging
6161
./include/google/appengine/logging/v1
6262
./include/google/bigtable/v2
63-
./include/google/cloud/bigquery/connection
64-
./include/google/cloud/bigquery/connection/v1
6563
./include/google/cloud/bigquery/datatransfer
6664
./include/google/cloud/bigquery/datatransfer/v1
6765
./include/google/cloud/bigquery/logging

ci/etc/expected_install_directories

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
./include/google/cloud/automl/mocks
4949
./include/google/cloud/automl/v1
5050
./include/google/cloud/bigquery
51+
./include/google/cloud/bigquery/connection
52+
./include/google/cloud/bigquery/connection/v1
5153
./include/google/cloud/bigquery/internal
5254
./include/google/cloud/bigquery/mocks
5355
./include/google/cloud/bigquery/storage

generator/generator_config.textproto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ service {
105105
retryable_status_codes: ["kDeadlineExceeded", "kUnavailable"]
106106
}
107107

108+
service {
109+
service_proto_path: "google/cloud/bigquery/connection/v1/connection.proto"
110+
product_path: "google/cloud/bigquery"
111+
initial_copyright_year: "2022"
112+
retryable_status_codes: ["kUnavailable"]
113+
}
114+
108115
# Bigtable
109116
service {
110117
service_proto_path: "google/bigtable/admin/v2/bigtable_instance_admin.proto"

google/cloud/bigquery/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ cc_library(
2626
deps = [
2727
"//google/cloud:google_cloud_cpp_common",
2828
"//google/cloud:google_cloud_cpp_grpc_utils",
29+
"@com_google_googleapis//google/cloud/bigquery/connection/v1:connection_cc_grpc",
30+
"@com_google_googleapis//google/cloud/bigquery/datatransfer/v1:datatransfer_cc_grpc",
31+
"@com_google_googleapis//google/cloud/bigquery/logging/v1:logging_cc_grpc",
32+
"@com_google_googleapis//google/cloud/bigquery/reservation/v1:reservation_cc_grpc",
2933
"@com_google_googleapis//google/cloud/bigquery/storage/v1:storage_cc_grpc",
34+
"@com_google_googleapis//google/cloud/bigquery/v2:bigquery_cc_grpc",
3035
],
3136
)
3237

google/cloud/bigquery/CMakeLists.txt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ add_library(
3838
bigquery_read_connection_idempotency_policy.cc
3939
bigquery_read_connection_idempotency_policy.h
4040
bigquery_read_options.h
41+
connection_client.cc
42+
connection_client.h
43+
connection_connection.cc
44+
connection_connection.h
45+
connection_connection_idempotency_policy.cc
46+
connection_connection_idempotency_policy.h
47+
connection_options.h
4148
internal/bigquery_read_auth_decorator.cc
4249
internal/bigquery_read_auth_decorator.h
4350
internal/bigquery_read_connection_impl.cc
@@ -53,6 +60,21 @@ add_library(
5360
internal/bigquery_read_stub.h
5461
internal/bigquery_read_stub_factory.cc
5562
internal/bigquery_read_stub_factory.h
63+
internal/connection_auth_decorator.cc
64+
internal/connection_auth_decorator.h
65+
internal/connection_connection_impl.cc
66+
internal/connection_connection_impl.h
67+
internal/connection_logging_decorator.cc
68+
internal/connection_logging_decorator.h
69+
internal/connection_metadata_decorator.cc
70+
internal/connection_metadata_decorator.h
71+
internal/connection_option_defaults.cc
72+
internal/connection_option_defaults.h
73+
internal/connection_retry_traits.h
74+
internal/connection_stub.cc
75+
internal/connection_stub.h
76+
internal/connection_stub_factory.cc
77+
internal/connection_stub_factory.h
5678
internal/streaming.cc
5779
retry_traits.h)
5880
target_include_directories(
@@ -88,7 +110,9 @@ create_bazel_config(google_cloud_cpp_bigquery YEAR "2021")
88110
add_library(google_cloud_cpp_bigquery_mocks INTERFACE)
89111
target_sources(
90112
google_cloud_cpp_bigquery_mocks
91-
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/mocks/mock_bigquery_read_connection.h)
113+
INTERFACE # cmake-format: sort
114+
${CMAKE_CURRENT_SOURCE_DIR}/mocks/mock_bigquery_read_connection.h
115+
${CMAKE_CURRENT_SOURCE_DIR}/mocks/mock_connection_connection.h)
92116
target_link_libraries(
93117
google_cloud_cpp_bigquery_mocks
94118
INTERFACE google-cloud-cpp::bigquery GTest::gmock_main GTest::gmock
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
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+
#include "google/cloud/bigquery/connection_client.h"
20+
#include "google/cloud/bigquery/internal/connection_option_defaults.h"
21+
#include <memory>
22+
23+
namespace google {
24+
namespace cloud {
25+
namespace bigquery {
26+
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
27+
28+
ConnectionServiceClient::ConnectionServiceClient(
29+
std::shared_ptr<ConnectionServiceConnection> connection, Options opts)
30+
: connection_(std::move(connection)),
31+
options_(internal::MergeOptions(
32+
std::move(opts), bigquery_internal::ConnectionServiceDefaultOptions(
33+
connection_->options()))) {}
34+
ConnectionServiceClient::~ConnectionServiceClient() = default;
35+
36+
StatusOr<google::cloud::bigquery::connection::v1::Connection>
37+
ConnectionServiceClient::CreateConnection(
38+
std::string const& parent,
39+
google::cloud::bigquery::connection::v1::Connection const& connection,
40+
std::string const& connection_id, Options opts) {
41+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
42+
google::cloud::bigquery::connection::v1::CreateConnectionRequest request;
43+
request.set_parent(parent);
44+
*request.mutable_connection() = connection;
45+
request.set_connection_id(connection_id);
46+
return connection_->CreateConnection(request);
47+
}
48+
49+
StatusOr<google::cloud::bigquery::connection::v1::Connection>
50+
ConnectionServiceClient::CreateConnection(
51+
google::cloud::bigquery::connection::v1::CreateConnectionRequest const&
52+
request,
53+
Options opts) {
54+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
55+
return connection_->CreateConnection(request);
56+
}
57+
58+
StatusOr<google::cloud::bigquery::connection::v1::Connection>
59+
ConnectionServiceClient::GetConnection(std::string const& name, Options opts) {
60+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
61+
google::cloud::bigquery::connection::v1::GetConnectionRequest request;
62+
request.set_name(name);
63+
return connection_->GetConnection(request);
64+
}
65+
66+
StatusOr<google::cloud::bigquery::connection::v1::Connection>
67+
ConnectionServiceClient::GetConnection(
68+
google::cloud::bigquery::connection::v1::GetConnectionRequest const&
69+
request,
70+
Options opts) {
71+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
72+
return connection_->GetConnection(request);
73+
}
74+
75+
StreamRange<google::cloud::bigquery::connection::v1::Connection>
76+
ConnectionServiceClient::ListConnections(std::string const& parent,
77+
Options opts) {
78+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
79+
google::cloud::bigquery::connection::v1::ListConnectionsRequest request;
80+
request.set_parent(parent);
81+
return connection_->ListConnections(request);
82+
}
83+
84+
StreamRange<google::cloud::bigquery::connection::v1::Connection>
85+
ConnectionServiceClient::ListConnections(
86+
google::cloud::bigquery::connection::v1::ListConnectionsRequest request,
87+
Options opts) {
88+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
89+
return connection_->ListConnections(std::move(request));
90+
}
91+
92+
StatusOr<google::cloud::bigquery::connection::v1::Connection>
93+
ConnectionServiceClient::UpdateConnection(
94+
std::string const& name,
95+
google::cloud::bigquery::connection::v1::Connection const& connection,
96+
google::protobuf::FieldMask const& update_mask, Options opts) {
97+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
98+
google::cloud::bigquery::connection::v1::UpdateConnectionRequest request;
99+
request.set_name(name);
100+
*request.mutable_connection() = connection;
101+
*request.mutable_update_mask() = update_mask;
102+
return connection_->UpdateConnection(request);
103+
}
104+
105+
StatusOr<google::cloud::bigquery::connection::v1::Connection>
106+
ConnectionServiceClient::UpdateConnection(
107+
google::cloud::bigquery::connection::v1::UpdateConnectionRequest const&
108+
request,
109+
Options opts) {
110+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
111+
return connection_->UpdateConnection(request);
112+
}
113+
114+
Status ConnectionServiceClient::DeleteConnection(std::string const& name,
115+
Options opts) {
116+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
117+
google::cloud::bigquery::connection::v1::DeleteConnectionRequest request;
118+
request.set_name(name);
119+
return connection_->DeleteConnection(request);
120+
}
121+
122+
Status ConnectionServiceClient::DeleteConnection(
123+
google::cloud::bigquery::connection::v1::DeleteConnectionRequest const&
124+
request,
125+
Options opts) {
126+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
127+
return connection_->DeleteConnection(request);
128+
}
129+
130+
StatusOr<google::iam::v1::Policy> ConnectionServiceClient::GetIamPolicy(
131+
std::string const& resource,
132+
google::iam::v1::GetPolicyOptions const& options, Options opts) {
133+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
134+
google::iam::v1::GetIamPolicyRequest request;
135+
request.set_resource(resource);
136+
*request.mutable_options() = options;
137+
return connection_->GetIamPolicy(request);
138+
}
139+
140+
StatusOr<google::iam::v1::Policy> ConnectionServiceClient::GetIamPolicy(
141+
google::iam::v1::GetIamPolicyRequest const& request, Options opts) {
142+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
143+
return connection_->GetIamPolicy(request);
144+
}
145+
146+
StatusOr<google::iam::v1::Policy> ConnectionServiceClient::SetIamPolicy(
147+
std::string const& resource, google::iam::v1::Policy const& policy,
148+
Options opts) {
149+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
150+
google::iam::v1::SetIamPolicyRequest request;
151+
request.set_resource(resource);
152+
*request.mutable_policy() = policy;
153+
return connection_->SetIamPolicy(request);
154+
}
155+
156+
StatusOr<google::iam::v1::Policy> ConnectionServiceClient::SetIamPolicy(
157+
google::iam::v1::SetIamPolicyRequest const& request, Options opts) {
158+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
159+
return connection_->SetIamPolicy(request);
160+
}
161+
162+
StatusOr<google::iam::v1::TestIamPermissionsResponse>
163+
ConnectionServiceClient::TestIamPermissions(
164+
std::string const& resource, std::vector<std::string> const& permissions,
165+
Options opts) {
166+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
167+
google::iam::v1::TestIamPermissionsRequest request;
168+
request.set_resource(resource);
169+
*request.mutable_permissions() = {permissions.begin(), permissions.end()};
170+
return connection_->TestIamPermissions(request);
171+
}
172+
173+
StatusOr<google::iam::v1::TestIamPermissionsResponse>
174+
ConnectionServiceClient::TestIamPermissions(
175+
google::iam::v1::TestIamPermissionsRequest const& request, Options opts) {
176+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
177+
return connection_->TestIamPermissions(request);
178+
}
179+
180+
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
181+
} // namespace bigquery
182+
} // namespace cloud
183+
} // namespace google

0 commit comments

Comments
 (0)