lib/google/cloud/billing/budgets/v1beta1/budget_service/client.rb in google-cloud-billing-budgets-v1beta1-0.6.1 vs lib/google/cloud/billing/budgets/v1beta1/budget_service/client.rb in google-cloud-billing-budgets-v1beta1-0.6.2

- old
+ new

@@ -41,18 +41,17 @@ # Configure the BudgetService Client class. # # See {::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client::Configuration} # for a description of the configuration fields. # - # ## Example + # @example # - # To modify the configuration for all BudgetService clients: + # # Modify the configuration for all BudgetService clients + # ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.configure do |config| + # config.timeout = 10.0 + # end # - # ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.configure do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # @@ -116,24 +115,20 @@ end ## # Create a new BudgetService client object. # - # ## Examples + # @example # - # To create a new BudgetService client with the default - # configuration: + # # Create a client using the default configuration + # client = ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new # - # client = ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new + # # Create a client using a custom configuration + # client = ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new do |config| + # config.timeout = 10.0 + # end # - # To create a new BudgetService client with a custom - # configuration: - # - # client = ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the BudgetService client. # @yieldparam config [Client::Configuration] # def initialize # These require statements are intentionally placed here to initialize @@ -148,14 +143,13 @@ # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials - # Use self-signed JWT if the scope and endpoint are unchanged from default, + # 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.scope == Client.configure.scope && - @config.endpoint == Client.configure.endpoint && + enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint && !@config.endpoint.split(".").first.include?("-") credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope @@ -232,11 +226,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_budget.timeout, metadata: metadata, retry_policy: @config.rpcs.create_budget.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @budget_service_stub.call_rpc :create_budget, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -310,11 +306,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_budget.timeout, metadata: metadata, retry_policy: @config.rpcs.update_budget.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @budget_service_stub.call_rpc :update_budget, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -382,11 +380,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_budget.timeout, metadata: metadata, retry_policy: @config.rpcs.get_budget.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @budget_service_stub.call_rpc :get_budget, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -461,11 +461,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_budgets.timeout, metadata: metadata, retry_policy: @config.rpcs.list_budgets.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @budget_service_stub.call_rpc :list_budgets, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @budget_service_stub, :list_budgets, request, response, operation, options yield response, operation if block_given? @@ -529,11 +531,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_budget.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_budget.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @budget_service_stub.call_rpc :delete_budget, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -553,25 +557,24 @@ # for a list of RPCs that can be configured independently. # # Configuration can be applied globally to all clients, or to a single client # on construction. # - # # Examples + # @example # - # To modify the global config, setting the timeout for create_budget - # to 20 seconds, and all remaining timeouts to 10 seconds: + # # Modify the global config, setting the timeout for + # # create_budget to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_budget.timeout = 20.0 + # end # - # ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.create_budget.timeout = 20.0 - # end - # - # To apply the above configuration only to a new client: - # - # client = ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.create_budget.timeout = 20.0 - # end + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_budget.timeout = 20.0 + # end # # @!attribute [rw] endpoint # The hostname or hostname:port of the service endpoint. # Defaults to `"billingbudgets.googleapis.com"`. # @return [::String]