diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 07af8d1ddd91..b3c95fae4fda 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -207,6 +207,8 @@ "google-cloud-cloud_quotas+FILLER": "0.0.0", "google-cloud-cloud_quotas-v1": "1.2.0", "google-cloud-cloud_quotas-v1+FILLER": "0.0.0", + "google-cloud-cloud_quotas-v1beta": "0.0.1", + "google-cloud-cloud_quotas-v1beta+FILLER": "0.0.0", "google-cloud-commerce-consumer-procurement": "1.1.0", "google-cloud-commerce-consumer-procurement+FILLER": "0.0.0", "google-cloud-commerce-consumer-procurement-v1": "1.2.0", diff --git a/google-cloud-cloud_quotas-v1beta/.OwlBot.yaml b/google-cloud-cloud_quotas-v1beta/.OwlBot.yaml new file mode 100644 index 000000000000..4df06601d709 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/.OwlBot.yaml @@ -0,0 +1,3 @@ +deep-copy-regex: + - source: /google/api/cloudquotas/v1beta/[^/]+-ruby/(.*) + dest: /owl-bot-staging/google-cloud-cloud_quotas-v1beta/$1 diff --git a/google-cloud-cloud_quotas-v1beta/.gitignore b/google-cloud-cloud_quotas-v1beta/.gitignore new file mode 100644 index 000000000000..0135b6bc6cfc --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/.gitignore @@ -0,0 +1,22 @@ +# Ignore bundler lockfiles +Gemfile.lock +gems.locked + +# Ignore documentation output +doc/* +.yardoc/* + +# Ignore test output +coverage/* + +# Ignore build artifacts +pkg/* + +# Ignore files commonly present in certain dev environments +.vagrant +.DS_STORE +.idea +*.iml + +# Ignore synth output +__pycache__ diff --git a/google-cloud-cloud_quotas-v1beta/.owlbot-manifest.json b/google-cloud-cloud_quotas-v1beta/.owlbot-manifest.json new file mode 100644 index 000000000000..6b2621a391ff --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/.owlbot-manifest.json @@ -0,0 +1,72 @@ +{ + "generated": [ + ".gitignore", + ".repo-metadata.json", + ".rubocop.yml", + ".toys.rb", + ".yardopts", + "AUTHENTICATION.md", + "CHANGELOG.md", + "Gemfile", + "LICENSE.md", + "README.md", + "Rakefile", + "gapic_metadata.json", + "google-cloud-cloud_quotas-v1beta.gemspec", + "lib/google-cloud-cloud_quotas-v1beta.rb", + "lib/google/api/cloudquotas/v1beta/cloudquotas_pb.rb", + "lib/google/api/cloudquotas/v1beta/cloudquotas_services_pb.rb", + "lib/google/api/cloudquotas/v1beta/quota_adjuster_settings_pb.rb", + "lib/google/api/cloudquotas/v1beta/quota_adjuster_settings_services_pb.rb", + "lib/google/api/cloudquotas/v1beta/resources_pb.rb", + "lib/google/cloud/cloud_quotas/v1beta.rb", + "lib/google/cloud/cloud_quotas/v1beta/cloud_quotas.rb", + "lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/client.rb", + "lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/credentials.rb", + "lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/paths.rb", + "lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest.rb", + "lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/client.rb", + "lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/service_stub.rb", + "lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager.rb", + "lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/client.rb", + "lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/credentials.rb", + "lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/paths.rb", + "lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest.rb", + "lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/client.rb", + "lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/service_stub.rb", + "lib/google/cloud/cloud_quotas/v1beta/rest.rb", + "lib/google/cloud/cloud_quotas/v1beta/version.rb", + "proto_docs/README.md", + "proto_docs/google/api/client.rb", + "proto_docs/google/api/cloudquotas/v1beta/cloudquotas.rb", + "proto_docs/google/api/cloudquotas/v1beta/quota_adjuster_settings.rb", + "proto_docs/google/api/cloudquotas/v1beta/resources.rb", + "proto_docs/google/api/field_behavior.rb", + "proto_docs/google/api/launch_stage.rb", + "proto_docs/google/api/resource.rb", + "proto_docs/google/protobuf/duration.rb", + "proto_docs/google/protobuf/field_mask.rb", + "proto_docs/google/protobuf/timestamp.rb", + "proto_docs/google/protobuf/wrappers.rb", + "snippets/Gemfile", + "snippets/cloud_quotas/create_quota_preference.rb", + "snippets/cloud_quotas/get_quota_info.rb", + "snippets/cloud_quotas/get_quota_preference.rb", + "snippets/cloud_quotas/list_quota_infos.rb", + "snippets/cloud_quotas/list_quota_preferences.rb", + "snippets/cloud_quotas/update_quota_preference.rb", + "snippets/quota_adjuster_settings_manager/get_quota_adjuster_settings.rb", + "snippets/quota_adjuster_settings_manager/update_quota_adjuster_settings.rb", + "snippets/snippet_metadata_google.api.cloudquotas.v1beta.json", + "test/google/cloud/cloud_quotas/v1beta/cloud_quotas_paths_test.rb", + "test/google/cloud/cloud_quotas/v1beta/cloud_quotas_rest_test.rb", + "test/google/cloud/cloud_quotas/v1beta/cloud_quotas_test.rb", + "test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_paths_test.rb", + "test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_rest_test.rb", + "test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_test.rb", + "test/helper.rb" + ], + "static": [ + ".OwlBot.yaml" + ] +} diff --git a/google-cloud-cloud_quotas-v1beta/.repo-metadata.json b/google-cloud-cloud_quotas-v1beta/.repo-metadata.json new file mode 100644 index 000000000000..dd68ac9240ee --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/.repo-metadata.json @@ -0,0 +1,17 @@ +{ + "api_id": "cloudquotas.googleapis.com", + "api_shortname": "cloudquotas", + "client_documentation": "https://cloud.google.com/ruby/docs/reference/google-cloud-cloud_quotas-v1beta/latest", + "distribution_name": "google-cloud-cloud_quotas-v1beta", + "is_cloud": true, + "language": "ruby", + "name": "cloudquotas", + "name_pretty": "Cloud Quotas V1BETA API", + "product_documentation": "https://cloud.google.com/docs/quotas/api-overview", + "release_level": "unreleased", + "repo": "googleapis/google-cloud-ruby", + "requires_billing": true, + "ruby-cloud-description": "Cloud Quotas API provides Google Cloud service consumers with management and observability for resource usage, quotas, and restrictions of the services they consume. Note that google-cloud-cloud_quotas-v1beta is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-cloud_quotas instead. See the readme for more details.", + "ruby-cloud-product-url": "https://cloud.google.com/docs/quotas/api-overview", + "library_type": "GAPIC_AUTO" +} diff --git a/google-cloud-cloud_quotas-v1beta/.rubocop.yml b/google-cloud-cloud_quotas-v1beta/.rubocop.yml new file mode 100644 index 000000000000..8266dcd55168 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/.rubocop.yml @@ -0,0 +1,33 @@ +inherit_gem: + google-style: google-style.yml + +AllCops: + Exclude: + - "google-cloud-cloud_quotas-v1beta.gemspec" + - "lib/**/*_pb.rb" + - "proto_docs/**/*" + - "test/**/*" + - "acceptance/**/*" + - "samples/acceptance/**/*" + - "Rakefile" + +Layout/LineLength: + Enabled: false +Metrics/AbcSize: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/ModuleLength: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false +Naming/AccessorMethodName: + Exclude: + - "snippets/**/*.rb" +Naming/FileName: + Exclude: + - "lib/google-cloud-cloud_quotas-v1beta.rb" diff --git a/google-cloud-cloud_quotas-v1beta/.toys.rb b/google-cloud-cloud_quotas-v1beta/.toys.rb new file mode 100644 index 000000000000..9a210f1427c7 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +toys_version! ">= 0.15.3" + +if ENV["RUBY_COMMON_TOOLS"] + common_tools_dir = File.expand_path ENV["RUBY_COMMON_TOOLS"] + load File.join(common_tools_dir, "toys", "gapic") +else + load_git remote: "https://github.com/googleapis/ruby-common-tools.git", + path: "toys/gapic", + update: true +end diff --git a/google-cloud-cloud_quotas-v1beta/.yardopts b/google-cloud-cloud_quotas-v1beta/.yardopts new file mode 100644 index 000000000000..206507c8f6c5 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/.yardopts @@ -0,0 +1,12 @@ +--no-private +--title="Cloud Quotas V1BETA API" +--exclude _pb\.rb$ +--markup markdown +--markup-provider redcarpet + +./lib/**/*.rb +./proto_docs/**/*.rb +- +README.md +LICENSE.md +AUTHENTICATION.md diff --git a/google-cloud-cloud_quotas-v1beta/AUTHENTICATION.md b/google-cloud-cloud_quotas-v1beta/AUTHENTICATION.md new file mode 100644 index 000000000000..9660d67ef0a3 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/AUTHENTICATION.md @@ -0,0 +1,122 @@ +# Authentication + +The recommended way to authenticate to the google-cloud-cloud_quotas-v1beta library is to use +[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials). +To review all of your authentication options, see [Credentials lookup](#credential-lookup). + +## Quickstart + +The following example shows how to set up authentication for a local development +environment with your user credentials. + +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. + +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: + +```sh +gcloud auth application-default login +``` + +3. Write code as if already authenticated. + +For more information about setting up authentication for a local development environment, see +[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev). + +## Credential Lookup + +The google-cloud-cloud_quotas-v1beta library provides several mechanisms to configure your system. +Generally, using Application Default Credentials to facilitate automatic +credentials discovery is the easist method. But if you need to explicitly specify +credentials, there are several methods available to you. + +Credentials are accepted in the following ways, in the following order or precedence: + +1. Credentials specified in method arguments +2. Credentials specified in configuration +3. Credentials pointed to or included in environment variables +4. Credentials found in local ADC file +5. Credentials returned by the metadata server for the attached service account (GCP) + +### Configuration + +You can configure a path to a JSON credentials file, either for an individual client object or +globally, for all client objects. The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +To configure a credentials file for an individual client initialization: + +```ruby +require "google/cloud/cloud_quotas/v1beta" + +client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = "path/to/credentialfile.json" +end +``` + +To configure a credentials file globally for all clients: + +```ruby +require "google/cloud/cloud_quotas/v1beta" + +::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.configure do |config| + config.credentials = "path/to/credentialfile.json" +end + +client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new +``` + +### Environment Variables + +You can also use an environment variable to provide a JSON credentials file. +The environment variable can contain a path to the credentials file or, for +environments such as Docker containers where writing files is not encouraged, +you can include the credentials file itself. + +The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +The environment variables that google-cloud-cloud_quotas-v1beta +checks for credentials are: + +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file + +```ruby +require "google/cloud/cloud_quotas/v1beta" + +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" + +client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new +``` + +### Local ADC file + +You can set up a local ADC file with your user credentials for authentication during +development. If credentials are not provided in code or in environment variables, +then the local ADC credentials are discovered. + +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. + +### Google Cloud Platform environments + +When running on Google Cloud Platform (GCP), including Google Compute Engine +(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud +Functions (GCF) and Cloud Run, credentials are retrieved from the attached +service account automatically. Code should be written as if already authenticated. + +For more information, see +[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa). diff --git a/google-cloud-cloud_quotas-v1beta/CHANGELOG.md b/google-cloud-cloud_quotas-v1beta/CHANGELOG.md new file mode 100644 index 000000000000..f88957a62ba2 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/CHANGELOG.md @@ -0,0 +1,2 @@ +# Release History + diff --git a/google-cloud-cloud_quotas-v1beta/Gemfile b/google-cloud-cloud_quotas-v1beta/Gemfile new file mode 100644 index 000000000000..95163a6d11f8 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/Gemfile @@ -0,0 +1,11 @@ +source "https://rubygems.org" + +gemspec + +gem "google-style", "~> 1.27.1" +gem "minitest", "~> 5.22" +gem "minitest-focus", "~> 1.4" +gem "minitest-rg", "~> 5.3" +gem "rake", ">= 13.0" +gem "redcarpet", "~> 3.6" +gem "yard", "~> 0.9" diff --git a/google-cloud-cloud_quotas-v1beta/LICENSE.md b/google-cloud-cloud_quotas-v1beta/LICENSE.md new file mode 100644 index 000000000000..c261857ba6ad --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + http://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. diff --git a/google-cloud-cloud_quotas-v1beta/README.md b/google-cloud-cloud_quotas-v1beta/README.md new file mode 100644 index 000000000000..738265d75c46 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/README.md @@ -0,0 +1,154 @@ +# Ruby Client for the Cloud Quotas V1BETA API + +Cloud Quotas API provides Google Cloud service consumers with management and observability for resource usage, quotas, and restrictions of the services they consume. + +Cloud Quotas API provides Google Cloud service consumers with management and observability for resource usage, quotas, and restrictions of the services they consume. + +https://github.com/googleapis/google-cloud-ruby + +This gem is a _versioned_ client. It provides basic client classes for a +specific version of the Cloud Quotas V1BETA API. Most users should consider using +the main client gem, +[google-cloud-cloud_quotas](https://rubygems.org/gems/google-cloud-cloud_quotas). +See the section below titled *Which client should I use?* for more information. + +## Installation + +``` +$ gem install google-cloud-cloud_quotas-v1beta +``` + +## Before You Begin + +In order to use this library, you first need to go through the following steps: + +1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project) +1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project) +1. [Enable the API.](https://console.cloud.google.com/apis/library/cloudquotas.googleapis.com) +1. [Set up authentication.](AUTHENTICATION.md) + +## Quick Start + +```ruby +require "google/cloud/cloud_quotas/v1beta" + +client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new +request = ::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest.new # (request fields as keyword arguments...) +response = client.list_quota_infos request +``` + +View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-cloud_quotas-v1beta/latest) +for class and method documentation. + +See also the [Product Documentation](https://cloud.google.com/docs/quotas/api-overview) +for general usage information. + +## Debug Logging + +This library comes with opt-in Debug Logging that can help you troubleshoot +your application's integration with the API. When logging is activated, key +events such as requests and responses, along with data payloads and metadata +such as headers and client configuration, are logged to the standard error +stream. + +**WARNING:** Client Library Debug Logging includes your data payloads in +plaintext, which could include sensitive data such as PII for yourself or your +customers, private keys, or other security data that could be compromising if +leaked. Always practice good data hygiene with your application logs, and follow +the principle of least access. Google also recommends that Client Library Debug +Logging be enabled only temporarily during active debugging, and not used +permanently in production. + +To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS` +to the value `all`. Alternatively, you can set the value to a comma-delimited +list of client library gem names. This will select the default logging behavior, +which writes logs to the standard error stream. On a local workstation, this may +result in logs appearing on the console. When running on a Google Cloud hosting +service such as [Google Cloud Run](https://cloud.google.com/run), this generally +results in logs appearing alongside your application logs in the +[Google Cloud Logging](https://cloud.google.com/logging/) service. + +You can customize logging by modifying the `logger` configuration when +constructing a client object. For example: + +```ruby +require "google/cloud/cloud_quotas/v1beta" +require "logger" + +client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.logger = Logger.new "my-app.log" +end +``` + +## Google Cloud Samples + +To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples). + +## Supported Ruby Versions + +This library is supported on Ruby 2.7+. + +Google provides official support for Ruby versions that are actively supported +by Ruby Core—that is, Ruby versions that are either in normal maintenance or +in security maintenance, and not end of life. Older versions of Ruby _may_ +still work, but are unsupported and not recommended. See +https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby +support schedule. + +## Which client should I use? + +Most modern Ruby client libraries for Google APIs come in two flavors: the main +client library with a name such as `google-cloud-cloud_quotas`, +and lower-level _versioned_ client libraries with names such as +`google-cloud-cloud_quotas-v1beta`. +_In most cases, you should install the main client._ + +### What's the difference between the main client and a versioned client? + +A _versioned client_ provides a basic set of data types and client classes for +a _single version_ of a specific service. (That is, for a service with multiple +versions, there might be a separate versioned client for each service version.) +Most versioned clients are written and maintained by a code generator. + +The _main client_ is designed to provide you with the _recommended_ client +interfaces for the service. There will be only one main client for any given +service, even a service with multiple versions. The main client includes +factory methods for constructing the client objects we recommend for most +users. In some cases, those will be classes provided by an underlying versioned +client; in other cases, they will be handwritten higher-level client objects +with additional capabilities, convenience methods, or best practices built in. +Generally, the main client will default to a recommended service version, +although in some cases you can override this if you need to talk to a specific +service version. + +### Why would I want to use the main client? + +We recommend that most users install the main client gem for a service. You can +identify this gem as the one _without_ a version in its name, e.g. +`google-cloud-cloud_quotas`. +The main client is recommended because it will embody the best practices for +accessing the service, and may also provide more convenient interfaces or +tighter integration into frameworks and third-party libraries. In addition, the +documentation and samples published by Google will generally demonstrate use of +the main client. + +### Why would I want to use a versioned client? + +You can use a versioned client if you are content with a possibly lower-level +class interface, you explicitly want to avoid features provided by the main +client, or you want to access a specific service version not be covered by the +main client. You can identify versioned client gems because the service version +is part of the name, e.g. `google-cloud-cloud_quotas-v1beta`. + +### What about the google-apis- clients? + +Client library gems with names that begin with `google-apis-` are based on an +older code generation technology. They talk to a REST/JSON backend (whereas +most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may +not offer the same performance, features, and ease of use provided by more +modern clients. + +The `google-apis-` clients have wide coverage across Google services, so you +might need to use one if there is no modern client available for the service. +However, if a modern client is available, we generally recommend it over the +older `google-apis-` clients. diff --git a/google-cloud-cloud_quotas-v1beta/Rakefile b/google-cloud-cloud_quotas-v1beta/Rakefile new file mode 100644 index 000000000000..8a22f2bdf9df --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/Rakefile @@ -0,0 +1,169 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "bundler/setup" +require "bundler/gem_tasks" + +require "rubocop/rake_task" +RuboCop::RakeTask.new + +require "rake/testtask" +desc "Run tests." +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList["test/**/*_test.rb"] + t.warning = false +end + +desc "Runs the smoke tests." +Rake::TestTask.new :smoke_test do |t| + t.test_files = FileList["acceptance/**/*smoke_test.rb"] + t.warning = false +end + +# Acceptance tests +desc "Run the google-cloud-cloud_quotas-v1beta acceptance tests." +task :acceptance, :project, :keyfile do |t, args| + project = args[:project] + project ||= + ENV["GOOGLE_CLOUD_TEST_PROJECT"] || + ENV["GCLOUD_TEST_PROJECT"] + keyfile = args[:keyfile] + keyfile ||= + ENV["GOOGLE_CLOUD_TEST_KEYFILE"] || + ENV["GCLOUD_TEST_KEYFILE"] + if keyfile + keyfile = File.read keyfile + else + keyfile ||= + ENV["GOOGLE_CLOUD_TEST_KEYFILE_JSON"] || + ENV["GCLOUD_TEST_KEYFILE_JSON"] + end + if project.nil? || keyfile.nil? + fail "You must provide a project and keyfile. e.g. rake acceptance[test123, /path/to/keyfile.json] or GOOGLE_CLOUD_TEST_PROJECT=test123 GOOGLE_CLOUD_TEST_KEYFILE=/path/to/keyfile.json rake acceptance" + end + require "google/cloud/cloud_quotas/v1beta/cloud_quotas/credentials" + ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Credentials.env_vars.each do |path| + ENV[path] = nil + end + ENV["GOOGLE_CLOUD_PROJECT"] = project + ENV["GOOGLE_CLOUD_TEST_PROJECT"] = project + ENV["GOOGLE_CLOUD_KEYFILE_JSON"] = keyfile + + Rake::Task["acceptance:run"].invoke +end + +namespace :acceptance do + task :run do + if File.directory? "acceptance" + Rake::Task[:smoke_test].invoke + else + puts "The google-cloud-cloud_quotas-v1beta gem has no acceptance tests." + end + end + + desc "Run acceptance cleanup." + task :cleanup do + end +end + +task :samples do + Rake::Task["samples:latest"].invoke +end + +namespace :samples do + task :latest do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "not_master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-cloud-cloud_quotas-v1beta gem has no samples to test." + end + end + + task :master do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-cloud-cloud_quotas-v1beta gem has no samples to test." + end + end +end + +require "yard" +require "yard/rake/yardoc_task" +YARD::Rake::YardocTask.new do |y| + y.options << "--fail-on-warning" +end + +desc "Run yard-doctest example tests." +task :doctest do + puts "The google-cloud-cloud_quotas-v1beta gem does not have doctest tests." +end + +desc "Run the CI build" +task :ci do + header "BUILDING google-cloud-cloud_quotas-v1beta" + header "google-cloud-cloud_quotas-v1beta rubocop", "*" + Rake::Task[:rubocop].invoke + header "google-cloud-cloud_quotas-v1beta yard", "*" + Rake::Task[:yard].invoke + header "google-cloud-cloud_quotas-v1beta test", "*" + Rake::Task[:test].invoke +end + +namespace :ci do + desc "Run the CI build, with smoke tests." + task :smoke_test do + Rake::Task[:ci].invoke + header "google-cloud-cloud_quotas-v1beta smoke_test", "*" + Rake::Task[:smoke_test].invoke + end + desc "Run the CI build, with acceptance tests." + task :acceptance do + Rake::Task[:ci].invoke + header "google-cloud-cloud_quotas-v1beta acceptance", "*" + Rake::Task[:acceptance].invoke + end + task :a do + # This is a handy shortcut to save typing + Rake::Task["ci:acceptance"].invoke + end +end + +task default: :test + +def header str, token = "#" + line_length = str.length + 8 + puts "" + puts token * line_length + puts "#{token * 3} #{str} #{token * 3}" + puts token * line_length + puts "" +end diff --git a/google-cloud-cloud_quotas-v1beta/gapic_metadata.json b/google-cloud-cloud_quotas-v1beta/gapic_metadata.json new file mode 100644 index 000000000000..b1ac56526834 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/gapic_metadata.json @@ -0,0 +1,67 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "ruby", + "protoPackage": "google.api.cloudquotas.v1beta", + "libraryPackage": "::Google::Cloud::CloudQuotas::V1beta", + "services": { + "CloudQuotas": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client", + "rpcs": { + "ListQuotaInfos": { + "methods": [ + "list_quota_infos" + ] + }, + "GetQuotaInfo": { + "methods": [ + "get_quota_info" + ] + }, + "ListQuotaPreferences": { + "methods": [ + "list_quota_preferences" + ] + }, + "GetQuotaPreference": { + "methods": [ + "get_quota_preference" + ] + }, + "CreateQuotaPreference": { + "methods": [ + "create_quota_preference" + ] + }, + "UpdateQuotaPreference": { + "methods": [ + "update_quota_preference" + ] + } + } + } + } + }, + "QuotaAdjusterSettingsManager": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client", + "rpcs": { + "UpdateQuotaAdjusterSettings": { + "methods": [ + "update_quota_adjuster_settings" + ] + }, + "GetQuotaAdjusterSettings": { + "methods": [ + "get_quota_adjuster_settings" + ] + } + } + } + } + } + } +} diff --git a/google-cloud-cloud_quotas-v1beta/google-cloud-cloud_quotas-v1beta.gemspec b/google-cloud-cloud_quotas-v1beta/google-cloud-cloud_quotas-v1beta.gemspec new file mode 100644 index 000000000000..f251dca42815 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/google-cloud-cloud_quotas-v1beta.gemspec @@ -0,0 +1,28 @@ +# -*- ruby -*- +# encoding: utf-8 + +require File.expand_path("lib/google/cloud/cloud_quotas/v1beta/version", __dir__) + +Gem::Specification.new do |gem| + gem.name = "google-cloud-cloud_quotas-v1beta" + gem.version = Google::Cloud::CloudQuotas::V1beta::VERSION + + gem.authors = ["Google LLC"] + gem.email = "googleapis-packages@google.com" + gem.description = "Cloud Quotas API provides Google Cloud service consumers with management and observability for resource usage, quotas, and restrictions of the services they consume. Note that google-cloud-cloud_quotas-v1beta is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-cloud_quotas instead. See the readme for more details." + gem.summary = "Cloud Quotas API provides Google Cloud service consumers with management and observability for resource usage, quotas, and restrictions of the services they consume." + gem.homepage = "https://github.com/googleapis/google-cloud-ruby" + gem.license = "Apache-2.0" + + gem.platform = Gem::Platform::RUBY + + gem.files = `git ls-files -- lib/*`.split("\n") + + `git ls-files -- proto_docs/*`.split("\n") + + ["README.md", "LICENSE.md", "AUTHENTICATION.md", ".yardopts"] + gem.require_paths = ["lib"] + + gem.required_ruby_version = ">= 2.7" + + gem.add_dependency "gapic-common", ">= 0.24.0", "< 2.a" + gem.add_dependency "google-cloud-errors", "~> 1.0" +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google-cloud-cloud_quotas-v1beta.rb b/google-cloud-cloud_quotas-v1beta/lib/google-cloud-cloud_quotas-v1beta.rb new file mode 100644 index 000000000000..011c7e36494a --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google-cloud-cloud_quotas-v1beta.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# This gem does not autoload during Bundler.require. To load this gem, +# issue explicit require statements for the packages desired, e.g.: +# require "google/cloud/cloud_quotas/v1beta" diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/api/cloudquotas/v1beta/cloudquotas_pb.rb b/google-cloud-cloud_quotas-v1beta/lib/google/api/cloudquotas/v1beta/cloudquotas_pb.rb new file mode 100644 index 000000000000..dc2cd3f44c92 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/api/cloudquotas/v1beta/cloudquotas_pb.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/api/cloudquotas/v1beta/cloudquotas.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/cloudquotas/v1beta/resources_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/protobuf/field_mask_pb' + + +descriptor_data = "\n/google/api/cloudquotas/v1beta/cloudquotas.proto\x12\x1dgoogle.api.cloudquotas.v1beta\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a-google/api/cloudquotas/v1beta/resources.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a google/protobuf/field_mask.proto\"\x86\x01\n\x15ListQuotaInfosRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\x12$cloudquotas.googleapis.com/QuotaInfo\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"p\n\x16ListQuotaInfosResponse\x12=\n\x0bquota_infos\x18\x01 \x03(\x0b\x32(.google.api.cloudquotas.v1beta.QuotaInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"Q\n\x13GetQuotaInfoRequest\x12:\n\x04name\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$cloudquotas.googleapis.com/QuotaInfo\"\xbe\x01\n\x1bListQuotaPreferencesRequest\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\x12*cloudquotas.googleapis.com/QuotaPreference\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x05 \x01(\tB\x03\xe0\x41\x01\"\x97\x01\n\x1cListQuotaPreferencesResponse\x12I\n\x11quota_preferences\x18\x01 \x03(\x0b\x32..google.api.cloudquotas.v1beta.QuotaPreference\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x13\n\x0bunreachable\x18\x03 \x03(\t\"]\n\x19GetQuotaPreferenceRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*cloudquotas.googleapis.com/QuotaPreference\"\xa2\x02\n\x1c\x43reateQuotaPreferenceRequest\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\x12*cloudquotas.googleapis.com/QuotaPreference\x12 \n\x13quota_preference_id\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12M\n\x10quota_preference\x18\x03 \x01(\x0b\x32..google.api.cloudquotas.v1beta.QuotaPreferenceB\x03\xe0\x41\x02\x12M\n\x14ignore_safety_checks\x18\x04 \x03(\x0e\x32/.google.api.cloudquotas.v1beta.QuotaSafetyCheck\"\xaa\x02\n\x1cUpdateQuotaPreferenceRequest\x12\x34\n\x0bupdate_mask\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\x12M\n\x10quota_preference\x18\x02 \x01(\x0b\x32..google.api.cloudquotas.v1beta.QuotaPreferenceB\x03\xe0\x41\x02\x12\x1a\n\rallow_missing\x18\x03 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1a\n\rvalidate_only\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x12M\n\x14ignore_safety_checks\x18\x05 \x03(\x0e\x32/.google.api.cloudquotas.v1beta.QuotaSafetyCheck2\xb1\x12\n\x0b\x43loudQuotas\x12\xd5\x02\n\x0eListQuotaInfos\x12\x34.google.api.cloudquotas.v1beta.ListQuotaInfosRequest\x1a\x35.google.api.cloudquotas.v1beta.ListQuotaInfosResponse\"\xd5\x01\xda\x41\x06parent\x82\xd3\xe4\x93\x02\xc5\x01\x12=/v1beta/{parent=projects/*/locations/*/services/*}/quotaInfosZD\x12\x42/v1beta/{parent=organizations/*/locations/*/services/*}/quotaInfosZ>\x12\x12.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest\x1a\x34.google.api.cloudquotas.v1beta.QuotaAdjusterSettings\"J\xda\x41\x04name\x82\xd3\xe4\x93\x02=\x12;/v1beta/{name=projects/*/locations/*/quotaAdjusterSettings}\x1aN\xca\x41\x1a\x63loudquotas.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xf1\x01\n!com.google.api.cloudquotas.v1betaB\x1aQuotaAdjusterSettingsProtoP\x01ZEcloud.google.com/go/cloudquotas/apiv1beta/cloudquotaspb;cloudquotaspb\xaa\x02\x1fGoogle.Cloud.CloudQuotas.V1Beta\xca\x02\x1fGoogle\\Cloud\\CloudQuotas\\V1beta\xea\x02\"Google::Cloud::CloudQuotas::V1betab\x06proto3" + +pool = Google::Protobuf::DescriptorPool.generated_pool + +begin + pool.add_serialized_file(descriptor_data) +rescue TypeError + # Compatibility code: will be removed in the next major version. + require 'google/protobuf/descriptor_pb' + parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) + parsed.clear_dependency + serialized = parsed.class.encode(parsed) + file = pool.add_serialized_file(serialized) + warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" + imports = [ + ["google.protobuf.FieldMask", "google/protobuf/field_mask.proto"], + ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"], + ] + imports.each do |type_name, expected_filename| + import_file = pool.lookup(type_name).file_descriptor + if import_file.name != expected_filename + warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" + end + end + warn "Each proto file must use a consistent fully-qualified name." + warn "This will become an error in the next major version." +end + +module Google + module Cloud + module CloudQuotas + module V1beta + GetQuotaAdjusterSettingsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest").msgclass + UpdateQuotaAdjusterSettingsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest").msgclass + QuotaAdjusterSettings = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaAdjusterSettings").msgclass + QuotaAdjusterSettings::Enablement = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaAdjusterSettings.Enablement").enummodule + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/api/cloudquotas/v1beta/quota_adjuster_settings_services_pb.rb b/google-cloud-cloud_quotas-v1beta/lib/google/api/cloudquotas/v1beta/quota_adjuster_settings_services_pb.rb new file mode 100644 index 000000000000..7fb9dc2449a4 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/api/cloudquotas/v1beta/quota_adjuster_settings_services_pb.rb @@ -0,0 +1,52 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/api/cloudquotas/v1beta/quota_adjuster_settings.proto for package 'Google.Cloud.CloudQuotas.V1beta' +# Original file comments: +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://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. +# + +require 'grpc' +require 'google/api/cloudquotas/v1beta/quota_adjuster_settings_pb' + +module Google + module Cloud + module CloudQuotas + module V1beta + module QuotaAdjusterSettingsManager + # 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. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager' + + # RPC Method for updating QuotaAdjusterSettings based on the request + rpc :UpdateQuotaAdjusterSettings, ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest, ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings + # RPC Method for getting QuotaAdjusterSettings based on the request + rpc :GetQuotaAdjusterSettings, ::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest, ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/api/cloudquotas/v1beta/resources_pb.rb b/google-cloud-cloud_quotas-v1beta/lib/google/api/cloudquotas/v1beta/resources_pb.rb new file mode 100644 index 000000000000..7a1abc5ffa5f --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/api/cloudquotas/v1beta/resources_pb.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/api/cloudquotas/v1beta/resources.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/protobuf/timestamp_pb' +require 'google/protobuf/wrappers_pb' + + +descriptor_data = "\n-google/api/cloudquotas/v1beta/resources.proto\x12\x1dgoogle.api.cloudquotas.v1beta\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xab\x07\n\tQuotaInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x10\n\x08quota_id\x18\x02 \x01(\t\x12\x0e\n\x06metric\x18\x03 \x01(\t\x12\x0f\n\x07service\x18\x04 \x01(\t\x12\x12\n\nis_precise\x18\x05 \x01(\x08\x12\x18\n\x10refresh_interval\x18\x06 \x01(\t\x12N\n\x0e\x63ontainer_type\x18\x07 \x01(\x0e\x32\x36.google.api.cloudquotas.v1beta.QuotaInfo.ContainerType\x12\x12\n\ndimensions\x18\x08 \x03(\t\x12\x1b\n\x13metric_display_name\x18\t \x01(\t\x12\x1a\n\x12quota_display_name\x18\n \x01(\t\x12\x13\n\x0bmetric_unit\x18\x0b \x01(\t\x12[\n\x1aquota_increase_eligibility\x18\x0c \x01(\x0b\x32\x37.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility\x12\x10\n\x08is_fixed\x18\r \x01(\x08\x12G\n\x10\x64imensions_infos\x18\x0e \x03(\x0b\x32-.google.api.cloudquotas.v1beta.DimensionsInfo\x12\x15\n\ris_concurrent\x18\x0f \x01(\x08\x12!\n\x19service_request_quota_uri\x18\x11 \x01(\t\"Z\n\rContainerType\x12\x1e\n\x1a\x43ONTAINER_TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07PROJECT\x10\x01\x12\n\n\x06\x46OLDER\x10\x02\x12\x10\n\x0cORGANIZATION\x10\x03:\xae\x02\xea\x41\xaa\x02\n$cloudquotas.googleapis.com/QuotaInfo\x12Rprojects/{project}/locations/{location}/services/{service}/quotaInfos/{quota_info}\x12Pfolders/{folder}/locations/{location}/services/{service}/quotaInfos/{quota_info}\x12\\organizations/{organization}/locations/{location}/services/{service}/quotaInfos/{quota_info}\"\xb2\x02\n\x18QuotaIncreaseEligibility\x12\x13\n\x0bis_eligible\x18\x01 \x01(\x08\x12i\n\x14ineligibility_reason\x18\x02 \x01(\x0e\x32K.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason\"\x95\x01\n\x13IneligibilityReason\x12$\n INELIGIBILITY_REASON_UNSPECIFIED\x10\x00\x12\x1c\n\x18NO_VALID_BILLING_ACCOUNT\x10\x01\x12\x11\n\rNOT_SUPPORTED\x10\x03\x12\x1c\n\x18NOT_ENOUGH_USAGE_HISTORY\x10\x04\x12\t\n\x05OTHER\x10\x02\"\x8d\x06\n\x0fQuotaPreference\x12\x0c\n\x04name\x18\x01 \x01(\t\x12W\n\ndimensions\x18\x02 \x03(\x0b\x32>.google.api.cloudquotas.v1beta.QuotaPreference.DimensionsEntryB\x03\xe0\x41\x05\x12\x45\n\x0cquota_config\x18\x03 \x01(\x0b\x32*.google.api.cloudquotas.v1beta.QuotaConfigB\x03\xe0\x41\x02\x12\x11\n\x04\x65tag\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x34\n\x0b\x63reate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x14\n\x07service\x18\x07 \x01(\tB\x03\xe0\x41\x02\x12\x15\n\x08quota_id\x18\x08 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x0breconciling\x18\n \x01(\x08\x42\x03\xe0\x41\x03\x12\x15\n\rjustification\x18\x0b \x01(\t\x12\x1a\n\rcontact_email\x18\x0c \x01(\tB\x03\xe0\x41\x04\x1a\x31\n\x0f\x44imensionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01:\x9f\x02\xea\x41\x9b\x02\n*cloudquotas.googleapis.com/QuotaPreference\x12Kprojects/{project}/locations/{location}/quotaPreferences/{quota_preference}\x12Ifolders/{folder}/locations/{location}/quotaPreferences/{quota_preference}\x12Uorganizations/{organization}/locations/{location}/quotaPreferences/{quota_preference}\"\xb9\x03\n\x0bQuotaConfig\x12\x1c\n\x0fpreferred_value\x18\x01 \x01(\x03\x42\x03\xe0\x41\x02\x12\x19\n\x0cstate_detail\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12\x37\n\rgranted_value\x18\x03 \x01(\x0b\x32\x1b.google.protobuf.Int64ValueB\x03\xe0\x41\x03\x12\x15\n\x08trace_id\x18\x04 \x01(\tB\x03\xe0\x41\x03\x12U\n\x0b\x61nnotations\x18\x05 \x03(\x0b\x32;.google.api.cloudquotas.v1beta.QuotaConfig.AnnotationsEntryB\x03\xe0\x41\x01\x12N\n\x0erequest_origin\x18\x06 \x01(\x0e\x32\x31.google.api.cloudquotas.v1beta.QuotaConfig.OriginB\x03\xe0\x41\x03\x1a\x32\n\x10\x41nnotationsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"F\n\x06Origin\x12\x16\n\x12ORIGIN_UNSPECIFIED\x10\x00\x12\x11\n\rCLOUD_CONSOLE\x10\x01\x12\x11\n\rAUTO_ADJUSTER\x10\x02\"\xf2\x01\n\x0e\x44imensionsInfo\x12Q\n\ndimensions\x18\x01 \x03(\x0b\x32=.google.api.cloudquotas.v1beta.DimensionsInfo.DimensionsEntry\x12<\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32+.google.api.cloudquotas.v1beta.QuotaDetails\x12\x1c\n\x14\x61pplicable_locations\x18\x03 \x03(\t\x1a\x31\n\x0f\x44imensionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"_\n\x0cQuotaDetails\x12\r\n\x05value\x18\x01 \x01(\x03\x12@\n\x0crollout_info\x18\x03 \x01(\x0b\x32*.google.api.cloudquotas.v1beta.RolloutInfo\"&\n\x0bRolloutInfo\x12\x17\n\x0fongoing_rollout\x18\x01 \x01(\x08*~\n\x10QuotaSafetyCheck\x12\"\n\x1eQUOTA_SAFETY_CHECK_UNSPECIFIED\x10\x00\x12\x1e\n\x1aQUOTA_DECREASE_BELOW_USAGE\x10\x01\x12&\n\"QUOTA_DECREASE_PERCENTAGE_TOO_HIGH\x10\x02\x42\xe5\x01\n!com.google.api.cloudquotas.v1betaB\x0eResourcesProtoP\x01ZEcloud.google.com/go/cloudquotas/apiv1beta/cloudquotaspb;cloudquotaspb\xaa\x02\x1fGoogle.Cloud.CloudQuotas.V1Beta\xca\x02\x1fGoogle\\Cloud\\CloudQuotas\\V1beta\xea\x02\"Google::Cloud::CloudQuotas::V1betab\x06proto3" + +pool = Google::Protobuf::DescriptorPool.generated_pool + +begin + pool.add_serialized_file(descriptor_data) +rescue TypeError + # Compatibility code: will be removed in the next major version. + require 'google/protobuf/descriptor_pb' + parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) + parsed.clear_dependency + serialized = parsed.class.encode(parsed) + file = pool.add_serialized_file(serialized) + warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" + imports = [ + ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"], + ["google.protobuf.Int64Value", "google/protobuf/wrappers.proto"], + ] + imports.each do |type_name, expected_filename| + import_file = pool.lookup(type_name).file_descriptor + if import_file.name != expected_filename + warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" + end + end + warn "Each proto file must use a consistent fully-qualified name." + warn "This will become an error in the next major version." +end + +module Google + module Cloud + module CloudQuotas + module V1beta + QuotaInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaInfo").msgclass + QuotaInfo::ContainerType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaInfo.ContainerType").enummodule + QuotaIncreaseEligibility = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaIncreaseEligibility").msgclass + QuotaIncreaseEligibility::IneligibilityReason = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason").enummodule + QuotaPreference = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaPreference").msgclass + QuotaConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaConfig").msgclass + QuotaConfig::Origin = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaConfig.Origin").enummodule + DimensionsInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.DimensionsInfo").msgclass + QuotaDetails = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaDetails").msgclass + RolloutInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.RolloutInfo").msgclass + QuotaSafetyCheck = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.api.cloudquotas.v1beta.QuotaSafetyCheck").enummodule + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta.rb new file mode 100644 index 000000000000..4eb0169971eb --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/cloud_quotas/v1beta/cloud_quotas" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager" +require "google/cloud/cloud_quotas/v1beta/version" + +module Google + module Cloud + module CloudQuotas + ## + # API client module. + # + # @example Load this package, including all its services, and instantiate a gRPC client + # + # require "google/cloud/cloud_quotas/v1beta" + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + # + # @example Load this package, including all its services, and instantiate a REST client + # + # require "google/cloud/cloud_quotas/v1beta" + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + module V1beta + end + end + end +end + +helper_path = ::File.join __dir__, "v1beta", "_helpers.rb" +require "google/cloud/cloud_quotas/v1beta/_helpers" if ::File.file? helper_path diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas.rb new file mode 100644 index 000000000000..d03fc30533a6 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/cloud_quotas/v1beta/version" + +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/credentials" +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/paths" +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/client" +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/rest" + +module Google + module Cloud + module CloudQuotas + module V1beta + ## + # The Cloud Quotas API is an infrastructure service for Google Cloud that lets + # service consumers list and manage their resource usage limits. + # + # - List/Get the metadata and current status of the quotas for a service. + # - Create/Update quota preferencess that declare the preferred quota values. + # - Check the status of a quota preference request. + # - List/Get pending and historical quota preference. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/cloud_quotas/v1beta/cloud_quotas" + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/cloud_quotas/v1beta/cloud_quotas/rest" + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + module CloudQuotas + end + end + end + end +end + +helper_path = ::File.join __dir__, "cloud_quotas", "helpers.rb" +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/helpers" if ::File.file? helper_path diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/client.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/client.rb new file mode 100644 index 000000000000..02bfde1517a2 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/client.rb @@ -0,0 +1,1030 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/api/cloudquotas/v1beta/cloudquotas_pb" + +module Google + module Cloud + module CloudQuotas + module V1beta + module CloudQuotas + ## + # Client for the CloudQuotas service. + # + # The Cloud Quotas API is an infrastructure service for Google Cloud that lets + # service consumers list and manage their resource usage limits. + # + # - List/Get the metadata and current status of the quotas for a service. + # - Create/Update quota preferencess that declare the preferred quota values. + # - Check the status of a quota preference request. + # - List/Get pending and historical quota preference. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudquotas.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :cloud_quotas_stub + + ## + # Configure the CloudQuotas Client class. + # + # See {::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all CloudQuotas clients + # ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "CloudQuotas", "V1beta"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.list_quota_infos.timeout = 60.0 + default_config.rpcs.list_quota_infos.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_quota_info.timeout = 60.0 + default_config.rpcs.get_quota_info.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_quota_preferences.timeout = 60.0 + default_config.rpcs.list_quota_preferences.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_quota_preference.timeout = 60.0 + default_config.rpcs.get_quota_preference.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_quota_preference.timeout = 60.0 + default_config.rpcs.create_quota_preference.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_quota_preference.timeout = 60.0 + default_config.rpcs.update_quota_preference.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the CloudQuotas Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_quotas_stub.universe_domain + end + + ## + # Create a new CloudQuotas client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the CloudQuotas client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/api/cloudquotas/v1beta/cloudquotas_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @cloud_quotas_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @cloud_quotas_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @cloud_quotas_stub.logger + end + + # Service calls + + ## + # Lists QuotaInfos of all quotas for a given project, folder or organization. + # + # @overload list_quota_infos(request, options = nil) + # Pass arguments to `list_quota_infos` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_quota_infos(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_quota_infos` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Parent value of QuotaInfo resources. + # Listing across different resource containers (such as 'projects/-') is not + # allowed. + # + # Example names: + # `projects/123/locations/global/services/compute.googleapis.com` + # `folders/234/locations/global/services/compute.googleapis.com` + # `organizations/345/locations/global/services/compute.googleapis.com` + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::CloudQuotas::V1beta::QuotaInfo>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::CloudQuotas::V1beta::QuotaInfo>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest.new + # + # # Call the list_quota_infos method. + # result = client.list_quota_infos request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::CloudQuotas::V1beta::QuotaInfo. + # p item + # end + # + def list_quota_infos request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_quota_infos.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_quota_infos.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_quota_infos.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.call_rpc :list_quota_infos, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @cloud_quotas_stub, :list_quota_infos, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieve the QuotaInfo of a quota for a project, folder or organization. + # + # @overload get_quota_info(request, options = nil) + # Pass arguments to `get_quota_info` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_quota_info(name: nil) + # Pass arguments to `get_quota_info` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the quota info. + # + # An example name: + # `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::CloudQuotas::V1beta::QuotaInfo] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaInfo] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest.new + # + # # Call the get_quota_info method. + # result = client.get_quota_info request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaInfo. + # p result + # + def get_quota_info request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_quota_info.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_quota_info.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_quota_info.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.call_rpc :get_quota_info, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists QuotaPreferences in a given project, folder or organization. + # + # @overload list_quota_preferences(request, options = nil) + # Pass arguments to `list_quota_preferences` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_quota_preferences(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_quota_preferences` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Parent value of QuotaPreference resources. + # Listing across different resource containers (such as 'projects/-') is not + # allowed. + # + # When the value starts with 'folders' or 'organizations', it lists the + # QuotaPreferences for org quotas in the container. It does not list the + # QuotaPreferences in the descendant projects of the container. + # + # Example parents: + # `projects/123/locations/global` + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filter result QuotaPreferences by their state, type, + # create/update time range. + # + # Example filters: + # `reconciling=true AND request_type=CLOUD_CONSOLE`, + # `reconciling=true OR creation_time>2022-12-03T10:30:00` + # @param order_by [::String] + # Optional. How to order of the results. By default, the results are ordered + # by create time. + # + # Example orders: + # `quota_id`, + # `service, create_time` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::CloudQuotas::V1beta::QuotaPreference>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::CloudQuotas::V1beta::QuotaPreference>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest.new + # + # # Call the list_quota_preferences method. + # result = client.list_quota_preferences request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + # p item + # end + # + def list_quota_preferences request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_quota_preferences.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_quota_preferences.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_quota_preferences.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.call_rpc :list_quota_preferences, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @cloud_quotas_stub, :list_quota_preferences, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets details of a single QuotaPreference. + # + # @overload get_quota_preference(request, options = nil) + # Pass arguments to `get_quota_preference` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_quota_preference(name: nil) + # Pass arguments to `get_quota_preference` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Name of the resource + # + # Example name: + # `projects/123/locations/global/quota_preferences/my-config-for-us-east1` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest.new + # + # # Call the get_quota_preference method. + # result = client.get_quota_preference request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + # p result + # + def get_quota_preference request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_quota_preference.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_quota_preference.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_quota_preference.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.call_rpc :get_quota_preference, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a new QuotaPreference that declares the desired value for a quota. + # + # @overload create_quota_preference(request, options = nil) + # Pass arguments to `create_quota_preference` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_quota_preference(parent: nil, quota_preference_id: nil, quota_preference: nil, ignore_safety_checks: nil) + # Pass arguments to `create_quota_preference` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Value for parent. + # + # Example: + # `projects/123/locations/global` + # @param quota_preference_id [::String] + # Optional. Id of the requesting object, must be unique under its parent. + # If client does not set this field, the service will generate one. + # @param quota_preference [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference, ::Hash] + # Required. The resource being created + # @param ignore_safety_checks [::Array<::Google::Cloud::CloudQuotas::V1beta::QuotaSafetyCheck>] + # The list of quota safety checks to be ignored. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest.new + # + # # Call the create_quota_preference method. + # result = client.create_quota_preference request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + # p result + # + def create_quota_preference request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_quota_preference.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_quota_preference.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_quota_preference.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.call_rpc :create_quota_preference, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates the parameters of a single QuotaPreference. It can updates the + # config in any states, not just the ones pending approval. + # + # @overload update_quota_preference(request, options = nil) + # Pass arguments to `update_quota_preference` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_quota_preference(update_mask: nil, quota_preference: nil, allow_missing: nil, validate_only: nil, ignore_safety_checks: nil) + # Pass arguments to `update_quota_preference` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. Field mask is used to specify the fields to be overwritten in the + # QuotaPreference resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. A field will be overwritten if it is in the mask. If the + # user does not provide a mask then all fields will be overwritten. + # @param quota_preference [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference, ::Hash] + # Required. The resource being updated + # @param allow_missing [::Boolean] + # Optional. If set to true, and the quota preference is not found, a new one + # will be created. In this situation, `update_mask` is ignored. + # @param validate_only [::Boolean] + # Optional. If set to true, validate the request, but do not actually update. + # Note that a request being valid does not mean that the request is + # guaranteed to be fulfilled. + # @param ignore_safety_checks [::Array<::Google::Cloud::CloudQuotas::V1beta::QuotaSafetyCheck>] + # The list of quota safety checks to be ignored. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest.new + # + # # Call the update_quota_preference method. + # result = client.update_quota_preference request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + # p result + # + def update_quota_preference request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_quota_preference.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.quota_preference&.name + header_params["quota_preference.name"] = request.quota_preference.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_quota_preference.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_quota_preference.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.call_rpc :update_quota_preference, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the CloudQuotas API. + # + # This class represents the configuration for CloudQuotas, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_quota_infos to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_quota_infos.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_quota_infos.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "cloudquotas.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the CloudQuotas API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_quota_infos` + # @return [::Gapic::Config::Method] + # + attr_reader :list_quota_infos + ## + # RPC-specific configuration for `get_quota_info` + # @return [::Gapic::Config::Method] + # + attr_reader :get_quota_info + ## + # RPC-specific configuration for `list_quota_preferences` + # @return [::Gapic::Config::Method] + # + attr_reader :list_quota_preferences + ## + # RPC-specific configuration for `get_quota_preference` + # @return [::Gapic::Config::Method] + # + attr_reader :get_quota_preference + ## + # RPC-specific configuration for `create_quota_preference` + # @return [::Gapic::Config::Method] + # + attr_reader :create_quota_preference + ## + # RPC-specific configuration for `update_quota_preference` + # @return [::Gapic::Config::Method] + # + attr_reader :update_quota_preference + + # @private + def initialize parent_rpcs = nil + list_quota_infos_config = parent_rpcs.list_quota_infos if parent_rpcs.respond_to? :list_quota_infos + @list_quota_infos = ::Gapic::Config::Method.new list_quota_infos_config + get_quota_info_config = parent_rpcs.get_quota_info if parent_rpcs.respond_to? :get_quota_info + @get_quota_info = ::Gapic::Config::Method.new get_quota_info_config + list_quota_preferences_config = parent_rpcs.list_quota_preferences if parent_rpcs.respond_to? :list_quota_preferences + @list_quota_preferences = ::Gapic::Config::Method.new list_quota_preferences_config + get_quota_preference_config = parent_rpcs.get_quota_preference if parent_rpcs.respond_to? :get_quota_preference + @get_quota_preference = ::Gapic::Config::Method.new get_quota_preference_config + create_quota_preference_config = parent_rpcs.create_quota_preference if parent_rpcs.respond_to? :create_quota_preference + @create_quota_preference = ::Gapic::Config::Method.new create_quota_preference_config + update_quota_preference_config = parent_rpcs.update_quota_preference if parent_rpcs.respond_to? :update_quota_preference + @update_quota_preference = ::Gapic::Config::Method.new update_quota_preference_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/credentials.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/credentials.rb new file mode 100644 index 000000000000..bf4145425483 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/credentials.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module CloudQuotas + module V1beta + module CloudQuotas + # Credentials for the CloudQuotas API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/paths.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/paths.rb new file mode 100644 index 000000000000..f4a2a68c52c6 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/paths.rb @@ -0,0 +1,265 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module CloudQuotas + module V1beta + module CloudQuotas + # Path helper methods for the CloudQuotas API. + module Paths + ## + # Create a fully-qualified Location resource string. + # + # @overload location_path(project:, location:) + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}` + # + # @param project [String] + # @param location [String] + # + # @overload location_path(folder:, location:) + # The resource will be in the following format: + # + # `folders/{folder}/locations/{location}` + # + # @param folder [String] + # @param location [String] + # + # @overload location_path(organization:, location:) + # The resource will be in the following format: + # + # `organizations/{organization}/locations/{location}` + # + # @param organization [String] + # @param location [String] + # + # @return [::String] + def location_path **args + resources = { + "location:project" => (proc do |project:, location:| + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + + "projects/#{project}/locations/#{location}" + end), + "folder:location" => (proc do |folder:, location:| + raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/" + + "folders/#{folder}/locations/#{location}" + end), + "location:organization" => (proc do |organization:, location:| + raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/" + + "organizations/#{organization}/locations/#{location}" + end) + } + + resource = resources[args.keys.sort.join(":")] + raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil? + resource.call(**args) + end + + ## + # Create a fully-qualified QuotaInfo resource string. + # + # @overload quota_info_path(project:, location:, service:, quota_info:) + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/services/{service}/quotaInfos/{quota_info}` + # + # @param project [String] + # @param location [String] + # @param service [String] + # @param quota_info [String] + # + # @overload quota_info_path(folder:, location:, service:, quota_info:) + # The resource will be in the following format: + # + # `folders/{folder}/locations/{location}/services/{service}/quotaInfos/{quota_info}` + # + # @param folder [String] + # @param location [String] + # @param service [String] + # @param quota_info [String] + # + # @overload quota_info_path(organization:, location:, service:, quota_info:) + # The resource will be in the following format: + # + # `organizations/{organization}/locations/{location}/services/{service}/quotaInfos/{quota_info}` + # + # @param organization [String] + # @param location [String] + # @param service [String] + # @param quota_info [String] + # + # @return [::String] + def quota_info_path **args + resources = { + "location:project:quota_info:service" => (proc do |project:, location:, service:, quota_info:| + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "service cannot contain /" if service.to_s.include? "/" + + "projects/#{project}/locations/#{location}/services/#{service}/quotaInfos/#{quota_info}" + end), + "folder:location:quota_info:service" => (proc do |folder:, location:, service:, quota_info:| + raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "service cannot contain /" if service.to_s.include? "/" + + "folders/#{folder}/locations/#{location}/services/#{service}/quotaInfos/#{quota_info}" + end), + "location:organization:quota_info:service" => (proc do |organization:, location:, service:, quota_info:| + raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "service cannot contain /" if service.to_s.include? "/" + + "organizations/#{organization}/locations/#{location}/services/#{service}/quotaInfos/#{quota_info}" + end) + } + + resource = resources[args.keys.sort.join(":")] + raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil? + resource.call(**args) + end + + ## + # Create a fully-qualified QuotaPreference resource string. + # + # @overload quota_preference_path(project:, location:, quota_preference:) + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/quotaPreferences/{quota_preference}` + # + # @param project [String] + # @param location [String] + # @param quota_preference [String] + # + # @overload quota_preference_path(folder:, location:, quota_preference:) + # The resource will be in the following format: + # + # `folders/{folder}/locations/{location}/quotaPreferences/{quota_preference}` + # + # @param folder [String] + # @param location [String] + # @param quota_preference [String] + # + # @overload quota_preference_path(organization:, location:, quota_preference:) + # The resource will be in the following format: + # + # `organizations/{organization}/locations/{location}/quotaPreferences/{quota_preference}` + # + # @param organization [String] + # @param location [String] + # @param quota_preference [String] + # + # @return [::String] + def quota_preference_path **args + resources = { + "location:project:quota_preference" => (proc do |project:, location:, quota_preference:| + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/quotaPreferences/#{quota_preference}" + end), + "folder:location:quota_preference" => (proc do |folder:, location:, quota_preference:| + raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "folders/#{folder}/locations/#{location}/quotaPreferences/#{quota_preference}" + end), + "location:organization:quota_preference" => (proc do |organization:, location:, quota_preference:| + raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "organizations/#{organization}/locations/#{location}/quotaPreferences/#{quota_preference}" + end) + } + + resource = resources[args.keys.sort.join(":")] + raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil? + resource.call(**args) + end + + ## + # Create a fully-qualified Service resource string. + # + # @overload service_path(project:, location:, service:) + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/services/{service}` + # + # @param project [String] + # @param location [String] + # @param service [String] + # + # @overload service_path(folder:, location:, service:) + # The resource will be in the following format: + # + # `folders/{folder}/locations/{location}/services/{service}` + # + # @param folder [String] + # @param location [String] + # @param service [String] + # + # @overload service_path(organization:, location:, service:) + # The resource will be in the following format: + # + # `organizations/{organization}/locations/{location}/services/{service}` + # + # @param organization [String] + # @param location [String] + # @param service [String] + # + # @return [::String] + def service_path **args + resources = { + "location:project:service" => (proc do |project:, location:, service:| + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/services/#{service}" + end), + "folder:location:service" => (proc do |folder:, location:, service:| + raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "folders/#{folder}/locations/#{location}/services/#{service}" + end), + "location:organization:service" => (proc do |organization:, location:, service:| + raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "organizations/#{organization}/locations/#{location}/services/#{service}" + end) + } + + resource = resources[args.keys.sort.join(":")] + raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil? + resource.call(**args) + end + + extend self + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest.rb new file mode 100644 index 000000000000..1d0f9b171c64 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/cloud_quotas/v1beta/version" + +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/credentials" +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/paths" +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/client" + +module Google + module Cloud + module CloudQuotas + module V1beta + ## + # The Cloud Quotas API is an infrastructure service for Google Cloud that lets + # service consumers list and manage their resource usage limits. + # + # - List/Get the metadata and current status of the quotas for a service. + # - Create/Update quota preferencess that declare the preferred quota values. + # - Check the status of a quota preference request. + # - List/Get pending and historical quota preference. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/cloud_quotas/v1beta/cloud_quotas/rest" + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + module CloudQuotas + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/client.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/client.rb new file mode 100644 index 000000000000..1481f3a24bba --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/client.rb @@ -0,0 +1,960 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/api/cloudquotas/v1beta/cloudquotas_pb" +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/service_stub" + +module Google + module Cloud + module CloudQuotas + module V1beta + module CloudQuotas + module Rest + ## + # REST client for the CloudQuotas service. + # + # The Cloud Quotas API is an infrastructure service for Google Cloud that lets + # service consumers list and manage their resource usage limits. + # + # - List/Get the metadata and current status of the quotas for a service. + # - Create/Update quota preferencess that declare the preferred quota values. + # - Check the status of a quota preference request. + # - List/Get pending and historical quota preference. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudquotas.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :cloud_quotas_stub + + ## + # Configure the CloudQuotas Client class. + # + # See {::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all CloudQuotas clients + # ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "CloudQuotas", "V1beta"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.list_quota_infos.timeout = 60.0 + default_config.rpcs.list_quota_infos.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_quota_info.timeout = 60.0 + default_config.rpcs.get_quota_info.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_quota_preferences.timeout = 60.0 + default_config.rpcs.list_quota_preferences.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_quota_preference.timeout = 60.0 + default_config.rpcs.get_quota_preference.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_quota_preference.timeout = 60.0 + default_config.rpcs.create_quota_preference.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_quota_preference.timeout = 60.0 + default_config.rpcs.update_quota_preference.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the CloudQuotas Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_quotas_stub.universe_domain + end + + ## + # Create a new CloudQuotas REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the CloudQuotas client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @cloud_quotas_stub = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @cloud_quotas_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @cloud_quotas_stub.logger + end + + # Service calls + + ## + # Lists QuotaInfos of all quotas for a given project, folder or organization. + # + # @overload list_quota_infos(request, options = nil) + # Pass arguments to `list_quota_infos` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_quota_infos(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_quota_infos` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Parent value of QuotaInfo resources. + # Listing across different resource containers (such as 'projects/-') is not + # allowed. + # + # Example names: + # `projects/123/locations/global/services/compute.googleapis.com` + # `folders/234/locations/global/services/compute.googleapis.com` + # `organizations/345/locations/global/services/compute.googleapis.com` + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::CloudQuotas::V1beta::QuotaInfo>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::CloudQuotas::V1beta::QuotaInfo>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest.new + # + # # Call the list_quota_infos method. + # result = client.list_quota_infos request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::CloudQuotas::V1beta::QuotaInfo. + # p item + # end + # + def list_quota_infos request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_quota_infos.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_quota_infos.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_quota_infos.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.list_quota_infos request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @cloud_quotas_stub, :list_quota_infos, "quota_infos", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieve the QuotaInfo of a quota for a project, folder or organization. + # + # @overload get_quota_info(request, options = nil) + # Pass arguments to `get_quota_info` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_quota_info(name: nil) + # Pass arguments to `get_quota_info` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the quota info. + # + # An example name: + # `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaInfo] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaInfo] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest.new + # + # # Call the get_quota_info method. + # result = client.get_quota_info request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaInfo. + # p result + # + def get_quota_info request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_quota_info.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_quota_info.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_quota_info.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.get_quota_info request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists QuotaPreferences in a given project, folder or organization. + # + # @overload list_quota_preferences(request, options = nil) + # Pass arguments to `list_quota_preferences` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_quota_preferences(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_quota_preferences` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Parent value of QuotaPreference resources. + # Listing across different resource containers (such as 'projects/-') is not + # allowed. + # + # When the value starts with 'folders' or 'organizations', it lists the + # QuotaPreferences for org quotas in the container. It does not list the + # QuotaPreferences in the descendant projects of the container. + # + # Example parents: + # `projects/123/locations/global` + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filter result QuotaPreferences by their state, type, + # create/update time range. + # + # Example filters: + # `reconciling=true AND request_type=CLOUD_CONSOLE`, + # `reconciling=true OR creation_time>2022-12-03T10:30:00` + # @param order_by [::String] + # Optional. How to order of the results. By default, the results are ordered + # by create time. + # + # Example orders: + # `quota_id`, + # `service, create_time` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest.new + # + # # Call the list_quota_preferences method. + # result = client.list_quota_preferences request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + # p item + # end + # + def list_quota_preferences request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_quota_preferences.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_quota_preferences.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_quota_preferences.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.list_quota_preferences request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets details of a single QuotaPreference. + # + # @overload get_quota_preference(request, options = nil) + # Pass arguments to `get_quota_preference` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_quota_preference(name: nil) + # Pass arguments to `get_quota_preference` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Name of the resource + # + # Example name: + # `projects/123/locations/global/quota_preferences/my-config-for-us-east1` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest.new + # + # # Call the get_quota_preference method. + # result = client.get_quota_preference request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + # p result + # + def get_quota_preference request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_quota_preference.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_quota_preference.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_quota_preference.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.get_quota_preference request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a new QuotaPreference that declares the desired value for a quota. + # + # @overload create_quota_preference(request, options = nil) + # Pass arguments to `create_quota_preference` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_quota_preference(parent: nil, quota_preference_id: nil, quota_preference: nil, ignore_safety_checks: nil) + # Pass arguments to `create_quota_preference` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Value for parent. + # + # Example: + # `projects/123/locations/global` + # @param quota_preference_id [::String] + # Optional. Id of the requesting object, must be unique under its parent. + # If client does not set this field, the service will generate one. + # @param quota_preference [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference, ::Hash] + # Required. The resource being created + # @param ignore_safety_checks [::Array<::Google::Cloud::CloudQuotas::V1beta::QuotaSafetyCheck>] + # The list of quota safety checks to be ignored. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest.new + # + # # Call the create_quota_preference method. + # result = client.create_quota_preference request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + # p result + # + def create_quota_preference request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_quota_preference.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_quota_preference.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_quota_preference.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.create_quota_preference request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates the parameters of a single QuotaPreference. It can updates the + # config in any states, not just the ones pending approval. + # + # @overload update_quota_preference(request, options = nil) + # Pass arguments to `update_quota_preference` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_quota_preference(update_mask: nil, quota_preference: nil, allow_missing: nil, validate_only: nil, ignore_safety_checks: nil) + # Pass arguments to `update_quota_preference` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. Field mask is used to specify the fields to be overwritten in the + # QuotaPreference resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. A field will be overwritten if it is in the mask. If the + # user does not provide a mask then all fields will be overwritten. + # @param quota_preference [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference, ::Hash] + # Required. The resource being updated + # @param allow_missing [::Boolean] + # Optional. If set to true, and the quota preference is not found, a new one + # will be created. In this situation, `update_mask` is ignored. + # @param validate_only [::Boolean] + # Optional. If set to true, validate the request, but do not actually update. + # Note that a request being valid does not mean that the request is + # guaranteed to be fulfilled. + # @param ignore_safety_checks [::Array<::Google::Cloud::CloudQuotas::V1beta::QuotaSafetyCheck>] + # The list of quota safety checks to be ignored. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest.new + # + # # Call the update_quota_preference method. + # result = client.update_quota_preference request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + # p result + # + def update_quota_preference request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_quota_preference.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_quota_preference.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_quota_preference.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_quotas_stub.update_quota_preference request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the CloudQuotas REST API. + # + # This class represents the configuration for CloudQuotas REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_quota_infos to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_quota_infos.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_quota_infos.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "cloudquotas.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the CloudQuotas API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_quota_infos` + # @return [::Gapic::Config::Method] + # + attr_reader :list_quota_infos + ## + # RPC-specific configuration for `get_quota_info` + # @return [::Gapic::Config::Method] + # + attr_reader :get_quota_info + ## + # RPC-specific configuration for `list_quota_preferences` + # @return [::Gapic::Config::Method] + # + attr_reader :list_quota_preferences + ## + # RPC-specific configuration for `get_quota_preference` + # @return [::Gapic::Config::Method] + # + attr_reader :get_quota_preference + ## + # RPC-specific configuration for `create_quota_preference` + # @return [::Gapic::Config::Method] + # + attr_reader :create_quota_preference + ## + # RPC-specific configuration for `update_quota_preference` + # @return [::Gapic::Config::Method] + # + attr_reader :update_quota_preference + + # @private + def initialize parent_rpcs = nil + list_quota_infos_config = parent_rpcs.list_quota_infos if parent_rpcs.respond_to? :list_quota_infos + @list_quota_infos = ::Gapic::Config::Method.new list_quota_infos_config + get_quota_info_config = parent_rpcs.get_quota_info if parent_rpcs.respond_to? :get_quota_info + @get_quota_info = ::Gapic::Config::Method.new get_quota_info_config + list_quota_preferences_config = parent_rpcs.list_quota_preferences if parent_rpcs.respond_to? :list_quota_preferences + @list_quota_preferences = ::Gapic::Config::Method.new list_quota_preferences_config + get_quota_preference_config = parent_rpcs.get_quota_preference if parent_rpcs.respond_to? :get_quota_preference + @get_quota_preference = ::Gapic::Config::Method.new get_quota_preference_config + create_quota_preference_config = parent_rpcs.create_quota_preference if parent_rpcs.respond_to? :create_quota_preference + @create_quota_preference = ::Gapic::Config::Method.new create_quota_preference_config + update_quota_preference_config = parent_rpcs.update_quota_preference if parent_rpcs.respond_to? :update_quota_preference + @update_quota_preference = ::Gapic::Config::Method.new update_quota_preference_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/service_stub.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/service_stub.rb new file mode 100644 index 000000000000..c6af203edaef --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/cloud_quotas/rest/service_stub.rb @@ -0,0 +1,537 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/api/cloudquotas/v1beta/cloudquotas_pb" + +module Google + module Cloud + module CloudQuotas + module V1beta + module CloudQuotas + module Rest + ## + # REST service stub for the CloudQuotas service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the list_quota_infos REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosResponse] + # A result object deserialized from the server's reply + def list_quota_infos request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_quota_infos_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_quota_infos", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_quota_info REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaInfo] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaInfo] + # A result object deserialized from the server's reply + def get_quota_info request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_quota_info_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_quota_info", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::CloudQuotas::V1beta::QuotaInfo.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_quota_preferences REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesResponse] + # A result object deserialized from the server's reply + def list_quota_preferences request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_quota_preferences_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_quota_preferences", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_quota_preference REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # A result object deserialized from the server's reply + def get_quota_preference request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_quota_preference_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_quota_preference", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the create_quota_preference REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # A result object deserialized from the server's reply + def create_quota_preference request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_quota_preference_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_quota_preference", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_quota_preference REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # A result object deserialized from the server's reply + def update_quota_preference request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_quota_preference_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_quota_preference", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the list_quota_infos REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_quota_infos_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{parent}/quotaInfos", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/services/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{parent}/quotaInfos", + matches: [ + ["parent", %r{^organizations/[^/]+/locations/[^/]+/services/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{parent}/quotaInfos", + matches: [ + ["parent", %r{^folders/[^/]+/locations/[^/]+/services/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_quota_info REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_quota_info_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/services/[^/]+/quotaInfos/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{name}", + matches: [ + ["name", %r{^organizations/[^/]+/locations/[^/]+/services/[^/]+/quotaInfos/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{name}", + matches: [ + ["name", %r{^folders/[^/]+/locations/[^/]+/services/[^/]+/quotaInfos/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_quota_preferences REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_quota_preferences_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{parent}/quotaPreferences", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{parent}/quotaPreferences", + matches: [ + ["parent", %r{^folders/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{parent}/quotaPreferences", + matches: [ + ["parent", %r{^organizations/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_quota_preference REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_quota_preference_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/quotaPreferences/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{name}", + matches: [ + ["name", %r{^organizations/[^/]+/locations/[^/]+/quotaPreferences/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{name}", + matches: [ + ["name", %r{^folders/[^/]+/locations/[^/]+/quotaPreferences/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_quota_preference REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_quota_preference_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1beta/{parent}/quotaPreferences", + body: "quota_preference", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v1beta/{parent}/quotaPreferences", + body: "quota_preference", + matches: [ + ["parent", %r{^folders/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v1beta/{parent}/quotaPreferences", + body: "quota_preference", + matches: [ + ["parent", %r{^organizations/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_quota_preference REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_quota_preference_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1beta/{quota_preference.name}", + body: "quota_preference", + matches: [ + ["quota_preference.name", %r{^projects/[^/]+/locations/[^/]+/quotaPreferences/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :patch, + uri_template: "/v1beta/{quota_preference.name}", + body: "quota_preference", + matches: [ + ["quota_preference.name", %r{^folders/[^/]+/locations/[^/]+/quotaPreferences/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :patch, + uri_template: "/v1beta/{quota_preference.name}", + body: "quota_preference", + matches: [ + ["quota_preference.name", %r{^organizations/[^/]+/locations/[^/]+/quotaPreferences/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager.rb new file mode 100644 index 000000000000..66802da78162 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/cloud_quotas/v1beta/version" + +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/credentials" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/paths" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/client" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest" + +module Google + module Cloud + module CloudQuotas + module V1beta + ## + # 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. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager" + # client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest" + # client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.new + # + module QuotaAdjusterSettingsManager + end + end + end + end +end + +helper_path = ::File.join __dir__, "quota_adjuster_settings_manager", "helpers.rb" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/helpers" if ::File.file? helper_path diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/client.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/client.rb new file mode 100644 index 000000000000..318b810d29f9 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/client.rb @@ -0,0 +1,564 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/api/cloudquotas/v1beta/quota_adjuster_settings_pb" + +module Google + module Cloud + module CloudQuotas + module V1beta + module QuotaAdjusterSettingsManager + ## + # Client for the QuotaAdjusterSettingsManager service. + # + # 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. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudquotas.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :quota_adjuster_settings_manager_stub + + ## + # Configure the QuotaAdjusterSettingsManager Client class. + # + # See {::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all QuotaAdjusterSettingsManager clients + # ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "CloudQuotas", "V1beta"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.update_quota_adjuster_settings.timeout = 60.0 + default_config.rpcs.update_quota_adjuster_settings.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_quota_adjuster_settings.timeout = 60.0 + default_config.rpcs.get_quota_adjuster_settings.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the QuotaAdjusterSettingsManager Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @quota_adjuster_settings_manager_stub.universe_domain + end + + ## + # Create a new QuotaAdjusterSettingsManager client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the QuotaAdjusterSettingsManager client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/api/cloudquotas/v1beta/quota_adjuster_settings_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @quota_adjuster_settings_manager_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @quota_adjuster_settings_manager_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @quota_adjuster_settings_manager_stub.logger + end + + # Service calls + + ## + # RPC Method for updating QuotaAdjusterSettings based on the request + # + # @overload update_quota_adjuster_settings(request, options = nil) + # Pass arguments to `update_quota_adjuster_settings` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_quota_adjuster_settings(quota_adjuster_settings: nil, update_mask: nil, validate_only: nil) + # Pass arguments to `update_quota_adjuster_settings` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param quota_adjuster_settings [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings, ::Hash] + # Required. The QuotaAdjusterSettings to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. The list of fields to update. + # @param validate_only [::Boolean] + # Optional. If set to true, validate the request, but do not actually update. + # Note that a request being valid does not mean that the request is + # guaranteed to be fulfilled. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest.new + # + # # Call the update_quota_adjuster_settings method. + # result = client.update_quota_adjuster_settings request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings. + # p result + # + def update_quota_adjuster_settings request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_quota_adjuster_settings.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.quota_adjuster_settings&.name + header_params["quota_adjuster_settings.name"] = request.quota_adjuster_settings.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_quota_adjuster_settings.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_quota_adjuster_settings.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @quota_adjuster_settings_manager_stub.call_rpc :update_quota_adjuster_settings, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # RPC Method for getting QuotaAdjusterSettings based on the request + # + # @overload get_quota_adjuster_settings(request, options = nil) + # Pass arguments to `get_quota_adjuster_settings` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_quota_adjuster_settings(name: nil) + # Pass arguments to `get_quota_adjuster_settings` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Name of the config. Required to be “settings”, as only a single + # setting per container will be supported initially. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest.new + # + # # Call the get_quota_adjuster_settings method. + # result = client.get_quota_adjuster_settings request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings. + # p result + # + def get_quota_adjuster_settings request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_quota_adjuster_settings.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_quota_adjuster_settings.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_quota_adjuster_settings.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @quota_adjuster_settings_manager_stub.call_rpc :get_quota_adjuster_settings, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the QuotaAdjusterSettingsManager API. + # + # This class represents the configuration for QuotaAdjusterSettingsManager, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # update_quota_adjuster_settings to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.update_quota_adjuster_settings.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.update_quota_adjuster_settings.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "cloudquotas.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the QuotaAdjusterSettingsManager API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `update_quota_adjuster_settings` + # @return [::Gapic::Config::Method] + # + attr_reader :update_quota_adjuster_settings + ## + # RPC-specific configuration for `get_quota_adjuster_settings` + # @return [::Gapic::Config::Method] + # + attr_reader :get_quota_adjuster_settings + + # @private + def initialize parent_rpcs = nil + update_quota_adjuster_settings_config = parent_rpcs.update_quota_adjuster_settings if parent_rpcs.respond_to? :update_quota_adjuster_settings + @update_quota_adjuster_settings = ::Gapic::Config::Method.new update_quota_adjuster_settings_config + get_quota_adjuster_settings_config = parent_rpcs.get_quota_adjuster_settings if parent_rpcs.respond_to? :get_quota_adjuster_settings + @get_quota_adjuster_settings = ::Gapic::Config::Method.new get_quota_adjuster_settings_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/credentials.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/credentials.rb new file mode 100644 index 000000000000..4959d4c45fe0 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/credentials.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module CloudQuotas + module V1beta + module QuotaAdjusterSettingsManager + # Credentials for the QuotaAdjusterSettingsManager API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/paths.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/paths.rb new file mode 100644 index 000000000000..b0e6099236ab --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/paths.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module CloudQuotas + module V1beta + module QuotaAdjusterSettingsManager + # Path helper methods for the QuotaAdjusterSettingsManager API. + module Paths + ## + # Create a fully-qualified QuotaAdjusterSettings resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/quotaAdjusterSettings` + # + # @param project [String] + # @param location [String] + # + # @return [::String] + def quota_adjuster_settings_path project:, location: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + + "projects/#{project}/locations/#{location}/quotaAdjusterSettings" + end + + extend self + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest.rb new file mode 100644 index 000000000000..1d256cbedfff --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/cloud_quotas/v1beta/version" + +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/credentials" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/paths" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/client" + +module Google + module Cloud + module CloudQuotas + module V1beta + ## + # 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. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest" + # client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.new + # + module QuotaAdjusterSettingsManager + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/client.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/client.rb new file mode 100644 index 000000000000..8c3e4fd67e13 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/client.rb @@ -0,0 +1,524 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/api/cloudquotas/v1beta/quota_adjuster_settings_pb" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/service_stub" + +module Google + module Cloud + module CloudQuotas + module V1beta + module QuotaAdjusterSettingsManager + module Rest + ## + # REST client for the QuotaAdjusterSettingsManager service. + # + # 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. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudquotas.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :quota_adjuster_settings_manager_stub + + ## + # Configure the QuotaAdjusterSettingsManager Client class. + # + # See {::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all QuotaAdjusterSettingsManager clients + # ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "CloudQuotas", "V1beta"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.update_quota_adjuster_settings.timeout = 60.0 + default_config.rpcs.update_quota_adjuster_settings.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_quota_adjuster_settings.timeout = 60.0 + default_config.rpcs.get_quota_adjuster_settings.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the QuotaAdjusterSettingsManager Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @quota_adjuster_settings_manager_stub.universe_domain + end + + ## + # Create a new QuotaAdjusterSettingsManager REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the QuotaAdjusterSettingsManager client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @quota_adjuster_settings_manager_stub = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @quota_adjuster_settings_manager_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @quota_adjuster_settings_manager_stub.logger + end + + # Service calls + + ## + # RPC Method for updating QuotaAdjusterSettings based on the request + # + # @overload update_quota_adjuster_settings(request, options = nil) + # Pass arguments to `update_quota_adjuster_settings` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_quota_adjuster_settings(quota_adjuster_settings: nil, update_mask: nil, validate_only: nil) + # Pass arguments to `update_quota_adjuster_settings` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param quota_adjuster_settings [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings, ::Hash] + # Required. The QuotaAdjusterSettings to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. The list of fields to update. + # @param validate_only [::Boolean] + # Optional. If set to true, validate the request, but do not actually update. + # Note that a request being valid does not mean that the request is + # guaranteed to be fulfilled. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest.new + # + # # Call the update_quota_adjuster_settings method. + # result = client.update_quota_adjuster_settings request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings. + # p result + # + def update_quota_adjuster_settings request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_quota_adjuster_settings.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_quota_adjuster_settings.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_quota_adjuster_settings.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @quota_adjuster_settings_manager_stub.update_quota_adjuster_settings request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # RPC Method for getting QuotaAdjusterSettings based on the request + # + # @overload get_quota_adjuster_settings(request, options = nil) + # Pass arguments to `get_quota_adjuster_settings` via a request object, either of type + # {::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_quota_adjuster_settings(name: nil) + # Pass arguments to `get_quota_adjuster_settings` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Name of the config. Required to be “settings”, as only a single + # setting per container will be supported initially. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/cloud_quotas/v1beta" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest.new + # + # # Call the get_quota_adjuster_settings method. + # result = client.get_quota_adjuster_settings request + # + # # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings. + # p result + # + def get_quota_adjuster_settings request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_quota_adjuster_settings.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::CloudQuotas::V1beta::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_quota_adjuster_settings.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_quota_adjuster_settings.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @quota_adjuster_settings_manager_stub.get_quota_adjuster_settings request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the QuotaAdjusterSettingsManager REST API. + # + # This class represents the configuration for QuotaAdjusterSettingsManager REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # update_quota_adjuster_settings to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.update_quota_adjuster_settings.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.update_quota_adjuster_settings.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "cloudquotas.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the QuotaAdjusterSettingsManager API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `update_quota_adjuster_settings` + # @return [::Gapic::Config::Method] + # + attr_reader :update_quota_adjuster_settings + ## + # RPC-specific configuration for `get_quota_adjuster_settings` + # @return [::Gapic::Config::Method] + # + attr_reader :get_quota_adjuster_settings + + # @private + def initialize parent_rpcs = nil + update_quota_adjuster_settings_config = parent_rpcs.update_quota_adjuster_settings if parent_rpcs.respond_to? :update_quota_adjuster_settings + @update_quota_adjuster_settings = ::Gapic::Config::Method.new update_quota_adjuster_settings_config + get_quota_adjuster_settings_config = parent_rpcs.get_quota_adjuster_settings if parent_rpcs.respond_to? :get_quota_adjuster_settings + @get_quota_adjuster_settings = ::Gapic::Config::Method.new get_quota_adjuster_settings_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/service_stub.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/service_stub.rb new file mode 100644 index 000000000000..5034757a2e2a --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest/service_stub.rb @@ -0,0 +1,204 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/api/cloudquotas/v1beta/quota_adjuster_settings_pb" + +module Google + module Cloud + module CloudQuotas + module V1beta + module QuotaAdjusterSettingsManager + module Rest + ## + # REST service stub for the QuotaAdjusterSettingsManager service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the update_quota_adjuster_settings REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # A result object deserialized from the server's reply + def update_quota_adjuster_settings request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_quota_adjuster_settings_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_quota_adjuster_settings", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_quota_adjuster_settings REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # A result object deserialized from the server's reply + def get_quota_adjuster_settings request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_quota_adjuster_settings_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_quota_adjuster_settings", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the update_quota_adjuster_settings REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_quota_adjuster_settings_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1beta/{quota_adjuster_settings.name}", + body: "quota_adjuster_settings", + matches: [ + ["quota_adjuster_settings.name", %r{^projects/[^/]+/locations/[^/]+/quotaAdjusterSettings/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_quota_adjuster_settings REST call + # + # @param request_pb [::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_quota_adjuster_settings_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1beta/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/quotaAdjusterSettings/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/rest.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/rest.rb new file mode 100644 index 000000000000..67706fb7f792 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/rest.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/rest" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest" +require "google/cloud/cloud_quotas/v1beta/version" + +module Google + module Cloud + module CloudQuotas + ## + # To load just the REST part of this package, including all its services, and instantiate a REST client: + # + # @example + # + # require "google/cloud/cloud_quotas/v1beta/rest" + # client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new + # + module V1beta + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/version.rb b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/version.rb new file mode 100644 index 000000000000..b1445754227f --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/lib/google/cloud/cloud_quotas/v1beta/version.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module CloudQuotas + module V1beta + VERSION = "0.0.1" + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/README.md b/google-cloud-cloud_quotas-v1beta/proto_docs/README.md new file mode 100644 index 000000000000..f84d228248ee --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/README.md @@ -0,0 +1,4 @@ +# Cloud Quotas V1BETA Protocol Buffer Documentation + +These files are for the YARD documentation of the generated protobuf files. +They are not intended to be required or loaded at runtime. diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/client.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/client.rb new file mode 100644 index 000000000000..1c6c0f32ec94 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/client.rb @@ -0,0 +1,459 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # Required information for every language. + # @!attribute [rw] reference_docs_uri + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # Link to automatically generated reference documentation. Example: + # https://cloud.google.com/nodejs/docs/reference/asset/latest + # @!attribute [rw] destinations + # @return [::Array<::Google::Api::ClientLibraryDestination>] + # The destination where API teams want this client library to be published. + # @!attribute [rw] selective_gapic_generation + # @return [::Google::Api::SelectiveGapicGeneration] + # Configuration for which RPCs should be generated in the GAPIC client. + class CommonLanguageSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Details about how and where to publish client libraries. + # @!attribute [rw] version + # @return [::String] + # Version of the API to apply these settings to. This is the full protobuf + # package for the API, ending in the version element. + # Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". + # @!attribute [rw] launch_stage + # @return [::Google::Api::LaunchStage] + # Launch stage of this version of the API. + # @!attribute [rw] rest_numeric_enums + # @return [::Boolean] + # When using transport=rest, the client request will encode enums as + # numbers rather than strings. + # @!attribute [rw] java_settings + # @return [::Google::Api::JavaSettings] + # Settings for legacy Java features, supported in the Service YAML. + # @!attribute [rw] cpp_settings + # @return [::Google::Api::CppSettings] + # Settings for C++ client libraries. + # @!attribute [rw] php_settings + # @return [::Google::Api::PhpSettings] + # Settings for PHP client libraries. + # @!attribute [rw] python_settings + # @return [::Google::Api::PythonSettings] + # Settings for Python client libraries. + # @!attribute [rw] node_settings + # @return [::Google::Api::NodeSettings] + # Settings for Node client libraries. + # @!attribute [rw] dotnet_settings + # @return [::Google::Api::DotnetSettings] + # Settings for .NET client libraries. + # @!attribute [rw] ruby_settings + # @return [::Google::Api::RubySettings] + # Settings for Ruby client libraries. + # @!attribute [rw] go_settings + # @return [::Google::Api::GoSettings] + # Settings for Go client libraries. + class ClientLibrarySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This message configures the settings for publishing [Google Cloud Client + # libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) + # generated from the service config. + # @!attribute [rw] method_settings + # @return [::Array<::Google::Api::MethodSettings>] + # A list of API method settings, e.g. the behavior for methods that use the + # long-running operation pattern. + # @!attribute [rw] new_issue_uri + # @return [::String] + # Link to a *public* URI where users can report issues. Example: + # https://issuetracker.google.com/issues/new?component=190865&template=1161103 + # @!attribute [rw] documentation_uri + # @return [::String] + # Link to product home page. Example: + # https://cloud.google.com/asset-inventory/docs/overview + # @!attribute [rw] api_short_name + # @return [::String] + # Used as a tracking tag when collecting data about the APIs developer + # relations artifacts like docs, packages delivered to package managers, + # etc. Example: "speech". + # @!attribute [rw] github_label + # @return [::String] + # GitHub label to apply to issues and pull requests opened for this API. + # @!attribute [rw] codeowner_github_teams + # @return [::Array<::String>] + # GitHub teams to be added to CODEOWNERS in the directory in GitHub + # containing source code for the client libraries for this API. + # @!attribute [rw] doc_tag_prefix + # @return [::String] + # A prefix used in sample code when demarking regions to be included in + # documentation. + # @!attribute [rw] organization + # @return [::Google::Api::ClientLibraryOrganization] + # For whom the client library is being published. + # @!attribute [rw] library_settings + # @return [::Array<::Google::Api::ClientLibrarySettings>] + # Client library settings. If the same version string appears multiple + # times in this list, then the last one wins. Settings from earlier + # settings with the same version string are discarded. + # @!attribute [rw] proto_reference_documentation_uri + # @return [::String] + # Optional link to proto reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rpc + # @!attribute [rw] rest_reference_documentation_uri + # @return [::String] + # Optional link to REST reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rest + class Publishing + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Java client libraries. + # @!attribute [rw] library_package + # @return [::String] + # The package name to use in Java. Clobbers the java_package option + # set in the protobuf. This should be used **only** by APIs + # who have already set the language_settings.java.package_name" field + # in gapic.yaml. API teams should use the protobuf java_package option + # where possible. + # + # Example of a YAML configuration:: + # + # publishing: + # java_settings: + # library_package: com.google.cloud.pubsub.v1 + # @!attribute [rw] service_class_names + # @return [::Google::Protobuf::Map{::String => ::String}] + # Configure the Java class name to use instead of the service's for its + # corresponding generated GAPIC client. Keys are fully-qualified + # service names as they appear in the protobuf (including the full + # the language_settings.java.interface_names" field in gapic.yaml. API + # teams should otherwise use the service name as it appears in the + # protobuf. + # + # Example of a YAML configuration:: + # + # publishing: + # java_settings: + # service_class_names: + # - google.pubsub.v1.Publisher: TopicAdmin + # - google.pubsub.v1.Subscriber: SubscriptionAdmin + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class JavaSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class ServiceClassNamesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for C++ client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class CppSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Php client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class PhpSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Python client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] experimental_features + # @return [::Google::Api::PythonSettings::ExperimentalFeatures] + # Experimental features to be included during client library generation. + class PythonSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Experimental features to be included during client library generation. + # These fields will be deprecated once the feature graduates and is enabled + # by default. + # @!attribute [rw] rest_async_io_enabled + # @return [::Boolean] + # Enables generation of asynchronous REST clients if `rest` transport is + # enabled. By default, asynchronous REST clients will not be generated. + # This feature will be enabled by default 1 month after launching the + # feature in preview packages. + # @!attribute [rw] protobuf_pythonic_types_enabled + # @return [::Boolean] + # Enables generation of protobuf code using new types that are more + # Pythonic which are included in `protobuf>=5.29.x`. This feature will be + # enabled by default 1 month after launching the feature in preview + # packages. + class ExperimentalFeatures + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for Node client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class NodeSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Dotnet client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] renamed_services + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from original service names to renamed versions. + # This is used when the default generated types + # would cause a naming conflict. (Neither name is + # fully-qualified.) + # Example: Subscriber to SubscriberServiceApi. + # @!attribute [rw] renamed_resources + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from full resource types to the effective short name + # for the resource. This is used when otherwise resource + # named from different services would cause naming collisions. + # Example entry: + # "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" + # @!attribute [rw] ignored_resources + # @return [::Array<::String>] + # List of full resource types to ignore during generation. + # This is typically used for API-specific Location resources, + # which should be handled by the generator as if they were actually + # the common Location resources. + # Example entry: "documentai.googleapis.com/Location" + # @!attribute [rw] forced_namespace_aliases + # @return [::Array<::String>] + # Namespaces which must be aliased in snippets due to + # a known (but non-generator-predictable) naming collision + # @!attribute [rw] handwritten_signatures + # @return [::Array<::String>] + # Method signatures (in the form "service.method(signature)") + # which are provided separately, so shouldn't be generated. + # Snippets *calling* these methods are still generated, however. + class DotnetSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedServicesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedResourcesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for Ruby client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class RubySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Go client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] renamed_services + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map of service names to renamed services. Keys are the package relative + # service names and values are the name to be used for the service client + # and call options. + # + # publishing: + # go_settings: + # renamed_services: + # Publisher: TopicAdmin + class GoSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedServicesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Describes the generator configuration for a method. + # @!attribute [rw] selector + # @return [::String] + # The fully qualified name of the method, for which the options below apply. + # This is used to find the method to apply the options. + # + # Example: + # + # publishing: + # method_settings: + # - selector: google.storage.control.v2.StorageControl.CreateFolder + # # method settings for CreateFolder... + # @!attribute [rw] long_running + # @return [::Google::Api::MethodSettings::LongRunning] + # Describes settings to use for long-running operations when generating + # API methods for RPCs. Complements RPCs that use the annotations in + # google/longrunning/operations.proto. + # + # Example of a YAML configuration:: + # + # publishing: + # method_settings: + # - selector: google.cloud.speech.v2.Speech.BatchRecognize + # long_running: + # initial_poll_delay: 60s # 1 minute + # poll_delay_multiplier: 1.5 + # max_poll_delay: 360s # 6 minutes + # total_poll_timeout: 54000s # 90 minutes + # @!attribute [rw] auto_populated_fields + # @return [::Array<::String>] + # List of top-level fields of the request message, that should be + # automatically populated by the client libraries based on their + # (google.api.field_info).format. Currently supported format: UUID4. + # + # Example of a YAML configuration: + # + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.CreateExample + # auto_populated_fields: + # - request_id + class MethodSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Describes settings to use when generating API methods that use the + # long-running operation pattern. + # All default values below are from those used in the client library + # generators (e.g. + # [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). + # @!attribute [rw] initial_poll_delay + # @return [::Google::Protobuf::Duration] + # Initial delay after which the first poll request will be made. + # Default value: 5 seconds. + # @!attribute [rw] poll_delay_multiplier + # @return [::Float] + # Multiplier to gradually increase delay between subsequent polls until it + # reaches max_poll_delay. + # Default value: 1.5. + # @!attribute [rw] max_poll_delay + # @return [::Google::Protobuf::Duration] + # Maximum time between two subsequent poll requests. + # Default value: 45 seconds. + # @!attribute [rw] total_poll_timeout + # @return [::Google::Protobuf::Duration] + # Total polling timeout. + # Default value: 5 minutes. + class LongRunning + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # This message is used to configure the generation of a subset of the RPCs in + # a service for client libraries. + # @!attribute [rw] methods + # @return [::Array<::String>] + # An allowlist of the fully qualified names of RPCs that should be included + # on public client surfaces. + class SelectiveGapicGeneration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The organization for which the client libraries are being published. + # Affects the url where generated docs are published, etc. + module ClientLibraryOrganization + # Not useful. + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0 + + # Google Cloud Platform Org. + CLOUD = 1 + + # Ads (Advertising) Org. + ADS = 2 + + # Photos Org. + PHOTOS = 3 + + # Street View Org. + STREET_VIEW = 4 + + # Shopping Org. + SHOPPING = 5 + + # Geo Org. + GEO = 6 + + # Generative AI - https://developers.generativeai.google + GENERATIVE_AI = 7 + end + + # To where should client libraries be published? + module ClientLibraryDestination + # Client libraries will neither be generated nor published to package + # managers. + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0 + + # Generate the client library in a repo under github.com/googleapis, + # but don't publish it to package managers. + GITHUB = 10 + + # Publish the library to package managers like nuget.org and npmjs.com. + PACKAGE_MANAGER = 20 + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/cloudquotas/v1beta/cloudquotas.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/cloudquotas/v1beta/cloudquotas.rb new file mode 100644 index 000000000000..f798b3d2f55b --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/cloudquotas/v1beta/cloudquotas.rb @@ -0,0 +1,193 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module CloudQuotas + module V1beta + # Message for requesting list of QuotaInfos + # @!attribute [rw] parent + # @return [::String] + # Required. Parent value of QuotaInfo resources. + # Listing across different resource containers (such as 'projects/-') is not + # allowed. + # + # Example names: + # `projects/123/locations/global/services/compute.googleapis.com` + # `folders/234/locations/global/services/compute.googleapis.com` + # `organizations/345/locations/global/services/compute.googleapis.com` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + class ListQuotaInfosRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Message for response to listing QuotaInfos + # @!attribute [rw] quota_infos + # @return [::Array<::Google::Cloud::CloudQuotas::V1beta::QuotaInfo>] + # The list of QuotaInfo + # @!attribute [rw] next_page_token + # @return [::String] + # A token, which can be sent as `page_token` to retrieve the next page. + # If this field is omitted, there are no subsequent pages. + class ListQuotaInfosResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Message for getting a QuotaInfo + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the quota info. + # + # An example name: + # `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion` + class GetQuotaInfoRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Message for requesting list of QuotaPreferences + # @!attribute [rw] parent + # @return [::String] + # Required. Parent value of QuotaPreference resources. + # Listing across different resource containers (such as 'projects/-') is not + # allowed. + # + # When the value starts with 'folders' or 'organizations', it lists the + # QuotaPreferences for org quotas in the container. It does not list the + # QuotaPreferences in the descendant projects of the container. + # + # Example parents: + # `projects/123/locations/global` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # @!attribute [rw] filter + # @return [::String] + # Optional. Filter result QuotaPreferences by their state, type, + # create/update time range. + # + # Example filters: + # `reconciling=true AND request_type=CLOUD_CONSOLE`, + # `reconciling=true OR creation_time>2022-12-03T10:30:00` + # @!attribute [rw] order_by + # @return [::String] + # Optional. How to order of the results. By default, the results are ordered + # by create time. + # + # Example orders: + # `quota_id`, + # `service, create_time` + class ListQuotaPreferencesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Message for response to listing QuotaPreferences + # @!attribute [rw] quota_preferences + # @return [::Array<::Google::Cloud::CloudQuotas::V1beta::QuotaPreference>] + # The list of QuotaPreference + # @!attribute [rw] next_page_token + # @return [::String] + # A token, which can be sent as `page_token` to retrieve the next page. + # If this field is omitted, there are no subsequent pages. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Locations that could not be reached. + class ListQuotaPreferencesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Message for getting a QuotaPreference + # @!attribute [rw] name + # @return [::String] + # Required. Name of the resource + # + # Example name: + # `projects/123/locations/global/quota_preferences/my-config-for-us-east1` + class GetQuotaPreferenceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Message for creating a QuotaPreference + # @!attribute [rw] parent + # @return [::String] + # Required. Value for parent. + # + # Example: + # `projects/123/locations/global` + # @!attribute [rw] quota_preference_id + # @return [::String] + # Optional. Id of the requesting object, must be unique under its parent. + # If client does not set this field, the service will generate one. + # @!attribute [rw] quota_preference + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # Required. The resource being created + # @!attribute [rw] ignore_safety_checks + # @return [::Array<::Google::Cloud::CloudQuotas::V1beta::QuotaSafetyCheck>] + # The list of quota safety checks to be ignored. + class CreateQuotaPreferenceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Message for updating a QuotaPreference + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Optional. Field mask is used to specify the fields to be overwritten in the + # QuotaPreference resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. A field will be overwritten if it is in the mask. If the + # user does not provide a mask then all fields will be overwritten. + # @!attribute [rw] quota_preference + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaPreference] + # Required. The resource being updated + # @!attribute [rw] allow_missing + # @return [::Boolean] + # Optional. If set to true, and the quota preference is not found, a new one + # will be created. In this situation, `update_mask` is ignored. + # @!attribute [rw] validate_only + # @return [::Boolean] + # Optional. If set to true, validate the request, but do not actually update. + # Note that a request being valid does not mean that the request is + # guaranteed to be fulfilled. + # @!attribute [rw] ignore_safety_checks + # @return [::Array<::Google::Cloud::CloudQuotas::V1beta::QuotaSafetyCheck>] + # The list of quota safety checks to be ignored. + class UpdateQuotaPreferenceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/cloudquotas/v1beta/quota_adjuster_settings.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/cloudquotas/v1beta/quota_adjuster_settings.rb new file mode 100644 index 000000000000..7d007bdc6cbd --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/cloudquotas/v1beta/quota_adjuster_settings.rb @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module CloudQuotas + module V1beta + # Request for getting QuotaAdjusterSettings + # @!attribute [rw] name + # @return [::String] + # Required. Name of the config. Required to be “settings”, as only a single + # setting per container will be supported initially. + class GetQuotaAdjusterSettingsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for updating QuotaAdjusterSettings + # @!attribute [rw] quota_adjuster_settings + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings] + # Required. The QuotaAdjusterSettings to update. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Optional. The list of fields to update. + # @!attribute [rw] validate_only + # @return [::Boolean] + # Optional. If set to true, validate the request, but do not actually update. + # Note that a request being valid does not mean that the request is + # guaranteed to be fulfilled. + class UpdateQuotaAdjusterSettingsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The QuotaAdjusterSettings resource defines the settings for the Quota + # Adjuster. + # @!attribute [rw] name + # @return [::String] + # Identifier. Name of the config would be of the format: + # projects/12345/locations/global/quotaAdjusterSettings + # @!attribute [rw] enablement + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings::Enablement] + # Required. The configured value of the enablement at the given resource. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The timestamp when the QuotaAdjusterSettings was last updated. + # @!attribute [rw] etag + # @return [::String] + # Optional. The current etag of the QuotaAdjusterSettings. If an etag is + # provided on update and does not match the current server's etag of the + # QuotaAdjusterSettings, the request will be blocked and an ABORTED error + # will be returned. See https://google.aip.dev/134#etags for more details on + # etags. + class QuotaAdjusterSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The enablement status of the quota adjuster. + module Enablement + # The quota adjuster is in an unknown state. + ENABLEMENT_UNSPECIFIED = 0 + + # The quota adjuster is enabled. + ENABLED = 2 + + # The quota adjuster is disabled. + DISABLED = 3 + end + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/cloudquotas/v1beta/resources.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/cloudquotas/v1beta/resources.rb new file mode 100644 index 000000000000..c629320a5416 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/cloudquotas/v1beta/resources.rb @@ -0,0 +1,348 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module CloudQuotas + module V1beta + # QuotaInfo represents information about a particular quota for a given + # project, folder or organization. + # @!attribute [rw] name + # @return [::String] + # Resource name of this QuotaInfo. + # The ID component following "locations/" must be "global". + # Example: + # `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion` + # @!attribute [rw] quota_id + # @return [::String] + # The id of the quota, which is unquie within the service. + # Example: `CpusPerProjectPerRegion` + # @!attribute [rw] metric + # @return [::String] + # The metric of the quota. It specifies the resources consumption the quota + # is defined for. + # Example: `compute.googleapis.com/cpus` + # @!attribute [rw] service + # @return [::String] + # The name of the service in which the quota is defined. + # Example: `compute.googleapis.com` + # @!attribute [rw] is_precise + # @return [::Boolean] + # Whether this is a precise quota. A precise quota is tracked with absolute + # precision. In contrast, an imprecise quota is not tracked with precision. + # @!attribute [rw] refresh_interval + # @return [::String] + # The reset time interval for the quota. Refresh interval applies to rate + # quota only. + # Example: "minute" for per minute, "day" for per day, or "10 seconds" for + # every 10 seconds. + # @!attribute [rw] container_type + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaInfo::ContainerType] + # The container type of the QuotaInfo. + # @!attribute [rw] dimensions + # @return [::Array<::String>] + # The dimensions the quota is defined on. + # @!attribute [rw] metric_display_name + # @return [::String] + # The display name of the quota metric + # @!attribute [rw] quota_display_name + # @return [::String] + # The display name of the quota. + # @!attribute [rw] metric_unit + # @return [::String] + # The unit in which the metric value is reported, e.g., "MByte". + # @!attribute [rw] quota_increase_eligibility + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaIncreaseEligibility] + # Whether it is eligible to request a higher quota value for this quota. + # @!attribute [rw] is_fixed + # @return [::Boolean] + # Whether the quota value is fixed or adjustable + # @!attribute [rw] dimensions_infos + # @return [::Array<::Google::Cloud::CloudQuotas::V1beta::DimensionsInfo>] + # The collection of dimensions info ordered by their dimensions from more + # specific ones to less specific ones. + # @!attribute [rw] is_concurrent + # @return [::Boolean] + # Whether the quota is a concurrent quota. Concurrent quotas are enforced + # on the total number of concurrent operations in flight at any given time. + # @!attribute [rw] service_request_quota_uri + # @return [::String] + # URI to the page where users can request more quota for the cloud + # service—for example, + # https://console.cloud.google.com/iam-admin/quotas. + class QuotaInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The enumeration of the types of a cloud resource container. + module ContainerType + # Unspecified container type. + CONTAINER_TYPE_UNSPECIFIED = 0 + + # consumer project + PROJECT = 1 + + # folder + FOLDER = 2 + + # organization + ORGANIZATION = 3 + end + end + + # Eligibility information regarding requesting increase adjustment of a quota. + # @!attribute [rw] is_eligible + # @return [::Boolean] + # Whether a higher quota value can be requested for the quota. + # @!attribute [rw] ineligibility_reason + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaIncreaseEligibility::IneligibilityReason] + # The reason of why it is ineligible to request increased value of the quota. + # If the is_eligible field is true, it defaults to + # INELIGIBILITY_REASON_UNSPECIFIED. + class QuotaIncreaseEligibility + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The enumeration of reasons when it is ineligible to request increase + # adjustment. + module IneligibilityReason + # Default value when is_eligible is true. + INELIGIBILITY_REASON_UNSPECIFIED = 0 + + # The container is not linked with a valid billing account. + NO_VALID_BILLING_ACCOUNT = 1 + + # Quota increase is not supported for the quota. + NOT_SUPPORTED = 3 + + # There is not enough usage history to determine the eligibility. + NOT_ENOUGH_USAGE_HISTORY = 4 + + # Other reasons. + OTHER = 2 + end + end + + # QuotaPreference represents the preferred quota configuration specified for + # a project, folder or organization. There is only one QuotaPreference + # resource for a quota value targeting a unique set of dimensions. + # @!attribute [rw] name + # @return [::String] + # Required except in the CREATE requests. + # The resource name of the quota preference. + # The ID component following "locations/" must be "global". + # Example: + # `projects/123/locations/global/quotaPreferences/my-config-for-us-east1` + # @!attribute [rw] dimensions + # @return [::Google::Protobuf::Map{::String => ::String}] + # Immutable. The dimensions that this quota preference applies to. The key of + # the map entry is the name of a dimension, such as "region", "zone", + # "network_id", and the value of the map entry is the dimension value. + # + # If a dimension is missing from the map of dimensions, the quota preference + # applies to all the dimension values except for those that have other quota + # preferences configured for the specific value. + # + # NOTE: QuotaPreferences can only be applied across all values of "user" and + # "resource" dimension. Do not set values for "user" or "resource" in the + # dimension map. + # + # Example: \\{"provider", "Foo Inc"} where "provider" is a service specific + # dimension. + # @!attribute [rw] quota_config + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaConfig] + # Required. Preferred quota configuration. + # @!attribute [rw] etag + # @return [::String] + # Optional. The current etag of the quota preference. If an etag is provided + # on update and does not match the current server's etag of the quota + # preference, the request will be blocked and an ABORTED error will be + # returned. See https://google.aip.dev/134#etags for more details on etags. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Create time stamp + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Update time stamp + # @!attribute [rw] service + # @return [::String] + # Required. The name of the service to which the quota preference is applied. + # @!attribute [rw] quota_id + # @return [::String] + # Required. The id of the quota to which the quota preference is applied. A + # quota name is unique in the service. Example: `CpusPerProjectPerRegion` + # @!attribute [r] reconciling + # @return [::Boolean] + # Output only. Is the quota preference pending Google Cloud approval and + # fulfillment. + # @!attribute [rw] justification + # @return [::String] + # The reason / justification for this quota preference. + # @!attribute [rw] contact_email + # @return [::String] + # Input only. An email address that can be used to contact the the user, in + # case Google Cloud needs more information to make a decision before + # additional quota can be granted. + # + # When requesting a quota increase, the email address is required. + # When requesting a quota decrease, the email address is optional. + # For example, the email address is optional when the + # `QuotaConfig.preferred_value` is smaller than the + # `QuotaDetails.reset_value`. + class QuotaPreference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class DimensionsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # The preferred quota configuration. + # @!attribute [rw] preferred_value + # @return [::Integer] + # Required. The preferred value. Must be greater than or equal to -1. If set + # to -1, it means the value is "unlimited". + # @!attribute [r] state_detail + # @return [::String] + # Output only. Optional details about the state of this quota preference. + # @!attribute [r] granted_value + # @return [::Google::Protobuf::Int64Value] + # Output only. Granted quota value. + # @!attribute [r] trace_id + # @return [::String] + # Output only. The trace id that the Google Cloud uses to provision the + # requested quota. This trace id may be used by the client to contact Cloud + # support to track the state of a quota preference request. The trace id is + # only produced for increase requests and is unique for each request. The + # quota decrease requests do not have a trace id. + # @!attribute [rw] annotations + # @return [::Google::Protobuf::Map{::String => ::String}] + # Optional. The annotations map for clients to store small amounts of + # arbitrary data. Do not put PII or other sensitive information here. See + # https://google.aip.dev/128#annotations + # @!attribute [r] request_origin + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaConfig::Origin] + # Output only. The origin of the quota preference request. + class QuotaConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class AnnotationsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The enumeration of the origins of quota preference requests. + module Origin + # The unspecified value. + ORIGIN_UNSPECIFIED = 0 + + # Created through Cloud Console. + CLOUD_CONSOLE = 1 + + # Generated by automatic quota adjustment. + AUTO_ADJUSTER = 2 + end + end + + # The detailed quota information such as effective quota value for a + # combination of dimensions. + # @!attribute [rw] dimensions + # @return [::Google::Protobuf::Map{::String => ::String}] + # The map of dimensions for this dimensions info. The key of a map entry + # is "region", "zone" or the name of a service specific dimension, and the + # value of a map entry is the value of the dimension. If a dimension does + # not appear in the map of dimensions, the dimensions info applies to all + # the dimension values except for those that have another DimenisonInfo + # instance configured for the specific value. + # Example: \\{"provider" : "Foo Inc"} where "provider" is a service specific + # dimension of a quota. + # @!attribute [rw] details + # @return [::Google::Cloud::CloudQuotas::V1beta::QuotaDetails] + # Quota details for the specified dimensions. + # @!attribute [rw] applicable_locations + # @return [::Array<::String>] + # The applicable regions or zones of this dimensions info. The field will be + # set to ['global'] for quotas that are not per region or per zone. + # Otherwise, it will be set to the list of locations this dimension info is + # applicable to. + class DimensionsInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class DimensionsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # The quota details for a map of dimensions. + # @!attribute [rw] value + # @return [::Integer] + # The value currently in effect and being enforced. + # @!attribute [rw] rollout_info + # @return [::Google::Cloud::CloudQuotas::V1beta::RolloutInfo] + # Rollout information of this quota. + # This field is present only if the effective limit will change due to the + # ongoing rollout of the service config. + class QuotaDetails + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # [Output only] Rollout information of a quota. + # @!attribute [rw] ongoing_rollout + # @return [::Boolean] + # Whether there is an ongoing rollout for a quota or not. + class RolloutInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Enumerations of quota safety checks. + module QuotaSafetyCheck + # Unspecified quota safety check. + QUOTA_SAFETY_CHECK_UNSPECIFIED = 0 + + # Validates that a quota mutation would not cause the consumer's effective + # limit to be lower than the consumer's quota usage. + QUOTA_DECREASE_BELOW_USAGE = 1 + + # Validates that a quota mutation would not cause the consumer's effective + # limit to decrease by more than 10 percent. + QUOTA_DECREASE_PERCENTAGE_TOO_HIGH = 2 + end + end + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/field_behavior.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/field_behavior.rb new file mode 100644 index 000000000000..fb9115c630af --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/field_behavior.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # An indicator of the behavior of a given field (for example, that a field + # is required in requests, or given as output but ignored as input). + # This **does not** change the behavior in protocol buffers itself; it only + # denotes the behavior and may affect how API tooling handles the field. + # + # Note: This enum **may** receive new values in the future. + module FieldBehavior + # Conventional default for enums. Do not use this. + FIELD_BEHAVIOR_UNSPECIFIED = 0 + + # Specifically denotes a field as optional. + # While all fields in protocol buffers are optional, this may be specified + # for emphasis if appropriate. + OPTIONAL = 1 + + # Denotes a field as required. + # This indicates that the field **must** be provided as part of the request, + # and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + REQUIRED = 2 + + # Denotes a field as output only. + # This indicates that the field is provided in responses, but including the + # field in a request does nothing (the server *must* ignore it and + # *must not* throw an error as a result of the field's presence). + OUTPUT_ONLY = 3 + + # Denotes a field as input only. + # This indicates that the field is provided in requests, and the + # corresponding field is not included in output. + INPUT_ONLY = 4 + + # Denotes a field as immutable. + # This indicates that the field may be set once in a request to create a + # resource, but may not be changed thereafter. + IMMUTABLE = 5 + + # Denotes that a (repeated) field is an unordered list. + # This indicates that the service may provide the elements of the list + # in any arbitrary order, rather than the order the user originally + # provided. Additionally, the list's order may or may not be stable. + UNORDERED_LIST = 6 + + # Denotes that this field returns a non-empty default value if not set. + # This indicates that if the user provides the empty value in a request, + # a non-empty value will be returned. The user will not be aware of what + # non-empty value to expect. + NON_EMPTY_DEFAULT = 7 + + # Denotes that the field in a resource (a message annotated with + # google.api.resource) is used in the resource name to uniquely identify the + # resource. For AIP-compliant APIs, this should only be applied to the + # `name` field on the resource. + # + # This behavior should not be applied to references to other resources within + # the message. + # + # The identifier field of resources often have different field behavior + # depending on the request it is embedded in (e.g. for Create methods name + # is optional and unused, while for Update methods it is required). Instead + # of method-specific annotations, only `IDENTIFIER` is required. + IDENTIFIER = 8 + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/launch_stage.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/launch_stage.rb new file mode 100644 index 000000000000..b836bdb60b21 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/launch_stage.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # The launch stage as defined by [Google Cloud Platform + # Launch Stages](https://cloud.google.com/terms/launch-stages). + module LaunchStage + # Do not use this default value. + LAUNCH_STAGE_UNSPECIFIED = 0 + + # The feature is not yet implemented. Users can not use it. + UNIMPLEMENTED = 6 + + # Prelaunch features are hidden from users and are only visible internally. + PRELAUNCH = 7 + + # Early Access features are limited to a closed group of testers. To use + # these features, you must sign up in advance and sign a Trusted Tester + # agreement (which includes confidentiality provisions). These features may + # be unstable, changed in backward-incompatible ways, and are not + # guaranteed to be released. + EARLY_ACCESS = 1 + + # Alpha is a limited availability test for releases before they are cleared + # for widespread use. By Alpha, all significant design issues are resolved + # and we are in the process of verifying functionality. Alpha customers + # need to apply for access, agree to applicable terms, and have their + # projects allowlisted. Alpha releases don't have to be feature complete, + # no SLAs are provided, and there are no technical support obligations, but + # they will be far enough along that customers can actually use them in + # test environments or for limited-use tests -- just like they would in + # normal production cases. + ALPHA = 2 + + # Beta is the point at which we are ready to open a release for any + # customer to use. There are no SLA or technical support obligations in a + # Beta release. Products will be complete from a feature perspective, but + # may have some open outstanding issues. Beta releases are suitable for + # limited production use cases. + BETA = 3 + + # GA features are open to all developers and are considered stable and + # fully qualified for production use. + GA = 4 + + # Deprecated features are scheduled to be shut down and removed. For more + # information, see the "Deprecation Policy" section of our [Terms of + # Service](https://cloud.google.com/terms/) + # and the [Google Cloud Platform Subject to the Deprecation + # Policy](https://cloud.google.com/terms/deprecation) documentation. + DEPRECATED = 5 + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/resource.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/resource.rb new file mode 100644 index 000000000000..71b994c7ef20 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/api/resource.rb @@ -0,0 +1,227 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # A simple descriptor of a resource type. + # + # ResourceDescriptor annotates a resource message (either by means of a + # protobuf annotation or use in the service config), and associates the + # resource's schema, the resource type, and the pattern of the resource name. + # + # Example: + # + # message Topic { + # // Indicates this message defines a resource schema. + # // Declares the resource type in the format of {service}/{kind}. + # // For Kubernetes resources, the format is {api group}/{kind}. + # option (google.api.resource) = { + # type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # + # Sometimes, resources have multiple patterns, typically because they can + # live under multiple parents. + # + # Example: + # + # message LogEntry { + # option (google.api.resource) = { + # type: "logging.googleapis.com/LogEntry" + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: 'logging.googleapis.com/LogEntry' + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # @!attribute [rw] type + # @return [::String] + # The resource type. It must be in the format of + # \\{service_name}/\\{resource_type_kind}. The `resource_type_kind` must be + # singular and must not include version numbers. + # + # Example: `storage.googleapis.com/Bucket` + # + # The value of the resource_type_kind must follow the regular expression + # /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + # should use PascalCase (UpperCamelCase). The maximum number of + # characters allowed for the `resource_type_kind` is 100. + # @!attribute [rw] pattern + # @return [::Array<::String>] + # Optional. The relative resource name pattern associated with this resource + # type. The DNS prefix of the full resource name shouldn't be specified here. + # + # The path pattern must follow the syntax, which aligns with HTTP binding + # syntax: + # + # Template = Segment { "/" Segment } ; + # Segment = LITERAL | Variable ; + # Variable = "{" LITERAL "}" ; + # + # Examples: + # + # - "projects/\\{project}/topics/\\{topic}" + # - "projects/\\{project}/knowledgeBases/\\{knowledge_base}" + # + # The components in braces correspond to the IDs for each resource in the + # hierarchy. It is expected that, if multiple patterns are provided, + # the same component name (e.g. "project") refers to IDs of the same + # type of resource. + # @!attribute [rw] name_field + # @return [::String] + # Optional. The field on the resource that designates the resource name + # field. If omitted, this is assumed to be "name". + # @!attribute [rw] history + # @return [::Google::Api::ResourceDescriptor::History] + # Optional. The historical or future-looking state of the resource pattern. + # + # Example: + # + # // The InspectTemplate message originally only supported resource + # // names with organization, and project was added later. + # message InspectTemplate { + # option (google.api.resource) = { + # type: "dlp.googleapis.com/InspectTemplate" + # pattern: + # "organizations/{organization}/inspectTemplates/{inspect_template}" + # pattern: "projects/{project}/inspectTemplates/{inspect_template}" + # history: ORIGINALLY_SINGLE_PATTERN + # }; + # } + # @!attribute [rw] plural + # @return [::String] + # The plural name used in the resource name and permission names, such as + # 'projects' for the resource name of 'projects/\\{project}' and the permission + # name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception + # to this is for Nested Collections that have stuttering names, as defined + # in [AIP-122](https://google.aip.dev/122#nested-collections), where the + # collection ID in the resource name pattern does not necessarily directly + # match the `plural` value. + # + # It is the same concept of the `plural` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # + # Note: The plural form is required even for singleton resources. See + # https://aip.dev/156 + # @!attribute [rw] singular + # @return [::String] + # The same concept of the `singular` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # Such as "project" for the `resourcemanager.googleapis.com/Project` type. + # @!attribute [rw] style + # @return [::Array<::Google::Api::ResourceDescriptor::Style>] + # Style flag(s) for this resource. + # These indicate that a resource is expected to conform to a given + # style. See the specific style flags for additional information. + class ResourceDescriptor + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A description of the historical or future-looking state of the + # resource pattern. + module History + # The "unset" value. + HISTORY_UNSPECIFIED = 0 + + # The resource originally had one pattern and launched as such, and + # additional patterns were added later. + ORIGINALLY_SINGLE_PATTERN = 1 + + # The resource has one pattern, but the API owner expects to add more + # later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + # that from being necessary once there are multiple patterns.) + FUTURE_MULTI_PATTERN = 2 + end + + # A flag representing a specific style that a resource claims to conform to. + module Style + # The unspecified value. Do not use. + STYLE_UNSPECIFIED = 0 + + # This resource is intended to be "declarative-friendly". + # + # Declarative-friendly resources must be more strictly consistent, and + # setting this to true communicates to tools that this resource should + # adhere to declarative-friendly expectations. + # + # Note: This is used by the API linter (linter.aip.dev) to enable + # additional checks. + DECLARATIVE_FRIENDLY = 1 + end + end + + # Defines a proto annotation that describes a string field that refers to + # an API resource. + # @!attribute [rw] type + # @return [::String] + # The resource type that the annotated field references. + # + # Example: + # + # message Subscription { + # string topic = 2 [(google.api.resource_reference) = { + # type: "pubsub.googleapis.com/Topic" + # }]; + # } + # + # Occasionally, a field may reference an arbitrary resource. In this case, + # APIs use the special value * in their resource reference. + # + # Example: + # + # message GetIamPolicyRequest { + # string resource = 2 [(google.api.resource_reference) = { + # type: "*" + # }]; + # } + # @!attribute [rw] child_type + # @return [::String] + # The resource type of a child collection that the annotated field + # references. This is useful for annotating the `parent` field that + # doesn't have a fixed resource type. + # + # Example: + # + # message ListLogEntriesRequest { + # string parent = 1 [(google.api.resource_reference) = { + # child_type: "logging.googleapis.com/LogEntry" + # }; + # } + class ResourceReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/duration.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/duration.rb new file mode 100644 index 000000000000..341efa296c29 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/duration.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Duration represents a signed, fixed-length span of time represented + # as a count of seconds and fractions of seconds at nanosecond + # resolution. It is independent of any calendar and concepts like "day" + # or "month". It is related to Timestamp in that the difference between + # two Timestamp values is a Duration and it can be added or subtracted + # from a Timestamp. Range is approximately +-10,000 years. + # + # # Examples + # + # Example 1: Compute Duration from two Timestamps in pseudo code. + # + # Timestamp start = ...; + # Timestamp end = ...; + # Duration duration = ...; + # + # duration.seconds = end.seconds - start.seconds; + # duration.nanos = end.nanos - start.nanos; + # + # if (duration.seconds < 0 && duration.nanos > 0) { + # duration.seconds += 1; + # duration.nanos -= 1000000000; + # } else if (duration.seconds > 0 && duration.nanos < 0) { + # duration.seconds -= 1; + # duration.nanos += 1000000000; + # } + # + # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + # + # Timestamp start = ...; + # Duration duration = ...; + # Timestamp end = ...; + # + # end.seconds = start.seconds + duration.seconds; + # end.nanos = start.nanos + duration.nanos; + # + # if (end.nanos < 0) { + # end.seconds -= 1; + # end.nanos += 1000000000; + # } else if (end.nanos >= 1000000000) { + # end.seconds += 1; + # end.nanos -= 1000000000; + # } + # + # Example 3: Compute Duration from datetime.timedelta in Python. + # + # td = datetime.timedelta(days=3, minutes=10) + # duration = Duration() + # duration.FromTimedelta(td) + # + # # JSON Mapping + # + # In JSON format, the Duration type is encoded as a string rather than an + # object, where the string ends in the suffix "s" (indicating seconds) and + # is preceded by the number of seconds, with nanoseconds expressed as + # fractional seconds. For example, 3 seconds with 0 nanoseconds should be + # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + # be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + # microsecond should be expressed in JSON format as "3.000001s". + # @!attribute [rw] seconds + # @return [::Integer] + # Signed seconds of the span of time. Must be from -315,576,000,000 + # to +315,576,000,000 inclusive. Note: these bounds are computed from: + # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + # @!attribute [rw] nanos + # @return [::Integer] + # Signed fractions of a second at nanosecond resolution of the span + # of time. Durations less than one second are represented with a 0 + # `seconds` field and a positive or negative `nanos` field. For durations + # of one second or more, a non-zero value for the `nanos` field must be + # of the same sign as the `seconds` field. Must be from -999,999,999 + # to +999,999,999 inclusive. + class Duration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/field_mask.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/field_mask.rb new file mode 100644 index 000000000000..ad3c3ad25f0f --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/field_mask.rb @@ -0,0 +1,229 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # `FieldMask` represents a set of symbolic field paths, for example: + # + # paths: "f.a" + # paths: "f.b.d" + # + # Here `f` represents a field in some root message, `a` and `b` + # fields in the message found in `f`, and `d` a field found in the + # message in `f.b`. + # + # Field masks are used to specify a subset of fields that should be + # returned by a get operation or modified by an update operation. + # Field masks also have a custom JSON encoding (see below). + # + # # Field Masks in Projections + # + # When used in the context of a projection, a response message or + # sub-message is filtered by the API to only contain those fields as + # specified in the mask. For example, if the mask in the previous + # example is applied to a response message as follows: + # + # f { + # a : 22 + # b { + # d : 1 + # x : 2 + # } + # y : 13 + # } + # z: 8 + # + # The result will not contain specific values for fields x,y and z + # (their value will be set to the default, and omitted in proto text + # output): + # + # + # f { + # a : 22 + # b { + # d : 1 + # } + # } + # + # A repeated field is not allowed except at the last position of a + # paths string. + # + # If a FieldMask object is not present in a get operation, the + # operation applies to all fields (as if a FieldMask of all fields + # had been specified). + # + # Note that a field mask does not necessarily apply to the + # top-level response message. In case of a REST get operation, the + # field mask applies directly to the response, but in case of a REST + # list operation, the mask instead applies to each individual message + # in the returned resource list. In case of a REST custom method, + # other definitions may be used. Where the mask applies will be + # clearly documented together with its declaration in the API. In + # any case, the effect on the returned resource/resources is required + # behavior for APIs. + # + # # Field Masks in Update Operations + # + # A field mask in update operations specifies which fields of the + # targeted resource are going to be updated. The API is required + # to only change the values of the fields as specified in the mask + # and leave the others untouched. If a resource is passed in to + # describe the updated values, the API ignores the values of all + # fields not covered by the mask. + # + # If a repeated field is specified for an update operation, new values will + # be appended to the existing repeated field in the target resource. Note that + # a repeated field is only allowed in the last position of a `paths` string. + # + # If a sub-message is specified in the last position of the field mask for an + # update operation, then new value will be merged into the existing sub-message + # in the target resource. + # + # For example, given the target message: + # + # f { + # b { + # d: 1 + # x: 2 + # } + # c: [1] + # } + # + # And an update message: + # + # f { + # b { + # d: 10 + # } + # c: [2] + # } + # + # then if the field mask is: + # + # paths: ["f.b", "f.c"] + # + # then the result will be: + # + # f { + # b { + # d: 10 + # x: 2 + # } + # c: [1, 2] + # } + # + # An implementation may provide options to override this default behavior for + # repeated and message fields. + # + # In order to reset a field's value to the default, the field must + # be in the mask and set to the default value in the provided resource. + # Hence, in order to reset all fields of a resource, provide a default + # instance of the resource and set all fields in the mask, or do + # not provide a mask as described below. + # + # If a field mask is not present on update, the operation applies to + # all fields (as if a field mask of all fields has been specified). + # Note that in the presence of schema evolution, this may mean that + # fields the client does not know and has therefore not filled into + # the request will be reset to their default. If this is unwanted + # behavior, a specific service may require a client to always specify + # a field mask, producing an error if not. + # + # As with get operations, the location of the resource which + # describes the updated values in the request message depends on the + # operation kind. In any case, the effect of the field mask is + # required to be honored by the API. + # + # ## Considerations for HTTP REST + # + # The HTTP kind of an update operation which uses a field mask must + # be set to PATCH instead of PUT in order to satisfy HTTP semantics + # (PUT must only be used for full updates). + # + # # JSON Encoding of Field Masks + # + # In JSON, a field mask is encoded as a single string where paths are + # separated by a comma. Fields name in each path are converted + # to/from lower-camel naming conventions. + # + # As an example, consider the following message declarations: + # + # message Profile { + # User user = 1; + # Photo photo = 2; + # } + # message User { + # string display_name = 1; + # string address = 2; + # } + # + # In proto a field mask for `Profile` may look as such: + # + # mask { + # paths: "user.display_name" + # paths: "photo" + # } + # + # In JSON, the same mask is represented as below: + # + # { + # mask: "user.displayName,photo" + # } + # + # # Field Masks and Oneof Fields + # + # Field masks treat fields in oneofs just as regular fields. Consider the + # following message: + # + # message SampleMessage { + # oneof test_oneof { + # string name = 4; + # SubMessage sub_message = 9; + # } + # } + # + # The field mask can be: + # + # mask { + # paths: "name" + # } + # + # Or: + # + # mask { + # paths: "sub_message" + # } + # + # Note that oneof type names ("test_oneof" in this case) cannot be used in + # paths. + # + # ## Field Mask Verification + # + # The implementation of any API method which has a FieldMask type field in the + # request should verify the included field paths, and return an + # `INVALID_ARGUMENT` error if any path is unmappable. + # @!attribute [rw] paths + # @return [::Array<::String>] + # The set of field mask paths. + class FieldMask + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/timestamp.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/timestamp.rb new file mode 100644 index 000000000000..a005f395ccab --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/timestamp.rb @@ -0,0 +1,127 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Timestamp represents a point in time independent of any time zone or local + # calendar, encoded as a count of seconds and fractions of seconds at + # nanosecond resolution. The count is relative to an epoch at UTC midnight on + # January 1, 1970, in the proleptic Gregorian calendar which extends the + # Gregorian calendar backwards to year one. + # + # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + # second table is needed for interpretation, using a [24-hour linear + # smear](https://developers.google.com/time/smear). + # + # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + # restricting to that range, we ensure that we can convert to and from [RFC + # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + # + # # Examples + # + # Example 1: Compute Timestamp from POSIX `time()`. + # + # Timestamp timestamp; + # timestamp.set_seconds(time(NULL)); + # timestamp.set_nanos(0); + # + # Example 2: Compute Timestamp from POSIX `gettimeofday()`. + # + # struct timeval tv; + # gettimeofday(&tv, NULL); + # + # Timestamp timestamp; + # timestamp.set_seconds(tv.tv_sec); + # timestamp.set_nanos(tv.tv_usec * 1000); + # + # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + # + # FILETIME ft; + # GetSystemTimeAsFileTime(&ft); + # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + # + # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + # Timestamp timestamp; + # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + # + # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + # + # long millis = System.currentTimeMillis(); + # + # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + # .setNanos((int) ((millis % 1000) * 1000000)).build(); + # + # Example 5: Compute Timestamp from Java `Instant.now()`. + # + # Instant now = Instant.now(); + # + # Timestamp timestamp = + # Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + # .setNanos(now.getNano()).build(); + # + # Example 6: Compute Timestamp from current time in Python. + # + # timestamp = Timestamp() + # timestamp.GetCurrentTime() + # + # # JSON Mapping + # + # In JSON format, the Timestamp type is encoded as a string in the + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z" + # where \\{year} is always expressed using four digits while \\{month}, \\{day}, + # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional + # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + # is required. A proto3 JSON serializer should always use UTC (as indicated by + # "Z") when printing the Timestamp type and a proto3 JSON parser should be + # able to accept both UTC and other timezones (as indicated by an offset). + # + # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + # 01:30 UTC on January 15, 2017. + # + # In JavaScript, one can convert a Date object to this format using the + # standard + # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + # method. In Python, a standard `datetime.datetime` object can be converted + # to this format using + # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + # the Joda Time's [`ISODateTimeFormat.dateTime()`]( + # http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + # ) to obtain a formatter capable of generating timestamps in this format. + # @!attribute [rw] seconds + # @return [::Integer] + # Represents seconds of UTC time since Unix epoch + # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + # 9999-12-31T23:59:59Z inclusive. + # @!attribute [rw] nanos + # @return [::Integer] + # Non-negative fractions of a second at nanosecond resolution. Negative + # second values with fractions must still have non-negative nanos values + # that count forward in time. Must be from 0 to 999,999,999 + # inclusive. + class Timestamp + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/wrappers.rb b/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/wrappers.rb new file mode 100644 index 000000000000..54bd4318d321 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/proto_docs/google/protobuf/wrappers.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # Wrapper message for `double`. + # + # The JSON representation for `DoubleValue` is JSON number. + # @!attribute [rw] value + # @return [::Float] + # The double value. + class DoubleValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `float`. + # + # The JSON representation for `FloatValue` is JSON number. + # @!attribute [rw] value + # @return [::Float] + # The float value. + class FloatValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `int64`. + # + # The JSON representation for `Int64Value` is JSON string. + # @!attribute [rw] value + # @return [::Integer] + # The int64 value. + class Int64Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `uint64`. + # + # The JSON representation for `UInt64Value` is JSON string. + # @!attribute [rw] value + # @return [::Integer] + # The uint64 value. + class UInt64Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `int32`. + # + # The JSON representation for `Int32Value` is JSON number. + # @!attribute [rw] value + # @return [::Integer] + # The int32 value. + class Int32Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `uint32`. + # + # The JSON representation for `UInt32Value` is JSON number. + # @!attribute [rw] value + # @return [::Integer] + # The uint32 value. + class UInt32Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `bool`. + # + # The JSON representation for `BoolValue` is JSON `true` and `false`. + # @!attribute [rw] value + # @return [::Boolean] + # The bool value. + class BoolValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `string`. + # + # The JSON representation for `StringValue` is JSON string. + # @!attribute [rw] value + # @return [::String] + # The string value. + class StringValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `bytes`. + # + # The JSON representation for `BytesValue` is JSON string. + # @!attribute [rw] value + # @return [::String] + # The bytes value. + class BytesValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/snippets/Gemfile b/google-cloud-cloud_quotas-v1beta/snippets/Gemfile new file mode 100644 index 000000000000..1db9e27cdb35 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/snippets/Gemfile @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +source "https://rubygems.org" + +if ENV["GOOGLE_CLOUD_SAMPLES_TEST"] == "master" + gem "google-cloud-cloud_quotas-v1beta", path: "../" +else + gem "google-cloud-cloud_quotas-v1beta" +end + +group :test do + gem "google-style", "~> 1.26.1" + gem "minitest", "~> 5.16" + gem "minitest-focus", "~> 1.1" + gem "minitest-hooks", "~> 1.5" +end diff --git a/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/create_quota_preference.rb b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/create_quota_preference.rb new file mode 100644 index 000000000000..0eb5db37d09c --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/create_quota_preference.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START cloudquotas_v1beta_generated_CloudQuotas_CreateQuotaPreference_sync] +require "google/cloud/cloud_quotas/v1beta" + +## +# Snippet for the create_quota_preference call in the CloudQuotas service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#create_quota_preference. +# +def create_quota_preference + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest.new + + # Call the create_quota_preference method. + result = client.create_quota_preference request + + # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + p result +end +# [END cloudquotas_v1beta_generated_CloudQuotas_CreateQuotaPreference_sync] diff --git a/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/get_quota_info.rb b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/get_quota_info.rb new file mode 100644 index 000000000000..5f190db4a6ab --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/get_quota_info.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START cloudquotas_v1beta_generated_CloudQuotas_GetQuotaInfo_sync] +require "google/cloud/cloud_quotas/v1beta" + +## +# Snippet for the get_quota_info call in the CloudQuotas service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#get_quota_info. +# +def get_quota_info + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest.new + + # Call the get_quota_info method. + result = client.get_quota_info request + + # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaInfo. + p result +end +# [END cloudquotas_v1beta_generated_CloudQuotas_GetQuotaInfo_sync] diff --git a/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/get_quota_preference.rb b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/get_quota_preference.rb new file mode 100644 index 000000000000..60cfaaa971b3 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/get_quota_preference.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START cloudquotas_v1beta_generated_CloudQuotas_GetQuotaPreference_sync] +require "google/cloud/cloud_quotas/v1beta" + +## +# Snippet for the get_quota_preference call in the CloudQuotas service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#get_quota_preference. +# +def get_quota_preference + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest.new + + # Call the get_quota_preference method. + result = client.get_quota_preference request + + # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + p result +end +# [END cloudquotas_v1beta_generated_CloudQuotas_GetQuotaPreference_sync] diff --git a/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/list_quota_infos.rb b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/list_quota_infos.rb new file mode 100644 index 000000000000..85c6770a82ae --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/list_quota_infos.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START cloudquotas_v1beta_generated_CloudQuotas_ListQuotaInfos_sync] +require "google/cloud/cloud_quotas/v1beta" + +## +# Snippet for the list_quota_infos call in the CloudQuotas service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#list_quota_infos. +# +def list_quota_infos + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest.new + + # Call the list_quota_infos method. + result = client.list_quota_infos request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::CloudQuotas::V1beta::QuotaInfo. + p item + end +end +# [END cloudquotas_v1beta_generated_CloudQuotas_ListQuotaInfos_sync] diff --git a/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/list_quota_preferences.rb b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/list_quota_preferences.rb new file mode 100644 index 000000000000..3a31e152014d --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/list_quota_preferences.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START cloudquotas_v1beta_generated_CloudQuotas_ListQuotaPreferences_sync] +require "google/cloud/cloud_quotas/v1beta" + +## +# Snippet for the list_quota_preferences call in the CloudQuotas service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#list_quota_preferences. +# +def list_quota_preferences + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest.new + + # Call the list_quota_preferences method. + result = client.list_quota_preferences request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + p item + end +end +# [END cloudquotas_v1beta_generated_CloudQuotas_ListQuotaPreferences_sync] diff --git a/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/update_quota_preference.rb b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/update_quota_preference.rb new file mode 100644 index 000000000000..97265c2e3b17 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/snippets/cloud_quotas/update_quota_preference.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START cloudquotas_v1beta_generated_CloudQuotas_UpdateQuotaPreference_sync] +require "google/cloud/cloud_quotas/v1beta" + +## +# Snippet for the update_quota_preference call in the CloudQuotas service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#update_quota_preference. +# +def update_quota_preference + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest.new + + # Call the update_quota_preference method. + result = client.update_quota_preference request + + # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaPreference. + p result +end +# [END cloudquotas_v1beta_generated_CloudQuotas_UpdateQuotaPreference_sync] diff --git a/google-cloud-cloud_quotas-v1beta/snippets/quota_adjuster_settings_manager/get_quota_adjuster_settings.rb b/google-cloud-cloud_quotas-v1beta/snippets/quota_adjuster_settings_manager/get_quota_adjuster_settings.rb new file mode 100644 index 000000000000..66284869a444 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/snippets/quota_adjuster_settings_manager/get_quota_adjuster_settings.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_GetQuotaAdjusterSettings_sync] +require "google/cloud/cloud_quotas/v1beta" + +## +# Snippet for the get_quota_adjuster_settings call in the QuotaAdjusterSettingsManager service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client#get_quota_adjuster_settings. +# +def get_quota_adjuster_settings + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest.new + + # Call the get_quota_adjuster_settings method. + result = client.get_quota_adjuster_settings request + + # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings. + p result +end +# [END cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_GetQuotaAdjusterSettings_sync] diff --git a/google-cloud-cloud_quotas-v1beta/snippets/quota_adjuster_settings_manager/update_quota_adjuster_settings.rb b/google-cloud-cloud_quotas-v1beta/snippets/quota_adjuster_settings_manager/update_quota_adjuster_settings.rb new file mode 100644 index 000000000000..112372b7eb76 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/snippets/quota_adjuster_settings_manager/update_quota_adjuster_settings.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_UpdateQuotaAdjusterSettings_sync] +require "google/cloud/cloud_quotas/v1beta" + +## +# Snippet for the update_quota_adjuster_settings call in the QuotaAdjusterSettingsManager service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client#update_quota_adjuster_settings. +# +def update_quota_adjuster_settings + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest.new + + # Call the update_quota_adjuster_settings method. + result = client.update_quota_adjuster_settings request + + # The returned object is of type Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings. + p result +end +# [END cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_UpdateQuotaAdjusterSettings_sync] diff --git a/google-cloud-cloud_quotas-v1beta/snippets/snippet_metadata_google.api.cloudquotas.v1beta.json b/google-cloud-cloud_quotas-v1beta/snippets/snippet_metadata_google.api.cloudquotas.v1beta.json new file mode 100644 index 000000000000..af9805e6916c --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/snippets/snippet_metadata_google.api.cloudquotas.v1beta.json @@ -0,0 +1,335 @@ +{ + "client_library": { + "name": "google-cloud-cloud_quotas-v1beta", + "version": "", + "language": "RUBY", + "apis": [ + { + "id": "google.api.cloudquotas.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "region_tag": "cloudquotas_v1beta_generated_CloudQuotas_ListQuotaInfos_sync", + "title": "Snippet for the list_quota_infos call in the CloudQuotas service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#list_quota_infos.", + "file": "cloud_quotas/list_quota_infos.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_quota_infos", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#list_quota_infos", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosResponse", + "client": { + "short_name": "CloudQuotas::Client", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client" + }, + "method": { + "short_name": "ListQuotaInfos", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas.ListQuotaInfos", + "service": { + "short_name": "CloudQuotas", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "cloudquotas_v1beta_generated_CloudQuotas_GetQuotaInfo_sync", + "title": "Snippet for the get_quota_info call in the CloudQuotas service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#get_quota_info.", + "file": "cloud_quotas/get_quota_info.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_quota_info", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#get_quota_info", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::CloudQuotas::V1beta::QuotaInfo", + "client": { + "short_name": "CloudQuotas::Client", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client" + }, + "method": { + "short_name": "GetQuotaInfo", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas.GetQuotaInfo", + "service": { + "short_name": "CloudQuotas", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "cloudquotas_v1beta_generated_CloudQuotas_ListQuotaPreferences_sync", + "title": "Snippet for the list_quota_preferences call in the CloudQuotas service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#list_quota_preferences.", + "file": "cloud_quotas/list_quota_preferences.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_quota_preferences", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#list_quota_preferences", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesResponse", + "client": { + "short_name": "CloudQuotas::Client", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client" + }, + "method": { + "short_name": "ListQuotaPreferences", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas.ListQuotaPreferences", + "service": { + "short_name": "CloudQuotas", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "cloudquotas_v1beta_generated_CloudQuotas_GetQuotaPreference_sync", + "title": "Snippet for the get_quota_preference call in the CloudQuotas service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#get_quota_preference.", + "file": "cloud_quotas/get_quota_preference.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_quota_preference", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#get_quota_preference", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::CloudQuotas::V1beta::QuotaPreference", + "client": { + "short_name": "CloudQuotas::Client", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client" + }, + "method": { + "short_name": "GetQuotaPreference", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas.GetQuotaPreference", + "service": { + "short_name": "CloudQuotas", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "cloudquotas_v1beta_generated_CloudQuotas_CreateQuotaPreference_sync", + "title": "Snippet for the create_quota_preference call in the CloudQuotas service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#create_quota_preference.", + "file": "cloud_quotas/create_quota_preference.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_quota_preference", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#create_quota_preference", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::CloudQuotas::V1beta::QuotaPreference", + "client": { + "short_name": "CloudQuotas::Client", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client" + }, + "method": { + "short_name": "CreateQuotaPreference", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas.CreateQuotaPreference", + "service": { + "short_name": "CloudQuotas", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "cloudquotas_v1beta_generated_CloudQuotas_UpdateQuotaPreference_sync", + "title": "Snippet for the update_quota_preference call in the CloudQuotas service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#update_quota_preference.", + "file": "cloud_quotas/update_quota_preference.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_quota_preference", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client#update_quota_preference", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::CloudQuotas::V1beta::QuotaPreference", + "client": { + "short_name": "CloudQuotas::Client", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client" + }, + "method": { + "short_name": "UpdateQuotaPreference", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas.UpdateQuotaPreference", + "service": { + "short_name": "CloudQuotas", + "full_name": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_UpdateQuotaAdjusterSettings_sync", + "title": "Snippet for the update_quota_adjuster_settings call in the QuotaAdjusterSettingsManager service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client#update_quota_adjuster_settings.", + "file": "quota_adjuster_settings_manager/update_quota_adjuster_settings.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_quota_adjuster_settings", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client#update_quota_adjuster_settings", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings", + "client": { + "short_name": "QuotaAdjusterSettingsManager::Client", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client" + }, + "method": { + "short_name": "UpdateQuotaAdjusterSettings", + "full_name": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager.UpdateQuotaAdjusterSettings", + "service": { + "short_name": "QuotaAdjusterSettingsManager", + "full_name": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_GetQuotaAdjusterSettings_sync", + "title": "Snippet for the get_quota_adjuster_settings call in the QuotaAdjusterSettingsManager service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client#get_quota_adjuster_settings.", + "file": "quota_adjuster_settings_manager/get_quota_adjuster_settings.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_quota_adjuster_settings", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client#get_quota_adjuster_settings", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings", + "client": { + "short_name": "QuotaAdjusterSettingsManager::Client", + "full_name": "::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client" + }, + "method": { + "short_name": "GetQuotaAdjusterSettings", + "full_name": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager.GetQuotaAdjusterSettings", + "service": { + "short_name": "QuotaAdjusterSettingsManager", + "full_name": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + } + ] +} \ No newline at end of file diff --git a/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/cloud_quotas_paths_test.rb b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/cloud_quotas_paths_test.rb new file mode 100644 index 000000000000..288f0c48db74 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/cloud_quotas_paths_test.rb @@ -0,0 +1,115 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/cloud_quotas/v1beta/cloud_quotas" + +class ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_location_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.location_path project: "value0", location: "value1" + assert_equal "projects/value0/locations/value1", path + + path = client.location_path folder: "value0", location: "value1" + assert_equal "folders/value0/locations/value1", path + + path = client.location_path organization: "value0", location: "value1" + assert_equal "organizations/value0/locations/value1", path + end + end + + def test_quota_info_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.quota_info_path project: "value0", location: "value1", service: "value2", quota_info: "value3" + assert_equal "projects/value0/locations/value1/services/value2/quotaInfos/value3", path + + path = client.quota_info_path folder: "value0", location: "value1", service: "value2", quota_info: "value3" + assert_equal "folders/value0/locations/value1/services/value2/quotaInfos/value3", path + + path = client.quota_info_path organization: "value0", location: "value1", service: "value2", quota_info: "value3" + assert_equal "organizations/value0/locations/value1/services/value2/quotaInfos/value3", path + end + end + + def test_quota_preference_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.quota_preference_path project: "value0", location: "value1", quota_preference: "value2" + assert_equal "projects/value0/locations/value1/quotaPreferences/value2", path + + path = client.quota_preference_path folder: "value0", location: "value1", quota_preference: "value2" + assert_equal "folders/value0/locations/value1/quotaPreferences/value2", path + + path = client.quota_preference_path organization: "value0", location: "value1", quota_preference: "value2" + assert_equal "organizations/value0/locations/value1/quotaPreferences/value2", path + end + end + + def test_service_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.service_path project: "value0", location: "value1", service: "value2" + assert_equal "projects/value0/locations/value1/services/value2", path + + path = client.service_path folder: "value0", location: "value1", service: "value2" + assert_equal "folders/value0/locations/value1/services/value2", path + + path = client.service_path organization: "value0", location: "value1", service: "value2" + assert_equal "organizations/value0/locations/value1/services/value2", path + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/cloud_quotas_rest_test.rb b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/cloud_quotas_rest_test.rb new file mode 100644 index 000000000000..4ef07d256de3 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/cloud_quotas_rest_test.rb @@ -0,0 +1,436 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/api/cloudquotas/v1beta/cloudquotas_pb" +require "google/cloud/cloud_quotas/v1beta/cloud_quotas/rest" + + +class ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list_quota_infos + # Create test objects. + client_result = ::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_quota_infos_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::ServiceStub.stub :transcode_list_quota_infos_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_quota_infos_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_quota_infos({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_quota_infos parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_quota_infos ::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_quota_infos({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_quota_infos(::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_quota_infos_client_stub.call_count + end + end + end + + def test_get_quota_info + # Create test objects. + client_result = ::Google::Cloud::CloudQuotas::V1beta::QuotaInfo.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_quota_info_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::ServiceStub.stub :transcode_get_quota_info_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_quota_info_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_quota_info({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_quota_info name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_quota_info ::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_quota_info({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_quota_info(::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_quota_info_client_stub.call_count + end + end + end + + def test_list_quota_preferences + # Create test objects. + client_result = ::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_quota_preferences_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::ServiceStub.stub :transcode_list_quota_preferences_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_quota_preferences_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_quota_preferences({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_quota_preferences parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_quota_preferences ::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_quota_preferences({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_quota_preferences(::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_quota_preferences_client_stub.call_count + end + end + end + + def test_get_quota_preference + # Create test objects. + client_result = ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_quota_preference_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::ServiceStub.stub :transcode_get_quota_preference_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_quota_preference_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_quota_preference({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_quota_preference name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_quota_preference ::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_quota_preference({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_quota_preference(::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_quota_preference_client_stub.call_count + end + end + end + + def test_create_quota_preference + # Create test objects. + client_result = ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + quota_preference_id = "hello world" + quota_preference = {} + ignore_safety_checks = [:QUOTA_SAFETY_CHECK_UNSPECIFIED] + + create_quota_preference_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::ServiceStub.stub :transcode_create_quota_preference_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_quota_preference_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_quota_preference({ parent: parent, quota_preference_id: quota_preference_id, quota_preference: quota_preference, ignore_safety_checks: ignore_safety_checks }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_quota_preference parent: parent, quota_preference_id: quota_preference_id, quota_preference: quota_preference, ignore_safety_checks: ignore_safety_checks do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_quota_preference ::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest.new(parent: parent, quota_preference_id: quota_preference_id, quota_preference: quota_preference, ignore_safety_checks: ignore_safety_checks) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_quota_preference({ parent: parent, quota_preference_id: quota_preference_id, quota_preference: quota_preference, ignore_safety_checks: ignore_safety_checks }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_quota_preference(::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest.new(parent: parent, quota_preference_id: quota_preference_id, quota_preference: quota_preference, ignore_safety_checks: ignore_safety_checks), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_quota_preference_client_stub.call_count + end + end + end + + def test_update_quota_preference + # Create test objects. + client_result = ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + update_mask = {} + quota_preference = {} + allow_missing = true + validate_only = true + ignore_safety_checks = [:QUOTA_SAFETY_CHECK_UNSPECIFIED] + + update_quota_preference_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::ServiceStub.stub :transcode_update_quota_preference_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_quota_preference_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.update_quota_preference({ update_mask: update_mask, quota_preference: quota_preference, allow_missing: allow_missing, validate_only: validate_only, ignore_safety_checks: ignore_safety_checks }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.update_quota_preference update_mask: update_mask, quota_preference: quota_preference, allow_missing: allow_missing, validate_only: validate_only, ignore_safety_checks: ignore_safety_checks do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.update_quota_preference ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest.new(update_mask: update_mask, quota_preference: quota_preference, allow_missing: allow_missing, validate_only: validate_only, ignore_safety_checks: ignore_safety_checks) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.update_quota_preference({ update_mask: update_mask, quota_preference: quota_preference, allow_missing: allow_missing, validate_only: validate_only, ignore_safety_checks: ignore_safety_checks }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.update_quota_preference(::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest.new(update_mask: update_mask, quota_preference: quota_preference, allow_missing: allow_missing, validate_only: validate_only, ignore_safety_checks: ignore_safety_checks), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_quota_preference_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/cloud_quotas_test.rb b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/cloud_quotas_test.rb new file mode 100644 index 000000000000..335f4c8e3cfa --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/cloud_quotas_test.rb @@ -0,0 +1,469 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/api/cloudquotas/v1beta/cloudquotas_pb" +require "google/api/cloudquotas/v1beta/cloudquotas_services_pb" +require "google/cloud/cloud_quotas/v1beta/cloud_quotas" + +class ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list_quota_infos + # Create GRPC objects. + grpc_response = ::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_quota_infos_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_quota_infos, name + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_quota_infos_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_quota_infos({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_quota_infos parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_quota_infos ::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_quota_infos({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_quota_infos(::Google::Cloud::CloudQuotas::V1beta::ListQuotaInfosRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_quota_infos_client_stub.call_rpc_count + end + end + + def test_get_quota_info + # Create GRPC objects. + grpc_response = ::Google::Cloud::CloudQuotas::V1beta::QuotaInfo.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_quota_info_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_quota_info, name + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_quota_info_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_quota_info({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_quota_info name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_quota_info ::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_quota_info({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_quota_info(::Google::Cloud::CloudQuotas::V1beta::GetQuotaInfoRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_quota_info_client_stub.call_rpc_count + end + end + + def test_list_quota_preferences + # Create GRPC objects. + grpc_response = ::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_quota_preferences_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_quota_preferences, name + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + assert_equal "hello world", request["order_by"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_quota_preferences_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_quota_preferences({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_quota_preferences parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_quota_preferences ::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_quota_preferences({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_quota_preferences(::Google::Cloud::CloudQuotas::V1beta::ListQuotaPreferencesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_quota_preferences_client_stub.call_rpc_count + end + end + + def test_get_quota_preference + # Create GRPC objects. + grpc_response = ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_quota_preference_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_quota_preference, name + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_quota_preference_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_quota_preference({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_quota_preference name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_quota_preference ::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_quota_preference({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_quota_preference(::Google::Cloud::CloudQuotas::V1beta::GetQuotaPreferenceRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_quota_preference_client_stub.call_rpc_count + end + end + + def test_create_quota_preference + # Create GRPC objects. + grpc_response = ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + quota_preference_id = "hello world" + quota_preference = {} + ignore_safety_checks = [:QUOTA_SAFETY_CHECK_UNSPECIFIED] + + create_quota_preference_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_quota_preference, name + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["quota_preference_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference), request["quota_preference"] + assert_equal [:QUOTA_SAFETY_CHECK_UNSPECIFIED], request["ignore_safety_checks"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_quota_preference_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_quota_preference({ parent: parent, quota_preference_id: quota_preference_id, quota_preference: quota_preference, ignore_safety_checks: ignore_safety_checks }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_quota_preference parent: parent, quota_preference_id: quota_preference_id, quota_preference: quota_preference, ignore_safety_checks: ignore_safety_checks do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_quota_preference ::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest.new(parent: parent, quota_preference_id: quota_preference_id, quota_preference: quota_preference, ignore_safety_checks: ignore_safety_checks) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_quota_preference({ parent: parent, quota_preference_id: quota_preference_id, quota_preference: quota_preference, ignore_safety_checks: ignore_safety_checks }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_quota_preference(::Google::Cloud::CloudQuotas::V1beta::CreateQuotaPreferenceRequest.new(parent: parent, quota_preference_id: quota_preference_id, quota_preference: quota_preference, ignore_safety_checks: ignore_safety_checks), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_quota_preference_client_stub.call_rpc_count + end + end + + def test_update_quota_preference + # Create GRPC objects. + grpc_response = ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + update_mask = {} + quota_preference = {} + allow_missing = true + validate_only = true + ignore_safety_checks = [:QUOTA_SAFETY_CHECK_UNSPECIFIED] + + update_quota_preference_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_quota_preference, name + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::CloudQuotas::V1beta::QuotaPreference), request["quota_preference"] + assert_equal true, request["allow_missing"] + assert_equal true, request["validate_only"] + assert_equal [:QUOTA_SAFETY_CHECK_UNSPECIFIED], request["ignore_safety_checks"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_quota_preference_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.update_quota_preference({ update_mask: update_mask, quota_preference: quota_preference, allow_missing: allow_missing, validate_only: validate_only, ignore_safety_checks: ignore_safety_checks }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.update_quota_preference update_mask: update_mask, quota_preference: quota_preference, allow_missing: allow_missing, validate_only: validate_only, ignore_safety_checks: ignore_safety_checks do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.update_quota_preference ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest.new(update_mask: update_mask, quota_preference: quota_preference, allow_missing: allow_missing, validate_only: validate_only, ignore_safety_checks: ignore_safety_checks) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.update_quota_preference({ update_mask: update_mask, quota_preference: quota_preference, allow_missing: allow_missing, validate_only: validate_only, ignore_safety_checks: ignore_safety_checks }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.update_quota_preference(::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaPreferenceRequest.new(update_mask: update_mask, quota_preference: quota_preference, allow_missing: allow_missing, validate_only: validate_only, ignore_safety_checks: ignore_safety_checks), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_quota_preference_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::CloudQuotas::Client::Configuration, config + end +end diff --git a/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_paths_test.rb b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_paths_test.rb new file mode 100644 index 000000000000..93039c8551c7 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_paths_test.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager" + +class ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_quota_adjuster_settings_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.quota_adjuster_settings_path project: "value0", location: "value1" + assert_equal "projects/value0/locations/value1/quotaAdjusterSettings", path + end + end +end diff --git a/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_rest_test.rb b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_rest_test.rb new file mode 100644 index 000000000000..9c108afffb15 --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_rest_test.rb @@ -0,0 +1,209 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/api/cloudquotas/v1beta/quota_adjuster_settings_pb" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager/rest" + + +class ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_update_quota_adjuster_settings + # Create test objects. + client_result = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + quota_adjuster_settings = {} + update_mask = {} + validate_only = true + + update_quota_adjuster_settings_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::ServiceStub.stub :transcode_update_quota_adjuster_settings_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_quota_adjuster_settings_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.update_quota_adjuster_settings({ quota_adjuster_settings: quota_adjuster_settings, update_mask: update_mask, validate_only: validate_only }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.update_quota_adjuster_settings quota_adjuster_settings: quota_adjuster_settings, update_mask: update_mask, validate_only: validate_only do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.update_quota_adjuster_settings ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest.new(quota_adjuster_settings: quota_adjuster_settings, update_mask: update_mask, validate_only: validate_only) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.update_quota_adjuster_settings({ quota_adjuster_settings: quota_adjuster_settings, update_mask: update_mask, validate_only: validate_only }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.update_quota_adjuster_settings(::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest.new(quota_adjuster_settings: quota_adjuster_settings, update_mask: update_mask, validate_only: validate_only), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_quota_adjuster_settings_client_stub.call_count + end + end + end + + def test_get_quota_adjuster_settings + # Create test objects. + client_result = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_quota_adjuster_settings_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::ServiceStub.stub :transcode_get_quota_adjuster_settings_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_quota_adjuster_settings_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_quota_adjuster_settings({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_quota_adjuster_settings name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_quota_adjuster_settings ::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_quota_adjuster_settings({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_quota_adjuster_settings(::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_quota_adjuster_settings_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_test.rb b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_test.rb new file mode 100644 index 000000000000..35438d2f639b --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/test/google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager_test.rb @@ -0,0 +1,205 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/api/cloudquotas/v1beta/quota_adjuster_settings_pb" +require "google/api/cloudquotas/v1beta/quota_adjuster_settings_services_pb" +require "google/cloud/cloud_quotas/v1beta/quota_adjuster_settings_manager" + +class ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_update_quota_adjuster_settings + # Create GRPC objects. + grpc_response = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + quota_adjuster_settings = {} + update_mask = {} + validate_only = true + + update_quota_adjuster_settings_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_quota_adjuster_settings, name + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings), request["quota_adjuster_settings"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + assert_equal true, request["validate_only"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_quota_adjuster_settings_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.update_quota_adjuster_settings({ quota_adjuster_settings: quota_adjuster_settings, update_mask: update_mask, validate_only: validate_only }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.update_quota_adjuster_settings quota_adjuster_settings: quota_adjuster_settings, update_mask: update_mask, validate_only: validate_only do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.update_quota_adjuster_settings ::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest.new(quota_adjuster_settings: quota_adjuster_settings, update_mask: update_mask, validate_only: validate_only) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.update_quota_adjuster_settings({ quota_adjuster_settings: quota_adjuster_settings, update_mask: update_mask, validate_only: validate_only }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.update_quota_adjuster_settings(::Google::Cloud::CloudQuotas::V1beta::UpdateQuotaAdjusterSettingsRequest.new(quota_adjuster_settings: quota_adjuster_settings, update_mask: update_mask, validate_only: validate_only), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_quota_adjuster_settings_client_stub.call_rpc_count + end + end + + def test_get_quota_adjuster_settings + # Create GRPC objects. + grpc_response = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettings.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_quota_adjuster_settings_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_quota_adjuster_settings, name + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_quota_adjuster_settings_client_stub do + # Create client + client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_quota_adjuster_settings({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_quota_adjuster_settings name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_quota_adjuster_settings ::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_quota_adjuster_settings({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_quota_adjuster_settings(::Google::Cloud::CloudQuotas::V1beta::GetQuotaAdjusterSettingsRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_quota_adjuster_settings_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::CloudQuotas::V1beta::QuotaAdjusterSettingsManager::Client::Configuration, config + end +end diff --git a/google-cloud-cloud_quotas-v1beta/test/helper.rb b/google-cloud-cloud_quotas-v1beta/test/helper.rb new file mode 100644 index 000000000000..968201e8049d --- /dev/null +++ b/google-cloud-cloud_quotas-v1beta/test/helper.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Copyright 2025 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "minitest/autorun" +require "minitest/focus" +require "minitest/rg" + +require "grpc" + +require "ostruct" diff --git a/release-please-config.json b/release-please-config.json index 0ac9bd58dcfc..459f75f2c7d9 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -427,6 +427,10 @@ "component": "google-cloud-cloud_quotas-v1", "version_file": "lib/google/cloud/cloud_quotas/v1/version.rb" }, + "google-cloud-cloud_quotas-v1beta": { + "component": "google-cloud-cloud_quotas-v1beta", + "version_file": "lib/google/cloud/cloud_quotas/v1beta/version.rb" + }, "google-cloud-commerce-consumer-procurement": { "component": "google-cloud-commerce-consumer-procurement", "version_file": "lib/google/cloud/commerce/consumer/procurement/version.rb"