diff --git a/google-cloud-edge_network-v1/.owlbot-manifest.json b/google-cloud-edge_network-v1/.owlbot-manifest.json index d5a3be357825..be28632cf4fa 100644 --- a/google-cloud-edge_network-v1/.owlbot-manifest.json +++ b/google-cloud-edge_network-v1/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-edge_network-v1/.toys.rb b/google-cloud-edge_network-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-edge_network-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-edge_network-v1/AUTHENTICATION.md b/google-cloud-edge_network-v1/AUTHENTICATION.md index 0c23c358bd11..3ac3267a21d8 100644 --- a/google-cloud-edge_network-v1/AUTHENTICATION.md +++ b/google-cloud-edge_network-v1/AUTHENTICATION.md @@ -1,149 +1,122 @@ # Authentication -In general, the google-cloud-edge_network-v1 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-edge_network-v1 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export GOOGLE_CLOUD_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/edge_network/v1" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-edge_network-v1 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-edge_network-v1 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. -The environment variables that google-cloud-edge_network-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/edge_network/v1" - -ENV["GOOGLE_CLOUD_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/edge_network/v1" client = ::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/edge_network/v1" ::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-edge_network-v1 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/edge_network/v1" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-edge_network-v1. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-edge_network-v1/google-cloud-edge_network-v1.gemspec b/google-cloud-edge_network-v1/google-cloud-edge_network-v1.gemspec index 120092f85d65..bfc7adb2c833 100644 --- a/google-cloud-edge_network-v1/google-cloud-edge_network-v1.gemspec +++ b/google-cloud-edge_network-v1/google-cloud-edge_network-v1.gemspec @@ -23,9 +23,9 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-errors", "~> 1.0" - gem.add_dependency "google-cloud-location", ">= 0.4", "< 2.a" + gem.add_dependency "google-cloud-location", ">= 0.7", "< 2.a" gem.add_development_dependency "google-style", "~> 1.26.3" gem.add_development_dependency "minitest", "~> 5.16" diff --git a/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/client.rb b/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/client.rb index 89fcd72ec182..dcd6ae1506d1 100644 --- a/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/client.rb +++ b/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/client.rb @@ -34,6 +34,9 @@ module EdgeNetwork # configure the network setup and property to meet the workload requirement. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "edgenetwork.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -179,6 +182,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @edge_network_stub.universe_domain + end + ## # Create a new EdgeNetwork client object. # @@ -212,8 +224,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -226,18 +239,22 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @edge_network_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -2840,9 +2857,9 @@ def delete_router request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"edgenetwork.googleapis.com"`. - # @return [::String] + # 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 @@ -2888,13 +2905,20 @@ def delete_router request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "edgenetwork.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -2909,6 +2933,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/operations.rb b/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/operations.rb index 5f7fddd7075c..b9a48bdea66e 100644 --- a/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/operations.rb +++ b/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/operations.rb @@ -26,6 +26,9 @@ module V1 module EdgeNetwork # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "edgenetwork.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -90,8 +102,10 @@ def initialize @operations_stub = ::Gapic::ServiceStub.new( ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -613,9 +627,9 @@ def wait_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"edgenetwork.googleapis.com"`. - # @return [::String] + # 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 @@ -661,13 +675,20 @@ def wait_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "edgenetwork.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -682,6 +703,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/client.rb b/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/client.rb index 51ae4c4112f5..35ad9255a789 100644 --- a/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/client.rb +++ b/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/client.rb @@ -36,6 +36,9 @@ module Rest # configure the network setup and property to meet the workload requirement. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "edgenetwork.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -181,6 +184,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @edge_network_stub.universe_domain + end + ## # Create a new EdgeNetwork REST client object. # @@ -208,8 +220,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -223,16 +236,23 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain config.bindings_override = @config.bindings_override end - @edge_network_stub = ::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @edge_network_stub = ::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -2643,9 +2663,9 @@ def delete_router request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"edgenetwork.googleapis.com"`. - # @return [::String] + # 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 @@ -2682,13 +2702,20 @@ def delete_router request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "edgenetwork.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -2700,6 +2727,7 @@ class Configuration 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 # @private # Overrides for http bindings for the RPCs of this service diff --git a/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/operations.rb b/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/operations.rb index 7f79ff304b13..4d92268acffc 100644 --- a/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/operations.rb +++ b/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/operations.rb @@ -26,6 +26,9 @@ module EdgeNetwork module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "edgenetwork.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -84,8 +96,10 @@ def initialize @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - credentials: credentials + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials ) # Used by an LRO wrapper for some methods of this service @@ -478,9 +492,9 @@ def cancel_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"edgenetwork.googleapis.com"`. - # @return [::String] + # 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 @@ -517,13 +531,20 @@ def cancel_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "edgenetwork.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -535,6 +556,7 @@ class Configuration 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 # @private def initialize parent_config = nil @@ -617,12 +639,15 @@ def initialize parent_rpcs = nil # Service stub contains baseline method implementations # including transcoding, making the REST call, and deserialing the response. class OperationsServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials end ## diff --git a/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/service_stub.rb b/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/service_stub.rb index e6b921a41a8c..cf03d1a99615 100644 --- a/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/service_stub.rb +++ b/google-cloud-edge_network-v1/lib/google/cloud/edge_network/v1/edge_network/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the initialize_zone REST call # diff --git a/google-cloud-edge_network-v1/proto_docs/google/api/client.rb b/google-cloud-edge_network-v1/proto_docs/google/api/client.rb index c38077287bbc..53fb4bc2d7da 100644 --- a/google-cloud-edge_network-v1/proto_docs/google/api/client.rb +++ b/google-cloud-edge_network-v1/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-edge_network-v1/snippets/edge_network/create_interconnect_attachment.rb b/google-cloud-edge_network-v1/snippets/edge_network/create_interconnect_attachment.rb index 0deadf242bcb..cf22eac634c5 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/create_interconnect_attachment.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/create_interconnect_attachment.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_interconnect_attachment call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#create_interconnect_attachment. -# It may require modification in order to execute successfully. # def create_interconnect_attachment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/create_network.rb b/google-cloud-edge_network-v1/snippets/edge_network/create_network.rb index 00bede3a067f..1aacfb46150f 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/create_network.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/create_network.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_network call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#create_network. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_network. # def create_network # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/create_router.rb b/google-cloud-edge_network-v1/snippets/edge_network/create_router.rb index 359beb3e3a1b..c66b50f7ff34 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/create_router.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/create_router.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_router call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#create_router. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_router. # def create_router # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/create_subnet.rb b/google-cloud-edge_network-v1/snippets/edge_network/create_subnet.rb index 03ac01f851b8..e16f6fd58bcc 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/create_subnet.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/create_subnet.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_subnet call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#create_subnet. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_subnet. # def create_subnet # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/delete_interconnect_attachment.rb b/google-cloud-edge_network-v1/snippets/edge_network/delete_interconnect_attachment.rb index f6a0f794c082..af617f251ac3 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/delete_interconnect_attachment.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/delete_interconnect_attachment.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_interconnect_attachment call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#delete_interconnect_attachment. -# It may require modification in order to execute successfully. # def delete_interconnect_attachment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/delete_network.rb b/google-cloud-edge_network-v1/snippets/edge_network/delete_network.rb index 11ca01063b98..e0d7ebd8486e 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/delete_network.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/delete_network.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_network call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#delete_network. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_network. # def delete_network # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/delete_router.rb b/google-cloud-edge_network-v1/snippets/edge_network/delete_router.rb index 8bb3db4c736f..06f9b09c184b 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/delete_router.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/delete_router.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_router call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#delete_router. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_router. # def delete_router # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/delete_subnet.rb b/google-cloud-edge_network-v1/snippets/edge_network/delete_subnet.rb index fc3c2a0dd986..8fa8071ce5bc 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/delete_subnet.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/delete_subnet.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_subnet call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#delete_subnet. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_subnet. # def delete_subnet # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/diagnose_interconnect.rb b/google-cloud-edge_network-v1/snippets/edge_network/diagnose_interconnect.rb index e410020b0447..985b17ed17f2 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/diagnose_interconnect.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/diagnose_interconnect.rb @@ -22,9 +22,14 @@ ## # Snippet for the diagnose_interconnect call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_interconnect. It -# may require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_interconnect. # def diagnose_interconnect # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/diagnose_network.rb b/google-cloud-edge_network-v1/snippets/edge_network/diagnose_network.rb index b8d045b13853..2f37464624ac 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/diagnose_network.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/diagnose_network.rb @@ -22,9 +22,14 @@ ## # Snippet for the diagnose_network call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_network. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_network. # def diagnose_network # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/diagnose_router.rb b/google-cloud-edge_network-v1/snippets/edge_network/diagnose_router.rb index f8acf42fd289..6839b0f8da36 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/diagnose_router.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/diagnose_router.rb @@ -22,9 +22,14 @@ ## # Snippet for the diagnose_router call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_router. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_router. # def diagnose_router # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/get_interconnect.rb b/google-cloud-edge_network-v1/snippets/edge_network/get_interconnect.rb index cfdc483ea79a..cee6c671ffbf 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/get_interconnect.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/get_interconnect.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_interconnect call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#get_interconnect. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_interconnect. # def get_interconnect # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/get_interconnect_attachment.rb b/google-cloud-edge_network-v1/snippets/edge_network/get_interconnect_attachment.rb index d5d3a1c69a6b..7ebc72f27d52 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/get_interconnect_attachment.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/get_interconnect_attachment.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_interconnect_attachment call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#get_interconnect_attachment. -# It may require modification in order to execute successfully. # def get_interconnect_attachment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/get_network.rb b/google-cloud-edge_network-v1/snippets/edge_network/get_network.rb index f14424302559..bb260cb9330c 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/get_network.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/get_network.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_network call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#get_network. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_network. # def get_network # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/get_router.rb b/google-cloud-edge_network-v1/snippets/edge_network/get_router.rb index c8311a96b931..1b930712dabf 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/get_router.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/get_router.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_router call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#get_router. It may require -# modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_router. # def get_router # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/get_subnet.rb b/google-cloud-edge_network-v1/snippets/edge_network/get_subnet.rb index 15c22526d0fd..0d152105d726 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/get_subnet.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/get_subnet.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_subnet call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#get_subnet. It may require -# modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_subnet. # def get_subnet # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/get_zone.rb b/google-cloud-edge_network-v1/snippets/edge_network/get_zone.rb index 1c1bc76f11b7..9f4abff9c107 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/get_zone.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/get_zone.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_zone call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#get_zone. It may require -# modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_zone. # def get_zone # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/initialize_zone.rb b/google-cloud-edge_network-v1/snippets/edge_network/initialize_zone.rb index ed470a400d0d..2290a265dc36 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/initialize_zone.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/initialize_zone.rb @@ -22,9 +22,14 @@ ## # Snippet for the initialize_zone call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#initialize_zone. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#initialize_zone. # def initialize_zone # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/list_interconnect_attachments.rb b/google-cloud-edge_network-v1/snippets/edge_network/list_interconnect_attachments.rb index eb800fc71f78..06766e4280b8 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/list_interconnect_attachments.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/list_interconnect_attachments.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_interconnect_attachments call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#list_interconnect_attachments. -# It may require modification in order to execute successfully. # def list_interconnect_attachments # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/list_interconnects.rb b/google-cloud-edge_network-v1/snippets/edge_network/list_interconnects.rb index 02777c945468..8a983b7069da 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/list_interconnects.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/list_interconnects.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_interconnects call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#list_interconnects. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_interconnects. # def list_interconnects # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/list_networks.rb b/google-cloud-edge_network-v1/snippets/edge_network/list_networks.rb index 4174a1f4b40a..bf1419602ade 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/list_networks.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/list_networks.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_networks call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#list_networks. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_networks. # def list_networks # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/list_routers.rb b/google-cloud-edge_network-v1/snippets/edge_network/list_routers.rb index d8d8a8610e0c..cb0462547094 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/list_routers.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/list_routers.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_routers call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#list_routers. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_routers. # def list_routers # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/list_subnets.rb b/google-cloud-edge_network-v1/snippets/edge_network/list_subnets.rb index 417d54d9f376..06f95354e5aa 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/list_subnets.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/list_subnets.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_subnets call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#list_subnets. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_subnets. # def list_subnets # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/list_zones.rb b/google-cloud-edge_network-v1/snippets/edge_network/list_zones.rb index 0d6af6f1c0eb..199d9c7ecbf2 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/list_zones.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/list_zones.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_zones call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#list_zones. It may require -# modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_zones. # def list_zones # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/update_router.rb b/google-cloud-edge_network-v1/snippets/edge_network/update_router.rb index 879a94b8763e..b54b6161b183 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/update_router.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/update_router.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_router call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#update_router. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#update_router. # def update_router # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/edge_network/update_subnet.rb b/google-cloud-edge_network-v1/snippets/edge_network/update_subnet.rb index 98a46ad22ac4..2eec7f75108f 100644 --- a/google-cloud-edge_network-v1/snippets/edge_network/update_subnet.rb +++ b/google-cloud-edge_network-v1/snippets/edge_network/update_subnet.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_subnet call in the EdgeNetwork 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::EdgeNetwork::V1::EdgeNetwork::Client#update_subnet. It may -# require modification in order to execute successfully. +# Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#update_subnet. # def update_subnet # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-edge_network-v1/snippets/snippet_metadata_google.cloud.edgenetwork.v1.json b/google-cloud-edge_network-v1/snippets/snippet_metadata_google.cloud.edgenetwork.v1.json index 18e9c3659529..048b59b1a568 100644 --- a/google-cloud-edge_network-v1/snippets/snippet_metadata_google.cloud.edgenetwork.v1.json +++ b/google-cloud-edge_network-v1/snippets/snippet_metadata_google.cloud.edgenetwork.v1.json @@ -14,7 +14,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_InitializeZone_sync", "title": "Snippet for the initialize_zone call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#initialize_zone. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#initialize_zone.", "file": "edge_network/initialize_zone.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_ListZones_sync", "title": "Snippet for the list_zones call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_zones. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_zones.", "file": "edge_network/list_zones.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_GetZone_sync", "title": "Snippet for the get_zone call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_zone. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_zone.", "file": "edge_network/get_zone.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_ListNetworks_sync", "title": "Snippet for the list_networks call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_networks. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_networks.", "file": "edge_network/list_networks.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_GetNetwork_sync", "title": "Snippet for the get_network call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_network. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_network.", "file": "edge_network/get_network.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_DiagnoseNetwork_sync", "title": "Snippet for the diagnose_network call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_network. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_network.", "file": "edge_network/diagnose_network.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_CreateNetwork_sync", "title": "Snippet for the create_network call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_network. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_network.", "file": "edge_network/create_network.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_DeleteNetwork_sync", "title": "Snippet for the delete_network call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_network. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_network.", "file": "edge_network/delete_network.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_ListSubnets_sync", "title": "Snippet for the list_subnets call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_subnets. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_subnets.", "file": "edge_network/list_subnets.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_GetSubnet_sync", "title": "Snippet for the get_subnet call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_subnet. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_subnet.", "file": "edge_network/get_subnet.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_CreateSubnet_sync", "title": "Snippet for the create_subnet call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_subnet. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_subnet.", "file": "edge_network/create_subnet.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_UpdateSubnet_sync", "title": "Snippet for the update_subnet call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#update_subnet. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#update_subnet.", "file": "edge_network/update_subnet.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_DeleteSubnet_sync", "title": "Snippet for the delete_subnet call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_subnet. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_subnet.", "file": "edge_network/delete_subnet.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_ListInterconnects_sync", "title": "Snippet for the list_interconnects call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_interconnects. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_interconnects.", "file": "edge_network/list_interconnects.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_GetInterconnect_sync", "title": "Snippet for the get_interconnect call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_interconnect. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_interconnect.", "file": "edge_network/get_interconnect.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_DiagnoseInterconnect_sync", "title": "Snippet for the diagnose_interconnect call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_interconnect. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_interconnect.", "file": "edge_network/diagnose_interconnect.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_ListInterconnectAttachments_sync", "title": "Snippet for the list_interconnect_attachments call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_interconnect_attachments. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_interconnect_attachments.", "file": "edge_network/list_interconnect_attachments.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -694,7 +694,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_GetInterconnectAttachment_sync", "title": "Snippet for the get_interconnect_attachment call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_interconnect_attachment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_interconnect_attachment.", "file": "edge_network/get_interconnect_attachment.rb", "language": "RUBY", "client_method": { @@ -726,7 +726,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -734,7 +734,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_CreateInterconnectAttachment_sync", "title": "Snippet for the create_interconnect_attachment call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_interconnect_attachment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_interconnect_attachment.", "file": "edge_network/create_interconnect_attachment.rb", "language": "RUBY", "client_method": { @@ -766,7 +766,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -774,7 +774,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_DeleteInterconnectAttachment_sync", "title": "Snippet for the delete_interconnect_attachment call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_interconnect_attachment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_interconnect_attachment.", "file": "edge_network/delete_interconnect_attachment.rb", "language": "RUBY", "client_method": { @@ -806,7 +806,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -814,7 +814,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_ListRouters_sync", "title": "Snippet for the list_routers call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_routers. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#list_routers.", "file": "edge_network/list_routers.rb", "language": "RUBY", "client_method": { @@ -846,7 +846,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -854,7 +854,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_GetRouter_sync", "title": "Snippet for the get_router call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_router. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#get_router.", "file": "edge_network/get_router.rb", "language": "RUBY", "client_method": { @@ -886,7 +886,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -894,7 +894,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_DiagnoseRouter_sync", "title": "Snippet for the diagnose_router call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_router. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#diagnose_router.", "file": "edge_network/diagnose_router.rb", "language": "RUBY", "client_method": { @@ -926,7 +926,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -934,7 +934,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_CreateRouter_sync", "title": "Snippet for the create_router call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_router. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#create_router.", "file": "edge_network/create_router.rb", "language": "RUBY", "client_method": { @@ -966,7 +966,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -974,7 +974,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_UpdateRouter_sync", "title": "Snippet for the update_router call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#update_router. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#update_router.", "file": "edge_network/update_router.rb", "language": "RUBY", "client_method": { @@ -1006,7 +1006,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -1014,7 +1014,7 @@ { "region_tag": "edgenetwork_v1_generated_EdgeNetwork_DeleteRouter_sync", "title": "Snippet for the delete_router call in the EdgeNetwork service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_router. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client#delete_router.", "file": "edge_network/delete_router.rb", "language": "RUBY", "client_method": { @@ -1046,7 +1046,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] diff --git a/google-cloud-error_reporting-v1beta1/.owlbot-manifest.json b/google-cloud-error_reporting-v1beta1/.owlbot-manifest.json index e15b15f392b0..d6ee55078c77 100644 --- a/google-cloud-error_reporting-v1beta1/.owlbot-manifest.json +++ b/google-cloud-error_reporting-v1beta1/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-error_reporting-v1beta1/.toys.rb b/google-cloud-error_reporting-v1beta1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-error_reporting-v1beta1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-error_reporting-v1beta1/AUTHENTICATION.md b/google-cloud-error_reporting-v1beta1/AUTHENTICATION.md index 314842c38d61..7f03abc44007 100644 --- a/google-cloud-error_reporting-v1beta1/AUTHENTICATION.md +++ b/google-cloud-error_reporting-v1beta1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-error_reporting-v1beta1 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-error_reporting-v1beta1 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export ERROR_REPORTING_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/error_reporting/v1beta1" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-error_reporting-v1beta1 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-error_reporting-v1beta1 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. -The environment variables that google-cloud-error_reporting-v1beta1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `ERROR_REPORTING_CREDENTIALS` - Path to JSON file, or JSON contents -* `ERROR_REPORTING_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/error_reporting/v1beta1" - -ENV["ERROR_REPORTING_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/error_reporting/v1beta1" client = ::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/error_reporting/v1beta1" ::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-error_reporting-v1beta1 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/error_reporting/v1beta1" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-error_reporting-v1beta1. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-error_reporting-v1beta1/google-cloud-error_reporting-v1beta1.gemspec b/google-cloud-error_reporting-v1beta1/google-cloud-error_reporting-v1beta1.gemspec index c31bceb531c7..9a2ac37e505b 100644 --- a/google-cloud-error_reporting-v1beta1/google-cloud-error_reporting-v1beta1.gemspec +++ b/google-cloud-error_reporting-v1beta1/google-cloud-error_reporting-v1beta1.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-errors", "~> 1.0" gem.add_development_dependency "google-style", "~> 1.26.3" diff --git a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/client.rb b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/client.rb index 1050c11a86bb..abcc0182a64a 100644 --- a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/client.rb +++ b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/client.rb @@ -30,6 +30,9 @@ module ErrorGroupService # Service for retrieving and updating individual error groups. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "clouderrorreporting.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -95,6 +98,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @error_group_service_stub.universe_domain + end + ## # Create a new ErrorGroupService client object. # @@ -128,8 +140,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -140,8 +153,10 @@ def initialize @error_group_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -356,9 +371,9 @@ def update_group request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"clouderrorreporting.googleapis.com"`. - # @return [::String] + # 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 @@ -404,13 +419,20 @@ def update_group request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "clouderrorreporting.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -425,6 +447,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/rest/client.rb b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/rest/client.rb index 6986e15f17ed..7336e5e2e600 100644 --- a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/rest/client.rb +++ b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # Service for retrieving and updating individual error groups. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "clouderrorreporting.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -97,6 +100,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @error_group_service_stub.universe_domain + end + ## # Create a new ErrorGroupService REST client object. # @@ -124,8 +136,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -135,7 +148,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @error_group_service_stub = ::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @error_group_service_stub = ::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -332,9 +350,9 @@ def update_group request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"clouderrorreporting.googleapis.com"`. - # @return [::String] + # 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 @@ -371,13 +389,20 @@ def update_group request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "clouderrorreporting.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -389,6 +414,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/rest/service_stub.rb b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/rest/service_stub.rb index 43cc66979878..1879cba43d2c 100644 --- a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/rest/service_stub.rb +++ b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_group_service/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the get_group REST call # diff --git a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/client.rb b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/client.rb index 6a779fcf792d..7adde8a41ea0 100644 --- a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/client.rb +++ b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/client.rb @@ -31,6 +31,9 @@ module ErrorStatsService # individual events. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "clouderrorreporting.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -96,6 +99,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @error_stats_service_stub.universe_domain + end + ## # Create a new ErrorStatsService client object. # @@ -129,8 +141,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -141,8 +154,10 @@ def initialize @error_stats_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -509,9 +524,9 @@ def delete_events request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"clouderrorreporting.googleapis.com"`. - # @return [::String] + # 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 @@ -557,13 +572,20 @@ def delete_events request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "clouderrorreporting.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -578,6 +600,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/rest/client.rb b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/rest/client.rb index 1a0ae56a5960..c09f0fda76b6 100644 --- a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/rest/client.rb +++ b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/rest/client.rb @@ -33,6 +33,9 @@ module Rest # individual events. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "clouderrorreporting.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -98,6 +101,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @error_stats_service_stub.universe_domain + end + ## # Create a new ErrorStatsService REST client object. # @@ -125,8 +137,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -136,7 +149,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @error_stats_service_stub = ::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @error_stats_service_stub = ::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -478,9 +496,9 @@ def delete_events request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"clouderrorreporting.googleapis.com"`. - # @return [::String] + # 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 @@ -517,13 +535,20 @@ def delete_events request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "clouderrorreporting.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -535,6 +560,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/rest/service_stub.rb b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/rest/service_stub.rb index 751709d70292..6a754d19fe59 100644 --- a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/rest/service_stub.rb +++ b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/error_stats_service/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the list_group_stats REST call # diff --git a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/client.rb b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/client.rb index 07e9bdd8e8e0..68addb1925d3 100644 --- a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/client.rb +++ b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/client.rb @@ -30,6 +30,9 @@ module ReportErrorsService # An API for reporting error events. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "clouderrorreporting.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -92,6 +95,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @report_errors_service_stub.universe_domain + end + ## # Create a new ReportErrorsService client object. # @@ -125,8 +137,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -137,8 +150,10 @@ def initialize @report_errors_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::ErrorReporting::V1beta1::ReportErrorsService::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -281,9 +296,9 @@ def report_error_event request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"clouderrorreporting.googleapis.com"`. - # @return [::String] + # 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 @@ -329,13 +344,20 @@ def report_error_event request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "clouderrorreporting.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -350,6 +372,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/rest/client.rb b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/rest/client.rb index bd15175cfe2d..ac6f014bf0aa 100644 --- a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/rest/client.rb +++ b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # An API for reporting error events. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "clouderrorreporting.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -94,6 +97,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @report_errors_service_stub.universe_domain + end + ## # Create a new ReportErrorsService REST client object. # @@ -121,8 +133,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -132,7 +145,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @report_errors_service_stub = ::Google::Cloud::ErrorReporting::V1beta1::ReportErrorsService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @report_errors_service_stub = ::Google::Cloud::ErrorReporting::V1beta1::ReportErrorsService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -264,9 +282,9 @@ def report_error_event request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"clouderrorreporting.googleapis.com"`. - # @return [::String] + # 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 @@ -303,13 +321,20 @@ def report_error_event request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "clouderrorreporting.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -321,6 +346,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/rest/service_stub.rb b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/rest/service_stub.rb index 8682b9f6ab66..64dfe7ea7310 100644 --- a/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/rest/service_stub.rb +++ b/google-cloud-error_reporting-v1beta1/lib/google/cloud/error_reporting/v1beta1/report_errors_service/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the report_error_event REST call # diff --git a/google-cloud-error_reporting-v1beta1/proto_docs/google/api/client.rb b/google-cloud-error_reporting-v1beta1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-error_reporting-v1beta1/proto_docs/google/api/client.rb +++ b/google-cloud-error_reporting-v1beta1/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-error_reporting-v1beta1/snippets/error_group_service/get_group.rb b/google-cloud-error_reporting-v1beta1/snippets/error_group_service/get_group.rb index 4f7f982011aa..7242e47186ea 100755 --- a/google-cloud-error_reporting-v1beta1/snippets/error_group_service/get_group.rb +++ b/google-cloud-error_reporting-v1beta1/snippets/error_group_service/get_group.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_group call in the ErrorGroupService 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::ErrorReporting::V1beta1::ErrorGroupService::Client#get_group. -# It may require modification in order to execute successfully. # def get_group # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-error_reporting-v1beta1/snippets/error_group_service/update_group.rb b/google-cloud-error_reporting-v1beta1/snippets/error_group_service/update_group.rb index 3efa28b19d3c..b07ead3d1051 100755 --- a/google-cloud-error_reporting-v1beta1/snippets/error_group_service/update_group.rb +++ b/google-cloud-error_reporting-v1beta1/snippets/error_group_service/update_group.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_group call in the ErrorGroupService 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::ErrorReporting::V1beta1::ErrorGroupService::Client#update_group. -# It may require modification in order to execute successfully. # def update_group # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/delete_events.rb b/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/delete_events.rb index 4361300e337f..2f9b3341bf08 100755 --- a/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/delete_events.rb +++ b/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/delete_events.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_events call in the ErrorStatsService 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::ErrorReporting::V1beta1::ErrorStatsService::Client#delete_events. -# It may require modification in order to execute successfully. # def delete_events # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/list_events.rb b/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/list_events.rb index 8dbf34142df4..3e9daa34d228 100755 --- a/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/list_events.rb +++ b/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/list_events.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_events call in the ErrorStatsService 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::ErrorReporting::V1beta1::ErrorStatsService::Client#list_events. -# It may require modification in order to execute successfully. # def list_events # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/list_group_stats.rb b/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/list_group_stats.rb index 5f95c4208ebe..7fd6479fdb38 100755 --- a/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/list_group_stats.rb +++ b/google-cloud-error_reporting-v1beta1/snippets/error_stats_service/list_group_stats.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_group_stats call in the ErrorStatsService 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::ErrorReporting::V1beta1::ErrorStatsService::Client#list_group_stats. -# It may require modification in order to execute successfully. # def list_group_stats # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-error_reporting-v1beta1/snippets/report_errors_service/report_error_event.rb b/google-cloud-error_reporting-v1beta1/snippets/report_errors_service/report_error_event.rb index 75a0185d4d87..de3975d22570 100755 --- a/google-cloud-error_reporting-v1beta1/snippets/report_errors_service/report_error_event.rb +++ b/google-cloud-error_reporting-v1beta1/snippets/report_errors_service/report_error_event.rb @@ -22,9 +22,14 @@ ## # Snippet for the report_error_event call in the ReportErrorsService 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::ErrorReporting::V1beta1::ReportErrorsService::Client#report_error_event. -# It may require modification in order to execute successfully. # def report_error_event # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-error_reporting-v1beta1/snippets/snippet_metadata_google.devtools.clouderrorreporting.v1beta1.json b/google-cloud-error_reporting-v1beta1/snippets/snippet_metadata_google.devtools.clouderrorreporting.v1beta1.json index 072a98085b38..241463ae26bd 100644 --- a/google-cloud-error_reporting-v1beta1/snippets/snippet_metadata_google.devtools.clouderrorreporting.v1beta1.json +++ b/google-cloud-error_reporting-v1beta1/snippets/snippet_metadata_google.devtools.clouderrorreporting.v1beta1.json @@ -14,7 +14,7 @@ { "region_tag": "clouderrorreporting_v1beta1_generated_ErrorGroupService_GetGroup_sync", "title": "Snippet for the get_group call in the ErrorGroupService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Client#get_group. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Client#get_group.", "file": "error_group_service/get_group.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "clouderrorreporting_v1beta1_generated_ErrorGroupService_UpdateGroup_sync", "title": "Snippet for the update_group call in the ErrorGroupService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Client#update_group. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ErrorGroupService::Client#update_group.", "file": "error_group_service/update_group.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "clouderrorreporting_v1beta1_generated_ErrorStatsService_ListGroupStats_sync", "title": "Snippet for the list_group_stats call in the ErrorStatsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client#list_group_stats. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client#list_group_stats.", "file": "error_stats_service/list_group_stats.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "clouderrorreporting_v1beta1_generated_ErrorStatsService_ListEvents_sync", "title": "Snippet for the list_events call in the ErrorStatsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client#list_events. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client#list_events.", "file": "error_stats_service/list_events.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "clouderrorreporting_v1beta1_generated_ErrorStatsService_DeleteEvents_sync", "title": "Snippet for the delete_events call in the ErrorStatsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client#delete_events. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client#delete_events.", "file": "error_stats_service/delete_events.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "clouderrorreporting_v1beta1_generated_ReportErrorsService_ReportErrorEvent_sync", "title": "Snippet for the report_error_event call in the ReportErrorsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ReportErrorsService::Client#report_error_event. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::ErrorReporting::V1beta1::ReportErrorsService::Client#report_error_event.", "file": "report_errors_service/report_error_event.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-essential_contacts-v1/.owlbot-manifest.json b/google-cloud-essential_contacts-v1/.owlbot-manifest.json index 6f9ed6a567d4..8e2d0f9d0302 100644 --- a/google-cloud-essential_contacts-v1/.owlbot-manifest.json +++ b/google-cloud-essential_contacts-v1/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-essential_contacts-v1/.toys.rb b/google-cloud-essential_contacts-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-essential_contacts-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-essential_contacts-v1/AUTHENTICATION.md b/google-cloud-essential_contacts-v1/AUTHENTICATION.md index f26189f2e157..9dd70c2cacb0 100644 --- a/google-cloud-essential_contacts-v1/AUTHENTICATION.md +++ b/google-cloud-essential_contacts-v1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-essential_contacts-v1 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-essential_contacts-v1 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export ESSENTIAL_CONTACTS_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/essential_contacts/v1" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-essential_contacts-v1 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-essential_contacts-v1 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. -The environment variables that google-cloud-essential_contacts-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `ESSENTIAL_CONTACTS_CREDENTIALS` - Path to JSON file, or JSON contents -* `ESSENTIAL_CONTACTS_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/essential_contacts/v1" - -ENV["ESSENTIAL_CONTACTS_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/essential_contacts/v1" client = ::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/essential_contacts/v1" ::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-essential_contacts-v1 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/essential_contacts/v1" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-essential_contacts-v1. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-essential_contacts-v1/google-cloud-essential_contacts-v1.gemspec b/google-cloud-essential_contacts-v1/google-cloud-essential_contacts-v1.gemspec index 48f6ed87e657..5c5de94dd819 100644 --- a/google-cloud-essential_contacts-v1/google-cloud-essential_contacts-v1.gemspec +++ b/google-cloud-essential_contacts-v1/google-cloud-essential_contacts-v1.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-errors", "~> 1.0" gem.add_development_dependency "google-style", "~> 1.26.3" diff --git a/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/client.rb b/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/client.rb index f2ee47cd4b0c..c4a92dd3ea7b 100644 --- a/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/client.rb +++ b/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/client.rb @@ -30,6 +30,9 @@ module EssentialContactsService # Manages contacts for important Google Cloud notifications. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "essentialcontacts.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -110,6 +113,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @essential_contacts_service_stub.universe_domain + end + ## # Create a new EssentialContactsService client object. # @@ -143,8 +155,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -155,8 +168,10 @@ def initialize @essential_contacts_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -860,9 +875,9 @@ def send_test_message request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"essentialcontacts.googleapis.com"`. - # @return [::String] + # 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 @@ -908,13 +923,20 @@ def send_test_message request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "essentialcontacts.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -929,6 +951,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/rest/client.rb b/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/rest/client.rb index 2400fbf7d1b1..5a0eda0d37d0 100644 --- a/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/rest/client.rb +++ b/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # Manages contacts for important Google Cloud notifications. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "essentialcontacts.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -112,6 +115,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @essential_contacts_service_stub.universe_domain + end + ## # Create a new EssentialContactsService REST client object. # @@ -139,8 +151,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -150,7 +163,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @essential_contacts_service_stub = ::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @essential_contacts_service_stub = ::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -801,9 +819,9 @@ def send_test_message request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"essentialcontacts.googleapis.com"`. - # @return [::String] + # 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 @@ -840,13 +858,20 @@ def send_test_message request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "essentialcontacts.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -858,6 +883,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/rest/service_stub.rb b/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/rest/service_stub.rb index 9300b7cd4762..41cb0eccf738 100644 --- a/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/rest/service_stub.rb +++ b/google-cloud-essential_contacts-v1/lib/google/cloud/essential_contacts/v1/essential_contacts_service/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the create_contact REST call # diff --git a/google-cloud-essential_contacts-v1/proto_docs/google/api/client.rb b/google-cloud-essential_contacts-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-essential_contacts-v1/proto_docs/google/api/client.rb +++ b/google-cloud-essential_contacts-v1/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/compute_contacts.rb b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/compute_contacts.rb index 1d1390a81900..1bd68fedea15 100755 --- a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/compute_contacts.rb +++ b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/compute_contacts.rb @@ -22,9 +22,14 @@ ## # Snippet for the compute_contacts call in the EssentialContactsService 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::EssentialContacts::V1::EssentialContactsService::Client#compute_contacts. -# It may require modification in order to execute successfully. # def compute_contacts # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/create_contact.rb b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/create_contact.rb index 78ffe161bc14..41a17450397b 100755 --- a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/create_contact.rb +++ b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/create_contact.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_contact call in the EssentialContactsService 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::EssentialContacts::V1::EssentialContactsService::Client#create_contact. -# It may require modification in order to execute successfully. # def create_contact # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/delete_contact.rb b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/delete_contact.rb index 204f6ad65c25..a8c62b6c3633 100755 --- a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/delete_contact.rb +++ b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/delete_contact.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_contact call in the EssentialContactsService 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::EssentialContacts::V1::EssentialContactsService::Client#delete_contact. -# It may require modification in order to execute successfully. # def delete_contact # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/get_contact.rb b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/get_contact.rb index 985dda2f3b81..4b67a4584527 100755 --- a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/get_contact.rb +++ b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/get_contact.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_contact call in the EssentialContactsService 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::EssentialContacts::V1::EssentialContactsService::Client#get_contact. -# It may require modification in order to execute successfully. # def get_contact # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/list_contacts.rb b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/list_contacts.rb index 019afc26c571..547878dc6096 100755 --- a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/list_contacts.rb +++ b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/list_contacts.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_contacts call in the EssentialContactsService 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::EssentialContacts::V1::EssentialContactsService::Client#list_contacts. -# It may require modification in order to execute successfully. # def list_contacts # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/send_test_message.rb b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/send_test_message.rb index d659b30a77ce..ef4e5841de39 100755 --- a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/send_test_message.rb +++ b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/send_test_message.rb @@ -22,9 +22,14 @@ ## # Snippet for the send_test_message call in the EssentialContactsService 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::EssentialContacts::V1::EssentialContactsService::Client#send_test_message. -# It may require modification in order to execute successfully. # def send_test_message # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/update_contact.rb b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/update_contact.rb index f022dfe9eb60..b615fabc02e7 100755 --- a/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/update_contact.rb +++ b/google-cloud-essential_contacts-v1/snippets/essential_contacts_service/update_contact.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_contact call in the EssentialContactsService 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::EssentialContacts::V1::EssentialContactsService::Client#update_contact. -# It may require modification in order to execute successfully. # def update_contact # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-essential_contacts-v1/snippets/snippet_metadata_google.cloud.essentialcontacts.v1.json b/google-cloud-essential_contacts-v1/snippets/snippet_metadata_google.cloud.essentialcontacts.v1.json index 73246697d449..99332311a6c8 100644 --- a/google-cloud-essential_contacts-v1/snippets/snippet_metadata_google.cloud.essentialcontacts.v1.json +++ b/google-cloud-essential_contacts-v1/snippets/snippet_metadata_google.cloud.essentialcontacts.v1.json @@ -14,7 +14,7 @@ { "region_tag": "essentialcontacts_v1_generated_EssentialContactsService_CreateContact_sync", "title": "Snippet for the create_contact call in the EssentialContactsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#create_contact. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#create_contact.", "file": "essential_contacts_service/create_contact.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "essentialcontacts_v1_generated_EssentialContactsService_UpdateContact_sync", "title": "Snippet for the update_contact call in the EssentialContactsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#update_contact. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#update_contact.", "file": "essential_contacts_service/update_contact.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "essentialcontacts_v1_generated_EssentialContactsService_ListContacts_sync", "title": "Snippet for the list_contacts call in the EssentialContactsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#list_contacts. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#list_contacts.", "file": "essential_contacts_service/list_contacts.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "essentialcontacts_v1_generated_EssentialContactsService_GetContact_sync", "title": "Snippet for the get_contact call in the EssentialContactsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#get_contact. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#get_contact.", "file": "essential_contacts_service/get_contact.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "essentialcontacts_v1_generated_EssentialContactsService_DeleteContact_sync", "title": "Snippet for the delete_contact call in the EssentialContactsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#delete_contact. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#delete_contact.", "file": "essential_contacts_service/delete_contact.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "essentialcontacts_v1_generated_EssentialContactsService_ComputeContacts_sync", "title": "Snippet for the compute_contacts call in the EssentialContactsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#compute_contacts. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#compute_contacts.", "file": "essential_contacts_service/compute_contacts.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "essentialcontacts_v1_generated_EssentialContactsService_SendTestMessage_sync", "title": "Snippet for the send_test_message call in the EssentialContactsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#send_test_message. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::EssentialContacts::V1::EssentialContactsService::Client#send_test_message.", "file": "essential_contacts_service/send_test_message.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-eventarc-publishing-v1/.owlbot-manifest.json b/google-cloud-eventarc-publishing-v1/.owlbot-manifest.json index 2a9051c05993..33b44f0d06fb 100644 --- a/google-cloud-eventarc-publishing-v1/.owlbot-manifest.json +++ b/google-cloud-eventarc-publishing-v1/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-eventarc-publishing-v1/.toys.rb b/google-cloud-eventarc-publishing-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-eventarc-publishing-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-eventarc-publishing-v1/AUTHENTICATION.md b/google-cloud-eventarc-publishing-v1/AUTHENTICATION.md index 25db839b4a5b..6730f31e37c8 100644 --- a/google-cloud-eventarc-publishing-v1/AUTHENTICATION.md +++ b/google-cloud-eventarc-publishing-v1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-eventarc-publishing-v1 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-eventarc-publishing-v1 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export EVENTARC_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/eventarc/publishing/v1" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-eventarc-publishing-v1 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-eventarc-publishing-v1 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. -The environment variables that google-cloud-eventarc-publishing-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Eventarc::Publishing::V1::Publisher::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `EVENTARC_CREDENTIALS` - Path to JSON file, or JSON contents -* `EVENTARC_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/eventarc/publishing/v1" - -ENV["EVENTARC_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/eventarc/publishing/v1" client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/eventarc/publishing/v1" ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-eventarc-publishing-v1 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/eventarc/publishing/v1" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-eventarc-publishing-v1. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-eventarc-publishing-v1/google-cloud-eventarc-publishing-v1.gemspec b/google-cloud-eventarc-publishing-v1/google-cloud-eventarc-publishing-v1.gemspec index e8a3ff59ea8e..d6a6a0060e2d 100644 --- a/google-cloud-eventarc-publishing-v1/google-cloud-eventarc-publishing-v1.gemspec +++ b/google-cloud-eventarc-publishing-v1/google-cloud-eventarc-publishing-v1.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-errors", "~> 1.0" gem.add_development_dependency "google-style", "~> 1.26.3" diff --git a/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/client.rb b/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/client.rb index e839df753002..645b4f866461 100644 --- a/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/client.rb +++ b/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/client.rb @@ -54,6 +54,9 @@ module Publisher # Publisher allows an event provider to publish events to Eventarc. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "eventarcpublishing.$UNIVERSE_DOMAIN$" + # @private attr_reader :publisher_stub @@ -114,6 +117,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @publisher_stub.universe_domain + end + ## # Create a new Publisher client object. # @@ -147,8 +159,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -159,8 +172,10 @@ def initialize @publisher_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -389,9 +404,9 @@ def publish_events request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"eventarcpublishing.googleapis.com"`. - # @return [::String] + # 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 @@ -437,13 +452,20 @@ def publish_events request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "eventarcpublishing.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -458,6 +480,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/rest/client.rb b/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/rest/client.rb index 63f2fe270c50..dc417648ab53 100644 --- a/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/rest/client.rb +++ b/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/rest/client.rb @@ -56,6 +56,9 @@ module Rest # Publisher allows an event provider to publish events to Eventarc. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "eventarcpublishing.$UNIVERSE_DOMAIN$" + # @private attr_reader :publisher_stub @@ -116,6 +119,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @publisher_stub.universe_domain + end + ## # Create a new Publisher REST client object. # @@ -143,8 +155,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -154,7 +167,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @publisher_stub = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @publisher_stub = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -365,9 +383,9 @@ def publish_events request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"eventarcpublishing.googleapis.com"`. - # @return [::String] + # 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 @@ -404,13 +422,20 @@ def publish_events request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "eventarcpublishing.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -422,6 +447,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/rest/service_stub.rb b/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/rest/service_stub.rb index 2754114174e5..c8a57491c16f 100644 --- a/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/rest/service_stub.rb +++ b/google-cloud-eventarc-publishing-v1/lib/google/cloud/eventarc/publishing/v1/publisher/rest/service_stub.rb @@ -31,16 +31,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the publish_channel_connection_events REST call # diff --git a/google-cloud-eventarc-publishing-v1/proto_docs/google/api/client.rb b/google-cloud-eventarc-publishing-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-eventarc-publishing-v1/proto_docs/google/api/client.rb +++ b/google-cloud-eventarc-publishing-v1/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-eventarc-publishing-v1/snippets/publisher/publish_channel_connection_events.rb b/google-cloud-eventarc-publishing-v1/snippets/publisher/publish_channel_connection_events.rb index 791f42f289fd..8e1e1178b978 100644 --- a/google-cloud-eventarc-publishing-v1/snippets/publisher/publish_channel_connection_events.rb +++ b/google-cloud-eventarc-publishing-v1/snippets/publisher/publish_channel_connection_events.rb @@ -22,9 +22,14 @@ ## # Snippet for the publish_channel_connection_events call in the Publisher 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::Eventarc::Publishing::V1::Publisher::Client#publish_channel_connection_events. -# It may require modification in order to execute successfully. # def publish_channel_connection_events # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-publishing-v1/snippets/publisher/publish_events.rb b/google-cloud-eventarc-publishing-v1/snippets/publisher/publish_events.rb index 8ab3e8939072..dc37ef635fe2 100644 --- a/google-cloud-eventarc-publishing-v1/snippets/publisher/publish_events.rb +++ b/google-cloud-eventarc-publishing-v1/snippets/publisher/publish_events.rb @@ -22,9 +22,14 @@ ## # Snippet for the publish_events call in the Publisher 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::Eventarc::Publishing::V1::Publisher::Client#publish_events. It -# may require modification in order to execute successfully. +# Google::Cloud::Eventarc::Publishing::V1::Publisher::Client#publish_events. # def publish_events # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-publishing-v1/snippets/snippet_metadata_google.cloud.eventarc.publishing.v1.json b/google-cloud-eventarc-publishing-v1/snippets/snippet_metadata_google.cloud.eventarc.publishing.v1.json index 753f56add374..db432175a960 100644 --- a/google-cloud-eventarc-publishing-v1/snippets/snippet_metadata_google.cloud.eventarc.publishing.v1.json +++ b/google-cloud-eventarc-publishing-v1/snippets/snippet_metadata_google.cloud.eventarc.publishing.v1.json @@ -14,7 +14,7 @@ { "region_tag": "eventarcpublishing_v1_generated_Publisher_PublishChannelConnectionEvents_sync", "title": "Snippet for the publish_channel_connection_events call in the Publisher service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::Publishing::V1::Publisher::Client#publish_channel_connection_events. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::Publishing::V1::Publisher::Client#publish_channel_connection_events.", "file": "publisher/publish_channel_connection_events.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "eventarcpublishing_v1_generated_Publisher_PublishEvents_sync", "title": "Snippet for the publish_events call in the Publisher service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::Publishing::V1::Publisher::Client#publish_events. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::Publishing::V1::Publisher::Client#publish_events.", "file": "publisher/publish_events.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-eventarc-v1/.owlbot-manifest.json b/google-cloud-eventarc-v1/.owlbot-manifest.json index 1f8e7f78c973..d12bbc083d67 100644 --- a/google-cloud-eventarc-v1/.owlbot-manifest.json +++ b/google-cloud-eventarc-v1/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-eventarc-v1/.toys.rb b/google-cloud-eventarc-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-eventarc-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-eventarc-v1/AUTHENTICATION.md b/google-cloud-eventarc-v1/AUTHENTICATION.md index 8bdf6610dc5a..935ba2836622 100644 --- a/google-cloud-eventarc-v1/AUTHENTICATION.md +++ b/google-cloud-eventarc-v1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-eventarc-v1 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-eventarc-v1 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export EVENTARC_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/eventarc/v1" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::Eventarc::V1::Eventarc::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-eventarc-v1 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-eventarc-v1 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. -The environment variables that google-cloud-eventarc-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Eventarc::V1::Eventarc::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `EVENTARC_CREDENTIALS` - Path to JSON file, or JSON contents -* `EVENTARC_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/eventarc/v1" - -ENV["EVENTARC_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Eventarc::V1::Eventarc::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/eventarc/v1" client = ::Google::Cloud::Eventarc::V1::Eventarc::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/eventarc/v1" ::Google::Cloud::Eventarc::V1::Eventarc::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Eventarc::V1::Eventarc::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-eventarc-v1 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/eventarc/v1" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-eventarc-v1. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::Eventarc::V1::Eventarc::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-eventarc-v1/google-cloud-eventarc-v1.gemspec b/google-cloud-eventarc-v1/google-cloud-eventarc-v1.gemspec index db02271d52c2..37b076fe9593 100644 --- a/google-cloud-eventarc-v1/google-cloud-eventarc-v1.gemspec +++ b/google-cloud-eventarc-v1/google-cloud-eventarc-v1.gemspec @@ -23,10 +23,10 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-errors", "~> 1.0" - gem.add_dependency "google-cloud-location", ">= 0.4", "< 2.a" - gem.add_dependency "google-iam-v1", ">= 0.4", "< 2.a" + gem.add_dependency "google-cloud-location", ">= 0.7", "< 2.a" + gem.add_dependency "google-iam-v1", ">= 0.7", "< 2.a" gem.add_development_dependency "google-style", "~> 1.26.3" gem.add_development_dependency "minitest", "~> 5.16" diff --git a/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/client.rb b/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/client.rb index fa17a2dabf80..9ed9aa637646 100644 --- a/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/client.rb +++ b/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/client.rb @@ -33,6 +33,9 @@ module Eventarc # Google Cloud services and forward them to supported destinations. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "eventarc.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -93,6 +96,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @eventarc_stub.universe_domain + end + ## # Create a new Eventarc client object. # @@ -126,8 +138,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -140,24 +153,29 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @eventarc_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Eventarc::V1::Eventarc::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -1941,9 +1959,9 @@ def update_google_channel_config request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"eventarc.googleapis.com"`. - # @return [::String] + # 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 @@ -1989,13 +2007,20 @@ def update_google_channel_config request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "eventarc.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -2010,6 +2035,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/operations.rb b/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/operations.rb index 5e872624de20..673c6a1bcdcb 100644 --- a/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/operations.rb +++ b/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/operations.rb @@ -26,6 +26,9 @@ module V1 module Eventarc # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "eventarc.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -90,8 +102,10 @@ def initialize @operations_stub = ::Gapic::ServiceStub.new( ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -613,9 +627,9 @@ def wait_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"eventarc.googleapis.com"`. - # @return [::String] + # 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 @@ -661,13 +675,20 @@ def wait_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "eventarc.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -682,6 +703,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/client.rb b/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/client.rb index 653bd6bbed12..12712163ff20 100644 --- a/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/client.rb +++ b/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/client.rb @@ -35,6 +35,9 @@ module Rest # Google Cloud services and forward them to supported destinations. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "eventarc.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -95,6 +98,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @eventarc_stub.universe_domain + end + ## # Create a new Eventarc REST client object. # @@ -122,8 +134,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -137,12 +150,14 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain config.bindings_override = @config.bindings_override end @@ -150,10 +165,16 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain config.bindings_override = @config.bindings_override end - @eventarc_stub = ::Google::Cloud::Eventarc::V1::Eventarc::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @eventarc_stub = ::Google::Cloud::Eventarc::V1::Eventarc::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -1803,9 +1824,9 @@ def update_google_channel_config request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"eventarc.googleapis.com"`. - # @return [::String] + # 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 @@ -1842,13 +1863,20 @@ def update_google_channel_config request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "eventarc.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -1860,6 +1888,7 @@ class Configuration 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 # @private # Overrides for http bindings for the RPCs of this service diff --git a/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/operations.rb b/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/operations.rb index 9b7d5db4a451..e8177e36141e 100644 --- a/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/operations.rb +++ b/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/operations.rb @@ -26,6 +26,9 @@ module Eventarc module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "eventarc.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -84,8 +96,10 @@ def initialize @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - credentials: credentials + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials ) # Used by an LRO wrapper for some methods of this service @@ -478,9 +492,9 @@ def cancel_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"eventarc.googleapis.com"`. - # @return [::String] + # 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 @@ -517,13 +531,20 @@ def cancel_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "eventarc.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -535,6 +556,7 @@ class Configuration 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 # @private def initialize parent_config = nil @@ -617,12 +639,15 @@ def initialize parent_rpcs = nil # Service stub contains baseline method implementations # including transcoding, making the REST call, and deserialing the response. class OperationsServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials end ## diff --git a/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/service_stub.rb b/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/service_stub.rb index f0bb4188ac2e..9b04bbbbb8ee 100644 --- a/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/service_stub.rb +++ b/google-cloud-eventarc-v1/lib/google/cloud/eventarc/v1/eventarc/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the get_trigger REST call # diff --git a/google-cloud-eventarc-v1/proto_docs/google/api/client.rb b/google-cloud-eventarc-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-eventarc-v1/proto_docs/google/api/client.rb +++ b/google-cloud-eventarc-v1/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-eventarc-v1/snippets/eventarc/create_channel.rb b/google-cloud-eventarc-v1/snippets/eventarc/create_channel.rb index fca6cc9ddc7c..e90d0aa5c24c 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/create_channel.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/create_channel.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_channel call in the Eventarc 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::Eventarc::V1::Eventarc::Client#create_channel. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#create_channel. # def create_channel # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/create_channel_connection.rb b/google-cloud-eventarc-v1/snippets/eventarc/create_channel_connection.rb index 5f5f88f30ff8..376a7211b785 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/create_channel_connection.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/create_channel_connection.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_channel_connection call in the Eventarc 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::Eventarc::V1::Eventarc::Client#create_channel_connection. It -# may require modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#create_channel_connection. # def create_channel_connection # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/create_trigger.rb b/google-cloud-eventarc-v1/snippets/eventarc/create_trigger.rb index 5fb51e4ee0a8..b2bd6f954abd 100755 --- a/google-cloud-eventarc-v1/snippets/eventarc/create_trigger.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/create_trigger.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_trigger call in the Eventarc 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::Eventarc::V1::Eventarc::Client#create_trigger. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#create_trigger. # def create_trigger # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/delete_channel.rb b/google-cloud-eventarc-v1/snippets/eventarc/delete_channel.rb index bd7abc4978a3..43cab47d1e1e 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/delete_channel.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/delete_channel.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_channel call in the Eventarc 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::Eventarc::V1::Eventarc::Client#delete_channel. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#delete_channel. # def delete_channel # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/delete_channel_connection.rb b/google-cloud-eventarc-v1/snippets/eventarc/delete_channel_connection.rb index e9cca505cbc5..8a694535696a 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/delete_channel_connection.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/delete_channel_connection.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_channel_connection call in the Eventarc 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::Eventarc::V1::Eventarc::Client#delete_channel_connection. It -# may require modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#delete_channel_connection. # def delete_channel_connection # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/delete_trigger.rb b/google-cloud-eventarc-v1/snippets/eventarc/delete_trigger.rb index bdfb3d700156..bd33ca1bd2e6 100755 --- a/google-cloud-eventarc-v1/snippets/eventarc/delete_trigger.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/delete_trigger.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_trigger call in the Eventarc 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::Eventarc::V1::Eventarc::Client#delete_trigger. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#delete_trigger. # def delete_trigger # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/get_channel.rb b/google-cloud-eventarc-v1/snippets/eventarc/get_channel.rb index 959924d26693..cb6e7292901a 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/get_channel.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/get_channel.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_channel call in the Eventarc 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::Eventarc::V1::Eventarc::Client#get_channel. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#get_channel. # def get_channel # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/get_channel_connection.rb b/google-cloud-eventarc-v1/snippets/eventarc/get_channel_connection.rb index d2bc3d1e0a4b..a4091a0e8088 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/get_channel_connection.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/get_channel_connection.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_channel_connection call in the Eventarc 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::Eventarc::V1::Eventarc::Client#get_channel_connection. It may -# require modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#get_channel_connection. # def get_channel_connection # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/get_google_channel_config.rb b/google-cloud-eventarc-v1/snippets/eventarc/get_google_channel_config.rb index f553c83a04de..7a0e73da9ba7 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/get_google_channel_config.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/get_google_channel_config.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_google_channel_config call in the Eventarc 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::Eventarc::V1::Eventarc::Client#get_google_channel_config. It -# may require modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#get_google_channel_config. # def get_google_channel_config # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/get_provider.rb b/google-cloud-eventarc-v1/snippets/eventarc/get_provider.rb index 5abb7433af84..1d397d6a00e4 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/get_provider.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/get_provider.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_provider call in the Eventarc 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::Eventarc::V1::Eventarc::Client#get_provider. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#get_provider. # def get_provider # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/get_trigger.rb b/google-cloud-eventarc-v1/snippets/eventarc/get_trigger.rb index f1fd62ff4166..95ea2991b1db 100755 --- a/google-cloud-eventarc-v1/snippets/eventarc/get_trigger.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/get_trigger.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_trigger call in the Eventarc 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::Eventarc::V1::Eventarc::Client#get_trigger. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#get_trigger. # def get_trigger # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/list_channel_connections.rb b/google-cloud-eventarc-v1/snippets/eventarc/list_channel_connections.rb index 1415ee1e1125..50046e507cd5 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/list_channel_connections.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/list_channel_connections.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_channel_connections call in the Eventarc 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::Eventarc::V1::Eventarc::Client#list_channel_connections. It may -# require modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#list_channel_connections. # def list_channel_connections # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/list_channels.rb b/google-cloud-eventarc-v1/snippets/eventarc/list_channels.rb index 8cb4bb1a3fc3..21188e363e92 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/list_channels.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/list_channels.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_channels call in the Eventarc 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::Eventarc::V1::Eventarc::Client#list_channels. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#list_channels. # def list_channels # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/list_providers.rb b/google-cloud-eventarc-v1/snippets/eventarc/list_providers.rb index fdbe17a990a4..061833ba46ca 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/list_providers.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/list_providers.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_providers call in the Eventarc 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::Eventarc::V1::Eventarc::Client#list_providers. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#list_providers. # def list_providers # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/list_triggers.rb b/google-cloud-eventarc-v1/snippets/eventarc/list_triggers.rb index 80a918d1407d..ef3d69c43d70 100755 --- a/google-cloud-eventarc-v1/snippets/eventarc/list_triggers.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/list_triggers.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_triggers call in the Eventarc 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::Eventarc::V1::Eventarc::Client#list_triggers. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#list_triggers. # def list_triggers # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/update_channel.rb b/google-cloud-eventarc-v1/snippets/eventarc/update_channel.rb index 60a45db53cf5..8273882dac9a 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/update_channel.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/update_channel.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_channel call in the Eventarc 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::Eventarc::V1::Eventarc::Client#update_channel. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#update_channel. # def update_channel # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/update_google_channel_config.rb b/google-cloud-eventarc-v1/snippets/eventarc/update_google_channel_config.rb index b0ad65f8c67a..134d1e7a2b3b 100644 --- a/google-cloud-eventarc-v1/snippets/eventarc/update_google_channel_config.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/update_google_channel_config.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_google_channel_config call in the Eventarc 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::Eventarc::V1::Eventarc::Client#update_google_channel_config. It -# may require modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#update_google_channel_config. # def update_google_channel_config # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/eventarc/update_trigger.rb b/google-cloud-eventarc-v1/snippets/eventarc/update_trigger.rb index 8c4b0497033c..6cd6f75f3929 100755 --- a/google-cloud-eventarc-v1/snippets/eventarc/update_trigger.rb +++ b/google-cloud-eventarc-v1/snippets/eventarc/update_trigger.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_trigger call in the Eventarc 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::Eventarc::V1::Eventarc::Client#update_trigger. It may require -# modification in order to execute successfully. +# Google::Cloud::Eventarc::V1::Eventarc::Client#update_trigger. # def update_trigger # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-eventarc-v1/snippets/snippet_metadata_google.cloud.eventarc.v1.json b/google-cloud-eventarc-v1/snippets/snippet_metadata_google.cloud.eventarc.v1.json index d4804093199b..13ce04f291ba 100644 --- a/google-cloud-eventarc-v1/snippets/snippet_metadata_google.cloud.eventarc.v1.json +++ b/google-cloud-eventarc-v1/snippets/snippet_metadata_google.cloud.eventarc.v1.json @@ -14,7 +14,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_GetTrigger_sync", "title": "Snippet for the get_trigger call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#get_trigger. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#get_trigger.", "file": "eventarc/get_trigger.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_ListTriggers_sync", "title": "Snippet for the list_triggers call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#list_triggers. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#list_triggers.", "file": "eventarc/list_triggers.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_CreateTrigger_sync", "title": "Snippet for the create_trigger call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#create_trigger. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#create_trigger.", "file": "eventarc/create_trigger.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_UpdateTrigger_sync", "title": "Snippet for the update_trigger call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#update_trigger. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#update_trigger.", "file": "eventarc/update_trigger.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_DeleteTrigger_sync", "title": "Snippet for the delete_trigger call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#delete_trigger. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#delete_trigger.", "file": "eventarc/delete_trigger.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_GetChannel_sync", "title": "Snippet for the get_channel call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#get_channel. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#get_channel.", "file": "eventarc/get_channel.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_ListChannels_sync", "title": "Snippet for the list_channels call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#list_channels. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#list_channels.", "file": "eventarc/list_channels.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_CreateChannel_sync", "title": "Snippet for the create_channel call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#create_channel. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#create_channel.", "file": "eventarc/create_channel.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_UpdateChannel_sync", "title": "Snippet for the update_channel call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#update_channel. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#update_channel.", "file": "eventarc/update_channel.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_DeleteChannel_sync", "title": "Snippet for the delete_channel call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#delete_channel. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#delete_channel.", "file": "eventarc/delete_channel.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_GetProvider_sync", "title": "Snippet for the get_provider call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#get_provider. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#get_provider.", "file": "eventarc/get_provider.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_ListProviders_sync", "title": "Snippet for the list_providers call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#list_providers. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#list_providers.", "file": "eventarc/list_providers.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_GetChannelConnection_sync", "title": "Snippet for the get_channel_connection call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#get_channel_connection. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#get_channel_connection.", "file": "eventarc/get_channel_connection.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_ListChannelConnections_sync", "title": "Snippet for the list_channel_connections call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#list_channel_connections. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#list_channel_connections.", "file": "eventarc/list_channel_connections.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_CreateChannelConnection_sync", "title": "Snippet for the create_channel_connection call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#create_channel_connection. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#create_channel_connection.", "file": "eventarc/create_channel_connection.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_DeleteChannelConnection_sync", "title": "Snippet for the delete_channel_connection call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#delete_channel_connection. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#delete_channel_connection.", "file": "eventarc/delete_channel_connection.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_GetGoogleChannelConfig_sync", "title": "Snippet for the get_google_channel_config call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#get_google_channel_config. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#get_google_channel_config.", "file": "eventarc/get_google_channel_config.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -694,7 +694,7 @@ { "region_tag": "eventarc_v1_generated_Eventarc_UpdateGoogleChannelConfig_sync", "title": "Snippet for the update_google_channel_config call in the Eventarc service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#update_google_channel_config. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Eventarc::V1::Eventarc::Client#update_google_channel_config.", "file": "eventarc/update_google_channel_config.rb", "language": "RUBY", "client_method": { @@ -726,7 +726,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-filestore-v1/.owlbot-manifest.json b/google-cloud-filestore-v1/.owlbot-manifest.json index d72938c9799b..f2b792440f81 100644 --- a/google-cloud-filestore-v1/.owlbot-manifest.json +++ b/google-cloud-filestore-v1/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-filestore-v1/.toys.rb b/google-cloud-filestore-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-filestore-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-filestore-v1/AUTHENTICATION.md b/google-cloud-filestore-v1/AUTHENTICATION.md index 9b22266d479c..3a7eefb2a452 100644 --- a/google-cloud-filestore-v1/AUTHENTICATION.md +++ b/google-cloud-filestore-v1/AUTHENTICATION.md @@ -1,149 +1,122 @@ # Authentication -In general, the google-cloud-filestore-v1 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-filestore-v1 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export GOOGLE_CLOUD_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/filestore/v1" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-filestore-v1 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-filestore-v1 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. -The environment variables that google-cloud-filestore-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Filestore::V1::CloudFilestoreManager::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/filestore/v1" - -ENV["GOOGLE_CLOUD_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/filestore/v1" client = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/filestore/v1" ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-filestore-v1 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/filestore/v1" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-filestore-v1. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-filestore-v1/google-cloud-filestore-v1.gemspec b/google-cloud-filestore-v1/google-cloud-filestore-v1.gemspec index f6d27ed09d25..b2afc56d2da1 100644 --- a/google-cloud-filestore-v1/google-cloud-filestore-v1.gemspec +++ b/google-cloud-filestore-v1/google-cloud-filestore-v1.gemspec @@ -23,10 +23,10 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-common", "~> 1.0" gem.add_dependency "google-cloud-errors", "~> 1.0" - gem.add_dependency "google-cloud-location", ">= 0.4", "< 2.a" + gem.add_dependency "google-cloud-location", ">= 0.7", "< 2.a" gem.add_development_dependency "google-style", "~> 1.26.3" gem.add_development_dependency "minitest", "~> 5.16" diff --git a/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/client.rb b/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/client.rb index 36d8adadc468..9a5e37213888 100644 --- a/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/client.rb +++ b/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/client.rb @@ -49,6 +49,9 @@ module CloudFilestoreManager # * `projects/12345/locations/us-central1/backups/my-backup` # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "file.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -143,6 +146,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_filestore_manager_stub.universe_domain + end + ## # Create a new CloudFilestoreManager client object. # @@ -176,8 +188,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -190,18 +203,22 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @cloud_filestore_manager_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -1915,9 +1932,9 @@ def update_backup request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"file.googleapis.com"`. - # @return [::String] + # 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 @@ -1963,13 +1980,20 @@ def update_backup request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "file.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -1984,6 +2008,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb b/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb index 69330ad97d50..3c239bcd9071 100644 --- a/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb +++ b/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb @@ -26,6 +26,9 @@ module V1 module CloudFilestoreManager # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "file.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -90,8 +102,10 @@ def initialize @operations_stub = ::Gapic::ServiceStub.new( ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -613,9 +627,9 @@ def wait_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"file.googleapis.com"`. - # @return [::String] + # 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 @@ -661,13 +675,20 @@ def wait_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "file.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -682,6 +703,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/client.rb b/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/client.rb index bc8cdbec0a09..404f495efd8f 100644 --- a/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/client.rb +++ b/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/client.rb @@ -51,6 +51,9 @@ module Rest # * `projects/12345/locations/us-central1/backups/my-backup` # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "file.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -145,6 +148,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_filestore_manager_stub.universe_domain + end + ## # Create a new CloudFilestoreManager REST client object. # @@ -172,8 +184,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -187,16 +200,23 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain config.bindings_override = @config.bindings_override end - @cloud_filestore_manager_stub = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @cloud_filestore_manager_stub = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -1785,9 +1805,9 @@ def update_backup request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"file.googleapis.com"`. - # @return [::String] + # 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 @@ -1824,13 +1844,20 @@ def update_backup request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "file.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -1842,6 +1869,7 @@ class Configuration 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 # @private # Overrides for http bindings for the RPCs of this service diff --git a/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/operations.rb b/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/operations.rb index 9f74c879e13b..49ae88af34e5 100644 --- a/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/operations.rb +++ b/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/operations.rb @@ -26,6 +26,9 @@ module CloudFilestoreManager module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "file.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -84,8 +96,10 @@ def initialize @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - credentials: credentials + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials ) # Used by an LRO wrapper for some methods of this service @@ -478,9 +492,9 @@ def cancel_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"file.googleapis.com"`. - # @return [::String] + # 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 @@ -517,13 +531,20 @@ def cancel_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "file.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -535,6 +556,7 @@ class Configuration 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 # @private def initialize parent_config = nil @@ -617,12 +639,15 @@ def initialize parent_rpcs = nil # Service stub contains baseline method implementations # including transcoding, making the REST call, and deserialing the response. class OperationsServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials end ## diff --git a/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/service_stub.rb b/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/service_stub.rb index bdbc31022be2..5e531e09dd8e 100644 --- a/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/service_stub.rb +++ b/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the list_instances REST call # diff --git a/google-cloud-filestore-v1/proto_docs/google/api/client.rb b/google-cloud-filestore-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-filestore-v1/proto_docs/google/api/client.rb +++ b/google-cloud-filestore-v1/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_backup.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_backup.rb index 92b2ba4ec310..4ac8bee276bc 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_backup.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_backup.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_backup call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#create_backup. It -# may require modification in order to execute successfully. +# Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#create_backup. # def create_backup # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_instance.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_instance.rb index 0018bf5cf3ca..47167c2b0d5b 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_instance.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_instance.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_instance call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#create_instance. -# It may require modification in order to execute successfully. # def create_instance # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_snapshot.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_snapshot.rb index 20696d82e6e9..9020176a52df 100644 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_snapshot.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/create_snapshot.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_snapshot call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#create_snapshot. -# It may require modification in order to execute successfully. # def create_snapshot # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_backup.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_backup.rb index 9e1ac2d23b47..9b58a6a0b6f6 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_backup.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_backup.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_backup call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#delete_backup. It -# may require modification in order to execute successfully. +# Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#delete_backup. # def delete_backup # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_instance.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_instance.rb index e74f3ddee5de..dd4b18b5600c 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_instance.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_instance.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_instance call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#delete_instance. -# It may require modification in order to execute successfully. # def delete_instance # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_snapshot.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_snapshot.rb index a1a92f5dacd2..12bec64f0df1 100644 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_snapshot.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/delete_snapshot.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_snapshot call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#delete_snapshot. -# It may require modification in order to execute successfully. # def delete_snapshot # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_backup.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_backup.rb index b1f64568db70..bde967af8a24 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_backup.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_backup.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_backup call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#get_backup. It may -# require modification in order to execute successfully. +# Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#get_backup. # def get_backup # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_instance.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_instance.rb index 5af574a9e22d..fa103b1ce637 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_instance.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_instance.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_instance call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#get_instance. It -# may require modification in order to execute successfully. +# Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#get_instance. # def get_instance # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_snapshot.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_snapshot.rb index 5233e48d9df7..d4c3e5858bd0 100644 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_snapshot.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/get_snapshot.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_snapshot call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#get_snapshot. It -# may require modification in order to execute successfully. +# Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#get_snapshot. # def get_snapshot # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_backups.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_backups.rb index e225fe3ab9c6..6b87a9514248 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_backups.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_backups.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_backups call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#list_backups. It -# may require modification in order to execute successfully. +# Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#list_backups. # def list_backups # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_instances.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_instances.rb index cbc157ee552e..d09b0830907f 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_instances.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_instances.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_instances call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#list_instances. It -# may require modification in order to execute successfully. +# Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#list_instances. # def list_instances # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_snapshots.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_snapshots.rb index 551f0b44e183..04c3e49b8d4e 100644 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_snapshots.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/list_snapshots.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_snapshots call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#list_snapshots. It -# may require modification in order to execute successfully. +# Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#list_snapshots. # def list_snapshots # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/restore_instance.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/restore_instance.rb index 61e14cdb97b9..c68a0e143e48 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/restore_instance.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/restore_instance.rb @@ -22,9 +22,14 @@ ## # Snippet for the restore_instance call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#restore_instance. -# It may require modification in order to execute successfully. # def restore_instance # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/revert_instance.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/revert_instance.rb index 74ea0baafff7..5efd597ff3a4 100644 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/revert_instance.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/revert_instance.rb @@ -22,9 +22,14 @@ ## # Snippet for the revert_instance call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#revert_instance. -# It may require modification in order to execute successfully. # def revert_instance # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_backup.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_backup.rb index db79df1b2c30..1bca0c892354 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_backup.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_backup.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_backup call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#update_backup. It -# may require modification in order to execute successfully. +# Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#update_backup. # def update_backup # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_instance.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_instance.rb index 1da336dd888c..dba1f7650303 100755 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_instance.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_instance.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_instance call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#update_instance. -# It may require modification in order to execute successfully. # def update_instance # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_snapshot.rb b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_snapshot.rb index 0d23f8bb2869..3c53608216ab 100644 --- a/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_snapshot.rb +++ b/google-cloud-filestore-v1/snippets/cloud_filestore_manager/update_snapshot.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_snapshot call in the CloudFilestoreManager 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::Filestore::V1::CloudFilestoreManager::Client#update_snapshot. -# It may require modification in order to execute successfully. # def update_snapshot # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-filestore-v1/snippets/snippet_metadata_google.cloud.filestore.v1.json b/google-cloud-filestore-v1/snippets/snippet_metadata_google.cloud.filestore.v1.json index 60f3c4b9dd69..33f22b5acedb 100644 --- a/google-cloud-filestore-v1/snippets/snippet_metadata_google.cloud.filestore.v1.json +++ b/google-cloud-filestore-v1/snippets/snippet_metadata_google.cloud.filestore.v1.json @@ -14,7 +14,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_ListInstances_sync", "title": "Snippet for the list_instances call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#list_instances. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#list_instances.", "file": "cloud_filestore_manager/list_instances.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_GetInstance_sync", "title": "Snippet for the get_instance call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#get_instance. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#get_instance.", "file": "cloud_filestore_manager/get_instance.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_CreateInstance_sync", "title": "Snippet for the create_instance call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#create_instance. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#create_instance.", "file": "cloud_filestore_manager/create_instance.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_UpdateInstance_sync", "title": "Snippet for the update_instance call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#update_instance. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#update_instance.", "file": "cloud_filestore_manager/update_instance.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_RestoreInstance_sync", "title": "Snippet for the restore_instance call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#restore_instance. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#restore_instance.", "file": "cloud_filestore_manager/restore_instance.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_RevertInstance_sync", "title": "Snippet for the revert_instance call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#revert_instance. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#revert_instance.", "file": "cloud_filestore_manager/revert_instance.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_DeleteInstance_sync", "title": "Snippet for the delete_instance call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#delete_instance. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#delete_instance.", "file": "cloud_filestore_manager/delete_instance.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_ListSnapshots_sync", "title": "Snippet for the list_snapshots call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#list_snapshots. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#list_snapshots.", "file": "cloud_filestore_manager/list_snapshots.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_GetSnapshot_sync", "title": "Snippet for the get_snapshot call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#get_snapshot. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#get_snapshot.", "file": "cloud_filestore_manager/get_snapshot.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_CreateSnapshot_sync", "title": "Snippet for the create_snapshot call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#create_snapshot. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#create_snapshot.", "file": "cloud_filestore_manager/create_snapshot.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_DeleteSnapshot_sync", "title": "Snippet for the delete_snapshot call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#delete_snapshot. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#delete_snapshot.", "file": "cloud_filestore_manager/delete_snapshot.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_UpdateSnapshot_sync", "title": "Snippet for the update_snapshot call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#update_snapshot. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#update_snapshot.", "file": "cloud_filestore_manager/update_snapshot.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_ListBackups_sync", "title": "Snippet for the list_backups call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#list_backups. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#list_backups.", "file": "cloud_filestore_manager/list_backups.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_GetBackup_sync", "title": "Snippet for the get_backup call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#get_backup. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#get_backup.", "file": "cloud_filestore_manager/get_backup.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_CreateBackup_sync", "title": "Snippet for the create_backup call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#create_backup. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#create_backup.", "file": "cloud_filestore_manager/create_backup.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_DeleteBackup_sync", "title": "Snippet for the delete_backup call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#delete_backup. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#delete_backup.", "file": "cloud_filestore_manager/delete_backup.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "file_v1_generated_CloudFilestoreManager_UpdateBackup_sync", "title": "Snippet for the update_backup call in the CloudFilestoreManager service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#update_backup. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Filestore::V1::CloudFilestoreManager::Client#update_backup.", "file": "cloud_filestore_manager/update_backup.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] diff --git a/google-cloud-firestore-admin-v1/.owlbot-manifest.json b/google-cloud-firestore-admin-v1/.owlbot-manifest.json index 5e1d84f78233..98613cb26fad 100644 --- a/google-cloud-firestore-admin-v1/.owlbot-manifest.json +++ b/google-cloud-firestore-admin-v1/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-firestore-admin-v1/.toys.rb b/google-cloud-firestore-admin-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-firestore-admin-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-firestore-admin-v1/AUTHENTICATION.md b/google-cloud-firestore-admin-v1/AUTHENTICATION.md index dd54315d8513..8143a0bdf549 100644 --- a/google-cloud-firestore-admin-v1/AUTHENTICATION.md +++ b/google-cloud-firestore-admin-v1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-firestore-admin-v1 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-firestore-admin-v1 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export FIRESTORE_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/firestore/admin/v1" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-firestore-admin-v1 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-firestore-admin-v1 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. -The environment variables that google-cloud-firestore-admin-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `FIRESTORE_CREDENTIALS` - Path to JSON file, or JSON contents -* `FIRESTORE_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/firestore/admin/v1" - -ENV["FIRESTORE_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/firestore/admin/v1" client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/firestore/admin/v1" ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-firestore-admin-v1 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/firestore/admin/v1" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-firestore-admin-v1. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-firestore-admin-v1/google-cloud-firestore-admin-v1.gemspec b/google-cloud-firestore-admin-v1/google-cloud-firestore-admin-v1.gemspec index 8390de34c733..c6d1a39957f6 100644 --- a/google-cloud-firestore-admin-v1/google-cloud-firestore-admin-v1.gemspec +++ b/google-cloud-firestore-admin-v1/google-cloud-firestore-admin-v1.gemspec @@ -23,9 +23,9 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-errors", "~> 1.0" - gem.add_dependency "google-cloud-location", ">= 0.4", "< 2.a" + gem.add_dependency "google-cloud-location", ">= 0.7", "< 2.a" gem.add_development_dependency "google-style", "~> 1.26.3" gem.add_development_dependency "minitest", "~> 5.16" diff --git a/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb b/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb index 575b88e8cd93..cab02ce42327 100644 --- a/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb +++ b/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb @@ -59,6 +59,9 @@ module FirestoreAdmin # service `google.longrunning.Operations`. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "firestore.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -152,6 +155,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @firestore_admin_stub.universe_domain + end + ## # Create a new FirestoreAdmin client object. # @@ -185,8 +197,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -199,18 +212,22 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @firestore_admin_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -1657,9 +1674,9 @@ def delete_database request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"firestore.googleapis.com"`. - # @return [::String] + # 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 @@ -1705,13 +1722,20 @@ def delete_database request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "firestore.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -1726,6 +1750,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/operations.rb b/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/operations.rb index 19b5bbe400e2..d724a1efe9aa 100644 --- a/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/operations.rb +++ b/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/operations.rb @@ -27,6 +27,9 @@ module V1 module FirestoreAdmin # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "firestore.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -61,6 +64,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -91,8 +103,10 @@ def initialize @operations_stub = ::Gapic::ServiceStub.new( ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -614,9 +628,9 @@ def wait_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"firestore.googleapis.com"`. - # @return [::String] + # 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 @@ -662,13 +676,20 @@ def wait_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "firestore.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -683,6 +704,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb b/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb index 1d279234bbdd..d419309c1807 100644 --- a/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb +++ b/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb @@ -61,6 +61,9 @@ module Rest # service `google.longrunning.Operations`. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "firestore.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -154,6 +157,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @firestore_admin_stub.universe_domain + end + ## # Create a new FirestoreAdmin REST client object. # @@ -181,8 +193,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -196,15 +209,22 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end - @firestore_admin_stub = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @firestore_admin_stub = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -1549,9 +1569,9 @@ def delete_database request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"firestore.googleapis.com"`. - # @return [::String] + # 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 @@ -1588,13 +1608,20 @@ def delete_database request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "firestore.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -1606,6 +1633,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/operations.rb b/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/operations.rb index 269b6e1cba30..209d4625567c 100644 --- a/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/operations.rb +++ b/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/operations.rb @@ -27,6 +27,9 @@ module FirestoreAdmin module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "firestore.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -61,6 +64,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -85,8 +97,10 @@ def initialize @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - credentials: credentials + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials ) # Used by an LRO wrapper for some methods of this service @@ -479,9 +493,9 @@ def cancel_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"firestore.googleapis.com"`. - # @return [::String] + # 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 @@ -518,13 +532,20 @@ def cancel_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "firestore.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -536,6 +557,7 @@ class Configuration 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 # @private def initialize parent_config = nil @@ -618,12 +640,15 @@ def initialize parent_rpcs = nil # Service stub contains baseline method implementations # including transcoding, making the REST call, and deserialing the response. class OperationsServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials end ## diff --git a/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/service_stub.rb b/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/service_stub.rb index 1efed082f7a4..0dd0df55da83 100644 --- a/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/service_stub.rb +++ b/google-cloud-firestore-admin-v1/lib/google/cloud/firestore/admin/v1/firestore_admin/rest/service_stub.rb @@ -31,16 +31,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the create_index REST call # diff --git a/google-cloud-firestore-admin-v1/proto_docs/google/api/client.rb b/google-cloud-firestore-admin-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-firestore-admin-v1/proto_docs/google/api/client.rb +++ b/google-cloud-firestore-admin-v1/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/create_database.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/create_database.rb index 64c465b63075..a3a48f63bb8c 100644 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/create_database.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/create_database.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_database call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#create_database. -# It may require modification in order to execute successfully. # def create_database # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/create_index.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/create_index.rb index d9c97bbf14df..7022a7ae9cee 100755 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/create_index.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/create_index.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_index call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#create_index. It -# may require modification in order to execute successfully. +# Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#create_index. # def create_index # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/delete_database.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/delete_database.rb index 7e5fac9c573e..40af6bce3910 100644 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/delete_database.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/delete_database.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_database call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#delete_database. -# It may require modification in order to execute successfully. # def delete_database # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/delete_index.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/delete_index.rb index 781c3be5cfb7..e3b2a2e0bf3a 100755 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/delete_index.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/delete_index.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_index call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#delete_index. It -# may require modification in order to execute successfully. +# Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#delete_index. # def delete_index # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/export_documents.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/export_documents.rb index 415aac9f132a..cbe0c18f9775 100755 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/export_documents.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/export_documents.rb @@ -22,9 +22,14 @@ ## # Snippet for the export_documents call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#export_documents. -# It may require modification in order to execute successfully. # def export_documents # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_database.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_database.rb index eff073f66952..f8ff47d75fc6 100644 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_database.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_database.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_database call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#get_database. It -# may require modification in order to execute successfully. +# Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#get_database. # def get_database # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_field.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_field.rb index 01971a091b03..e3ca5c8d6aaf 100755 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_field.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_field.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_field call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#get_field. It may -# require modification in order to execute successfully. +# Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#get_field. # def get_field # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_index.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_index.rb index a773a646bba4..c7d3fab2bf49 100755 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_index.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/get_index.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_index call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#get_index. It may -# require modification in order to execute successfully. +# Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#get_index. # def get_index # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/import_documents.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/import_documents.rb index ac6014700f47..815bce918fcc 100755 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/import_documents.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/import_documents.rb @@ -22,9 +22,14 @@ ## # Snippet for the import_documents call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#import_documents. -# It may require modification in order to execute successfully. # def import_documents # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_databases.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_databases.rb index b439f2581974..c3cbd9fa102b 100644 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_databases.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_databases.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_databases call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#list_databases. It -# may require modification in order to execute successfully. +# Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_databases. # def list_databases # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_fields.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_fields.rb index 83835f7a2799..89e9af56f4aa 100755 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_fields.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_fields.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_fields call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields. It -# may require modification in order to execute successfully. +# Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields. # def list_fields # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_indexes.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_indexes.rb index 8a28539f4dbb..4625ee877a96 100755 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_indexes.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/list_indexes.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_indexes call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#list_indexes. It -# may require modification in order to execute successfully. +# Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_indexes. # def list_indexes # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/update_database.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/update_database.rb index 5c6d5976b170..582525715fe9 100644 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/update_database.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/update_database.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_database call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#update_database. -# It may require modification in order to execute successfully. # def update_database # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/firestore_admin/update_field.rb b/google-cloud-firestore-admin-v1/snippets/firestore_admin/update_field.rb index 81d038af6cea..a38355e6b146 100755 --- a/google-cloud-firestore-admin-v1/snippets/firestore_admin/update_field.rb +++ b/google-cloud-firestore-admin-v1/snippets/firestore_admin/update_field.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_field call in the FirestoreAdmin 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::Firestore::Admin::V1::FirestoreAdmin::Client#update_field. It -# may require modification in order to execute successfully. +# Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#update_field. # def update_field # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-admin-v1/snippets/snippet_metadata_google.firestore.admin.v1.json b/google-cloud-firestore-admin-v1/snippets/snippet_metadata_google.firestore.admin.v1.json index b346919df7f8..85a2ee15f2d5 100644 --- a/google-cloud-firestore-admin-v1/snippets/snippet_metadata_google.firestore.admin.v1.json +++ b/google-cloud-firestore-admin-v1/snippets/snippet_metadata_google.firestore.admin.v1.json @@ -14,7 +14,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_CreateIndex_sync", "title": "Snippet for the create_index call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#create_index. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#create_index.", "file": "firestore_admin/create_index.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_ListIndexes_sync", "title": "Snippet for the list_indexes call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_indexes. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_indexes.", "file": "firestore_admin/list_indexes.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_GetIndex_sync", "title": "Snippet for the get_index call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#get_index. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#get_index.", "file": "firestore_admin/get_index.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_DeleteIndex_sync", "title": "Snippet for the delete_index call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#delete_index. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#delete_index.", "file": "firestore_admin/delete_index.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_GetField_sync", "title": "Snippet for the get_field call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#get_field. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#get_field.", "file": "firestore_admin/get_field.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_UpdateField_sync", "title": "Snippet for the update_field call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#update_field. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#update_field.", "file": "firestore_admin/update_field.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_ListFields_sync", "title": "Snippet for the list_fields call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields.", "file": "firestore_admin/list_fields.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_ExportDocuments_sync", "title": "Snippet for the export_documents call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#export_documents. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#export_documents.", "file": "firestore_admin/export_documents.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_ImportDocuments_sync", "title": "Snippet for the import_documents call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#import_documents. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#import_documents.", "file": "firestore_admin/import_documents.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_CreateDatabase_sync", "title": "Snippet for the create_database call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#create_database. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#create_database.", "file": "firestore_admin/create_database.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_GetDatabase_sync", "title": "Snippet for the get_database call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#get_database. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#get_database.", "file": "firestore_admin/get_database.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_ListDatabases_sync", "title": "Snippet for the list_databases call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_databases. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_databases.", "file": "firestore_admin/list_databases.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_UpdateDatabase_sync", "title": "Snippet for the update_database call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#update_database. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#update_database.", "file": "firestore_admin/update_database.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "firestore_v1_generated_FirestoreAdmin_DeleteDatabase_sync", "title": "Snippet for the delete_database call in the FirestoreAdmin service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#delete_database. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#delete_database.", "file": "firestore_admin/delete_database.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] diff --git a/google-cloud-firestore-v1/.owlbot-manifest.json b/google-cloud-firestore-v1/.owlbot-manifest.json index b79dc6ad9a65..c8022115e546 100644 --- a/google-cloud-firestore-v1/.owlbot-manifest.json +++ b/google-cloud-firestore-v1/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-firestore-v1/.toys.rb b/google-cloud-firestore-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-firestore-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-firestore-v1/AUTHENTICATION.md b/google-cloud-firestore-v1/AUTHENTICATION.md index efc5dbe03536..928670fe30c0 100644 --- a/google-cloud-firestore-v1/AUTHENTICATION.md +++ b/google-cloud-firestore-v1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-firestore-v1 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-firestore-v1 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export FIRESTORE_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/firestore/v1" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::Firestore::V1::Firestore::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-firestore-v1 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-firestore-v1 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. -The environment variables that google-cloud-firestore-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Firestore::V1::Firestore::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `FIRESTORE_CREDENTIALS` - Path to JSON file, or JSON contents -* `FIRESTORE_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/firestore/v1" - -ENV["FIRESTORE_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Firestore::V1::Firestore::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/firestore/v1" client = ::Google::Cloud::Firestore::V1::Firestore::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/firestore/v1" ::Google::Cloud::Firestore::V1::Firestore::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Firestore::V1::Firestore::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-firestore-v1 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/firestore/v1" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-firestore-v1. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::Firestore::V1::Firestore::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-firestore-v1/google-cloud-firestore-v1.gemspec b/google-cloud-firestore-v1/google-cloud-firestore-v1.gemspec index b78d291c2f7f..6bfe721dde48 100644 --- a/google-cloud-firestore-v1/google-cloud-firestore-v1.gemspec +++ b/google-cloud-firestore-v1/google-cloud-firestore-v1.gemspec @@ -23,9 +23,9 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-errors", "~> 1.0" - gem.add_dependency "google-cloud-location", ">= 0.4", "< 2.a" + gem.add_dependency "google-cloud-location", ">= 0.7", "< 2.a" gem.add_development_dependency "google-style", "~> 1.26.3" gem.add_development_dependency "minitest", "~> 5.16" diff --git a/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/client.rb b/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/client.rb index 8dc136688f15..517a206cddea 100644 --- a/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/client.rb +++ b/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/client.rb @@ -38,6 +38,9 @@ module Firestore # truly serverless apps. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "firestore.$UNIVERSE_DOMAIN$" + # @private attr_reader :firestore_stub @@ -173,6 +176,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @firestore_stub.universe_domain + end + ## # Create a new Firestore client object. # @@ -206,8 +218,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -220,12 +233,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @firestore_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Firestore::V1::Firestore::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -1933,9 +1949,9 @@ def create_document request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"firestore.googleapis.com"`. - # @return [::String] + # 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 @@ -1981,13 +1997,20 @@ def create_document request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "firestore.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -2002,6 +2025,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/client.rb b/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/client.rb index 1200815270aa..bc4c888e8c6b 100644 --- a/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/client.rb +++ b/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/client.rb @@ -40,6 +40,9 @@ module Rest # truly serverless apps. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "firestore.$UNIVERSE_DOMAIN$" + # @private attr_reader :firestore_stub @@ -168,6 +171,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @firestore_stub.universe_domain + end + ## # Create a new Firestore REST client object. # @@ -195,8 +207,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -210,9 +223,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end - @firestore_stub = ::Google::Cloud::Firestore::V1::Firestore::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @firestore_stub = ::Google::Cloud::Firestore::V1::Firestore::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -1658,9 +1677,9 @@ def create_document request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"firestore.googleapis.com"`. - # @return [::String] + # 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 @@ -1697,13 +1716,20 @@ def create_document request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "firestore.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -1715,6 +1741,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb b/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb index 0ae3fce125db..bf17b4c58060 100644 --- a/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb +++ b/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the get_document REST call # diff --git a/google-cloud-firestore-v1/proto_docs/google/api/client.rb b/google-cloud-firestore-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-firestore-v1/proto_docs/google/api/client.rb +++ b/google-cloud-firestore-v1/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-firestore-v1/snippets/firestore/batch_get_documents.rb b/google-cloud-firestore-v1/snippets/firestore/batch_get_documents.rb index d59be2a2c7f2..749fe7e02379 100755 --- a/google-cloud-firestore-v1/snippets/firestore/batch_get_documents.rb +++ b/google-cloud-firestore-v1/snippets/firestore/batch_get_documents.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_get_documents call in the Firestore 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::Firestore::V1::Firestore::Client#batch_get_documents. It may -# require modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#batch_get_documents. # def batch_get_documents # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/batch_write.rb b/google-cloud-firestore-v1/snippets/firestore/batch_write.rb index e0f407b2bd83..052952090ad1 100755 --- a/google-cloud-firestore-v1/snippets/firestore/batch_write.rb +++ b/google-cloud-firestore-v1/snippets/firestore/batch_write.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_write call in the Firestore 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::Firestore::V1::Firestore::Client#batch_write. It may require -# modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#batch_write. # def batch_write # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/begin_transaction.rb b/google-cloud-firestore-v1/snippets/firestore/begin_transaction.rb index fcf08abf8681..c524a6f826e1 100755 --- a/google-cloud-firestore-v1/snippets/firestore/begin_transaction.rb +++ b/google-cloud-firestore-v1/snippets/firestore/begin_transaction.rb @@ -22,9 +22,14 @@ ## # Snippet for the begin_transaction call in the Firestore 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::Firestore::V1::Firestore::Client#begin_transaction. It may -# require modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#begin_transaction. # def begin_transaction # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/commit.rb b/google-cloud-firestore-v1/snippets/firestore/commit.rb index 43a4401bf657..0ab4e874f3e9 100755 --- a/google-cloud-firestore-v1/snippets/firestore/commit.rb +++ b/google-cloud-firestore-v1/snippets/firestore/commit.rb @@ -22,9 +22,14 @@ ## # Snippet for the commit call in the Firestore 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::Firestore::V1::Firestore::Client#commit. It may require -# modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#commit. # def commit # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/create_document.rb b/google-cloud-firestore-v1/snippets/firestore/create_document.rb index 27953fe73f2b..126b2e384599 100755 --- a/google-cloud-firestore-v1/snippets/firestore/create_document.rb +++ b/google-cloud-firestore-v1/snippets/firestore/create_document.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_document call in the Firestore 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::Firestore::V1::Firestore::Client#create_document. It may -# require modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#create_document. # def create_document # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/delete_document.rb b/google-cloud-firestore-v1/snippets/firestore/delete_document.rb index c239c7ef30d0..8468165feccc 100755 --- a/google-cloud-firestore-v1/snippets/firestore/delete_document.rb +++ b/google-cloud-firestore-v1/snippets/firestore/delete_document.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_document call in the Firestore 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::Firestore::V1::Firestore::Client#delete_document. It may -# require modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#delete_document. # def delete_document # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/get_document.rb b/google-cloud-firestore-v1/snippets/firestore/get_document.rb index 1a8b06b0f5a6..fc5496f83c5e 100755 --- a/google-cloud-firestore-v1/snippets/firestore/get_document.rb +++ b/google-cloud-firestore-v1/snippets/firestore/get_document.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_document call in the Firestore 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::Firestore::V1::Firestore::Client#get_document. It may require -# modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#get_document. # def get_document # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/list_collection_ids.rb b/google-cloud-firestore-v1/snippets/firestore/list_collection_ids.rb index c6872b9b331b..fd1f314b634c 100755 --- a/google-cloud-firestore-v1/snippets/firestore/list_collection_ids.rb +++ b/google-cloud-firestore-v1/snippets/firestore/list_collection_ids.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_collection_ids call in the Firestore 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::Firestore::V1::Firestore::Client#list_collection_ids. It may -# require modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#list_collection_ids. # def list_collection_ids # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/list_documents.rb b/google-cloud-firestore-v1/snippets/firestore/list_documents.rb index 4322979643ce..62971318ffed 100755 --- a/google-cloud-firestore-v1/snippets/firestore/list_documents.rb +++ b/google-cloud-firestore-v1/snippets/firestore/list_documents.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_documents call in the Firestore 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::Firestore::V1::Firestore::Client#list_documents. It may require -# modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#list_documents. # def list_documents # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/listen.rb b/google-cloud-firestore-v1/snippets/firestore/listen.rb index f701066817e7..01bda80b1819 100755 --- a/google-cloud-firestore-v1/snippets/firestore/listen.rb +++ b/google-cloud-firestore-v1/snippets/firestore/listen.rb @@ -22,9 +22,14 @@ ## # Snippet for the listen call in the Firestore 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::Firestore::V1::Firestore::Client#listen. It may require -# modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#listen. # def listen # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/partition_query.rb b/google-cloud-firestore-v1/snippets/firestore/partition_query.rb index 4f4a0de98dc3..62b6e42adc3c 100755 --- a/google-cloud-firestore-v1/snippets/firestore/partition_query.rb +++ b/google-cloud-firestore-v1/snippets/firestore/partition_query.rb @@ -22,9 +22,14 @@ ## # Snippet for the partition_query call in the Firestore 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::Firestore::V1::Firestore::Client#partition_query. It may -# require modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#partition_query. # def partition_query # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/rollback.rb b/google-cloud-firestore-v1/snippets/firestore/rollback.rb index aea921597c86..a35c9e7a185f 100755 --- a/google-cloud-firestore-v1/snippets/firestore/rollback.rb +++ b/google-cloud-firestore-v1/snippets/firestore/rollback.rb @@ -22,9 +22,14 @@ ## # Snippet for the rollback call in the Firestore 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::Firestore::V1::Firestore::Client#rollback. It may require -# modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#rollback. # def rollback # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/run_aggregation_query.rb b/google-cloud-firestore-v1/snippets/firestore/run_aggregation_query.rb index 9d99d02966b5..f030a23e9cf4 100644 --- a/google-cloud-firestore-v1/snippets/firestore/run_aggregation_query.rb +++ b/google-cloud-firestore-v1/snippets/firestore/run_aggregation_query.rb @@ -22,9 +22,14 @@ ## # Snippet for the run_aggregation_query call in the Firestore 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::Firestore::V1::Firestore::Client#run_aggregation_query. It may -# require modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#run_aggregation_query. # def run_aggregation_query # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/run_query.rb b/google-cloud-firestore-v1/snippets/firestore/run_query.rb index d699d405ada6..cd779949aac8 100755 --- a/google-cloud-firestore-v1/snippets/firestore/run_query.rb +++ b/google-cloud-firestore-v1/snippets/firestore/run_query.rb @@ -22,9 +22,14 @@ ## # Snippet for the run_query call in the Firestore 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::Firestore::V1::Firestore::Client#run_query. It may require -# modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#run_query. # def run_query # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/update_document.rb b/google-cloud-firestore-v1/snippets/firestore/update_document.rb index 37581cdbcbe1..c126bac5c1b4 100755 --- a/google-cloud-firestore-v1/snippets/firestore/update_document.rb +++ b/google-cloud-firestore-v1/snippets/firestore/update_document.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_document call in the Firestore 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::Firestore::V1::Firestore::Client#update_document. It may -# require modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#update_document. # def update_document # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/firestore/write.rb b/google-cloud-firestore-v1/snippets/firestore/write.rb index 50983f1d9f98..097df3085a2a 100755 --- a/google-cloud-firestore-v1/snippets/firestore/write.rb +++ b/google-cloud-firestore-v1/snippets/firestore/write.rb @@ -22,9 +22,14 @@ ## # Snippet for the write call in the Firestore 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::Firestore::V1::Firestore::Client#write. It may require -# modification in order to execute successfully. +# Google::Cloud::Firestore::V1::Firestore::Client#write. # def write # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-firestore-v1/snippets/snippet_metadata_google.firestore.v1.json b/google-cloud-firestore-v1/snippets/snippet_metadata_google.firestore.v1.json index 789b7e49b1e6..86dbaddf66dc 100644 --- a/google-cloud-firestore-v1/snippets/snippet_metadata_google.firestore.v1.json +++ b/google-cloud-firestore-v1/snippets/snippet_metadata_google.firestore.v1.json @@ -14,7 +14,7 @@ { "region_tag": "firestore_v1_generated_Firestore_GetDocument_sync", "title": "Snippet for the get_document call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#get_document. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#get_document.", "file": "firestore/get_document.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "firestore_v1_generated_Firestore_ListDocuments_sync", "title": "Snippet for the list_documents call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#list_documents. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#list_documents.", "file": "firestore/list_documents.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "firestore_v1_generated_Firestore_UpdateDocument_sync", "title": "Snippet for the update_document call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#update_document. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#update_document.", "file": "firestore/update_document.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "firestore_v1_generated_Firestore_DeleteDocument_sync", "title": "Snippet for the delete_document call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#delete_document. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#delete_document.", "file": "firestore/delete_document.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "firestore_v1_generated_Firestore_BatchGetDocuments_sync", "title": "Snippet for the batch_get_documents call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#batch_get_documents. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#batch_get_documents.", "file": "firestore/batch_get_documents.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 44, + "end": 49, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "firestore_v1_generated_Firestore_BeginTransaction_sync", "title": "Snippet for the begin_transaction call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#begin_transaction. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#begin_transaction.", "file": "firestore/begin_transaction.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "firestore_v1_generated_Firestore_Commit_sync", "title": "Snippet for the commit call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#commit. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#commit.", "file": "firestore/commit.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "firestore_v1_generated_Firestore_Rollback_sync", "title": "Snippet for the rollback call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#rollback. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#rollback.", "file": "firestore/rollback.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "firestore_v1_generated_Firestore_RunQuery_sync", "title": "Snippet for the run_query call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#run_query. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#run_query.", "file": "firestore/run_query.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 44, + "end": 49, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "firestore_v1_generated_Firestore_RunAggregationQuery_sync", "title": "Snippet for the run_aggregation_query call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#run_aggregation_query. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#run_aggregation_query.", "file": "firestore/run_aggregation_query.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 44, + "end": 49, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "firestore_v1_generated_Firestore_PartitionQuery_sync", "title": "Snippet for the partition_query call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#partition_query. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#partition_query.", "file": "firestore/partition_query.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "firestore_v1_generated_Firestore_Write_sync", "title": "Snippet for the write call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#write. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#write.", "file": "firestore/write.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 50, + "end": 55, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "firestore_v1_generated_Firestore_Listen_sync", "title": "Snippet for the listen call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#listen. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#listen.", "file": "firestore/listen.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 50, + "end": 55, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "firestore_v1_generated_Firestore_ListCollectionIds_sync", "title": "Snippet for the list_collection_ids call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#list_collection_ids. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#list_collection_ids.", "file": "firestore/list_collection_ids.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "firestore_v1_generated_Firestore_BatchWrite_sync", "title": "Snippet for the batch_write call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#batch_write. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#batch_write.", "file": "firestore/batch_write.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "firestore_v1_generated_Firestore_CreateDocument_sync", "title": "Snippet for the create_document call in the Firestore service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#create_document. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Firestore::V1::Firestore::Client#create_document.", "file": "firestore/create_document.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-functions-v1/.owlbot-manifest.json b/google-cloud-functions-v1/.owlbot-manifest.json index b91bbd177603..5ea886871546 100644 --- a/google-cloud-functions-v1/.owlbot-manifest.json +++ b/google-cloud-functions-v1/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-functions-v1/.toys.rb b/google-cloud-functions-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-functions-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-functions-v1/AUTHENTICATION.md b/google-cloud-functions-v1/AUTHENTICATION.md index 8dcf6a831973..593505e94f8d 100644 --- a/google-cloud-functions-v1/AUTHENTICATION.md +++ b/google-cloud-functions-v1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-functions-v1 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-functions-v1 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export FUNCTIONS_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/functions/v1" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-functions-v1 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-functions-v1 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. -The environment variables that google-cloud-functions-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Functions::V1::CloudFunctionsService::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `FUNCTIONS_CREDENTIALS` - Path to JSON file, or JSON contents -* `FUNCTIONS_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/functions/v1" - -ENV["FUNCTIONS_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/functions/v1" client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/functions/v1" ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-functions-v1 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/functions/v1" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-functions-v1. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-functions-v1/google-cloud-functions-v1.gemspec b/google-cloud-functions-v1/google-cloud-functions-v1.gemspec index 1292fb036c53..fa97207c504f 100644 --- a/google-cloud-functions-v1/google-cloud-functions-v1.gemspec +++ b/google-cloud-functions-v1/google-cloud-functions-v1.gemspec @@ -23,10 +23,10 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-errors", "~> 1.0" - gem.add_dependency "google-cloud-location", ">= 0.4", "< 2.a" - gem.add_dependency "google-iam-v1", ">= 0.4", "< 2.a" + gem.add_dependency "google-cloud-location", ">= 0.7", "< 2.a" + gem.add_dependency "google-iam-v1", ">= 0.7", "< 2.a" gem.add_development_dependency "google-style", "~> 1.26.3" gem.add_development_dependency "minitest", "~> 5.16" diff --git a/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/client.rb b/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/client.rb index 1e8fa0e09b55..675582a8c9c0 100644 --- a/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/client.rb +++ b/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/client.rb @@ -32,6 +32,9 @@ module CloudFunctionsService # A service that application uses to manipulate triggers and functions. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudfunctions.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -116,6 +119,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_functions_service_stub.universe_domain + end + ## # Create a new CloudFunctionsService client object. # @@ -149,8 +161,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -163,24 +176,29 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @cloud_functions_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Functions::V1::CloudFunctionsService::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -1309,9 +1327,9 @@ def test_iam_permissions request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudfunctions.googleapis.com"`. - # @return [::String] + # 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 @@ -1357,13 +1375,20 @@ def test_iam_permissions request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "cloudfunctions.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -1378,6 +1403,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/operations.rb b/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/operations.rb index 1c9dc98cf289..645e8fdecb45 100644 --- a/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/operations.rb +++ b/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/operations.rb @@ -26,6 +26,9 @@ module V1 module CloudFunctionsService # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudfunctions.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -90,8 +102,10 @@ def initialize @operations_stub = ::Gapic::ServiceStub.new( ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -605,9 +619,9 @@ def wait_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudfunctions.googleapis.com"`. - # @return [::String] + # 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 @@ -653,13 +667,20 @@ def wait_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "cloudfunctions.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -674,6 +695,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/client.rb b/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/client.rb index 792f04a62fc9..a25b1c104251 100644 --- a/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/client.rb +++ b/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/client.rb @@ -34,6 +34,9 @@ module Rest # A service that application uses to manipulate triggers and functions. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudfunctions.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -118,6 +121,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_functions_service_stub.universe_domain + end + ## # Create a new CloudFunctionsService REST client object. # @@ -145,8 +157,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -160,12 +173,14 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain config.bindings_override = @config.bindings_override end @@ -173,9 +188,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end - @cloud_functions_service_stub = ::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @cloud_functions_service_stub = ::Google::Cloud::Functions::V1::CloudFunctionsService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -1222,9 +1243,9 @@ def test_iam_permissions request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudfunctions.googleapis.com"`. - # @return [::String] + # 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 @@ -1261,13 +1282,20 @@ def test_iam_permissions request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "cloudfunctions.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -1279,6 +1307,7 @@ class Configuration 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 # @private # Overrides for http bindings for the RPCs of this service diff --git a/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/operations.rb b/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/operations.rb index 6726e9bb3cf1..d360fed147f0 100644 --- a/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/operations.rb +++ b/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/operations.rb @@ -26,6 +26,9 @@ module CloudFunctionsService module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudfunctions.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -84,8 +96,10 @@ def initialize @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - credentials: credentials + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials ) # Used by an LRO wrapper for some methods of this service @@ -478,9 +492,9 @@ def cancel_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudfunctions.googleapis.com"`. - # @return [::String] + # 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 @@ -517,13 +531,20 @@ def cancel_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "cloudfunctions.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -535,6 +556,7 @@ class Configuration 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 # @private def initialize parent_config = nil @@ -617,12 +639,15 @@ def initialize parent_rpcs = nil # Service stub contains baseline method implementations # including transcoding, making the REST call, and deserialing the response. class OperationsServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials end ## diff --git a/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/service_stub.rb b/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/service_stub.rb index 48c62b896b78..a919c5ec80e1 100644 --- a/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/service_stub.rb +++ b/google-cloud-functions-v1/lib/google/cloud/functions/v1/cloud_functions_service/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the list_functions REST call # diff --git a/google-cloud-functions-v1/proto_docs/google/api/client.rb b/google-cloud-functions-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-functions-v1/proto_docs/google/api/client.rb +++ b/google-cloud-functions-v1/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/call_function.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/call_function.rb index 62020967ebff..fd5515805369 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/call_function.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/call_function.rb @@ -22,9 +22,14 @@ ## # Snippet for the call_function call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#call_function. It -# may require modification in order to execute successfully. +# Google::Cloud::Functions::V1::CloudFunctionsService::Client#call_function. # def call_function # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/create_function.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/create_function.rb index 1f4b6ed24c7c..975b97151734 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/create_function.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/create_function.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_function call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#create_function. -# It may require modification in order to execute successfully. # def create_function # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/delete_function.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/delete_function.rb index a98c4973b5ce..29e33b023957 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/delete_function.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/delete_function.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_function call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#delete_function. -# It may require modification in order to execute successfully. # def delete_function # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/generate_download_url.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/generate_download_url.rb index 4b04e78de757..54b90385780a 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/generate_download_url.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/generate_download_url.rb @@ -22,9 +22,14 @@ ## # Snippet for the generate_download_url call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#generate_download_url. -# It may require modification in order to execute successfully. # def generate_download_url # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/generate_upload_url.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/generate_upload_url.rb index d284d87a02bb..b02c06efd330 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/generate_upload_url.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/generate_upload_url.rb @@ -22,9 +22,14 @@ ## # Snippet for the generate_upload_url call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#generate_upload_url. -# It may require modification in order to execute successfully. # def generate_upload_url # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/get_function.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/get_function.rb index a7205fc94556..b0f38465bb66 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/get_function.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/get_function.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_function call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#get_function. It -# may require modification in order to execute successfully. +# Google::Cloud::Functions::V1::CloudFunctionsService::Client#get_function. # def get_function # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/get_iam_policy.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/get_iam_policy.rb index 4cb35c89f7b7..c95ff431a6ec 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/get_iam_policy.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/get_iam_policy.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_iam_policy call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#get_iam_policy. It -# may require modification in order to execute successfully. +# Google::Cloud::Functions::V1::CloudFunctionsService::Client#get_iam_policy. # def get_iam_policy # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/list_functions.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/list_functions.rb index 2bfe30b35409..ee822ff4e83b 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/list_functions.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/list_functions.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_functions call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#list_functions. It -# may require modification in order to execute successfully. +# Google::Cloud::Functions::V1::CloudFunctionsService::Client#list_functions. # def list_functions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/set_iam_policy.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/set_iam_policy.rb index cc25cda83a20..7af9884c96e7 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/set_iam_policy.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/set_iam_policy.rb @@ -22,9 +22,14 @@ ## # Snippet for the set_iam_policy call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#set_iam_policy. It -# may require modification in order to execute successfully. +# Google::Cloud::Functions::V1::CloudFunctionsService::Client#set_iam_policy. # def set_iam_policy # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/test_iam_permissions.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/test_iam_permissions.rb index aa660a0730f0..af254bd9093c 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/test_iam_permissions.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/test_iam_permissions.rb @@ -22,9 +22,14 @@ ## # Snippet for the test_iam_permissions call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#test_iam_permissions. -# It may require modification in order to execute successfully. # def test_iam_permissions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/cloud_functions_service/update_function.rb b/google-cloud-functions-v1/snippets/cloud_functions_service/update_function.rb index 1e2a591555a6..5a1f3a726366 100755 --- a/google-cloud-functions-v1/snippets/cloud_functions_service/update_function.rb +++ b/google-cloud-functions-v1/snippets/cloud_functions_service/update_function.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_function call in the CloudFunctionsService 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::Functions::V1::CloudFunctionsService::Client#update_function. -# It may require modification in order to execute successfully. # def update_function # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v1/snippets/snippet_metadata_google.cloud.functions.v1.json b/google-cloud-functions-v1/snippets/snippet_metadata_google.cloud.functions.v1.json index 019aefb7ceea..19f0619e3051 100644 --- a/google-cloud-functions-v1/snippets/snippet_metadata_google.cloud.functions.v1.json +++ b/google-cloud-functions-v1/snippets/snippet_metadata_google.cloud.functions.v1.json @@ -14,7 +14,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_sync", "title": "Snippet for the list_functions call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#list_functions. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#list_functions.", "file": "cloud_functions_service/list_functions.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_sync", "title": "Snippet for the get_function call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#get_function. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#get_function.", "file": "cloud_functions_service/get_function.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_sync", "title": "Snippet for the create_function call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#create_function. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#create_function.", "file": "cloud_functions_service/create_function.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_sync", "title": "Snippet for the update_function call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#update_function. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#update_function.", "file": "cloud_functions_service/update_function.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_sync", "title": "Snippet for the delete_function call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#delete_function. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#delete_function.", "file": "cloud_functions_service/delete_function.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_sync", "title": "Snippet for the call_function call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#call_function. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#call_function.", "file": "cloud_functions_service/call_function.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_sync", "title": "Snippet for the generate_upload_url call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#generate_upload_url. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#generate_upload_url.", "file": "cloud_functions_service/generate_upload_url.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_sync", "title": "Snippet for the generate_download_url call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#generate_download_url. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#generate_download_url.", "file": "cloud_functions_service/generate_download_url.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_sync", "title": "Snippet for the set_iam_policy call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#set_iam_policy. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#set_iam_policy.", "file": "cloud_functions_service/set_iam_policy.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_sync", "title": "Snippet for the get_iam_policy call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#get_iam_policy. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#get_iam_policy.", "file": "cloud_functions_service/get_iam_policy.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_sync", "title": "Snippet for the test_iam_permissions call in the CloudFunctionsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#test_iam_permissions. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V1::CloudFunctionsService::Client#test_iam_permissions.", "file": "cloud_functions_service/test_iam_permissions.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-functions-v2/.owlbot-manifest.json b/google-cloud-functions-v2/.owlbot-manifest.json index 3cb8833b2b0c..50803d67453c 100644 --- a/google-cloud-functions-v2/.owlbot-manifest.json +++ b/google-cloud-functions-v2/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-functions-v2/.toys.rb b/google-cloud-functions-v2/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-functions-v2/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-functions-v2/AUTHENTICATION.md b/google-cloud-functions-v2/AUTHENTICATION.md index 353bed699930..76016ac8ea3a 100644 --- a/google-cloud-functions-v2/AUTHENTICATION.md +++ b/google-cloud-functions-v2/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-functions-v2 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-functions-v2 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export FUNCTIONS_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/functions/v2" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::Functions::V2::FunctionService::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-functions-v2 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-functions-v2 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. -The environment variables that google-cloud-functions-v2 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Functions::V2::FunctionService::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `FUNCTIONS_CREDENTIALS` - Path to JSON file, or JSON contents -* `FUNCTIONS_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/functions/v2" - -ENV["FUNCTIONS_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Functions::V2::FunctionService::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/functions/v2" client = ::Google::Cloud::Functions::V2::FunctionService::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/functions/v2" ::Google::Cloud::Functions::V2::FunctionService::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Functions::V2::FunctionService::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-functions-v2 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/functions/v2" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-functions-v2. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::Functions::V2::FunctionService::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-functions-v2/google-cloud-functions-v2.gemspec b/google-cloud-functions-v2/google-cloud-functions-v2.gemspec index bac26bed1e77..31ea0c344d73 100644 --- a/google-cloud-functions-v2/google-cloud-functions-v2.gemspec +++ b/google-cloud-functions-v2/google-cloud-functions-v2.gemspec @@ -23,10 +23,10 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-errors", "~> 1.0" - gem.add_dependency "google-cloud-location", ">= 0.4", "< 2.a" - gem.add_dependency "google-iam-v1", ">= 0.4", "< 2.a" + gem.add_dependency "google-cloud-location", ">= 0.7", "< 2.a" + gem.add_dependency "google-iam-v1", ">= 0.7", "< 2.a" gem.add_development_dependency "google-style", "~> 1.26.3" gem.add_development_dependency "minitest", "~> 5.16" diff --git a/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/client.rb b/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/client.rb index 7367da93b142..e426d81a3304 100644 --- a/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/client.rb +++ b/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/client.rb @@ -37,6 +37,9 @@ module FunctionService # executed and how it is triggered. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudfunctions.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -97,6 +100,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @function_service_stub.universe_domain + end + ## # Create a new FunctionService client object. # @@ -130,8 +142,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -144,24 +157,29 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @function_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Functions::V2::FunctionService::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -1017,9 +1035,9 @@ def list_runtimes request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudfunctions.googleapis.com"`. - # @return [::String] + # 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 @@ -1065,13 +1083,20 @@ def list_runtimes request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "cloudfunctions.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -1086,6 +1111,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/operations.rb b/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/operations.rb index 981181910888..48efe78b4f57 100644 --- a/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/operations.rb +++ b/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/operations.rb @@ -26,6 +26,9 @@ module V2 module FunctionService # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudfunctions.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -90,8 +102,10 @@ def initialize @operations_stub = ::Gapic::ServiceStub.new( ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -613,9 +627,9 @@ def wait_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudfunctions.googleapis.com"`. - # @return [::String] + # 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 @@ -661,13 +675,20 @@ def wait_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "cloudfunctions.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -682,6 +703,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/client.rb b/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/client.rb index 1981985cb37d..6f367d8ae46d 100644 --- a/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/client.rb +++ b/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/client.rb @@ -39,6 +39,9 @@ module Rest # executed and how it is triggered. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudfunctions.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -99,6 +102,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @function_service_stub.universe_domain + end + ## # Create a new FunctionService REST client object. # @@ -126,8 +138,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -141,12 +154,14 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain config.bindings_override = @config.bindings_override end @@ -154,10 +169,16 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain config.bindings_override = @config.bindings_override end - @function_service_stub = ::Google::Cloud::Functions::V2::FunctionService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @function_service_stub = ::Google::Cloud::Functions::V2::FunctionService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -952,9 +973,9 @@ def list_runtimes request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudfunctions.googleapis.com"`. - # @return [::String] + # 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 @@ -991,13 +1012,20 @@ def list_runtimes request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "cloudfunctions.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -1009,6 +1037,7 @@ class Configuration 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 # @private # Overrides for http bindings for the RPCs of this service diff --git a/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/operations.rb b/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/operations.rb index cba8c7bdb29e..d281e84f7d70 100644 --- a/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/operations.rb +++ b/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/operations.rb @@ -26,6 +26,9 @@ module FunctionService module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudfunctions.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -84,8 +96,10 @@ def initialize @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - credentials: credentials + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials ) # Used by an LRO wrapper for some methods of this service @@ -478,9 +492,9 @@ def cancel_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudfunctions.googleapis.com"`. - # @return [::String] + # 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 @@ -517,13 +531,20 @@ def cancel_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "cloudfunctions.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -535,6 +556,7 @@ class Configuration 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 # @private def initialize parent_config = nil @@ -617,12 +639,15 @@ def initialize parent_rpcs = nil # Service stub contains baseline method implementations # including transcoding, making the REST call, and deserialing the response. class OperationsServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials end ## diff --git a/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/service_stub.rb b/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/service_stub.rb index aa60988f8cbb..a13d3cb2334c 100644 --- a/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/service_stub.rb +++ b/google-cloud-functions-v2/lib/google/cloud/functions/v2/function_service/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the get_function REST call # diff --git a/google-cloud-functions-v2/proto_docs/google/api/client.rb b/google-cloud-functions-v2/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-functions-v2/proto_docs/google/api/client.rb +++ b/google-cloud-functions-v2/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-functions-v2/snippets/function_service/create_function.rb b/google-cloud-functions-v2/snippets/function_service/create_function.rb index d4a6747ed3a4..bdb555d9bb62 100644 --- a/google-cloud-functions-v2/snippets/function_service/create_function.rb +++ b/google-cloud-functions-v2/snippets/function_service/create_function.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_function call in the FunctionService 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::Functions::V2::FunctionService::Client#create_function. It may -# require modification in order to execute successfully. +# Google::Cloud::Functions::V2::FunctionService::Client#create_function. # def create_function # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v2/snippets/function_service/delete_function.rb b/google-cloud-functions-v2/snippets/function_service/delete_function.rb index 9a9c2548cedf..c5f0afc9efe0 100644 --- a/google-cloud-functions-v2/snippets/function_service/delete_function.rb +++ b/google-cloud-functions-v2/snippets/function_service/delete_function.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_function call in the FunctionService 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::Functions::V2::FunctionService::Client#delete_function. It may -# require modification in order to execute successfully. +# Google::Cloud::Functions::V2::FunctionService::Client#delete_function. # def delete_function # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v2/snippets/function_service/generate_download_url.rb b/google-cloud-functions-v2/snippets/function_service/generate_download_url.rb index 95448c1b6466..2df9877a88a8 100644 --- a/google-cloud-functions-v2/snippets/function_service/generate_download_url.rb +++ b/google-cloud-functions-v2/snippets/function_service/generate_download_url.rb @@ -22,9 +22,14 @@ ## # Snippet for the generate_download_url call in the FunctionService 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::Functions::V2::FunctionService::Client#generate_download_url. -# It may require modification in order to execute successfully. # def generate_download_url # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v2/snippets/function_service/generate_upload_url.rb b/google-cloud-functions-v2/snippets/function_service/generate_upload_url.rb index d739943e70fd..af70e4987029 100644 --- a/google-cloud-functions-v2/snippets/function_service/generate_upload_url.rb +++ b/google-cloud-functions-v2/snippets/function_service/generate_upload_url.rb @@ -22,9 +22,14 @@ ## # Snippet for the generate_upload_url call in the FunctionService 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::Functions::V2::FunctionService::Client#generate_upload_url. It -# may require modification in order to execute successfully. +# Google::Cloud::Functions::V2::FunctionService::Client#generate_upload_url. # def generate_upload_url # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v2/snippets/function_service/get_function.rb b/google-cloud-functions-v2/snippets/function_service/get_function.rb index 0f94c9d5e45d..fbe9a39ef2ce 100644 --- a/google-cloud-functions-v2/snippets/function_service/get_function.rb +++ b/google-cloud-functions-v2/snippets/function_service/get_function.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_function call in the FunctionService 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::Functions::V2::FunctionService::Client#get_function. It may -# require modification in order to execute successfully. +# Google::Cloud::Functions::V2::FunctionService::Client#get_function. # def get_function # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v2/snippets/function_service/list_functions.rb b/google-cloud-functions-v2/snippets/function_service/list_functions.rb index ea1b135674fe..e8ced06ce48c 100644 --- a/google-cloud-functions-v2/snippets/function_service/list_functions.rb +++ b/google-cloud-functions-v2/snippets/function_service/list_functions.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_functions call in the FunctionService 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::Functions::V2::FunctionService::Client#list_functions. It may -# require modification in order to execute successfully. +# Google::Cloud::Functions::V2::FunctionService::Client#list_functions. # def list_functions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v2/snippets/function_service/list_runtimes.rb b/google-cloud-functions-v2/snippets/function_service/list_runtimes.rb index d87a8ffaa3fd..cc5a7a590311 100644 --- a/google-cloud-functions-v2/snippets/function_service/list_runtimes.rb +++ b/google-cloud-functions-v2/snippets/function_service/list_runtimes.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_runtimes call in the FunctionService 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::Functions::V2::FunctionService::Client#list_runtimes. It may -# require modification in order to execute successfully. +# Google::Cloud::Functions::V2::FunctionService::Client#list_runtimes. # def list_runtimes # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v2/snippets/function_service/update_function.rb b/google-cloud-functions-v2/snippets/function_service/update_function.rb index 4d2142bcabe2..89d1026fe516 100644 --- a/google-cloud-functions-v2/snippets/function_service/update_function.rb +++ b/google-cloud-functions-v2/snippets/function_service/update_function.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_function call in the FunctionService 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::Functions::V2::FunctionService::Client#update_function. It may -# require modification in order to execute successfully. +# Google::Cloud::Functions::V2::FunctionService::Client#update_function. # def update_function # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-functions-v2/snippets/snippet_metadata_google.cloud.functions.v2.json b/google-cloud-functions-v2/snippets/snippet_metadata_google.cloud.functions.v2.json index dd504e27716f..008f43651785 100644 --- a/google-cloud-functions-v2/snippets/snippet_metadata_google.cloud.functions.v2.json +++ b/google-cloud-functions-v2/snippets/snippet_metadata_google.cloud.functions.v2.json @@ -14,7 +14,7 @@ { "region_tag": "cloudfunctions_v2_generated_FunctionService_GetFunction_sync", "title": "Snippet for the get_function call in the FunctionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#get_function. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#get_function.", "file": "function_service/get_function.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "cloudfunctions_v2_generated_FunctionService_ListFunctions_sync", "title": "Snippet for the list_functions call in the FunctionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#list_functions. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#list_functions.", "file": "function_service/list_functions.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "cloudfunctions_v2_generated_FunctionService_CreateFunction_sync", "title": "Snippet for the create_function call in the FunctionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#create_function. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#create_function.", "file": "function_service/create_function.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "cloudfunctions_v2_generated_FunctionService_UpdateFunction_sync", "title": "Snippet for the update_function call in the FunctionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#update_function. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#update_function.", "file": "function_service/update_function.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "cloudfunctions_v2_generated_FunctionService_DeleteFunction_sync", "title": "Snippet for the delete_function call in the FunctionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#delete_function. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#delete_function.", "file": "function_service/delete_function.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_sync", "title": "Snippet for the generate_upload_url call in the FunctionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#generate_upload_url. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#generate_upload_url.", "file": "function_service/generate_upload_url.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_sync", "title": "Snippet for the generate_download_url call in the FunctionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#generate_download_url. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#generate_download_url.", "file": "function_service/generate_download_url.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "cloudfunctions_v2_generated_FunctionService_ListRuntimes_sync", "title": "Snippet for the list_runtimes call in the FunctionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#list_runtimes. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Functions::V2::FunctionService::Client#list_runtimes.", "file": "function_service/list_runtimes.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-gke_backup-v1/.owlbot-manifest.json b/google-cloud-gke_backup-v1/.owlbot-manifest.json index dd8c426971a8..1a4691113f3d 100644 --- a/google-cloud-gke_backup-v1/.owlbot-manifest.json +++ b/google-cloud-gke_backup-v1/.owlbot-manifest.json @@ -3,6 +3,7 @@ ".gitignore", ".repo-metadata.json", ".rubocop.yml", + ".toys.rb", ".yardopts", "AUTHENTICATION.md", "CHANGELOG.md", diff --git a/google-cloud-gke_backup-v1/.toys.rb b/google-cloud-gke_backup-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-gke_backup-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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-gke_backup-v1/AUTHENTICATION.md b/google-cloud-gke_backup-v1/AUTHENTICATION.md index c2b2415371b9..665050fca1c0 100644 --- a/google-cloud-gke_backup-v1/AUTHENTICATION.md +++ b/google-cloud-gke_backup-v1/AUTHENTICATION.md @@ -1,149 +1,122 @@ # Authentication -In general, the google-cloud-gke_backup-v1 library uses -[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within -[Google Cloud Platform environments](#google-cloud-platform-environments) the -credentials will be discovered automatically. When running on other -environments, the Service Account credentials can be specified by providing the -path to the -[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) -for the account (or the JSON itself) in -[environment variables](#environment-variables). Additionally, Cloud SDK -credentials can also be discovered automatically, but this is only recommended -during development. +The recommended way to authenticate to the google-cloud-gke_backup-v1 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 -1. [Create a service account and credentials](#creating-a-service-account). -2. Set the [environment variable](#environment-variables). +The following example shows how to set up authentication for a local development +environment with your user credentials. -```sh -export GOOGLE_CLOUD_CREDENTIALS=path/to/keyfile.json -``` - -3. Initialize the client. +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. -```ruby -require "google/cloud/gke_backup/v1" +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: -client = ::Google::Cloud::GkeBackup::V1::BackupForGKE::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-gke_backup-v1 library aims to make authentication -as simple as possible, and provides several mechanisms to configure your system -without requiring **Service Account Credentials** directly in code. - -**Credentials** are discovered in the following order: - -1. Specify credentials in method arguments -2. Specify credentials in configuration -3. Discover credentials path in environment variables -4. Discover credentials JSON in environment variables -5. Discover credentials file in the Cloud SDK's path -6. Discover GCP credentials - -### Google Cloud Platform environments +3. Write code as if already authenticated. -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 discovered automatically. -Code should be written 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). -### Environment Variables +## Credential Lookup -The **Credentials JSON** can be placed in environment variables instead of -declaring them directly in code. Each service has its own environment variable, -allowing for different service accounts to be used for different services. (See -the READMEs for the individual service gems for details.) The path to the -**Credentials JSON** file can be stored in the environment variable, or the -**Credentials JSON** itself can be stored for environments such as Docker -containers where writing files is difficult or not encouraged. +The google-cloud-gke_backup-v1 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. -The environment variables that google-cloud-gke_backup-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::GkeBackup::V1::BackupForGKE::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file +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) -```ruby -require "google/cloud/gke_backup/v1" - -ENV["GOOGLE_CLOUD_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::GkeBackup::V1::BackupForGKE::Client.new -``` +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). -### Configuration +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 path to the **Credentials JSON** file can be configured instead of storing -it in an environment variable. Either on an individual client initialization: +To configure a credentials file for an individual client initialization: ```ruby require "google/cloud/gke_backup/v1" client = ::Google::Cloud::GkeBackup::V1::BackupForGKE::Client.new do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end ``` -Or globally for all clients: +To configure a credentials file globally for all clients: ```ruby require "google/cloud/gke_backup/v1" ::Google::Cloud::GkeBackup::V1::BackupForGKE::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::GkeBackup::V1::BackupForGKE::Client.new ``` -### Cloud SDK +### Environment Variables -This option allows for an easy way to authenticate during development. If -credentials are not provided in code or in environment variables, then Cloud SDK -credentials are discovered. +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. -To configure your system for this, simply: +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). -1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) -2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` -3. Write code as if already authenticated. +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-gke_backup-v1 +checks for credentials are: -**NOTE:** This is _not_ recommended for running in production. The Cloud SDK -*should* only be used during development. +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file -## Creating a Service Account +```ruby +require "google/cloud/gke_backup/v1" -Google Cloud requires **Service Account Credentials** to -connect to the APIs. You will use the **JSON key file** to -connect to most services with google-cloud-gke_backup-v1. +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" -If you are not running this client within -[Google Cloud Platform environments](#google-cloud-platform-environments), you -need a Google Developers service account. +client = ::Google::Cloud::GkeBackup::V1::BackupForGKE::Client.new +``` -1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). -2. Create a new project or click on an existing project. -3. Activate the menu in the upper left and select **APIs & Services**. From - here, you will enable the APIs that your application requires. +### Local ADC file - *Note: You may need to enable billing in order to use these services.* +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. -4. Select **Credentials** from the side navigation. +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - Find the "Create credentials" drop down near the top of the page, and select - "Service account" to be guided through downloading a new JSON key file. +### Google Cloud Platform environments - If you want to re-use an existing service account, you can easily generate a - new key file. Just select the account you wish to re-use, click the pencil - tool on the right side to edit the service account, select the **Keys** tab, - and then select **Add Key**. +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. - The key file you download will be used by this library to authenticate API - requests and should be stored in a secure location. +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-gke_backup-v1/google-cloud-gke_backup-v1.gemspec b/google-cloud-gke_backup-v1/google-cloud-gke_backup-v1.gemspec index 7274b3145254..3c8560b8c49c 100644 --- a/google-cloud-gke_backup-v1/google-cloud-gke_backup-v1.gemspec +++ b/google-cloud-gke_backup-v1/google-cloud-gke_backup-v1.gemspec @@ -23,10 +23,10 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.6" - gem.add_dependency "gapic-common", ">= 0.20.0", "< 2.a" + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" gem.add_dependency "google-cloud-errors", "~> 1.0" - gem.add_dependency "google-cloud-location", ">= 0.4", "< 2.a" - gem.add_dependency "google-iam-v1", ">= 0.4", "< 2.a" + gem.add_dependency "google-cloud-location", ">= 0.7", "< 2.a" + gem.add_dependency "google-iam-v1", ">= 0.7", "< 2.a" gem.add_development_dependency "google-style", "~> 1.26.3" gem.add_development_dependency "minitest", "~> 5.16" diff --git a/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/client.rb b/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/client.rb index 5fdb057c20e0..36bf73edd533 100644 --- a/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/client.rb +++ b/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/client.rb @@ -33,6 +33,9 @@ module BackupForGKE # manage backup and restore operations for their GKE clusters. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "gkebackup.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -177,6 +180,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @backup_for_gke_stub.universe_domain + end + ## # Create a new BackupForGKE client object. # @@ -210,8 +222,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -224,24 +237,29 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @backup_for_gke_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::GkeBackup::V1::BackupForGKE::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -2708,9 +2726,9 @@ def get_volume_restore request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"gkebackup.googleapis.com"`. - # @return [::String] + # 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 @@ -2756,13 +2774,20 @@ def get_volume_restore request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "gkebackup.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -2777,6 +2802,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/operations.rb b/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/operations.rb index 54215a22b078..dffb5e75464e 100644 --- a/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/operations.rb +++ b/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/operations.rb @@ -26,6 +26,9 @@ module V1 module BackupForGKE # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "gkebackup.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -90,8 +102,10 @@ def initialize @operations_stub = ::Gapic::ServiceStub.new( ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, + 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 @@ -613,9 +627,9 @@ def wait_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"gkebackup.googleapis.com"`. - # @return [::String] + # 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 @@ -661,13 +675,20 @@ def wait_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "gkebackup.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 @@ -682,6 +703,7 @@ class Configuration 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 # @private def initialize parent_config = nil diff --git a/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/client.rb b/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/client.rb index 880c10e27648..a331dd7812a9 100644 --- a/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/client.rb +++ b/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/client.rb @@ -35,6 +35,9 @@ module Rest # manage backup and restore operations for their GKE clusters. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "gkebackup.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -179,6 +182,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @backup_for_gke_stub.universe_domain + end + ## # Create a new BackupForGKE REST client object. # @@ -206,8 +218,9 @@ def initialize 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 == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-") + 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) @@ -221,12 +234,14 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain config.bindings_override = @config.bindings_override end @@ -234,10 +249,16 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain config.bindings_override = @config.bindings_override end - @backup_for_gke_stub = ::Google::Cloud::GkeBackup::V1::BackupForGKE::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @backup_for_gke_stub = ::Google::Cloud::GkeBackup::V1::BackupForGKE::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -2529,9 +2550,9 @@ def get_volume_restore request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"gkebackup.googleapis.com"`. - # @return [::String] + # 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 @@ -2568,13 +2589,20 @@ def get_volume_restore request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "gkebackup.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -2586,6 +2614,7 @@ class Configuration 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 # @private # Overrides for http bindings for the RPCs of this service diff --git a/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/operations.rb b/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/operations.rb index dab91b5b69a1..1d1ce2f4a4de 100644 --- a/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/operations.rb +++ b/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/operations.rb @@ -26,6 +26,9 @@ module BackupForGKE module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "gkebackup.$UNIVERSE_DOMAIN$" + # @private attr_reader :operations_stub @@ -60,6 +63,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + ## # Create a new Operations client object. # @@ -84,8 +96,10 @@ def initialize @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - credentials: credentials + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials ) # Used by an LRO wrapper for some methods of this service @@ -478,9 +492,9 @@ def cancel_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"gkebackup.googleapis.com"`. - # @return [::String] + # 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 @@ -517,13 +531,20 @@ def cancel_operation request, options = nil # @!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] # class Configuration extend ::Gapic::Config + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. DEFAULT_ENDPOINT = "gkebackup.googleapis.com" - config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 } @@ -535,6 +556,7 @@ class Configuration 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 # @private def initialize parent_config = nil @@ -617,12 +639,15 @@ def initialize parent_rpcs = nil # Service stub contains baseline method implementations # including transcoding, making the REST call, and deserialing the response. class OperationsServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials end ## diff --git a/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/service_stub.rb b/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/service_stub.rb index dddd3edabf96..3fb049768376 100644 --- a/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/service_stub.rb +++ b/google-cloud-gke_backup-v1/lib/google/cloud/gke_backup/v1/backup_for_gke/rest/service_stub.rb @@ -30,16 +30,28 @@ module Rest # including transcoding, making the REST call, and deserialing the response. # class ServiceStub - def initialize endpoint:, credentials: + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: # 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, credentials: credentials, + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, numeric_enums: true, raise_faraday_errors: false end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + ## # Baseline implementation for the create_backup_plan REST call # diff --git a/google-cloud-gke_backup-v1/proto_docs/google/api/client.rb b/google-cloud-gke_backup-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-gke_backup-v1/proto_docs/google/api/client.rb +++ b/google-cloud-gke_backup-v1/proto_docs/google/api/client.rb @@ -21,6 +21,7 @@ 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 diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_backup.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_backup.rb index 6cfa3770ed14..19066db2da5b 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_backup.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_backup.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_backup call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#create_backup. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_backup. # def create_backup # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_backup_plan.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_backup_plan.rb index b8bf24b6811f..23d916c1f08b 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_backup_plan.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_backup_plan.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_backup_plan call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#create_backup_plan. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_backup_plan. # def create_backup_plan # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_restore.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_restore.rb index 4ce3453f3930..a8f8f346dbac 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_restore.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_restore.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_restore call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#create_restore. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_restore. # def create_restore # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_restore_plan.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_restore_plan.rb index 7a653a6d0e05..97d523e7ad35 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_restore_plan.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/create_restore_plan.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_restore_plan call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#create_restore_plan. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_restore_plan. # def create_restore_plan # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_backup.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_backup.rb index 3ee6b5ebee54..915841b74236 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_backup.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_backup.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_backup call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#delete_backup. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_backup. # def delete_backup # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_backup_plan.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_backup_plan.rb index 9d003c7fc922..008d04cdc5a6 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_backup_plan.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_backup_plan.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_backup_plan call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#delete_backup_plan. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_backup_plan. # def delete_backup_plan # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_restore.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_restore.rb index 6771f400eebf..7a90c3eeb72f 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_restore.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_restore.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_restore call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#delete_restore. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_restore. # def delete_restore # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_restore_plan.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_restore_plan.rb index c183e8ea6754..2a26b3159d1b 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_restore_plan.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/delete_restore_plan.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_restore_plan call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#delete_restore_plan. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_restore_plan. # def delete_restore_plan # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_backup.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_backup.rb index 96aff11b7011..1f1d602121bc 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_backup.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_backup.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_backup call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#get_backup. It may require -# modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_backup. # def get_backup # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_backup_plan.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_backup_plan.rb index 4c9057f6393d..088e7f3a0ca8 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_backup_plan.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_backup_plan.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_backup_plan call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#get_backup_plan. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_backup_plan. # def get_backup_plan # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_restore.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_restore.rb index 64562b6d0a1c..79fedff31de3 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_restore.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_restore.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_restore call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#get_restore. It may require -# modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_restore. # def get_restore # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_restore_plan.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_restore_plan.rb index aef399f8c450..113465f21623 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_restore_plan.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_restore_plan.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_restore_plan call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#get_restore_plan. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_restore_plan. # def get_restore_plan # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_volume_backup.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_volume_backup.rb index 77f28821b29a..5c327d1e3c78 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_volume_backup.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_volume_backup.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_volume_backup call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#get_volume_backup. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_volume_backup. # def get_volume_backup # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_volume_restore.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_volume_restore.rb index 258e0d7e6eae..769961e7669f 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_volume_restore.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/get_volume_restore.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_volume_restore call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#get_volume_restore. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_volume_restore. # def get_volume_restore # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_backup_plans.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_backup_plans.rb index 5bae13b56e89..203eeb67d3b7 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_backup_plans.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_backup_plans.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_backup_plans call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#list_backup_plans. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_backup_plans. # def list_backup_plans # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_backups.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_backups.rb index 9d95f23de420..56c0caa0f3f0 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_backups.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_backups.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_backups call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#list_backups. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_backups. # def list_backups # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_restore_plans.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_restore_plans.rb index bd1e960a6358..a8dc5c5abda6 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_restore_plans.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_restore_plans.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_restore_plans call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#list_restore_plans. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_restore_plans. # def list_restore_plans # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_restores.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_restores.rb index c56619d63991..b1a398e6fa59 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_restores.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_restores.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_restores call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#list_restores. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_restores. # def list_restores # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_volume_backups.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_volume_backups.rb index 7b481647de48..16e0bcba56fe 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_volume_backups.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_volume_backups.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_volume_backups call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#list_volume_backups. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_volume_backups. # def list_volume_backups # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_volume_restores.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_volume_restores.rb index 2b9311a75cd7..e7dc839222ba 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_volume_restores.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/list_volume_restores.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_volume_restores call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#list_volume_restores. It -# may require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_volume_restores. # def list_volume_restores # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_backup.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_backup.rb index 05922610b5a4..1fb989b2cf11 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_backup.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_backup.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_backup call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#update_backup. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_backup. # def update_backup # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_backup_plan.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_backup_plan.rb index e8b0cb1f1d66..7d13204d9075 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_backup_plan.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_backup_plan.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_backup_plan call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#update_backup_plan. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_backup_plan. # def update_backup_plan # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_restore.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_restore.rb index f37129cb5133..56ce3939ec86 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_restore.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_restore.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_restore call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#update_restore. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_restore. # def update_restore # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_restore_plan.rb b/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_restore_plan.rb index e0e2284ac0b7..139058e60e1a 100644 --- a/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_restore_plan.rb +++ b/google-cloud-gke_backup-v1/snippets/backup_for_gke/update_restore_plan.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_restore_plan call in the BackupForGKE 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::GkeBackup::V1::BackupForGKE::Client#update_restore_plan. It may -# require modification in order to execute successfully. +# Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_restore_plan. # def update_restore_plan # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-gke_backup-v1/snippets/snippet_metadata_google.cloud.gkebackup.v1.json b/google-cloud-gke_backup-v1/snippets/snippet_metadata_google.cloud.gkebackup.v1.json index a73aaa479d8a..e7fea5d4f7eb 100644 --- a/google-cloud-gke_backup-v1/snippets/snippet_metadata_google.cloud.gkebackup.v1.json +++ b/google-cloud-gke_backup-v1/snippets/snippet_metadata_google.cloud.gkebackup.v1.json @@ -14,7 +14,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_CreateBackupPlan_sync", "title": "Snippet for the create_backup_plan call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_backup_plan. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_backup_plan.", "file": "backup_for_gke/create_backup_plan.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_ListBackupPlans_sync", "title": "Snippet for the list_backup_plans call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_backup_plans. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_backup_plans.", "file": "backup_for_gke/list_backup_plans.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_GetBackupPlan_sync", "title": "Snippet for the get_backup_plan call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_backup_plan. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_backup_plan.", "file": "backup_for_gke/get_backup_plan.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_UpdateBackupPlan_sync", "title": "Snippet for the update_backup_plan call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_backup_plan. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_backup_plan.", "file": "backup_for_gke/update_backup_plan.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_DeleteBackupPlan_sync", "title": "Snippet for the delete_backup_plan call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_backup_plan. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_backup_plan.", "file": "backup_for_gke/delete_backup_plan.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_CreateBackup_sync", "title": "Snippet for the create_backup call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_backup. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_backup.", "file": "backup_for_gke/create_backup.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_ListBackups_sync", "title": "Snippet for the list_backups call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_backups. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_backups.", "file": "backup_for_gke/list_backups.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_GetBackup_sync", "title": "Snippet for the get_backup call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_backup. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_backup.", "file": "backup_for_gke/get_backup.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_UpdateBackup_sync", "title": "Snippet for the update_backup call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_backup. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_backup.", "file": "backup_for_gke/update_backup.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_DeleteBackup_sync", "title": "Snippet for the delete_backup call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_backup. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_backup.", "file": "backup_for_gke/delete_backup.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_ListVolumeBackups_sync", "title": "Snippet for the list_volume_backups call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_volume_backups. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_volume_backups.", "file": "backup_for_gke/list_volume_backups.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_GetVolumeBackup_sync", "title": "Snippet for the get_volume_backup call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_volume_backup. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_volume_backup.", "file": "backup_for_gke/get_volume_backup.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_CreateRestorePlan_sync", "title": "Snippet for the create_restore_plan call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_restore_plan. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_restore_plan.", "file": "backup_for_gke/create_restore_plan.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_ListRestorePlans_sync", "title": "Snippet for the list_restore_plans call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_restore_plans. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_restore_plans.", "file": "backup_for_gke/list_restore_plans.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_GetRestorePlan_sync", "title": "Snippet for the get_restore_plan call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_restore_plan. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_restore_plan.", "file": "backup_for_gke/get_restore_plan.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_UpdateRestorePlan_sync", "title": "Snippet for the update_restore_plan call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_restore_plan. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_restore_plan.", "file": "backup_for_gke/update_restore_plan.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_DeleteRestorePlan_sync", "title": "Snippet for the delete_restore_plan call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_restore_plan. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_restore_plan.", "file": "backup_for_gke/delete_restore_plan.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -694,7 +694,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_CreateRestore_sync", "title": "Snippet for the create_restore call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_restore. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#create_restore.", "file": "backup_for_gke/create_restore.rb", "language": "RUBY", "client_method": { @@ -726,7 +726,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -734,7 +734,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_ListRestores_sync", "title": "Snippet for the list_restores call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_restores. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_restores.", "file": "backup_for_gke/list_restores.rb", "language": "RUBY", "client_method": { @@ -766,7 +766,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -774,7 +774,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_GetRestore_sync", "title": "Snippet for the get_restore call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_restore. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_restore.", "file": "backup_for_gke/get_restore.rb", "language": "RUBY", "client_method": { @@ -806,7 +806,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -814,7 +814,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_UpdateRestore_sync", "title": "Snippet for the update_restore call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_restore. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#update_restore.", "file": "backup_for_gke/update_restore.rb", "language": "RUBY", "client_method": { @@ -846,7 +846,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -854,7 +854,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_DeleteRestore_sync", "title": "Snippet for the delete_restore call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_restore. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#delete_restore.", "file": "backup_for_gke/delete_restore.rb", "language": "RUBY", "client_method": { @@ -886,7 +886,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -894,7 +894,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_ListVolumeRestores_sync", "title": "Snippet for the list_volume_restores call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_volume_restores. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#list_volume_restores.", "file": "backup_for_gke/list_volume_restores.rb", "language": "RUBY", "client_method": { @@ -926,7 +926,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -934,7 +934,7 @@ { "region_tag": "gkebackup_v1_generated_BackupForGKE_GetVolumeRestore_sync", "title": "Snippet for the get_volume_restore call in the BackupForGKE service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_volume_restore. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::GkeBackup::V1::BackupForGKE::Client#get_volume_restore.", "file": "backup_for_gke/get_volume_restore.rb", "language": "RUBY", "client_method": { @@ -966,7 +966,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ]