|
| 1 | +// Copyright 2024 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +// Generated by the Codegen C++ plugin. |
| 16 | +// If you make any local changes, they will be lost. |
| 17 | +// source: generator/integration_tests/test_deprecated.proto |
| 18 | + |
| 19 | +#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CLIENT_H |
| 20 | +#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CLIENT_H |
| 21 | + |
| 22 | +#include "google/cloud/internal/disable_deprecation_warnings.inc" |
| 23 | +#include "generator/integration_tests/golden/v1/deprecated_connection.h" |
| 24 | +#include "google/cloud/future.h" |
| 25 | +#include "google/cloud/options.h" |
| 26 | +#include "google/cloud/polling_policy.h" |
| 27 | +#include "google/cloud/status_or.h" |
| 28 | +#include "google/cloud/version.h" |
| 29 | +#include <memory> |
| 30 | +#include <string> |
| 31 | + |
| 32 | +namespace google { |
| 33 | +namespace cloud { |
| 34 | +namespace golden_v1 { |
| 35 | +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN |
| 36 | + |
| 37 | +/// |
| 38 | +/// Service to test deprecated services. |
| 39 | +/// |
| 40 | +/// @par Equality |
| 41 | +/// |
| 42 | +/// Instances of this class created via copy-construction or copy-assignment |
| 43 | +/// always compare equal. Instances created with equal |
| 44 | +/// `std::shared_ptr<*Connection>` objects compare equal. Objects that compare |
| 45 | +/// equal share the same underlying resources. |
| 46 | +/// |
| 47 | +/// @par Performance |
| 48 | +/// |
| 49 | +/// Creating a new instance of this class is a relatively expensive operation, |
| 50 | +/// new objects establish new connections to the service. In contrast, |
| 51 | +/// copy-construction, move-construction, and the corresponding assignment |
| 52 | +/// operations are relatively efficient as the copies share all underlying |
| 53 | +/// resources. |
| 54 | +/// |
| 55 | +/// @par Thread Safety |
| 56 | +/// |
| 57 | +/// Concurrent access to different instances of this class, even if they compare |
| 58 | +/// equal, is guaranteed to work. Two or more threads operating on the same |
| 59 | +/// instance of this class is not guaranteed to work. Since copy-construction |
| 60 | +/// and move-construction is a relatively efficient operation, consider using |
| 61 | +/// such a copy when using this class from multiple threads. |
| 62 | +/// |
| 63 | +class |
| 64 | + GOOGLE_CLOUD_CPP_DEPRECATED( |
| 65 | + "DeprecatedService has been deprecated and will be turned down in the future." |
| 66 | +) |
| 67 | +DeprecatedServiceClient { |
| 68 | + public: |
| 69 | + explicit DeprecatedServiceClient(std::shared_ptr<DeprecatedServiceConnection> connection, Options opts = {}); |
| 70 | + ~DeprecatedServiceClient(); |
| 71 | + |
| 72 | + ///@{ |
| 73 | + /// @name Copy and move support |
| 74 | + DeprecatedServiceClient(DeprecatedServiceClient const&) = default; |
| 75 | + DeprecatedServiceClient& operator=(DeprecatedServiceClient const&) = default; |
| 76 | + DeprecatedServiceClient(DeprecatedServiceClient&&) = default; |
| 77 | + DeprecatedServiceClient& operator=(DeprecatedServiceClient&&) = default; |
| 78 | + ///@} |
| 79 | + |
| 80 | + ///@{ |
| 81 | + /// @name Equality |
| 82 | + friend bool operator==(DeprecatedServiceClient const& a, DeprecatedServiceClient const& b) { |
| 83 | + return a.connection_ == b.connection_; |
| 84 | + } |
| 85 | + friend bool operator!=(DeprecatedServiceClient const& a, DeprecatedServiceClient const& b) { |
| 86 | + return !(a == b); |
| 87 | + } |
| 88 | + ///@} |
| 89 | + |
| 90 | + // clang-format off |
| 91 | + /// |
| 92 | + /// Does nothing. |
| 93 | + /// |
| 94 | + /// @param request Unary RPCs, such as the one wrapped by this |
| 95 | + /// function, receive a single `request` proto message which includes all |
| 96 | + /// the inputs for the RPC. In this case, the proto message is a |
| 97 | + /// [google.test.deprecated.v1.DeprecatedServiceRequest]. |
| 98 | + /// Proto messages are converted to C++ classes by Protobuf, using the |
| 99 | + /// [Protobuf mapping rules]. |
| 100 | + /// @param opts Optional. Override the class-level options, such as retry and |
| 101 | + /// backoff policies. |
| 102 | + /// @return a [`Status`] object. If the request failed, the |
| 103 | + /// status contains the details of the failure. |
| 104 | + /// |
| 105 | + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ |
| 106 | + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator |
| 107 | + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string |
| 108 | + /// [`future`]: @ref google::cloud::future |
| 109 | + /// [`StatusOr`]: @ref google::cloud::StatusOr |
| 110 | + /// [`Status`]: @ref google::cloud::Status |
| 111 | + /// [google.test.deprecated.v1.DeprecatedServiceRequest]: @googleapis_reference_link{generator/integration_tests/test_deprecated.proto#L39} |
| 112 | + /// |
| 113 | + // clang-format on |
| 114 | + Status |
| 115 | + Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request, Options opts = {}); |
| 116 | + |
| 117 | + private: |
| 118 | + std::shared_ptr<DeprecatedServiceConnection> connection_; |
| 119 | + Options options_; |
| 120 | +}; |
| 121 | + |
| 122 | +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END |
| 123 | +} // namespace golden_v1 |
| 124 | +} // namespace cloud |
| 125 | +} // namespace google |
| 126 | + |
| 127 | +#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CLIENT_H |
0 commit comments