|
| 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/storage/v1/storage.proto |
| 18 | + |
| 19 | +#include "google/cloud/bigquery/bigquery_write_client.h" |
| 20 | +#include "google/cloud/bigquery/internal/bigquery_write_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 | +BigQueryWriteClient::BigQueryWriteClient( |
| 29 | + std::shared_ptr<BigQueryWriteConnection> connection, Options opts) |
| 30 | + : connection_(std::move(connection)), |
| 31 | + options_(internal::MergeOptions( |
| 32 | + std::move(opts), bigquery_internal::BigQueryWriteDefaultOptions( |
| 33 | + connection_->options()))) {} |
| 34 | +BigQueryWriteClient::~BigQueryWriteClient() = default; |
| 35 | + |
| 36 | +StatusOr<google::cloud::bigquery::storage::v1::WriteStream> |
| 37 | +BigQueryWriteClient::CreateWriteStream( |
| 38 | + std::string const& parent, |
| 39 | + google::cloud::bigquery::storage::v1::WriteStream const& write_stream, |
| 40 | + Options opts) { |
| 41 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 42 | + google::cloud::bigquery::storage::v1::CreateWriteStreamRequest request; |
| 43 | + request.set_parent(parent); |
| 44 | + *request.mutable_write_stream() = write_stream; |
| 45 | + return connection_->CreateWriteStream(request); |
| 46 | +} |
| 47 | + |
| 48 | +StatusOr<google::cloud::bigquery::storage::v1::WriteStream> |
| 49 | +BigQueryWriteClient::CreateWriteStream( |
| 50 | + google::cloud::bigquery::storage::v1::CreateWriteStreamRequest const& |
| 51 | + request, |
| 52 | + Options opts) { |
| 53 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 54 | + return connection_->CreateWriteStream(request); |
| 55 | +} |
| 56 | + |
| 57 | +std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc< |
| 58 | + google::cloud::bigquery::storage::v1::AppendRowsRequest, |
| 59 | + google::cloud::bigquery::storage::v1::AppendRowsResponse>> |
| 60 | +BigQueryWriteClient::AsyncAppendRows(ExperimentalTag tag, Options opts) { |
| 61 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 62 | + return connection_->AsyncAppendRows(std::move(tag)); |
| 63 | +} |
| 64 | + |
| 65 | +StatusOr<google::cloud::bigquery::storage::v1::WriteStream> |
| 66 | +BigQueryWriteClient::GetWriteStream(std::string const& name, Options opts) { |
| 67 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 68 | + google::cloud::bigquery::storage::v1::GetWriteStreamRequest request; |
| 69 | + request.set_name(name); |
| 70 | + return connection_->GetWriteStream(request); |
| 71 | +} |
| 72 | + |
| 73 | +StatusOr<google::cloud::bigquery::storage::v1::WriteStream> |
| 74 | +BigQueryWriteClient::GetWriteStream( |
| 75 | + google::cloud::bigquery::storage::v1::GetWriteStreamRequest const& request, |
| 76 | + Options opts) { |
| 77 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 78 | + return connection_->GetWriteStream(request); |
| 79 | +} |
| 80 | + |
| 81 | +StatusOr<google::cloud::bigquery::storage::v1::FinalizeWriteStreamResponse> |
| 82 | +BigQueryWriteClient::FinalizeWriteStream(std::string const& name, |
| 83 | + Options opts) { |
| 84 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 85 | + google::cloud::bigquery::storage::v1::FinalizeWriteStreamRequest request; |
| 86 | + request.set_name(name); |
| 87 | + return connection_->FinalizeWriteStream(request); |
| 88 | +} |
| 89 | + |
| 90 | +StatusOr<google::cloud::bigquery::storage::v1::FinalizeWriteStreamResponse> |
| 91 | +BigQueryWriteClient::FinalizeWriteStream( |
| 92 | + google::cloud::bigquery::storage::v1::FinalizeWriteStreamRequest const& |
| 93 | + request, |
| 94 | + Options opts) { |
| 95 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 96 | + return connection_->FinalizeWriteStream(request); |
| 97 | +} |
| 98 | + |
| 99 | +StatusOr<google::cloud::bigquery::storage::v1::BatchCommitWriteStreamsResponse> |
| 100 | +BigQueryWriteClient::BatchCommitWriteStreams(std::string const& parent, |
| 101 | + Options opts) { |
| 102 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 103 | + google::cloud::bigquery::storage::v1::BatchCommitWriteStreamsRequest request; |
| 104 | + request.set_parent(parent); |
| 105 | + return connection_->BatchCommitWriteStreams(request); |
| 106 | +} |
| 107 | + |
| 108 | +StatusOr<google::cloud::bigquery::storage::v1::BatchCommitWriteStreamsResponse> |
| 109 | +BigQueryWriteClient::BatchCommitWriteStreams( |
| 110 | + google::cloud::bigquery::storage::v1::BatchCommitWriteStreamsRequest const& |
| 111 | + request, |
| 112 | + Options opts) { |
| 113 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 114 | + return connection_->BatchCommitWriteStreams(request); |
| 115 | +} |
| 116 | + |
| 117 | +StatusOr<google::cloud::bigquery::storage::v1::FlushRowsResponse> |
| 118 | +BigQueryWriteClient::FlushRows(std::string const& write_stream, Options opts) { |
| 119 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 120 | + google::cloud::bigquery::storage::v1::FlushRowsRequest request; |
| 121 | + request.set_write_stream(write_stream); |
| 122 | + return connection_->FlushRows(request); |
| 123 | +} |
| 124 | + |
| 125 | +StatusOr<google::cloud::bigquery::storage::v1::FlushRowsResponse> |
| 126 | +BigQueryWriteClient::FlushRows( |
| 127 | + google::cloud::bigquery::storage::v1::FlushRowsRequest const& request, |
| 128 | + Options opts) { |
| 129 | + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); |
| 130 | + return connection_->FlushRows(request); |
| 131 | +} |
| 132 | + |
| 133 | +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END |
| 134 | +} // namespace bigquery |
| 135 | +} // namespace cloud |
| 136 | +} // namespace google |
0 commit comments