diff --git a/generator/integration_tests/BUILD.bazel b/generator/integration_tests/BUILD.bazel index f512a6f02a57d..0d4c5238dfa19 100644 --- a/generator/integration_tests/BUILD.bazel +++ b/generator/integration_tests/BUILD.bazel @@ -30,6 +30,7 @@ proto_library( "common.proto", "test.proto", "test2.proto", + "test_deprecated.proto", "test_request_id.proto", ], deps = [ diff --git a/generator/integration_tests/CMakeLists.txt b/generator/integration_tests/CMakeLists.txt index 843e412ae6c33..2b8fbe8af678e 100644 --- a/generator/integration_tests/CMakeLists.txt +++ b/generator/integration_tests/CMakeLists.txt @@ -31,6 +31,7 @@ google_cloud_cpp_grpcpp_library( ${PROJECT_SOURCE_DIR}/generator/integration_tests/test.proto ${PROJECT_SOURCE_DIR}/generator/integration_tests/test2.proto ${PROJECT_SOURCE_DIR}/generator/integration_tests/test_request_id.proto + ${PROJECT_SOURCE_DIR}/generator/integration_tests/test_deprecated.proto PROTO_PATH_DIRECTORIES ${PROTO_INCLUDE_DIR} ${PROJECT_SOURCE_DIR} diff --git a/generator/integration_tests/golden/v1/deprecated_client.cc b/generator/integration_tests/golden/v1/deprecated_client.cc new file mode 100644 index 0000000000000..98924b99a70a2 --- /dev/null +++ b/generator/integration_tests/golden/v1/deprecated_client.cc @@ -0,0 +1,45 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_client.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +DeprecatedServiceClient::DeprecatedServiceClient( + std::shared_ptr connection, Options opts) + : connection_(std::move(connection)), + options_(internal::MergeOptions(std::move(opts), + connection_->options())) {} +DeprecatedServiceClient::~DeprecatedServiceClient() = default; + +Status +DeprecatedServiceClient::Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->Noop(request); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1 +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/deprecated_client.h b/generator/integration_tests/golden/v1/deprecated_client.h new file mode 100644 index 0000000000000..d7eb4f8c67633 --- /dev/null +++ b/generator/integration_tests/golden/v1/deprecated_client.h @@ -0,0 +1,127 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CLIENT_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CLIENT_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_connection.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/version.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// +/// Service to test deprecated services. +/// +/// @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( + "DeprecatedService has been deprecated and will be turned down in the future." +) +DeprecatedServiceClient { + public: + explicit DeprecatedServiceClient(std::shared_ptr connection, Options opts = {}); + ~DeprecatedServiceClient(); + + ///@{ + /// @name Copy and move support + DeprecatedServiceClient(DeprecatedServiceClient const&) = default; + DeprecatedServiceClient& operator=(DeprecatedServiceClient const&) = default; + DeprecatedServiceClient(DeprecatedServiceClient&&) = default; + DeprecatedServiceClient& operator=(DeprecatedServiceClient&&) = default; + ///@} + + ///@{ + /// @name Equality + friend bool operator==(DeprecatedServiceClient const& a, DeprecatedServiceClient const& b) { + return a.connection_ == b.connection_; + } + friend bool operator!=(DeprecatedServiceClient const& a, DeprecatedServiceClient const& b) { + return !(a == b); + } + ///@} + + // clang-format off + /// + /// Does nothing. + /// + /// @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.test.deprecated.v1.DeprecatedServiceRequest]. + /// 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.test.deprecated.v1.DeprecatedServiceRequest]: @googleapis_reference_link{generator/integration_tests/test_deprecated.proto#L39} + /// + // clang-format on + Status + Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request, Options opts = {}); + + private: + std::shared_ptr connection_; + Options options_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CLIENT_H diff --git a/generator/integration_tests/golden/v1/deprecated_connection.cc b/generator/integration_tests/golden/v1/deprecated_connection.cc new file mode 100644 index 0000000000000..66fcf200333b8 --- /dev/null +++ b/generator/integration_tests/golden/v1/deprecated_connection.cc @@ -0,0 +1,66 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_connection.h" +#include "generator/integration_tests/golden/v1/deprecated_options.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_connection_impl.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_option_defaults.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_stub_factory.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_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/unified_grpc_credentials.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +DeprecatedServiceConnection::~DeprecatedServiceConnection() = default; + +Status +DeprecatedServiceConnection::Noop( + google::test::deprecated::v1::DeprecatedServiceRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +std::shared_ptr MakeDeprecatedServiceConnection( + Options options) { + internal::CheckExpectedOptions(options, __func__); + options = golden_v1_internal::DeprecatedServiceDefaultOptions( + std::move(options)); + auto background = internal::MakeBackgroundThreadsFactory(options)(); + auto auth = internal::CreateAuthenticationStrategy(background->cq(), options); + auto stub = golden_v1_internal::CreateDefaultDeprecatedServiceStub( + std::move(auth), options); + return golden_v1_internal::MakeDeprecatedServiceTracingConnection( + std::make_shared( + std::move(background), std::move(stub), std::move(options))); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1 +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/deprecated_connection.h b/generator/integration_tests/golden/v1/deprecated_connection.h new file mode 100644 index 0000000000000..33dbdb6d0f041 --- /dev/null +++ b/generator/integration_tests/golden/v1/deprecated_connection.h @@ -0,0 +1,211 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CONNECTION_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_retry_traits.h" +#include "google/cloud/backoff_policy.h" +#include "google/cloud/internal/retry_policy_impl.h" +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// The retry policy for `DeprecatedServiceConnection`. +class DeprecatedServiceRetryPolicy : 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 `DeprecatedServiceConnection` 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 DeprecatedServiceLimitedErrorCountRetryPolicy : public DeprecatedServiceRetryPolicy { + 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 DeprecatedServiceLimitedErrorCountRetryPolicy(int maximum_failures) + : impl_(maximum_failures) {} + + DeprecatedServiceLimitedErrorCountRetryPolicy( + DeprecatedServiceLimitedErrorCountRetryPolicy&& rhs) noexcept + : DeprecatedServiceLimitedErrorCountRetryPolicy(rhs.maximum_failures()) {} + DeprecatedServiceLimitedErrorCountRetryPolicy( + DeprecatedServiceLimitedErrorCountRetryPolicy const& rhs) noexcept + : DeprecatedServiceLimitedErrorCountRetryPolicy(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( + maximum_failures()); + } + + // This is provided only for backwards compatibility. + using BaseType = DeprecatedServiceRetryPolicy; + + private: + google::cloud::internal::LimitedErrorCountRetryPolicy impl_; +}; + +/** + * A retry policy for `DeprecatedServiceConnection` 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 DeprecatedServiceLimitedTimeRetryPolicy : public DeprecatedServiceRetryPolicy { + 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 DeprecatedServiceLimitedTimeRetryPolicy( + std::chrono::duration maximum_duration) + : impl_(maximum_duration) {} + + DeprecatedServiceLimitedTimeRetryPolicy(DeprecatedServiceLimitedTimeRetryPolicy&& rhs) noexcept + : DeprecatedServiceLimitedTimeRetryPolicy(rhs.maximum_duration()) {} + DeprecatedServiceLimitedTimeRetryPolicy(DeprecatedServiceLimitedTimeRetryPolicy const& rhs) noexcept + : DeprecatedServiceLimitedTimeRetryPolicy(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 = DeprecatedServiceRetryPolicy; + + private: + google::cloud::internal::LimitedTimeRetryPolicy impl_; +}; + +/** + * The `DeprecatedServiceConnection` object for `DeprecatedServiceClient`. + * + * This interface defines virtual methods for each of the user-facing overload + * sets in `DeprecatedServiceClient`. This allows users to inject custom behavior + * (e.g., with a Google Mock object) when writing tests that use objects of type + * `DeprecatedServiceClient`. + * + * To create a concrete instance, see `MakeDeprecatedServiceConnection()`. + * + * For mocking, see `golden_v1_mocks::MockDeprecatedServiceConnection`. + */ +class DeprecatedServiceConnection { + public: + virtual ~DeprecatedServiceConnection() = 0; + + virtual Options options() { return Options{}; } + + virtual Status + Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request); +}; + +/** + * A factory function to construct an object of type `DeprecatedServiceConnection`. + * + * The returned connection object should not be used directly; instead it + * should be passed as an argument to the constructor of DeprecatedServiceClient. + * + * The optional @p options argument may be used to configure aspects of the + * returned `DeprecatedServiceConnection`. Expected options are any of the types in + * the following option lists: + * + * - `google::cloud::CommonOptionList` + * - `google::cloud::GrpcOptionList` + * - `google::cloud::UnifiedCredentialsOptionList` + * - `google::cloud::golden_v1::DeprecatedServicePolicyOptionList` + * + * @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 `DeprecatedServiceConnection` created by + * this function. + */ +std::shared_ptr MakeDeprecatedServiceConnection( + Options options = {}); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CONNECTION_H diff --git a/generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.cc b/generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.cc new file mode 100644 index 0000000000000..c43fa17bcba82 --- /dev/null +++ b/generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.cc @@ -0,0 +1,49 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.h" +#include + +namespace google { +namespace cloud { +namespace golden_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +using ::google::cloud::Idempotency; + +DeprecatedServiceConnectionIdempotencyPolicy::~DeprecatedServiceConnectionIdempotencyPolicy() = default; + +std::unique_ptr +DeprecatedServiceConnectionIdempotencyPolicy::clone() const { + return std::make_unique(*this); +} + +Idempotency DeprecatedServiceConnectionIdempotencyPolicy::Noop(google::test::deprecated::v1::DeprecatedServiceRequest const&) { + return Idempotency::kNonIdempotent; +} + +std::unique_ptr + MakeDefaultDeprecatedServiceConnectionIdempotencyPolicy() { + return std::make_unique(); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1 +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.h b/generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.h new file mode 100644 index 0000000000000..f818b1fc5852a --- /dev/null +++ b/generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.h @@ -0,0 +1,52 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CONNECTION_IDEMPOTENCY_POLICY_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CONNECTION_IDEMPOTENCY_POLICY_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "google/cloud/idempotency.h" +#include "google/cloud/version.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class DeprecatedServiceConnectionIdempotencyPolicy { + public: + virtual ~DeprecatedServiceConnectionIdempotencyPolicy(); + + /// Create a new copy of this object. + virtual std::unique_ptr clone() const; + + virtual google::cloud::Idempotency + Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request); +}; + +std::unique_ptr + MakeDefaultDeprecatedServiceConnectionIdempotencyPolicy(); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CONNECTION_IDEMPOTENCY_POLICY_H diff --git a/generator/integration_tests/golden/v1/deprecated_options.h b/generator/integration_tests/golden/v1/deprecated_options.h new file mode 100644 index 0000000000000..8e8d0a4ffddbc --- /dev/null +++ b/generator/integration_tests/golden/v1/deprecated_options.h @@ -0,0 +1,77 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_OPTIONS_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_OPTIONS_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_connection.h" +#include "generator/integration_tests/golden/v1/deprecated_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 golden_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * Use with `google::cloud::Options` to configure the retry policy. + * + * @ingroup generator-integration_tests-golden-options + */ +struct DeprecatedServiceRetryPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure the backoff policy. + * + * @ingroup generator-integration_tests-golden-options + */ +struct DeprecatedServiceBackoffPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure which operations are retried. + * + * @ingroup generator-integration_tests-golden-options + */ +struct DeprecatedServiceConnectionIdempotencyPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * The options applicable to DeprecatedService. + * + * @ingroup generator-integration_tests-golden-options + */ +using DeprecatedServicePolicyOptionList = + OptionList; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_OPTIONS_H diff --git a/generator/integration_tests/golden/v1/deprecated_rest_connection.cc b/generator/integration_tests/golden/v1/deprecated_rest_connection.cc new file mode 100644 index 0000000000000..fa27d29d93cbd --- /dev/null +++ b/generator/integration_tests/golden/v1/deprecated_rest_connection.cc @@ -0,0 +1,58 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_rest_connection.h" +#include "generator/integration_tests/golden/v1/deprecated_options.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_option_defaults.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_connection_impl.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub_factory.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_tracing_connection.h" +#include "google/cloud/common_options.h" +#include "google/cloud/credentials.h" +#include "google/cloud/internal/rest_background_threads_impl.h" +#include "google/cloud/internal/rest_options.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr MakeDeprecatedServiceConnectionRest( + Options options) { + internal::CheckExpectedOptions(options, __func__); + options = golden_v1_internal::DeprecatedServiceDefaultOptions( + std::move(options)); + auto background = std::make_unique< + rest_internal::AutomaticallyCreatedRestBackgroundThreads>(); + auto stub = golden_v1_internal::CreateDefaultDeprecatedServiceRestStub( + options); + return golden_v1_internal::MakeDeprecatedServiceTracingConnection( + std::make_shared< + golden_v1_internal::DeprecatedServiceRestConnectionImpl>( + std::move(background), std::move(stub), std::move(options))); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1 +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/deprecated_rest_connection.h b/generator/integration_tests/golden/v1/deprecated_rest_connection.h new file mode 100644 index 0000000000000..8c509353b9e01 --- /dev/null +++ b/generator/integration_tests/golden/v1/deprecated_rest_connection.h @@ -0,0 +1,65 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_REST_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_REST_CONNECTION_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_connection.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace golden_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * A factory function to construct an object of type `DeprecatedServiceConnection` + * that uses REST over HTTP as transport in lieu of gRPC. REST transport should + * only be used for services that do not support gRPC or if the existing network + * configuration precludes using gRPC. + * + * The returned connection object should not be used directly; instead it + * should be passed as an argument to the constructor of DeprecatedServiceClient. + * + * The optional @p options argument may be used to configure aspects of the + * returned `DeprecatedServiceConnection`. Expected options are any of the types in + * the following option lists: + * + * - `google::cloud::CommonOptionList` + * - `google::cloud::RestOptionList` + * - `google::cloud::UnifiedCredentialsOptionList` + * - `google::cloud::golden_v1::DeprecatedServicePolicyOptionList` + * + * @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 `DeprecatedServiceConnection` created by + * this function. + */ +std::shared_ptr MakeDeprecatedServiceConnectionRest( + Options options = {}); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_REST_CONNECTION_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_auth_decorator.cc b/generator/integration_tests/golden/v1/internal/deprecated_auth_decorator.cc new file mode 100644 index 0000000000000..8f6a9fcaf66b6 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_auth_decorator.cc @@ -0,0 +1,47 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_auth_decorator.h" +#include +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +DeprecatedServiceAuth::DeprecatedServiceAuth( + std::shared_ptr auth, + std::shared_ptr child) + : auth_(std::move(auth)), child_(std::move(child)) {} + +Status DeprecatedServiceAuth::Noop( + grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->Noop(context, options, request); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_auth_decorator.h b/generator/integration_tests/golden/v1/internal/deprecated_auth_decorator.h new file mode 100644 index 0000000000000..948b2b92ed011 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_auth_decorator.h @@ -0,0 +1,57 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_AUTH_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_AUTH_DECORATOR_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_stub.h" +#include "google/cloud/internal/unified_grpc_credentials.h" +#include "google/cloud/version.h" +#include +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class DeprecatedServiceAuth : public DeprecatedServiceStub { + public: + ~DeprecatedServiceAuth() override = default; + DeprecatedServiceAuth( + std::shared_ptr auth, + std::shared_ptr child); + + Status Noop( + grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) override; + + private: + std::shared_ptr auth_; + std::shared_ptr child_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_AUTH_DECORATOR_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_connection_impl.cc b/generator/integration_tests/golden/v1/internal/deprecated_connection_impl.cc new file mode 100644 index 0000000000000..ba512c0132efb --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_connection_impl.cc @@ -0,0 +1,77 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_connection_impl.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_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/retry_loop.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_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 +idempotency_policy(Options const& options) { + return options.get()->clone(); +} + +} // namespace + +DeprecatedServiceConnectionImpl::DeprecatedServiceConnectionImpl( + std::unique_ptr background, + std::shared_ptr stub, + Options options) + : background_(std::move(background)), stub_(std::move(stub)), + options_(internal::MergeOptions( + std::move(options), + DeprecatedServiceConnection::options())) {} + +Status +DeprecatedServiceConnectionImpl::Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->Noop(request), + [this](grpc::ClientContext& context, Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + return stub_->Noop(context, options, request); + }, + *current, request, __func__); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_connection_impl.h b/generator/integration_tests/golden/v1/internal/deprecated_connection_impl.h new file mode 100644 index 0000000000000..1f4e27c322044 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_connection_impl.h @@ -0,0 +1,66 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_CONNECTION_IMPL_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_CONNECTION_IMPL_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_connection.h" +#include "generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.h" +#include "generator/integration_tests/golden/v1/deprecated_options.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_retry_traits.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_stub.h" +#include "google/cloud/background_threads.h" +#include "google/cloud/backoff_policy.h" +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class DeprecatedServiceConnectionImpl + : public golden_v1::DeprecatedServiceConnection { + public: + ~DeprecatedServiceConnectionImpl() override = default; + + DeprecatedServiceConnectionImpl( + std::unique_ptr background, + std::shared_ptr stub, + Options options); + + Options options() override { return options_; } + + Status + Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request) override; + + private: + std::unique_ptr background_; + std::shared_ptr stub_; + Options options_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_CONNECTION_IMPL_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_logging_decorator.cc b/generator/integration_tests/golden/v1/internal/deprecated_logging_decorator.cc new file mode 100644 index 0000000000000..fd3fe04cdf8d0 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_logging_decorator.cc @@ -0,0 +1,58 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_logging_decorator.h" +#include "google/cloud/internal/log_wrapper.h" +#include "google/cloud/status_or.h" +#include +#include +#include +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +DeprecatedServiceLogging::DeprecatedServiceLogging( + std::shared_ptr child, + TracingOptions tracing_options, + std::set const&) + : child_(std::move(child)), + tracing_options_(std::move(tracing_options)) {} + +Status +DeprecatedServiceLogging::Noop( + grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + return child_->Noop(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_logging_decorator.h b/generator/integration_tests/golden/v1/internal/deprecated_logging_decorator.h new file mode 100644 index 0000000000000..ef62c7c39caf4 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_logging_decorator.h @@ -0,0 +1,57 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_LOGGING_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_LOGGING_DECORATOR_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_stub.h" +#include "google/cloud/tracing_options.h" +#include "google/cloud/version.h" +#include +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class DeprecatedServiceLogging : public DeprecatedServiceStub { + public: + ~DeprecatedServiceLogging() override = default; + DeprecatedServiceLogging(std::shared_ptr child, + TracingOptions tracing_options, + std::set const& components); + + Status Noop( + grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) override; + + private: + std::shared_ptr child_; + TracingOptions tracing_options_; +}; // DeprecatedServiceLogging + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_LOGGING_DECORATOR_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_metadata_decorator.cc b/generator/integration_tests/golden/v1/internal/deprecated_metadata_decorator.cc new file mode 100644 index 0000000000000..c20c965fdd7ab --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_metadata_decorator.cc @@ -0,0 +1,73 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_metadata_decorator.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 +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +DeprecatedServiceMetadata::DeprecatedServiceMetadata( + 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)) {} + +Status +DeprecatedServiceMetadata::Noop( + grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + SetMetadata(context, options); + return child_->Noop(context, options, request); +} + +void DeprecatedServiceMetadata::SetMetadata(grpc::ClientContext& context, + Options const& options, + std::string const& request_params) { + context.AddMetadata("x-goog-request-params", request_params); + SetMetadata(context, options); +} + +void DeprecatedServiceMetadata::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 golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_metadata_decorator.h b/generator/integration_tests/golden/v1/internal/deprecated_metadata_decorator.h new file mode 100644 index 0000000000000..b3df571b3d9f7 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_metadata_decorator.h @@ -0,0 +1,64 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_METADATA_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_METADATA_DECORATOR_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_stub.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class DeprecatedServiceMetadata : public DeprecatedServiceStub { + public: + ~DeprecatedServiceMetadata() override = default; + DeprecatedServiceMetadata( + std::shared_ptr child, + std::multimap fixed_metadata, + std::string api_client_header = ""); + + Status Noop( + grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest 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 golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_METADATA_DECORATOR_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_option_defaults.cc b/generator/integration_tests/golden/v1/internal/deprecated_option_defaults.cc new file mode 100644 index 0000000000000..73efcf2693b4d --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_option_defaults.cc @@ -0,0 +1,64 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_option_defaults.h" +#include "generator/integration_tests/golden/v1/deprecated_connection.h" +#include "generator/integration_tests/golden/v1/deprecated_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 golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +namespace { +auto constexpr kBackoffScaling = 2.0; +} // namespace + +Options DeprecatedServiceDefaultOptions(Options options) { + options = internal::PopulateCommonOptions( + std::move(options), "GOOGLE_CLOUD_CPP_DEPRECATED_SERVICE_ENDPOINT", + "", "GOOGLE_CLOUD_CPP_DEPRECATED_SERVICE_AUTHORITY", + "goldenrestonly.googleapis.com"); + options = internal::PopulateGrpcOptions(std::move(options)); + if (!options.has()) { + options.set( + golden_v1::DeprecatedServiceLimitedTimeRetryPolicy( + 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( + golden_v1::MakeDefaultDeprecatedServiceConnectionIdempotencyPolicy()); + } + + return options; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_option_defaults.h b/generator/integration_tests/golden/v1/internal/deprecated_option_defaults.h new file mode 100644 index 0000000000000..32f71550325ef --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_option_defaults.h @@ -0,0 +1,38 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_OPTION_DEFAULTS_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_OPTION_DEFAULTS_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "google/cloud/options.h" +#include "google/cloud/version.h" + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +Options DeprecatedServiceDefaultOptions(Options options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_OPTION_DEFAULTS_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_rest_connection_impl.cc b/generator/integration_tests/golden/v1/internal/deprecated_rest_connection_impl.cc new file mode 100644 index 0000000000000..8614fa9f5db7d --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_rest_connection_impl.cc @@ -0,0 +1,59 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_connection_impl.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub_factory.h" +#include "google/cloud/common_options.h" +#include "google/cloud/credentials.h" +#include "google/cloud/internal/rest_retry_loop.h" +#include "google/cloud/rest_options.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +DeprecatedServiceRestConnectionImpl::DeprecatedServiceRestConnectionImpl( + std::unique_ptr background, + std::shared_ptr stub, + Options options) + : background_(std::move(background)), stub_(std::move(stub)), + options_(internal::MergeOptions( + std::move(options), + DeprecatedServiceConnection::options())) {} + +Status +DeprecatedServiceRestConnectionImpl::Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::rest_internal::RestRetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->Noop(request), + [this](rest_internal::RestContext& rest_context, + Options const& options, google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + return stub_->Noop(rest_context, options, request); + }, + *current, request, __func__); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_rest_connection_impl.h b/generator/integration_tests/golden/v1/internal/deprecated_rest_connection_impl.h new file mode 100644 index 0000000000000..8dbd70cc188f0 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_rest_connection_impl.h @@ -0,0 +1,80 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_CONNECTION_IMPL_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_CONNECTION_IMPL_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_connection.h" +#include "generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.h" +#include "generator/integration_tests/golden/v1/deprecated_options.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_retry_traits.h" +#include "google/cloud/background_threads.h" +#include "google/cloud/backoff_policy.h" +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class DeprecatedServiceRestConnectionImpl + : public golden_v1::DeprecatedServiceConnection { + public: + ~DeprecatedServiceRestConnectionImpl() override = default; + + DeprecatedServiceRestConnectionImpl( + std::unique_ptr background, + std::shared_ptr stub, + Options options); + + Options options() override { return options_; } + + Status + Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request) override; + + private: + static std::unique_ptr + retry_policy(Options const& options) { + return options.get()->clone(); + } + + static std::unique_ptr backoff_policy(Options const& options) { + return options.get()->clone(); + } + + static std::unique_ptr + idempotency_policy(Options const& options) { + return options.get()->clone(); + } + + std::unique_ptr background_; + std::shared_ptr stub_; + Options options_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_CONNECTION_IMPL_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_rest_logging_decorator.cc b/generator/integration_tests/golden/v1/internal/deprecated_rest_logging_decorator.cc new file mode 100644 index 0000000000000..dc9cb7580c1ff --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_rest_logging_decorator.cc @@ -0,0 +1,55 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_logging_decorator.h" +#include "google/cloud/internal/log_wrapper.h" +#include "google/cloud/status_or.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +DeprecatedServiceRestLogging::DeprecatedServiceRestLogging( + std::shared_ptr child, + TracingOptions tracing_options, + std::set components) + : child_(std::move(child)), tracing_options_(std::move(tracing_options)), + components_(std::move(components)) {} + +Status +DeprecatedServiceRestLogging::Noop( + rest_internal::RestContext& rest_context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](rest_internal::RestContext& rest_context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + return child_->Noop(rest_context, options, request); + }, + rest_context, options, request, __func__, tracing_options_); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_rest_logging_decorator.h b/generator/integration_tests/golden/v1/internal/deprecated_rest_logging_decorator.h new file mode 100644 index 0000000000000..c251b57091919 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_rest_logging_decorator.h @@ -0,0 +1,60 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_LOGGING_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_LOGGING_DECORATOR_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub.h" +#include "google/cloud/future.h" +#include "google/cloud/internal/rest_context.h" +#include "google/cloud/tracing_options.h" +#include "google/cloud/version.h" +#include +#include +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class DeprecatedServiceRestLogging : public DeprecatedServiceRestStub { + public: + ~DeprecatedServiceRestLogging() override = default; + DeprecatedServiceRestLogging(std::shared_ptr child, + TracingOptions tracing_options, + std::set components); + + Status Noop( + google::cloud::rest_internal::RestContext& rest_context, + Options const& options, google::test::deprecated::v1::DeprecatedServiceRequest const& request) override; + + private: + std::shared_ptr child_; + TracingOptions tracing_options_; + std::set components_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_LOGGING_DECORATOR_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_rest_metadata_decorator.cc b/generator/integration_tests/golden/v1/internal/deprecated_rest_metadata_decorator.cc new file mode 100644 index 0000000000000..adc65827303d8 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_rest_metadata_decorator.cc @@ -0,0 +1,61 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_metadata_decorator.h" +#include "absl/strings/str_format.h" +#include "google/cloud/internal/absl_str_cat_quiet.h" +#include "google/cloud/internal/api_client_header.h" +#include "google/cloud/internal/rest_set_metadata.h" +#include "google/cloud/status_or.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +DeprecatedServiceRestMetadata::DeprecatedServiceRestMetadata( + std::shared_ptr child, + std::string api_client_header) + : child_(std::move(child)), + api_client_header_( + api_client_header.empty() + ? google::cloud::internal::GeneratedLibClientHeader() + : std::move(api_client_header)) {} + +Status +DeprecatedServiceRestMetadata::Noop( + rest_internal::RestContext& rest_context, + Options const& options, google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + SetMetadata(rest_context, options); + return child_->Noop(rest_context, options, request); +} + +void DeprecatedServiceRestMetadata::SetMetadata( + rest_internal::RestContext& rest_context, + Options const& options, std::vector const& params) { + google::cloud::rest_internal::SetMetadata( + rest_context, options, params, api_client_header_); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_rest_metadata_decorator.h b/generator/integration_tests/golden/v1/internal/deprecated_rest_metadata_decorator.h new file mode 100644 index 0000000000000..c9c0002d8a5f9 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_rest_metadata_decorator.h @@ -0,0 +1,61 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_METADATA_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_METADATA_DECORATOR_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub.h" +#include "google/cloud/future.h" +#include "google/cloud/rest_options.h" +#include "google/cloud/version.h" +#include +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class DeprecatedServiceRestMetadata : public DeprecatedServiceRestStub { + public: + ~DeprecatedServiceRestMetadata() override = default; + explicit DeprecatedServiceRestMetadata( + std::shared_ptr child, + std::string api_client_header = ""); + + Status Noop( + google::cloud::rest_internal::RestContext& rest_context, + Options const& options, google::test::deprecated::v1::DeprecatedServiceRequest const& request) override; + + private: + void SetMetadata(rest_internal::RestContext& rest_context, + Options const& options, + std::vector const& params = {}); + + std::shared_ptr child_; + std::string api_client_header_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_METADATA_DECORATOR_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_rest_stub.cc b/generator/integration_tests/golden/v1/internal/deprecated_rest_stub.cc new file mode 100644 index 0000000000000..e58e74c1474db --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_rest_stub.cc @@ -0,0 +1,58 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub.h" +#include "google/cloud/common_options.h" +#include "google/cloud/internal/absl_str_cat_quiet.h" +#include "google/cloud/internal/rest_stub_helpers.h" +#include "google/cloud/status_or.h" +#include +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +DefaultDeprecatedServiceRestStub::DefaultDeprecatedServiceRestStub(Options options) + : service_(rest_internal::MakePooledRestClient( + options.get(), options)), + options_(std::move(options)) {} + +DefaultDeprecatedServiceRestStub::DefaultDeprecatedServiceRestStub( + std::shared_ptr service, + Options options) + : service_(std::move(service)), + options_(std::move(options)) {} + +Status DefaultDeprecatedServiceRestStub::Noop( + google::cloud::rest_internal::RestContext& rest_context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + std::vector> query_params; + return rest_internal::Post( + *service_, rest_context, request, false, + absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", "noop"), std::move(query_params)); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_rest_stub.h b/generator/integration_tests/golden/v1/internal/deprecated_rest_stub.h new file mode 100644 index 0000000000000..ac02c5019c130 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_rest_stub.h @@ -0,0 +1,68 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_STUB_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_STUB_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "google/cloud/completion_queue.h" +#include "google/cloud/internal/rest_client.h" +#include "google/cloud/internal/rest_context.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class DeprecatedServiceRestStub { + public: + virtual ~DeprecatedServiceRestStub() = default; + + virtual Status Noop( + google::cloud::rest_internal::RestContext& rest_context, + Options const& options, google::test::deprecated::v1::DeprecatedServiceRequest const& request) = 0; +}; + +class DefaultDeprecatedServiceRestStub : public DeprecatedServiceRestStub { + public: + ~DefaultDeprecatedServiceRestStub() override = default; + + explicit DefaultDeprecatedServiceRestStub(Options options); + DefaultDeprecatedServiceRestStub( + std::shared_ptr service, + Options options); + + Status Noop( + google::cloud::rest_internal::RestContext& rest_context, + Options const& options, google::test::deprecated::v1::DeprecatedServiceRequest const& request) override; + + private: + std::shared_ptr service_; + Options options_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_STUB_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_rest_stub_factory.cc b/generator/integration_tests/golden/v1/internal/deprecated_rest_stub_factory.cc new file mode 100644 index 0000000000000..362a91352675e --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_rest_stub_factory.cc @@ -0,0 +1,59 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub_factory.h" +#include "absl/strings/match.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_logging_decorator.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_metadata_decorator.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub.h" +#include "google/cloud/common_options.h" +#include "google/cloud/internal/algorithm.h" +#include "google/cloud/internal/populate_rest_options.h" +#include "google/cloud/log.h" +#include "google/cloud/options.h" +#include "google/cloud/rest_options.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr +CreateDefaultDeprecatedServiceRestStub(Options const& options) { + auto opts = internal::PopulateRestOptions(options); + std::shared_ptr stub = + std::make_shared(std::move(opts)); + stub = std::make_shared(std::move(stub)); + if (internal::Contains( + options.get(), "rpc")) { + GCP_LOG(INFO) << "Enabled logging for REST rpc calls"; + stub = std::make_shared( + std::move(stub), + options.get(), + options.get()); + } + return stub; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_rest_stub_factory.h b/generator/integration_tests/golden/v1/internal/deprecated_rest_stub_factory.h new file mode 100644 index 0000000000000..cf257f9add21c --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_rest_stub_factory.h @@ -0,0 +1,41 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_STUB_FACTORY_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_STUB_FACTORY_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr CreateDefaultDeprecatedServiceRestStub( + Options const& options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_REST_STUB_FACTORY_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_retry_traits.h b/generator/integration_tests/golden/v1/internal/deprecated_retry_traits.h new file mode 100644 index 0000000000000..e7bb228b1d856 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_retry_traits.h @@ -0,0 +1,43 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_RETRY_TRAITS_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_RETRY_TRAITS_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "google/cloud/status.h" +#include "google/cloud/version.h" + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// Define the gRPC status code semantics for retrying requests. +struct DeprecatedServiceRetryTraits { + static bool IsPermanentFailure(google::cloud::Status const& status) { + return status.code() != StatusCode::kOk && status.code() != StatusCode::kUnavailable; + } +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_RETRY_TRAITS_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_sources.cc b/generator/integration_tests/golden/v1/internal/deprecated_sources.cc new file mode 100644 index 0000000000000..22adbe82a469a --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_sources.cc @@ -0,0 +1,39 @@ +// 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: generator/integration_tests/test_deprecated.proto + +// NOLINTBEGIN(bugprone-suspicious-include) +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_client.cc" +#include "generator/integration_tests/golden/v1/deprecated_connection.cc" +#include "generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.cc" +#include "generator/integration_tests/golden/v1/deprecated_rest_connection.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_auth_decorator.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_connection_impl.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_logging_decorator.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_metadata_decorator.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_option_defaults.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_connection_impl.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_logging_decorator.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_metadata_decorator.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_rest_stub_factory.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_stub.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_stub_factory.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_tracing_connection.cc" +#include "generator/integration_tests/golden/v1/internal/deprecated_tracing_stub.cc" +// NOLINTEND(bugprone-suspicious-include) diff --git a/generator/integration_tests/golden/v1/internal/deprecated_stub.cc b/generator/integration_tests/golden/v1/internal/deprecated_stub.cc new file mode 100644 index 0000000000000..198b961b50bc9 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_stub.cc @@ -0,0 +1,50 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_stub.h" +#include "google/cloud/grpc_error_delegate.h" +#include "google/cloud/status_or.h" +#include +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +DeprecatedServiceStub::~DeprecatedServiceStub() = default; + +Status +DefaultDeprecatedServiceStub::Noop( + grpc::ClientContext& context, Options const&, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + google::protobuf::Empty response; + auto status = + grpc_stub_->Noop(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return google::cloud::Status(); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_stub.h b/generator/integration_tests/golden/v1/internal/deprecated_stub.h new file mode 100644 index 0000000000000..44837af0131f8 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_stub.h @@ -0,0 +1,65 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_STUB_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_STUB_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class DeprecatedServiceStub { + public: + virtual ~DeprecatedServiceStub() = 0; + + virtual Status Noop( + grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) = 0; +}; + +class DefaultDeprecatedServiceStub : public DeprecatedServiceStub { + public: + explicit DefaultDeprecatedServiceStub( + std::unique_ptr grpc_stub) + : grpc_stub_(std::move(grpc_stub)) {} + + Status Noop( + grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) override; + + private: + std::unique_ptr grpc_stub_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_STUB_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_stub_factory.cc b/generator/integration_tests/golden/v1/internal/deprecated_stub_factory.cc new file mode 100644 index 0000000000000..3cc56203e2f95 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_stub_factory.cc @@ -0,0 +1,74 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_stub_factory.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_auth_decorator.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_logging_decorator.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_metadata_decorator.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_stub.h" +#include "generator/integration_tests/golden/v1/internal/deprecated_tracing_stub.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 +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr +CreateDefaultDeprecatedServiceStub( + std::shared_ptr auth, + Options const& options) { + auto channel = auth->CreateChannel( + options.get(), internal::MakeChannelArguments(options)); + auto service_grpc_stub = google::test::deprecated::v1::DeprecatedService::NewStub(channel); + std::shared_ptr stub = + std::make_shared(std::move(service_grpc_stub)); + + 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 = MakeDeprecatedServiceTracingStub(std::move(stub)); + } + return stub; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_stub_factory.h b/generator/integration_tests/golden/v1/internal/deprecated_stub_factory.h new file mode 100644 index 0000000000000..90417eba91707 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_stub_factory.h @@ -0,0 +1,43 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_STUB_FACTORY_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_STUB_FACTORY_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_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 golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr CreateDefaultDeprecatedServiceStub( + std::shared_ptr auth, + Options const& options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_STUB_FACTORY_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_tracing_connection.cc b/generator/integration_tests/golden/v1/internal/deprecated_tracing_connection.cc new file mode 100644 index 0000000000000..72a46456be9fb --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_tracing_connection.cc @@ -0,0 +1,59 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_tracing_connection.h" +#include "google/cloud/internal/opentelemetry.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + +DeprecatedServiceTracingConnection::DeprecatedServiceTracingConnection( + std::shared_ptr child) + : child_(std::move(child)) {} + +Status +DeprecatedServiceTracingConnection::Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + auto span = internal::MakeSpan("golden_v1::DeprecatedServiceConnection::Noop"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->Noop(request)); +} + +#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + +std::shared_ptr +MakeDeprecatedServiceTracingConnection( + std::shared_ptr conn) { +#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + if (internal::TracingEnabled(conn->options())) { + conn = std::make_shared(std::move(conn)); + } +#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + return conn; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_tracing_connection.h b/generator/integration_tests/golden/v1/internal/deprecated_tracing_connection.h new file mode 100644 index 0000000000000..063dac2c619c4 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_tracing_connection.h @@ -0,0 +1,68 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_TRACING_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_TRACING_CONNECTION_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_connection.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + +class DeprecatedServiceTracingConnection + : public golden_v1::DeprecatedServiceConnection { + public: + ~DeprecatedServiceTracingConnection() override = default; + + explicit DeprecatedServiceTracingConnection( + std::shared_ptr child); + + Options options() override { return child_->options(); } + + Status + Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request) override; + + private: + std::shared_ptr child_; +}; + +#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + +/** + * 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 +MakeDeprecatedServiceTracingConnection( + std::shared_ptr conn); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_TRACING_CONNECTION_H diff --git a/generator/integration_tests/golden/v1/internal/deprecated_tracing_stub.cc b/generator/integration_tests/golden/v1/internal/deprecated_tracing_stub.cc new file mode 100644 index 0000000000000..6583dff1502f9 --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_tracing_stub.cc @@ -0,0 +1,61 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_tracing_stub.h" +#include "google/cloud/internal/grpc_opentelemetry.h" +#include +#include + +namespace google { +namespace cloud { +namespace golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + +DeprecatedServiceTracingStub::DeprecatedServiceTracingStub( + std::shared_ptr child) + : child_(std::move(child)), propagator_(internal::MakePropagator()) {} + +Status DeprecatedServiceTracingStub::Noop( + grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) { + auto span = internal::MakeSpanGrpc("google.test.deprecated.v1.DeprecatedService", "Noop"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->Noop(context, options, request)); +} + +#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + +std::shared_ptr MakeDeprecatedServiceTracingStub( + std::shared_ptr stub) { +#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + return std::make_shared(std::move(stub)); +#else + return stub; +#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google diff --git a/generator/integration_tests/golden/v1/internal/deprecated_tracing_stub.h b/generator/integration_tests/golden/v1/internal/deprecated_tracing_stub.h new file mode 100644 index 0000000000000..2aeab6eeeddea --- /dev/null +++ b/generator/integration_tests/golden/v1/internal/deprecated_tracing_stub.h @@ -0,0 +1,68 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_TRACING_STUB_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_TRACING_STUB_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/internal/deprecated_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 golden_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + +class DeprecatedServiceTracingStub : public DeprecatedServiceStub { + public: + ~DeprecatedServiceTracingStub() override = default; + + explicit DeprecatedServiceTracingStub(std::shared_ptr child); + + Status Noop( + grpc::ClientContext& context, + Options const& options, + google::test::deprecated::v1::DeprecatedServiceRequest const& request) override; + + private: + std::shared_ptr child_; + std::shared_ptr propagator_; +}; + +#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY + +/** + * Applies the tracing decorator to the given stub. + * + * The stub is only decorated if the library has been compiled with + * OpenTelemetry. + */ +std::shared_ptr MakeDeprecatedServiceTracingStub( + std::shared_ptr stub); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_INTERNAL_DEPRECATED_TRACING_STUB_H diff --git a/generator/integration_tests/golden/v1/mocks/mock_deprecated_connection.h b/generator/integration_tests/golden/v1/mocks/mock_deprecated_connection.h new file mode 100644 index 0000000000000..da0b25b2e3a61 --- /dev/null +++ b/generator/integration_tests/golden/v1/mocks/mock_deprecated_connection.h @@ -0,0 +1,60 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_MOCKS_MOCK_DEPRECATED_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_MOCKS_MOCK_DEPRECATED_CONNECTION_H + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_connection.h" +#include + +namespace google { +namespace cloud { +namespace golden_v1_mocks { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * A class to mock `DeprecatedServiceConnection`. + * + * Application developers may want to test their code with simulated responses, + * including errors, from an object of type `DeprecatedServiceClient`. To do so, + * construct an object of type `DeprecatedServiceClient` 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 MockDeprecatedServiceConnection : public golden_v1::DeprecatedServiceConnection { + public: + MOCK_METHOD(Options, options, (), (override)); + + MOCK_METHOD(Status, + Noop, + (google::test::deprecated::v1::DeprecatedServiceRequest const& request), (override)); +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace golden_v1_mocks +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_MOCKS_MOCK_DEPRECATED_CONNECTION_H diff --git a/generator/integration_tests/golden/v1/samples/deprecated_client_samples.cc b/generator/integration_tests/golden/v1/samples/deprecated_client_samples.cc new file mode 100644 index 0000000000000..350d909ce97e8 --- /dev/null +++ b/generator/integration_tests/golden/v1/samples/deprecated_client_samples.cc @@ -0,0 +1,146 @@ +// 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: generator/integration_tests/test_deprecated.proto + +#include "google/cloud/internal/disable_deprecation_warnings.inc" +#include "generator/integration_tests/golden/v1/deprecated_client.h" +#include "generator/integration_tests/golden/v1/deprecated_connection_idempotency_policy.h" +#include "generator/integration_tests/golden/v1/deprecated_options.h" +#include "google/cloud/common_options.h" +#include "google/cloud/credentials.h" +#include "google/cloud/internal/getenv.h" +#include "google/cloud/testing_util/example_driver.h" +#include +#include +#include +#include + +// clang-format off +// main-dox-marker: golden_v1::DeprecatedServiceClient +// 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 client = google::cloud::golden_v1::DeprecatedServiceClient( + google::cloud::golden_v1::MakeDeprecatedServiceConnection(options)); + //! [set-client-endpoint] +} + +//! [custom-idempotency-policy] +class CustomIdempotencyPolicy + : public google::cloud::golden_v1::DeprecatedServiceConnectionIdempotencyPolicy { + 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::golden_v1::DeprecatedServiceLimitedErrorCountRetryPolicy(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::golden_v1::MakeDeprecatedServiceConnection(options); + + // c1 and c2 share the same retry policies + auto c1 = google::cloud::golden_v1::DeprecatedServiceClient(connection); + auto c2 = google::cloud::golden_v1::DeprecatedServiceClient(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::golden_v1::DeprecatedServiceClient( + connection, google::cloud::Options{}.set( + google::cloud::golden_v1::DeprecatedServiceLimitedTimeRetryPolicy(std::chrono::minutes(5)).clone())); + + // You can also override the policies in a single call: + // c3.SomeRpc(..., google::cloud::Options{} + // .set( + // google::cloud::golden_v1::DeprecatedServiceLimitedErrorCountRetryPolicy(10).clone())); + //! [set-retry-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::golden_v1::DeprecatedServiceClient( + google::cloud::golden_v1::MakeDeprecatedServiceConnection(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 WithServiceAccount() example" << std::endl; + WithServiceAccount({keyfile}); +} + +} // 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}, + {"with-service-account", WithServiceAccount}, + {"auto", AutoRun}, + }); + return example.Run(argc, argv); +} diff --git a/generator/integration_tests/golden_config.textproto b/generator/integration_tests/golden_config.textproto index 17fc6dfe9c058..998de811957c1 100644 --- a/generator/integration_tests/golden_config.textproto +++ b/generator/integration_tests/golden_config.textproto @@ -72,3 +72,14 @@ service { ] override_service_config_yaml_name: "generator/integration_tests/test_request_id.yaml" } + +service { + service_proto_path: "generator/integration_tests/test_deprecated.proto" + product_path: "generator/integration_tests/golden/v1" + initial_copyright_year: "2024" + generate_rest_transport: true + generate_grpc_transport: true + retryable_status_codes: [ + "kUnavailable" + ] +} diff --git a/generator/integration_tests/test_deprecated.proto b/generator/integration_tests/test_deprecated.proto new file mode 100644 index 0000000000000..113f97e674017 --- /dev/null +++ b/generator/integration_tests/test_deprecated.proto @@ -0,0 +1,39 @@ +// 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. + +syntax = "proto3"; + +package google.test.deprecated.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/protobuf/empty.proto"; + +// Service to test deprecated services. +service DeprecatedService { + option deprecated = true; + option (google.api.default_host) = "goldenrestonly.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Does nothing. + rpc Noop(DeprecatedServiceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/noop" + body: "*" + }; + } +} + +message DeprecatedServiceRequest {} diff --git a/generator/internal/client_generator.cc b/generator/internal/client_generator.cc index 6c7224500ceec..b1b2b2e740027 100644 --- a/generator/internal/client_generator.cc +++ b/generator/internal/client_generator.cc @@ -75,6 +75,7 @@ Status ClientGenerator::GenerateHeader() { // includes HeaderPrint("\n"); + HeaderLocalIncludes( {HasGenerateGrpcTransport() ? vars("connection_header_path") : vars("connection_rest_header_path"), @@ -97,10 +98,22 @@ Status ClientGenerator::GenerateHeader() { if (!result.ok()) return result; // Client Class + if (IsDeprecated()) { + HeaderPrint(R"""( +$class_comment_block$ +class + GOOGLE_CLOUD_CPP_DEPRECATED( + "$service_name$ has been deprecated and will be turned down in the future." +) +$client_class_name$ {)"""); + } else { + HeaderPrint( + R"""( +$class_comment_block$ +class $client_class_name$ {)"""); + } HeaderPrint( R"""( -$class_comment_block$ -class $client_class_name$ { public: explicit $client_class_name$()"""); if (IsExperimental()) HeaderPrint("ExperimentalTag, "); diff --git a/generator/internal/service_code_generator.cc b/generator/internal/service_code_generator.cc index a55ef630a8499..b55a1105db68d 100644 --- a/generator/internal/service_code_generator.cc +++ b/generator/internal/service_code_generator.cc @@ -293,12 +293,13 @@ VarsDictionary ServiceCodeGenerator::MergeServiceAndMethodVars( void ServiceCodeGenerator::HeaderLocalIncludes( std::vector const& local_includes) { - GenerateLocalIncludes(header_, local_includes); + GenerateLocalIncludes(header_, local_includes, FileType::kHeaderFile, + IsDeprecated()); } void ServiceCodeGenerator::CcLocalIncludes( std::vector const& local_includes) { - GenerateLocalIncludes(cc_, local_includes, FileType::kCcFile); + GenerateLocalIncludes(cc_, local_includes, FileType::kCcFile, IsDeprecated()); } void ServiceCodeGenerator::HeaderSystemIncludes( @@ -384,7 +385,14 @@ void ServiceCodeGenerator::CcPrintMethod( } void ServiceCodeGenerator::GenerateLocalIncludes( - Printer& p, std::vector local_includes, FileType file_type) { + Printer& p, std::vector local_includes, FileType file_type, + bool is_deprecated) { + if (is_deprecated) { + p.Print( + "#include " + "\"google/cloud/internal/disable_deprecation_warnings.inc\"\n"); + } + if (file_type == FileType::kCcFile) { std::sort(local_includes.begin() + 1, local_includes.end()); } else { @@ -507,6 +515,10 @@ std::vector const& ServiceCodeGenerator::MixinMethods() const { return mixin_methods_; } +bool ServiceCodeGenerator::IsDeprecated() const { + return service_descriptor_->options().deprecated(); +} + } // namespace generator_internal } // namespace cloud } // namespace google diff --git a/generator/internal/service_code_generator.h b/generator/internal/service_code_generator.h index 247c9e76ed160..e645b048e2ae3 100644 --- a/generator/internal/service_code_generator.h +++ b/generator/internal/service_code_generator.h @@ -237,13 +237,18 @@ class ServiceCodeGenerator : public GeneratorInterface { std::vector const& MixinMethods() const; + /** + * If the service is defined with `option deprecated = true;`. + */ + bool IsDeprecated() const; + private: void SetMethods(); enum class FileType { kHeaderFile, kCcFile }; static void GenerateLocalIncludes(Printer& p, std::vector local_includes, - FileType file_type = FileType::kHeaderFile); + FileType file_type, bool is_deprecated); static void GenerateSystemIncludes(Printer& p, std::vector system_includes); diff --git a/generator/internal/service_code_generator_test.cc b/generator/internal/service_code_generator_test.cc index 663fa5bfe35b5..4a65fb279743a 100644 --- a/generator/internal/service_code_generator_test.cc +++ b/generator/internal/service_code_generator_test.cc @@ -63,6 +63,7 @@ class TestGenerator : public ServiceCodeGenerator { using ServiceCodeGenerator::HasPaginatedMethod; using ServiceCodeGenerator::HasStreamingReadMethod; using ServiceCodeGenerator::HasStreamingWriteMethod; + using ServiceCodeGenerator::IsDeprecated; using ServiceCodeGenerator::IsDiscoveryDocumentProto; using ServiceCodeGenerator::IsExperimental; using ServiceCodeGenerator::MethodSignatureWellKnownProtobufTypeIncludes; @@ -1011,6 +1012,55 @@ TEST(PredicateUtilsTest, IsDiscoveryDocumentProto) { EXPECT_FALSE(g3.IsDiscoveryDocumentProto()); } +TEST(ServiceCodeGeneratorTest, IsDeprecated) { + auto constexpr kServiceProto = R"""( +syntax = "proto3"; + +// This service that is deprecated. +service DeprecatedService { + option deprecated = true; +} + +// This service that is NOT deprecated. +service NonDeprecatedService { +} + +)"""; + + generator_testing::FakeSourceTree source_tree( + std::map{ + {"google/cloud/foo/service.proto", kServiceProto}}); + google::protobuf::compiler::SourceTreeDescriptorDatabase source_tree_db( + &source_tree); + google::protobuf::SimpleDescriptorDatabase simple_db; + FileDescriptorProto file_proto; + // we need descriptor.proto to be accessible by the pool + // since our test file imports it + FileDescriptorProto::descriptor()->file()->CopyTo(&file_proto); + simple_db.Add(file_proto); + google::protobuf::MergedDescriptorDatabase merged_db(&simple_db, + &source_tree_db); + generator_testing::ErrorCollector collector; + DescriptorPool pool(&merged_db, &collector); + + FileDescriptor const* service_file_descriptor = + pool.FindFileByName("google/cloud/foo/service.proto"); + + auto generator_context = std::make_unique(); + EXPECT_CALL(*generator_context, Open("header_path")) + .Times(2) + .WillRepeatedly( + [](std::string const&) { return new MockZeroCopyOutputStream(); }); + + TestGenerator deprecated_service(service_file_descriptor->service(0), + generator_context.get()); + EXPECT_TRUE(deprecated_service.IsDeprecated()); + + TestGenerator non_deprecated_service(service_file_descriptor->service(1), + generator_context.get()); + EXPECT_FALSE(non_deprecated_service.IsDeprecated()); +} + } // namespace } // namespace generator_internal } // namespace cloud diff --git a/google/cloud/bigtable/test_proxy/BUILD.bazel b/google/cloud/bigtable/test_proxy/BUILD.bazel index c3b6490e7da97..c3ad1602b5b1c 100644 --- a/google/cloud/bigtable/test_proxy/BUILD.bazel +++ b/google/cloud/bigtable/test_proxy/BUILD.bazel @@ -22,6 +22,7 @@ cc_library( testonly = True, srcs = ["cbt_test_proxy.cc"], hdrs = ["cbt_test_proxy.h"], + copts = ["-Wno-deprecated-declarations"], deps = [ "//:bigtable", "//protos:system_includes", diff --git a/google/cloud/channel/v1/cloud_channel_reports_client.cc b/google/cloud/channel/v1/cloud_channel_reports_client.cc index 48de414b35fb1..9f8170bf7e6c8 100644 --- a/google/cloud/channel/v1/cloud_channel_reports_client.cc +++ b/google/cloud/channel/v1/cloud_channel_reports_client.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/cloud_channel_reports_client.h" #include #include diff --git a/google/cloud/channel/v1/cloud_channel_reports_client.h b/google/cloud/channel/v1/cloud_channel_reports_client.h index ad8295c16ab80..454eea919eb0d 100644 --- a/google/cloud/channel/v1/cloud_channel_reports_client.h +++ b/google/cloud/channel/v1/cloud_channel_reports_client.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/cloud_channel_reports_connection.h" #include "google/cloud/future.h" #include "google/cloud/no_await_tag.h" @@ -68,7 +69,9 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN /// and move-construction is a relatively efficient operation, consider using /// such a copy when using this class from multiple threads. /// -class CloudChannelReportsServiceClient { +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, diff --git a/google/cloud/channel/v1/cloud_channel_reports_connection.cc b/google/cloud/channel/v1/cloud_channel_reports_connection.cc index dc14ad37ba0ee..55adbd4dc1e90 100644 --- a/google/cloud/channel/v1/cloud_channel_reports_connection.cc +++ b/google/cloud/channel/v1/cloud_channel_reports_connection.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #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" diff --git a/google/cloud/channel/v1/cloud_channel_reports_connection.h b/google/cloud/channel/v1/cloud_channel_reports_connection.h index 9c887fd5acf50..a1bec0f6aebc9 100644 --- a/google/cloud/channel/v1/cloud_channel_reports_connection.h +++ b/google/cloud/channel/v1/cloud_channel_reports_connection.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #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/backoff_policy.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 index a7d2ad092e2c8..521be7414bb60 100644 --- a/google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.cc +++ b/google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h" #include 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 index a6a7424863161..f2c14443e49bc 100644 --- a/google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h +++ b/google/cloud/channel/v1/cloud_channel_reports_connection_idempotency_policy.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/idempotency.h" #include "google/cloud/version.h" #include diff --git a/google/cloud/channel/v1/cloud_channel_reports_options.h b/google/cloud/channel/v1/cloud_channel_reports_options.h index 7bd68ee312f06..84c403c1c31aa 100644 --- a/google/cloud/channel/v1/cloud_channel_reports_options.h +++ b/google/cloud/channel/v1/cloud_channel_reports_options.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #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" 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 index de6c83addd0f7..b43c92875c062 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.cc +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.h" #include #include 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 index e85a1f1fa6850..88147f4b2ba8a 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.h +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_auth_decorator.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" #include "google/cloud/internal/unified_grpc_credentials.h" #include "google/cloud/version.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 index cc83bc433b1bf..1264ef3378844 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.cc +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #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" 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 index bcbb394c2a822..30b266b668b07 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.h +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_connection_impl.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #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" 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 index ae543652e5b16..070c1478bbbcd 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.cc +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.h" #include "google/cloud/internal/log_wrapper.h" #include "google/cloud/status_or.h" 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 index 3f684aee67146..f5994de4f2ef0 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.h +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_logging_decorator.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" #include "google/cloud/tracing_options.h" #include "google/cloud/version.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 index bc044f97300f5..dd576ee77f88e 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.cc +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.h" #include "google/cloud/grpc_options.h" #include "google/cloud/internal/absl_str_cat_quiet.h" 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 index f5dcf7a0088e1..9c7765fc10dc8 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.h +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_metadata_decorator.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" #include "google/cloud/options.h" #include "google/cloud/version.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 index c868bafb49bcc..00f77d5b6dd8a 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.cc +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #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" 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 index 10223a941de77..6059740adbe3b 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.h +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_option_defaults.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/options.h" #include "google/cloud/version.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 index 50ca7f3779b6c..eebbbe2e50fe3 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_retry_traits.h +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_retry_traits.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/status.h" #include "google/cloud/version.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 index 6a7a46f323f2b..519e066e12778 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_sources.cc +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_sources.cc @@ -17,6 +17,7 @@ // source: google/cloud/channel/v1/reports_service.proto // NOLINTBEGIN(bugprone-suspicious-include) +#include "google/cloud/internal/disable_deprecation_warnings.inc" #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" diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_stub.cc b/google/cloud/channel/v1/internal/cloud_channel_reports_stub.cc index aa567a8d3a89f..850459fd894dc 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_stub.cc +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_stub.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" #include "google/cloud/grpc_error_delegate.h" #include "google/cloud/status_or.h" diff --git a/google/cloud/channel/v1/internal/cloud_channel_reports_stub.h b/google/cloud/channel/v1/internal/cloud_channel_reports_stub.h index 3f9f864a9b297..3323159b099d7 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_stub.h +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_stub.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/completion_queue.h" #include "google/cloud/future.h" #include "google/cloud/options.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 index c9d47efa3b930..fcbb009c595fd 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.cc +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #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" 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 index 56dce648fbd5f..225b6406b47f2 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.h +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_stub_factory.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" #include "google/cloud/internal/unified_grpc_credentials.h" #include "google/cloud/options.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 index b81bc97be669e..acb8052875371 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.cc +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #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" 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 index 1e76d8af0e401..3f8ea51dc7d84 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.h +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_connection.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/cloud_channel_reports_connection.h" #include "google/cloud/version.h" #include 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 index ce153912ae552..c34b0b38c89c9 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.cc +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.h" #include "google/cloud/internal/grpc_opentelemetry.h" #include 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 index 14bf63f41bc3e..ccc6d6a1f55ed 100644 --- a/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.h +++ b/google/cloud/channel/v1/internal/cloud_channel_reports_tracing_stub.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/internal/cloud_channel_reports_stub.h" #include "google/cloud/internal/trace_propagator.h" #include "google/cloud/options.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 index 7e371da033dc3..76a8eeafbc457 100644 --- a/google/cloud/channel/v1/mocks/mock_cloud_channel_reports_connection.h +++ b/google/cloud/channel/v1/mocks/mock_cloud_channel_reports_connection.h @@ -19,6 +19,7 @@ #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/internal/disable_deprecation_warnings.inc" #include "google/cloud/channel/v1/cloud_channel_reports_connection.h" #include 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 index 30b3baec49c2b..58a4946c3fcdd 100644 --- a/google/cloud/channel/v1/samples/cloud_channel_reports_client_samples.cc +++ b/google/cloud/channel/v1/samples/cloud_channel_reports_client_samples.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/channel/v1/reports_service.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #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" diff --git a/google/cloud/resourcesettings/mocks/mock_resource_settings_connection.h b/google/cloud/resourcesettings/mocks/mock_resource_settings_connection.h index e499569275c8c..bc2a23a35dbd9 100644 --- a/google/cloud/resourcesettings/mocks/mock_resource_settings_connection.h +++ b/google/cloud/resourcesettings/mocks/mock_resource_settings_connection.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_MOCKS_MOCK_RESOURCE_SETTINGS_CONNECTION_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_MOCKS_MOCK_RESOURCE_SETTINGS_CONNECTION_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/resource_settings_connection.h" #include "google/cloud/resourcesettings/v1/mocks/mock_resource_settings_connection.h" diff --git a/google/cloud/resourcesettings/resource_settings_client.h b/google/cloud/resourcesettings/resource_settings_client.h index 3e568af40c23d..dcb12cd73dd70 100644 --- a/google/cloud/resourcesettings/resource_settings_client.h +++ b/google/cloud/resourcesettings/resource_settings_client.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_RESOURCE_SETTINGS_CLIENT_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_RESOURCE_SETTINGS_CLIENT_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/resource_settings_connection.h" #include "google/cloud/resourcesettings/v1/resource_settings_client.h" diff --git a/google/cloud/resourcesettings/resource_settings_connection.h b/google/cloud/resourcesettings/resource_settings_connection.h index dbc3517c3236c..06fec173fa46f 100644 --- a/google/cloud/resourcesettings/resource_settings_connection.h +++ b/google/cloud/resourcesettings/resource_settings_connection.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_RESOURCE_SETTINGS_CONNECTION_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_RESOURCE_SETTINGS_CONNECTION_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/resource_settings_connection_idempotency_policy.h" #include "google/cloud/resourcesettings/v1/resource_settings_connection.h" diff --git a/google/cloud/resourcesettings/resource_settings_connection_idempotency_policy.h b/google/cloud/resourcesettings/resource_settings_connection_idempotency_policy.h index 8ef02109aabb3..0c5adf94cd804 100644 --- a/google/cloud/resourcesettings/resource_settings_connection_idempotency_policy.h +++ b/google/cloud/resourcesettings/resource_settings_connection_idempotency_policy.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_RESOURCE_SETTINGS_CONNECTION_IDEMPOTENCY_POLICY_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_RESOURCE_SETTINGS_CONNECTION_IDEMPOTENCY_POLICY_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.h" namespace google { diff --git a/google/cloud/resourcesettings/resource_settings_options.h b/google/cloud/resourcesettings/resource_settings_options.h index 1759ad0890715..ec09c1875cd42 100644 --- a/google/cloud/resourcesettings/resource_settings_options.h +++ b/google/cloud/resourcesettings/resource_settings_options.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_RESOURCE_SETTINGS_OPTIONS_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_RESOURCE_SETTINGS_OPTIONS_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/resource_settings_connection.h" #include "google/cloud/resourcesettings/resource_settings_connection_idempotency_policy.h" #include "google/cloud/resourcesettings/v1/resource_settings_options.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.cc b/google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.cc index 68d16bf256b1f..fd9cfa8bde04a 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.cc +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.h" #include #include diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.h b/google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.h index 3136ea666bdd7..2733542dc199e 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.h +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_AUTH_DECORATOR_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_AUTH_DECORATOR_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_stub.h" #include "google/cloud/internal/unified_grpc_credentials.h" #include "google/cloud/version.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.cc b/google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.cc index bacd82772334e..3955562f97c9f 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.cc +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.h" #include "google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.h" #include "google/cloud/background_threads.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.h b/google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.h index 0158a0706e5bf..c2ee2db6539e0 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.h +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_CONNECTION_IMPL_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_CONNECTION_IMPL_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_retry_traits.h" #include "google/cloud/resourcesettings/v1/internal/resource_settings_stub.h" #include "google/cloud/resourcesettings/v1/resource_settings_connection.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.cc b/google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.cc index 82a274df74399..d11eadcdc4c98 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.cc +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.h" #include "google/cloud/internal/log_wrapper.h" #include "google/cloud/status_or.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.h b/google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.h index f2fe7ccb485ba..a2530a5412808 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.h +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_LOGGING_DECORATOR_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_LOGGING_DECORATOR_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_stub.h" #include "google/cloud/tracing_options.h" #include "google/cloud/version.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_metadata_decorator.cc b/google/cloud/resourcesettings/v1/internal/resource_settings_metadata_decorator.cc index 64cddfc5f86cc..1e3b5f9bc00ba 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_metadata_decorator.cc +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_metadata_decorator.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_metadata_decorator.h" #include "google/cloud/grpc_options.h" #include "google/cloud/internal/absl_str_cat_quiet.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_metadata_decorator.h b/google/cloud/resourcesettings/v1/internal/resource_settings_metadata_decorator.h index 8efe5c66807ab..657eee1808595 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_metadata_decorator.h +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_metadata_decorator.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_METADATA_DECORATOR_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_METADATA_DECORATOR_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_stub.h" #include "google/cloud/options.h" #include "google/cloud/version.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.cc b/google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.cc index 4c4893bd59b98..4cea36bc833a0 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.cc +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.h" #include "google/cloud/resourcesettings/v1/resource_settings_connection.h" #include "google/cloud/resourcesettings/v1/resource_settings_options.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.h b/google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.h index 79d8a69f803fc..33ebcbe47f9af 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.h +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_OPTION_DEFAULTS_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_OPTION_DEFAULTS_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/options.h" #include "google/cloud/version.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_retry_traits.h b/google/cloud/resourcesettings/v1/internal/resource_settings_retry_traits.h index bc2e7a0ec2f77..040ee13982901 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_retry_traits.h +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_retry_traits.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_RETRY_TRAITS_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_RETRY_TRAITS_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/status.h" #include "google/cloud/version.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_sources.cc b/google/cloud/resourcesettings/v1/internal/resource_settings_sources.cc index d1a293b1b904f..fb0b9e2b9452b 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_sources.cc +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_sources.cc @@ -17,6 +17,7 @@ // source: google/cloud/resourcesettings/v1/resource_settings.proto // NOLINTBEGIN(bugprone-suspicious-include) +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.cc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.cc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.cc" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_stub.cc b/google/cloud/resourcesettings/v1/internal/resource_settings_stub.cc index 200fd75ffee4a..a0c09e6ce3ef6 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_stub.cc +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_stub.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_stub.h" #include "google/cloud/grpc_error_delegate.h" #include "google/cloud/status_or.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_stub.h b/google/cloud/resourcesettings/v1/internal/resource_settings_stub.h index 56e1818660aeb..ba63dc9fb0ed8 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_stub.h +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_stub.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_STUB_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_STUB_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/options.h" #include "google/cloud/status_or.h" #include "google/cloud/version.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_stub_factory.cc b/google/cloud/resourcesettings/v1/internal/resource_settings_stub_factory.cc index dc31d3367162f..86b46b47086c6 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_stub_factory.cc +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_stub_factory.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_stub_factory.h" #include "google/cloud/resourcesettings/v1/internal/resource_settings_auth_decorator.h" #include "google/cloud/resourcesettings/v1/internal/resource_settings_logging_decorator.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_stub_factory.h b/google/cloud/resourcesettings/v1/internal/resource_settings_stub_factory.h index 894d04a734754..3fb84ed013f08 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_stub_factory.h +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_stub_factory.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_STUB_FACTORY_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_STUB_FACTORY_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_stub.h" #include "google/cloud/internal/unified_grpc_credentials.h" #include "google/cloud/options.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_connection.cc b/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_connection.cc index ded4663d22828..a2f2dc2dfe12f 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_connection.cc +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_connection.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_tracing_connection.h" #include "google/cloud/internal/opentelemetry.h" #include "google/cloud/internal/traced_stream_range.h" diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_connection.h b/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_connection.h index ed392edcf2c1c..11638072378e5 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_connection.h +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_connection.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_TRACING_CONNECTION_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_TRACING_CONNECTION_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/resource_settings_connection.h" #include "google/cloud/version.h" #include diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_stub.cc b/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_stub.cc index 03fe0bbe5648e..cb55ac6308655 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_stub.cc +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_stub.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_tracing_stub.h" #include "google/cloud/internal/grpc_opentelemetry.h" #include diff --git a/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_stub.h b/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_stub.h index 5544c28163056..4ea5a41b28851 100644 --- a/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_stub.h +++ b/google/cloud/resourcesettings/v1/internal/resource_settings_tracing_stub.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_TRACING_STUB_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_INTERNAL_RESOURCE_SETTINGS_TRACING_STUB_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_stub.h" #include "google/cloud/internal/trace_propagator.h" #include "google/cloud/options.h" diff --git a/google/cloud/resourcesettings/v1/mocks/mock_resource_settings_connection.h b/google/cloud/resourcesettings/v1/mocks/mock_resource_settings_connection.h index 81311678f3b64..83ca1e3038ff9 100644 --- a/google/cloud/resourcesettings/v1/mocks/mock_resource_settings_connection.h +++ b/google/cloud/resourcesettings/v1/mocks/mock_resource_settings_connection.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_MOCKS_MOCK_RESOURCE_SETTINGS_CONNECTION_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_MOCKS_MOCK_RESOURCE_SETTINGS_CONNECTION_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/resource_settings_connection.h" #include diff --git a/google/cloud/resourcesettings/v1/resource_settings_client.cc b/google/cloud/resourcesettings/v1/resource_settings_client.cc index 5cc1471d3d2c2..f3f87ea0d29f0 100644 --- a/google/cloud/resourcesettings/v1/resource_settings_client.cc +++ b/google/cloud/resourcesettings/v1/resource_settings_client.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/resource_settings_client.h" #include #include diff --git a/google/cloud/resourcesettings/v1/resource_settings_client.h b/google/cloud/resourcesettings/v1/resource_settings_client.h index ce12bf18369fa..86ff1d4f52909 100644 --- a/google/cloud/resourcesettings/v1/resource_settings_client.h +++ b/google/cloud/resourcesettings/v1/resource_settings_client.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_RESOURCE_SETTINGS_CLIENT_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_RESOURCE_SETTINGS_CLIENT_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/resource_settings_connection.h" #include "google/cloud/future.h" #include "google/cloud/options.h" @@ -73,7 +74,9 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN /// and move-construction is a relatively efficient operation, consider using /// such a copy when using this class from multiple threads. /// -class ResourceSettingsServiceClient { +class GOOGLE_CLOUD_CPP_DEPRECATED( + "ResourceSettingsService has been deprecated and will be turned down in " + "the future.") ResourceSettingsServiceClient { public: explicit ResourceSettingsServiceClient( std::shared_ptr connection, diff --git a/google/cloud/resourcesettings/v1/resource_settings_connection.cc b/google/cloud/resourcesettings/v1/resource_settings_connection.cc index ef0206409c69c..32bdf73d3ebdf 100644 --- a/google/cloud/resourcesettings/v1/resource_settings_connection.cc +++ b/google/cloud/resourcesettings/v1/resource_settings_connection.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/resource_settings_connection.h" #include "google/cloud/resourcesettings/v1/internal/resource_settings_connection_impl.h" #include "google/cloud/resourcesettings/v1/internal/resource_settings_option_defaults.h" diff --git a/google/cloud/resourcesettings/v1/resource_settings_connection.h b/google/cloud/resourcesettings/v1/resource_settings_connection.h index 56027ef817795..b3ddbd8b26ec3 100644 --- a/google/cloud/resourcesettings/v1/resource_settings_connection.h +++ b/google/cloud/resourcesettings/v1/resource_settings_connection.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_RESOURCE_SETTINGS_CONNECTION_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_RESOURCE_SETTINGS_CONNECTION_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/internal/resource_settings_retry_traits.h" #include "google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.h" #include "google/cloud/backoff_policy.h" diff --git a/google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.cc b/google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.cc index e17e1d1ed3931..77420a3faa3c4 100644 --- a/google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.cc +++ b/google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.h" #include diff --git a/google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.h b/google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.h index bb9f199f0fffb..8160bf8b015d1 100644 --- a/google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.h +++ b/google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_RESOURCE_SETTINGS_CONNECTION_IDEMPOTENCY_POLICY_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_RESOURCE_SETTINGS_CONNECTION_IDEMPOTENCY_POLICY_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/idempotency.h" #include "google/cloud/version.h" #include diff --git a/google/cloud/resourcesettings/v1/resource_settings_options.h b/google/cloud/resourcesettings/v1/resource_settings_options.h index f8f56442ddd52..86a997723e803 100644 --- a/google/cloud/resourcesettings/v1/resource_settings_options.h +++ b/google/cloud/resourcesettings/v1/resource_settings_options.h @@ -19,6 +19,7 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_RESOURCE_SETTINGS_OPTIONS_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_RESOURCESETTINGS_V1_RESOURCE_SETTINGS_OPTIONS_H +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/resource_settings_connection.h" #include "google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.h" #include "google/cloud/backoff_policy.h" diff --git a/google/cloud/resourcesettings/v1/samples/resource_settings_client_samples.cc b/google/cloud/resourcesettings/v1/samples/resource_settings_client_samples.cc index 0c503530bf917..4ee5f50dbb40e 100644 --- a/google/cloud/resourcesettings/v1/samples/resource_settings_client_samples.cc +++ b/google/cloud/resourcesettings/v1/samples/resource_settings_client_samples.cc @@ -16,6 +16,7 @@ // If you make any local changes, they will be lost. // source: google/cloud/resourcesettings/v1/resource_settings.proto +#include "google/cloud/internal/disable_deprecation_warnings.inc" #include "google/cloud/resourcesettings/v1/resource_settings_client.h" #include "google/cloud/resourcesettings/v1/resource_settings_connection_idempotency_policy.h" #include "google/cloud/resourcesettings/v1/resource_settings_options.h"