diff --git a/ci/abi-dumps/google_cloud_cpp_channel.expected.abi.dump.gz b/ci/abi-dumps/google_cloud_cpp_channel.expected.abi.dump.gz index 10ae67511971d..ad916ffce55ff 100644 Binary files a/ci/abi-dumps/google_cloud_cpp_channel.expected.abi.dump.gz and b/ci/abi-dumps/google_cloud_cpp_channel.expected.abi.dump.gz differ diff --git a/generator/generator_config.textproto b/generator/generator_config.textproto index bbbbfb69b3161..7398c70893d21 100644 --- a/generator/generator_config.textproto +++ b/generator/generator_config.textproto @@ -745,14 +745,6 @@ service { retryable_status_codes: ["kUnavailable"] } -service { - service_proto_path: "google/cloud/channel/v1/reports_service.proto" - additional_proto_files: ["google/cloud/channel/v1/operations.proto"] - product_path: "google/cloud/channel/v1" - initial_copyright_year: "2023" - retryable_status_codes: ["kUnavailable"] -} - # Cloud Controls Partner service { service_proto_path: "google/cloud/cloudcontrolspartner/v1/core.proto" diff --git a/google/cloud/channel/doc/environment-variables.dox b/google/cloud/channel/doc/environment-variables.dox index 87279b5131706..e3aaf0e96a2ac 100644 --- a/google/cloud/channel/doc/environment-variables.dox +++ b/google/cloud/channel/doc/environment-variables.dox @@ -9,10 +9,6 @@ environment variables are convenient when troubleshooting problems. -- `GOOGLE_CLOUD_CPP_CLOUD_CHANNEL_REPORTS_SERVICE_ENDPOINT=...` overrides the - `EndpointOption` (which defaults to "cloudchannel.googleapis.com") - used by `MakeCloudChannelReportsServiceConnection()`. - - `GOOGLE_CLOUD_CPP_CLOUD_CHANNEL_SERVICE_ENDPOINT=...` overrides the `EndpointOption` (which defaults to "cloudchannel.googleapis.com") used by `MakeCloudChannelServiceConnection()`. diff --git a/google/cloud/channel/doc/main.dox b/google/cloud/channel/doc/main.dox index e26afd0f79404..6c2e718803565 100644 --- a/google/cloud/channel/doc/main.dox +++ b/google/cloud/channel/doc/main.dox @@ -22,18 +22,12 @@ which should give you a taste of the Cloud Channel API C++ client library API. ## Main classes -This library offers multiple `*Client` classes, which are listed below. Each one -of these classes exposes all the RPCs for a service as member functions of the -class. This library groups multiple services because they are part of the same -product or are often used together. A typical example may be the administrative -and data plane operations for a single product. - -The library also has other classes that provide helpers, configuration -parameters, and infrastructure to mock the `*Client` classes when testing your +The main class in this library is +[`channel_v1::CloudChannelServiceClient`](@ref google::cloud::channel_v1::CloudChannelServiceClient). All RPCs are exposed +as member functions of this class. Other classes provide helpers, configuration +parameters, and infrastructure to mock +[`channel_v1::CloudChannelServiceClient`](@ref google::cloud::channel_v1::CloudChannelServiceClient) when testing your application. - -- [\c channel_v1::CloudChannelServiceClient](@ref google::cloud::channel_v1::CloudChannelServiceClient) -- [\c channel_v1::CloudChannelReportsServiceClient](@ref google::cloud::channel_v1::CloudChannelReportsServiceClient) ## More Information diff --git a/google/cloud/channel/doc/override-authentication.dox b/google/cloud/channel/doc/override-authentication.dox index 99bb4a4ba99af..362da1179fa24 100644 --- a/google/cloud/channel/doc/override-authentication.dox +++ b/google/cloud/channel/doc/override-authentication.dox @@ -11,11 +11,6 @@ The following example shows how to explicitly load a service account key file: @snippet cloud_channel_client_samples.cc with-service-account -Follow these links to find examples for other \c *Client classes: - -- [\c channel_v1::CloudChannelServiceClient](@ref channel_v1::CloudChannelServiceClient-service-account-snippet) -- [\c channel_v1::CloudChannelReportsServiceClient](@ref channel_v1::CloudChannelReportsServiceClient-service-account-snippet) - Keep in mind that we chose this as an example because it is relatively easy to @@ -36,11 +31,5 @@ guide for more details. @snippet google/cloud/channel/v1/samples/cloud_channel_client_samples.cc with-service-account -*/ - -/*! @page channel_v1::CloudChannelReportsServiceClient-service-account-snippet Override channel_v1::CloudChannelReportsServiceClient Authentication Defaults - -@snippet google/cloud/channel/v1/samples/cloud_channel_reports_client_samples.cc with-service-account - */ // diff --git a/google/cloud/channel/doc/override-endpoint.dox b/google/cloud/channel/doc/override-endpoint.dox index 30253d1238885..dbccdff87a160 100644 --- a/google/cloud/channel/doc/override-endpoint.dox +++ b/google/cloud/channel/doc/override-endpoint.dox @@ -11,11 +11,6 @@ For example, this will override the default endpoint for `channel_v1::CloudChann @snippet cloud_channel_client_samples.cc set-client-endpoint -Follow these links to find examples for other \c *Client classes: - -- [\c channel_v1::CloudChannelServiceClient](@ref channel_v1::CloudChannelServiceClient-endpoint-snippet) -- [\c channel_v1::CloudChannelReportsServiceClient](@ref channel_v1::CloudChannelReportsServiceClient-endpoint-snippet) - */ @@ -26,11 +21,5 @@ Follow these links to find examples for other \c *Client classes: @snippet google/cloud/channel/v1/samples/cloud_channel_client_samples.cc set-client-endpoint -*/ - -/*! @page channel_v1::CloudChannelReportsServiceClient-endpoint-snippet Override channel_v1::CloudChannelReportsServiceClient Endpoint Configuration - -@snippet google/cloud/channel/v1/samples/cloud_channel_reports_client_samples.cc set-client-endpoint - */ // diff --git a/google/cloud/channel/doc/override-retry-policies.dox b/google/cloud/channel/doc/override-retry-policies.dox index 0b361974f26a9..2dc2fa9dc6066 100644 --- a/google/cloud/channel/doc/override-retry-policies.dox +++ b/google/cloud/channel/doc/override-retry-policies.dox @@ -80,11 +80,6 @@ This will override the polling policies for `channel_v1::CloudChannelServiceClie @snippet cloud_channel_client_samples.cc set-polling-policy -Follow these links to find examples for other \c *Client classes: - -- [\c channel_v1::CloudChannelServiceClient](@ref channel_v1::CloudChannelServiceClient-retry-snippet) -- [\c channel_v1::CloudChannelReportsServiceClient](@ref channel_v1::CloudChannelReportsServiceClient-retry-snippet) - @section channel-override-retry-more-information More Information @@ -109,17 +104,5 @@ Assuming you have created a custom idempotency policy. Such as: @snippet google/cloud/channel/v1/samples/cloud_channel_client_samples.cc custom-idempotency-policy -*/ - -/*! @page channel_v1::CloudChannelReportsServiceClient-retry-snippet Override channel_v1::CloudChannelReportsServiceClient Retry Policies - -This shows how to override the retry policies for channel_v1::CloudChannelReportsServiceClient: - -@snippet google/cloud/channel/v1/samples/cloud_channel_reports_client_samples.cc set-retry-policy - -Assuming you have created a custom idempotency policy. Such as: - -@snippet google/cloud/channel/v1/samples/cloud_channel_reports_client_samples.cc custom-idempotency-policy - */ // diff --git a/google/cloud/channel/doc/override-universe-domain.dox b/google/cloud/channel/doc/override-universe-domain.dox index 824898a382df8..0389701576c56 100644 --- a/google/cloud/channel/doc/override-universe-domain.dox +++ b/google/cloud/channel/doc/override-universe-domain.dox @@ -10,11 +10,6 @@ For example, this will override the default universe domain for `channel_v1::Clo @snippet cloud_channel_client_samples.cc set-client-universe-domain -Follow these links to find examples for other \c *Client classes: - -- [\c channel_v1::CloudChannelServiceClient](@ref channel_v1::CloudChannelServiceClient-universe-domain-snippet) -- [\c channel_v1::CloudChannelReportsServiceClient](@ref channel_v1::CloudChannelReportsServiceClient-universe-domain-snippet) - */ @@ -25,11 +20,5 @@ Follow these links to find examples for other \c *Client classes: @snippet google/cloud/channel/v1/samples/cloud_channel_client_samples.cc set-client-universe-domain -*/ - -/*! @page channel_v1::CloudChannelReportsServiceClient-universe-domain-snippet Override channel_v1::CloudChannelReportsServiceClient Universe Domain - -@snippet google/cloud/channel/v1/samples/cloud_channel_reports_client_samples.cc set-client-universe-domain - */ // diff --git a/google/cloud/channel/v1/cloud_channel_reports_client.cc b/google/cloud/channel/v1/cloud_channel_reports_client.cc deleted file mode 100644 index 48de414b35fb1..0000000000000 --- a/google/cloud/channel/v1/cloud_channel_reports_client.cc +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/cloud_channel_reports_client.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1 { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -CloudChannelReportsServiceClient::CloudChannelReportsServiceClient( - std::shared_ptr connection, - Options opts) - : connection_(std::move(connection)), - options_( - internal::MergeOptions(std::move(opts), connection_->options())) {} -CloudChannelReportsServiceClient::~CloudChannelReportsServiceClient() = default; - -future> -CloudChannelReportsServiceClient::RunReportJob( - google::cloud::channel::v1::RunReportJobRequest const& request, - Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - return connection_->RunReportJob(request); -} - -StatusOr -CloudChannelReportsServiceClient::RunReportJob( - NoAwaitTag, google::cloud::channel::v1::RunReportJobRequest const& request, - Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - return connection_->RunReportJob(NoAwaitTag{}, request); -} - -future> -CloudChannelReportsServiceClient::RunReportJob( - google::longrunning::Operation const& operation, Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - return connection_->RunReportJob(operation); -} - -StreamRange -CloudChannelReportsServiceClient::FetchReportResults( - std::string const& report_job, Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - google::cloud::channel::v1::FetchReportResultsRequest request; - request.set_report_job(report_job); - return connection_->FetchReportResults(request); -} - -StreamRange -CloudChannelReportsServiceClient::FetchReportResults( - google::cloud::channel::v1::FetchReportResultsRequest request, - Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - return connection_->FetchReportResults(std::move(request)); -} - -StreamRange -CloudChannelReportsServiceClient::ListReports(std::string const& parent, - Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - google::cloud::channel::v1::ListReportsRequest request; - request.set_parent(parent); - return connection_->ListReports(request); -} - -StreamRange -CloudChannelReportsServiceClient::ListReports( - google::cloud::channel::v1::ListReportsRequest request, Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - return connection_->ListReports(std::move(request)); -} - -StreamRange -CloudChannelReportsServiceClient::ListOperations(std::string const& name, - std::string const& filter, - Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - google::longrunning::ListOperationsRequest request; - request.set_name(name); - request.set_filter(filter); - return connection_->ListOperations(request); -} - -StreamRange -CloudChannelReportsServiceClient::ListOperations( - google::longrunning::ListOperationsRequest request, Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - return connection_->ListOperations(std::move(request)); -} - -StatusOr -CloudChannelReportsServiceClient::GetOperation(std::string const& name, - Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - google::longrunning::GetOperationRequest request; - request.set_name(name); - return connection_->GetOperation(request); -} - -StatusOr -CloudChannelReportsServiceClient::GetOperation( - google::longrunning::GetOperationRequest const& request, Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - return connection_->GetOperation(request); -} - -Status CloudChannelReportsServiceClient::DeleteOperation( - std::string const& name, Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - google::longrunning::DeleteOperationRequest request; - request.set_name(name); - return connection_->DeleteOperation(request); -} - -Status CloudChannelReportsServiceClient::DeleteOperation( - google::longrunning::DeleteOperationRequest const& request, Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - return connection_->DeleteOperation(request); -} - -Status CloudChannelReportsServiceClient::CancelOperation( - std::string const& name, Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - google::longrunning::CancelOperationRequest request; - request.set_name(name); - return connection_->CancelOperation(request); -} - -Status CloudChannelReportsServiceClient::CancelOperation( - google::longrunning::CancelOperationRequest const& request, Options opts) { - internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); - return connection_->CancelOperation(request); -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1 -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/cloud_channel_reports_client.h b/google/cloud/channel/v1/cloud_channel_reports_client.h deleted file mode 100644 index 0afe404f80921..0000000000000 --- a/google/cloud/channel/v1/cloud_channel_reports_client.h +++ /dev/null @@ -1,673 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_CLIENT_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_CLIENT_H - -#include "google/cloud/channel/v1/cloud_channel_reports_connection.h" -#include "google/cloud/future.h" -#include "google/cloud/no_await_tag.h" -#include "google/cloud/options.h" -#include "google/cloud/polling_policy.h" -#include "google/cloud/status_or.h" -#include "google/cloud/version.h" -#include "google/longrunning/operations.grpc.pb.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1 { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -/// -/// CloudChannelReportsService lets Google Cloud resellers and -/// distributors retrieve and combine a variety of data in Cloud Channel for -/// multiple products (Google Cloud, Google Voice, and Google Workspace.) -/// -/// Deprecated: This service is being deprecated. Please use [Export Channel -/// Services data to -/// BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) -/// instead. -/// -/// @par Equality -/// -/// Instances of this class created via copy-construction or copy-assignment -/// always compare equal. Instances created with equal -/// `std::shared_ptr<*Connection>` objects compare equal. Objects that compare -/// equal share the same underlying resources. -/// -/// @par Performance -/// -/// Creating a new instance of this class is a relatively expensive operation, -/// new objects establish new connections to the service. In contrast, -/// copy-construction, move-construction, and the corresponding assignment -/// operations are relatively efficient as the copies share all underlying -/// resources. -/// -/// @par Thread Safety -/// -/// Concurrent access to different instances of this class, even if they compare -/// equal, is guaranteed to work. Two or more threads operating on the same -/// instance of this class is not guaranteed to work. Since copy-construction -/// and move-construction is a relatively efficient operation, consider using -/// such a copy when using this class from multiple threads. -/// -class GOOGLE_CLOUD_CPP_DEPRECATED( - "CloudChannelReportsService has been deprecated and will be turned down in " - "the future.") CloudChannelReportsServiceClient { - public: - explicit CloudChannelReportsServiceClient( - std::shared_ptr connection, - Options opts = {}); - ~CloudChannelReportsServiceClient(); - - ///@{ - /// @name Copy and move support - CloudChannelReportsServiceClient(CloudChannelReportsServiceClient const&) = - default; - CloudChannelReportsServiceClient& operator=( - CloudChannelReportsServiceClient const&) = default; - CloudChannelReportsServiceClient(CloudChannelReportsServiceClient&&) = - default; - CloudChannelReportsServiceClient& operator=( - CloudChannelReportsServiceClient&&) = default; - ///@} - - ///@{ - /// @name Equality - friend bool operator==(CloudChannelReportsServiceClient const& a, - CloudChannelReportsServiceClient const& b) { - return a.connection_ == b.connection_; - } - friend bool operator!=(CloudChannelReportsServiceClient const& a, - CloudChannelReportsServiceClient const& b) { - return !(a == b); - } - ///@} - - // clang-format off - /// - /// @deprecated This RPC is deprecated. - /// - /// Begins generation of data for a given report. The report - /// identifier is a UID (for example, `613bf59q`). - /// - /// Possible error codes: - /// - /// * PERMISSION_DENIED: The user doesn't have access to this report. - /// * INVALID_ARGUMENT: Required request parameters are missing - /// or invalid. - /// * NOT_FOUND: The report identifier was not found. - /// * INTERNAL: Any non-user error related to a technical issue - /// in the backend. Contact Cloud Channel support. - /// * UNKNOWN: Any non-user error related to a technical issue - /// in the backend. Contact Cloud Channel support. - /// - /// Return value: - /// The ID of a long-running operation. - /// - /// To get the results of the operation, call the GetOperation method of - /// CloudChannelOperationsService. The Operation metadata contains an - /// instance of [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - /// - /// To get the results of report generation, call - /// [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults] - /// with the - /// [RunReportJobResponse.report_job][google.cloud.channel.v1.RunReportJobResponse.report_job]. - /// - /// Deprecated: Please use [Export Channel Services data to - /// BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) - /// instead. - /// - /// @param request Unary RPCs, such as the one wrapped by this - /// function, receive a single `request` proto message which includes all - /// the inputs for the RPC. In this case, the proto message is a - /// [google.cloud.channel.v1.RunReportJobRequest]. - /// Proto messages are converted to C++ classes by Protobuf, using the - /// [Protobuf mapping rules]. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return A [`future`] that becomes satisfied when the LRO - /// ([Long Running Operation]) completes or the polling policy in effect - /// for this call is exhausted. The future is satisfied with an error if - /// the LRO completes with an error or the polling policy is exhausted. - /// In this case the [`StatusOr`] returned by the future contains the - /// error. If the LRO completes successfully the value of the future - /// contains the LRO's result. For this RPC the result is a - /// [google.cloud.channel.v1.RunReportJobResponse] proto message. - /// The C++ class representing this message is created by Protobuf, using - /// the [Protobuf mapping rules]. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [Long Running Operation]: https://google.aip.dev/151 - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L97} - /// [google.cloud.channel.v1.OperationMetadata]: @googleapis_reference_link{google/cloud/channel/v1/operations.proto#L26} - /// [google.cloud.channel.v1.RunReportJobRequest]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L124} - /// [google.cloud.channel.v1.RunReportJobResponse]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L163} - /// [google.cloud.channel.v1.RunReportJobResponse.report_job]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L169} - /// - // clang-format on - GOOGLE_CLOUD_CPP_DEPRECATED("This RPC is deprecated.") - future> - RunReportJob(google::cloud::channel::v1::RunReportJobRequest const& request, - Options opts = {}); - - // clang-format off - /// - /// @deprecated This RPC is deprecated. - /// - /// @copybrief RunReportJob - /// - /// Specifying the [`NoAwaitTag`] immediately returns the - /// [`google::longrunning::Operation`] that corresponds to the Long Running - /// Operation that has been started. No polling for operation status occurs. - /// - /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag - /// - // clang-format on - GOOGLE_CLOUD_CPP_DEPRECATED("This RPC is deprecated.") - StatusOr RunReportJob( - NoAwaitTag, - google::cloud::channel::v1::RunReportJobRequest const& request, - Options opts = {}); - - // clang-format off - /// - /// @deprecated This RPC is deprecated. - /// - /// @copybrief RunReportJob - /// - /// This method accepts a `google::longrunning::Operation` that corresponds - /// to a previously started Long Running Operation (LRO) and polls the status - /// of the LRO in the background. - /// - // clang-format on - GOOGLE_CLOUD_CPP_DEPRECATED("This RPC is deprecated.") - future> - RunReportJob(google::longrunning::Operation const& operation, - Options opts = {}); - - // clang-format off - /// - /// @deprecated This RPC is deprecated. - /// - /// Retrieves data generated by - /// [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. - /// - /// Deprecated: Please use [Export Channel Services data to - /// BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) - /// instead. - /// - /// @param report_job Required. The report job created by - /// [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. - /// Report_job uses the format: - /// accounts/{account_id}/reportJobs/{report_job_id} - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return a [StreamRange](@ref google::cloud::StreamRange) - /// to iterate of the results. See the documentation of this type for - /// details. In brief, this class has `begin()` and `end()` member - /// functions returning a iterator class meeting the - /// [input iterator requirements]. The value type for this iterator is a - /// [`StatusOr`] as the iteration may fail even after some values are - /// retrieved successfully, for example, if there is a network disconnect. - /// An empty set of results does not indicate an error, it indicates - /// that there are no resources meeting the request criteria. - /// On a successful iteration the `StatusOr` contains elements of type - /// [google.cloud.channel.v1.Row], or rather, - /// the C++ class generated by Protobuf from that type. Please consult the - /// Protobuf documentation for details on the [Protobuf mapping rules]. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L79} - /// [google.cloud.channel.v1.FetchReportResultsRequest]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L179} - /// [google.cloud.channel.v1.Row]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L399} - /// - // clang-format on - GOOGLE_CLOUD_CPP_DEPRECATED("This RPC is deprecated.") - StreamRange FetchReportResults( - std::string const& report_job, Options opts = {}); - - // clang-format off - /// - /// @deprecated This RPC is deprecated. - /// - /// Retrieves data generated by - /// [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. - /// - /// Deprecated: Please use [Export Channel Services data to - /// BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) - /// instead. - /// - /// @param request Unary RPCs, such as the one wrapped by this - /// function, receive a single `request` proto message which includes all - /// the inputs for the RPC. In this case, the proto message is a - /// [google.cloud.channel.v1.FetchReportResultsRequest]. - /// Proto messages are converted to C++ classes by Protobuf, using the - /// [Protobuf mapping rules]. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return a [StreamRange](@ref google::cloud::StreamRange) - /// to iterate of the results. See the documentation of this type for - /// details. In brief, this class has `begin()` and `end()` member - /// functions returning a iterator class meeting the - /// [input iterator requirements]. The value type for this iterator is a - /// [`StatusOr`] as the iteration may fail even after some values are - /// retrieved successfully, for example, if there is a network disconnect. - /// An empty set of results does not indicate an error, it indicates - /// that there are no resources meeting the request criteria. - /// On a successful iteration the `StatusOr` contains elements of type - /// [google.cloud.channel.v1.Row], or rather, - /// the C++ class generated by Protobuf from that type. Please consult the - /// Protobuf documentation for details on the [Protobuf mapping rules]. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L79} - /// [google.cloud.channel.v1.FetchReportResultsRequest]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L179} - /// [google.cloud.channel.v1.Row]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L399} - /// - // clang-format on - GOOGLE_CLOUD_CPP_DEPRECATED("This RPC is deprecated.") - StreamRange FetchReportResults( - google::cloud::channel::v1::FetchReportResultsRequest request, - Options opts = {}); - - // clang-format off - /// - /// @deprecated This RPC is deprecated. - /// - /// Lists the reports that RunReportJob can run. These reports include an ID, - /// a description, and the list of columns that will be in the result. - /// - /// Deprecated: Please use [Export Channel Services data to - /// BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) - /// instead. - /// - /// @param parent Required. The resource name of the partner account to list available - /// reports for. Parent uses the format: accounts/{account_id} - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return a [StreamRange](@ref google::cloud::StreamRange) - /// to iterate of the results. See the documentation of this type for - /// details. In brief, this class has `begin()` and `end()` member - /// functions returning a iterator class meeting the - /// [input iterator requirements]. The value type for this iterator is a - /// [`StatusOr`] as the iteration may fail even after some values are - /// retrieved successfully, for example, if there is a network disconnect. - /// An empty set of results does not indicate an error, it indicates - /// that there are no resources meeting the request criteria. - /// On a successful iteration the `StatusOr` contains elements of type - /// [google.cloud.channel.v1.Report], or rather, - /// the C++ class generated by Protobuf from that type. Please consult the - /// Protobuf documentation for details on the [Protobuf mapping rules]. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.cloud.channel.v1.ListReportsRequest]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L236} - /// [google.cloud.channel.v1.Report]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L474} - /// - // clang-format on - GOOGLE_CLOUD_CPP_DEPRECATED("This RPC is deprecated.") - StreamRange ListReports( - std::string const& parent, Options opts = {}); - - // clang-format off - /// - /// @deprecated This RPC is deprecated. - /// - /// Lists the reports that RunReportJob can run. These reports include an ID, - /// a description, and the list of columns that will be in the result. - /// - /// Deprecated: Please use [Export Channel Services data to - /// BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) - /// instead. - /// - /// @param request Unary RPCs, such as the one wrapped by this - /// function, receive a single `request` proto message which includes all - /// the inputs for the RPC. In this case, the proto message is a - /// [google.cloud.channel.v1.ListReportsRequest]. - /// Proto messages are converted to C++ classes by Protobuf, using the - /// [Protobuf mapping rules]. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return a [StreamRange](@ref google::cloud::StreamRange) - /// to iterate of the results. See the documentation of this type for - /// details. In brief, this class has `begin()` and `end()` member - /// functions returning a iterator class meeting the - /// [input iterator requirements]. The value type for this iterator is a - /// [`StatusOr`] as the iteration may fail even after some values are - /// retrieved successfully, for example, if there is a network disconnect. - /// An empty set of results does not indicate an error, it indicates - /// that there are no resources meeting the request criteria. - /// On a successful iteration the `StatusOr` contains elements of type - /// [google.cloud.channel.v1.Report], or rather, - /// the C++ class generated by Protobuf from that type. Please consult the - /// Protobuf documentation for details on the [Protobuf mapping rules]. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.cloud.channel.v1.ListReportsRequest]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L236} - /// [google.cloud.channel.v1.Report]: @googleapis_reference_link{google/cloud/channel/v1/reports_service.proto#L474} - /// - // clang-format on - GOOGLE_CLOUD_CPP_DEPRECATED("This RPC is deprecated.") - StreamRange ListReports( - google::cloud::channel::v1::ListReportsRequest request, - Options opts = {}); - - // clang-format off - /// - /// Lists operations that match the specified filter in the request. If the - /// server doesn't support this method, it returns `UNIMPLEMENTED`. - /// - /// @param name The name of the operation's parent resource. - /// @param filter The standard list filter. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return a [StreamRange](@ref google::cloud::StreamRange) - /// to iterate of the results. See the documentation of this type for - /// details. In brief, this class has `begin()` and `end()` member - /// functions returning a iterator class meeting the - /// [input iterator requirements]. The value type for this iterator is a - /// [`StatusOr`] as the iteration may fail even after some values are - /// retrieved successfully, for example, if there is a network disconnect. - /// An empty set of results does not indicate an error, it indicates - /// that there are no resources meeting the request criteria. - /// On a successful iteration the `StatusOr` contains elements of type - /// [google.longrunning.Operation], or rather, - /// the C++ class generated by Protobuf from that type. Please consult the - /// Protobuf documentation for details on the [Protobuf mapping rules]. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.longrunning.ListOperationsRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L167} - /// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L121} - /// - // clang-format on - StreamRange ListOperations( - std::string const& name, std::string const& filter, Options opts = {}); - - // clang-format off - /// - /// Lists operations that match the specified filter in the request. If the - /// server doesn't support this method, it returns `UNIMPLEMENTED`. - /// - /// @param request Unary RPCs, such as the one wrapped by this - /// function, receive a single `request` proto message which includes all - /// the inputs for the RPC. In this case, the proto message is a - /// [google.longrunning.ListOperationsRequest]. - /// Proto messages are converted to C++ classes by Protobuf, using the - /// [Protobuf mapping rules]. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return a [StreamRange](@ref google::cloud::StreamRange) - /// to iterate of the results. See the documentation of this type for - /// details. In brief, this class has `begin()` and `end()` member - /// functions returning a iterator class meeting the - /// [input iterator requirements]. The value type for this iterator is a - /// [`StatusOr`] as the iteration may fail even after some values are - /// retrieved successfully, for example, if there is a network disconnect. - /// An empty set of results does not indicate an error, it indicates - /// that there are no resources meeting the request criteria. - /// On a successful iteration the `StatusOr` contains elements of type - /// [google.longrunning.Operation], or rather, - /// the C++ class generated by Protobuf from that type. Please consult the - /// Protobuf documentation for details on the [Protobuf mapping rules]. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.longrunning.ListOperationsRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L167} - /// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L121} - /// - // clang-format on - StreamRange ListOperations( - google::longrunning::ListOperationsRequest request, Options opts = {}); - - // clang-format off - /// - /// Gets the latest state of a long-running operation. Clients can use this - /// method to poll the operation result at intervals as recommended by the API - /// service. - /// - /// @param name The name of the operation resource. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return the result of the RPC. The response message type - /// ([google.longrunning.Operation]) - /// is mapped to a C++ class using the [Protobuf mapping rules]. - /// If the request fails, the [`StatusOr`] contains the error details. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.longrunning.GetOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L160} - /// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L121} - /// - // clang-format on - StatusOr GetOperation(std::string const& name, - Options opts = {}); - - // clang-format off - /// - /// Gets the latest state of a long-running operation. Clients can use this - /// method to poll the operation result at intervals as recommended by the API - /// service. - /// - /// @param request Unary RPCs, such as the one wrapped by this - /// function, receive a single `request` proto message which includes all - /// the inputs for the RPC. In this case, the proto message is a - /// [google.longrunning.GetOperationRequest]. - /// Proto messages are converted to C++ classes by Protobuf, using the - /// [Protobuf mapping rules]. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return the result of the RPC. The response message type - /// ([google.longrunning.Operation]) - /// is mapped to a C++ class using the [Protobuf mapping rules]. - /// If the request fails, the [`StatusOr`] contains the error details. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.longrunning.GetOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L160} - /// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L121} - /// - // clang-format on - StatusOr GetOperation( - google::longrunning::GetOperationRequest const& request, - Options opts = {}); - - // clang-format off - /// - /// Deletes a long-running operation. This method indicates that the client is - /// no longer interested in the operation result. It does not cancel the - /// operation. If the server doesn't support this method, it returns - /// `google.rpc.Code.UNIMPLEMENTED`. - /// - /// @param name The name of the operation resource to be deleted. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return a [`Status`] object. If the request failed, the - /// status contains the details of the failure. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.longrunning.DeleteOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L219} - /// - // clang-format on - Status DeleteOperation(std::string const& name, Options opts = {}); - - // clang-format off - /// - /// Deletes a long-running operation. This method indicates that the client is - /// no longer interested in the operation result. It does not cancel the - /// operation. If the server doesn't support this method, it returns - /// `google.rpc.Code.UNIMPLEMENTED`. - /// - /// @param request Unary RPCs, such as the one wrapped by this - /// function, receive a single `request` proto message which includes all - /// the inputs for the RPC. In this case, the proto message is a - /// [google.longrunning.DeleteOperationRequest]. - /// Proto messages are converted to C++ classes by Protobuf, using the - /// [Protobuf mapping rules]. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return a [`Status`] object. If the request failed, the - /// status contains the details of the failure. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.longrunning.DeleteOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L219} - /// - // clang-format on - Status DeleteOperation( - google::longrunning::DeleteOperationRequest const& request, - Options opts = {}); - - // clang-format off - /// - /// Starts asynchronous cancellation on a long-running operation. The server - /// makes a best effort to cancel the operation, but success is not - /// guaranteed. If the server doesn't support this method, it returns - /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use - /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - /// other methods to check whether the cancellation succeeded or whether the - /// operation completed despite cancellation. On successful cancellation, - /// the operation is not deleted; instead, it becomes an operation with - /// an [Operation.error][google.longrunning.Operation.error] value with a - /// [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to - /// `Code.CANCELLED`. - /// - /// @param name The name of the operation resource to be cancelled. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return a [`Status`] object. If the request failed, the - /// status contains the details of the failure. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.longrunning.CancelOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L212} - /// [google.longrunning.Operation.error]: @googleapis_reference_link{google/longrunning/operations.proto#L144} - /// [google.longrunning.Operations.GetOperation]: @googleapis_reference_link{google/longrunning/operations.proto#L70} - /// [google.rpc.Status.code]: @googleapis_reference_link{google/rpc/status.proto#L38} - /// - // clang-format on - Status CancelOperation(std::string const& name, Options opts = {}); - - // clang-format off - /// - /// Starts asynchronous cancellation on a long-running operation. The server - /// makes a best effort to cancel the operation, but success is not - /// guaranteed. If the server doesn't support this method, it returns - /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use - /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - /// other methods to check whether the cancellation succeeded or whether the - /// operation completed despite cancellation. On successful cancellation, - /// the operation is not deleted; instead, it becomes an operation with - /// an [Operation.error][google.longrunning.Operation.error] value with a - /// [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to - /// `Code.CANCELLED`. - /// - /// @param request Unary RPCs, such as the one wrapped by this - /// function, receive a single `request` proto message which includes all - /// the inputs for the RPC. In this case, the proto message is a - /// [google.longrunning.CancelOperationRequest]. - /// Proto messages are converted to C++ classes by Protobuf, using the - /// [Protobuf mapping rules]. - /// @param opts Optional. Override the class-level options, such as retry and - /// backoff policies. - /// @return a [`Status`] object. If the request failed, the - /// status contains the details of the failure. - /// - /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ - /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator - /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string - /// [`future`]: @ref google::cloud::future - /// [`StatusOr`]: @ref google::cloud::StatusOr - /// [`Status`]: @ref google::cloud::Status - /// [google.longrunning.CancelOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L212} - /// [google.longrunning.Operation.error]: @googleapis_reference_link{google/longrunning/operations.proto#L144} - /// [google.longrunning.Operations.GetOperation]: @googleapis_reference_link{google/longrunning/operations.proto#L70} - /// [google.rpc.Status.code]: @googleapis_reference_link{google/rpc/status.proto#L38} - /// - // clang-format on - Status CancelOperation( - google::longrunning::CancelOperationRequest const& request, - Options opts = {}); - - private: - std::shared_ptr connection_; - Options options_; -}; - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1 -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_CLIENT_H diff --git a/google/cloud/channel/v1/cloud_channel_reports_connection.cc b/google/cloud/channel/v1/cloud_channel_reports_connection.cc deleted file mode 100644 index dc14ad37ba0ee..0000000000000 --- a/google/cloud/channel/v1/cloud_channel_reports_connection.cc +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/cloud_channel_reports_connection.h" -#include "google/cloud/channel/v1/cloud_channel_reports_options.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.h" -#include "google/cloud/background_threads.h" -#include "google/cloud/common_options.h" -#include "google/cloud/credentials.h" -#include "google/cloud/grpc_options.h" -#include "google/cloud/internal/pagination_range.h" -#include "google/cloud/internal/unified_grpc_credentials.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1 { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -CloudChannelReportsServiceConnection::~CloudChannelReportsServiceConnection() = - default; - -future> -CloudChannelReportsServiceConnection::RunReportJob( - google::cloud::channel::v1::RunReportJobRequest const&) { - return google::cloud::make_ready_future< - StatusOr>( - Status(StatusCode::kUnimplemented, "not implemented")); -} - -StatusOr -CloudChannelReportsServiceConnection::RunReportJob( - NoAwaitTag, google::cloud::channel::v1::RunReportJobRequest const&) { - return StatusOr( - Status(StatusCode::kUnimplemented, "not implemented")); -} - -future> -CloudChannelReportsServiceConnection::RunReportJob( - google::longrunning::Operation const&) { - return google::cloud::make_ready_future< - StatusOr>( - Status(StatusCode::kUnimplemented, "not implemented")); -} - -StreamRange -CloudChannelReportsServiceConnection::FetchReportResults( - google::cloud::channel::v1:: - FetchReportResultsRequest) { // NOLINT(performance-unnecessary-value-param) - return google::cloud::internal::MakeUnimplementedPaginationRange< - StreamRange>(); -} - -StreamRange -CloudChannelReportsServiceConnection::ListReports( - google::cloud::channel::v1:: - ListReportsRequest) { // NOLINT(performance-unnecessary-value-param) - return google::cloud::internal::MakeUnimplementedPaginationRange< - StreamRange>(); -} - -StreamRange -CloudChannelReportsServiceConnection::ListOperations( - google::longrunning:: - ListOperationsRequest) { // NOLINT(performance-unnecessary-value-param) - return google::cloud::internal::MakeUnimplementedPaginationRange< - StreamRange>(); -} - -StatusOr -CloudChannelReportsServiceConnection::GetOperation( - google::longrunning::GetOperationRequest const&) { - return Status(StatusCode::kUnimplemented, "not implemented"); -} - -Status CloudChannelReportsServiceConnection::DeleteOperation( - google::longrunning::DeleteOperationRequest const&) { - return Status(StatusCode::kUnimplemented, "not implemented"); -} - -Status CloudChannelReportsServiceConnection::CancelOperation( - google::longrunning::CancelOperationRequest const&) { - return Status(StatusCode::kUnimplemented, "not implemented"); -} - -std::shared_ptr -MakeCloudChannelReportsServiceConnection(Options options) { - internal::CheckExpectedOptions( - options, __func__); - options = channel_v1_internal::CloudChannelReportsServiceDefaultOptions( - std::move(options)); - auto background = internal::MakeBackgroundThreadsFactory(options)(); - auto auth = internal::CreateAuthenticationStrategy(background->cq(), options); - auto stub = channel_v1_internal::CreateDefaultCloudChannelReportsServiceStub( - std::move(auth), options); - return channel_v1_internal::MakeCloudChannelReportsServiceTracingConnection( - std::make_shared< - channel_v1_internal::CloudChannelReportsServiceConnectionImpl>( - std::move(background), std::move(stub), std::move(options))); -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1 -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/cloud_channel_reports_connection.h b/google/cloud/channel/v1/cloud_channel_reports_connection.h deleted file mode 100644 index 08a093a3930a3..0000000000000 --- a/google/cloud/channel/v1/cloud_channel_reports_connection.h +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_CONNECTION_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_CONNECTION_H - -#include "google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_retry_traits.h" -#include "google/cloud/channel/v1/operations.pb.h" -#include "google/cloud/channel/v1/reports_service.pb.h" -#include "google/cloud/backoff_policy.h" -#include "google/cloud/future.h" -#include "google/cloud/internal/retry_policy_impl.h" -#include "google/cloud/no_await_tag.h" -#include "google/cloud/options.h" -#include "google/cloud/polling_policy.h" -#include "google/cloud/status_or.h" -#include "google/cloud/stream_range.h" -#include "google/cloud/version.h" -#include "google/longrunning/operations.grpc.pb.h" -#include - -namespace google { -namespace cloud { -namespace channel_v1 { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -/// The retry policy for `CloudChannelReportsServiceConnection`. -class CloudChannelReportsServiceRetryPolicy - : public ::google::cloud::RetryPolicy { - public: - /// Creates a new instance of the policy, reset to the initial state. - virtual std::unique_ptr clone() - const = 0; -}; - -/** - * A retry policy for `CloudChannelReportsServiceConnection` based on counting - * errors. - * - * This policy stops retrying if: - * - An RPC returns a non-transient error. - * - More than a prescribed number of transient failures is detected. - * - * In this class the following status codes are treated as transient errors: - * - [`kUnavailable`](@ref google::cloud::StatusCode) - */ -class CloudChannelReportsServiceLimitedErrorCountRetryPolicy - : public CloudChannelReportsServiceRetryPolicy { - public: - /** - * Create an instance that tolerates up to @p maximum_failures transient - * errors. - * - * @note Disable the retry loop by providing an instance of this policy with - * @p maximum_failures == 0. - */ - explicit CloudChannelReportsServiceLimitedErrorCountRetryPolicy( - int maximum_failures) - : impl_(maximum_failures) {} - - CloudChannelReportsServiceLimitedErrorCountRetryPolicy( - CloudChannelReportsServiceLimitedErrorCountRetryPolicy&& rhs) noexcept - : CloudChannelReportsServiceLimitedErrorCountRetryPolicy( - rhs.maximum_failures()) {} - CloudChannelReportsServiceLimitedErrorCountRetryPolicy( - CloudChannelReportsServiceLimitedErrorCountRetryPolicy const& - rhs) noexcept - : CloudChannelReportsServiceLimitedErrorCountRetryPolicy( - rhs.maximum_failures()) {} - - int maximum_failures() const { return impl_.maximum_failures(); } - - bool OnFailure(Status const& status) override { - return impl_.OnFailure(status); - } - bool IsExhausted() const override { return impl_.IsExhausted(); } - bool IsPermanentFailure(Status const& status) const override { - return impl_.IsPermanentFailure(status); - } - std::unique_ptr clone() - const override { - return std::make_unique< - CloudChannelReportsServiceLimitedErrorCountRetryPolicy>( - maximum_failures()); - } - - // This is provided only for backwards compatibility. - using BaseType = CloudChannelReportsServiceRetryPolicy; - - private: - google::cloud::internal::LimitedErrorCountRetryPolicy< - channel_v1_internal::CloudChannelReportsServiceRetryTraits> - impl_; -}; - -/** - * A retry policy for `CloudChannelReportsServiceConnection` based on elapsed - * time. - * - * This policy stops retrying if: - * - An RPC returns a non-transient error. - * - The elapsed time in the retry loop exceeds a prescribed duration. - * - * In this class the following status codes are treated as transient errors: - * - [`kUnavailable`](@ref google::cloud::StatusCode) - */ -class CloudChannelReportsServiceLimitedTimeRetryPolicy - : public CloudChannelReportsServiceRetryPolicy { - public: - /** - * Constructor given a `std::chrono::duration<>` object. - * - * @tparam DurationRep a placeholder to match the `Rep` tparam for @p - * duration's type. The semantics of this template parameter are - * documented in `std::chrono::duration<>`. In brief, the underlying - * arithmetic type used to store the number of ticks. For our purposes it - * is simply a formal parameter. - * @tparam DurationPeriod a placeholder to match the `Period` tparam for @p - * duration's type. The semantics of this template parameter are - * documented in `std::chrono::duration<>`. In brief, the length of the - * tick in seconds, expressed as a `std::ratio<>`. For our purposes it is - * simply a formal parameter. - * @param maximum_duration the maximum time allowed before the policy expires. - * While the application can express this time in any units they desire, - * the class truncates to milliseconds. - * - * @see https://en.cppreference.com/w/cpp/chrono/duration for more information - * about `std::chrono::duration`. - */ - template - explicit CloudChannelReportsServiceLimitedTimeRetryPolicy( - std::chrono::duration maximum_duration) - : impl_(maximum_duration) {} - - CloudChannelReportsServiceLimitedTimeRetryPolicy( - CloudChannelReportsServiceLimitedTimeRetryPolicy&& rhs) noexcept - : CloudChannelReportsServiceLimitedTimeRetryPolicy( - rhs.maximum_duration()) {} - CloudChannelReportsServiceLimitedTimeRetryPolicy( - CloudChannelReportsServiceLimitedTimeRetryPolicy const& rhs) noexcept - : CloudChannelReportsServiceLimitedTimeRetryPolicy( - rhs.maximum_duration()) {} - - std::chrono::milliseconds maximum_duration() const { - return impl_.maximum_duration(); - } - - bool OnFailure(Status const& status) override { - return impl_.OnFailure(status); - } - bool IsExhausted() const override { return impl_.IsExhausted(); } - bool IsPermanentFailure(Status const& status) const override { - return impl_.IsPermanentFailure(status); - } - std::unique_ptr clone() - const override { - return std::make_unique( - maximum_duration()); - } - - // This is provided only for backwards compatibility. - using BaseType = CloudChannelReportsServiceRetryPolicy; - - private: - google::cloud::internal::LimitedTimeRetryPolicy< - channel_v1_internal::CloudChannelReportsServiceRetryTraits> - impl_; -}; - -/** - * The `CloudChannelReportsServiceConnection` object for - * `CloudChannelReportsServiceClient`. - * - * This interface defines virtual methods for each of the user-facing overload - * sets in `CloudChannelReportsServiceClient`. This allows users to inject - * custom behavior (e.g., with a Google Mock object) when writing tests that use - * objects of type `CloudChannelReportsServiceClient`. - * - * To create a concrete instance, see - * `MakeCloudChannelReportsServiceConnection()`. - * - * For mocking, see - * `channel_v1_mocks::MockCloudChannelReportsServiceConnection`. - */ -class CloudChannelReportsServiceConnection { - public: - virtual ~CloudChannelReportsServiceConnection() = 0; - - virtual Options options() { return Options{}; } - - virtual future> - RunReportJob(google::cloud::channel::v1::RunReportJobRequest const& request); - - virtual StatusOr RunReportJob( - NoAwaitTag, - google::cloud::channel::v1::RunReportJobRequest const& request); - - virtual future> - RunReportJob(google::longrunning::Operation const& operation); - - virtual StreamRange FetchReportResults( - google::cloud::channel::v1::FetchReportResultsRequest request); - - virtual StreamRange ListReports( - google::cloud::channel::v1::ListReportsRequest request); - - virtual StreamRange ListOperations( - google::longrunning::ListOperationsRequest request); - - virtual StatusOr GetOperation( - google::longrunning::GetOperationRequest const& request); - - virtual Status DeleteOperation( - google::longrunning::DeleteOperationRequest const& request); - - virtual Status CancelOperation( - google::longrunning::CancelOperationRequest const& request); -}; - -/** - * A factory function to construct an object of type - * `CloudChannelReportsServiceConnection`. - * - * The returned connection object should not be used directly; instead it - * should be passed as an argument to the constructor of - * CloudChannelReportsServiceClient. - * - * The optional @p options argument may be used to configure aspects of the - * returned `CloudChannelReportsServiceConnection`. Expected options are any of - * the types in the following option lists: - * - * - `google::cloud::CommonOptionList` - * - `google::cloud::GrpcOptionList` - * - `google::cloud::UnifiedCredentialsOptionList` - * - `google::cloud::channel_v1::CloudChannelReportsServicePolicyOptionList` - * - * @note Unexpected options will be ignored. To log unexpected options instead, - * set `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` in the environment. - * - * @param options (optional) Configure the - * `CloudChannelReportsServiceConnection` created by this function. - */ -std::shared_ptr -MakeCloudChannelReportsServiceConnection(Options options = {}); - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1 -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_CONNECTION_H diff --git a/google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.cc b/google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.cc deleted file mode 100644 index a7d2ad092e2c8..0000000000000 --- a/google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.cc +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h" -#include - -namespace google { -namespace cloud { -namespace channel_v1 { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -using ::google::cloud::Idempotency; - -CloudChannelReportsServiceConnectionIdempotencyPolicy:: - ~CloudChannelReportsServiceConnectionIdempotencyPolicy() = default; - -std::unique_ptr -CloudChannelReportsServiceConnectionIdempotencyPolicy::clone() const { - return std::make_unique< - CloudChannelReportsServiceConnectionIdempotencyPolicy>(*this); -} - -Idempotency CloudChannelReportsServiceConnectionIdempotencyPolicy::RunReportJob( - google::cloud::channel::v1::RunReportJobRequest const&) { - return Idempotency::kNonIdempotent; -} - -Idempotency -CloudChannelReportsServiceConnectionIdempotencyPolicy::FetchReportResults( - google::cloud::channel::v1::FetchReportResultsRequest) { // NOLINT - return Idempotency::kNonIdempotent; -} - -Idempotency CloudChannelReportsServiceConnectionIdempotencyPolicy::ListReports( - google::cloud::channel::v1::ListReportsRequest) { // NOLINT - return Idempotency::kIdempotent; -} - -Idempotency -CloudChannelReportsServiceConnectionIdempotencyPolicy::ListOperations( - google::longrunning::ListOperationsRequest) { // NOLINT - return Idempotency::kIdempotent; -} - -Idempotency CloudChannelReportsServiceConnectionIdempotencyPolicy::GetOperation( - google::longrunning::GetOperationRequest const&) { - return Idempotency::kIdempotent; -} - -Idempotency -CloudChannelReportsServiceConnectionIdempotencyPolicy::DeleteOperation( - google::longrunning::DeleteOperationRequest const&) { - return Idempotency::kNonIdempotent; -} - -Idempotency -CloudChannelReportsServiceConnectionIdempotencyPolicy::CancelOperation( - google::longrunning::CancelOperationRequest const&) { - return Idempotency::kNonIdempotent; -} - -std::unique_ptr -MakeDefaultCloudChannelReportsServiceConnectionIdempotencyPolicy() { - return std::make_unique< - CloudChannelReportsServiceConnectionIdempotencyPolicy>(); -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1 -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h b/google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h deleted file mode 100644 index 5ea53e81d3985..0000000000000 --- a/google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_CONNECTION_IDEMPOTENCY_POLICY_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_CONNECTION_IDEMPOTENCY_POLICY_H - -#include "google/cloud/channel/v1/reports_service.grpc.pb.h" -#include "google/cloud/idempotency.h" -#include "google/cloud/version.h" -#include "google/longrunning/operations.grpc.pb.h" -#include - -namespace google { -namespace cloud { -namespace channel_v1 { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -class CloudChannelReportsServiceConnectionIdempotencyPolicy { - public: - virtual ~CloudChannelReportsServiceConnectionIdempotencyPolicy(); - - /// Create a new copy of this object. - virtual std::unique_ptr - clone() const; - - virtual google::cloud::Idempotency RunReportJob( - google::cloud::channel::v1::RunReportJobRequest const& request); - - virtual google::cloud::Idempotency FetchReportResults( - google::cloud::channel::v1::FetchReportResultsRequest request); - - virtual google::cloud::Idempotency ListReports( - google::cloud::channel::v1::ListReportsRequest request); - - virtual google::cloud::Idempotency ListOperations( - google::longrunning::ListOperationsRequest request); - - virtual google::cloud::Idempotency GetOperation( - google::longrunning::GetOperationRequest const& request); - - virtual google::cloud::Idempotency DeleteOperation( - google::longrunning::DeleteOperationRequest const& request); - - virtual google::cloud::Idempotency CancelOperation( - google::longrunning::CancelOperationRequest const& request); -}; - -std::unique_ptr -MakeDefaultCloudChannelReportsServiceConnectionIdempotencyPolicy(); - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1 -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_CONNECTION_IDEMPOTENCY_POLICY_H diff --git a/google/cloud/channel/v1/cloud_channel_reports_options.h b/google/cloud/channel/v1/cloud_channel_reports_options.h deleted file mode 100644 index 7bd68ee312f06..0000000000000 --- a/google/cloud/channel/v1/cloud_channel_reports_options.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_OPTIONS_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_OPTIONS_H - -#include "google/cloud/channel/v1/cloud_channel_reports_connection.h" -#include "google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h" -#include "google/cloud/backoff_policy.h" -#include "google/cloud/options.h" -#include "google/cloud/version.h" -#include - -namespace google { -namespace cloud { -namespace channel_v1 { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -/** - * Use with `google::cloud::Options` to configure the retry policy. - * - * @ingroup google-cloud-channel-options - */ -struct CloudChannelReportsServiceRetryPolicyOption { - using Type = std::shared_ptr; -}; - -/** - * Use with `google::cloud::Options` to configure the backoff policy. - * - * @ingroup google-cloud-channel-options - */ -struct CloudChannelReportsServiceBackoffPolicyOption { - using Type = std::shared_ptr; -}; - -/** - * Use with `google::cloud::Options` to configure which operations are retried. - * - * @ingroup google-cloud-channel-options - */ -struct CloudChannelReportsServiceConnectionIdempotencyPolicyOption { - using Type = - std::shared_ptr; -}; - -/** - * Use with `google::cloud::Options` to configure the long-running operations - * polling policy. - * - * @ingroup google-cloud-channel-options - */ -struct CloudChannelReportsServicePollingPolicyOption { - using Type = std::shared_ptr; -}; - -/** - * The options applicable to CloudChannelReportsService. - * - * @ingroup google-cloud-channel-options - */ -using CloudChannelReportsServicePolicyOptionList = - OptionList; - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1 -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_CLOUD_CHANNEL_REPORTS_OPTIONS_H diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.cc deleted file mode 100644 index 04521ec5f408e..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.cc +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.h" -#include "google/cloud/channel/v1/reports_service.grpc.pb.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -CloudChannelReportsServiceAuth::CloudChannelReportsServiceAuth( - std::shared_ptr auth, - std::shared_ptr child) - : auth_(std::move(auth)), child_(std::move(child)) {} - -future> -CloudChannelReportsServiceAuth::AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - using ReturnType = StatusOr; - return auth_->AsyncConfigureContext(std::move(context)) - .then([cq, child = child_, options = std::move(options), - request](future>> - f) mutable { - auto context = f.get(); - if (!context) { - return make_ready_future(ReturnType(std::move(context).status())); - } - return child->AsyncRunReportJob(cq, *std::move(context), - std::move(options), request); - }); -} - -StatusOr -CloudChannelReportsServiceAuth::RunReportJob( - grpc::ClientContext& context, Options options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - auto status = auth_->ConfigureContext(context); - if (!status.ok()) return status; - return child_->RunReportJob(context, options, request); -} - -StatusOr -CloudChannelReportsServiceAuth::FetchReportResults( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& request) { - auto status = auth_->ConfigureContext(context); - if (!status.ok()) return status; - return child_->FetchReportResults(context, options, request); -} - -StatusOr -CloudChannelReportsServiceAuth::ListReports( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) { - auto status = auth_->ConfigureContext(context); - if (!status.ok()) return status; - return child_->ListReports(context, options, request); -} - -StatusOr -CloudChannelReportsServiceAuth::ListOperations( - grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) { - auto status = auth_->ConfigureContext(context); - if (!status.ok()) return status; - return child_->ListOperations(context, options, request); -} - -StatusOr -CloudChannelReportsServiceAuth::GetOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) { - auto status = auth_->ConfigureContext(context); - if (!status.ok()) return status; - return child_->GetOperation(context, options, request); -} - -Status CloudChannelReportsServiceAuth::DeleteOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) { - auto status = auth_->ConfigureContext(context); - if (!status.ok()) return status; - return child_->DeleteOperation(context, options, request); -} - -Status CloudChannelReportsServiceAuth::CancelOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) { - auto status = auth_->ConfigureContext(context); - if (!status.ok()) return status; - return child_->CancelOperation(context, options, request); -} - -future> -CloudChannelReportsServiceAuth::AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) { - using ReturnType = StatusOr; - return auth_->AsyncConfigureContext(std::move(context)) - .then([cq, child = child_, options = std::move(options), - request](future>> - f) mutable { - auto context = f.get(); - if (!context) { - return make_ready_future(ReturnType(std::move(context).status())); - } - return child->AsyncGetOperation(cq, *std::move(context), - std::move(options), request); - }); -} - -future CloudChannelReportsServiceAuth::AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) { - return auth_->AsyncConfigureContext(std::move(context)) - .then([cq, child = child_, options = std::move(options), - request](future>> - f) mutable { - auto context = f.get(); - if (!context) return make_ready_future(std::move(context).status()); - return child->AsyncCancelOperation(cq, *std::move(context), - std::move(options), request); - }); -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.h b/google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.h deleted file mode 100644 index 4d9b7b4a44441..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_AUTH_DECORATOR_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_AUTH_DECORATOR_H - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" -#include "google/cloud/internal/unified_grpc_credentials.h" -#include "google/cloud/version.h" -#include "google/longrunning/operations.grpc.pb.h" -#include -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -class CloudChannelReportsServiceAuth : public CloudChannelReportsServiceStub { - public: - ~CloudChannelReportsServiceAuth() override = default; - CloudChannelReportsServiceAuth( - std::shared_ptr auth, - std::shared_ptr child); - - future> AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr RunReportJob( - grpc::ClientContext& context, Options options, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr - FetchReportResults( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& request) - override; - - StatusOr ListReports( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) override; - - StatusOr ListOperations( - grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) override; - - StatusOr GetOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) override; - - Status DeleteOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) override; - - Status CancelOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) override; - - future> AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) override; - - future AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) override; - - private: - std::shared_ptr auth_; - std::shared_ptr child_; -}; - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_AUTH_DECORATOR_H diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.cc deleted file mode 100644 index cc83bc433b1bf..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.cc +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.h" -#include "google/cloud/background_threads.h" -#include "google/cloud/common_options.h" -#include "google/cloud/grpc_options.h" -#include "google/cloud/internal/async_long_running_operation.h" -#include "google/cloud/internal/pagination_range.h" -#include "google/cloud/internal/retry_loop.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN -namespace { - -std::unique_ptr retry_policy( - Options const& options) { - return options.get() - ->clone(); -} - -std::unique_ptr backoff_policy(Options const& options) { - return options - .get() - ->clone(); -} - -std::unique_ptr< - channel_v1::CloudChannelReportsServiceConnectionIdempotencyPolicy> -idempotency_policy(Options const& options) { - return options - .get() - ->clone(); -} - -std::unique_ptr polling_policy(Options const& options) { - return options - .get() - ->clone(); -} - -} // namespace - -CloudChannelReportsServiceConnectionImpl:: - CloudChannelReportsServiceConnectionImpl( - std::unique_ptr background, - std::shared_ptr - stub, - Options options) - : background_(std::move(background)), - stub_(std::move(stub)), - options_(internal::MergeOptions( - std::move(options), - CloudChannelReportsServiceConnection::options())) {} - -future> -CloudChannelReportsServiceConnectionImpl::RunReportJob( - google::cloud::channel::v1::RunReportJobRequest const& request) { - auto current = google::cloud::internal::SaveCurrentOptions(); - auto request_copy = request; - auto const idempotent = - idempotency_policy(*current)->RunReportJob(request_copy); - return google::cloud::internal::AsyncLongRunningOperation< - google::cloud::channel::v1::RunReportJobResponse>( - background_->cq(), current, std::move(request_copy), - [stub = stub_]( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - return stub->AsyncRunReportJob(cq, std::move(context), - std::move(options), request); - }, - [stub = stub_](google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) { - return stub->AsyncGetOperation(cq, std::move(context), - std::move(options), request); - }, - [stub = stub_]( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) { - return stub->AsyncCancelOperation(cq, std::move(context), - std::move(options), request); - }, - &google::cloud::internal::ExtractLongRunningResultResponse< - google::cloud::channel::v1::RunReportJobResponse>, - retry_policy(*current), backoff_policy(*current), idempotent, - polling_policy(*current), __func__); -} - -StatusOr -CloudChannelReportsServiceConnectionImpl::RunReportJob( - NoAwaitTag, - google::cloud::channel::v1::RunReportJobRequest const& request) { - auto current = google::cloud::internal::SaveCurrentOptions(); - return google::cloud::internal::RetryLoop( - retry_policy(*current), backoff_policy(*current), - idempotency_policy(*current)->RunReportJob(request), - [this](grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - return stub_->RunReportJob(context, options, request); - }, - *current, request, __func__); -} - -future> -CloudChannelReportsServiceConnectionImpl::RunReportJob( - google::longrunning::Operation const& operation) { - auto current = google::cloud::internal::SaveCurrentOptions(); - if (!operation.metadata() - .Is()) { - return make_ready_future< - StatusOr>( - internal::InvalidArgumentError( - "operation does not correspond to RunReportJob", - GCP_ERROR_INFO().WithMetadata("operation", - operation.metadata().DebugString()))); - } - - return google::cloud::internal::AsyncAwaitLongRunningOperation< - google::cloud::channel::v1::RunReportJobResponse>( - background_->cq(), current, operation, - [stub = stub_](google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) { - return stub->AsyncGetOperation(cq, std::move(context), - std::move(options), request); - }, - [stub = stub_]( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) { - return stub->AsyncCancelOperation(cq, std::move(context), - std::move(options), request); - }, - &google::cloud::internal::ExtractLongRunningResultResponse< - google::cloud::channel::v1::RunReportJobResponse>, - polling_policy(*current), __func__); -} - -StreamRange -CloudChannelReportsServiceConnectionImpl::FetchReportResults( - google::cloud::channel::v1::FetchReportResultsRequest request) { - request.clear_page_token(); - auto current = google::cloud::internal::SaveCurrentOptions(); - auto idempotency = idempotency_policy(*current)->FetchReportResults(request); - char const* function_name = __func__; - return google::cloud::internal::MakePaginationRange< - StreamRange>( - current, std::move(request), - [idempotency, function_name, stub = stub_, - retry = - std::shared_ptr( - retry_policy(*current)), - backoff = std::shared_ptr(backoff_policy(*current))]( - Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& r) { - return google::cloud::internal::RetryLoop( - retry->clone(), backoff->clone(), idempotency, - [stub](grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& - request) { - return stub->FetchReportResults(context, options, request); - }, - options, r, function_name); - }, - [](google::cloud::channel::v1::FetchReportResultsResponse r) { - std::vector result(r.rows().size()); - auto& messages = *r.mutable_rows(); - std::move(messages.begin(), messages.end(), result.begin()); - return result; - }); -} - -StreamRange -CloudChannelReportsServiceConnectionImpl::ListReports( - google::cloud::channel::v1::ListReportsRequest request) { - request.clear_page_token(); - auto current = google::cloud::internal::SaveCurrentOptions(); - auto idempotency = idempotency_policy(*current)->ListReports(request); - char const* function_name = __func__; - return google::cloud::internal::MakePaginationRange< - StreamRange>( - current, std::move(request), - [idempotency, function_name, stub = stub_, - retry = - std::shared_ptr( - retry_policy(*current)), - backoff = std::shared_ptr(backoff_policy(*current))]( - Options const& options, - google::cloud::channel::v1::ListReportsRequest const& r) { - return google::cloud::internal::RetryLoop( - retry->clone(), backoff->clone(), idempotency, - [stub]( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) { - return stub->ListReports(context, options, request); - }, - options, r, function_name); - }, - [](google::cloud::channel::v1::ListReportsResponse r) { - std::vector result( - r.reports().size()); - auto& messages = *r.mutable_reports(); - std::move(messages.begin(), messages.end(), result.begin()); - return result; - }); -} - -StreamRange -CloudChannelReportsServiceConnectionImpl::ListOperations( - google::longrunning::ListOperationsRequest request) { - request.clear_page_token(); - auto current = google::cloud::internal::SaveCurrentOptions(); - auto idempotency = idempotency_policy(*current)->ListOperations(request); - char const* function_name = __func__; - return google::cloud::internal::MakePaginationRange< - StreamRange>( - current, std::move(request), - [idempotency, function_name, stub = stub_, - retry = - std::shared_ptr( - retry_policy(*current)), - backoff = std::shared_ptr(backoff_policy(*current))]( - Options const& options, - google::longrunning::ListOperationsRequest const& r) { - return google::cloud::internal::RetryLoop( - retry->clone(), backoff->clone(), idempotency, - [stub](grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) { - return stub->ListOperations(context, options, request); - }, - options, r, function_name); - }, - [](google::longrunning::ListOperationsResponse r) { - std::vector result( - r.operations().size()); - auto& messages = *r.mutable_operations(); - std::move(messages.begin(), messages.end(), result.begin()); - return result; - }); -} - -StatusOr -CloudChannelReportsServiceConnectionImpl::GetOperation( - google::longrunning::GetOperationRequest const& request) { - auto current = google::cloud::internal::SaveCurrentOptions(); - return google::cloud::internal::RetryLoop( - retry_policy(*current), backoff_policy(*current), - idempotency_policy(*current)->GetOperation(request), - [this](grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) { - return stub_->GetOperation(context, options, request); - }, - *current, request, __func__); -} - -Status CloudChannelReportsServiceConnectionImpl::DeleteOperation( - google::longrunning::DeleteOperationRequest const& request) { - auto current = google::cloud::internal::SaveCurrentOptions(); - return google::cloud::internal::RetryLoop( - retry_policy(*current), backoff_policy(*current), - idempotency_policy(*current)->DeleteOperation(request), - [this](grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) { - return stub_->DeleteOperation(context, options, request); - }, - *current, request, __func__); -} - -Status CloudChannelReportsServiceConnectionImpl::CancelOperation( - google::longrunning::CancelOperationRequest const& request) { - auto current = google::cloud::internal::SaveCurrentOptions(); - return google::cloud::internal::RetryLoop( - retry_policy(*current), backoff_policy(*current), - idempotency_policy(*current)->CancelOperation(request), - [this](grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) { - return stub_->CancelOperation(context, options, request); - }, - *current, request, __func__); -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.h b/google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.h deleted file mode 100644 index e878e811e67f4..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_CONNECTION_IMPL_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_CONNECTION_IMPL_H - -#include "google/cloud/channel/v1/cloud_channel_reports_connection.h" -#include "google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h" -#include "google/cloud/channel/v1/cloud_channel_reports_options.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_retry_traits.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" -#include "google/cloud/background_threads.h" -#include "google/cloud/backoff_policy.h" -#include "google/cloud/future.h" -#include "google/cloud/options.h" -#include "google/cloud/polling_policy.h" -#include "google/cloud/status_or.h" -#include "google/cloud/stream_range.h" -#include "google/cloud/version.h" -#include "google/longrunning/operations.grpc.pb.h" -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -class CloudChannelReportsServiceConnectionImpl - : public channel_v1::CloudChannelReportsServiceConnection { - public: - ~CloudChannelReportsServiceConnectionImpl() override = default; - - CloudChannelReportsServiceConnectionImpl( - std::unique_ptr background, - std::shared_ptr stub, - Options options); - - Options options() override { return options_; } - - future> - RunReportJob( - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr RunReportJob( - NoAwaitTag, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - future> - RunReportJob(google::longrunning::Operation const& operation) override; - - StreamRange FetchReportResults( - google::cloud::channel::v1::FetchReportResultsRequest request) override; - - StreamRange ListReports( - google::cloud::channel::v1::ListReportsRequest request) override; - - StreamRange ListOperations( - google::longrunning::ListOperationsRequest request) override; - - StatusOr GetOperation( - google::longrunning::GetOperationRequest const& request) override; - - Status DeleteOperation( - google::longrunning::DeleteOperationRequest const& request) override; - - Status CancelOperation( - google::longrunning::CancelOperationRequest const& request) override; - - private: - std::unique_ptr background_; - std::shared_ptr stub_; - Options options_; -}; - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_CONNECTION_IMPL_H diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.cc deleted file mode 100644 index dae5a03c0484f..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.cc +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.h" -#include "google/cloud/channel/v1/reports_service.grpc.pb.h" -#include "google/cloud/internal/log_wrapper.h" -#include "google/cloud/status_or.h" -#include -#include -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -CloudChannelReportsServiceLogging::CloudChannelReportsServiceLogging( - std::shared_ptr child, - TracingOptions tracing_options, std::set const&) - : child_(std::move(child)), tracing_options_(std::move(tracing_options)) {} - -future> -CloudChannelReportsServiceLogging::AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - return google::cloud::internal::LogWrapper( - [this](google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - return child_->AsyncRunReportJob(cq, std::move(context), - std::move(options), request); - }, - cq, std::move(context), std::move(options), request, __func__, - tracing_options_); -} - -StatusOr -CloudChannelReportsServiceLogging::RunReportJob( - grpc::ClientContext& context, Options options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - return google::cloud::internal::LogWrapper( - [this](grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - return child_->RunReportJob(context, options, request); - }, - context, options, request, __func__, tracing_options_); -} - -StatusOr -CloudChannelReportsServiceLogging::FetchReportResults( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& request) { - return google::cloud::internal::LogWrapper( - [this](grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& - request) { - return child_->FetchReportResults(context, options, request); - }, - context, options, request, __func__, tracing_options_); -} - -StatusOr -CloudChannelReportsServiceLogging::ListReports( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) { - return google::cloud::internal::LogWrapper( - [this](grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) { - return child_->ListReports(context, options, request); - }, - context, options, request, __func__, tracing_options_); -} - -StatusOr -CloudChannelReportsServiceLogging::ListOperations( - grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) { - return google::cloud::internal::LogWrapper( - [this](grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) { - return child_->ListOperations(context, options, request); - }, - context, options, request, __func__, tracing_options_); -} - -StatusOr -CloudChannelReportsServiceLogging::GetOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) { - return google::cloud::internal::LogWrapper( - [this](grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) { - return child_->GetOperation(context, options, request); - }, - context, options, request, __func__, tracing_options_); -} - -Status CloudChannelReportsServiceLogging::DeleteOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) { - return google::cloud::internal::LogWrapper( - [this](grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) { - return child_->DeleteOperation(context, options, request); - }, - context, options, request, __func__, tracing_options_); -} - -Status CloudChannelReportsServiceLogging::CancelOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) { - return google::cloud::internal::LogWrapper( - [this](grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) { - return child_->CancelOperation(context, options, request); - }, - context, options, request, __func__, tracing_options_); -} - -future> -CloudChannelReportsServiceLogging::AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) { - return google::cloud::internal::LogWrapper( - [this](google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) { - return child_->AsyncGetOperation(cq, std::move(context), - std::move(options), request); - }, - cq, std::move(context), std::move(options), request, __func__, - tracing_options_); -} - -future CloudChannelReportsServiceLogging::AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) { - return google::cloud::internal::LogWrapper( - [this](google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) { - return child_->AsyncCancelOperation(cq, std::move(context), - std::move(options), request); - }, - cq, std::move(context), std::move(options), request, __func__, - tracing_options_); -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.h b/google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.h deleted file mode 100644 index b6e3918423274..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_LOGGING_DECORATOR_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_LOGGING_DECORATOR_H - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" -#include "google/cloud/tracing_options.h" -#include "google/cloud/version.h" -#include "google/longrunning/operations.grpc.pb.h" -#include -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -class CloudChannelReportsServiceLogging - : public CloudChannelReportsServiceStub { - public: - ~CloudChannelReportsServiceLogging() override = default; - CloudChannelReportsServiceLogging( - std::shared_ptr child, - TracingOptions tracing_options, std::set const& components); - - future> AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr RunReportJob( - grpc::ClientContext& context, Options options, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr - FetchReportResults( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& request) - override; - - StatusOr ListReports( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) override; - - StatusOr ListOperations( - grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) override; - - StatusOr GetOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) override; - - Status DeleteOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) override; - - Status CancelOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) override; - - future> AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) override; - - future AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) override; - - private: - std::shared_ptr child_; - TracingOptions tracing_options_; -}; // CloudChannelReportsServiceLogging - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_LOGGING_DECORATOR_H diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.cc deleted file mode 100644 index 63b53ee2fbe95..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.cc +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.h" -#include "google/cloud/channel/v1/reports_service.grpc.pb.h" -#include "google/cloud/grpc_options.h" -#include "google/cloud/internal/absl_str_cat_quiet.h" -#include "google/cloud/internal/api_client_header.h" -#include "google/cloud/internal/url_encode.h" -#include "google/cloud/status_or.h" -#include -#include -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -CloudChannelReportsServiceMetadata::CloudChannelReportsServiceMetadata( - std::shared_ptr child, - std::multimap fixed_metadata, - std::string api_client_header) - : child_(std::move(child)), - fixed_metadata_(std::move(fixed_metadata)), - api_client_header_( - api_client_header.empty() - ? google::cloud::internal::GeneratedLibClientHeader() - : std::move(api_client_header)) {} - -future> -CloudChannelReportsServiceMetadata::AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - SetMetadata(*context, *options, - absl::StrCat("name=", internal::UrlEncode(request.name()))); - return child_->AsyncRunReportJob(cq, std::move(context), std::move(options), - request); -} - -StatusOr -CloudChannelReportsServiceMetadata::RunReportJob( - grpc::ClientContext& context, Options options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - SetMetadata(context, options, - absl::StrCat("name=", internal::UrlEncode(request.name()))); - return child_->RunReportJob(context, options, request); -} - -StatusOr -CloudChannelReportsServiceMetadata::FetchReportResults( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& request) { - SetMetadata( - context, options, - absl::StrCat("report_job=", internal::UrlEncode(request.report_job()))); - return child_->FetchReportResults(context, options, request); -} - -StatusOr -CloudChannelReportsServiceMetadata::ListReports( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) { - SetMetadata(context, options, - absl::StrCat("parent=", internal::UrlEncode(request.parent()))); - return child_->ListReports(context, options, request); -} - -StatusOr -CloudChannelReportsServiceMetadata::ListOperations( - grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) { - SetMetadata(context, options, - absl::StrCat("name=", internal::UrlEncode(request.name()))); - return child_->ListOperations(context, options, request); -} - -StatusOr -CloudChannelReportsServiceMetadata::GetOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) { - SetMetadata(context, options, - absl::StrCat("name=", internal::UrlEncode(request.name()))); - return child_->GetOperation(context, options, request); -} - -Status CloudChannelReportsServiceMetadata::DeleteOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) { - SetMetadata(context, options, - absl::StrCat("name=", internal::UrlEncode(request.name()))); - return child_->DeleteOperation(context, options, request); -} - -Status CloudChannelReportsServiceMetadata::CancelOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) { - SetMetadata(context, options, - absl::StrCat("name=", internal::UrlEncode(request.name()))); - return child_->CancelOperation(context, options, request); -} - -future> -CloudChannelReportsServiceMetadata::AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) { - SetMetadata(*context, *options, - absl::StrCat("name=", internal::UrlEncode(request.name()))); - return child_->AsyncGetOperation(cq, std::move(context), std::move(options), - request); -} - -future CloudChannelReportsServiceMetadata::AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) { - SetMetadata(*context, *options, - absl::StrCat("name=", internal::UrlEncode(request.name()))); - return child_->AsyncCancelOperation(cq, std::move(context), - std::move(options), request); -} - -void CloudChannelReportsServiceMetadata::SetMetadata( - grpc::ClientContext& context, Options const& options, - std::string const& request_params) { - context.AddMetadata("x-goog-request-params", request_params); - SetMetadata(context, options); -} - -void CloudChannelReportsServiceMetadata::SetMetadata( - grpc::ClientContext& context, Options const& options) { - google::cloud::internal::SetMetadata(context, options, fixed_metadata_, - api_client_header_); -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.h b/google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.h deleted file mode 100644 index 407d20a180254..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_METADATA_DECORATOR_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_METADATA_DECORATOR_H - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" -#include "google/cloud/options.h" -#include "google/cloud/version.h" -#include "google/longrunning/operations.grpc.pb.h" -#include -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -class CloudChannelReportsServiceMetadata - : public CloudChannelReportsServiceStub { - public: - ~CloudChannelReportsServiceMetadata() override = default; - CloudChannelReportsServiceMetadata( - std::shared_ptr child, - std::multimap fixed_metadata, - std::string api_client_header = ""); - - future> AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr RunReportJob( - grpc::ClientContext& context, Options options, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr - FetchReportResults( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& request) - override; - - StatusOr ListReports( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) override; - - StatusOr ListOperations( - grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) override; - - StatusOr GetOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) override; - - Status DeleteOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) override; - - Status CancelOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) override; - - future> AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) override; - - future AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) override; - - private: - void SetMetadata(grpc::ClientContext& context, Options const& options, - std::string const& request_params); - void SetMetadata(grpc::ClientContext& context, Options const& options); - - std::shared_ptr child_; - std::multimap fixed_metadata_; - std::string api_client_header_; -}; - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_METADATA_DECORATOR_H diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.cc deleted file mode 100644 index c868bafb49bcc..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.cc +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.h" -#include "google/cloud/channel/v1/cloud_channel_reports_connection.h" -#include "google/cloud/channel/v1/cloud_channel_reports_options.h" -#include "google/cloud/internal/populate_common_options.h" -#include "google/cloud/internal/populate_grpc_options.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -namespace { -auto constexpr kBackoffScaling = 2.0; -} // namespace - -Options CloudChannelReportsServiceDefaultOptions(Options options) { - options = internal::PopulateCommonOptions( - std::move(options), - "GOOGLE_CLOUD_CPP_CLOUD_CHANNEL_REPORTS_SERVICE_ENDPOINT", "", - "GOOGLE_CLOUD_CPP_CLOUD_CHANNEL_REPORTS_SERVICE_AUTHORITY", - "cloudchannel.googleapis.com"); - options = internal::PopulateGrpcOptions(std::move(options)); - if (!options.has()) { - options.set( - channel_v1::CloudChannelReportsServiceLimitedTimeRetryPolicy( - std::chrono::minutes(30)) - .clone()); - } - if (!options - .has()) { - options.set( - ExponentialBackoffPolicy( - std::chrono::seconds(0), std::chrono::seconds(1), - std::chrono::minutes(5), kBackoffScaling, kBackoffScaling) - .clone()); - } - if (!options - .has()) { - options.set( - GenericPollingPolicy< - channel_v1::CloudChannelReportsServiceRetryPolicyOption::Type, - channel_v1::CloudChannelReportsServiceBackoffPolicyOption::Type>( - options - .get() - ->clone(), - ExponentialBackoffPolicy(std::chrono::seconds(1), - std::chrono::minutes(5), kBackoffScaling) - .clone()) - .clone()); - } - if (!options.has< - channel_v1:: - CloudChannelReportsServiceConnectionIdempotencyPolicyOption>()) { - options.set< - channel_v1:: - CloudChannelReportsServiceConnectionIdempotencyPolicyOption>( - channel_v1:: - MakeDefaultCloudChannelReportsServiceConnectionIdempotencyPolicy()); - } - - return options; -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.h b/google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.h deleted file mode 100644 index 10223a941de77..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_OPTION_DEFAULTS_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_OPTION_DEFAULTS_H - -#include "google/cloud/options.h" -#include "google/cloud/version.h" - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -Options CloudChannelReportsServiceDefaultOptions(Options options); - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_OPTION_DEFAULTS_H diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_retry_traits.h b/google/cloud/channel/v1/internal/cloud_channel_reports_retry_traits.h deleted file mode 100644 index 50ca7f3779b6c..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_retry_traits.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_RETRY_TRAITS_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_RETRY_TRAITS_H - -#include "google/cloud/status.h" -#include "google/cloud/version.h" - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -/// Define the gRPC status code semantics for retrying requests. -struct CloudChannelReportsServiceRetryTraits { - static bool IsPermanentFailure(google::cloud::Status const& status) { - return status.code() != StatusCode::kOk && - status.code() != StatusCode::kUnavailable; - } -}; - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_RETRY_TRAITS_H diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_sources.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_sources.cc deleted file mode 100644 index 6a7a46f323f2b..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_sources.cc +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -// NOLINTBEGIN(bugprone-suspicious-include) -#include "google/cloud/channel/v1/cloud_channel_reports_client.cc" -#include "google/cloud/channel/v1/cloud_channel_reports_connection.cc" -#include "google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.cc" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.cc" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.cc" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.cc" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.cc" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.cc" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.cc" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.cc" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.cc" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.cc" -// NOLINTEND(bugprone-suspicious-include) diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_stub.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_stub.cc deleted file mode 100644 index 279802b675d88..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_stub.cc +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" -#include "google/cloud/channel/v1/reports_service.grpc.pb.h" -#include "google/cloud/grpc_error_delegate.h" -#include "google/cloud/status_or.h" -#include "google/longrunning/operations.grpc.pb.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -CloudChannelReportsServiceStub::~CloudChannelReportsServiceStub() = default; - -future> -DefaultCloudChannelReportsServiceStub::AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions, - google::cloud::channel::v1::RunReportJobRequest const& request) { - return internal::MakeUnaryRpcImpl< - google::cloud::channel::v1::RunReportJobRequest, - google::longrunning::Operation>( - cq, - [this](grpc::ClientContext* context, - google::cloud::channel::v1::RunReportJobRequest const& request, - grpc::CompletionQueue* cq) { - return grpc_stub_->AsyncRunReportJob(context, request, cq); - }, - request, std::move(context)); -} - -StatusOr -DefaultCloudChannelReportsServiceStub::RunReportJob( - grpc::ClientContext& context, Options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - google::longrunning::Operation response; - auto status = grpc_stub_->RunReportJob(&context, request, &response); - if (!status.ok()) { - return google::cloud::MakeStatusFromRpcError(status); - } - return response; -} - -StatusOr -DefaultCloudChannelReportsServiceStub::FetchReportResults( - grpc::ClientContext& context, Options const&, - google::cloud::channel::v1::FetchReportResultsRequest const& request) { - google::cloud::channel::v1::FetchReportResultsResponse response; - auto status = grpc_stub_->FetchReportResults(&context, request, &response); - if (!status.ok()) { - return google::cloud::MakeStatusFromRpcError(status); - } - return response; -} - -StatusOr -DefaultCloudChannelReportsServiceStub::ListReports( - grpc::ClientContext& context, Options const&, - google::cloud::channel::v1::ListReportsRequest const& request) { - google::cloud::channel::v1::ListReportsResponse response; - auto status = grpc_stub_->ListReports(&context, request, &response); - if (!status.ok()) { - return google::cloud::MakeStatusFromRpcError(status); - } - return response; -} - -StatusOr -DefaultCloudChannelReportsServiceStub::ListOperations( - grpc::ClientContext& context, Options const&, - google::longrunning::ListOperationsRequest const& request) { - google::longrunning::ListOperationsResponse response; - auto status = operations_stub_->ListOperations(&context, request, &response); - if (!status.ok()) { - return google::cloud::MakeStatusFromRpcError(status); - } - return response; -} - -StatusOr -DefaultCloudChannelReportsServiceStub::GetOperation( - grpc::ClientContext& context, Options const&, - google::longrunning::GetOperationRequest const& request) { - google::longrunning::Operation response; - auto status = operations_stub_->GetOperation(&context, request, &response); - if (!status.ok()) { - return google::cloud::MakeStatusFromRpcError(status); - } - return response; -} - -Status DefaultCloudChannelReportsServiceStub::DeleteOperation( - grpc::ClientContext& context, Options const&, - google::longrunning::DeleteOperationRequest const& request) { - google::protobuf::Empty response; - auto status = operations_stub_->DeleteOperation(&context, request, &response); - if (!status.ok()) { - return google::cloud::MakeStatusFromRpcError(status); - } - return google::cloud::Status(); -} - -Status DefaultCloudChannelReportsServiceStub::CancelOperation( - grpc::ClientContext& context, Options const&, - google::longrunning::CancelOperationRequest const& request) { - google::protobuf::Empty response; - auto status = operations_stub_->CancelOperation(&context, request, &response); - if (!status.ok()) { - return google::cloud::MakeStatusFromRpcError(status); - } - return google::cloud::Status(); -} - -future> -DefaultCloudChannelReportsServiceStub::AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - // NOLINTNEXTLINE(performance-unnecessary-value-param) - google::cloud::internal::ImmutableOptions, - google::longrunning::GetOperationRequest const& request) { - return internal::MakeUnaryRpcImpl( - cq, - [this](grpc::ClientContext* context, - google::longrunning::GetOperationRequest const& request, - grpc::CompletionQueue* cq) { - return operations_stub_->AsyncGetOperation(context, request, cq); - }, - request, std::move(context)); -} - -future DefaultCloudChannelReportsServiceStub::AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - // NOLINTNEXTLINE(performance-unnecessary-value-param) - google::cloud::internal::ImmutableOptions, - google::longrunning::CancelOperationRequest const& request) { - return internal::MakeUnaryRpcImpl( - cq, - [this](grpc::ClientContext* context, - google::longrunning::CancelOperationRequest const& request, - grpc::CompletionQueue* cq) { - return operations_stub_->AsyncCancelOperation(context, request, - cq); - }, - request, std::move(context)) - .then([](future> f) { - return f.get().status(); - }); -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_stub.h b/google/cloud/channel/v1/internal/cloud_channel_reports_stub.h deleted file mode 100644 index b653f95f267d5..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_stub.h +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_STUB_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_STUB_H - -#include "google/cloud/channel/v1/operations.pb.h" -#include "google/cloud/channel/v1/reports_service.grpc.pb.h" -#include "google/cloud/completion_queue.h" -#include "google/cloud/future.h" -#include "google/cloud/options.h" -#include "google/cloud/status_or.h" -#include "google/cloud/version.h" -#include "google/longrunning/operations.grpc.pb.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -class CloudChannelReportsServiceStub { - public: - virtual ~CloudChannelReportsServiceStub() = 0; - - virtual future> AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) = 0; - - virtual StatusOr RunReportJob( - grpc::ClientContext& context, Options options, - google::cloud::channel::v1::RunReportJobRequest const& request) = 0; - - virtual StatusOr - FetchReportResults( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& request) = 0; - - virtual StatusOr ListReports( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) = 0; - - virtual StatusOr ListOperations( - grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) = 0; - - virtual StatusOr GetOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) = 0; - - virtual Status DeleteOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) = 0; - - virtual Status CancelOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) = 0; - - virtual future> AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) = 0; - - virtual future AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) = 0; -}; - -class DefaultCloudChannelReportsServiceStub - : public CloudChannelReportsServiceStub { - public: - DefaultCloudChannelReportsServiceStub( - std::unique_ptr< - google::cloud::channel::v1::CloudChannelReportsService::StubInterface> - grpc_stub, - std::unique_ptr - operations_stub) - : grpc_stub_(std::move(grpc_stub)), - operations_stub_(std::move(operations_stub)) {} - - future> AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr RunReportJob( - grpc::ClientContext& context, Options options, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr - FetchReportResults( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& request) - override; - - StatusOr ListReports( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) override; - - StatusOr ListOperations( - grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) override; - - StatusOr GetOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) override; - - Status DeleteOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) override; - - Status CancelOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) override; - - future> AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) override; - - future AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) override; - - private: - std::unique_ptr< - google::cloud::channel::v1::CloudChannelReportsService::StubInterface> - grpc_stub_; - std::unique_ptr - operations_stub_; -}; - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_STUB_H diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.cc deleted file mode 100644 index 96025dcbb69fc..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.cc +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" -#include "google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.h" -#include "google/cloud/channel/v1/reports_service.grpc.pb.h" -#include "google/cloud/common_options.h" -#include "google/cloud/grpc_options.h" -#include "google/cloud/internal/algorithm.h" -#include "google/cloud/internal/opentelemetry.h" -#include "google/cloud/log.h" -#include "google/cloud/options.h" -#include "google/longrunning/operations.grpc.pb.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -std::shared_ptr -CreateDefaultCloudChannelReportsServiceStub( - std::shared_ptr auth, - Options const& options) { - auto channel = auth->CreateChannel(options.get(), - internal::MakeChannelArguments(options)); - auto service_grpc_stub = - google::cloud::channel::v1::CloudChannelReportsService::NewStub(channel); - std::shared_ptr stub = - std::make_shared( - std::move(service_grpc_stub), - google::longrunning::Operations::NewStub(channel)); - - if (auth->RequiresConfigureContext()) { - stub = std::make_shared(std::move(auth), - std::move(stub)); - } - stub = std::make_shared( - std::move(stub), std::multimap{}); - if (internal::Contains(options.get(), "rpc")) { - GCP_LOG(INFO) << "Enabled logging for gRPC calls"; - stub = std::make_shared( - std::move(stub), options.get(), - options.get()); - } - if (internal::TracingEnabled(options)) { - stub = MakeCloudChannelReportsServiceTracingStub(std::move(stub)); - } - return stub; -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.h b/google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.h deleted file mode 100644 index 56dce648fbd5f..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_STUB_FACTORY_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_STUB_FACTORY_H - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" -#include "google/cloud/internal/unified_grpc_credentials.h" -#include "google/cloud/options.h" -#include "google/cloud/version.h" -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -std::shared_ptr -CreateDefaultCloudChannelReportsServiceStub( - std::shared_ptr auth, - Options const& options); - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_STUB_FACTORY_H diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.cc deleted file mode 100644 index 0fa6cc41b3666..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.cc +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.h" -#include "google/cloud/internal/opentelemetry.h" -#include "google/cloud/internal/traced_stream_range.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -CloudChannelReportsServiceTracingConnection:: - CloudChannelReportsServiceTracingConnection( - std::shared_ptr child) - : child_(std::move(child)) {} - -future> -CloudChannelReportsServiceTracingConnection::RunReportJob( - google::cloud::channel::v1::RunReportJobRequest const& request) { - auto span = internal::MakeSpan( - "channel_v1::CloudChannelReportsServiceConnection::RunReportJob"); - internal::OTelScope scope(span); - return internal::EndSpan(std::move(span), child_->RunReportJob(request)); -} - -StatusOr -CloudChannelReportsServiceTracingConnection::RunReportJob( - NoAwaitTag, - google::cloud::channel::v1::RunReportJobRequest const& request) { - auto span = internal::MakeSpan( - "channel_v1::CloudChannelReportsServiceConnection::RunReportJob"); - opentelemetry::trace::Scope scope(span); - return internal::EndSpan(*span, child_->RunReportJob(NoAwaitTag{}, request)); -} - -future> -CloudChannelReportsServiceTracingConnection::RunReportJob( - google::longrunning::Operation const& operation) { - auto span = internal::MakeSpan( - "channel_v1::CloudChannelReportsServiceConnection::RunReportJob"); - internal::OTelScope scope(span); - return internal::EndSpan(std::move(span), child_->RunReportJob(operation)); -} - -StreamRange -CloudChannelReportsServiceTracingConnection::FetchReportResults( - google::cloud::channel::v1::FetchReportResultsRequest request) { - auto span = internal::MakeSpan( - "channel_v1::CloudChannelReportsServiceConnection::FetchReportResults"); - internal::OTelScope scope(span); - auto sr = child_->FetchReportResults(std::move(request)); - return internal::MakeTracedStreamRange( - std::move(span), std::move(sr)); -} - -StreamRange -CloudChannelReportsServiceTracingConnection::ListReports( - google::cloud::channel::v1::ListReportsRequest request) { - auto span = internal::MakeSpan( - "channel_v1::CloudChannelReportsServiceConnection::ListReports"); - internal::OTelScope scope(span); - auto sr = child_->ListReports(std::move(request)); - return internal::MakeTracedStreamRange( - std::move(span), std::move(sr)); -} - -StreamRange -CloudChannelReportsServiceTracingConnection::ListOperations( - google::longrunning::ListOperationsRequest request) { - auto span = internal::MakeSpan( - "channel_v1::CloudChannelReportsServiceConnection::ListOperations"); - internal::OTelScope scope(span); - auto sr = child_->ListOperations(std::move(request)); - return internal::MakeTracedStreamRange( - std::move(span), std::move(sr)); -} - -StatusOr -CloudChannelReportsServiceTracingConnection::GetOperation( - google::longrunning::GetOperationRequest const& request) { - auto span = internal::MakeSpan( - "channel_v1::CloudChannelReportsServiceConnection::GetOperation"); - auto scope = opentelemetry::trace::Scope(span); - return internal::EndSpan(*span, child_->GetOperation(request)); -} - -Status CloudChannelReportsServiceTracingConnection::DeleteOperation( - google::longrunning::DeleteOperationRequest const& request) { - auto span = internal::MakeSpan( - "channel_v1::CloudChannelReportsServiceConnection::DeleteOperation"); - auto scope = opentelemetry::trace::Scope(span); - return internal::EndSpan(*span, child_->DeleteOperation(request)); -} - -Status CloudChannelReportsServiceTracingConnection::CancelOperation( - google::longrunning::CancelOperationRequest const& request) { - auto span = internal::MakeSpan( - "channel_v1::CloudChannelReportsServiceConnection::CancelOperation"); - auto scope = opentelemetry::trace::Scope(span); - return internal::EndSpan(*span, child_->CancelOperation(request)); -} - -std::shared_ptr -MakeCloudChannelReportsServiceTracingConnection( - std::shared_ptr conn) { - if (internal::TracingEnabled(conn->options())) { - conn = std::make_shared( - std::move(conn)); - } - return conn; -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.h b/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.h deleted file mode 100644 index a87c1ed61b7fc..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.h +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_TRACING_CONNECTION_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_TRACING_CONNECTION_H - -#include "google/cloud/channel/v1/cloud_channel_reports_connection.h" -#include "google/cloud/version.h" -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -class CloudChannelReportsServiceTracingConnection - : public channel_v1::CloudChannelReportsServiceConnection { - public: - ~CloudChannelReportsServiceTracingConnection() override = default; - - explicit CloudChannelReportsServiceTracingConnection( - std::shared_ptr child); - - Options options() override { return child_->options(); } - - future> - RunReportJob( - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr RunReportJob( - NoAwaitTag, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - future> - RunReportJob(google::longrunning::Operation const& operation) override; - - StreamRange FetchReportResults( - google::cloud::channel::v1::FetchReportResultsRequest request) override; - - StreamRange ListReports( - google::cloud::channel::v1::ListReportsRequest request) override; - - StreamRange ListOperations( - google::longrunning::ListOperationsRequest request) override; - - StatusOr GetOperation( - google::longrunning::GetOperationRequest const& request) override; - - Status DeleteOperation( - google::longrunning::DeleteOperationRequest const& request) override; - - Status CancelOperation( - google::longrunning::CancelOperationRequest const& request) override; - - private: - std::shared_ptr child_; -}; - -/** - * Conditionally applies the tracing decorator to the given connection. - * - * The connection is only decorated if tracing is enabled (as determined by the - * connection's options). - */ -std::shared_ptr -MakeCloudChannelReportsServiceTracingConnection( - std::shared_ptr conn); - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_TRACING_CONNECTION_H diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.cc deleted file mode 100644 index a70daf32df51c..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.cc +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.h" -#include "google/cloud/internal/grpc_opentelemetry.h" -#include -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -CloudChannelReportsServiceTracingStub::CloudChannelReportsServiceTracingStub( - std::shared_ptr child) - : child_(std::move(child)), propagator_(internal::MakePropagator()) {} - -future> -CloudChannelReportsServiceTracingStub::AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - auto span = internal::MakeSpanGrpc( - "google.cloud.channel.v1.CloudChannelReportsService", "RunReportJob"); - internal::OTelScope scope(span); - internal::InjectTraceContext(*context, *propagator_); - auto f = child_->AsyncRunReportJob(cq, context, std::move(options), request); - return internal::EndSpan(std::move(context), std::move(span), std::move(f)); -} - -StatusOr -CloudChannelReportsServiceTracingStub::RunReportJob( - grpc::ClientContext& context, Options options, - google::cloud::channel::v1::RunReportJobRequest const& request) { - auto span = internal::MakeSpanGrpc( - "google.cloud.channel.v1.CloudChannelReportsService", "RunReportJob"); - auto scope = opentelemetry::trace::Scope(span); - internal::InjectTraceContext(context, *propagator_); - return internal::EndSpan(context, *span, - child_->RunReportJob(context, options, request)); -} - -StatusOr -CloudChannelReportsServiceTracingStub::FetchReportResults( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& request) { - auto span = internal::MakeSpanGrpc( - "google.cloud.channel.v1.CloudChannelReportsService", - "FetchReportResults"); - auto scope = opentelemetry::trace::Scope(span); - internal::InjectTraceContext(context, *propagator_); - return internal::EndSpan( - context, *span, child_->FetchReportResults(context, options, request)); -} - -StatusOr -CloudChannelReportsServiceTracingStub::ListReports( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) { - auto span = internal::MakeSpanGrpc( - "google.cloud.channel.v1.CloudChannelReportsService", "ListReports"); - auto scope = opentelemetry::trace::Scope(span); - internal::InjectTraceContext(context, *propagator_); - return internal::EndSpan(context, *span, - child_->ListReports(context, options, request)); -} - -StatusOr -CloudChannelReportsServiceTracingStub::ListOperations( - grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) { - auto span = internal::MakeSpanGrpc( - "google.cloud.channel.v1.CloudChannelReportsService", "ListOperations"); - auto scope = opentelemetry::trace::Scope(span); - internal::InjectTraceContext(context, *propagator_); - return internal::EndSpan(context, *span, - child_->ListOperations(context, options, request)); -} - -StatusOr -CloudChannelReportsServiceTracingStub::GetOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) { - auto span = internal::MakeSpanGrpc( - "google.cloud.channel.v1.CloudChannelReportsService", "GetOperation"); - auto scope = opentelemetry::trace::Scope(span); - internal::InjectTraceContext(context, *propagator_); - return internal::EndSpan(context, *span, - child_->GetOperation(context, options, request)); -} - -Status CloudChannelReportsServiceTracingStub::DeleteOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) { - auto span = internal::MakeSpanGrpc( - "google.cloud.channel.v1.CloudChannelReportsService", "DeleteOperation"); - auto scope = opentelemetry::trace::Scope(span); - internal::InjectTraceContext(context, *propagator_); - return internal::EndSpan(context, *span, - child_->DeleteOperation(context, options, request)); -} - -Status CloudChannelReportsServiceTracingStub::CancelOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) { - auto span = internal::MakeSpanGrpc( - "google.cloud.channel.v1.CloudChannelReportsService", "CancelOperation"); - auto scope = opentelemetry::trace::Scope(span); - internal::InjectTraceContext(context, *propagator_); - return internal::EndSpan(context, *span, - child_->CancelOperation(context, options, request)); -} - -future> -CloudChannelReportsServiceTracingStub::AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) { - auto span = - internal::MakeSpanGrpc("google.longrunning.Operations", "GetOperation"); - internal::OTelScope scope(span); - internal::InjectTraceContext(*context, *propagator_); - auto f = child_->AsyncGetOperation(cq, context, std::move(options), request); - return internal::EndSpan(std::move(context), std::move(span), std::move(f)); -} - -future CloudChannelReportsServiceTracingStub::AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) { - auto span = internal::MakeSpanGrpc("google.longrunning.Operations", - "CancelOperation"); - internal::OTelScope scope(span); - internal::InjectTraceContext(*context, *propagator_); - auto f = - child_->AsyncCancelOperation(cq, context, std::move(options), request); - return internal::EndSpan(std::move(context), std::move(span), std::move(f)); -} - -std::shared_ptr -MakeCloudChannelReportsServiceTracingStub( - std::shared_ptr stub) { - return std::make_shared( - std::move(stub)); -} - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.h b/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.h deleted file mode 100644 index aca4fd3baaf04..0000000000000 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.h +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_TRACING_STUB_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_TRACING_STUB_H - -#include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" -#include "google/cloud/internal/trace_propagator.h" -#include "google/cloud/options.h" -#include "google/cloud/version.h" -#include - -namespace google { -namespace cloud { -namespace channel_v1_internal { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -class CloudChannelReportsServiceTracingStub - : public CloudChannelReportsServiceStub { - public: - ~CloudChannelReportsServiceTracingStub() override = default; - - explicit CloudChannelReportsServiceTracingStub( - std::shared_ptr child); - - future> AsyncRunReportJob( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr RunReportJob( - grpc::ClientContext& context, Options options, - google::cloud::channel::v1::RunReportJobRequest const& request) override; - - StatusOr - FetchReportResults( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::FetchReportResultsRequest const& request) - override; - - StatusOr ListReports( - grpc::ClientContext& context, Options const& options, - google::cloud::channel::v1::ListReportsRequest const& request) override; - - StatusOr ListOperations( - grpc::ClientContext& context, Options const& options, - google::longrunning::ListOperationsRequest const& request) override; - - StatusOr GetOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::GetOperationRequest const& request) override; - - Status DeleteOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::DeleteOperationRequest const& request) override; - - Status CancelOperation( - grpc::ClientContext& context, Options const& options, - google::longrunning::CancelOperationRequest const& request) override; - - future> AsyncGetOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::GetOperationRequest const& request) override; - - future AsyncCancelOperation( - google::cloud::CompletionQueue& cq, - std::shared_ptr context, - google::cloud::internal::ImmutableOptions options, - google::longrunning::CancelOperationRequest const& request) override; - - private: - std::shared_ptr child_; - std::shared_ptr - propagator_; -}; - -/** - * Applies the tracing decorator to the given stub. - * - * The stub is only decorated if the library has been compiled with - * OpenTelemetry. - */ -std::shared_ptr -MakeCloudChannelReportsServiceTracingStub( - std::shared_ptr stub); - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_internal -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_INTERNAL_CLOUD_CHANNEL_REPORTS_TRACING_STUB_H diff --git a/google/cloud/channel/v1/mocks/mock_cloud_channel_reports_connection.h b/google/cloud/channel/v1/mocks/mock_cloud_channel_reports_connection.h deleted file mode 100644 index 7e371da033dc3..0000000000000 --- a/google/cloud/channel/v1/mocks/mock_cloud_channel_reports_connection.h +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_MOCKS_MOCK_CLOUD_CHANNEL_REPORTS_CONNECTION_H -#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_MOCKS_MOCK_CLOUD_CHANNEL_REPORTS_CONNECTION_H - -#include "google/cloud/channel/v1/cloud_channel_reports_connection.h" -#include - -namespace google { -namespace cloud { -namespace channel_v1_mocks { -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN - -/** - * A class to mock `CloudChannelReportsServiceConnection`. - * - * Application developers may want to test their code with simulated responses, - * including errors, from an object of type `CloudChannelReportsServiceClient`. - * To do so, construct an object of type `CloudChannelReportsServiceClient` with - * an instance of this class. Then use the Google Test framework functions to - * program the behavior of this mock. - * - * @see [This example][bq-mock] for how to test your application with GoogleTest. - * While the example showcases types from the BigQuery library, the underlying - * principles apply for any pair of `*Client` and `*Connection`. - * - * [bq-mock]: @cloud_cpp_docs_link{bigquery,bigquery-read-mock} - */ -class MockCloudChannelReportsServiceConnection - : public channel_v1::CloudChannelReportsServiceConnection { - public: - MOCK_METHOD(Options, options, (), (override)); - - /// To disambiguate calls, use: - /// - /// @code - /// using ::testing::_; - /// using ::testing::Matcher; - /// EXPECT_CALL(*mock, - /// RunReportJob(Matcher(_))) - /// @endcode - MOCK_METHOD( - future>, - RunReportJob, - (google::cloud::channel::v1::RunReportJobRequest const& request), - (override)); - - /// To disambiguate calls, use: - /// - /// @code - /// using ::testing::_; - /// EXPECT_CALL(*mock, RunReportJob(_, _)) - /// @endcode - MOCK_METHOD(StatusOr, RunReportJob, - (NoAwaitTag, - google::cloud::channel::v1::RunReportJobRequest const& request), - (override)); - - /// To disambiguate calls, use: - /// - /// @code - /// using ::testing::_; - /// using ::testing::Matcher; - /// EXPECT_CALL(*mock, RunReportJob(Matcher(_))) - /// @endcode - MOCK_METHOD( - future>, - RunReportJob, (google::longrunning::Operation const& operation), - (override)); - - MOCK_METHOD((StreamRange), - FetchReportResults, - (google::cloud::channel::v1::FetchReportResultsRequest request), - (override)); - - MOCK_METHOD((StreamRange), ListReports, - (google::cloud::channel::v1::ListReportsRequest request), - (override)); - - MOCK_METHOD((StreamRange), ListOperations, - (google::longrunning::ListOperationsRequest request), (override)); - - MOCK_METHOD(StatusOr, GetOperation, - (google::longrunning::GetOperationRequest const& request), - (override)); - - MOCK_METHOD(Status, DeleteOperation, - (google::longrunning::DeleteOperationRequest const& request), - (override)); - - MOCK_METHOD(Status, CancelOperation, - (google::longrunning::CancelOperationRequest const& request), - (override)); -}; - -GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END -} // namespace channel_v1_mocks -} // namespace cloud -} // namespace google - -#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CHANNEL_V1_MOCKS_MOCK_CLOUD_CHANNEL_REPORTS_CONNECTION_H diff --git a/google/cloud/channel/v1/samples/cloud_channel_reports_client_samples.cc b/google/cloud/channel/v1/samples/cloud_channel_reports_client_samples.cc deleted file mode 100644 index 32ff801201d3a..0000000000000 --- a/google/cloud/channel/v1/samples/cloud_channel_reports_client_samples.cc +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the Codegen C++ plugin. -// If you make any local changes, they will be lost. -// source: google/cloud/channel/v1/reports_service.proto - -#include "google/cloud/channel/v1/cloud_channel_reports_client.h" -#include "google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h" -#include "google/cloud/channel/v1/cloud_channel_reports_options.h" -#include "google/cloud/common_options.h" -#include "google/cloud/credentials.h" -#include "google/cloud/internal/getenv.h" -#include "google/cloud/polling_policy.h" -#include "google/cloud/testing_util/example_driver.h" -#include "google/cloud/universe_domain.h" -#include -#include -#include -#include - -// clang-format off -// main-dox-marker: channel_v1::CloudChannelReportsServiceClient -// lro-marker: true -// clang-format on -namespace { - -void SetClientEndpoint(std::vector const& argv) { - if (!argv.empty()) { - throw google::cloud::testing_util::Usage{"set-client-endpoint"}; - } - //! [set-client-endpoint] - // This configuration is common with Private Google Access: - // https://cloud.google.com/vpc/docs/private-google-access - auto options = google::cloud::Options{}.set( - "private.googleapis.com"); - auto vpc_client = google::cloud::channel_v1::CloudChannelReportsServiceClient( - google::cloud::channel_v1::MakeCloudChannelReportsServiceConnection( - options)); - //! [set-client-endpoint] -} - -void SetClientUniverseDomain(std::vector const& argv) { - if (!argv.empty()) { - throw google::cloud::testing_util::Usage{"set-client-universe-domain"}; - } - //! [set-client-universe-domain] - google::cloud::Options options; - - // AddUniverseDomainOption interrogates the UnifiedCredentialsOption, if set, - // in the provided Options for the Universe Domain associated with the - // credentials and adds it to the set of Options. - // If no UnifiedCredentialsOption is set, GoogleDefaultCredentials are used. - auto ud_options = google::cloud::AddUniverseDomainOption(std::move(options)); - - if (!ud_options.ok()) throw std::move(ud_options).status(); - auto ud_client = google::cloud::channel_v1::CloudChannelReportsServiceClient( - google::cloud::channel_v1::MakeCloudChannelReportsServiceConnection( - *ud_options)); - //! [set-client-universe-domain] -} - -//! [custom-idempotency-policy] -class CustomIdempotencyPolicy - : public google::cloud::channel_v1:: - CloudChannelReportsServiceConnectionIdempotencyPolicy { - public: - ~CustomIdempotencyPolicy() override = default; - std::unique_ptr - clone() const override { - return std::make_unique(*this); - } - // Override inherited functions to define as needed. -}; -//! [custom-idempotency-policy] - -void SetRetryPolicy(std::vector const& argv) { - if (!argv.empty()) { - throw google::cloud::testing_util::Usage{"set-client-retry-policy"}; - } - //! [set-retry-policy] - auto options = - google::cloud::Options{} - .set( - CustomIdempotencyPolicy().clone()) - .set( - google::cloud::channel_v1:: - CloudChannelReportsServiceLimitedErrorCountRetryPolicy(3) - .clone()) - .set( - google::cloud::ExponentialBackoffPolicy( - /*initial_delay=*/std::chrono::milliseconds(200), - /*maximum_delay=*/std::chrono::seconds(45), - /*scaling=*/2.0) - .clone()); - auto connection = - google::cloud::channel_v1::MakeCloudChannelReportsServiceConnection( - options); - - // c1 and c2 share the same retry policies - auto c1 = - google::cloud::channel_v1::CloudChannelReportsServiceClient(connection); - auto c2 = - google::cloud::channel_v1::CloudChannelReportsServiceClient(connection); - - // You can override any of the policies in a new client. This new client - // will share the policies from c1 (or c2) *except* for the retry policy. - auto c3 = google::cloud::channel_v1::CloudChannelReportsServiceClient( - connection, google::cloud::Options{} - .set( - google::cloud::channel_v1:: - CloudChannelReportsServiceLimitedTimeRetryPolicy( - std::chrono::minutes(5)) - .clone())); - - // You can also override the policies in a single call: - // c3.SomeRpc(..., google::cloud::Options{} - // .set( - // google::cloud::channel_v1::CloudChannelReportsServiceLimitedErrorCountRetryPolicy(10).clone())); - //! [set-retry-policy] -} - -void SetPollingPolicy(std::vector const& argv) { - if (!argv.empty()) { - throw google::cloud::testing_util::Usage{"set-client-policy-policy"}; - } - //! [set-polling-policy] - - // The polling policy controls how the client waits for long-running - // operations. `GenericPollingPolicy<>` combines existing policies. - // In this case, keep polling until the operation completes (with success - // or error) or 45 minutes, whichever happens first. Initially pause for - // 10 seconds between polling requests, increasing the pause by a factor - // of 4 until it becomes 2 minutes. - auto options = - google::cloud::Options{} - .set( - google::cloud::GenericPollingPolicy< - google::cloud::channel_v1:: - CloudChannelReportsServiceRetryPolicyOption::Type, - google::cloud::channel_v1:: - CloudChannelReportsServiceBackoffPolicyOption::Type>( - google::cloud::channel_v1:: - CloudChannelReportsServiceLimitedTimeRetryPolicy( - /*maximum_duration=*/std::chrono::minutes(45)) - .clone(), - google::cloud::ExponentialBackoffPolicy( - /*initial_delay=*/std::chrono::seconds(10), - /*maximum_delay=*/std::chrono::minutes(2), - /*scaling=*/4.0) - .clone()) - .clone()); - - auto connection = - google::cloud::channel_v1::MakeCloudChannelReportsServiceConnection( - options); - - // c1 and c2 share the same polling policies. - auto c1 = - google::cloud::channel_v1::CloudChannelReportsServiceClient(connection); - auto c2 = - google::cloud::channel_v1::CloudChannelReportsServiceClient(connection); - //! [set-polling-policy] -} - -void WithServiceAccount(std::vector const& argv) { - if (argv.size() != 1 || argv[0] == "--help") { - throw google::cloud::testing_util::Usage{"with-service-account "}; - } - //! [with-service-account] - [](std::string const& keyfile) { - auto is = std::ifstream(keyfile); - is.exceptions(std::ios::badbit); // Minimal error handling in examples - auto contents = std::string(std::istreambuf_iterator(is.rdbuf()), {}); - auto options = - google::cloud::Options{}.set( - google::cloud::MakeServiceAccountCredentials(contents)); - return google::cloud::channel_v1::CloudChannelReportsServiceClient( - google::cloud::channel_v1::MakeCloudChannelReportsServiceConnection( - options)); - } - //! [with-service-account] - (argv.at(0)); -} - -void AutoRun(std::vector const& argv) { - namespace examples = ::google::cloud::testing_util; - using ::google::cloud::internal::GetEnv; - if (!argv.empty()) throw examples::Usage{"auto"}; - examples::CheckEnvironmentVariablesAreSet( - {"GOOGLE_CLOUD_CPP_TEST_SERVICE_ACCOUNT_KEYFILE"}); - auto const keyfile = - GetEnv("GOOGLE_CLOUD_CPP_TEST_SERVICE_ACCOUNT_KEYFILE").value(); - - std::cout << "\nRunning SetClientEndpoint() example" << std::endl; - SetClientEndpoint({}); - - std::cout << "\nRunning SetRetryPolicy() example" << std::endl; - SetRetryPolicy({}); - - std::cout << "\nRunning SetPollingPolicy() example" << std::endl; - SetPollingPolicy({}); - - std::cout << "\nRunning WithServiceAccount() example" << std::endl; - WithServiceAccount({keyfile}); - - std::cout << "\nRunning SetClientUniverseDomain() example" << std::endl; - SetClientUniverseDomain({}); -} - -} // namespace - -int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape) - google::cloud::testing_util::Example example({ - {"set-client-endpoint", SetClientEndpoint}, - {"set-retry-policy", SetRetryPolicy}, - {"set-polling-policy", SetPollingPolicy}, - {"with-service-account", WithServiceAccount}, - {"set-client-universe-domain", SetClientUniverseDomain}, - {"auto", AutoRun}, - }); - return example.Run(argc, argv); -}