|
| 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