diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c250480bfcdb..e5024d0637a51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ for details on updating existing applications using v1.x.y or v2.x.y. ## v3.8.0 - TBD +### [Cloud Quotas API](/google/cloud/cloudquotas/README.md) + - The library has been expanded to include the QuotaAdjusterSettingsManager service. + ## v3.7.0 - 2026-07 ### Removed Libraries diff --git a/ci/abi-dumps/google_cloud_cpp_cloudquotas.expected.abi.dump.gz b/ci/abi-dumps/google_cloud_cpp_cloudquotas.expected.abi.dump.gz index fbca3af67391f..cfc54e46fd30e 100644 Binary files a/ci/abi-dumps/google_cloud_cpp_cloudquotas.expected.abi.dump.gz and b/ci/abi-dumps/google_cloud_cpp_cloudquotas.expected.abi.dump.gz differ diff --git a/generator/generator_config.textproto b/generator/generator_config.textproto index c62acf5c64025..c199787ec21f5 100644 --- a/generator/generator_config.textproto +++ b/generator/generator_config.textproto @@ -796,6 +796,13 @@ service { retryable_status_codes: ["kUnavailable"] } +service { + service_proto_path: "google/api/cloudquotas/v1/quota_adjuster_settings.proto" + product_path: "google/cloud/cloudquotas/v1" + initial_copyright_year: "2026" + retryable_status_codes: ["kUnavailable"] +} + # Cloud Security Compliance service { service_proto_path: "google/cloud/cloudsecuritycompliance/v1/config.proto" diff --git a/google/cloud/cloudquotas/doc/environment-variables.dox b/google/cloud/cloudquotas/doc/environment-variables.dox index 97307c4f0a81c..ec26ab3998236 100644 --- a/google/cloud/cloudquotas/doc/environment-variables.dox +++ b/google/cloud/cloudquotas/doc/environment-variables.dox @@ -13,6 +13,10 @@ environment variables are convenient when troubleshooting problems. `EndpointOption` (which defaults to "cloudquotas.googleapis.com") used by `MakeCloudQuotasConnection()`. +- `GOOGLE_CLOUD_CPP_QUOTA_ADJUSTER_SETTINGS_MANAGER_ENDPOINT=...` overrides the + `EndpointOption` (which defaults to "cloudquotas.googleapis.com") + used by `MakeQuotaAdjusterSettingsManagerConnection()`. + @see google::cloud::EndpointOption diff --git a/google/cloud/cloudquotas/doc/main.dox b/google/cloud/cloudquotas/doc/main.dox index fcfab7fae7857..ee0ee0d811b5c 100644 --- a/google/cloud/cloudquotas/doc/main.dox +++ b/google/cloud/cloudquotas/doc/main.dox @@ -21,12 +21,18 @@ which should give you a taste of the Cloud Quotas API C++ client library API. ## Main classes -The main class in this library is -[`cloudquotas_v1::CloudQuotasClient`](@ref google::cloud::cloudquotas_v1::CloudQuotasClient). All RPCs are exposed -as member functions of this class. Other classes provide helpers, configuration -parameters, and infrastructure to mock -[`cloudquotas_v1::CloudQuotasClient`](@ref google::cloud::cloudquotas_v1::CloudQuotasClient) when testing your +This library offers multiple `*Client` classes, which are listed below. Each one +of these classes exposes all the RPCs for a service as member functions of the +class. This library groups multiple services because they are part of the same +product or are often used together. A typical example may be the administrative +and data plane operations for a single product. + +The library also has other classes that provide helpers, configuration +parameters, and infrastructure to mock the `*Client` classes when testing your application. + +- [\c cloudquotas_v1::CloudQuotasClient](@ref google::cloud::cloudquotas_v1::CloudQuotasClient) +- [\c cloudquotas_v1::QuotaAdjusterSettingsManagerClient](@ref google::cloud::cloudquotas_v1::QuotaAdjusterSettingsManagerClient) ## More Information diff --git a/google/cloud/cloudquotas/doc/override-authentication.dox b/google/cloud/cloudquotas/doc/override-authentication.dox index 00ffda74ce0f9..dffa86ec6633c 100644 --- a/google/cloud/cloudquotas/doc/override-authentication.dox +++ b/google/cloud/cloudquotas/doc/override-authentication.dox @@ -11,6 +11,11 @@ The following example shows how to explicitly load a service account key file: @snippet cloud_quotas_client_samples.cc with-service-account +Follow these links to find examples for other \c *Client classes: + +- [\c cloudquotas_v1::CloudQuotasClient](@ref cloudquotas_v1::CloudQuotasClient-service-account-snippet) +- [\c cloudquotas_v1::QuotaAdjusterSettingsManagerClient](@ref cloudquotas_v1::QuotaAdjusterSettingsManagerClient-service-account-snippet) + Keep in mind that we chose this as an example because it is relatively easy to @@ -31,5 +36,11 @@ guide for more details. @snippet google/cloud/cloudquotas/v1/samples/cloud_quotas_client_samples.cc with-service-account +*/ + +/*! @page cloudquotas_v1::QuotaAdjusterSettingsManagerClient-service-account-snippet Override cloudquotas_v1::QuotaAdjusterSettingsManagerClient Authentication Defaults + +@snippet google/cloud/cloudquotas/v1/samples/quota_adjuster_settings_manager_client_samples.cc with-service-account + */ // diff --git a/google/cloud/cloudquotas/doc/override-endpoint.dox b/google/cloud/cloudquotas/doc/override-endpoint.dox index ec63c18a335d8..941ac486ea950 100644 --- a/google/cloud/cloudquotas/doc/override-endpoint.dox +++ b/google/cloud/cloudquotas/doc/override-endpoint.dox @@ -11,6 +11,11 @@ For example, this will override the default endpoint for `cloudquotas_v1::CloudQ @snippet cloud_quotas_client_samples.cc set-client-endpoint +Follow these links to find examples for other \c *Client classes: + +- [\c cloudquotas_v1::CloudQuotasClient](@ref cloudquotas_v1::CloudQuotasClient-endpoint-snippet) +- [\c cloudquotas_v1::QuotaAdjusterSettingsManagerClient](@ref cloudquotas_v1::QuotaAdjusterSettingsManagerClient-endpoint-snippet) + */ @@ -21,5 +26,11 @@ For example, this will override the default endpoint for `cloudquotas_v1::CloudQ @snippet google/cloud/cloudquotas/v1/samples/cloud_quotas_client_samples.cc set-client-endpoint +*/ + +/*! @page cloudquotas_v1::QuotaAdjusterSettingsManagerClient-endpoint-snippet Override cloudquotas_v1::QuotaAdjusterSettingsManagerClient Endpoint Configuration + +@snippet google/cloud/cloudquotas/v1/samples/quota_adjuster_settings_manager_client_samples.cc set-client-endpoint + */ // diff --git a/google/cloud/cloudquotas/doc/override-retry-policies.dox b/google/cloud/cloudquotas/doc/override-retry-policies.dox index dff37d1f79fc5..35d79c45f16c9 100644 --- a/google/cloud/cloudquotas/doc/override-retry-policies.dox +++ b/google/cloud/cloudquotas/doc/override-retry-policies.dox @@ -76,6 +76,11 @@ This assumes you have created a custom idempotency policy. Such as: @snippet cloud_quotas_client_samples.cc custom-idempotency-policy +Follow these links to find examples for other \c *Client classes: + +- [\c cloudquotas_v1::CloudQuotasClient](@ref cloudquotas_v1::CloudQuotasClient-retry-snippet) +- [\c cloudquotas_v1::QuotaAdjusterSettingsManagerClient](@ref cloudquotas_v1::QuotaAdjusterSettingsManagerClient-retry-snippet) + @section cloudquotas-override-retry-more-information More Information @@ -100,5 +105,17 @@ Assuming you have created a custom idempotency policy. Such as: @snippet google/cloud/cloudquotas/v1/samples/cloud_quotas_client_samples.cc custom-idempotency-policy +*/ + +/*! @page cloudquotas_v1::QuotaAdjusterSettingsManagerClient-retry-snippet Override cloudquotas_v1::QuotaAdjusterSettingsManagerClient Retry Policies + +This shows how to override the retry policies for cloudquotas_v1::QuotaAdjusterSettingsManagerClient: + +@snippet google/cloud/cloudquotas/v1/samples/quota_adjuster_settings_manager_client_samples.cc set-retry-policy + +Assuming you have created a custom idempotency policy. Such as: + +@snippet google/cloud/cloudquotas/v1/samples/quota_adjuster_settings_manager_client_samples.cc custom-idempotency-policy + */ // diff --git a/google/cloud/cloudquotas/doc/override-universe-domain.dox b/google/cloud/cloudquotas/doc/override-universe-domain.dox index a2e7e2d0adc2b..7b2bea8a26916 100644 --- a/google/cloud/cloudquotas/doc/override-universe-domain.dox +++ b/google/cloud/cloudquotas/doc/override-universe-domain.dox @@ -10,6 +10,11 @@ For example, this will override the default universe domain for `cloudquotas_v1: @snippet cloud_quotas_client_samples.cc set-client-universe-domain +Follow these links to find examples for other \c *Client classes: + +- [\c cloudquotas_v1::CloudQuotasClient](@ref cloudquotas_v1::CloudQuotasClient-universe-domain-snippet) +- [\c cloudquotas_v1::QuotaAdjusterSettingsManagerClient](@ref cloudquotas_v1::QuotaAdjusterSettingsManagerClient-universe-domain-snippet) + */ @@ -20,5 +25,11 @@ For example, this will override the default universe domain for `cloudquotas_v1: @snippet google/cloud/cloudquotas/v1/samples/cloud_quotas_client_samples.cc set-client-universe-domain +*/ + +/*! @page cloudquotas_v1::QuotaAdjusterSettingsManagerClient-universe-domain-snippet Override cloudquotas_v1::QuotaAdjusterSettingsManagerClient Universe Domain + +@snippet google/cloud/cloudquotas/v1/samples/quota_adjuster_settings_manager_client_samples.cc set-client-universe-domain + */ // diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_auth_decorator.cc b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_auth_decorator.cc new file mode 100644 index 0000000000000..5a4ac2041a173 --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_auth_decorator.cc @@ -0,0 +1,62 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_auth_decorator.h" +#include "google/api/cloudquotas/v1/quota_adjuster_settings.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +QuotaAdjusterSettingsManagerAuth::QuotaAdjusterSettingsManagerAuth( + std::shared_ptr auth, + std::shared_ptr child) + : auth_(std::move(auth)), child_(std::move(child)) {} + +StatusOr +QuotaAdjusterSettingsManagerAuth::UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->UpdateQuotaAdjusterSettings(context, options, request); +} + +StatusOr +QuotaAdjusterSettingsManagerAuth::GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetQuotaAdjusterSettings(context, options, request); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_auth_decorator.h b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_auth_decorator.h new file mode 100644 index 0000000000000..3f7b425361776 --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_auth_decorator.h @@ -0,0 +1,69 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_AUTH_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_AUTH_DECORATOR_H + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h" +#include "google/cloud/internal/unified_grpc_credentials.h" +#include "google/cloud/version.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class QuotaAdjusterSettingsManagerAuth + : public QuotaAdjusterSettingsManagerStub { + public: + ~QuotaAdjusterSettingsManagerAuth() override = default; + QuotaAdjusterSettingsManagerAuth( + std::shared_ptr auth, + std::shared_ptr child); + + StatusOr + UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) override; + + StatusOr + GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) override; + + private: + std::shared_ptr auth_; + std::shared_ptr child_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_AUTH_DECORATOR_H diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_connection_impl.cc b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_connection_impl.cc new file mode 100644 index 0000000000000..c2c8ffa3e52b8 --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_connection_impl.cc @@ -0,0 +1,107 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_connection_impl.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_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 cloudquotas_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< + cloudquotas_v1::QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy> +idempotency_policy(Options const& options) { + return options + .get() + ->clone(); +} + +} // namespace + +QuotaAdjusterSettingsManagerConnectionImpl:: + QuotaAdjusterSettingsManagerConnectionImpl( + std::unique_ptr background, + std::shared_ptr< + cloudquotas_v1_internal::QuotaAdjusterSettingsManagerStub> + stub, + Options options) + : background_(std::move(background)), + stub_(std::move(stub)), + options_(internal::MergeOptions( + std::move(options), + QuotaAdjusterSettingsManagerConnection::options())) {} + +StatusOr +QuotaAdjusterSettingsManagerConnectionImpl::UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->UpdateQuotaAdjusterSettings(request), + [this](grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1:: + UpdateQuotaAdjusterSettingsRequest const& request) { + return stub_->UpdateQuotaAdjusterSettings(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +QuotaAdjusterSettingsManagerConnectionImpl::GetQuotaAdjusterSettings( + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetQuotaAdjusterSettings(request), + [this]( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) { + return stub_->GetQuotaAdjusterSettings(context, options, request); + }, + *current, request, __func__); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_connection_impl.h b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_connection_impl.h new file mode 100644 index 0000000000000..97dcc7c3c7a6e --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_connection_impl.h @@ -0,0 +1,74 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_IMPL_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_IMPL_H + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_retry_traits.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.h" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.h" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_options.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 cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class QuotaAdjusterSettingsManagerConnectionImpl + : public cloudquotas_v1::QuotaAdjusterSettingsManagerConnection { + public: + ~QuotaAdjusterSettingsManagerConnectionImpl() override = default; + + QuotaAdjusterSettingsManagerConnectionImpl( + std::unique_ptr background, + std::shared_ptr + stub, + Options options); + + Options options() override { return options_; } + + StatusOr + UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) override; + + StatusOr + GetQuotaAdjusterSettings( + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) override; + + private: + std::unique_ptr background_; + std::shared_ptr + stub_; + Options options_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_IMPL_H diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_logging_decorator.cc b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_logging_decorator.cc new file mode 100644 index 0000000000000..b91bc5be3a49e --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_logging_decorator.cc @@ -0,0 +1,75 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_logging_decorator.h" +#include "google/cloud/internal/log_wrapper.h" +#include "google/cloud/status_or.h" +#include "google/api/cloudquotas/v1/quota_adjuster_settings.grpc.pb.h" +#include +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +QuotaAdjusterSettingsManagerLogging::QuotaAdjusterSettingsManagerLogging( + std::shared_ptr child, + TracingOptions tracing_options, std::set const&) + : child_(std::move(child)), tracing_options_(std::move(tracing_options)) {} + +StatusOr +QuotaAdjusterSettingsManagerLogging::UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1:: + UpdateQuotaAdjusterSettingsRequest const& request) { + return child_->UpdateQuotaAdjusterSettings(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +QuotaAdjusterSettingsManagerLogging::GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this]( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) { + return child_->GetQuotaAdjusterSettings(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_logging_decorator.h b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_logging_decorator.h new file mode 100644 index 0000000000000..a4ddc5827fd7a --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_logging_decorator.h @@ -0,0 +1,69 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_LOGGING_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_LOGGING_DECORATOR_H + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h" +#include "google/cloud/tracing_options.h" +#include "google/cloud/version.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class QuotaAdjusterSettingsManagerLogging + : public QuotaAdjusterSettingsManagerStub { + public: + ~QuotaAdjusterSettingsManagerLogging() override = default; + QuotaAdjusterSettingsManagerLogging( + std::shared_ptr child, + TracingOptions tracing_options, std::set const& components); + + StatusOr + UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) override; + + StatusOr + GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) override; + + private: + std::shared_ptr child_; + TracingOptions tracing_options_; +}; // QuotaAdjusterSettingsManagerLogging + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_LOGGING_DECORATOR_H diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_metadata_decorator.cc b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_metadata_decorator.cc new file mode 100644 index 0000000000000..3b351d6a328af --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_metadata_decorator.cc @@ -0,0 +1,91 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_metadata_decorator.h" +#include "google/cloud/grpc_options.h" +#include "google/cloud/internal/api_client_header.h" +#include "google/cloud/internal/url_encode.h" +#include "google/cloud/status_or.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/str_join.h" +#include "google/api/cloudquotas/v1/quota_adjuster_settings.grpc.pb.h" +#include +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +QuotaAdjusterSettingsManagerMetadata::QuotaAdjusterSettingsManagerMetadata( + 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)) {} + +StatusOr +QuotaAdjusterSettingsManagerMetadata::UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("quota_adjuster_settings.name=", + internal::UrlEncode( + request.quota_adjuster_settings().name()))); + return child_->UpdateQuotaAdjusterSettings(context, options, request); +} + +StatusOr +QuotaAdjusterSettingsManagerMetadata::GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetQuotaAdjusterSettings(context, options, request); +} + +void QuotaAdjusterSettingsManagerMetadata::SetMetadata( + grpc::ClientContext& context, Options const& options, + std::string const& request_params) { + context.AddMetadata("x-goog-request-params", request_params); + SetMetadata(context, options); +} + +void QuotaAdjusterSettingsManagerMetadata::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 cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_metadata_decorator.h b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_metadata_decorator.h new file mode 100644 index 0000000000000..46d2421d8492c --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_metadata_decorator.h @@ -0,0 +1,75 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_METADATA_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_METADATA_DECORATOR_H + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class QuotaAdjusterSettingsManagerMetadata + : public QuotaAdjusterSettingsManagerStub { + public: + ~QuotaAdjusterSettingsManagerMetadata() override = default; + QuotaAdjusterSettingsManagerMetadata( + std::shared_ptr child, + std::multimap fixed_metadata, + std::string api_client_header = ""); + + StatusOr + UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) override; + + StatusOr + GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest 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 cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_METADATA_DECORATOR_H diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_option_defaults.cc b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_option_defaults.cc new file mode 100644 index 0000000000000..16f34e0eaa890 --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_option_defaults.cc @@ -0,0 +1,75 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_option_defaults.h" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.h" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_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 cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +namespace { +auto constexpr kBackoffScaling = 2.0; +} // namespace + +Options QuotaAdjusterSettingsManagerDefaultOptions(Options options) { + options = internal::PopulateCommonOptions( + std::move(options), + "GOOGLE_CLOUD_CPP_QUOTA_ADJUSTER_SETTINGS_MANAGER_ENDPOINT", "", + "GOOGLE_CLOUD_CPP_QUOTA_ADJUSTER_SETTINGS_MANAGER_AUTHORITY", + "cloudquotas.googleapis.com"); + options = internal::PopulateGrpcOptions(std::move(options)); + if (!options.has< + cloudquotas_v1::QuotaAdjusterSettingsManagerRetryPolicyOption>()) { + options.set( + cloudquotas_v1::QuotaAdjusterSettingsManagerLimitedTimeRetryPolicy( + std::chrono::minutes(10)) + .clone()); + } + if (!options.has< + cloudquotas_v1::QuotaAdjusterSettingsManagerBackoffPolicyOption>()) { + options + .set( + ExponentialBackoffPolicy( + std::chrono::seconds(0), std::chrono::seconds(1), + std::chrono::minutes(5), kBackoffScaling, kBackoffScaling) + .clone()); + } + if (!options.has< + cloudquotas_v1:: + QuotaAdjusterSettingsManagerConnectionIdempotencyPolicyOption>()) { + options.set< + cloudquotas_v1:: + QuotaAdjusterSettingsManagerConnectionIdempotencyPolicyOption>( + cloudquotas_v1:: + MakeDefaultQuotaAdjusterSettingsManagerConnectionIdempotencyPolicy()); + } + + return options; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_option_defaults.h b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_option_defaults.h new file mode 100644 index 0000000000000..7cabddf20da58 --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_option_defaults.h @@ -0,0 +1,37 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_OPTION_DEFAULTS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_OPTION_DEFAULTS_H + +#include "google/cloud/options.h" +#include "google/cloud/version.h" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +Options QuotaAdjusterSettingsManagerDefaultOptions(Options options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_OPTION_DEFAULTS_H diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_retry_traits.h b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_retry_traits.h new file mode 100644 index 0000000000000..f4f92c96b04cc --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_retry_traits.h @@ -0,0 +1,43 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_RETRY_TRAITS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_RETRY_TRAITS_H + +#include "google/cloud/status.h" +#include "google/cloud/version.h" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// Define the gRPC status code semantics for retrying requests. +struct QuotaAdjusterSettingsManagerRetryTraits { + static bool IsPermanentFailure(google::cloud::Status const& status) { + return status.code() != StatusCode::kOk && + status.code() != StatusCode::kUnavailable; + } +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_RETRY_TRAITS_H diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_sources.cc b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_sources.cc new file mode 100644 index 0000000000000..441187c2ca17f --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_sources.cc @@ -0,0 +1,32 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +// NOLINTBEGIN(bugprone-suspicious-include) +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_auth_decorator.cc" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_connection_impl.cc" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_logging_decorator.cc" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_metadata_decorator.cc" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_option_defaults.cc" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.cc" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub_factory.cc" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_connection.cc" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_stub.cc" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_client.cc" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.cc" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.cc" +// NOLINTEND(bugprone-suspicious-include) diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.cc b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.cc new file mode 100644 index 0000000000000..26fb86bda0f2a --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.cc @@ -0,0 +1,69 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h" +#include "google/cloud/grpc_error_delegate.h" +#include "google/cloud/status_or.h" +#include "google/api/cloudquotas/v1/quota_adjuster_settings.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +QuotaAdjusterSettingsManagerStub::~QuotaAdjusterSettingsManagerStub() = default; + +StatusOr +DefaultQuotaAdjusterSettingsManagerStub::UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const&, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) { + google::api::cloudquotas::v1::QuotaAdjusterSettings response; + auto status = + grpc_stub_->UpdateQuotaAdjusterSettings(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultQuotaAdjusterSettingsManagerStub::GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const&, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) { + google::api::cloudquotas::v1::QuotaAdjusterSettings response; + auto status = + grpc_stub_->GetQuotaAdjusterSettings(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h new file mode 100644 index 0000000000000..aed103cb62e0e --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h @@ -0,0 +1,88 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_STUB_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_STUB_H + +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include "google/api/cloudquotas/v1/quota_adjuster_settings.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class QuotaAdjusterSettingsManagerStub { + public: + virtual ~QuotaAdjusterSettingsManagerStub() = 0; + + virtual StatusOr + UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) = 0; + + virtual StatusOr + GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) = 0; +}; + +class DefaultQuotaAdjusterSettingsManagerStub + : public QuotaAdjusterSettingsManagerStub { + public: + explicit DefaultQuotaAdjusterSettingsManagerStub( + std::unique_ptr + grpc_stub) + : grpc_stub_(std::move(grpc_stub)) {} + + StatusOr + UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) override; + + StatusOr + GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) override; + + private: + std::unique_ptr< + google::api::cloudquotas::v1::QuotaAdjusterSettingsManager::StubInterface> + grpc_stub_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_STUB_H diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub_factory.cc b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub_factory.cc new file mode 100644 index 0000000000000..84bffd71732dc --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub_factory.cc @@ -0,0 +1,79 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub_factory.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_auth_decorator.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_logging_decorator.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_metadata_decorator.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_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 "google/api/cloudquotas/v1/quota_adjuster_settings.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr +CreateDefaultQuotaAdjusterSettingsManagerStub( + std::shared_ptr auth, + Options const& options) { + auto channel = auth->CreateChannel(options.get(), + internal::MakeChannelArguments(options)); + auto service_grpc_stub = + google::api::cloudquotas::v1::QuotaAdjusterSettingsManager::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 = MakeQuotaAdjusterSettingsManagerTracingStub(std::move(stub)); + } + return stub; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub_factory.h b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub_factory.h new file mode 100644 index 0000000000000..037ecdf5ad75b --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub_factory.h @@ -0,0 +1,48 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_STUB_FACTORY_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_STUB_FACTORY_H + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h" +#include "google/cloud/internal/unified_grpc_credentials.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr +CreateDefaultQuotaAdjusterSettingsManagerStub( + std::shared_ptr auth, + Options const& options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_STUB_FACTORY_H diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_connection.cc b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_connection.cc new file mode 100644 index 0000000000000..e1f63b95cfe83 --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_connection.cc @@ -0,0 +1,71 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_connection.h" +#include "google/cloud/internal/opentelemetry.h" +#include +#include + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +QuotaAdjusterSettingsManagerTracingConnection:: + QuotaAdjusterSettingsManagerTracingConnection( + std::shared_ptr + child) + : child_(std::move(child)) {} + +StatusOr +QuotaAdjusterSettingsManagerTracingConnection::UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) { + auto span = internal::MakeSpan( + "cloudquotas_v1::QuotaAdjusterSettingsManagerConnection::" + "UpdateQuotaAdjusterSettings"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->UpdateQuotaAdjusterSettings(request)); +} + +StatusOr +QuotaAdjusterSettingsManagerTracingConnection::GetQuotaAdjusterSettings( + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) { + auto span = internal::MakeSpan( + "cloudquotas_v1::QuotaAdjusterSettingsManagerConnection::" + "GetQuotaAdjusterSettings"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetQuotaAdjusterSettings(request)); +} + +std::shared_ptr +MakeQuotaAdjusterSettingsManagerTracingConnection( + std::shared_ptr + conn) { + if (internal::TracingEnabled(conn->options())) { + conn = std::make_shared( + std::move(conn)); + } + return conn; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_connection.h b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_connection.h new file mode 100644 index 0000000000000..239e534c2c303 --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_connection.h @@ -0,0 +1,73 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_TRACING_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_TRACING_CONNECTION_H + +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class QuotaAdjusterSettingsManagerTracingConnection + : public cloudquotas_v1::QuotaAdjusterSettingsManagerConnection { + public: + ~QuotaAdjusterSettingsManagerTracingConnection() override = default; + + explicit QuotaAdjusterSettingsManagerTracingConnection( + std::shared_ptr + child); + + Options options() override { return child_->options(); } + + StatusOr + UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) override; + + StatusOr + GetQuotaAdjusterSettings( + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) override; + + private: + std::shared_ptr + child_; +}; + +/** + * Conditionally applies the tracing decorator to the given connection. + * + * The connection is only decorated if tracing is enabled (as determined by the + * connection's options). + */ +std::shared_ptr +MakeQuotaAdjusterSettingsManagerTracingConnection( + std::shared_ptr + conn); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_TRACING_CONNECTION_H diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_stub.cc b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_stub.cc new file mode 100644 index 0000000000000..fc267f05cfb43 --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_stub.cc @@ -0,0 +1,79 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_stub.h" +#include "google/cloud/internal/grpc_opentelemetry.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +QuotaAdjusterSettingsManagerTracingStub:: + QuotaAdjusterSettingsManagerTracingStub( + std::shared_ptr child) + : child_(std::move(child)), propagator_(internal::MakePropagator()) {} + +StatusOr +QuotaAdjusterSettingsManagerTracingStub::UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.api.cloudquotas.v1.QuotaAdjusterSettingsManager", + "UpdateQuotaAdjusterSettings"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, + child_->UpdateQuotaAdjusterSettings(context, options, request)); +} + +StatusOr +QuotaAdjusterSettingsManagerTracingStub::GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.api.cloudquotas.v1.QuotaAdjusterSettingsManager", + "GetQuotaAdjusterSettings"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, + child_->GetQuotaAdjusterSettings(context, options, request)); +} + +std::shared_ptr +MakeQuotaAdjusterSettingsManagerTracingStub( + std::shared_ptr stub) { + return std::make_shared( + std::move(stub)); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_stub.h b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_stub.h new file mode 100644 index 0000000000000..5d5188aa7738c --- /dev/null +++ b/google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_stub.h @@ -0,0 +1,79 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_TRACING_STUB_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_TRACING_STUB_H + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub.h" +#include "google/cloud/internal/trace_propagator.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace cloudquotas_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class QuotaAdjusterSettingsManagerTracingStub + : public QuotaAdjusterSettingsManagerStub { + public: + ~QuotaAdjusterSettingsManagerTracingStub() override = default; + + explicit QuotaAdjusterSettingsManagerTracingStub( + std::shared_ptr child); + + StatusOr + UpdateQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request) override; + + StatusOr + GetQuotaAdjusterSettings( + grpc::ClientContext& context, Options const& options, + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request) override; + + private: + std::shared_ptr child_; + std::shared_ptr + propagator_; +}; + +/** + * Applies the tracing decorator to the given stub. + * + * The stub is only decorated if the library has been compiled with + * OpenTelemetry. + */ +std::shared_ptr +MakeQuotaAdjusterSettingsManagerTracingStub( + std::shared_ptr stub); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_INTERNAL_QUOTA_ADJUSTER_SETTINGS_MANAGER_TRACING_STUB_H diff --git a/google/cloud/cloudquotas/v1/mocks/mock_quota_adjuster_settings_manager_connection.h b/google/cloud/cloudquotas/v1/mocks/mock_quota_adjuster_settings_manager_connection.h new file mode 100644 index 0000000000000..d362f24463d05 --- /dev/null +++ b/google/cloud/cloudquotas/v1/mocks/mock_quota_adjuster_settings_manager_connection.h @@ -0,0 +1,70 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_MOCKS_MOCK_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_MOCKS_MOCK_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_H + +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.h" +#include + +namespace google { +namespace cloud { +namespace cloudquotas_v1_mocks { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * A class to mock `QuotaAdjusterSettingsManagerConnection`. + * + * Application developers may want to test their code with simulated responses, + * including errors, from an object of type + * `QuotaAdjusterSettingsManagerClient`. To do so, construct an object of type + * `QuotaAdjusterSettingsManagerClient` 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 MockQuotaAdjusterSettingsManagerConnection + : public cloudquotas_v1::QuotaAdjusterSettingsManagerConnection { + public: + MOCK_METHOD(Options, options, (), (override)); + + MOCK_METHOD( + StatusOr, + UpdateQuotaAdjusterSettings, + (google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request), + (override)); + + MOCK_METHOD( + StatusOr, + GetQuotaAdjusterSettings, + (google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request), + (override)); +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1_mocks +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_MOCKS_MOCK_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_H diff --git a/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_client.cc b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_client.cc new file mode 100644 index 0000000000000..b945a28bffcaa --- /dev/null +++ b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_client.cc @@ -0,0 +1,79 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_client.h" +#include +#include + +namespace google { +namespace cloud { +namespace cloudquotas_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +QuotaAdjusterSettingsManagerClient::QuotaAdjusterSettingsManagerClient( + std::shared_ptr connection, + Options opts) + : connection_(std::move(connection)), + options_( + internal::MergeOptions(std::move(opts), connection_->options())) {} +QuotaAdjusterSettingsManagerClient::~QuotaAdjusterSettingsManagerClient() = + default; + +StatusOr +QuotaAdjusterSettingsManagerClient::UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::QuotaAdjusterSettings const& + quota_adjuster_settings, + google::protobuf::FieldMask const& update_mask, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest request; + *request.mutable_quota_adjuster_settings() = quota_adjuster_settings; + *request.mutable_update_mask() = update_mask; + return connection_->UpdateQuotaAdjusterSettings(request); +} + +StatusOr +QuotaAdjusterSettingsManagerClient::UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->UpdateQuotaAdjusterSettings(request); +} + +StatusOr +QuotaAdjusterSettingsManagerClient::GetQuotaAdjusterSettings( + std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest request; + request.set_name(name); + return connection_->GetQuotaAdjusterSettings(request); +} + +StatusOr +QuotaAdjusterSettingsManagerClient::GetQuotaAdjusterSettings( + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetQuotaAdjusterSettings(request); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_client.h b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_client.h new file mode 100644 index 0000000000000..ed1eed9f93aa7 --- /dev/null +++ b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_client.h @@ -0,0 +1,229 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_CLIENT_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_CLIENT_H + +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_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 cloudquotas_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// +/// The Quotas Adjuster Settings API is an infrastructure service for Google +/// Cloud that lets service consumers view and update their quota adjuster +/// settings. +/// +/// - Update quota adjuster settings. +/// - Get the name of the configurations. +/// +/// @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 QuotaAdjusterSettingsManagerClient { + public: + explicit QuotaAdjusterSettingsManagerClient( + std::shared_ptr connection, + Options opts = {}); + ~QuotaAdjusterSettingsManagerClient(); + + ///@{ + /// @name Copy and move support + QuotaAdjusterSettingsManagerClient( + QuotaAdjusterSettingsManagerClient const&) = default; + QuotaAdjusterSettingsManagerClient& operator=( + QuotaAdjusterSettingsManagerClient const&) = default; + QuotaAdjusterSettingsManagerClient(QuotaAdjusterSettingsManagerClient&&) = + default; + QuotaAdjusterSettingsManagerClient& operator=( + QuotaAdjusterSettingsManagerClient&&) = default; + ///@} + + ///@{ + /// @name Equality + friend bool operator==(QuotaAdjusterSettingsManagerClient const& a, + QuotaAdjusterSettingsManagerClient const& b) { + return a.connection_ == b.connection_; + } + friend bool operator!=(QuotaAdjusterSettingsManagerClient const& a, + QuotaAdjusterSettingsManagerClient const& b) { + return !(a == b); + } + ///@} + + // clang-format off + /// + /// Updates the QuotaAdjusterSettings for the specified resource. + /// + /// @param quota_adjuster_settings Required. The QuotaAdjusterSettings to update. + /// @param update_mask Optional. The list of fields to update. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.api.cloudquotas.v1.QuotaAdjusterSettings]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.api.cloudquotas.v1.QuotaAdjusterSettings]: @googleapis_reference_link{google/api/cloudquotas/v1/quota_adjuster_settings.proto#L111} + /// [google.api.cloudquotas.v1.UpdateQuotaAdjusterSettingsRequest]: @googleapis_reference_link{google/api/cloudquotas/v1/quota_adjuster_settings.proto#L94} + /// + // clang-format on + StatusOr + UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::QuotaAdjusterSettings const& + quota_adjuster_settings, + google::protobuf::FieldMask const& update_mask, Options opts = {}); + + // clang-format off + /// + /// Updates the QuotaAdjusterSettings for the specified resource. + /// + /// @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.api.cloudquotas.v1.UpdateQuotaAdjusterSettingsRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.api.cloudquotas.v1.QuotaAdjusterSettings]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.api.cloudquotas.v1.QuotaAdjusterSettings]: @googleapis_reference_link{google/api/cloudquotas/v1/quota_adjuster_settings.proto#L111} + /// [google.api.cloudquotas.v1.UpdateQuotaAdjusterSettingsRequest]: @googleapis_reference_link{google/api/cloudquotas/v1/quota_adjuster_settings.proto#L94} + /// + // clang-format on + StatusOr + UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request, + Options opts = {}); + + // clang-format off + /// + /// Gets the QuotaAdjusterSettings for the specified resource. + /// + /// @param name Required. Identifier. Name of the `quotaAdjusterSettings` configuration. + /// Only a single setting per project is supported. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.api.cloudquotas.v1.QuotaAdjusterSettings]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.api.cloudquotas.v1.GetQuotaAdjusterSettingsRequest]: @googleapis_reference_link{google/api/cloudquotas/v1/quota_adjuster_settings.proto#L81} + /// [google.api.cloudquotas.v1.QuotaAdjusterSettings]: @googleapis_reference_link{google/api/cloudquotas/v1/quota_adjuster_settings.proto#L111} + /// + // clang-format on + StatusOr + GetQuotaAdjusterSettings(std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Gets the QuotaAdjusterSettings for the specified resource. + /// + /// @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.api.cloudquotas.v1.GetQuotaAdjusterSettingsRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.api.cloudquotas.v1.QuotaAdjusterSettings]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.api.cloudquotas.v1.GetQuotaAdjusterSettingsRequest]: @googleapis_reference_link{google/api/cloudquotas/v1/quota_adjuster_settings.proto#L81} + /// [google.api.cloudquotas.v1.QuotaAdjusterSettings]: @googleapis_reference_link{google/api/cloudquotas/v1/quota_adjuster_settings.proto#L111} + /// + // clang-format on + StatusOr + GetQuotaAdjusterSettings( + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request, + Options opts = {}); + + private: + std::shared_ptr connection_; + Options options_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_CLIENT_H diff --git a/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.cc b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.cc new file mode 100644 index 0000000000000..76c28153c32f8 --- /dev/null +++ b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.cc @@ -0,0 +1,76 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_connection_impl.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_option_defaults.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_stub_factory.h" +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_tracing_connection.h" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_options.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 cloudquotas_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +QuotaAdjusterSettingsManagerConnection:: + ~QuotaAdjusterSettingsManagerConnection() = default; + +StatusOr +QuotaAdjusterSettingsManagerConnection::UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr +QuotaAdjusterSettingsManagerConnection::GetQuotaAdjusterSettings( + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +std::shared_ptr +MakeQuotaAdjusterSettingsManagerConnection(Options options) { + internal::CheckExpectedOptions( + options, __func__); + options = cloudquotas_v1_internal::QuotaAdjusterSettingsManagerDefaultOptions( + std::move(options)); + auto background = internal::MakeBackgroundThreadsFactory(options)(); + auto auth = internal::CreateAuthenticationStrategy(background->cq(), options); + auto stub = + cloudquotas_v1_internal::CreateDefaultQuotaAdjusterSettingsManagerStub( + std::move(auth), options); + return cloudquotas_v1_internal:: + MakeQuotaAdjusterSettingsManagerTracingConnection( + std::make_shared( + std::move(background), std::move(stub), std::move(options))); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.h b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.h new file mode 100644 index 0000000000000..3576e76dbc36d --- /dev/null +++ b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.h @@ -0,0 +1,244 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_H + +#include "google/cloud/cloudquotas/v1/internal/quota_adjuster_settings_manager_retry_traits.h" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.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 "google/api/cloudquotas/v1/quota_adjuster_settings.pb.h" +#include + +namespace google { +namespace cloud { +namespace cloudquotas_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// The retry policy for `QuotaAdjusterSettingsManagerConnection`. +class QuotaAdjusterSettingsManagerRetryPolicy + : 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 `QuotaAdjusterSettingsManagerConnection` 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 QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy + : public QuotaAdjusterSettingsManagerRetryPolicy { + 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 QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy( + int maximum_failures) + : impl_(maximum_failures) {} + + QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy( + QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy&& rhs) noexcept + : QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy( + rhs.maximum_failures()) {} + QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy( + QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy const& + rhs) noexcept + : QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy( + 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< + QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy>( + maximum_failures()); + } + + // This is provided only for backwards compatibility. + using BaseType = QuotaAdjusterSettingsManagerRetryPolicy; + + private: + google::cloud::internal::LimitedErrorCountRetryPolicy< + cloudquotas_v1_internal::QuotaAdjusterSettingsManagerRetryTraits> + impl_; +}; + +/** + * A retry policy for `QuotaAdjusterSettingsManagerConnection` 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 QuotaAdjusterSettingsManagerLimitedTimeRetryPolicy + : public QuotaAdjusterSettingsManagerRetryPolicy { + 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 QuotaAdjusterSettingsManagerLimitedTimeRetryPolicy( + std::chrono::duration maximum_duration) + : impl_(maximum_duration) {} + + QuotaAdjusterSettingsManagerLimitedTimeRetryPolicy( + QuotaAdjusterSettingsManagerLimitedTimeRetryPolicy&& rhs) noexcept + : QuotaAdjusterSettingsManagerLimitedTimeRetryPolicy( + rhs.maximum_duration()) {} + QuotaAdjusterSettingsManagerLimitedTimeRetryPolicy( + QuotaAdjusterSettingsManagerLimitedTimeRetryPolicy const& rhs) noexcept + : QuotaAdjusterSettingsManagerLimitedTimeRetryPolicy( + 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 = QuotaAdjusterSettingsManagerRetryPolicy; + + private: + google::cloud::internal::LimitedTimeRetryPolicy< + cloudquotas_v1_internal::QuotaAdjusterSettingsManagerRetryTraits> + impl_; +}; + +/** + * The `QuotaAdjusterSettingsManagerConnection` object for + * `QuotaAdjusterSettingsManagerClient`. + * + * This interface defines virtual methods for each of the user-facing overload + * sets in `QuotaAdjusterSettingsManagerClient`. This allows users to inject + * custom behavior (e.g., with a Google Mock object) when writing tests that use + * objects of type `QuotaAdjusterSettingsManagerClient`. + * + * To create a concrete instance, see + * `MakeQuotaAdjusterSettingsManagerConnection()`. + * + * For mocking, see + * `cloudquotas_v1_mocks::MockQuotaAdjusterSettingsManagerConnection`. + */ +class QuotaAdjusterSettingsManagerConnection { + public: + virtual ~QuotaAdjusterSettingsManagerConnection() = 0; + + virtual Options options() { return Options{}; } + + virtual StatusOr + UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request); + + virtual StatusOr + GetQuotaAdjusterSettings( + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request); +}; + +/** + * A factory function to construct an object of type + * `QuotaAdjusterSettingsManagerConnection`. + * + * The returned connection object should not be used directly; instead it + * should be passed as an argument to the constructor of + * QuotaAdjusterSettingsManagerClient. + * + * The optional @p options argument may be used to configure aspects of the + * returned `QuotaAdjusterSettingsManagerConnection`. Expected options are any + * of the types in the following option lists: + * + * - `google::cloud::CommonOptionList` + * - `google::cloud::GrpcOptionList` + * - `google::cloud::UnifiedCredentialsOptionList` + * - + * `google::cloud::cloudquotas_v1::QuotaAdjusterSettingsManagerPolicyOptionList` + * + * @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 + * `QuotaAdjusterSettingsManagerConnection` created by this function. + */ +std::shared_ptr +MakeQuotaAdjusterSettingsManagerConnection(Options options = {}); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_H diff --git a/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.cc b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.cc new file mode 100644 index 0000000000000..d1c08419ca857 --- /dev/null +++ b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.cc @@ -0,0 +1,59 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.h" +#include + +namespace google { +namespace cloud { +namespace cloudquotas_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +using ::google::cloud::Idempotency; + +QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy:: + ~QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy() = default; + +std::unique_ptr +QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy::clone() const { + return std::make_unique< + QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy>(*this); +} + +Idempotency QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy:: + UpdateQuotaAdjusterSettings(google::api::cloudquotas::v1:: + UpdateQuotaAdjusterSettingsRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy:: + GetQuotaAdjusterSettings( + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const&) { + return Idempotency::kIdempotent; +} + +std::unique_ptr +MakeDefaultQuotaAdjusterSettingsManagerConnectionIdempotencyPolicy() { + return std::make_unique< + QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy>(); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.h b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.h new file mode 100644 index 0000000000000..5f2b98953916d --- /dev/null +++ b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.h @@ -0,0 +1,58 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_IDEMPOTENCY_POLICY_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_IDEMPOTENCY_POLICY_H + +#include "google/cloud/idempotency.h" +#include "google/cloud/version.h" +#include "google/api/cloudquotas/v1/quota_adjuster_settings.grpc.pb.h" +#include + +namespace google { +namespace cloud { +namespace cloudquotas_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy { + public: + virtual ~QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy(); + + /// Create a new copy of this object. + virtual std::unique_ptr< + QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy> + clone() const; + + virtual google::cloud::Idempotency UpdateQuotaAdjusterSettings( + google::api::cloudquotas::v1::UpdateQuotaAdjusterSettingsRequest const& + request); + + virtual google::cloud::Idempotency GetQuotaAdjusterSettings( + google::api::cloudquotas::v1::GetQuotaAdjusterSettingsRequest const& + request); +}; + +std::unique_ptr +MakeDefaultQuotaAdjusterSettingsManagerConnectionIdempotencyPolicy(); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_CONNECTION_IDEMPOTENCY_POLICY_H diff --git a/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_options.h b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_options.h new file mode 100644 index 0000000000000..14bc82166dd45 --- /dev/null +++ b/google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_options.h @@ -0,0 +1,77 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_OPTIONS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_OPTIONS_H + +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection.h" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_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 cloudquotas_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * Use with `google::cloud::Options` to configure the retry policy. + * + * @ingroup google-cloud-cloudquotas-options + */ +struct QuotaAdjusterSettingsManagerRetryPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure the backoff policy. + * + * @ingroup google-cloud-cloudquotas-options + */ +struct QuotaAdjusterSettingsManagerBackoffPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure which operations are retried. + * + * @ingroup google-cloud-cloudquotas-options + */ +struct QuotaAdjusterSettingsManagerConnectionIdempotencyPolicyOption { + using Type = + std::shared_ptr; +}; + +/** + * The options applicable to QuotaAdjusterSettingsManager. + * + * @ingroup google-cloud-cloudquotas-options + */ +using QuotaAdjusterSettingsManagerPolicyOptionList = + OptionList; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace cloudquotas_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_CLOUDQUOTAS_V1_QUOTA_ADJUSTER_SETTINGS_MANAGER_OPTIONS_H diff --git a/google/cloud/cloudquotas/v1/samples/quota_adjuster_settings_manager_client_samples.cc b/google/cloud/cloudquotas/v1/samples/quota_adjuster_settings_manager_client_samples.cc new file mode 100644 index 0000000000000..787e5895d40db --- /dev/null +++ b/google/cloud/cloudquotas/v1/samples/quota_adjuster_settings_manager_client_samples.cc @@ -0,0 +1,194 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/api/cloudquotas/v1/quota_adjuster_settings.proto + +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_client.h" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_connection_idempotency_policy.h" +#include "google/cloud/cloudquotas/v1/quota_adjuster_settings_manager_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 "google/cloud/universe_domain.h" +#include +#include +#include +#include + +// clang-format off +// main-dox-marker: cloudquotas_v1::QuotaAdjusterSettingsManagerClient +// clang-format on +namespace { + +void SetClientEndpoint(std::vector const& argv) { + if (!argv.empty()) { + throw google::cloud::testing_util::Usage{"set-client-endpoint"}; + } + //! [set-client-endpoint] + // This configuration is common with Private Google Access: + // https://cloud.google.com/vpc/docs/private-google-access + auto options = google::cloud::Options{}.set( + "private.googleapis.com"); + auto vpc_client = + google::cloud::cloudquotas_v1::QuotaAdjusterSettingsManagerClient( + google::cloud::cloudquotas_v1:: + MakeQuotaAdjusterSettingsManagerConnection(options)); + //! [set-client-endpoint] +} + +void SetClientUniverseDomain(std::vector const& argv) { + if (!argv.empty()) { + throw google::cloud::testing_util::Usage{"set-client-universe-domain"}; + } + //! [set-client-universe-domain] + google::cloud::Options options; + + // AddUniverseDomainOption interrogates the UnifiedCredentialsOption, if set, + // in the provided Options for the Universe Domain associated with the + // credentials and adds it to the set of Options. + // If no UnifiedCredentialsOption is set, GoogleDefaultCredentials are used. + auto ud_options = google::cloud::AddUniverseDomainOption(std::move(options)); + + if (!ud_options.ok()) throw std::move(ud_options).status(); + auto ud_client = + google::cloud::cloudquotas_v1::QuotaAdjusterSettingsManagerClient( + google::cloud::cloudquotas_v1:: + MakeQuotaAdjusterSettingsManagerConnection(*ud_options)); + //! [set-client-universe-domain] +} + +//! [custom-idempotency-policy] +class CustomIdempotencyPolicy + : public google::cloud::cloudquotas_v1:: + QuotaAdjusterSettingsManagerConnectionIdempotencyPolicy { + 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< + google::cloud::cloudquotas_v1:: + QuotaAdjusterSettingsManagerConnectionIdempotencyPolicyOption>( + CustomIdempotencyPolicy().clone()) + .set( + google::cloud::cloudquotas_v1:: + QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy(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::cloudquotas_v1::MakeQuotaAdjusterSettingsManagerConnection( + options); + + // c1 and c2 share the same retry policies + auto c1 = google::cloud::cloudquotas_v1::QuotaAdjusterSettingsManagerClient( + connection); + auto c2 = google::cloud::cloudquotas_v1::QuotaAdjusterSettingsManagerClient( + 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::cloudquotas_v1::QuotaAdjusterSettingsManagerClient( + connection, + google::cloud::Options{} + .set( + google::cloud::cloudquotas_v1:: + QuotaAdjusterSettingsManagerLimitedTimeRetryPolicy( + std::chrono::minutes(5)) + .clone())); + + // You can also override the policies in a single call: + // c3.SomeRpc(..., google::cloud::Options{} + // .set( + // google::cloud::cloudquotas_v1::QuotaAdjusterSettingsManagerLimitedErrorCountRetryPolicy(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::cloudquotas_v1::QuotaAdjusterSettingsManagerClient( + google::cloud::cloudquotas_v1:: + MakeQuotaAdjusterSettingsManagerConnection(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}); + + std::cout << "\nRunning SetClientUniverseDomain() example" << std::endl; + SetClientUniverseDomain({}); +} + +} // namespace + +int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape) + google::cloud::testing_util::Example example({ + {"set-client-endpoint", SetClientEndpoint}, + {"set-retry-policy", SetRetryPolicy}, + {"with-service-account", WithServiceAccount}, + {"set-client-universe-domain", SetClientUniverseDomain}, + {"auto", AutoRun}, + }); + return example.Run(argc, argv); +}