diff --git a/google-cloud-talent-v4/.owlbot-manifest.json b/google-cloud-talent-v4/.owlbot-manifest.json index 19299f019fdf..e781295097e6 100644 --- a/google-cloud-talent-v4/.owlbot-manifest.json +++ b/google-cloud-talent-v4/.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-talent-v4/.toys.rb b/google-cloud-talent-v4/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-talent-v4/.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-talent-v4/AUTHENTICATION.md b/google-cloud-talent-v4/AUTHENTICATION.md index e27160978fa5..3ee7d3b9820d 100644 --- a/google-cloud-talent-v4/AUTHENTICATION.md +++ b/google-cloud-talent-v4/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-talent-v4 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-talent-v4 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 TALENT_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/talent/v4" +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::Talent::V4::CompanyService::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-talent-v4 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-talent-v4 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-talent-v4 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Talent::V4::CompanyService::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `TALENT_CREDENTIALS` - Path to JSON file, or JSON contents -* `TALENT_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/talent/v4" - -ENV["TALENT_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Talent::V4::CompanyService::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/talent/v4" client = ::Google::Cloud::Talent::V4::CompanyService::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/talent/v4" ::Google::Cloud::Talent::V4::CompanyService::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Talent::V4::CompanyService::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-talent-v4 +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/talent/v4" -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-talent-v4. +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::Talent::V4::CompanyService::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-talent-v4/google-cloud-talent-v4.gemspec b/google-cloud-talent-v4/google-cloud-talent-v4.gemspec index 551902422064..958fa9498817 100644 --- a/google-cloud-talent-v4/google-cloud-talent-v4.gemspec +++ b/google-cloud-talent-v4/google-cloud-talent-v4.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-talent-v4/lib/google/cloud/talent/v4/company_service/client.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/company_service/client.rb index 252da25379e9..4070b24825fb 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/company_service/client.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/company_service/client.rb @@ -30,6 +30,9 @@ module CompanyService # A service that handles company management, including CRUD and enumeration. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -109,6 +112,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @company_service_stub.universe_domain + end + ## # Create a new CompanyService client object. # @@ -142,8 +154,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,8 +167,10 @@ def initialize @company_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4::CompanyService::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 @@ -666,9 +681,9 @@ def list_companies request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -714,13 +729,20 @@ def list_companies 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 = "jobs.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 @@ -735,6 +757,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-talent-v4/lib/google/cloud/talent/v4/company_service/rest/client.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/company_service/rest/client.rb index 46512b324b74..1b5bc73f50a6 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/company_service/rest/client.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/company_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # A service that handles company management, including CRUD and enumeration. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -111,6 +114,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @company_service_stub.universe_domain + end + ## # Create a new CompanyService REST client object. # @@ -138,8 +150,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) @@ -149,7 +162,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @company_service_stub = ::Google::Cloud::Talent::V4::CompanyService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @company_service_stub = ::Google::Cloud::Talent::V4::CompanyService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -621,9 +639,9 @@ def list_companies request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -660,13 +678,20 @@ def list_companies 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 = "jobs.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 } @@ -678,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-talent-v4/lib/google/cloud/talent/v4/company_service/rest/service_stub.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/company_service/rest/service_stub.rb index 62930b7fb2e9..09d48ad3cf53 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/company_service/rest/service_stub.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/company_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_company REST call # diff --git a/google-cloud-talent-v4/lib/google/cloud/talent/v4/completion/client.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/completion/client.rb index 4447edae4860..e336b5f0382a 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/completion/client.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/completion/client.rb @@ -30,6 +30,9 @@ module Completion # A service handles auto completion. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -95,6 +98,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @completion_stub.universe_domain + end + ## # Create a new Completion 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 @completion_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4::Completion::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 @@ -296,9 +311,9 @@ def complete_query request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -344,13 +359,20 @@ def complete_query 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 = "jobs.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 @@ -365,6 +387,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-talent-v4/lib/google/cloud/talent/v4/completion/rest/client.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/completion/rest/client.rb index 53ee40b491e1..71a3e7f25434 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/completion/rest/client.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/completion/rest/client.rb @@ -32,6 +32,9 @@ module Rest # A service handles auto completion. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -97,6 +100,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @completion_stub.universe_domain + end + ## # Create a new Completion 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 - @completion_stub = ::Google::Cloud::Talent::V4::Completion::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @completion_stub = ::Google::Cloud::Talent::V4::Completion::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -279,9 +297,9 @@ def complete_query request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -318,13 +336,20 @@ def complete_query 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 = "jobs.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 } @@ -336,6 +361,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-talent-v4/lib/google/cloud/talent/v4/completion/rest/service_stub.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/completion/rest/service_stub.rb index cd78f2a7dd7c..bde0d14f5784 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/completion/rest/service_stub.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/completion/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 complete_query REST call # diff --git a/google-cloud-talent-v4/lib/google/cloud/talent/v4/event_service/client.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/event_service/client.rb index 9a9fbbe90c7e..dea47f8c7cd2 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/event_service/client.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/event_service/client.rb @@ -30,6 +30,9 @@ module EventService # A service handles client event report. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -92,6 +95,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @event_service_stub.universe_domain + end + ## # Create a new EventService 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 @event_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4::EventService::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 @@ -274,9 +289,9 @@ def create_client_event request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -322,13 +337,20 @@ def create_client_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 = "jobs.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 @@ -343,6 +365,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-talent-v4/lib/google/cloud/talent/v4/event_service/rest/client.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/event_service/rest/client.rb index e0ac68e9daee..d14f246803d6 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/event_service/rest/client.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/event_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # A service handles client event report. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -94,6 +97,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @event_service_stub.universe_domain + end + ## # Create a new EventService 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 - @event_service_stub = ::Google::Cloud::Talent::V4::EventService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @event_service_stub = ::Google::Cloud::Talent::V4::EventService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -257,9 +275,9 @@ def create_client_event request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -296,13 +314,20 @@ def create_client_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 = "jobs.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 } @@ -314,6 +339,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-talent-v4/lib/google/cloud/talent/v4/event_service/rest/service_stub.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/event_service/rest/service_stub.rb index 728959b30120..c26242c009ce 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/event_service/rest/service_stub.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/event_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_client_event REST call # diff --git a/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/client.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/client.rb index 196e3ac5a1b2..289985c387ed 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/client.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/client.rb @@ -30,6 +30,9 @@ module JobService # A service handles job management, including job CRUD, enumeration and search. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -117,6 +120,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @job_service_stub.universe_domain + end + ## # Create a new JobService client object. # @@ -150,8 +162,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) @@ -164,12 +177,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @job_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4::JobService::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 @@ -1768,9 +1784,9 @@ def search_jobs_for_alert request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -1816,13 +1832,20 @@ def search_jobs_for_alert 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 = "jobs.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 @@ -1837,6 +1860,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-talent-v4/lib/google/cloud/talent/v4/job_service/operations.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/operations.rb index 4684269f3844..89eb6f37a5b3 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/operations.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/operations.rb @@ -26,6 +26,9 @@ module V4 module JobService # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$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 `"jobs.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 = "jobs.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-talent-v4/lib/google/cloud/talent/v4/job_service/rest/client.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/rest/client.rb index a1abaf30f397..9b3fc6468153 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/rest/client.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # A service handles job management, including job CRUD, enumeration and search. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -119,6 +122,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @job_service_stub.universe_domain + end + ## # Create a new JobService REST client object. # @@ -146,8 +158,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) @@ -161,9 +174,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end - @job_service_stub = ::Google::Cloud::Talent::V4::JobService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @job_service_stub = ::Google::Cloud::Talent::V4::JobService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -1688,9 +1707,9 @@ def search_jobs_for_alert request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -1727,13 +1746,20 @@ def search_jobs_for_alert 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 = "jobs.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 } @@ -1745,6 +1771,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-talent-v4/lib/google/cloud/talent/v4/job_service/rest/operations.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/rest/operations.rb index 3821ed1dc503..2dff7131f5ef 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/rest/operations.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/rest/operations.rb @@ -26,6 +26,9 @@ module JobService module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$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 `"jobs.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 = "jobs.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-talent-v4/lib/google/cloud/talent/v4/job_service/rest/service_stub.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/rest/service_stub.rb index 8d2ca34b0252..b028ff064f0b 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_service/rest/service_stub.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/job_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_job REST call # diff --git a/google-cloud-talent-v4/lib/google/cloud/talent/v4/tenant_service/client.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/tenant_service/client.rb index 020cd67efa8e..1b87ffca79d1 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/tenant_service/client.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/tenant_service/client.rb @@ -30,6 +30,9 @@ module TenantService # A service that handles tenant management, including CRUD and enumeration. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -109,6 +112,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @tenant_service_stub.universe_domain + end + ## # Create a new TenantService client object. # @@ -142,8 +154,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,8 +167,10 @@ def initialize @tenant_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4::TenantService::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 @@ -654,9 +669,9 @@ def list_tenants request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -702,13 +717,20 @@ def list_tenants 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 = "jobs.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 @@ -723,6 +745,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-talent-v4/lib/google/cloud/talent/v4/tenant_service/rest/client.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/tenant_service/rest/client.rb index 6995ea6c82f6..4d29e4c2606e 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/tenant_service/rest/client.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/tenant_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # A service that handles tenant management, including CRUD and enumeration. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -111,6 +114,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @tenant_service_stub.universe_domain + end + ## # Create a new TenantService REST client object. # @@ -138,8 +150,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) @@ -149,7 +162,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @tenant_service_stub = ::Google::Cloud::Talent::V4::TenantService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @tenant_service_stub = ::Google::Cloud::Talent::V4::TenantService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -609,9 +627,9 @@ def list_tenants request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -648,13 +666,20 @@ def list_tenants 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 = "jobs.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 } @@ -666,6 +691,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-talent-v4/lib/google/cloud/talent/v4/tenant_service/rest/service_stub.rb b/google-cloud-talent-v4/lib/google/cloud/talent/v4/tenant_service/rest/service_stub.rb index fb6c21d5b338..e031321d1eee 100644 --- a/google-cloud-talent-v4/lib/google/cloud/talent/v4/tenant_service/rest/service_stub.rb +++ b/google-cloud-talent-v4/lib/google/cloud/talent/v4/tenant_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_tenant REST call # diff --git a/google-cloud-talent-v4/proto_docs/google/api/client.rb b/google-cloud-talent-v4/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-talent-v4/proto_docs/google/api/client.rb +++ b/google-cloud-talent-v4/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-talent-v4/proto_docs/google/cloud/talent/v4/common.rb b/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/common.rb index c81ff106b6f1..fd6bc6a9bd4f 100644 --- a/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/common.rb +++ b/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/common.rb @@ -894,6 +894,7 @@ module PostingRegion # Deprecated. All resources are only visible to the owner. # # An enum that represents who has view access to the resource. + # @deprecated This enum is deprecated and may be removed in the next major version update. module Visibility # Default value. VISIBILITY_UNSPECIFIED = 0 diff --git a/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/company.rb b/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/company.rb index 32982a73ab98..915827c8fca0 100644 --- a/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/company.rb +++ b/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/company.rb @@ -80,6 +80,7 @@ module V4 # @return [::String] # A URI that hosts the employer's company logo. # @!attribute [rw] keyword_searchable_job_custom_attributes + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::Array<::String>] # This field is deprecated. Please set the searchability of the custom # attribute in the diff --git a/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/job.rb b/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/job.rb index ac09bbed0d93..6f068237e0b9 100644 --- a/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/job.rb +++ b/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/job.rb @@ -211,6 +211,7 @@ module V4 # setting job {::Google::Cloud::Talent::V4::Job#addresses Job.addresses} to the # same location level as this field is strongly recommended. # @!attribute [rw] visibility + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::Google::Cloud::Talent::V4::Visibility] # Deprecated. The job is only visible to the owner. # diff --git a/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/job_service.rb b/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/job_service.rb index 87da9e5accab..d7fe02795deb 100644 --- a/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/job_service.rb +++ b/google-cloud-talent-v4/proto_docs/google/cloud/talent/v4/job_service.rb @@ -400,6 +400,7 @@ class ListJobsResponse # Controls over how job documents get ranked on top of existing relevance # score (determined by API algorithm). # @!attribute [rw] disable_keyword_match + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::Boolean] # This field is deprecated. Please use # {::Google::Cloud::Talent::V4::SearchJobsRequest#keyword_match_mode SearchJobsRequest.keyword_match_mode} diff --git a/google-cloud-talent-v4/snippets/company_service/create_company.rb b/google-cloud-talent-v4/snippets/company_service/create_company.rb index cd841c602d22..c1ca6968e91e 100755 --- a/google-cloud-talent-v4/snippets/company_service/create_company.rb +++ b/google-cloud-talent-v4/snippets/company_service/create_company.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_company call in the CompanyService 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::Talent::V4::CompanyService::Client#create_company. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4::CompanyService::Client#create_company. # def create_company # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/company_service/delete_company.rb b/google-cloud-talent-v4/snippets/company_service/delete_company.rb index 20c6d405cd49..9cf091b42a76 100755 --- a/google-cloud-talent-v4/snippets/company_service/delete_company.rb +++ b/google-cloud-talent-v4/snippets/company_service/delete_company.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_company call in the CompanyService 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::Talent::V4::CompanyService::Client#delete_company. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4::CompanyService::Client#delete_company. # def delete_company # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/company_service/get_company.rb b/google-cloud-talent-v4/snippets/company_service/get_company.rb index c3477027af5a..aabe2fe3dd25 100755 --- a/google-cloud-talent-v4/snippets/company_service/get_company.rb +++ b/google-cloud-talent-v4/snippets/company_service/get_company.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_company call in the CompanyService 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::Talent::V4::CompanyService::Client#get_company. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::CompanyService::Client#get_company. # def get_company # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/company_service/list_companies.rb b/google-cloud-talent-v4/snippets/company_service/list_companies.rb index 4b07febf3071..cc028ba74f3a 100755 --- a/google-cloud-talent-v4/snippets/company_service/list_companies.rb +++ b/google-cloud-talent-v4/snippets/company_service/list_companies.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_companies call in the CompanyService 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::Talent::V4::CompanyService::Client#list_companies. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4::CompanyService::Client#list_companies. # def list_companies # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/company_service/update_company.rb b/google-cloud-talent-v4/snippets/company_service/update_company.rb index 67d7f9accbf9..7d685637b427 100755 --- a/google-cloud-talent-v4/snippets/company_service/update_company.rb +++ b/google-cloud-talent-v4/snippets/company_service/update_company.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_company call in the CompanyService 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::Talent::V4::CompanyService::Client#update_company. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4::CompanyService::Client#update_company. # def update_company # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/completion/complete_query.rb b/google-cloud-talent-v4/snippets/completion/complete_query.rb index 32d13a16a2fe..7622d9fc5044 100755 --- a/google-cloud-talent-v4/snippets/completion/complete_query.rb +++ b/google-cloud-talent-v4/snippets/completion/complete_query.rb @@ -22,9 +22,14 @@ ## # Snippet for the complete_query call in the Completion 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::Talent::V4::Completion::Client#complete_query. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::Completion::Client#complete_query. # def complete_query # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/event_service/create_client_event.rb b/google-cloud-talent-v4/snippets/event_service/create_client_event.rb index 9c69c2980ffd..678f8a480962 100755 --- a/google-cloud-talent-v4/snippets/event_service/create_client_event.rb +++ b/google-cloud-talent-v4/snippets/event_service/create_client_event.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_client_event call in the EventService 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::Talent::V4::EventService::Client#create_client_event. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4::EventService::Client#create_client_event. # def create_client_event # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/job_service/batch_create_jobs.rb b/google-cloud-talent-v4/snippets/job_service/batch_create_jobs.rb index ae35ef7fb218..a3e30e03581d 100755 --- a/google-cloud-talent-v4/snippets/job_service/batch_create_jobs.rb +++ b/google-cloud-talent-v4/snippets/job_service/batch_create_jobs.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_create_jobs call in the JobService 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::Talent::V4::JobService::Client#batch_create_jobs. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4::JobService::Client#batch_create_jobs. # def batch_create_jobs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/job_service/batch_delete_jobs.rb b/google-cloud-talent-v4/snippets/job_service/batch_delete_jobs.rb index c7ebd7f3434b..22c27bbb1a2d 100755 --- a/google-cloud-talent-v4/snippets/job_service/batch_delete_jobs.rb +++ b/google-cloud-talent-v4/snippets/job_service/batch_delete_jobs.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_delete_jobs call in the JobService 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::Talent::V4::JobService::Client#batch_delete_jobs. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4::JobService::Client#batch_delete_jobs. # def batch_delete_jobs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/job_service/batch_update_jobs.rb b/google-cloud-talent-v4/snippets/job_service/batch_update_jobs.rb index 25ebc1db3d21..18916c46a149 100755 --- a/google-cloud-talent-v4/snippets/job_service/batch_update_jobs.rb +++ b/google-cloud-talent-v4/snippets/job_service/batch_update_jobs.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_update_jobs call in the JobService 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::Talent::V4::JobService::Client#batch_update_jobs. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4::JobService::Client#batch_update_jobs. # def batch_update_jobs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/job_service/create_job.rb b/google-cloud-talent-v4/snippets/job_service/create_job.rb index 4f8b88495003..c98bf8e3d9b1 100755 --- a/google-cloud-talent-v4/snippets/job_service/create_job.rb +++ b/google-cloud-talent-v4/snippets/job_service/create_job.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_job call in the JobService 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::Talent::V4::JobService::Client#create_job. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::JobService::Client#create_job. # def create_job # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/job_service/delete_job.rb b/google-cloud-talent-v4/snippets/job_service/delete_job.rb index 948ad4c97ad4..3acfa761e308 100755 --- a/google-cloud-talent-v4/snippets/job_service/delete_job.rb +++ b/google-cloud-talent-v4/snippets/job_service/delete_job.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_job call in the JobService 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::Talent::V4::JobService::Client#delete_job. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::JobService::Client#delete_job. # def delete_job # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/job_service/get_job.rb b/google-cloud-talent-v4/snippets/job_service/get_job.rb index 29a2777c2e48..934d93dc85f2 100755 --- a/google-cloud-talent-v4/snippets/job_service/get_job.rb +++ b/google-cloud-talent-v4/snippets/job_service/get_job.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_job call in the JobService 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::Talent::V4::JobService::Client#get_job. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::JobService::Client#get_job. # def get_job # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/job_service/list_jobs.rb b/google-cloud-talent-v4/snippets/job_service/list_jobs.rb index 3cbeac469890..8af243daaa38 100755 --- a/google-cloud-talent-v4/snippets/job_service/list_jobs.rb +++ b/google-cloud-talent-v4/snippets/job_service/list_jobs.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_jobs call in the JobService 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::Talent::V4::JobService::Client#list_jobs. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::JobService::Client#list_jobs. # def list_jobs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/job_service/search_jobs.rb b/google-cloud-talent-v4/snippets/job_service/search_jobs.rb index cb9e3ca234a0..7aee46c028b1 100755 --- a/google-cloud-talent-v4/snippets/job_service/search_jobs.rb +++ b/google-cloud-talent-v4/snippets/job_service/search_jobs.rb @@ -22,9 +22,14 @@ ## # Snippet for the search_jobs call in the JobService 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::Talent::V4::JobService::Client#search_jobs. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::JobService::Client#search_jobs. # def search_jobs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/job_service/search_jobs_for_alert.rb b/google-cloud-talent-v4/snippets/job_service/search_jobs_for_alert.rb index dd77aa68bdff..851fd2b4f259 100755 --- a/google-cloud-talent-v4/snippets/job_service/search_jobs_for_alert.rb +++ b/google-cloud-talent-v4/snippets/job_service/search_jobs_for_alert.rb @@ -22,9 +22,14 @@ ## # Snippet for the search_jobs_for_alert call in the JobService 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::Talent::V4::JobService::Client#search_jobs_for_alert. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4::JobService::Client#search_jobs_for_alert. # def search_jobs_for_alert # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/job_service/update_job.rb b/google-cloud-talent-v4/snippets/job_service/update_job.rb index 531a99d8f65e..a30c5820647f 100755 --- a/google-cloud-talent-v4/snippets/job_service/update_job.rb +++ b/google-cloud-talent-v4/snippets/job_service/update_job.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_job call in the JobService 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::Talent::V4::JobService::Client#update_job. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::JobService::Client#update_job. # def update_job # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/snippet_metadata_google.cloud.talent.v4.json b/google-cloud-talent-v4/snippets/snippet_metadata_google.cloud.talent.v4.json index 4d5158071b5c..94a4f63157cc 100644 --- a/google-cloud-talent-v4/snippets/snippet_metadata_google.cloud.talent.v4.json +++ b/google-cloud-talent-v4/snippets/snippet_metadata_google.cloud.talent.v4.json @@ -14,7 +14,7 @@ { "region_tag": "jobs_v4_generated_CompanyService_CreateCompany_sync", "title": "Snippet for the create_company call in the CompanyService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::CompanyService::Client#create_company. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::CompanyService::Client#create_company.", "file": "company_service/create_company.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "jobs_v4_generated_CompanyService_GetCompany_sync", "title": "Snippet for the get_company call in the CompanyService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::CompanyService::Client#get_company. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::CompanyService::Client#get_company.", "file": "company_service/get_company.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "jobs_v4_generated_CompanyService_UpdateCompany_sync", "title": "Snippet for the update_company call in the CompanyService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::CompanyService::Client#update_company. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::CompanyService::Client#update_company.", "file": "company_service/update_company.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "jobs_v4_generated_CompanyService_DeleteCompany_sync", "title": "Snippet for the delete_company call in the CompanyService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::CompanyService::Client#delete_company. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::CompanyService::Client#delete_company.", "file": "company_service/delete_company.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "jobs_v4_generated_CompanyService_ListCompanies_sync", "title": "Snippet for the list_companies call in the CompanyService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::CompanyService::Client#list_companies. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::CompanyService::Client#list_companies.", "file": "company_service/list_companies.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "jobs_v4_generated_Completion_CompleteQuery_sync", "title": "Snippet for the complete_query call in the Completion service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::Completion::Client#complete_query. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::Completion::Client#complete_query.", "file": "completion/complete_query.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "jobs_v4_generated_EventService_CreateClientEvent_sync", "title": "Snippet for the create_client_event call in the EventService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::EventService::Client#create_client_event. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::EventService::Client#create_client_event.", "file": "event_service/create_client_event.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "jobs_v4_generated_JobService_CreateJob_sync", "title": "Snippet for the create_job call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#create_job. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#create_job.", "file": "job_service/create_job.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "jobs_v4_generated_JobService_BatchCreateJobs_sync", "title": "Snippet for the batch_create_jobs call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#batch_create_jobs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#batch_create_jobs.", "file": "job_service/batch_create_jobs.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "jobs_v4_generated_JobService_GetJob_sync", "title": "Snippet for the get_job call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#get_job. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#get_job.", "file": "job_service/get_job.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "jobs_v4_generated_JobService_UpdateJob_sync", "title": "Snippet for the update_job call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#update_job. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#update_job.", "file": "job_service/update_job.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "jobs_v4_generated_JobService_BatchUpdateJobs_sync", "title": "Snippet for the batch_update_jobs call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#batch_update_jobs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#batch_update_jobs.", "file": "job_service/batch_update_jobs.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "jobs_v4_generated_JobService_DeleteJob_sync", "title": "Snippet for the delete_job call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#delete_job. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#delete_job.", "file": "job_service/delete_job.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "jobs_v4_generated_JobService_BatchDeleteJobs_sync", "title": "Snippet for the batch_delete_jobs call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#batch_delete_jobs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#batch_delete_jobs.", "file": "job_service/batch_delete_jobs.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "jobs_v4_generated_JobService_ListJobs_sync", "title": "Snippet for the list_jobs call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#list_jobs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#list_jobs.", "file": "job_service/list_jobs.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "jobs_v4_generated_JobService_SearchJobs_sync", "title": "Snippet for the search_jobs call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#search_jobs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#search_jobs.", "file": "job_service/search_jobs.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "jobs_v4_generated_JobService_SearchJobsForAlert_sync", "title": "Snippet for the search_jobs_for_alert call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#search_jobs_for_alert. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::JobService::Client#search_jobs_for_alert.", "file": "job_service/search_jobs_for_alert.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -694,7 +694,7 @@ { "region_tag": "jobs_v4_generated_TenantService_CreateTenant_sync", "title": "Snippet for the create_tenant call in the TenantService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::TenantService::Client#create_tenant. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::TenantService::Client#create_tenant.", "file": "tenant_service/create_tenant.rb", "language": "RUBY", "client_method": { @@ -726,7 +726,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -734,7 +734,7 @@ { "region_tag": "jobs_v4_generated_TenantService_GetTenant_sync", "title": "Snippet for the get_tenant call in the TenantService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::TenantService::Client#get_tenant. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::TenantService::Client#get_tenant.", "file": "tenant_service/get_tenant.rb", "language": "RUBY", "client_method": { @@ -766,7 +766,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -774,7 +774,7 @@ { "region_tag": "jobs_v4_generated_TenantService_UpdateTenant_sync", "title": "Snippet for the update_tenant call in the TenantService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::TenantService::Client#update_tenant. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::TenantService::Client#update_tenant.", "file": "tenant_service/update_tenant.rb", "language": "RUBY", "client_method": { @@ -806,7 +806,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -814,7 +814,7 @@ { "region_tag": "jobs_v4_generated_TenantService_DeleteTenant_sync", "title": "Snippet for the delete_tenant call in the TenantService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::TenantService::Client#delete_tenant. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::TenantService::Client#delete_tenant.", "file": "tenant_service/delete_tenant.rb", "language": "RUBY", "client_method": { @@ -846,7 +846,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -854,7 +854,7 @@ { "region_tag": "jobs_v4_generated_TenantService_ListTenants_sync", "title": "Snippet for the list_tenants call in the TenantService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::TenantService::Client#list_tenants. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4::TenantService::Client#list_tenants.", "file": "tenant_service/list_tenants.rb", "language": "RUBY", "client_method": { @@ -886,7 +886,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] diff --git a/google-cloud-talent-v4/snippets/tenant_service/create_tenant.rb b/google-cloud-talent-v4/snippets/tenant_service/create_tenant.rb index e1bbfcba04a3..ec87bdce8d83 100755 --- a/google-cloud-talent-v4/snippets/tenant_service/create_tenant.rb +++ b/google-cloud-talent-v4/snippets/tenant_service/create_tenant.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_tenant call in the TenantService 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::Talent::V4::TenantService::Client#create_tenant. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::TenantService::Client#create_tenant. # def create_tenant # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/tenant_service/delete_tenant.rb b/google-cloud-talent-v4/snippets/tenant_service/delete_tenant.rb index b061dd23a934..4be674d536a9 100755 --- a/google-cloud-talent-v4/snippets/tenant_service/delete_tenant.rb +++ b/google-cloud-talent-v4/snippets/tenant_service/delete_tenant.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_tenant call in the TenantService 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::Talent::V4::TenantService::Client#delete_tenant. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::TenantService::Client#delete_tenant. # def delete_tenant # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/tenant_service/get_tenant.rb b/google-cloud-talent-v4/snippets/tenant_service/get_tenant.rb index 99d09864192a..71ec3173eaa2 100755 --- a/google-cloud-talent-v4/snippets/tenant_service/get_tenant.rb +++ b/google-cloud-talent-v4/snippets/tenant_service/get_tenant.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_tenant call in the TenantService 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::Talent::V4::TenantService::Client#get_tenant. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::TenantService::Client#get_tenant. # def get_tenant # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/tenant_service/list_tenants.rb b/google-cloud-talent-v4/snippets/tenant_service/list_tenants.rb index 740942709f04..16c158e3962d 100755 --- a/google-cloud-talent-v4/snippets/tenant_service/list_tenants.rb +++ b/google-cloud-talent-v4/snippets/tenant_service/list_tenants.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_tenants call in the TenantService 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::Talent::V4::TenantService::Client#list_tenants. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::TenantService::Client#list_tenants. # def list_tenants # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4/snippets/tenant_service/update_tenant.rb b/google-cloud-talent-v4/snippets/tenant_service/update_tenant.rb index c6b962f0e8af..3601d72365bf 100755 --- a/google-cloud-talent-v4/snippets/tenant_service/update_tenant.rb +++ b/google-cloud-talent-v4/snippets/tenant_service/update_tenant.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_tenant call in the TenantService 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::Talent::V4::TenantService::Client#update_tenant. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4::TenantService::Client#update_tenant. # def update_tenant # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/.owlbot-manifest.json b/google-cloud-talent-v4beta1/.owlbot-manifest.json index 1e2bb3e91c4a..7d86748d7b76 100644 --- a/google-cloud-talent-v4beta1/.owlbot-manifest.json +++ b/google-cloud-talent-v4beta1/.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-talent-v4beta1/.toys.rb b/google-cloud-talent-v4beta1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-talent-v4beta1/.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-talent-v4beta1/AUTHENTICATION.md b/google-cloud-talent-v4beta1/AUTHENTICATION.md index 338158e61728..26b135cba9b3 100644 --- a/google-cloud-talent-v4beta1/AUTHENTICATION.md +++ b/google-cloud-talent-v4beta1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-talent-v4beta1 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-talent-v4beta1 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 TALENT_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/talent/v4beta1" +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::Talent::V4beta1::CompanyService::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-talent-v4beta1 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-talent-v4beta1 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-talent-v4beta1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Talent::V4beta1::CompanyService::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `TALENT_CREDENTIALS` - Path to JSON file, or JSON contents -* `TALENT_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/talent/v4beta1" - -ENV["TALENT_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Talent::V4beta1::CompanyService::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/talent/v4beta1" client = ::Google::Cloud::Talent::V4beta1::CompanyService::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/talent/v4beta1" ::Google::Cloud::Talent::V4beta1::CompanyService::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Talent::V4beta1::CompanyService::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-talent-v4beta1 +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/talent/v4beta1" -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-talent-v4beta1. +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::Talent::V4beta1::CompanyService::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-talent-v4beta1/google-cloud-talent-v4beta1.gemspec b/google-cloud-talent-v4beta1/google-cloud-talent-v4beta1.gemspec index dd33989b68fe..9073d25b0aa2 100644 --- a/google-cloud-talent-v4beta1/google-cloud-talent-v4beta1.gemspec +++ b/google-cloud-talent-v4beta1/google-cloud-talent-v4beta1.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-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/client.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/client.rb index 26069aa97582..326d5a63ecf0 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/client.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/client.rb @@ -30,6 +30,9 @@ module CompanyService # A service that handles company management, including CRUD and enumeration. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -109,6 +112,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @company_service_stub.universe_domain + end + ## # Create a new CompanyService client object. # @@ -142,8 +154,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,8 +167,10 @@ def initialize @company_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4beta1::CompanyService::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 @@ -677,9 +692,9 @@ def list_companies request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -725,13 +740,20 @@ def list_companies 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 = "jobs.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 @@ -746,6 +768,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-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/rest/client.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/rest/client.rb index f21e6281d9dc..7d33e8d17d11 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/rest/client.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # A service that handles company management, including CRUD and enumeration. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -111,6 +114,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @company_service_stub.universe_domain + end + ## # Create a new CompanyService REST client object. # @@ -138,8 +150,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) @@ -149,7 +162,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @company_service_stub = ::Google::Cloud::Talent::V4beta1::CompanyService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @company_service_stub = ::Google::Cloud::Talent::V4beta1::CompanyService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -632,9 +650,9 @@ def list_companies request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -671,13 +689,20 @@ def list_companies 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 = "jobs.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 } @@ -689,6 +714,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-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/rest/service_stub.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/rest/service_stub.rb index 140386b810ae..aefa9ed37827 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_service/rest/service_stub.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/company_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_company REST call # diff --git a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/client.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/client.rb index 29b1bd8e9fa9..e5e24f483b6e 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/client.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/client.rb @@ -30,6 +30,9 @@ module Completion # A service handles auto completion. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -95,6 +98,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @completion_stub.universe_domain + end + ## # Create a new Completion 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 @completion_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4beta1::Completion::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 @@ -302,9 +317,9 @@ def complete_query request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -350,13 +365,20 @@ def complete_query 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 = "jobs.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 @@ -371,6 +393,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-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/rest/client.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/rest/client.rb index db4df5eb4076..e85ed3d3ff0a 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/rest/client.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/rest/client.rb @@ -32,6 +32,9 @@ module Rest # A service handles auto completion. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -97,6 +100,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @completion_stub.universe_domain + end + ## # Create a new Completion 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 - @completion_stub = ::Google::Cloud::Talent::V4beta1::Completion::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @completion_stub = ::Google::Cloud::Talent::V4beta1::Completion::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -285,9 +303,9 @@ def complete_query request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -324,13 +342,20 @@ def complete_query 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 = "jobs.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 } @@ -342,6 +367,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-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/rest/service_stub.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/rest/service_stub.rb index 7d4b30c7bdc4..1072c8c9eb02 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/rest/service_stub.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/completion/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 complete_query REST call # diff --git a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/client.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/client.rb index 4ff1b75445af..4c7ff01de522 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/client.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/client.rb @@ -30,6 +30,9 @@ module EventService # A service handles client event report. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -92,6 +95,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @event_service_stub.universe_domain + end + ## # Create a new EventService 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 @event_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4beta1::EventService::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 @@ -275,9 +290,9 @@ def create_client_event request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -323,13 +338,20 @@ def create_client_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 = "jobs.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 @@ -344,6 +366,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-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/rest/client.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/rest/client.rb index 20f5fbc6865d..60517290c851 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/rest/client.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # A service handles client event report. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -94,6 +97,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @event_service_stub.universe_domain + end + ## # Create a new EventService 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 - @event_service_stub = ::Google::Cloud::Talent::V4beta1::EventService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @event_service_stub = ::Google::Cloud::Talent::V4beta1::EventService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -258,9 +276,9 @@ def create_client_event request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -297,13 +315,20 @@ def create_client_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 = "jobs.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 } @@ -315,6 +340,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-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/rest/service_stub.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/rest/service_stub.rb index bc4ae2a28479..457289cc2b4b 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_service/rest/service_stub.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/event_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_client_event REST call # diff --git a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/client.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/client.rb index 2261cd4ae03c..085311713cc1 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/client.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/client.rb @@ -30,6 +30,9 @@ module JobService # A service handles job management, including job CRUD, enumeration and search. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -119,6 +122,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @job_service_stub.universe_domain + end + ## # Create a new JobService client object. # @@ -152,8 +164,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) @@ -166,12 +179,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @job_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4beta1::JobService::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 @@ -1790,9 +1806,9 @@ def search_jobs_for_alert request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -1838,13 +1854,20 @@ def search_jobs_for_alert 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 = "jobs.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 @@ -1859,6 +1882,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-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/operations.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/operations.rb index d5e69d597dd7..6712cc94aa6e 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/operations.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/operations.rb @@ -26,6 +26,9 @@ module V4beta1 module JobService # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$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 `"jobs.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 = "jobs.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-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/client.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/client.rb index 0b23759190b3..b5ff0401fd6f 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/client.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # A service handles job management, including job CRUD, enumeration and search. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -121,6 +124,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @job_service_stub.universe_domain + end + ## # Create a new JobService REST client object. # @@ -148,8 +160,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,9 +176,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end - @job_service_stub = ::Google::Cloud::Talent::V4beta1::JobService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @job_service_stub = ::Google::Cloud::Talent::V4beta1::JobService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -1710,9 +1729,9 @@ def search_jobs_for_alert request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -1749,13 +1768,20 @@ def search_jobs_for_alert 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 = "jobs.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 } @@ -1767,6 +1793,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-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/operations.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/operations.rb index fe0ae37c655b..7127f0441f24 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/operations.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/operations.rb @@ -26,6 +26,9 @@ module JobService module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$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 `"jobs.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 = "jobs.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-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/service_stub.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/service_stub.rb index 4da883580525..73dc55a476fa 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_service/rest/service_stub.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/job_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_job REST call # diff --git a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/client.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/client.rb index 0837c3b83713..328e7ff313b3 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/client.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/client.rb @@ -30,6 +30,9 @@ module TenantService # A service that handles tenant management, including CRUD and enumeration. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -109,6 +112,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @tenant_service_stub.universe_domain + end + ## # Create a new TenantService client object. # @@ -142,8 +154,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,8 +167,10 @@ def initialize @tenant_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4beta1::TenantService::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 @@ -656,9 +671,9 @@ def list_tenants request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -704,13 +719,20 @@ def list_tenants 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 = "jobs.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 @@ -725,6 +747,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-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/rest/client.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/rest/client.rb index 0b559b7cfeec..00a6371bb7a5 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/rest/client.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # A service that handles tenant management, including CRUD and enumeration. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "jobs.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -111,6 +114,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @tenant_service_stub.universe_domain + end + ## # Create a new TenantService REST client object. # @@ -138,8 +150,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) @@ -149,7 +162,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @tenant_service_stub = ::Google::Cloud::Talent::V4beta1::TenantService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @tenant_service_stub = ::Google::Cloud::Talent::V4beta1::TenantService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -611,9 +629,9 @@ def list_tenants request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"jobs.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 @@ -650,13 +668,20 @@ def list_tenants 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 = "jobs.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 } @@ -668,6 +693,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-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/rest/service_stub.rb b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/rest/service_stub.rb index 6316825dbaf8..627bec3d8d8f 100644 --- a/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_service/rest/service_stub.rb +++ b/google-cloud-talent-v4beta1/lib/google/cloud/talent/v4beta1/tenant_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_tenant REST call # diff --git a/google-cloud-talent-v4beta1/proto_docs/google/api/client.rb b/google-cloud-talent-v4beta1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-talent-v4beta1/proto_docs/google/api/client.rb +++ b/google-cloud-talent-v4beta1/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-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/common.rb b/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/common.rb index 8ca37c228163..18e46b0fe88d 100644 --- a/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/common.rb +++ b/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/common.rb @@ -895,6 +895,7 @@ module PostingRegion # Deprecated. All resources are only visible to the owner. # # An enum that represents who has view access to the resource. + # @deprecated This enum is deprecated and may be removed in the next major version update. module Visibility # Default value. VISIBILITY_UNSPECIFIED = 0 diff --git a/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/company.rb b/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/company.rb index ccaf6de34a72..462b8a084e3a 100644 --- a/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/company.rb +++ b/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/company.rb @@ -83,6 +83,7 @@ module V4beta1 # @return [::String] # A URI that hosts the employer's company logo. # @!attribute [rw] keyword_searchable_job_custom_attributes + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::Array<::String>] # This field is deprecated. Please set the searchability of the custom # attribute in the diff --git a/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/job.rb b/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/job.rb index 67b1befa0c06..3ba5f41529e1 100644 --- a/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/job.rb +++ b/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/job.rb @@ -209,6 +209,7 @@ module V4beta1 # setting job {::Google::Cloud::Talent::V4beta1::Job#addresses Job.addresses} to # the same location level as this field is strongly recommended. # @!attribute [rw] visibility + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::Google::Cloud::Talent::V4beta1::Visibility] # Deprecated. The job is only visible to the owner. # diff --git a/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/job_service.rb b/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/job_service.rb index cfebeb1a88ee..ccd52f1dd5ae 100644 --- a/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/job_service.rb +++ b/google-cloud-talent-v4beta1/proto_docs/google/cloud/talent/v4beta1/job_service.rb @@ -222,6 +222,7 @@ class ListJobsResponse # # Defaults to false. # @!attribute [rw] require_precise_result_size + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::Boolean] # This field is deprecated. # @!attribute [rw] histogram_queries diff --git a/google-cloud-talent-v4beta1/snippets/company_service/create_company.rb b/google-cloud-talent-v4beta1/snippets/company_service/create_company.rb index e1f748ca3115..9ed263a1fcaa 100755 --- a/google-cloud-talent-v4beta1/snippets/company_service/create_company.rb +++ b/google-cloud-talent-v4beta1/snippets/company_service/create_company.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_company call in the CompanyService 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::Talent::V4beta1::CompanyService::Client#create_company. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::CompanyService::Client#create_company. # def create_company # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/company_service/delete_company.rb b/google-cloud-talent-v4beta1/snippets/company_service/delete_company.rb index 0c6c0bd158a4..89355ca16363 100755 --- a/google-cloud-talent-v4beta1/snippets/company_service/delete_company.rb +++ b/google-cloud-talent-v4beta1/snippets/company_service/delete_company.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_company call in the CompanyService 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::Talent::V4beta1::CompanyService::Client#delete_company. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::CompanyService::Client#delete_company. # def delete_company # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/company_service/get_company.rb b/google-cloud-talent-v4beta1/snippets/company_service/get_company.rb index d32489d404dc..60fa869521ac 100755 --- a/google-cloud-talent-v4beta1/snippets/company_service/get_company.rb +++ b/google-cloud-talent-v4beta1/snippets/company_service/get_company.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_company call in the CompanyService 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::Talent::V4beta1::CompanyService::Client#get_company. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::CompanyService::Client#get_company. # def get_company # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/company_service/list_companies.rb b/google-cloud-talent-v4beta1/snippets/company_service/list_companies.rb index dc610462a6c1..e0d7f236263f 100755 --- a/google-cloud-talent-v4beta1/snippets/company_service/list_companies.rb +++ b/google-cloud-talent-v4beta1/snippets/company_service/list_companies.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_companies call in the CompanyService 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::Talent::V4beta1::CompanyService::Client#list_companies. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::CompanyService::Client#list_companies. # def list_companies # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/company_service/update_company.rb b/google-cloud-talent-v4beta1/snippets/company_service/update_company.rb index b845a1b3dbb6..8375da2bf24b 100755 --- a/google-cloud-talent-v4beta1/snippets/company_service/update_company.rb +++ b/google-cloud-talent-v4beta1/snippets/company_service/update_company.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_company call in the CompanyService 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::Talent::V4beta1::CompanyService::Client#update_company. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::CompanyService::Client#update_company. # def update_company # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/completion/complete_query.rb b/google-cloud-talent-v4beta1/snippets/completion/complete_query.rb index 107b4aa98bb9..3ce89a6dbbc6 100755 --- a/google-cloud-talent-v4beta1/snippets/completion/complete_query.rb +++ b/google-cloud-talent-v4beta1/snippets/completion/complete_query.rb @@ -22,9 +22,14 @@ ## # Snippet for the complete_query call in the Completion 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::Talent::V4beta1::Completion::Client#complete_query. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::Completion::Client#complete_query. # def complete_query # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/event_service/create_client_event.rb b/google-cloud-talent-v4beta1/snippets/event_service/create_client_event.rb index a2f2236791fc..be8c118ff0fb 100755 --- a/google-cloud-talent-v4beta1/snippets/event_service/create_client_event.rb +++ b/google-cloud-talent-v4beta1/snippets/event_service/create_client_event.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_client_event call in the EventService 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::Talent::V4beta1::EventService::Client#create_client_event. It -# may require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::EventService::Client#create_client_event. # def create_client_event # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/job_service/batch_create_jobs.rb b/google-cloud-talent-v4beta1/snippets/job_service/batch_create_jobs.rb index 55e15ce6766f..116caf2cf6e8 100755 --- a/google-cloud-talent-v4beta1/snippets/job_service/batch_create_jobs.rb +++ b/google-cloud-talent-v4beta1/snippets/job_service/batch_create_jobs.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_create_jobs call in the JobService 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::Talent::V4beta1::JobService::Client#batch_create_jobs. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::JobService::Client#batch_create_jobs. # def batch_create_jobs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/job_service/batch_delete_jobs.rb b/google-cloud-talent-v4beta1/snippets/job_service/batch_delete_jobs.rb index 33e15aed1717..f60fa81ad16d 100755 --- a/google-cloud-talent-v4beta1/snippets/job_service/batch_delete_jobs.rb +++ b/google-cloud-talent-v4beta1/snippets/job_service/batch_delete_jobs.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_delete_jobs call in the JobService 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::Talent::V4beta1::JobService::Client#batch_delete_jobs. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::JobService::Client#batch_delete_jobs. # def batch_delete_jobs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/job_service/batch_update_jobs.rb b/google-cloud-talent-v4beta1/snippets/job_service/batch_update_jobs.rb index ba0f488a0296..adce61946b6e 100755 --- a/google-cloud-talent-v4beta1/snippets/job_service/batch_update_jobs.rb +++ b/google-cloud-talent-v4beta1/snippets/job_service/batch_update_jobs.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_update_jobs call in the JobService 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::Talent::V4beta1::JobService::Client#batch_update_jobs. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::JobService::Client#batch_update_jobs. # def batch_update_jobs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/job_service/create_job.rb b/google-cloud-talent-v4beta1/snippets/job_service/create_job.rb index c2ff6863171f..e2e0c57a47f5 100755 --- a/google-cloud-talent-v4beta1/snippets/job_service/create_job.rb +++ b/google-cloud-talent-v4beta1/snippets/job_service/create_job.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_job call in the JobService 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::Talent::V4beta1::JobService::Client#create_job. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::JobService::Client#create_job. # def create_job # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/job_service/delete_job.rb b/google-cloud-talent-v4beta1/snippets/job_service/delete_job.rb index 15385e40a282..02d21ed089f2 100755 --- a/google-cloud-talent-v4beta1/snippets/job_service/delete_job.rb +++ b/google-cloud-talent-v4beta1/snippets/job_service/delete_job.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_job call in the JobService 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::Talent::V4beta1::JobService::Client#delete_job. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::JobService::Client#delete_job. # def delete_job # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/job_service/get_job.rb b/google-cloud-talent-v4beta1/snippets/job_service/get_job.rb index 5937e4bbf358..7057493e8a6b 100755 --- a/google-cloud-talent-v4beta1/snippets/job_service/get_job.rb +++ b/google-cloud-talent-v4beta1/snippets/job_service/get_job.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_job call in the JobService 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::Talent::V4beta1::JobService::Client#get_job. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::JobService::Client#get_job. # def get_job # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/job_service/list_jobs.rb b/google-cloud-talent-v4beta1/snippets/job_service/list_jobs.rb index db80ce4c0031..efb25ae837da 100755 --- a/google-cloud-talent-v4beta1/snippets/job_service/list_jobs.rb +++ b/google-cloud-talent-v4beta1/snippets/job_service/list_jobs.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_jobs call in the JobService 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::Talent::V4beta1::JobService::Client#list_jobs. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::JobService::Client#list_jobs. # def list_jobs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/job_service/search_jobs.rb b/google-cloud-talent-v4beta1/snippets/job_service/search_jobs.rb index bbb38a27ac2a..1bd16d70b8f0 100755 --- a/google-cloud-talent-v4beta1/snippets/job_service/search_jobs.rb +++ b/google-cloud-talent-v4beta1/snippets/job_service/search_jobs.rb @@ -22,9 +22,14 @@ ## # Snippet for the search_jobs call in the JobService 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::Talent::V4beta1::JobService::Client#search_jobs. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::JobService::Client#search_jobs. # def search_jobs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/job_service/search_jobs_for_alert.rb b/google-cloud-talent-v4beta1/snippets/job_service/search_jobs_for_alert.rb index a0bcc13daf61..36a90ae512a8 100755 --- a/google-cloud-talent-v4beta1/snippets/job_service/search_jobs_for_alert.rb +++ b/google-cloud-talent-v4beta1/snippets/job_service/search_jobs_for_alert.rb @@ -22,9 +22,14 @@ ## # Snippet for the search_jobs_for_alert call in the JobService 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::Talent::V4beta1::JobService::Client#search_jobs_for_alert. It -# may require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::JobService::Client#search_jobs_for_alert. # def search_jobs_for_alert # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/job_service/update_job.rb b/google-cloud-talent-v4beta1/snippets/job_service/update_job.rb index 4f7293a90d43..36ef6a6f8935 100755 --- a/google-cloud-talent-v4beta1/snippets/job_service/update_job.rb +++ b/google-cloud-talent-v4beta1/snippets/job_service/update_job.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_job call in the JobService 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::Talent::V4beta1::JobService::Client#update_job. It may require -# modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::JobService::Client#update_job. # def update_job # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/snippet_metadata_google.cloud.talent.v4beta1.json b/google-cloud-talent-v4beta1/snippets/snippet_metadata_google.cloud.talent.v4beta1.json index 857e16da2b93..e22c3aa7c62e 100644 --- a/google-cloud-talent-v4beta1/snippets/snippet_metadata_google.cloud.talent.v4beta1.json +++ b/google-cloud-talent-v4beta1/snippets/snippet_metadata_google.cloud.talent.v4beta1.json @@ -14,7 +14,7 @@ { "region_tag": "jobs_v4beta1_generated_CompanyService_CreateCompany_sync", "title": "Snippet for the create_company call in the CompanyService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::CompanyService::Client#create_company. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::CompanyService::Client#create_company.", "file": "company_service/create_company.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "jobs_v4beta1_generated_CompanyService_GetCompany_sync", "title": "Snippet for the get_company call in the CompanyService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::CompanyService::Client#get_company. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::CompanyService::Client#get_company.", "file": "company_service/get_company.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "jobs_v4beta1_generated_CompanyService_UpdateCompany_sync", "title": "Snippet for the update_company call in the CompanyService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::CompanyService::Client#update_company. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::CompanyService::Client#update_company.", "file": "company_service/update_company.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "jobs_v4beta1_generated_CompanyService_DeleteCompany_sync", "title": "Snippet for the delete_company call in the CompanyService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::CompanyService::Client#delete_company. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::CompanyService::Client#delete_company.", "file": "company_service/delete_company.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "jobs_v4beta1_generated_CompanyService_ListCompanies_sync", "title": "Snippet for the list_companies call in the CompanyService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::CompanyService::Client#list_companies. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::CompanyService::Client#list_companies.", "file": "company_service/list_companies.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "jobs_v4beta1_generated_Completion_CompleteQuery_sync", "title": "Snippet for the complete_query call in the Completion service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::Completion::Client#complete_query. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::Completion::Client#complete_query.", "file": "completion/complete_query.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "jobs_v4beta1_generated_EventService_CreateClientEvent_sync", "title": "Snippet for the create_client_event call in the EventService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::EventService::Client#create_client_event. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::EventService::Client#create_client_event.", "file": "event_service/create_client_event.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "jobs_v4beta1_generated_JobService_CreateJob_sync", "title": "Snippet for the create_job call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#create_job. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#create_job.", "file": "job_service/create_job.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "jobs_v4beta1_generated_JobService_BatchCreateJobs_sync", "title": "Snippet for the batch_create_jobs call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#batch_create_jobs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#batch_create_jobs.", "file": "job_service/batch_create_jobs.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "jobs_v4beta1_generated_JobService_GetJob_sync", "title": "Snippet for the get_job call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#get_job. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#get_job.", "file": "job_service/get_job.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "jobs_v4beta1_generated_JobService_UpdateJob_sync", "title": "Snippet for the update_job call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#update_job. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#update_job.", "file": "job_service/update_job.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "jobs_v4beta1_generated_JobService_BatchUpdateJobs_sync", "title": "Snippet for the batch_update_jobs call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#batch_update_jobs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#batch_update_jobs.", "file": "job_service/batch_update_jobs.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "jobs_v4beta1_generated_JobService_DeleteJob_sync", "title": "Snippet for the delete_job call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#delete_job. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#delete_job.", "file": "job_service/delete_job.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "jobs_v4beta1_generated_JobService_BatchDeleteJobs_sync", "title": "Snippet for the batch_delete_jobs call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#batch_delete_jobs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#batch_delete_jobs.", "file": "job_service/batch_delete_jobs.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "jobs_v4beta1_generated_JobService_ListJobs_sync", "title": "Snippet for the list_jobs call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#list_jobs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#list_jobs.", "file": "job_service/list_jobs.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "jobs_v4beta1_generated_JobService_SearchJobs_sync", "title": "Snippet for the search_jobs call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#search_jobs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#search_jobs.", "file": "job_service/search_jobs.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "jobs_v4beta1_generated_JobService_SearchJobsForAlert_sync", "title": "Snippet for the search_jobs_for_alert call in the JobService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#search_jobs_for_alert. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::JobService::Client#search_jobs_for_alert.", "file": "job_service/search_jobs_for_alert.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -694,7 +694,7 @@ { "region_tag": "jobs_v4beta1_generated_TenantService_CreateTenant_sync", "title": "Snippet for the create_tenant call in the TenantService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::TenantService::Client#create_tenant. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::TenantService::Client#create_tenant.", "file": "tenant_service/create_tenant.rb", "language": "RUBY", "client_method": { @@ -726,7 +726,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -734,7 +734,7 @@ { "region_tag": "jobs_v4beta1_generated_TenantService_GetTenant_sync", "title": "Snippet for the get_tenant call in the TenantService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::TenantService::Client#get_tenant. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::TenantService::Client#get_tenant.", "file": "tenant_service/get_tenant.rb", "language": "RUBY", "client_method": { @@ -766,7 +766,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -774,7 +774,7 @@ { "region_tag": "jobs_v4beta1_generated_TenantService_UpdateTenant_sync", "title": "Snippet for the update_tenant call in the TenantService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::TenantService::Client#update_tenant. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::TenantService::Client#update_tenant.", "file": "tenant_service/update_tenant.rb", "language": "RUBY", "client_method": { @@ -806,7 +806,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -814,7 +814,7 @@ { "region_tag": "jobs_v4beta1_generated_TenantService_DeleteTenant_sync", "title": "Snippet for the delete_tenant call in the TenantService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::TenantService::Client#delete_tenant. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::TenantService::Client#delete_tenant.", "file": "tenant_service/delete_tenant.rb", "language": "RUBY", "client_method": { @@ -846,7 +846,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -854,7 +854,7 @@ { "region_tag": "jobs_v4beta1_generated_TenantService_ListTenants_sync", "title": "Snippet for the list_tenants call in the TenantService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::TenantService::Client#list_tenants. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Talent::V4beta1::TenantService::Client#list_tenants.", "file": "tenant_service/list_tenants.rb", "language": "RUBY", "client_method": { @@ -886,7 +886,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] diff --git a/google-cloud-talent-v4beta1/snippets/tenant_service/create_tenant.rb b/google-cloud-talent-v4beta1/snippets/tenant_service/create_tenant.rb index 6b9b10ead2c1..3e98b46b16ff 100755 --- a/google-cloud-talent-v4beta1/snippets/tenant_service/create_tenant.rb +++ b/google-cloud-talent-v4beta1/snippets/tenant_service/create_tenant.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_tenant call in the TenantService 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::Talent::V4beta1::TenantService::Client#create_tenant. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::TenantService::Client#create_tenant. # def create_tenant # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/tenant_service/delete_tenant.rb b/google-cloud-talent-v4beta1/snippets/tenant_service/delete_tenant.rb index fc5714c4f7bc..cae6f3ed1367 100755 --- a/google-cloud-talent-v4beta1/snippets/tenant_service/delete_tenant.rb +++ b/google-cloud-talent-v4beta1/snippets/tenant_service/delete_tenant.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_tenant call in the TenantService 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::Talent::V4beta1::TenantService::Client#delete_tenant. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::TenantService::Client#delete_tenant. # def delete_tenant # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/tenant_service/get_tenant.rb b/google-cloud-talent-v4beta1/snippets/tenant_service/get_tenant.rb index 9ffacf6fa663..21eafdeb17e0 100755 --- a/google-cloud-talent-v4beta1/snippets/tenant_service/get_tenant.rb +++ b/google-cloud-talent-v4beta1/snippets/tenant_service/get_tenant.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_tenant call in the TenantService 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::Talent::V4beta1::TenantService::Client#get_tenant. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::TenantService::Client#get_tenant. # def get_tenant # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/tenant_service/list_tenants.rb b/google-cloud-talent-v4beta1/snippets/tenant_service/list_tenants.rb index 7a85e718f00b..8b3b2481d810 100755 --- a/google-cloud-talent-v4beta1/snippets/tenant_service/list_tenants.rb +++ b/google-cloud-talent-v4beta1/snippets/tenant_service/list_tenants.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_tenants call in the TenantService 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::Talent::V4beta1::TenantService::Client#list_tenants. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::TenantService::Client#list_tenants. # def list_tenants # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-talent-v4beta1/snippets/tenant_service/update_tenant.rb b/google-cloud-talent-v4beta1/snippets/tenant_service/update_tenant.rb index 8b37bfa0c8b3..f4ea15361ecd 100755 --- a/google-cloud-talent-v4beta1/snippets/tenant_service/update_tenant.rb +++ b/google-cloud-talent-v4beta1/snippets/tenant_service/update_tenant.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_tenant call in the TenantService 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::Talent::V4beta1::TenantService::Client#update_tenant. It may -# require modification in order to execute successfully. +# Google::Cloud::Talent::V4beta1::TenantService::Client#update_tenant. # def update_tenant # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/.owlbot-manifest.json b/google-cloud-tasks-v2/.owlbot-manifest.json index b61c71010ab0..81cd80d1deb1 100644 --- a/google-cloud-tasks-v2/.owlbot-manifest.json +++ b/google-cloud-tasks-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-tasks-v2/.toys.rb b/google-cloud-tasks-v2/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-tasks-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-tasks-v2/AUTHENTICATION.md b/google-cloud-tasks-v2/AUTHENTICATION.md index f3071b208131..17282377935b 100644 --- a/google-cloud-tasks-v2/AUTHENTICATION.md +++ b/google-cloud-tasks-v2/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-tasks-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-tasks-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 TASKS_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/tasks/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::Tasks::V2::CloudTasks::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-tasks-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-tasks-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-tasks-v2 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Tasks::V2::CloudTasks::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `TASKS_CREDENTIALS` - Path to JSON file, or JSON contents -* `TASKS_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/tasks/v2" - -ENV["TASKS_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Tasks::V2::CloudTasks::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/tasks/v2" client = ::Google::Cloud::Tasks::V2::CloudTasks::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/tasks/v2" ::Google::Cloud::Tasks::V2::CloudTasks::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Tasks::V2::CloudTasks::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-tasks-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/tasks/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-tasks-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::Tasks::V2::CloudTasks::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-tasks-v2/google-cloud-tasks-v2.gemspec b/google-cloud-tasks-v2/google-cloud-tasks-v2.gemspec index 77a571136e1a..388e8e27656b 100644 --- a/google-cloud-tasks-v2/google-cloud-tasks-v2.gemspec +++ b/google-cloud-tasks-v2/google-cloud-tasks-v2.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_dependency "grpc-google-iam-v1", "~> 1.1" gem.add_development_dependency "google-style", "~> 1.26.3" diff --git a/google-cloud-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/client.rb b/google-cloud-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/client.rb index d58793e766be..32dc59a3cd9e 100644 --- a/google-cloud-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/client.rb +++ b/google-cloud-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/client.rb @@ -32,6 +32,9 @@ module CloudTasks # work in their applications. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudtasks.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -148,6 +151,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_tasks_stub.universe_domain + end + ## # Create a new CloudTasks 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) @@ -195,12 +208,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @cloud_tasks_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Tasks::V2::CloudTasks::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 @@ -1936,9 +1952,9 @@ def run_task request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudtasks.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 @@ -1984,13 +2000,20 @@ def run_task 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 = "cloudtasks.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 @@ -2005,6 +2028,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-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/rest/client.rb b/google-cloud-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/rest/client.rb index 9b6cec61a3e0..e8d3a06a8cfd 100644 --- a/google-cloud-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/rest/client.rb +++ b/google-cloud-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/rest/client.rb @@ -34,6 +34,9 @@ module Rest # work in their applications. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudtasks.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -150,6 +153,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_tasks_stub.universe_domain + end + ## # Create a new CloudTasks REST client object. # @@ -177,8 +189,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) @@ -192,10 +205,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 - @cloud_tasks_stub = ::Google::Cloud::Tasks::V2::CloudTasks::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @cloud_tasks_stub = ::Google::Cloud::Tasks::V2::CloudTasks::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -1815,9 +1834,9 @@ def run_task request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudtasks.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 @@ -1854,13 +1873,20 @@ def run_task 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 = "cloudtasks.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 } @@ -1872,6 +1898,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-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/rest/service_stub.rb b/google-cloud-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/rest/service_stub.rb index 8fcecb7da48b..3a1a6c4785f6 100644 --- a/google-cloud-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/rest/service_stub.rb +++ b/google-cloud-tasks-v2/lib/google/cloud/tasks/v2/cloud_tasks/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_queues REST call # diff --git a/google-cloud-tasks-v2/proto_docs/google/api/client.rb b/google-cloud-tasks-v2/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-tasks-v2/proto_docs/google/api/client.rb +++ b/google-cloud-tasks-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-tasks-v2/snippets/cloud_tasks/create_queue.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/create_queue.rb index 4b087dbd76e6..ab4be605a621 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/create_queue.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/create_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_queue call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#create_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#create_queue. # def create_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/create_task.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/create_task.rb index f6ff36cf80e1..6b134f370315 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/create_task.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/create_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_task call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#create_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#create_task. # def create_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/delete_queue.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/delete_queue.rb index 113d596d6dd1..722ff00f247f 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/delete_queue.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/delete_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_queue call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#delete_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#delete_queue. # def delete_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/delete_task.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/delete_task.rb index 210d3d913977..be1270d602e3 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/delete_task.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/delete_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_task call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#delete_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#delete_task. # def delete_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/get_iam_policy.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/get_iam_policy.rb index 101059f03cc1..da9f5c610396 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/get_iam_policy.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/get_iam_policy.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_iam_policy call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#get_iam_policy. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::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-tasks-v2/snippets/cloud_tasks/get_queue.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/get_queue.rb index 7aaf5b25f148..3e217b38e9e1 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/get_queue.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/get_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_queue call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#get_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#get_queue. # def get_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/get_task.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/get_task.rb index d14eed644b24..7c9edfd766a5 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/get_task.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/get_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_task call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#get_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#get_task. # def get_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/list_queues.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/list_queues.rb index d478a3c51c1d..776435d672ee 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/list_queues.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/list_queues.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_queues call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#list_queues. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#list_queues. # def list_queues # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/list_tasks.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/list_tasks.rb index 48c88197515d..d3327096a8ed 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/list_tasks.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/list_tasks.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_tasks call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#list_tasks. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#list_tasks. # def list_tasks # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/pause_queue.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/pause_queue.rb index a900288215da..0703ba0a8ddd 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/pause_queue.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/pause_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the pause_queue call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#pause_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#pause_queue. # def pause_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/purge_queue.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/purge_queue.rb index f932ab7fba3b..e80bd4d6906c 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/purge_queue.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/purge_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the purge_queue call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#purge_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#purge_queue. # def purge_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/resume_queue.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/resume_queue.rb index b6990b87a1fa..45d3502e9022 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/resume_queue.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/resume_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the resume_queue call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#resume_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#resume_queue. # def resume_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/run_task.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/run_task.rb index 299b8daffc76..b0d75d0686ba 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/run_task.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/run_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the run_task call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#run_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#run_task. # def run_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/set_iam_policy.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/set_iam_policy.rb index 2db85f62c12c..377da439a590 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/set_iam_policy.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/set_iam_policy.rb @@ -22,9 +22,14 @@ ## # Snippet for the set_iam_policy call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#set_iam_policy. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::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-tasks-v2/snippets/cloud_tasks/test_iam_permissions.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/test_iam_permissions.rb index d78e0fb44252..725dc6b0c15c 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/test_iam_permissions.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/test_iam_permissions.rb @@ -22,9 +22,14 @@ ## # Snippet for the test_iam_permissions call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#test_iam_permissions. It may -# require modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#test_iam_permissions. # def test_iam_permissions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/cloud_tasks/update_queue.rb b/google-cloud-tasks-v2/snippets/cloud_tasks/update_queue.rb index b9dbaa28afa9..f76b11f3a83b 100755 --- a/google-cloud-tasks-v2/snippets/cloud_tasks/update_queue.rb +++ b/google-cloud-tasks-v2/snippets/cloud_tasks/update_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_queue call in the CloudTasks 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::Tasks::V2::CloudTasks::Client#update_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2::CloudTasks::Client#update_queue. # def update_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2/snippets/snippet_metadata_google.cloud.tasks.v2.json b/google-cloud-tasks-v2/snippets/snippet_metadata_google.cloud.tasks.v2.json index 89fae4064827..7d6f527a85d0 100644 --- a/google-cloud-tasks-v2/snippets/snippet_metadata_google.cloud.tasks.v2.json +++ b/google-cloud-tasks-v2/snippets/snippet_metadata_google.cloud.tasks.v2.json @@ -14,7 +14,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_ListQueues_sync", "title": "Snippet for the list_queues call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#list_queues. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#list_queues.", "file": "cloud_tasks/list_queues.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_GetQueue_sync", "title": "Snippet for the get_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#get_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#get_queue.", "file": "cloud_tasks/get_queue.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_CreateQueue_sync", "title": "Snippet for the create_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#create_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#create_queue.", "file": "cloud_tasks/create_queue.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_UpdateQueue_sync", "title": "Snippet for the update_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#update_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#update_queue.", "file": "cloud_tasks/update_queue.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_DeleteQueue_sync", "title": "Snippet for the delete_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#delete_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#delete_queue.", "file": "cloud_tasks/delete_queue.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_PurgeQueue_sync", "title": "Snippet for the purge_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#purge_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#purge_queue.", "file": "cloud_tasks/purge_queue.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_PauseQueue_sync", "title": "Snippet for the pause_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#pause_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#pause_queue.", "file": "cloud_tasks/pause_queue.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_ResumeQueue_sync", "title": "Snippet for the resume_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#resume_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#resume_queue.", "file": "cloud_tasks/resume_queue.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_GetIamPolicy_sync", "title": "Snippet for the get_iam_policy call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::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::Tasks::V2::CloudTasks::Client#get_iam_policy.", "file": "cloud_tasks/get_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": "cloudtasks_v2_generated_CloudTasks_SetIamPolicy_sync", "title": "Snippet for the set_iam_policy call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::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::Tasks::V2::CloudTasks::Client#set_iam_policy.", "file": "cloud_tasks/set_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": "cloudtasks_v2_generated_CloudTasks_TestIamPermissions_sync", "title": "Snippet for the test_iam_permissions call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::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::Tasks::V2::CloudTasks::Client#test_iam_permissions.", "file": "cloud_tasks/test_iam_permissions.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_ListTasks_sync", "title": "Snippet for the list_tasks call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#list_tasks. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#list_tasks.", "file": "cloud_tasks/list_tasks.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_GetTask_sync", "title": "Snippet for the get_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#get_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#get_task.", "file": "cloud_tasks/get_task.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_CreateTask_sync", "title": "Snippet for the create_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#create_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#create_task.", "file": "cloud_tasks/create_task.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_DeleteTask_sync", "title": "Snippet for the delete_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#delete_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#delete_task.", "file": "cloud_tasks/delete_task.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "cloudtasks_v2_generated_CloudTasks_RunTask_sync", "title": "Snippet for the run_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#run_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2::CloudTasks::Client#run_task.", "file": "cloud_tasks/run_task.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-tasks-v2beta2/.owlbot-manifest.json b/google-cloud-tasks-v2beta2/.owlbot-manifest.json index b7658bcd4a65..a797dd62b905 100644 --- a/google-cloud-tasks-v2beta2/.owlbot-manifest.json +++ b/google-cloud-tasks-v2beta2/.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-tasks-v2beta2/.toys.rb b/google-cloud-tasks-v2beta2/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-tasks-v2beta2/.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-tasks-v2beta2/AUTHENTICATION.md b/google-cloud-tasks-v2beta2/AUTHENTICATION.md index 13a73a8313c9..458865effa49 100644 --- a/google-cloud-tasks-v2beta2/AUTHENTICATION.md +++ b/google-cloud-tasks-v2beta2/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-tasks-v2beta2 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-tasks-v2beta2 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 TASKS_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/tasks/v2beta2" +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::Tasks::V2beta2::CloudTasks::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-tasks-v2beta2 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-tasks-v2beta2 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-tasks-v2beta2 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Tasks::V2beta2::CloudTasks::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `TASKS_CREDENTIALS` - Path to JSON file, or JSON contents -* `TASKS_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/tasks/v2beta2" - -ENV["TASKS_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::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/tasks/v2beta2" client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::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/tasks/v2beta2" ::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::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-tasks-v2beta2 +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/tasks/v2beta2" -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-tasks-v2beta2. +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::Tasks::V2beta2::CloudTasks::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-tasks-v2beta2/google-cloud-tasks-v2beta2.gemspec b/google-cloud-tasks-v2beta2/google-cloud-tasks-v2beta2.gemspec index ac136d57a802..487a46f001a8 100644 --- a/google-cloud-tasks-v2beta2/google-cloud-tasks-v2beta2.gemspec +++ b/google-cloud-tasks-v2beta2/google-cloud-tasks-v2beta2.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_dependency "grpc-google-iam-v1", "~> 1.1" gem.add_development_dependency "google-style", "~> 1.26.3" diff --git a/google-cloud-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/client.rb b/google-cloud-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/client.rb index a05a13ea0f61..fa739530cb01 100644 --- a/google-cloud-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/client.rb +++ b/google-cloud-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/client.rb @@ -32,6 +32,9 @@ module CloudTasks # work in their applications. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudtasks.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -160,6 +163,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_tasks_stub.universe_domain + end + ## # Create a new CloudTasks client object. # @@ -193,8 +205,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) @@ -207,12 +220,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @cloud_tasks_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Tasks::V2beta2::CloudTasks::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 @@ -2689,9 +2705,9 @@ def buffer_task request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudtasks.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 @@ -2737,13 +2753,20 @@ def buffer_task 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 = "cloudtasks.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 @@ -2758,6 +2781,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-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/rest/client.rb b/google-cloud-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/rest/client.rb index 9aba7b8af25a..95c4a37b6856 100644 --- a/google-cloud-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/rest/client.rb +++ b/google-cloud-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/rest/client.rb @@ -34,6 +34,9 @@ module Rest # work in their applications. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudtasks.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -160,6 +163,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_tasks_stub.universe_domain + end + ## # Create a new CloudTasks REST client object. # @@ -187,8 +199,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) @@ -202,10 +215,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 - @cloud_tasks_stub = ::Google::Cloud::Tasks::V2beta2::CloudTasks::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @cloud_tasks_stub = ::Google::Cloud::Tasks::V2beta2::CloudTasks::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -2443,9 +2462,9 @@ def buffer_task request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudtasks.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 @@ -2482,13 +2501,20 @@ def buffer_task 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 = "cloudtasks.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 } @@ -2500,6 +2526,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-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/rest/service_stub.rb b/google-cloud-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/rest/service_stub.rb index 27a57dceed78..bbf0f4ab301f 100644 --- a/google-cloud-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/rest/service_stub.rb +++ b/google-cloud-tasks-v2beta2/lib/google/cloud/tasks/v2beta2/cloud_tasks/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_queues REST call # diff --git a/google-cloud-tasks-v2beta2/proto_docs/google/api/client.rb b/google-cloud-tasks-v2beta2/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-tasks-v2beta2/proto_docs/google/api/client.rb +++ b/google-cloud-tasks-v2beta2/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-tasks-v2beta2/snippets/cloud_tasks/acknowledge_task.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/acknowledge_task.rb index b174afadfeea..03941ad0ac37 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/acknowledge_task.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/acknowledge_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the acknowledge_task call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#acknowledge_task. It may -# require modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#acknowledge_task. # def acknowledge_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/buffer_task.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/buffer_task.rb index 9b48ed22d891..524404a06b9b 100644 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/buffer_task.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/buffer_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the buffer_task call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#buffer_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#buffer_task. # def buffer_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/cancel_lease.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/cancel_lease.rb index 6c97746834c7..e944830fa583 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/cancel_lease.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/cancel_lease.rb @@ -22,9 +22,14 @@ ## # Snippet for the cancel_lease call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#cancel_lease. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#cancel_lease. # def cancel_lease # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/create_queue.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/create_queue.rb index 7b2a8cfed42b..7419562d90a5 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/create_queue.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/create_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_queue call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#create_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#create_queue. # def create_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/create_task.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/create_task.rb index 8b07fbec7683..af5773c9e3ca 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/create_task.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/create_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_task call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#create_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#create_task. # def create_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/delete_queue.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/delete_queue.rb index 8ecd4fe7b6f8..0d01cbbdcca0 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/delete_queue.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/delete_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_queue call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#delete_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#delete_queue. # def delete_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/delete_task.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/delete_task.rb index 64f0dfade633..69c2091dd3d1 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/delete_task.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/delete_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_task call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#delete_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#delete_task. # def delete_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_iam_policy.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_iam_policy.rb index 9b355a71d346..33e1073e8d4a 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_iam_policy.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_iam_policy.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_iam_policy call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#get_iam_policy. It may -# require modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::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-tasks-v2beta2/snippets/cloud_tasks/get_queue.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_queue.rb index 40f99e791c8d..5f58a629857f 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_queue.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_queue call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#get_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#get_queue. # def get_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_task.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_task.rb index 1448b5ed814c..270ded734baa 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_task.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/get_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_task call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#get_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#get_task. # def get_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/lease_tasks.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/lease_tasks.rb index 283f0fce983b..86264d22f32c 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/lease_tasks.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/lease_tasks.rb @@ -22,9 +22,14 @@ ## # Snippet for the lease_tasks call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#lease_tasks. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks. # def lease_tasks # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/list_queues.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/list_queues.rb index 7569528212ea..1614a8a91097 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/list_queues.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/list_queues.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_queues call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#list_queues. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_queues. # def list_queues # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/list_tasks.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/list_tasks.rb index b59019386d78..d050d839f65a 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/list_tasks.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/list_tasks.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_tasks call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#list_tasks. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_tasks. # def list_tasks # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/pause_queue.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/pause_queue.rb index cabc64f03a57..343ced5622af 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/pause_queue.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/pause_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the pause_queue call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#pause_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#pause_queue. # def pause_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/purge_queue.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/purge_queue.rb index e4744691a1ff..ac5b2a4e4a90 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/purge_queue.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/purge_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the purge_queue call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#purge_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#purge_queue. # def purge_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/renew_lease.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/renew_lease.rb index f84b2bec93c3..4e6f73f31ba5 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/renew_lease.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/renew_lease.rb @@ -22,9 +22,14 @@ ## # Snippet for the renew_lease call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#renew_lease. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#renew_lease. # def renew_lease # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/resume_queue.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/resume_queue.rb index b53029e23c17..77d34d80dded 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/resume_queue.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/resume_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the resume_queue call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#resume_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#resume_queue. # def resume_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/run_task.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/run_task.rb index 105b1eb05c51..c898ec64975f 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/run_task.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/run_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the run_task call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#run_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task. # def run_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/set_iam_policy.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/set_iam_policy.rb index c2f9aac4412c..95346efa1aaa 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/set_iam_policy.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/set_iam_policy.rb @@ -22,9 +22,14 @@ ## # Snippet for the set_iam_policy call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#set_iam_policy. It may -# require modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::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-tasks-v2beta2/snippets/cloud_tasks/test_iam_permissions.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/test_iam_permissions.rb index dc4f91f58f32..a0fd1602dde7 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/test_iam_permissions.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/test_iam_permissions.rb @@ -22,9 +22,14 @@ ## # Snippet for the test_iam_permissions call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#test_iam_permissions. It may -# require modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#test_iam_permissions. # def test_iam_permissions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/update_queue.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/update_queue.rb index 94ab83e9107d..ed8eb9227efb 100755 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/update_queue.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/update_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_queue call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#update_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#update_queue. # def update_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/upload_queue_yaml.rb b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/upload_queue_yaml.rb index 686ef89dd453..07f482e72358 100644 --- a/google-cloud-tasks-v2beta2/snippets/cloud_tasks/upload_queue_yaml.rb +++ b/google-cloud-tasks-v2beta2/snippets/cloud_tasks/upload_queue_yaml.rb @@ -22,9 +22,14 @@ ## # Snippet for the upload_queue_yaml call in the CloudTasks 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::Tasks::V2beta2::CloudTasks::Client#upload_queue_yaml. It may -# require modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta2::CloudTasks::Client#upload_queue_yaml. # def upload_queue_yaml # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta2/snippets/snippet_metadata_google.cloud.tasks.v2beta2.json b/google-cloud-tasks-v2beta2/snippets/snippet_metadata_google.cloud.tasks.v2beta2.json index 6e3cbe8ed501..f4e28350aa4c 100644 --- a/google-cloud-tasks-v2beta2/snippets/snippet_metadata_google.cloud.tasks.v2beta2.json +++ b/google-cloud-tasks-v2beta2/snippets/snippet_metadata_google.cloud.tasks.v2beta2.json @@ -14,7 +14,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_ListQueues_sync", "title": "Snippet for the list_queues call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_queues. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_queues.", "file": "cloud_tasks/list_queues.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_GetQueue_sync", "title": "Snippet for the get_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#get_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#get_queue.", "file": "cloud_tasks/get_queue.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_CreateQueue_sync", "title": "Snippet for the create_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#create_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#create_queue.", "file": "cloud_tasks/create_queue.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_UpdateQueue_sync", "title": "Snippet for the update_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#update_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#update_queue.", "file": "cloud_tasks/update_queue.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_DeleteQueue_sync", "title": "Snippet for the delete_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#delete_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#delete_queue.", "file": "cloud_tasks/delete_queue.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_PurgeQueue_sync", "title": "Snippet for the purge_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#purge_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#purge_queue.", "file": "cloud_tasks/purge_queue.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_PauseQueue_sync", "title": "Snippet for the pause_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#pause_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#pause_queue.", "file": "cloud_tasks/pause_queue.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_ResumeQueue_sync", "title": "Snippet for the resume_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#resume_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#resume_queue.", "file": "cloud_tasks/resume_queue.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_UploadQueueYaml_sync", "title": "Snippet for the upload_queue_yaml call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#upload_queue_yaml. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#upload_queue_yaml.", "file": "cloud_tasks/upload_queue_yaml.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_GetIamPolicy_sync", "title": "Snippet for the get_iam_policy call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::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::Tasks::V2beta2::CloudTasks::Client#get_iam_policy.", "file": "cloud_tasks/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": "cloudtasks_v2beta2_generated_CloudTasks_SetIamPolicy_sync", "title": "Snippet for the set_iam_policy call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::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::Tasks::V2beta2::CloudTasks::Client#set_iam_policy.", "file": "cloud_tasks/set_iam_policy.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_TestIamPermissions_sync", "title": "Snippet for the test_iam_permissions call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::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::Tasks::V2beta2::CloudTasks::Client#test_iam_permissions.", "file": "cloud_tasks/test_iam_permissions.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_ListTasks_sync", "title": "Snippet for the list_tasks call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_tasks. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_tasks.", "file": "cloud_tasks/list_tasks.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_GetTask_sync", "title": "Snippet for the get_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#get_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#get_task.", "file": "cloud_tasks/get_task.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_CreateTask_sync", "title": "Snippet for the create_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#create_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#create_task.", "file": "cloud_tasks/create_task.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_DeleteTask_sync", "title": "Snippet for the delete_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#delete_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#delete_task.", "file": "cloud_tasks/delete_task.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_LeaseTasks_sync", "title": "Snippet for the lease_tasks call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks.", "file": "cloud_tasks/lease_tasks.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -694,7 +694,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_AcknowledgeTask_sync", "title": "Snippet for the acknowledge_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#acknowledge_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#acknowledge_task.", "file": "cloud_tasks/acknowledge_task.rb", "language": "RUBY", "client_method": { @@ -726,7 +726,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -734,7 +734,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_RenewLease_sync", "title": "Snippet for the renew_lease call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#renew_lease. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#renew_lease.", "file": "cloud_tasks/renew_lease.rb", "language": "RUBY", "client_method": { @@ -766,7 +766,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -774,7 +774,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_CancelLease_sync", "title": "Snippet for the cancel_lease call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#cancel_lease. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#cancel_lease.", "file": "cloud_tasks/cancel_lease.rb", "language": "RUBY", "client_method": { @@ -806,7 +806,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -814,7 +814,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_RunTask_sync", "title": "Snippet for the run_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task.", "file": "cloud_tasks/run_task.rb", "language": "RUBY", "client_method": { @@ -846,7 +846,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -854,7 +854,7 @@ { "region_tag": "cloudtasks_v2beta2_generated_CloudTasks_BufferTask_sync", "title": "Snippet for the buffer_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#buffer_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta2::CloudTasks::Client#buffer_task.", "file": "cloud_tasks/buffer_task.rb", "language": "RUBY", "client_method": { @@ -886,7 +886,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-tasks-v2beta3/.owlbot-manifest.json b/google-cloud-tasks-v2beta3/.owlbot-manifest.json index 2b1547a6d9a1..5a073a2a5d0a 100644 --- a/google-cloud-tasks-v2beta3/.owlbot-manifest.json +++ b/google-cloud-tasks-v2beta3/.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-tasks-v2beta3/.toys.rb b/google-cloud-tasks-v2beta3/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-tasks-v2beta3/.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-tasks-v2beta3/AUTHENTICATION.md b/google-cloud-tasks-v2beta3/AUTHENTICATION.md index 4b1755de4c20..8a26642ba1e1 100644 --- a/google-cloud-tasks-v2beta3/AUTHENTICATION.md +++ b/google-cloud-tasks-v2beta3/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-tasks-v2beta3 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-tasks-v2beta3 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 TASKS_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/tasks/v2beta3" +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::Tasks::V2beta3::CloudTasks::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-tasks-v2beta3 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-tasks-v2beta3 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-tasks-v2beta3 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Tasks::V2beta3::CloudTasks::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `TASKS_CREDENTIALS` - Path to JSON file, or JSON contents -* `TASKS_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/tasks/v2beta3" - -ENV["TASKS_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Tasks::V2beta3::CloudTasks::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/tasks/v2beta3" client = ::Google::Cloud::Tasks::V2beta3::CloudTasks::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/tasks/v2beta3" ::Google::Cloud::Tasks::V2beta3::CloudTasks::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Tasks::V2beta3::CloudTasks::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-tasks-v2beta3 +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/tasks/v2beta3" -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-tasks-v2beta3. +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::Tasks::V2beta3::CloudTasks::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-tasks-v2beta3/google-cloud-tasks-v2beta3.gemspec b/google-cloud-tasks-v2beta3/google-cloud-tasks-v2beta3.gemspec index b74540832f98..43d3204a9f26 100644 --- a/google-cloud-tasks-v2beta3/google-cloud-tasks-v2beta3.gemspec +++ b/google-cloud-tasks-v2beta3/google-cloud-tasks-v2beta3.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_dependency "grpc-google-iam-v1", "~> 1.1" gem.add_development_dependency "google-style", "~> 1.26.3" diff --git a/google-cloud-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/client.rb b/google-cloud-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/client.rb index 861abf094186..a3dbabdf4473 100644 --- a/google-cloud-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/client.rb +++ b/google-cloud-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/client.rb @@ -32,6 +32,9 @@ module CloudTasks # work in their applications. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudtasks.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -150,6 +153,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_tasks_stub.universe_domain + end + ## # Create a new CloudTasks client object. # @@ -183,8 +195,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) @@ -197,12 +210,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @cloud_tasks_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Tasks::V2beta3::CloudTasks::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 @@ -2065,9 +2081,9 @@ def buffer_task request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudtasks.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 @@ -2113,13 +2129,20 @@ def buffer_task 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 = "cloudtasks.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 @@ -2134,6 +2157,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-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/rest/client.rb b/google-cloud-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/rest/client.rb index 4017a9683c8e..7706e25f6e98 100644 --- a/google-cloud-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/rest/client.rb +++ b/google-cloud-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/rest/client.rb @@ -34,6 +34,9 @@ module Rest # work in their applications. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudtasks.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -152,6 +155,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @cloud_tasks_stub.universe_domain + end + ## # Create a new CloudTasks REST client object. # @@ -179,8 +191,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) @@ -194,10 +207,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 - @cloud_tasks_stub = ::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @cloud_tasks_stub = ::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -1934,9 +1953,9 @@ def buffer_task request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudtasks.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 @@ -1973,13 +1992,20 @@ def buffer_task 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 = "cloudtasks.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 } @@ -1991,6 +2017,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-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/rest/service_stub.rb b/google-cloud-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/rest/service_stub.rb index 0956c3a4a4ae..b0a80386cea0 100644 --- a/google-cloud-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/rest/service_stub.rb +++ b/google-cloud-tasks-v2beta3/lib/google/cloud/tasks/v2beta3/cloud_tasks/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_queues REST call # diff --git a/google-cloud-tasks-v2beta3/proto_docs/google/api/client.rb b/google-cloud-tasks-v2beta3/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-tasks-v2beta3/proto_docs/google/api/client.rb +++ b/google-cloud-tasks-v2beta3/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-tasks-v2beta3/snippets/cloud_tasks/buffer_task.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/buffer_task.rb index 6286a1412914..a3735f441dc1 100644 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/buffer_task.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/buffer_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the buffer_task call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#buffer_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#buffer_task. # def buffer_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/create_queue.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/create_queue.rb index ca654c5d35a8..e89294f78270 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/create_queue.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/create_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_queue call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#create_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#create_queue. # def create_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/create_task.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/create_task.rb index 80773e88b91e..b9206fbec184 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/create_task.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/create_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_task call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#create_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#create_task. # def create_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/delete_queue.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/delete_queue.rb index 2b54421da646..09b151773c7f 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/delete_queue.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/delete_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_queue call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#delete_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#delete_queue. # def delete_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/delete_task.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/delete_task.rb index e20fa79cfdb8..9ebcb7c264f2 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/delete_task.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/delete_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_task call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#delete_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#delete_task. # def delete_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_iam_policy.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_iam_policy.rb index 0111e5aa0827..883f67b19768 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_iam_policy.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_iam_policy.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_iam_policy call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#get_iam_policy. It may -# require modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::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-tasks-v2beta3/snippets/cloud_tasks/get_queue.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_queue.rb index 004ab14a8f27..b58696531da4 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_queue.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_queue call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#get_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#get_queue. # def get_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_task.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_task.rb index c272588e6a9d..12d93ef1af78 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_task.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/get_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_task call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#get_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#get_task. # def get_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/list_queues.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/list_queues.rb index 8ed1e9d9bc39..b353b3220da7 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/list_queues.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/list_queues.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_queues call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#list_queues. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#list_queues. # def list_queues # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/list_tasks.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/list_tasks.rb index 4e95871d9090..0830c2a1437e 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/list_tasks.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/list_tasks.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_tasks call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#list_tasks. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#list_tasks. # def list_tasks # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/pause_queue.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/pause_queue.rb index 8556ee9eb85b..d9b3887627be 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/pause_queue.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/pause_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the pause_queue call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#pause_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#pause_queue. # def pause_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/purge_queue.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/purge_queue.rb index d2d396b99c82..ce87127a41c0 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/purge_queue.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/purge_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the purge_queue call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#purge_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#purge_queue. # def purge_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/resume_queue.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/resume_queue.rb index 867075c4f850..8bfeb9cfbbb5 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/resume_queue.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/resume_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the resume_queue call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#resume_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#resume_queue. # def resume_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/run_task.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/run_task.rb index fa1fa08ac910..4b7d74af042a 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/run_task.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/run_task.rb @@ -22,9 +22,14 @@ ## # Snippet for the run_task call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#run_task. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#run_task. # def run_task # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/set_iam_policy.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/set_iam_policy.rb index 0e0241322fb5..ca8992d77083 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/set_iam_policy.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/set_iam_policy.rb @@ -22,9 +22,14 @@ ## # Snippet for the set_iam_policy call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#set_iam_policy. It may -# require modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::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-tasks-v2beta3/snippets/cloud_tasks/test_iam_permissions.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/test_iam_permissions.rb index 23de447fa347..6d03a7eb5883 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/test_iam_permissions.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/test_iam_permissions.rb @@ -22,9 +22,14 @@ ## # Snippet for the test_iam_permissions call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#test_iam_permissions. It may -# require modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#test_iam_permissions. # def test_iam_permissions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/update_queue.rb b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/update_queue.rb index c273a43d1df2..e024d9fbda54 100755 --- a/google-cloud-tasks-v2beta3/snippets/cloud_tasks/update_queue.rb +++ b/google-cloud-tasks-v2beta3/snippets/cloud_tasks/update_queue.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_queue call in the CloudTasks 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::Tasks::V2beta3::CloudTasks::Client#update_queue. It may require -# modification in order to execute successfully. +# Google::Cloud::Tasks::V2beta3::CloudTasks::Client#update_queue. # def update_queue # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tasks-v2beta3/snippets/snippet_metadata_google.cloud.tasks.v2beta3.json b/google-cloud-tasks-v2beta3/snippets/snippet_metadata_google.cloud.tasks.v2beta3.json index 5e71c4a1f24e..4a2a82758d05 100644 --- a/google-cloud-tasks-v2beta3/snippets/snippet_metadata_google.cloud.tasks.v2beta3.json +++ b/google-cloud-tasks-v2beta3/snippets/snippet_metadata_google.cloud.tasks.v2beta3.json @@ -14,7 +14,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_ListQueues_sync", "title": "Snippet for the list_queues call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#list_queues. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#list_queues.", "file": "cloud_tasks/list_queues.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_GetQueue_sync", "title": "Snippet for the get_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#get_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#get_queue.", "file": "cloud_tasks/get_queue.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_CreateQueue_sync", "title": "Snippet for the create_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#create_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#create_queue.", "file": "cloud_tasks/create_queue.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_UpdateQueue_sync", "title": "Snippet for the update_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#update_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#update_queue.", "file": "cloud_tasks/update_queue.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_DeleteQueue_sync", "title": "Snippet for the delete_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#delete_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#delete_queue.", "file": "cloud_tasks/delete_queue.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_PurgeQueue_sync", "title": "Snippet for the purge_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#purge_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#purge_queue.", "file": "cloud_tasks/purge_queue.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_PauseQueue_sync", "title": "Snippet for the pause_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#pause_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#pause_queue.", "file": "cloud_tasks/pause_queue.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_ResumeQueue_sync", "title": "Snippet for the resume_queue call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#resume_queue. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#resume_queue.", "file": "cloud_tasks/resume_queue.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_GetIamPolicy_sync", "title": "Snippet for the get_iam_policy call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::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::Tasks::V2beta3::CloudTasks::Client#get_iam_policy.", "file": "cloud_tasks/get_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": "cloudtasks_v2beta3_generated_CloudTasks_SetIamPolicy_sync", "title": "Snippet for the set_iam_policy call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::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::Tasks::V2beta3::CloudTasks::Client#set_iam_policy.", "file": "cloud_tasks/set_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": "cloudtasks_v2beta3_generated_CloudTasks_TestIamPermissions_sync", "title": "Snippet for the test_iam_permissions call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::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::Tasks::V2beta3::CloudTasks::Client#test_iam_permissions.", "file": "cloud_tasks/test_iam_permissions.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_ListTasks_sync", "title": "Snippet for the list_tasks call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#list_tasks. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#list_tasks.", "file": "cloud_tasks/list_tasks.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_GetTask_sync", "title": "Snippet for the get_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#get_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#get_task.", "file": "cloud_tasks/get_task.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_CreateTask_sync", "title": "Snippet for the create_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#create_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#create_task.", "file": "cloud_tasks/create_task.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_DeleteTask_sync", "title": "Snippet for the delete_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#delete_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#delete_task.", "file": "cloud_tasks/delete_task.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_RunTask_sync", "title": "Snippet for the run_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#run_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#run_task.", "file": "cloud_tasks/run_task.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "cloudtasks_v2beta3_generated_CloudTasks_BufferTask_sync", "title": "Snippet for the buffer_task call in the CloudTasks service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#buffer_task. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tasks::V2beta3::CloudTasks::Client#buffer_task.", "file": "cloud_tasks/buffer_task.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-telco_automation-v1/.owlbot-manifest.json b/google-cloud-telco_automation-v1/.owlbot-manifest.json index 6a6801291305..8d9e1e05dc8e 100644 --- a/google-cloud-telco_automation-v1/.owlbot-manifest.json +++ b/google-cloud-telco_automation-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-telco_automation-v1/.toys.rb b/google-cloud-telco_automation-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-telco_automation-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-telco_automation-v1/AUTHENTICATION.md b/google-cloud-telco_automation-v1/AUTHENTICATION.md index 3e33b8d3f814..15c5b59bafcf 100644 --- a/google-cloud-telco_automation-v1/AUTHENTICATION.md +++ b/google-cloud-telco_automation-v1/AUTHENTICATION.md @@ -1,149 +1,122 @@ # Authentication -In general, the google-cloud-telco_automation-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-telco_automation-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/telco_automation/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::TelcoAutomation::V1::TelcoAutomation::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-telco_automation-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-telco_automation-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-telco_automation-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::TelcoAutomation::V1::TelcoAutomation::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/telco_automation/v1" - -ENV["GOOGLE_CLOUD_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::TelcoAutomation::V1::TelcoAutomation::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/telco_automation/v1" client = ::Google::Cloud::TelcoAutomation::V1::TelcoAutomation::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/telco_automation/v1" ::Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::TelcoAutomation::V1::TelcoAutomation::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-telco_automation-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/telco_automation/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-telco_automation-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::TelcoAutomation::V1::TelcoAutomation::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-telco_automation-v1/google-cloud-telco_automation-v1.gemspec b/google-cloud-telco_automation-v1/google-cloud-telco_automation-v1.gemspec index 761d98a0503f..8913187de737 100644 --- a/google-cloud-telco_automation-v1/google-cloud-telco_automation-v1.gemspec +++ b/google-cloud-telco_automation-v1/google-cloud-telco_automation-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-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/client.rb b/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/client.rb index f13157f3ea0f..aa58e1905b13 100644 --- a/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/client.rb +++ b/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/client.rb @@ -35,6 +35,9 @@ module TelcoAutomation # functions. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "telcoautomation.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -95,6 +98,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @telco_automation_stub.universe_domain + end + ## # Create a new TelcoAutomation 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) @@ -142,18 +155,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 @telco_automation_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::TelcoAutomation::V1::TelcoAutomation::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 @@ -3563,9 +3580,9 @@ def apply_hydrated_deployment request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"telcoautomation.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 @@ -3611,13 +3628,20 @@ def apply_hydrated_deployment 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 = "telcoautomation.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 @@ -3632,6 +3656,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-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/operations.rb b/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/operations.rb index c6d368691dda..e513423c3399 100644 --- a/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/operations.rb +++ b/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/operations.rb @@ -26,6 +26,9 @@ module V1 module TelcoAutomation # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "telcoautomation.$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 `"telcoautomation.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 = "telcoautomation.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-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/client.rb b/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/client.rb index 0c8d52b8c6ed..16e145cd97dc 100644 --- a/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/client.rb +++ b/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/client.rb @@ -37,6 +37,9 @@ module Rest # functions. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "telcoautomation.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -97,6 +100,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @telco_automation_stub.universe_domain + end + ## # Create a new TelcoAutomation 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) @@ -139,16 +152,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 - @telco_automation_stub = ::Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @telco_automation_stub = ::Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -3300,9 +3320,9 @@ def apply_hydrated_deployment request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"telcoautomation.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 @@ -3339,13 +3359,20 @@ def apply_hydrated_deployment 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 = "telcoautomation.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 } @@ -3357,6 +3384,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-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/operations.rb b/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/operations.rb index ee79396c256f..381ece3dc1ff 100644 --- a/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/operations.rb +++ b/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/operations.rb @@ -26,6 +26,9 @@ module TelcoAutomation module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "telcoautomation.$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 `"telcoautomation.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 = "telcoautomation.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-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/service_stub.rb b/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/service_stub.rb index 82575ad517b6..aef5b26d1d07 100644 --- a/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/rest/service_stub.rb +++ b/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/telco_automation/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_orchestration_clusters REST call # diff --git a/google-cloud-telco_automation-v1/proto_docs/google/api/client.rb b/google-cloud-telco_automation-v1/proto_docs/google/api/client.rb index c38077287bbc..53fb4bc2d7da 100644 --- a/google-cloud-telco_automation-v1/proto_docs/google/api/client.rb +++ b/google-cloud-telco_automation-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-telco_automation-v1/snippets/snippet_metadata_google.cloud.telcoautomation.v1.json b/google-cloud-telco_automation-v1/snippets/snippet_metadata_google.cloud.telcoautomation.v1.json index 8075e0af49c1..ab6edef8ffb4 100644 --- a/google-cloud-telco_automation-v1/snippets/snippet_metadata_google.cloud.telcoautomation.v1.json +++ b/google-cloud-telco_automation-v1/snippets/snippet_metadata_google.cloud.telcoautomation.v1.json @@ -14,7 +14,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ListOrchestrationClusters_sync", "title": "Snippet for the list_orchestration_clusters call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_orchestration_clusters. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_orchestration_clusters.", "file": "telco_automation/list_orchestration_clusters.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_GetOrchestrationCluster_sync", "title": "Snippet for the get_orchestration_cluster call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_orchestration_cluster. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_orchestration_cluster.", "file": "telco_automation/get_orchestration_cluster.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_CreateOrchestrationCluster_sync", "title": "Snippet for the create_orchestration_cluster call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#create_orchestration_cluster. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#create_orchestration_cluster.", "file": "telco_automation/create_orchestration_cluster.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_DeleteOrchestrationCluster_sync", "title": "Snippet for the delete_orchestration_cluster call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#delete_orchestration_cluster. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#delete_orchestration_cluster.", "file": "telco_automation/delete_orchestration_cluster.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ListEdgeSlms_sync", "title": "Snippet for the list_edge_slms call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_edge_slms. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_edge_slms.", "file": "telco_automation/list_edge_slms.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_GetEdgeSlm_sync", "title": "Snippet for the get_edge_slm call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_edge_slm. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_edge_slm.", "file": "telco_automation/get_edge_slm.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_CreateEdgeSlm_sync", "title": "Snippet for the create_edge_slm call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#create_edge_slm. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#create_edge_slm.", "file": "telco_automation/create_edge_slm.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_DeleteEdgeSlm_sync", "title": "Snippet for the delete_edge_slm call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#delete_edge_slm. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#delete_edge_slm.", "file": "telco_automation/delete_edge_slm.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_CreateBlueprint_sync", "title": "Snippet for the create_blueprint call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#create_blueprint. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#create_blueprint.", "file": "telco_automation/create_blueprint.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_UpdateBlueprint_sync", "title": "Snippet for the update_blueprint call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#update_blueprint. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#update_blueprint.", "file": "telco_automation/update_blueprint.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_GetBlueprint_sync", "title": "Snippet for the get_blueprint call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_blueprint. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_blueprint.", "file": "telco_automation/get_blueprint.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_DeleteBlueprint_sync", "title": "Snippet for the delete_blueprint call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#delete_blueprint. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#delete_blueprint.", "file": "telco_automation/delete_blueprint.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ListBlueprints_sync", "title": "Snippet for the list_blueprints call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_blueprints. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_blueprints.", "file": "telco_automation/list_blueprints.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ApproveBlueprint_sync", "title": "Snippet for the approve_blueprint call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#approve_blueprint. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#approve_blueprint.", "file": "telco_automation/approve_blueprint.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ProposeBlueprint_sync", "title": "Snippet for the propose_blueprint call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#propose_blueprint. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#propose_blueprint.", "file": "telco_automation/propose_blueprint.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_RejectBlueprint_sync", "title": "Snippet for the reject_blueprint call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#reject_blueprint. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#reject_blueprint.", "file": "telco_automation/reject_blueprint.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ListBlueprintRevisions_sync", "title": "Snippet for the list_blueprint_revisions call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_blueprint_revisions. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_blueprint_revisions.", "file": "telco_automation/list_blueprint_revisions.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -694,7 +694,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_SearchBlueprintRevisions_sync", "title": "Snippet for the search_blueprint_revisions call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#search_blueprint_revisions. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#search_blueprint_revisions.", "file": "telco_automation/search_blueprint_revisions.rb", "language": "RUBY", "client_method": { @@ -726,7 +726,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -734,7 +734,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_SearchDeploymentRevisions_sync", "title": "Snippet for the search_deployment_revisions call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#search_deployment_revisions. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#search_deployment_revisions.", "file": "telco_automation/search_deployment_revisions.rb", "language": "RUBY", "client_method": { @@ -766,7 +766,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -774,7 +774,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_DiscardBlueprintChanges_sync", "title": "Snippet for the discard_blueprint_changes call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#discard_blueprint_changes. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#discard_blueprint_changes.", "file": "telco_automation/discard_blueprint_changes.rb", "language": "RUBY", "client_method": { @@ -806,7 +806,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -814,7 +814,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ListPublicBlueprints_sync", "title": "Snippet for the list_public_blueprints call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_public_blueprints. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_public_blueprints.", "file": "telco_automation/list_public_blueprints.rb", "language": "RUBY", "client_method": { @@ -846,7 +846,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -854,7 +854,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_GetPublicBlueprint_sync", "title": "Snippet for the get_public_blueprint call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_public_blueprint. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_public_blueprint.", "file": "telco_automation/get_public_blueprint.rb", "language": "RUBY", "client_method": { @@ -886,7 +886,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -894,7 +894,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_CreateDeployment_sync", "title": "Snippet for the create_deployment call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#create_deployment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#create_deployment.", "file": "telco_automation/create_deployment.rb", "language": "RUBY", "client_method": { @@ -926,7 +926,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -934,7 +934,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_UpdateDeployment_sync", "title": "Snippet for the update_deployment call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#update_deployment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#update_deployment.", "file": "telco_automation/update_deployment.rb", "language": "RUBY", "client_method": { @@ -966,7 +966,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -974,7 +974,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_GetDeployment_sync", "title": "Snippet for the get_deployment call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_deployment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_deployment.", "file": "telco_automation/get_deployment.rb", "language": "RUBY", "client_method": { @@ -1006,7 +1006,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -1014,7 +1014,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_RemoveDeployment_sync", "title": "Snippet for the remove_deployment call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#remove_deployment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#remove_deployment.", "file": "telco_automation/remove_deployment.rb", "language": "RUBY", "client_method": { @@ -1046,7 +1046,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -1054,7 +1054,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ListDeployments_sync", "title": "Snippet for the list_deployments call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_deployments. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_deployments.", "file": "telco_automation/list_deployments.rb", "language": "RUBY", "client_method": { @@ -1086,7 +1086,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -1094,7 +1094,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ListDeploymentRevisions_sync", "title": "Snippet for the list_deployment_revisions call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_deployment_revisions. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_deployment_revisions.", "file": "telco_automation/list_deployment_revisions.rb", "language": "RUBY", "client_method": { @@ -1126,7 +1126,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -1134,7 +1134,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_DiscardDeploymentChanges_sync", "title": "Snippet for the discard_deployment_changes call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#discard_deployment_changes. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#discard_deployment_changes.", "file": "telco_automation/discard_deployment_changes.rb", "language": "RUBY", "client_method": { @@ -1166,7 +1166,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -1174,7 +1174,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ApplyDeployment_sync", "title": "Snippet for the apply_deployment call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#apply_deployment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#apply_deployment.", "file": "telco_automation/apply_deployment.rb", "language": "RUBY", "client_method": { @@ -1206,7 +1206,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -1214,7 +1214,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ComputeDeploymentStatus_sync", "title": "Snippet for the compute_deployment_status call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#compute_deployment_status. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#compute_deployment_status.", "file": "telco_automation/compute_deployment_status.rb", "language": "RUBY", "client_method": { @@ -1246,7 +1246,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -1254,7 +1254,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_RollbackDeployment_sync", "title": "Snippet for the rollback_deployment call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#rollback_deployment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#rollback_deployment.", "file": "telco_automation/rollback_deployment.rb", "language": "RUBY", "client_method": { @@ -1286,7 +1286,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -1294,7 +1294,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_GetHydratedDeployment_sync", "title": "Snippet for the get_hydrated_deployment call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_hydrated_deployment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_hydrated_deployment.", "file": "telco_automation/get_hydrated_deployment.rb", "language": "RUBY", "client_method": { @@ -1326,7 +1326,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -1334,7 +1334,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ListHydratedDeployments_sync", "title": "Snippet for the list_hydrated_deployments call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_hydrated_deployments. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_hydrated_deployments.", "file": "telco_automation/list_hydrated_deployments.rb", "language": "RUBY", "client_method": { @@ -1366,7 +1366,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -1374,7 +1374,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_UpdateHydratedDeployment_sync", "title": "Snippet for the update_hydrated_deployment call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#update_hydrated_deployment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#update_hydrated_deployment.", "file": "telco_automation/update_hydrated_deployment.rb", "language": "RUBY", "client_method": { @@ -1406,7 +1406,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -1414,7 +1414,7 @@ { "region_tag": "telcoautomation_v1_generated_TelcoAutomation_ApplyHydratedDeployment_sync", "title": "Snippet for the apply_hydrated_deployment call in the TelcoAutomation service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#apply_hydrated_deployment. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#apply_hydrated_deployment.", "file": "telco_automation/apply_hydrated_deployment.rb", "language": "RUBY", "client_method": { @@ -1446,7 +1446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/apply_deployment.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/apply_deployment.rb index 341353220cc6..79c14443188a 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/apply_deployment.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/apply_deployment.rb @@ -22,9 +22,14 @@ ## # Snippet for the apply_deployment call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#apply_deployment. -# It may require modification in order to execute successfully. # def apply_deployment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/apply_hydrated_deployment.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/apply_hydrated_deployment.rb index df9c79353fb1..ada84baaad0b 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/apply_hydrated_deployment.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/apply_hydrated_deployment.rb @@ -22,9 +22,14 @@ ## # Snippet for the apply_hydrated_deployment call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#apply_hydrated_deployment. -# It may require modification in order to execute successfully. # def apply_hydrated_deployment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/approve_blueprint.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/approve_blueprint.rb index e234d4331cb9..32fa845604ec 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/approve_blueprint.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/approve_blueprint.rb @@ -22,9 +22,14 @@ ## # Snippet for the approve_blueprint call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#approve_blueprint. -# It may require modification in order to execute successfully. # def approve_blueprint # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/compute_deployment_status.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/compute_deployment_status.rb index 4c2cfe2e6f33..f06ca76893e1 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/compute_deployment_status.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/compute_deployment_status.rb @@ -22,9 +22,14 @@ ## # Snippet for the compute_deployment_status call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#compute_deployment_status. -# It may require modification in order to execute successfully. # def compute_deployment_status # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/create_blueprint.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/create_blueprint.rb index 0f1a655c7952..c29c78ccb10e 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/create_blueprint.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/create_blueprint.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_blueprint call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#create_blueprint. -# It may require modification in order to execute successfully. # def create_blueprint # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/create_deployment.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/create_deployment.rb index 3c00fc3dc3cb..289ff36485f9 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/create_deployment.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/create_deployment.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_deployment call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#create_deployment. -# It may require modification in order to execute successfully. # def create_deployment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/create_edge_slm.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/create_edge_slm.rb index 4fe844de25df..fec9e907d0df 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/create_edge_slm.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/create_edge_slm.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_edge_slm call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#create_edge_slm. -# It may require modification in order to execute successfully. # def create_edge_slm # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/create_orchestration_cluster.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/create_orchestration_cluster.rb index 9fca9abe234c..f057c48baeac 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/create_orchestration_cluster.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/create_orchestration_cluster.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_orchestration_cluster call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#create_orchestration_cluster. -# It may require modification in order to execute successfully. # def create_orchestration_cluster # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/delete_blueprint.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/delete_blueprint.rb index 14bbcb205d29..c39d1ee60b55 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/delete_blueprint.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/delete_blueprint.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_blueprint call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#delete_blueprint. -# It may require modification in order to execute successfully. # def delete_blueprint # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/delete_edge_slm.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/delete_edge_slm.rb index 78aebbe06fda..fbd2705f4f5d 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/delete_edge_slm.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/delete_edge_slm.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_edge_slm call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#delete_edge_slm. -# It may require modification in order to execute successfully. # def delete_edge_slm # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/delete_orchestration_cluster.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/delete_orchestration_cluster.rb index bb0508a957b3..82c837708c5c 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/delete_orchestration_cluster.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/delete_orchestration_cluster.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_orchestration_cluster call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#delete_orchestration_cluster. -# It may require modification in order to execute successfully. # def delete_orchestration_cluster # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/discard_blueprint_changes.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/discard_blueprint_changes.rb index c47aff77cd50..96b686a223c5 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/discard_blueprint_changes.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/discard_blueprint_changes.rb @@ -22,9 +22,14 @@ ## # Snippet for the discard_blueprint_changes call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#discard_blueprint_changes. -# It may require modification in order to execute successfully. # def discard_blueprint_changes # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/discard_deployment_changes.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/discard_deployment_changes.rb index b978973ea7f3..1093f4ea5820 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/discard_deployment_changes.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/discard_deployment_changes.rb @@ -22,9 +22,14 @@ ## # Snippet for the discard_deployment_changes call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#discard_deployment_changes. -# It may require modification in order to execute successfully. # def discard_deployment_changes # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/get_blueprint.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/get_blueprint.rb index 7ff2bf2b6049..151e5fc56dd5 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/get_blueprint.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/get_blueprint.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_blueprint call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#get_blueprint. It -# may require modification in order to execute successfully. +# Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_blueprint. # def get_blueprint # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/get_deployment.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/get_deployment.rb index f00a4e32541b..c990b27bfa88 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/get_deployment.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/get_deployment.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_deployment call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#get_deployment. It -# may require modification in order to execute successfully. +# Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_deployment. # def get_deployment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/get_edge_slm.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/get_edge_slm.rb index d4e97f59b04d..145d97453441 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/get_edge_slm.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/get_edge_slm.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_edge_slm call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#get_edge_slm. It -# may require modification in order to execute successfully. +# Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#get_edge_slm. # def get_edge_slm # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/get_hydrated_deployment.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/get_hydrated_deployment.rb index 08f59f08fe18..81c2132e34d8 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/get_hydrated_deployment.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/get_hydrated_deployment.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_hydrated_deployment call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#get_hydrated_deployment. -# It may require modification in order to execute successfully. # def get_hydrated_deployment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/get_orchestration_cluster.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/get_orchestration_cluster.rb index 230361e32011..179cec5348c8 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/get_orchestration_cluster.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/get_orchestration_cluster.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_orchestration_cluster call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#get_orchestration_cluster. -# It may require modification in order to execute successfully. # def get_orchestration_cluster # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/get_public_blueprint.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/get_public_blueprint.rb index 39d56ff2139d..ee4ab3bb2965 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/get_public_blueprint.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/get_public_blueprint.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_public_blueprint call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#get_public_blueprint. -# It may require modification in order to execute successfully. # def get_public_blueprint # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/list_blueprint_revisions.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/list_blueprint_revisions.rb index fd72bab1f7ec..13d182f65132 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/list_blueprint_revisions.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/list_blueprint_revisions.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_blueprint_revisions call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#list_blueprint_revisions. -# It may require modification in order to execute successfully. # def list_blueprint_revisions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/list_blueprints.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/list_blueprints.rb index 514e841b3e65..f9e56669ac7c 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/list_blueprints.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/list_blueprints.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_blueprints call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#list_blueprints. -# It may require modification in order to execute successfully. # def list_blueprints # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/list_deployment_revisions.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/list_deployment_revisions.rb index 03b9a5e97d0c..f763758c6779 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/list_deployment_revisions.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/list_deployment_revisions.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_deployment_revisions call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#list_deployment_revisions. -# It may require modification in order to execute successfully. # def list_deployment_revisions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/list_deployments.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/list_deployments.rb index 043199760e0a..ef9b78af9687 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/list_deployments.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/list_deployments.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_deployments call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#list_deployments. -# It may require modification in order to execute successfully. # def list_deployments # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/list_edge_slms.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/list_edge_slms.rb index a971590f9321..0309563ede0a 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/list_edge_slms.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/list_edge_slms.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_edge_slms call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#list_edge_slms. It -# may require modification in order to execute successfully. +# Google::Cloud::TelcoAutomation::V1::TelcoAutomation::Client#list_edge_slms. # def list_edge_slms # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/list_hydrated_deployments.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/list_hydrated_deployments.rb index c6c7d2bdeb6f..f1cbcb9c6e06 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/list_hydrated_deployments.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/list_hydrated_deployments.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_hydrated_deployments call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#list_hydrated_deployments. -# It may require modification in order to execute successfully. # def list_hydrated_deployments # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/list_orchestration_clusters.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/list_orchestration_clusters.rb index 52478dcab6ff..49a356040256 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/list_orchestration_clusters.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/list_orchestration_clusters.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_orchestration_clusters call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#list_orchestration_clusters. -# It may require modification in order to execute successfully. # def list_orchestration_clusters # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/list_public_blueprints.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/list_public_blueprints.rb index 6b67fc0b9741..ecc522198249 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/list_public_blueprints.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/list_public_blueprints.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_public_blueprints call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#list_public_blueprints. -# It may require modification in order to execute successfully. # def list_public_blueprints # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/propose_blueprint.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/propose_blueprint.rb index a2437894d5b7..dfd75d78c8a4 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/propose_blueprint.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/propose_blueprint.rb @@ -22,9 +22,14 @@ ## # Snippet for the propose_blueprint call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#propose_blueprint. -# It may require modification in order to execute successfully. # def propose_blueprint # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/reject_blueprint.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/reject_blueprint.rb index 863e2a37b235..4206b332b04f 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/reject_blueprint.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/reject_blueprint.rb @@ -22,9 +22,14 @@ ## # Snippet for the reject_blueprint call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#reject_blueprint. -# It may require modification in order to execute successfully. # def reject_blueprint # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/remove_deployment.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/remove_deployment.rb index 225e1df3b19c..19718ae1a50f 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/remove_deployment.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/remove_deployment.rb @@ -22,9 +22,14 @@ ## # Snippet for the remove_deployment call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#remove_deployment. -# It may require modification in order to execute successfully. # def remove_deployment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/rollback_deployment.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/rollback_deployment.rb index 536b9287de6d..e32479000c4e 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/rollback_deployment.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/rollback_deployment.rb @@ -22,9 +22,14 @@ ## # Snippet for the rollback_deployment call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#rollback_deployment. -# It may require modification in order to execute successfully. # def rollback_deployment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/search_blueprint_revisions.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/search_blueprint_revisions.rb index 89e5a36cb4e6..5d1c82557913 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/search_blueprint_revisions.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/search_blueprint_revisions.rb @@ -22,9 +22,14 @@ ## # Snippet for the search_blueprint_revisions call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#search_blueprint_revisions. -# It may require modification in order to execute successfully. # def search_blueprint_revisions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/search_deployment_revisions.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/search_deployment_revisions.rb index b9f44c33d909..869e24da2bba 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/search_deployment_revisions.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/search_deployment_revisions.rb @@ -22,9 +22,14 @@ ## # Snippet for the search_deployment_revisions call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#search_deployment_revisions. -# It may require modification in order to execute successfully. # def search_deployment_revisions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/update_blueprint.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/update_blueprint.rb index 63170be49047..3a59b7978996 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/update_blueprint.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/update_blueprint.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_blueprint call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#update_blueprint. -# It may require modification in order to execute successfully. # def update_blueprint # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/update_deployment.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/update_deployment.rb index 26d5e10c0df5..e70d0dadbeb8 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/update_deployment.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/update_deployment.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_deployment call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#update_deployment. -# It may require modification in order to execute successfully. # def update_deployment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-telco_automation-v1/snippets/telco_automation/update_hydrated_deployment.rb b/google-cloud-telco_automation-v1/snippets/telco_automation/update_hydrated_deployment.rb index 2ab19398488f..6a1ddf862e30 100644 --- a/google-cloud-telco_automation-v1/snippets/telco_automation/update_hydrated_deployment.rb +++ b/google-cloud-telco_automation-v1/snippets/telco_automation/update_hydrated_deployment.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_hydrated_deployment call in the TelcoAutomation 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::TelcoAutomation::V1::TelcoAutomation::Client#update_hydrated_deployment. -# It may require modification in order to execute successfully. # def update_hydrated_deployment # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-text_to_speech-v1/.owlbot-manifest.json b/google-cloud-text_to_speech-v1/.owlbot-manifest.json index fe1a54fc5ea3..21f4261125be 100644 --- a/google-cloud-text_to_speech-v1/.owlbot-manifest.json +++ b/google-cloud-text_to_speech-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-text_to_speech-v1/.toys.rb b/google-cloud-text_to_speech-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-text_to_speech-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-text_to_speech-v1/AUTHENTICATION.md b/google-cloud-text_to_speech-v1/AUTHENTICATION.md index df4fba635a58..9eb74f158a54 100644 --- a/google-cloud-text_to_speech-v1/AUTHENTICATION.md +++ b/google-cloud-text_to_speech-v1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-text_to_speech-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-text_to_speech-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 TEXTTOSPEECH_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/text_to_speech/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::TextToSpeech::V1::TextToSpeech::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-text_to_speech-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-text_to_speech-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-text_to_speech-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::TextToSpeech::V1::TextToSpeech::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `TEXTTOSPEECH_CREDENTIALS` - Path to JSON file, or JSON contents -* `TEXTTOSPEECH_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/text_to_speech/v1" - -ENV["TEXTTOSPEECH_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::TextToSpeech::V1::TextToSpeech::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/text_to_speech/v1" client = ::Google::Cloud::TextToSpeech::V1::TextToSpeech::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/text_to_speech/v1" ::Google::Cloud::TextToSpeech::V1::TextToSpeech::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::TextToSpeech::V1::TextToSpeech::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-text_to_speech-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/text_to_speech/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-text_to_speech-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::TextToSpeech::V1::TextToSpeech::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-text_to_speech-v1/google-cloud-text_to_speech-v1.gemspec b/google-cloud-text_to_speech-v1/google-cloud-text_to_speech-v1.gemspec index 7649ffd1e0f6..e0eea98306cf 100644 --- a/google-cloud-text_to_speech-v1/google-cloud-text_to_speech-v1.gemspec +++ b/google-cloud-text_to_speech-v1/google-cloud-text_to_speech-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-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/client.rb b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/client.rb index 1b3a7633674b..e3b282698d26 100644 --- a/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/client.rb +++ b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/client.rb @@ -30,6 +30,9 @@ module TextToSpeech # Service that implements Google Cloud Text-to-Speech API. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -95,6 +98,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @text_to_speech_stub.universe_domain + end + ## # Create a new TextToSpeech 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 @text_to_speech_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::TextToSpeech::V1::TextToSpeech::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 @@ -346,9 +361,9 @@ def synthesize_speech request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"texttospeech.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 @@ -394,13 +409,20 @@ def synthesize_speech 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 = "texttospeech.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 @@ -415,6 +437,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-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/rest/client.rb b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/rest/client.rb index 2d692f9ce9e6..7b2100d7d1a9 100644 --- a/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/rest/client.rb +++ b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/rest/client.rb @@ -32,6 +32,9 @@ module Rest # Service that implements Google Cloud Text-to-Speech API. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -97,6 +100,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @text_to_speech_stub.universe_domain + end + ## # Create a new TextToSpeech 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 - @text_to_speech_stub = ::Google::Cloud::TextToSpeech::V1::TextToSpeech::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @text_to_speech_stub = ::Google::Cloud::TextToSpeech::V1::TextToSpeech::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -338,9 +356,9 @@ def synthesize_speech request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"texttospeech.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 @@ -377,13 +395,20 @@ def synthesize_speech 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 = "texttospeech.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 } @@ -395,6 +420,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-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/rest/service_stub.rb b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/rest/service_stub.rb index 1d6d18318602..0a9794e343ed 100644 --- a/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/rest/service_stub.rb +++ b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech/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_voices REST call # diff --git a/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/client.rb b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/client.rb index 2c4dffb492f6..1fc0b51e89e6 100644 --- a/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/client.rb +++ b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/client.rb @@ -30,6 +30,9 @@ module TextToSpeechLongAudioSynthesize # Service that implements Google Cloud Text-to-Speech API. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -92,6 +95,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @text_to_speech_long_audio_synthesize_stub.universe_domain + end + ## # Create a new TextToSpeechLongAudioSynthesize 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) @@ -139,12 +152,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @text_to_speech_long_audio_synthesize_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::TextToSpeech::V1::TextToSpeechLongAudioSynthesize::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 @@ -295,9 +311,9 @@ def synthesize_long_audio request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"texttospeech.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 @@ -343,13 +359,20 @@ def synthesize_long_audio 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 = "texttospeech.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 @@ -364,6 +387,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-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/operations.rb b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/operations.rb index 1850d949ea64..575addcf6f28 100644 --- a/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/operations.rb +++ b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/operations.rb @@ -26,6 +26,9 @@ module V1 module TextToSpeechLongAudioSynthesize # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$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 `"texttospeech.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 = "texttospeech.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-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/client.rb b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/client.rb index a078d2cd2306..a406ef592106 100644 --- a/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/client.rb +++ b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/client.rb @@ -32,6 +32,9 @@ module Rest # Service that implements Google Cloud Text-to-Speech API. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -94,6 +97,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @text_to_speech_long_audio_synthesize_stub.universe_domain + end + ## # Create a new TextToSpeechLongAudioSynthesize 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) @@ -136,9 +149,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end - @text_to_speech_long_audio_synthesize_stub = ::Google::Cloud::TextToSpeech::V1::TextToSpeechLongAudioSynthesize::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @text_to_speech_long_audio_synthesize_stub = ::Google::Cloud::TextToSpeech::V1::TextToSpeechLongAudioSynthesize::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -278,9 +297,9 @@ def synthesize_long_audio request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"texttospeech.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 @@ -317,13 +336,20 @@ def synthesize_long_audio 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 = "texttospeech.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 } @@ -335,6 +361,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-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/operations.rb b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/operations.rb index 0c76ac3a5ef5..288a6473b3c0 100644 --- a/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/operations.rb +++ b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/operations.rb @@ -26,6 +26,9 @@ module TextToSpeechLongAudioSynthesize module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$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 `"texttospeech.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 = "texttospeech.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-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/service_stub.rb b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/service_stub.rb index 9c58e3832065..fcf77a7858c2 100644 --- a/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/rest/service_stub.rb +++ b/google-cloud-text_to_speech-v1/lib/google/cloud/text_to_speech/v1/text_to_speech_long_audio_synthesize/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 synthesize_long_audio REST call # diff --git a/google-cloud-text_to_speech-v1/proto_docs/google/api/client.rb b/google-cloud-text_to_speech-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-text_to_speech-v1/proto_docs/google/api/client.rb +++ b/google-cloud-text_to_speech-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-text_to_speech-v1/proto_docs/google/cloud/texttospeech/v1/cloud_tts.rb b/google-cloud-text_to_speech-v1/proto_docs/google/cloud/texttospeech/v1/cloud_tts.rb index 9037b9f91328..7e69f954f47c 100644 --- a/google-cloud-text_to_speech-v1/proto_docs/google/cloud/texttospeech/v1/cloud_tts.rb +++ b/google-cloud-text_to_speech-v1/proto_docs/google/cloud/texttospeech/v1/cloud_tts.rb @@ -187,6 +187,7 @@ class AudioConfig # @return [::String] # Required. The name of the AutoML model that synthesizes the custom voice. # @!attribute [rw] reported_usage + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::Google::Cloud::TextToSpeech::V1::CustomVoiceParams::ReportedUsage] # Optional. Deprecated. The usage of the synthesized audio to be reported. class CustomVoiceParams diff --git a/google-cloud-text_to_speech-v1/proto_docs/google/cloud/texttospeech/v1/cloud_tts_lrs.rb b/google-cloud-text_to_speech-v1/proto_docs/google/cloud/texttospeech/v1/cloud_tts_lrs.rb index 4d87ddc77c39..85353c3aa042 100644 --- a/google-cloud-text_to_speech-v1/proto_docs/google/cloud/texttospeech/v1/cloud_tts_lrs.rb +++ b/google-cloud-text_to_speech-v1/proto_docs/google/cloud/texttospeech/v1/cloud_tts_lrs.rb @@ -58,6 +58,7 @@ class SynthesizeLongAudioResponse # @return [::Google::Protobuf::Timestamp] # Time when the request was received. # @!attribute [rw] last_update_time + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::Google::Protobuf::Timestamp] # Deprecated. Do not use. # @!attribute [rw] progress_percentage diff --git a/google-cloud-text_to_speech-v1/snippets/snippet_metadata_google.cloud.texttospeech.v1.json b/google-cloud-text_to_speech-v1/snippets/snippet_metadata_google.cloud.texttospeech.v1.json index ce993c63e0e0..406ba8fddbbf 100644 --- a/google-cloud-text_to_speech-v1/snippets/snippet_metadata_google.cloud.texttospeech.v1.json +++ b/google-cloud-text_to_speech-v1/snippets/snippet_metadata_google.cloud.texttospeech.v1.json @@ -14,7 +14,7 @@ { "region_tag": "texttospeech_v1_generated_TextToSpeech_ListVoices_sync", "title": "Snippet for the list_voices call in the TextToSpeech service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1::TextToSpeech::Client#list_voices. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1::TextToSpeech::Client#list_voices.", "file": "text_to_speech/list_voices.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_sync", "title": "Snippet for the synthesize_speech call in the TextToSpeech service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1::TextToSpeech::Client#synthesize_speech. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1::TextToSpeech::Client#synthesize_speech.", "file": "text_to_speech/synthesize_speech.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "texttospeech_v1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_sync", "title": "Snippet for the synthesize_long_audio call in the TextToSpeechLongAudioSynthesize service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1::TextToSpeechLongAudioSynthesize::Client#synthesize_long_audio. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1::TextToSpeechLongAudioSynthesize::Client#synthesize_long_audio.", "file": "text_to_speech_long_audio_synthesize/synthesize_long_audio.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] diff --git a/google-cloud-text_to_speech-v1/snippets/text_to_speech/list_voices.rb b/google-cloud-text_to_speech-v1/snippets/text_to_speech/list_voices.rb index 0526828e63a2..25cbc2170195 100755 --- a/google-cloud-text_to_speech-v1/snippets/text_to_speech/list_voices.rb +++ b/google-cloud-text_to_speech-v1/snippets/text_to_speech/list_voices.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_voices call in the TextToSpeech 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::TextToSpeech::V1::TextToSpeech::Client#list_voices. It may -# require modification in order to execute successfully. +# Google::Cloud::TextToSpeech::V1::TextToSpeech::Client#list_voices. # def list_voices # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-text_to_speech-v1/snippets/text_to_speech/synthesize_speech.rb b/google-cloud-text_to_speech-v1/snippets/text_to_speech/synthesize_speech.rb index 66811843d07d..1b8600ef3367 100755 --- a/google-cloud-text_to_speech-v1/snippets/text_to_speech/synthesize_speech.rb +++ b/google-cloud-text_to_speech-v1/snippets/text_to_speech/synthesize_speech.rb @@ -22,9 +22,14 @@ ## # Snippet for the synthesize_speech call in the TextToSpeech 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::TextToSpeech::V1::TextToSpeech::Client#synthesize_speech. It -# may require modification in order to execute successfully. +# Google::Cloud::TextToSpeech::V1::TextToSpeech::Client#synthesize_speech. # def synthesize_speech # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-text_to_speech-v1/snippets/text_to_speech_long_audio_synthesize/synthesize_long_audio.rb b/google-cloud-text_to_speech-v1/snippets/text_to_speech_long_audio_synthesize/synthesize_long_audio.rb index c93f160f4f04..37dfc32e3077 100644 --- a/google-cloud-text_to_speech-v1/snippets/text_to_speech_long_audio_synthesize/synthesize_long_audio.rb +++ b/google-cloud-text_to_speech-v1/snippets/text_to_speech_long_audio_synthesize/synthesize_long_audio.rb @@ -22,9 +22,14 @@ ## # Snippet for the synthesize_long_audio call in the TextToSpeechLongAudioSynthesize 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::TextToSpeech::V1::TextToSpeechLongAudioSynthesize::Client#synthesize_long_audio. -# It may require modification in order to execute successfully. # def synthesize_long_audio # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-text_to_speech-v1beta1/.owlbot-manifest.json b/google-cloud-text_to_speech-v1beta1/.owlbot-manifest.json index 9ed552ee8761..e4d363e464bd 100644 --- a/google-cloud-text_to_speech-v1beta1/.owlbot-manifest.json +++ b/google-cloud-text_to_speech-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-text_to_speech-v1beta1/.toys.rb b/google-cloud-text_to_speech-v1beta1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-text_to_speech-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-text_to_speech-v1beta1/AUTHENTICATION.md b/google-cloud-text_to_speech-v1beta1/AUTHENTICATION.md index 001642a0d89a..b8cf76c40475 100644 --- a/google-cloud-text_to_speech-v1beta1/AUTHENTICATION.md +++ b/google-cloud-text_to_speech-v1beta1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-text_to_speech-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-text_to_speech-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 TEXTTOSPEECH_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/text_to_speech/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::TextToSpeech::V1beta1::TextToSpeech::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-text_to_speech-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-text_to_speech-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-text_to_speech-v1beta1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `TEXTTOSPEECH_CREDENTIALS` - Path to JSON file, or JSON contents -* `TEXTTOSPEECH_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/text_to_speech/v1beta1" - -ENV["TEXTTOSPEECH_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::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/text_to_speech/v1beta1" client = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::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/text_to_speech/v1beta1" ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::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-text_to_speech-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/text_to_speech/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-text_to_speech-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::TextToSpeech::V1beta1::TextToSpeech::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-text_to_speech-v1beta1/google-cloud-text_to_speech-v1beta1.gemspec b/google-cloud-text_to_speech-v1beta1/google-cloud-text_to_speech-v1beta1.gemspec index 9fd11c4ba3d8..fc8dc5fa7fe9 100644 --- a/google-cloud-text_to_speech-v1beta1/google-cloud-text_to_speech-v1beta1.gemspec +++ b/google-cloud-text_to_speech-v1beta1/google-cloud-text_to_speech-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-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/client.rb b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/client.rb index 590d03779380..957a8d0ae3a8 100644 --- a/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/client.rb +++ b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/client.rb @@ -30,6 +30,9 @@ module TextToSpeech # Service that implements Google Cloud Text-to-Speech API. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -95,6 +98,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @text_to_speech_stub.universe_domain + end + ## # Create a new TextToSpeech 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 @text_to_speech_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::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 @@ -348,9 +363,9 @@ def synthesize_speech request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"texttospeech.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 @@ -396,13 +411,20 @@ def synthesize_speech 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 = "texttospeech.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 @@ -417,6 +439,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-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/rest/client.rb b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/rest/client.rb index d7d403d8dfb7..753ba03957b3 100644 --- a/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/rest/client.rb +++ b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/rest/client.rb @@ -32,6 +32,9 @@ module Rest # Service that implements Google Cloud Text-to-Speech API. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -97,6 +100,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @text_to_speech_stub.universe_domain + end + ## # Create a new TextToSpeech 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 - @text_to_speech_stub = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @text_to_speech_stub = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -340,9 +358,9 @@ def synthesize_speech request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"texttospeech.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 @@ -379,13 +397,20 @@ def synthesize_speech 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 = "texttospeech.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 } @@ -397,6 +422,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-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/rest/service_stub.rb b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/rest/service_stub.rb index 6e791907830a..21da587d40e1 100644 --- a/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/rest/service_stub.rb +++ b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech/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_voices REST call # diff --git a/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/client.rb b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/client.rb index 933a250f0331..782cdf713f5d 100644 --- a/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/client.rb +++ b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/client.rb @@ -30,6 +30,9 @@ module TextToSpeechLongAudioSynthesize # Service that implements Google Cloud Text-to-Speech API. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -92,6 +95,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @text_to_speech_long_audio_synthesize_stub.universe_domain + end + ## # Create a new TextToSpeechLongAudioSynthesize 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) @@ -139,12 +152,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @text_to_speech_long_audio_synthesize_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::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 @@ -295,9 +311,9 @@ def synthesize_long_audio request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"texttospeech.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 @@ -343,13 +359,20 @@ def synthesize_long_audio 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 = "texttospeech.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 @@ -364,6 +387,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-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/operations.rb b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/operations.rb index 51816f03e530..b7606e84939d 100644 --- a/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/operations.rb +++ b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/operations.rb @@ -26,6 +26,9 @@ module V1beta1 module TextToSpeechLongAudioSynthesize # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$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 `"texttospeech.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 = "texttospeech.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-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/client.rb b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/client.rb index 9bf229fb4d8f..1cc5696f367c 100644 --- a/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/client.rb +++ b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/client.rb @@ -32,6 +32,9 @@ module Rest # Service that implements Google Cloud Text-to-Speech API. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -94,6 +97,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @text_to_speech_long_audio_synthesize_stub.universe_domain + end + ## # Create a new TextToSpeechLongAudioSynthesize 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) @@ -136,9 +149,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end - @text_to_speech_long_audio_synthesize_stub = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @text_to_speech_long_audio_synthesize_stub = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -278,9 +297,9 @@ def synthesize_long_audio request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"texttospeech.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 @@ -317,13 +336,20 @@ def synthesize_long_audio 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 = "texttospeech.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 } @@ -335,6 +361,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-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/operations.rb b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/operations.rb index 9a7f5b775b19..7ef090018393 100644 --- a/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/operations.rb +++ b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/operations.rb @@ -26,6 +26,9 @@ module TextToSpeechLongAudioSynthesize module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "texttospeech.$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 `"texttospeech.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 = "texttospeech.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-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/service_stub.rb b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/service_stub.rb index 7f2185b06d71..a492162ab61e 100644 --- a/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/rest/service_stub.rb +++ b/google-cloud-text_to_speech-v1beta1/lib/google/cloud/text_to_speech/v1beta1/text_to_speech_long_audio_synthesize/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 synthesize_long_audio REST call # diff --git a/google-cloud-text_to_speech-v1beta1/proto_docs/google/api/client.rb b/google-cloud-text_to_speech-v1beta1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-text_to_speech-v1beta1/proto_docs/google/api/client.rb +++ b/google-cloud-text_to_speech-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-text_to_speech-v1beta1/proto_docs/google/cloud/texttospeech/v1beta1/cloud_tts.rb b/google-cloud-text_to_speech-v1beta1/proto_docs/google/cloud/texttospeech/v1beta1/cloud_tts.rb index eb8d85d5916b..0e563264c128 100644 --- a/google-cloud-text_to_speech-v1beta1/proto_docs/google/cloud/texttospeech/v1beta1/cloud_tts.rb +++ b/google-cloud-text_to_speech-v1beta1/proto_docs/google/cloud/texttospeech/v1beta1/cloud_tts.rb @@ -199,6 +199,7 @@ class AudioConfig # @return [::String] # Required. The name of the AutoML model that synthesizes the custom voice. # @!attribute [rw] reported_usage + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::Google::Cloud::TextToSpeech::V1beta1::CustomVoiceParams::ReportedUsage] # Optional. Deprecated. The usage of the synthesized audio to be reported. class CustomVoiceParams diff --git a/google-cloud-text_to_speech-v1beta1/proto_docs/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.rb b/google-cloud-text_to_speech-v1beta1/proto_docs/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.rb index 9ba88e033cd7..158186d6b86f 100644 --- a/google-cloud-text_to_speech-v1beta1/proto_docs/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.rb +++ b/google-cloud-text_to_speech-v1beta1/proto_docs/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.rb @@ -58,6 +58,7 @@ class SynthesizeLongAudioResponse # @return [::Google::Protobuf::Timestamp] # Time when the request was received. # @!attribute [rw] last_update_time + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::Google::Protobuf::Timestamp] # Deprecated. Do not use. # @!attribute [rw] progress_percentage diff --git a/google-cloud-text_to_speech-v1beta1/snippets/snippet_metadata_google.cloud.texttospeech.v1beta1.json b/google-cloud-text_to_speech-v1beta1/snippets/snippet_metadata_google.cloud.texttospeech.v1beta1.json index d546b8b7dcf3..ecdd96f05db8 100644 --- a/google-cloud-text_to_speech-v1beta1/snippets/snippet_metadata_google.cloud.texttospeech.v1beta1.json +++ b/google-cloud-text_to_speech-v1beta1/snippets/snippet_metadata_google.cloud.texttospeech.v1beta1.json @@ -14,7 +14,7 @@ { "region_tag": "texttospeech_v1beta1_generated_TextToSpeech_ListVoices_sync", "title": "Snippet for the list_voices call in the TextToSpeech service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client#list_voices. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client#list_voices.", "file": "text_to_speech/list_voices.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "texttospeech_v1beta1_generated_TextToSpeech_SynthesizeSpeech_sync", "title": "Snippet for the synthesize_speech call in the TextToSpeech service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client#synthesize_speech. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client#synthesize_speech.", "file": "text_to_speech/synthesize_speech.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_sync", "title": "Snippet for the synthesize_long_audio call in the TextToSpeechLongAudioSynthesize service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::Client#synthesize_long_audio. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::Client#synthesize_long_audio.", "file": "text_to_speech_long_audio_synthesize/synthesize_long_audio.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] diff --git a/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech/list_voices.rb b/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech/list_voices.rb index fe53f17d9e57..beb6569fc540 100755 --- a/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech/list_voices.rb +++ b/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech/list_voices.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_voices call in the TextToSpeech 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::TextToSpeech::V1beta1::TextToSpeech::Client#list_voices. It may -# require modification in order to execute successfully. +# Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client#list_voices. # def list_voices # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech/synthesize_speech.rb b/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech/synthesize_speech.rb index 35e1d53c7b01..1d53311ff914 100755 --- a/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech/synthesize_speech.rb +++ b/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech/synthesize_speech.rb @@ -22,9 +22,14 @@ ## # Snippet for the synthesize_speech call in the TextToSpeech 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::TextToSpeech::V1beta1::TextToSpeech::Client#synthesize_speech. -# It may require modification in order to execute successfully. # def synthesize_speech # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech_long_audio_synthesize/synthesize_long_audio.rb b/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech_long_audio_synthesize/synthesize_long_audio.rb index 358aff4ee359..f980c59239b0 100644 --- a/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech_long_audio_synthesize/synthesize_long_audio.rb +++ b/google-cloud-text_to_speech-v1beta1/snippets/text_to_speech_long_audio_synthesize/synthesize_long_audio.rb @@ -22,9 +22,14 @@ ## # Snippet for the synthesize_long_audio call in the TextToSpeechLongAudioSynthesize 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::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::Client#synthesize_long_audio. -# It may require modification in order to execute successfully. # def synthesize_long_audio # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/.owlbot-manifest.json b/google-cloud-tpu-v1/.owlbot-manifest.json index 66790713cf45..bb3374a10707 100644 --- a/google-cloud-tpu-v1/.owlbot-manifest.json +++ b/google-cloud-tpu-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-tpu-v1/.toys.rb b/google-cloud-tpu-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-tpu-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-tpu-v1/AUTHENTICATION.md b/google-cloud-tpu-v1/AUTHENTICATION.md index 9afc29d187a5..dcd3772bc00e 100644 --- a/google-cloud-tpu-v1/AUTHENTICATION.md +++ b/google-cloud-tpu-v1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-tpu-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-tpu-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 CLOUD_TPU_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/tpu/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::Tpu::V1::Tpu::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-tpu-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-tpu-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-tpu-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Tpu::V1::Tpu::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `CLOUD_TPU_CREDENTIALS` - Path to JSON file, or JSON contents -* `CLOUD_TPU_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/tpu/v1" - -ENV["CLOUD_TPU_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Tpu::V1::Tpu::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/tpu/v1" client = ::Google::Cloud::Tpu::V1::Tpu::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/tpu/v1" ::Google::Cloud::Tpu::V1::Tpu::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Tpu::V1::Tpu::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-tpu-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/tpu/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-tpu-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::Tpu::V1::Tpu::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-tpu-v1/google-cloud-tpu-v1.gemspec b/google-cloud-tpu-v1/google-cloud-tpu-v1.gemspec index 937f1dd36fef..73831c0c6e39 100644 --- a/google-cloud-tpu-v1/google-cloud-tpu-v1.gemspec +++ b/google-cloud-tpu-v1/google-cloud-tpu-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-tpu-v1/lib/google/cloud/tpu/v1/tpu/client.rb b/google-cloud-tpu-v1/lib/google/cloud/tpu/v1/tpu/client.rb index 8e002593c960..8298c67e13b1 100644 --- a/google-cloud-tpu-v1/lib/google/cloud/tpu/v1/tpu/client.rb +++ b/google-cloud-tpu-v1/lib/google/cloud/tpu/v1/tpu/client.rb @@ -33,6 +33,9 @@ module Tpu # TPU API v1 # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "tpu.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -95,6 +98,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @tpu_stub.universe_domain + end + ## # Create a new Tpu 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) @@ -142,18 +155,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 @tpu_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Tpu::V1::Tpu::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 @@ -1222,9 +1239,9 @@ def get_accelerator_type request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"tpu.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 @@ -1270,13 +1287,20 @@ def get_accelerator_type 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 = "tpu.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 @@ -1291,6 +1315,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-tpu-v1/lib/google/cloud/tpu/v1/tpu/operations.rb b/google-cloud-tpu-v1/lib/google/cloud/tpu/v1/tpu/operations.rb index caa5873693d1..2558f1eea8ef 100644 --- a/google-cloud-tpu-v1/lib/google/cloud/tpu/v1/tpu/operations.rb +++ b/google-cloud-tpu-v1/lib/google/cloud/tpu/v1/tpu/operations.rb @@ -26,6 +26,9 @@ module V1 module Tpu # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "tpu.$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 `"tpu.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 = "tpu.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-tpu-v1/proto_docs/google/api/client.rb b/google-cloud-tpu-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-tpu-v1/proto_docs/google/api/client.rb +++ b/google-cloud-tpu-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-tpu-v1/proto_docs/google/cloud/tpu/v1/cloud_tpu.rb b/google-cloud-tpu-v1/proto_docs/google/cloud/tpu/v1/cloud_tpu.rb index 49bd830e5b65..827c35f40372 100644 --- a/google-cloud-tpu-v1/proto_docs/google/cloud/tpu/v1/cloud_tpu.rb +++ b/google-cloud-tpu-v1/proto_docs/google/cloud/tpu/v1/cloud_tpu.rb @@ -56,11 +56,13 @@ class NetworkEndpoint # @return [::String] # Required. The type of hardware accelerators associated with this node. # @!attribute [rw] ip_address + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::String] # Output only. DEPRECATED! Use network_endpoints instead. # The network address for the TPU Node as visible to Compute Engine # instances. # @!attribute [rw] port + # @deprecated This field is deprecated and may be removed in the next major version update. # @return [::String] # Output only. DEPRECATED! Use network_endpoints instead. # The network port for the TPU Node as visible to Compute Engine instances. diff --git a/google-cloud-tpu-v1/snippets/snippet_metadata_google.cloud.tpu.v1.json b/google-cloud-tpu-v1/snippets/snippet_metadata_google.cloud.tpu.v1.json index bc235f34bf07..62be9f4a7dc2 100644 --- a/google-cloud-tpu-v1/snippets/snippet_metadata_google.cloud.tpu.v1.json +++ b/google-cloud-tpu-v1/snippets/snippet_metadata_google.cloud.tpu.v1.json @@ -14,7 +14,7 @@ { "region_tag": "tpu_v1_generated_Tpu_ListNodes_sync", "title": "Snippet for the list_nodes call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#list_nodes. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#list_nodes.", "file": "tpu/list_nodes.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "tpu_v1_generated_Tpu_GetNode_sync", "title": "Snippet for the get_node call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#get_node. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#get_node.", "file": "tpu/get_node.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "tpu_v1_generated_Tpu_CreateNode_sync", "title": "Snippet for the create_node call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#create_node. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#create_node.", "file": "tpu/create_node.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "tpu_v1_generated_Tpu_DeleteNode_sync", "title": "Snippet for the delete_node call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#delete_node. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#delete_node.", "file": "tpu/delete_node.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "tpu_v1_generated_Tpu_ReimageNode_sync", "title": "Snippet for the reimage_node call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#reimage_node. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#reimage_node.", "file": "tpu/reimage_node.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "tpu_v1_generated_Tpu_StopNode_sync", "title": "Snippet for the stop_node call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#stop_node. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#stop_node.", "file": "tpu/stop_node.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "tpu_v1_generated_Tpu_StartNode_sync", "title": "Snippet for the start_node call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#start_node. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#start_node.", "file": "tpu/start_node.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "tpu_v1_generated_Tpu_ListTensorFlowVersions_sync", "title": "Snippet for the list_tensor_flow_versions call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#list_tensor_flow_versions. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#list_tensor_flow_versions.", "file": "tpu/list_tensor_flow_versions.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "tpu_v1_generated_Tpu_GetTensorFlowVersion_sync", "title": "Snippet for the get_tensor_flow_version call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#get_tensor_flow_version. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#get_tensor_flow_version.", "file": "tpu/get_tensor_flow_version.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "tpu_v1_generated_Tpu_ListAcceleratorTypes_sync", "title": "Snippet for the list_accelerator_types call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#list_accelerator_types. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#list_accelerator_types.", "file": "tpu/list_accelerator_types.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "tpu_v1_generated_Tpu_GetAcceleratorType_sync", "title": "Snippet for the get_accelerator_type call in the Tpu service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#get_accelerator_type. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Tpu::V1::Tpu::Client#get_accelerator_type.", "file": "tpu/get_accelerator_type.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-tpu-v1/snippets/tpu/create_node.rb b/google-cloud-tpu-v1/snippets/tpu/create_node.rb index c5a6a8ccbc95..c5cea1385b04 100755 --- a/google-cloud-tpu-v1/snippets/tpu/create_node.rb +++ b/google-cloud-tpu-v1/snippets/tpu/create_node.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_node call in the Tpu 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::Tpu::V1::Tpu::Client#create_node. It may require modification -# in order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#create_node. # def create_node # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/snippets/tpu/delete_node.rb b/google-cloud-tpu-v1/snippets/tpu/delete_node.rb index 0f6c17d6e8be..dc90d4ccfdff 100755 --- a/google-cloud-tpu-v1/snippets/tpu/delete_node.rb +++ b/google-cloud-tpu-v1/snippets/tpu/delete_node.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_node call in the Tpu 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::Tpu::V1::Tpu::Client#delete_node. It may require modification -# in order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#delete_node. # def delete_node # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/snippets/tpu/get_accelerator_type.rb b/google-cloud-tpu-v1/snippets/tpu/get_accelerator_type.rb index bdddcf9c6242..569434b9f54f 100755 --- a/google-cloud-tpu-v1/snippets/tpu/get_accelerator_type.rb +++ b/google-cloud-tpu-v1/snippets/tpu/get_accelerator_type.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_accelerator_type call in the Tpu 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::Tpu::V1::Tpu::Client#get_accelerator_type. It may require -# modification in order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#get_accelerator_type. # def get_accelerator_type # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/snippets/tpu/get_node.rb b/google-cloud-tpu-v1/snippets/tpu/get_node.rb index 5c9507a9ee6e..6c3a3de67a73 100755 --- a/google-cloud-tpu-v1/snippets/tpu/get_node.rb +++ b/google-cloud-tpu-v1/snippets/tpu/get_node.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_node call in the Tpu 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::Tpu::V1::Tpu::Client#get_node. It may require modification in -# order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#get_node. # def get_node # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/snippets/tpu/get_tensor_flow_version.rb b/google-cloud-tpu-v1/snippets/tpu/get_tensor_flow_version.rb index 579de50272bc..e2846a9353a9 100755 --- a/google-cloud-tpu-v1/snippets/tpu/get_tensor_flow_version.rb +++ b/google-cloud-tpu-v1/snippets/tpu/get_tensor_flow_version.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_tensor_flow_version call in the Tpu 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::Tpu::V1::Tpu::Client#get_tensor_flow_version. It may require -# modification in order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#get_tensor_flow_version. # def get_tensor_flow_version # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/snippets/tpu/list_accelerator_types.rb b/google-cloud-tpu-v1/snippets/tpu/list_accelerator_types.rb index 005fd6bb1cca..5ae93dce3a85 100755 --- a/google-cloud-tpu-v1/snippets/tpu/list_accelerator_types.rb +++ b/google-cloud-tpu-v1/snippets/tpu/list_accelerator_types.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_accelerator_types call in the Tpu 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::Tpu::V1::Tpu::Client#list_accelerator_types. It may require -# modification in order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#list_accelerator_types. # def list_accelerator_types # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/snippets/tpu/list_nodes.rb b/google-cloud-tpu-v1/snippets/tpu/list_nodes.rb index 39629169451d..77080aac8b3d 100755 --- a/google-cloud-tpu-v1/snippets/tpu/list_nodes.rb +++ b/google-cloud-tpu-v1/snippets/tpu/list_nodes.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_nodes call in the Tpu 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::Tpu::V1::Tpu::Client#list_nodes. It may require modification in -# order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#list_nodes. # def list_nodes # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/snippets/tpu/list_tensor_flow_versions.rb b/google-cloud-tpu-v1/snippets/tpu/list_tensor_flow_versions.rb index d82cc114eca3..450c31093d5e 100755 --- a/google-cloud-tpu-v1/snippets/tpu/list_tensor_flow_versions.rb +++ b/google-cloud-tpu-v1/snippets/tpu/list_tensor_flow_versions.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_tensor_flow_versions call in the Tpu 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::Tpu::V1::Tpu::Client#list_tensor_flow_versions. It may require -# modification in order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#list_tensor_flow_versions. # def list_tensor_flow_versions # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/snippets/tpu/reimage_node.rb b/google-cloud-tpu-v1/snippets/tpu/reimage_node.rb index b35e34d80b11..51751bb3673c 100755 --- a/google-cloud-tpu-v1/snippets/tpu/reimage_node.rb +++ b/google-cloud-tpu-v1/snippets/tpu/reimage_node.rb @@ -22,9 +22,14 @@ ## # Snippet for the reimage_node call in the Tpu 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::Tpu::V1::Tpu::Client#reimage_node. It may require modification -# in order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#reimage_node. # def reimage_node # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/snippets/tpu/start_node.rb b/google-cloud-tpu-v1/snippets/tpu/start_node.rb index c323330039e5..4123d3ec4d63 100755 --- a/google-cloud-tpu-v1/snippets/tpu/start_node.rb +++ b/google-cloud-tpu-v1/snippets/tpu/start_node.rb @@ -22,9 +22,14 @@ ## # Snippet for the start_node call in the Tpu 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::Tpu::V1::Tpu::Client#start_node. It may require modification in -# order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#start_node. # def start_node # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-tpu-v1/snippets/tpu/stop_node.rb b/google-cloud-tpu-v1/snippets/tpu/stop_node.rb index 4fcfa059614f..f737e5cf763d 100755 --- a/google-cloud-tpu-v1/snippets/tpu/stop_node.rb +++ b/google-cloud-tpu-v1/snippets/tpu/stop_node.rb @@ -22,9 +22,14 @@ ## # Snippet for the stop_node call in the Tpu 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::Tpu::V1::Tpu::Client#stop_node. It may require modification in -# order to execute successfully. +# Google::Cloud::Tpu::V1::Tpu::Client#stop_node. # def stop_node # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-trace-v1/.owlbot-manifest.json b/google-cloud-trace-v1/.owlbot-manifest.json index 0ff772fd225a..f57a75fe03b6 100644 --- a/google-cloud-trace-v1/.owlbot-manifest.json +++ b/google-cloud-trace-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-trace-v1/.toys.rb b/google-cloud-trace-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-trace-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-trace-v1/AUTHENTICATION.md b/google-cloud-trace-v1/AUTHENTICATION.md index 130732376534..ce2edb9aa12f 100644 --- a/google-cloud-trace-v1/AUTHENTICATION.md +++ b/google-cloud-trace-v1/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-trace-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-trace-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 TRACE_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/trace/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::Trace::V1::TraceService::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-trace-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-trace-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-trace-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Trace::V1::TraceService::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `TRACE_CREDENTIALS` - Path to JSON file, or JSON contents -* `TRACE_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/trace/v1" - -ENV["TRACE_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Trace::V1::TraceService::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/trace/v1" client = ::Google::Cloud::Trace::V1::TraceService::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/trace/v1" ::Google::Cloud::Trace::V1::TraceService::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Trace::V1::TraceService::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-trace-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/trace/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-trace-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::Trace::V1::TraceService::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-trace-v1/google-cloud-trace-v1.gemspec b/google-cloud-trace-v1/google-cloud-trace-v1.gemspec index c0aad2a07355..1f336f31aafc 100644 --- a/google-cloud-trace-v1/google-cloud-trace-v1.gemspec +++ b/google-cloud-trace-v1/google-cloud-trace-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-trace-v1/lib/google/cloud/trace/v1/trace_service/client.rb b/google-cloud-trace-v1/lib/google/cloud/trace/v1/trace_service/client.rb index 8697f7a5557a..d5f163bd9975 100644 --- a/google-cloud-trace-v1/lib/google/cloud/trace/v1/trace_service/client.rb +++ b/google-cloud-trace-v1/lib/google/cloud/trace/v1/trace_service/client.rb @@ -34,6 +34,9 @@ module TraceService # may span multiple services. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudtrace.$UNIVERSE_DOMAIN$" + # @private attr_reader :trace_service_stub @@ -107,6 +110,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @trace_service_stub.universe_domain + end + ## # Create a new TraceService client object. # @@ -140,8 +152,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) @@ -152,8 +165,10 @@ def initialize @trace_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Trace::V1::TraceService::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 @@ -524,9 +539,9 @@ def patch_traces request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudtrace.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 @@ -572,13 +587,20 @@ def patch_traces 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 = "cloudtrace.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 @@ -593,6 +615,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-trace-v1/lib/google/cloud/trace/v1/trace_service/rest/client.rb b/google-cloud-trace-v1/lib/google/cloud/trace/v1/trace_service/rest/client.rb index 1d9b1e6db0fd..db20303015bc 100644 --- a/google-cloud-trace-v1/lib/google/cloud/trace/v1/trace_service/rest/client.rb +++ b/google-cloud-trace-v1/lib/google/cloud/trace/v1/trace_service/rest/client.rb @@ -36,6 +36,9 @@ module Rest # may span multiple services. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudtrace.$UNIVERSE_DOMAIN$" + # @private attr_reader :trace_service_stub @@ -109,6 +112,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @trace_service_stub.universe_domain + end + ## # Create a new TraceService REST client object. # @@ -136,8 +148,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) @@ -147,7 +160,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @trace_service_stub = ::Google::Cloud::Trace::V1::TraceService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @trace_service_stub = ::Google::Cloud::Trace::V1::TraceService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -490,9 +508,9 @@ def patch_traces request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudtrace.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 @@ -529,13 +547,20 @@ def patch_traces 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 = "cloudtrace.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 } @@ -547,6 +572,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-trace-v1/lib/google/cloud/trace/v1/trace_service/rest/service_stub.rb b/google-cloud-trace-v1/lib/google/cloud/trace/v1/trace_service/rest/service_stub.rb index 8408bf6992ae..bb220bbd25ec 100644 --- a/google-cloud-trace-v1/lib/google/cloud/trace/v1/trace_service/rest/service_stub.rb +++ b/google-cloud-trace-v1/lib/google/cloud/trace/v1/trace_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_traces REST call # diff --git a/google-cloud-trace-v1/proto_docs/google/api/client.rb b/google-cloud-trace-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-trace-v1/proto_docs/google/api/client.rb +++ b/google-cloud-trace-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-trace-v1/snippets/snippet_metadata_google.devtools.cloudtrace.v1.json b/google-cloud-trace-v1/snippets/snippet_metadata_google.devtools.cloudtrace.v1.json index e640c912840a..fd29717eab91 100644 --- a/google-cloud-trace-v1/snippets/snippet_metadata_google.devtools.cloudtrace.v1.json +++ b/google-cloud-trace-v1/snippets/snippet_metadata_google.devtools.cloudtrace.v1.json @@ -14,7 +14,7 @@ { "region_tag": "cloudtrace_v1_generated_TraceService_ListTraces_sync", "title": "Snippet for the list_traces call in the TraceService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Trace::V1::TraceService::Client#list_traces. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Trace::V1::TraceService::Client#list_traces.", "file": "trace_service/list_traces.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "cloudtrace_v1_generated_TraceService_GetTrace_sync", "title": "Snippet for the get_trace call in the TraceService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Trace::V1::TraceService::Client#get_trace. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Trace::V1::TraceService::Client#get_trace.", "file": "trace_service/get_trace.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "cloudtrace_v1_generated_TraceService_PatchTraces_sync", "title": "Snippet for the patch_traces call in the TraceService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Trace::V1::TraceService::Client#patch_traces. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Trace::V1::TraceService::Client#patch_traces.", "file": "trace_service/patch_traces.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-trace-v1/snippets/trace_service/get_trace.rb b/google-cloud-trace-v1/snippets/trace_service/get_trace.rb index 709ec8257acb..486b393aa553 100755 --- a/google-cloud-trace-v1/snippets/trace_service/get_trace.rb +++ b/google-cloud-trace-v1/snippets/trace_service/get_trace.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_trace call in the TraceService 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::Trace::V1::TraceService::Client#get_trace. It may require -# modification in order to execute successfully. +# Google::Cloud::Trace::V1::TraceService::Client#get_trace. # def get_trace # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-trace-v1/snippets/trace_service/list_traces.rb b/google-cloud-trace-v1/snippets/trace_service/list_traces.rb index 2b4c32ad330d..0d2f5d701cff 100755 --- a/google-cloud-trace-v1/snippets/trace_service/list_traces.rb +++ b/google-cloud-trace-v1/snippets/trace_service/list_traces.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_traces call in the TraceService 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::Trace::V1::TraceService::Client#list_traces. It may require -# modification in order to execute successfully. +# Google::Cloud::Trace::V1::TraceService::Client#list_traces. # def list_traces # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-trace-v1/snippets/trace_service/patch_traces.rb b/google-cloud-trace-v1/snippets/trace_service/patch_traces.rb index c00862a0cd40..79fd9e53275d 100755 --- a/google-cloud-trace-v1/snippets/trace_service/patch_traces.rb +++ b/google-cloud-trace-v1/snippets/trace_service/patch_traces.rb @@ -22,9 +22,14 @@ ## # Snippet for the patch_traces call in the TraceService 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::Trace::V1::TraceService::Client#patch_traces. It may require -# modification in order to execute successfully. +# Google::Cloud::Trace::V1::TraceService::Client#patch_traces. # def patch_traces # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-trace-v2/.owlbot-manifest.json b/google-cloud-trace-v2/.owlbot-manifest.json index 44cffa1f84f5..3c06f86ee870 100644 --- a/google-cloud-trace-v2/.owlbot-manifest.json +++ b/google-cloud-trace-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-trace-v2/.toys.rb b/google-cloud-trace-v2/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-trace-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-trace-v2/AUTHENTICATION.md b/google-cloud-trace-v2/AUTHENTICATION.md index 82055fe3981f..cd2b7cadfb3d 100644 --- a/google-cloud-trace-v2/AUTHENTICATION.md +++ b/google-cloud-trace-v2/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-trace-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-trace-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 TRACE_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/trace/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::Trace::V2::TraceService::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-trace-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-trace-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-trace-v2 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Trace::V2::TraceService::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `TRACE_CREDENTIALS` - Path to JSON file, or JSON contents -* `TRACE_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/trace/v2" - -ENV["TRACE_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Trace::V2::TraceService::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/trace/v2" client = ::Google::Cloud::Trace::V2::TraceService::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/trace/v2" ::Google::Cloud::Trace::V2::TraceService::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Trace::V2::TraceService::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-trace-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/trace/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-trace-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::Trace::V2::TraceService::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-trace-v2/google-cloud-trace-v2.gemspec b/google-cloud-trace-v2/google-cloud-trace-v2.gemspec index cefadc6e3dea..17a85424605a 100644 --- a/google-cloud-trace-v2/google-cloud-trace-v2.gemspec +++ b/google-cloud-trace-v2/google-cloud-trace-v2.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-trace-v2/lib/google/cloud/trace/v2/trace_service/client.rb b/google-cloud-trace-v2/lib/google/cloud/trace/v2/trace_service/client.rb index bf6bbdc4d385..76da3df03b2b 100644 --- a/google-cloud-trace-v2/lib/google/cloud/trace/v2/trace_service/client.rb +++ b/google-cloud-trace-v2/lib/google/cloud/trace/v2/trace_service/client.rb @@ -36,6 +36,9 @@ module TraceService # A single trace can contain spans from multiple services. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudtrace.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -106,6 +109,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @trace_service_stub.universe_domain + end + ## # Create a new TraceService 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) @@ -151,8 +164,10 @@ def initialize @trace_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Trace::V2::TraceService::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 @@ -422,9 +437,9 @@ def create_span request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudtrace.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 @@ -470,13 +485,20 @@ def create_span 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 = "cloudtrace.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 @@ -491,6 +513,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-trace-v2/lib/google/cloud/trace/v2/trace_service/rest/client.rb b/google-cloud-trace-v2/lib/google/cloud/trace/v2/trace_service/rest/client.rb index db5e8849a27e..6bc25e901946 100644 --- a/google-cloud-trace-v2/lib/google/cloud/trace/v2/trace_service/rest/client.rb +++ b/google-cloud-trace-v2/lib/google/cloud/trace/v2/trace_service/rest/client.rb @@ -38,6 +38,9 @@ module Rest # A single trace can contain spans from multiple services. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "cloudtrace.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -108,6 +111,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @trace_service_stub.universe_domain + end + ## # Create a new TraceService REST client object. # @@ -135,8 +147,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) @@ -146,7 +159,12 @@ def initialize @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - @trace_service_stub = ::Google::Cloud::Trace::V2::TraceService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @trace_service_stub = ::Google::Cloud::Trace::V2::TraceService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end # Service calls @@ -398,9 +416,9 @@ def create_span request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"cloudtrace.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 +455,20 @@ def create_span 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 = "cloudtrace.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 } @@ -455,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-trace-v2/lib/google/cloud/trace/v2/trace_service/rest/service_stub.rb b/google-cloud-trace-v2/lib/google/cloud/trace/v2/trace_service/rest/service_stub.rb index e20896e1f33f..694e5ca99416 100644 --- a/google-cloud-trace-v2/lib/google/cloud/trace/v2/trace_service/rest/service_stub.rb +++ b/google-cloud-trace-v2/lib/google/cloud/trace/v2/trace_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 batch_write_spans REST call # diff --git a/google-cloud-trace-v2/proto_docs/google/api/client.rb b/google-cloud-trace-v2/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-trace-v2/proto_docs/google/api/client.rb +++ b/google-cloud-trace-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-trace-v2/snippets/snippet_metadata_google.devtools.cloudtrace.v2.json b/google-cloud-trace-v2/snippets/snippet_metadata_google.devtools.cloudtrace.v2.json index 69218ad4667d..0a42ed8c485d 100644 --- a/google-cloud-trace-v2/snippets/snippet_metadata_google.devtools.cloudtrace.v2.json +++ b/google-cloud-trace-v2/snippets/snippet_metadata_google.devtools.cloudtrace.v2.json @@ -14,7 +14,7 @@ { "region_tag": "cloudtrace_v2_generated_TraceService_BatchWriteSpans_sync", "title": "Snippet for the batch_write_spans call in the TraceService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Trace::V2::TraceService::Client#batch_write_spans. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Trace::V2::TraceService::Client#batch_write_spans.", "file": "trace_service/batch_write_spans.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "cloudtrace_v2_generated_TraceService_CreateSpan_sync", "title": "Snippet for the create_span call in the TraceService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Trace::V2::TraceService::Client#create_span. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Trace::V2::TraceService::Client#create_span.", "file": "trace_service/create_span.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] diff --git a/google-cloud-trace-v2/snippets/trace_service/batch_write_spans.rb b/google-cloud-trace-v2/snippets/trace_service/batch_write_spans.rb index c3e69e0a318f..99158e4bec50 100755 --- a/google-cloud-trace-v2/snippets/trace_service/batch_write_spans.rb +++ b/google-cloud-trace-v2/snippets/trace_service/batch_write_spans.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_write_spans call in the TraceService 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::Trace::V2::TraceService::Client#batch_write_spans. It may -# require modification in order to execute successfully. +# Google::Cloud::Trace::V2::TraceService::Client#batch_write_spans. # def batch_write_spans # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-trace-v2/snippets/trace_service/create_span.rb b/google-cloud-trace-v2/snippets/trace_service/create_span.rb index 1fa25e399969..d2c038565d90 100755 --- a/google-cloud-trace-v2/snippets/trace_service/create_span.rb +++ b/google-cloud-trace-v2/snippets/trace_service/create_span.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_span call in the TraceService 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::Trace::V2::TraceService::Client#create_span. It may require -# modification in order to execute successfully. +# Google::Cloud::Trace::V2::TraceService::Client#create_span. # def create_span # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/.owlbot-manifest.json b/google-cloud-translate-v3/.owlbot-manifest.json index 42398758b96e..6337e9ca7136 100644 --- a/google-cloud-translate-v3/.owlbot-manifest.json +++ b/google-cloud-translate-v3/.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-translate-v3/.toys.rb b/google-cloud-translate-v3/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-translate-v3/.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-translate-v3/AUTHENTICATION.md b/google-cloud-translate-v3/AUTHENTICATION.md index 4ed5a7ebd7c7..f67deb161865 100644 --- a/google-cloud-translate-v3/AUTHENTICATION.md +++ b/google-cloud-translate-v3/AUTHENTICATION.md @@ -1,151 +1,122 @@ # Authentication -In general, the google-cloud-translate-v3 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-translate-v3 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 TRANSLATE_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/translate/v3" +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::Translate::V3::TranslationService::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-translate-v3 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-translate-v3 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-translate-v3 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Translate::V3::TranslationService::Credentials}): +Credentials are accepted in the following ways, in the following order or precedence: -* `TRANSLATE_CREDENTIALS` - Path to JSON file, or JSON contents -* `TRANSLATE_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/translate/v3" - -ENV["TRANSLATE_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Translate::V3::TranslationService::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/translate/v3" client = ::Google::Cloud::Translate::V3::TranslationService::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/translate/v3" ::Google::Cloud::Translate::V3::TranslationService::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Translate::V3::TranslationService::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-translate-v3 +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/translate/v3" -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-translate-v3. +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::Translate::V3::TranslationService::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-translate-v3/google-cloud-translate-v3.gemspec b/google-cloud-translate-v3/google-cloud-translate-v3.gemspec index d28c50221117..24133f499d21 100644 --- a/google-cloud-translate-v3/google-cloud-translate-v3.gemspec +++ b/google-cloud-translate-v3/google-cloud-translate-v3.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-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb index 51ad18e6c7e1..a0e49514b10a 100644 --- a/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb +++ b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb @@ -30,6 +30,9 @@ module TranslationService # Provides natural language translation operations. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -122,6 +125,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @translation_service_stub.universe_domain + end + ## # Create a new TranslationService client object. # @@ -155,8 +167,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) @@ -169,12 +182,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end @translation_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Translate::V3::TranslationService::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 @@ -2385,9 +2401,9 @@ def list_adaptive_mt_sentences request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"translate.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 @@ -2433,13 +2449,20 @@ def list_adaptive_mt_sentences 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 = "translate.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 @@ -2454,6 +2477,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-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb index ebb0f00dcfd3..760c6afa9b83 100644 --- a/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb +++ b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb @@ -26,6 +26,9 @@ module V3 module TranslationService # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "translate.$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 @@ -621,9 +635,9 @@ def wait_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"translate.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 @@ -669,13 +683,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 = "translate.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 @@ -690,6 +711,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-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb index abaae9805e00..66bfb5097da2 100644 --- a/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb +++ b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb @@ -32,6 +32,9 @@ module Rest # Provides natural language translation operations. # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -124,6 +127,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @translation_service_stub.universe_domain + end + ## # Create a new TranslationService REST client object. # @@ -151,8 +163,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) @@ -166,9 +179,15 @@ def initialize config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain end - @translation_service_stub = ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @translation_service_stub = ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -2235,9 +2254,9 @@ def list_adaptive_mt_sentences request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"translate.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 @@ -2274,13 +2293,20 @@ def list_adaptive_mt_sentences 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 = "translate.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 } @@ -2292,6 +2318,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-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb index 9bb0915e9256..f620aea2458f 100644 --- a/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb +++ b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb @@ -26,6 +26,9 @@ module TranslationService module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "translate.$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 @@ -576,9 +590,9 @@ def wait_operation request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"translate.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 @@ -615,13 +629,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 = "translate.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 } @@ -633,6 +654,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 @@ -722,12 +744,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-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb index 3a834a5cd7e4..7e1616631aa2 100644 --- a/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb +++ b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_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 translate_text REST call # diff --git a/google-cloud-translate-v3/proto_docs/google/api/client.rb b/google-cloud-translate-v3/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-translate-v3/proto_docs/google/api/client.rb +++ b/google-cloud-translate-v3/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-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json b/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json index d09d44523c16..04064440096a 100644 --- a/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json +++ b/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json @@ -14,7 +14,7 @@ { "region_tag": "translate_v3_generated_TranslationService_TranslateText_sync", "title": "Snippet for the translate_text call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#translate_text. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#translate_text.", "file": "translation_service/translate_text.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "translate_v3_generated_TranslationService_DetectLanguage_sync", "title": "Snippet for the detect_language call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#detect_language. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#detect_language.", "file": "translation_service/detect_language.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "translate_v3_generated_TranslationService_GetSupportedLanguages_sync", "title": "Snippet for the get_supported_languages call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_supported_languages. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_supported_languages.", "file": "translation_service/get_supported_languages.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "translate_v3_generated_TranslationService_TranslateDocument_sync", "title": "Snippet for the translate_document call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#translate_document. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#translate_document.", "file": "translation_service/translate_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": "translate_v3_generated_TranslationService_BatchTranslateText_sync", "title": "Snippet for the batch_translate_text call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_text. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_text.", "file": "translation_service/batch_translate_text.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "translate_v3_generated_TranslationService_BatchTranslateDocument_sync", "title": "Snippet for the batch_translate_document call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_document. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_document.", "file": "translation_service/batch_translate_document.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "translate_v3_generated_TranslationService_CreateGlossary_sync", "title": "Snippet for the create_glossary call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_glossary. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_glossary.", "file": "translation_service/create_glossary.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "translate_v3_generated_TranslationService_ListGlossaries_sync", "title": "Snippet for the list_glossaries call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_glossaries. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_glossaries.", "file": "translation_service/list_glossaries.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "translate_v3_generated_TranslationService_GetGlossary_sync", "title": "Snippet for the get_glossary call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_glossary. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_glossary.", "file": "translation_service/get_glossary.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "translate_v3_generated_TranslationService_DeleteGlossary_sync", "title": "Snippet for the delete_glossary call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary.", "file": "translation_service/delete_glossary.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "translate_v3_generated_TranslationService_CreateAdaptiveMtDataset_sync", "title": "Snippet for the create_adaptive_mt_dataset call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_adaptive_mt_dataset. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_adaptive_mt_dataset.", "file": "translation_service/create_adaptive_mt_dataset.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "translate_v3_generated_TranslationService_DeleteAdaptiveMtDataset_sync", "title": "Snippet for the delete_adaptive_mt_dataset call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_dataset. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_dataset.", "file": "translation_service/delete_adaptive_mt_dataset.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "translate_v3_generated_TranslationService_GetAdaptiveMtDataset_sync", "title": "Snippet for the get_adaptive_mt_dataset call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_dataset. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_dataset.", "file": "translation_service/get_adaptive_mt_dataset.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "translate_v3_generated_TranslationService_ListAdaptiveMtDatasets_sync", "title": "Snippet for the list_adaptive_mt_datasets call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_datasets. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_datasets.", "file": "translation_service/list_adaptive_mt_datasets.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "translate_v3_generated_TranslationService_AdaptiveMtTranslate_sync", "title": "Snippet for the adaptive_mt_translate call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#adaptive_mt_translate. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#adaptive_mt_translate.", "file": "translation_service/adaptive_mt_translate.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "translate_v3_generated_TranslationService_GetAdaptiveMtFile_sync", "title": "Snippet for the get_adaptive_mt_file call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_file. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_file.", "file": "translation_service/get_adaptive_mt_file.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "translate_v3_generated_TranslationService_DeleteAdaptiveMtFile_sync", "title": "Snippet for the delete_adaptive_mt_file call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_file. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_file.", "file": "translation_service/delete_adaptive_mt_file.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -694,7 +694,7 @@ { "region_tag": "translate_v3_generated_TranslationService_ImportAdaptiveMtFile_sync", "title": "Snippet for the import_adaptive_mt_file call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#import_adaptive_mt_file. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#import_adaptive_mt_file.", "file": "translation_service/import_adaptive_mt_file.rb", "language": "RUBY", "client_method": { @@ -726,7 +726,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -734,7 +734,7 @@ { "region_tag": "translate_v3_generated_TranslationService_ListAdaptiveMtFiles_sync", "title": "Snippet for the list_adaptive_mt_files call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_files. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_files.", "file": "translation_service/list_adaptive_mt_files.rb", "language": "RUBY", "client_method": { @@ -766,7 +766,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -774,7 +774,7 @@ { "region_tag": "translate_v3_generated_TranslationService_ListAdaptiveMtSentences_sync", "title": "Snippet for the list_adaptive_mt_sentences call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_sentences. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_sentences.", "file": "translation_service/list_adaptive_mt_sentences.rb", "language": "RUBY", "client_method": { @@ -806,7 +806,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] diff --git a/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb b/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb index 7508afeb484f..1cd1b30dce10 100644 --- a/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb +++ b/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb @@ -22,9 +22,14 @@ ## # Snippet for the adaptive_mt_translate call in the TranslationService 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::Translate::V3::TranslationService::Client#adaptive_mt_translate. -# It may require modification in order to execute successfully. # def adaptive_mt_translate # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb b/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb index c1b059c7f171..0f0f0719f5ec 100755 --- a/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb +++ b/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_translate_document call in the TranslationService 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::Translate::V3::TranslationService::Client#batch_translate_document. -# It may require modification in order to execute successfully. # def batch_translate_document # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb b/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb index 347256df4652..537b1cbdd63f 100755 --- a/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb +++ b/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb @@ -22,9 +22,14 @@ ## # Snippet for the batch_translate_text call in the TranslationService 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::Translate::V3::TranslationService::Client#batch_translate_text. -# It may require modification in order to execute successfully. # def batch_translate_text # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb b/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb index 1c4837673403..aa2dfe4d06d4 100644 --- a/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb +++ b/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_adaptive_mt_dataset call in the TranslationService 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::Translate::V3::TranslationService::Client#create_adaptive_mt_dataset. -# It may require modification in order to execute successfully. # def create_adaptive_mt_dataset # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb b/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb index 29872e05598f..f93a1dc168a2 100755 --- a/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb +++ b/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_glossary call in the TranslationService 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::Translate::V3::TranslationService::Client#create_glossary. It -# may require modification in order to execute successfully. +# Google::Cloud::Translate::V3::TranslationService::Client#create_glossary. # def create_glossary # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb b/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb index 1b83491a16c6..24a93be0c44e 100644 --- a/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb +++ b/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_adaptive_mt_dataset call in the TranslationService 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::Translate::V3::TranslationService::Client#delete_adaptive_mt_dataset. -# It may require modification in order to execute successfully. # def delete_adaptive_mt_dataset # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb b/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb index e70919b109d4..13408a956bae 100644 --- a/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb +++ b/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_adaptive_mt_file call in the TranslationService 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::Translate::V3::TranslationService::Client#delete_adaptive_mt_file. -# It may require modification in order to execute successfully. # def delete_adaptive_mt_file # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb b/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb index 4ea13822cc6e..40108a55a5af 100755 --- a/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb +++ b/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_glossary call in the TranslationService 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::Translate::V3::TranslationService::Client#delete_glossary. It -# may require modification in order to execute successfully. +# Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary. # def delete_glossary # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/detect_language.rb b/google-cloud-translate-v3/snippets/translation_service/detect_language.rb index 96a92424e0d3..95a28dc7abe7 100755 --- a/google-cloud-translate-v3/snippets/translation_service/detect_language.rb +++ b/google-cloud-translate-v3/snippets/translation_service/detect_language.rb @@ -22,9 +22,14 @@ ## # Snippet for the detect_language call in the TranslationService 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::Translate::V3::TranslationService::Client#detect_language. It -# may require modification in order to execute successfully. +# Google::Cloud::Translate::V3::TranslationService::Client#detect_language. # def detect_language # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb b/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb index bb4c4cc2f1f2..a48d01718f48 100644 --- a/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb +++ b/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_adaptive_mt_dataset call in the TranslationService 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::Translate::V3::TranslationService::Client#get_adaptive_mt_dataset. -# It may require modification in order to execute successfully. # def get_adaptive_mt_dataset # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb b/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb index 831a369474b9..642e8995b0b7 100644 --- a/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb +++ b/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_adaptive_mt_file call in the TranslationService 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::Translate::V3::TranslationService::Client#get_adaptive_mt_file. -# It may require modification in order to execute successfully. # def get_adaptive_mt_file # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb b/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb index df7eeab9acf0..7e72dbbc3fda 100755 --- a/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb +++ b/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_glossary call in the TranslationService 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::Translate::V3::TranslationService::Client#get_glossary. It may -# require modification in order to execute successfully. +# Google::Cloud::Translate::V3::TranslationService::Client#get_glossary. # def get_glossary # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb b/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb index 4d4bff4eab26..98f4a9864a1d 100755 --- a/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb +++ b/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_supported_languages call in the TranslationService 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::Translate::V3::TranslationService::Client#get_supported_languages. -# It may require modification in order to execute successfully. # def get_supported_languages # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb b/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb index 2f6ac3e77cc4..24d616eaee83 100644 --- a/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb +++ b/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb @@ -22,9 +22,14 @@ ## # Snippet for the import_adaptive_mt_file call in the TranslationService 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::Translate::V3::TranslationService::Client#import_adaptive_mt_file. -# It may require modification in order to execute successfully. # def import_adaptive_mt_file # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb b/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb index 776367bb78eb..3fa4128b4099 100644 --- a/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb +++ b/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_adaptive_mt_datasets call in the TranslationService 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::Translate::V3::TranslationService::Client#list_adaptive_mt_datasets. -# It may require modification in order to execute successfully. # def list_adaptive_mt_datasets # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb b/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb index f8d551d95959..3516dcd16fc6 100644 --- a/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb +++ b/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_adaptive_mt_files call in the TranslationService 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::Translate::V3::TranslationService::Client#list_adaptive_mt_files. -# It may require modification in order to execute successfully. # def list_adaptive_mt_files # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb b/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb index cb4441826faa..c2cbe67e69c4 100644 --- a/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb +++ b/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_adaptive_mt_sentences call in the TranslationService 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::Translate::V3::TranslationService::Client#list_adaptive_mt_sentences. -# It may require modification in order to execute successfully. # def list_adaptive_mt_sentences # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb b/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb index dc56e65c31fb..187e82a1d090 100755 --- a/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb +++ b/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_glossaries call in the TranslationService 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::Translate::V3::TranslationService::Client#list_glossaries. It -# may require modification in order to execute successfully. +# Google::Cloud::Translate::V3::TranslationService::Client#list_glossaries. # def list_glossaries # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/translate_document.rb b/google-cloud-translate-v3/snippets/translation_service/translate_document.rb index c8c7356ba20f..cf5b109c52c0 100755 --- a/google-cloud-translate-v3/snippets/translation_service/translate_document.rb +++ b/google-cloud-translate-v3/snippets/translation_service/translate_document.rb @@ -22,9 +22,14 @@ ## # Snippet for the translate_document call in the TranslationService 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::Translate::V3::TranslationService::Client#translate_document. -# It may require modification in order to execute successfully. # def translate_document # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-translate-v3/snippets/translation_service/translate_text.rb b/google-cloud-translate-v3/snippets/translation_service/translate_text.rb index 12caa8acc604..a553d009f041 100755 --- a/google-cloud-translate-v3/snippets/translation_service/translate_text.rb +++ b/google-cloud-translate-v3/snippets/translation_service/translate_text.rb @@ -22,9 +22,14 @@ ## # Snippet for the translate_text call in the TranslationService 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::Translate::V3::TranslationService::Client#translate_text. It -# may require modification in order to execute successfully. +# Google::Cloud::Translate::V3::TranslationService::Client#translate_text. # def translate_text # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/.owlbot-manifest.json b/google-cloud-video-live_stream-v1/.owlbot-manifest.json index d1ef98e6d931..a525de5b7373 100644 --- a/google-cloud-video-live_stream-v1/.owlbot-manifest.json +++ b/google-cloud-video-live_stream-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-video-live_stream-v1/.toys.rb b/google-cloud-video-live_stream-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-video-live_stream-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-video-live_stream-v1/AUTHENTICATION.md b/google-cloud-video-live_stream-v1/AUTHENTICATION.md index 0bd5d63c4436..7132dc94ea28 100644 --- a/google-cloud-video-live_stream-v1/AUTHENTICATION.md +++ b/google-cloud-video-live_stream-v1/AUTHENTICATION.md @@ -1,149 +1,122 @@ # Authentication -In general, the google-cloud-video-live_stream-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-video-live_stream-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/video/live_stream/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::Video::LiveStream::V1::LivestreamService::Client.new +```sh +gcloud auth application-default login ``` -## Credential Lookup - -The google-cloud-video-live_stream-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-video-live_stream-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-video-live_stream-v1 -checks for credentials are configured on the service Credentials class (such as -{::Google::Cloud::Video::LiveStream::V1::LivestreamService::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/video/live_stream/v1" - -ENV["GOOGLE_CLOUD_CREDENTIALS"] = "path/to/keyfile.json" +### Configuration -client = ::Google::Cloud::Video::LiveStream::V1::LivestreamService::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/video/live_stream/v1" client = ::Google::Cloud::Video::LiveStream::V1::LivestreamService::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/video/live_stream/v1" ::Google::Cloud::Video::LiveStream::V1::LivestreamService::Client.configure do |config| - config.credentials = "path/to/keyfile.json" + config.credentials = "path/to/credentialfile.json" end client = ::Google::Cloud::Video::LiveStream::V1::LivestreamService::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-video-live_stream-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/video/live_stream/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-video-live_stream-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::Video::LiveStream::V1::LivestreamService::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-video-live_stream-v1/google-cloud-video-live_stream-v1.gemspec b/google-cloud-video-live_stream-v1/google-cloud-video-live_stream-v1.gemspec index 02dad7187643..50386ecb7aeb 100644 --- a/google-cloud-video-live_stream-v1/google-cloud-video-live_stream-v1.gemspec +++ b/google-cloud-video-live_stream-v1/google-cloud-video-live_stream-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-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/client.rb b/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/client.rb index 9fb935203bbc..85d3c2245c54 100644 --- a/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/client.rb +++ b/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/client.rb @@ -36,6 +36,9 @@ module LivestreamService # Protocol (RTMP) and Secure Reliable Transport (SRT). # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "livestream.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -146,6 +149,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @livestream_service_stub.universe_domain + end + ## # Create a new LivestreamService client object. # @@ -179,8 +191,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) @@ -193,18 +206,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 @livestream_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Video::LiveStream::V1::LivestreamService::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 @@ -2559,9 +2576,9 @@ def update_pool request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"livestream.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 @@ -2607,13 +2624,20 @@ def update_pool 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 = "livestream.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 @@ -2628,6 +2652,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-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/operations.rb b/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/operations.rb index 72fc07f5c49f..1dd7e947c408 100644 --- a/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/operations.rb +++ b/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/operations.rb @@ -27,6 +27,9 @@ module V1 module LivestreamService # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "livestream.$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 `"livestream.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 = "livestream.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-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/client.rb b/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/client.rb index 7e3ce4e26d70..509f6ac2eab5 100644 --- a/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/client.rb +++ b/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/client.rb @@ -38,6 +38,9 @@ module Rest # Protocol (RTMP) and Secure Reliable Transport (SRT). # class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "livestream.$UNIVERSE_DOMAIN$" + include Paths # @private @@ -148,6 +151,15 @@ def configure @config end + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @livestream_service_stub.universe_domain + end + ## # Create a new LivestreamService REST client object. # @@ -175,8 +187,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,16 +203,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 - @livestream_service_stub = ::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + @livestream_service_stub = ::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) end ## @@ -2392,9 +2412,9 @@ def update_pool request, options = nil # end # # @!attribute [rw] endpoint - # The hostname or hostname:port of the service endpoint. - # Defaults to `"livestream.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 @@ -2431,13 +2451,20 @@ def update_pool 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 = "livestream.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 } @@ -2449,6 +2476,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-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/operations.rb b/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/operations.rb index cbbc994d39a0..56ed40061e67 100644 --- a/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/operations.rb +++ b/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/operations.rb @@ -27,6 +27,9 @@ module LivestreamService module Rest # Service that implements Longrunning Operations API. class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "livestream.$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 `"livestream.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 = "livestream.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-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/service_stub.rb b/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/service_stub.rb index 16f8a7252a79..2095bc3038c6 100644 --- a/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/rest/service_stub.rb +++ b/google-cloud-video-live_stream-v1/lib/google/cloud/video/live_stream/v1/livestream_service/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_channel REST call # diff --git a/google-cloud-video-live_stream-v1/proto_docs/google/api/client.rb b/google-cloud-video-live_stream-v1/proto_docs/google/api/client.rb index 31fe6bba3132..b62dfdf37219 100644 --- a/google-cloud-video-live_stream-v1/proto_docs/google/api/client.rb +++ b/google-cloud-video-live_stream-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-video-live_stream-v1/snippets/livestream_service/create_asset.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/create_asset.rb index e9decfd35b4d..da1dac93eb5c 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/create_asset.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/create_asset.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_asset call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#create_asset. -# It may require modification in order to execute successfully. # def create_asset # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/create_channel.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/create_channel.rb index 1b828740dd94..038636d0ee3d 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/create_channel.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/create_channel.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_channel call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#create_channel. -# It may require modification in order to execute successfully. # def create_channel # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/create_event.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/create_event.rb index 430ecb613fac..47c3ecee0826 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/create_event.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/create_event.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_event call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#create_event. -# It may require modification in order to execute successfully. # def create_event # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/create_input.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/create_input.rb index fae03d236802..89bb57c25990 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/create_input.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/create_input.rb @@ -22,9 +22,14 @@ ## # Snippet for the create_input call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#create_input. -# It may require modification in order to execute successfully. # def create_input # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_asset.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_asset.rb index 6ce02741d542..abfe73166523 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_asset.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_asset.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_asset call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#delete_asset. -# It may require modification in order to execute successfully. # def delete_asset # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_channel.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_channel.rb index d27e4513c7ba..8a1fe2458e2a 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_channel.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_channel.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_channel call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#delete_channel. -# It may require modification in order to execute successfully. # def delete_channel # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_event.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_event.rb index 3adc63a3a3e5..8bfd566dcf5d 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_event.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_event.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_event call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#delete_event. -# It may require modification in order to execute successfully. # def delete_event # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_input.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_input.rb index 49a577ccfd61..b4f91e8ffc1f 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_input.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/delete_input.rb @@ -22,9 +22,14 @@ ## # Snippet for the delete_input call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#delete_input. -# It may require modification in order to execute successfully. # def delete_input # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/get_asset.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/get_asset.rb index 031700656fe9..b83b6a8af177 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/get_asset.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/get_asset.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_asset call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#get_asset. It -# may require modification in order to execute successfully. +# Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_asset. # def get_asset # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/get_channel.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/get_channel.rb index f1067d18973d..f2ba7673d3fa 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/get_channel.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/get_channel.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_channel call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#get_channel. -# It may require modification in order to execute successfully. # def get_channel # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/get_event.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/get_event.rb index 64c3de61cf5b..97560f1fe9da 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/get_event.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/get_event.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_event call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#get_event. It -# may require modification in order to execute successfully. +# Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_event. # def get_event # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/get_input.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/get_input.rb index 0ec794657109..1d114e949245 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/get_input.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/get_input.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_input call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#get_input. It -# may require modification in order to execute successfully. +# Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_input. # def get_input # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/get_pool.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/get_pool.rb index d2cdeddef02d..2397b0edeb50 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/get_pool.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/get_pool.rb @@ -22,9 +22,14 @@ ## # Snippet for the get_pool call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#get_pool. It -# may require modification in order to execute successfully. +# Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_pool. # def get_pool # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/list_assets.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/list_assets.rb index f1bc359cc726..9977be9f1271 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/list_assets.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/list_assets.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_assets call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#list_assets. -# It may require modification in order to execute successfully. # def list_assets # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/list_channels.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/list_channels.rb index 62fc6eeda806..19cb0eea59f7 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/list_channels.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/list_channels.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_channels call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#list_channels. -# It may require modification in order to execute successfully. # def list_channels # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/list_events.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/list_events.rb index f77d62aaf803..1c577f1b5ccd 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/list_events.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/list_events.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_events call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::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-video-live_stream-v1/snippets/livestream_service/list_inputs.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/list_inputs.rb index 92ca9533ca22..9d027e69082f 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/list_inputs.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/list_inputs.rb @@ -22,9 +22,14 @@ ## # Snippet for the list_inputs call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#list_inputs. -# It may require modification in order to execute successfully. # def list_inputs # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/start_channel.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/start_channel.rb index e5c7919ed2ff..76deb8f19001 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/start_channel.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/start_channel.rb @@ -22,9 +22,14 @@ ## # Snippet for the start_channel call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#start_channel. -# It may require modification in order to execute successfully. # def start_channel # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/stop_channel.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/stop_channel.rb index c3336d11e865..164b8dd38d22 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/stop_channel.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/stop_channel.rb @@ -22,9 +22,14 @@ ## # Snippet for the stop_channel call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#stop_channel. -# It may require modification in order to execute successfully. # def stop_channel # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/update_channel.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/update_channel.rb index 55111485cb85..0da9541f2534 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/update_channel.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/update_channel.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_channel call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#update_channel. -# It may require modification in order to execute successfully. # def update_channel # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/update_input.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/update_input.rb index 544f08b6a95b..2b308c23d2c4 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/update_input.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/update_input.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_input call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#update_input. -# It may require modification in order to execute successfully. # def update_input # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/livestream_service/update_pool.rb b/google-cloud-video-live_stream-v1/snippets/livestream_service/update_pool.rb index 3801ae2c8dae..c17e82ad56f2 100644 --- a/google-cloud-video-live_stream-v1/snippets/livestream_service/update_pool.rb +++ b/google-cloud-video-live_stream-v1/snippets/livestream_service/update_pool.rb @@ -22,9 +22,14 @@ ## # Snippet for the update_pool call in the LivestreamService 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::Video::LiveStream::V1::LivestreamService::Client#update_pool. -# It may require modification in order to execute successfully. # def update_pool # Create a client object. The client can be reused for multiple calls. diff --git a/google-cloud-video-live_stream-v1/snippets/snippet_metadata_google.cloud.video.livestream.v1.json b/google-cloud-video-live_stream-v1/snippets/snippet_metadata_google.cloud.video.livestream.v1.json index 516dafe55703..a7649f68e4e2 100644 --- a/google-cloud-video-live_stream-v1/snippets/snippet_metadata_google.cloud.video.livestream.v1.json +++ b/google-cloud-video-live_stream-v1/snippets/snippet_metadata_google.cloud.video.livestream.v1.json @@ -14,7 +14,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_CreateChannel_sync", "title": "Snippet for the create_channel call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::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::Video::LiveStream::V1::LivestreamService::Client#create_channel.", "file": "livestream_service/create_channel.rb", "language": "RUBY", "client_method": { @@ -46,7 +46,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -54,7 +54,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_ListChannels_sync", "title": "Snippet for the list_channels call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::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::Video::LiveStream::V1::LivestreamService::Client#list_channels.", "file": "livestream_service/list_channels.rb", "language": "RUBY", "client_method": { @@ -86,7 +86,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -94,7 +94,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_GetChannel_sync", "title": "Snippet for the get_channel call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::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::Video::LiveStream::V1::LivestreamService::Client#get_channel.", "file": "livestream_service/get_channel.rb", "language": "RUBY", "client_method": { @@ -126,7 +126,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -134,7 +134,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_DeleteChannel_sync", "title": "Snippet for the delete_channel call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::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::Video::LiveStream::V1::LivestreamService::Client#delete_channel.", "file": "livestream_service/delete_channel.rb", "language": "RUBY", "client_method": { @@ -166,7 +166,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -174,7 +174,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_UpdateChannel_sync", "title": "Snippet for the update_channel call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::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::Video::LiveStream::V1::LivestreamService::Client#update_channel.", "file": "livestream_service/update_channel.rb", "language": "RUBY", "client_method": { @@ -206,7 +206,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -214,7 +214,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_StartChannel_sync", "title": "Snippet for the start_channel call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#start_channel. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#start_channel.", "file": "livestream_service/start_channel.rb", "language": "RUBY", "client_method": { @@ -246,7 +246,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -254,7 +254,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_StopChannel_sync", "title": "Snippet for the stop_channel call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#stop_channel. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#stop_channel.", "file": "livestream_service/stop_channel.rb", "language": "RUBY", "client_method": { @@ -286,7 +286,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -294,7 +294,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_CreateInput_sync", "title": "Snippet for the create_input call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#create_input. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#create_input.", "file": "livestream_service/create_input.rb", "language": "RUBY", "client_method": { @@ -326,7 +326,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -334,7 +334,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_ListInputs_sync", "title": "Snippet for the list_inputs call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#list_inputs. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#list_inputs.", "file": "livestream_service/list_inputs.rb", "language": "RUBY", "client_method": { @@ -366,7 +366,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -374,7 +374,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_GetInput_sync", "title": "Snippet for the get_input call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_input. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_input.", "file": "livestream_service/get_input.rb", "language": "RUBY", "client_method": { @@ -406,7 +406,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -414,7 +414,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_DeleteInput_sync", "title": "Snippet for the delete_input call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#delete_input. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#delete_input.", "file": "livestream_service/delete_input.rb", "language": "RUBY", "client_method": { @@ -446,7 +446,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -454,7 +454,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_UpdateInput_sync", "title": "Snippet for the update_input call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#update_input. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#update_input.", "file": "livestream_service/update_input.rb", "language": "RUBY", "client_method": { @@ -486,7 +486,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -494,7 +494,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_CreateEvent_sync", "title": "Snippet for the create_event call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#create_event. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#create_event.", "file": "livestream_service/create_event.rb", "language": "RUBY", "client_method": { @@ -526,7 +526,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -534,7 +534,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_ListEvents_sync", "title": "Snippet for the list_events call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::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::Video::LiveStream::V1::LivestreamService::Client#list_events.", "file": "livestream_service/list_events.rb", "language": "RUBY", "client_method": { @@ -566,7 +566,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -574,7 +574,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_GetEvent_sync", "title": "Snippet for the get_event call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_event. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_event.", "file": "livestream_service/get_event.rb", "language": "RUBY", "client_method": { @@ -606,7 +606,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -614,7 +614,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_DeleteEvent_sync", "title": "Snippet for the delete_event call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#delete_event. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#delete_event.", "file": "livestream_service/delete_event.rb", "language": "RUBY", "client_method": { @@ -646,7 +646,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -654,7 +654,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_CreateAsset_sync", "title": "Snippet for the create_asset call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#create_asset. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#create_asset.", "file": "livestream_service/create_asset.rb", "language": "RUBY", "client_method": { @@ -686,7 +686,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -694,7 +694,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_DeleteAsset_sync", "title": "Snippet for the delete_asset call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#delete_asset. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#delete_asset.", "file": "livestream_service/delete_asset.rb", "language": "RUBY", "client_method": { @@ -726,7 +726,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ] @@ -734,7 +734,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_GetAsset_sync", "title": "Snippet for the get_asset call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_asset. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_asset.", "file": "livestream_service/get_asset.rb", "language": "RUBY", "client_method": { @@ -766,7 +766,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -774,7 +774,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_ListAssets_sync", "title": "Snippet for the list_assets call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#list_assets. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#list_assets.", "file": "livestream_service/list_assets.rb", "language": "RUBY", "client_method": { @@ -806,7 +806,7 @@ "segments": [ { "start": 20, - "end": 45, + "end": 50, "type": "FULL" } ] @@ -814,7 +814,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_GetPool_sync", "title": "Snippet for the get_pool call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_pool. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#get_pool.", "file": "livestream_service/get_pool.rb", "language": "RUBY", "client_method": { @@ -846,7 +846,7 @@ "segments": [ { "start": 20, - "end": 41, + "end": 46, "type": "FULL" } ] @@ -854,7 +854,7 @@ { "region_tag": "livestream_v1_generated_LivestreamService_UpdatePool_sync", "title": "Snippet for the update_pool call in the LivestreamService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#update_pool. It may require modification in order to execute successfully.", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Video::LiveStream::V1::LivestreamService::Client#update_pool.", "file": "livestream_service/update_pool.rb", "language": "RUBY", "client_method": { @@ -886,7 +886,7 @@ "segments": [ { "start": 20, - "end": 48, + "end": 53, "type": "FULL" } ]