lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb in google-cloud-bigquery-reservation-v1-0.3.2 vs lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb in google-cloud-bigquery-reservation-v1-0.3.3

- old
+ new

@@ -54,18 +54,17 @@ # Configure the ReservationService Client class. # # See {::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client::Configuration} # for a description of the configuration fields. # - # ## Example + # @example # - # To modify the configuration for all ReservationService clients: + # # Modify the configuration for all ReservationService clients + # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.configure do |config| + # config.timeout = 10.0 + # end # - # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.configure do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # @@ -175,24 +174,20 @@ end ## # Create a new ReservationService client object. # - # ## Examples + # @example # - # To create a new ReservationService client with the default - # configuration: + # # Create a client using the default configuration + # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new # - # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new + # # Create a client using a custom configuration + # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config| + # config.timeout = 10.0 + # end # - # To create a new ReservationService client with a custom - # configuration: - # - # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the ReservationService client. # @yieldparam config [Client::Configuration] # def initialize # These require statements are intentionally placed here to initialize @@ -207,14 +202,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 @@ -292,11 +286,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_reservation.timeout, metadata: metadata, retry_policy: @config.rpcs.create_reservation.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :create_reservation, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -363,11 +359,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_reservations.timeout, metadata: metadata, retry_policy: @config.rpcs.list_reservations.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :list_reservations, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @reservation_service_stub, :list_reservations, request, response, operation, options yield response, operation if block_given? @@ -431,11 +429,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_reservation.timeout, metadata: metadata, retry_policy: @config.rpcs.get_reservation.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :get_reservation, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -500,11 +500,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_reservation.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_reservation.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :delete_reservation, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -568,11 +570,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_reservation.timeout, metadata: metadata, retry_policy: @config.rpcs.update_reservation.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :update_reservation, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -640,11 +644,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_capacity_commitment.timeout, metadata: metadata, retry_policy: @config.rpcs.create_capacity_commitment.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :create_capacity_commitment, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -711,11 +717,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_capacity_commitments.timeout, metadata: metadata, retry_policy: @config.rpcs.list_capacity_commitments.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :list_capacity_commitments, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @reservation_service_stub, :list_capacity_commitments, request, response, operation, options yield response, operation if block_given? @@ -779,11 +787,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_capacity_commitment.timeout, metadata: metadata, retry_policy: @config.rpcs.get_capacity_commitment.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :get_capacity_commitment, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -848,11 +858,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_capacity_commitment.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_capacity_commitment.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :delete_capacity_commitment, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -922,11 +934,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_capacity_commitment.timeout, metadata: metadata, retry_policy: @config.rpcs.update_capacity_commitment.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :update_capacity_commitment, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -998,11 +1012,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.split_capacity_commitment.timeout, metadata: metadata, retry_policy: @config.rpcs.split_capacity_commitment.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :split_capacity_commitment, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -1077,11 +1093,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.merge_capacity_commitments.timeout, metadata: metadata, retry_policy: @config.rpcs.merge_capacity_commitments.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :merge_capacity_commitments, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -1175,11 +1193,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_assignment.timeout, metadata: metadata, retry_policy: @config.rpcs.create_assignment.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :create_assignment, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -1271,11 +1291,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_assignments.timeout, metadata: metadata, retry_policy: @config.rpcs.list_assignments.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :list_assignments, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @reservation_service_stub, :list_assignments, request, response, operation, options yield response, operation if block_given? @@ -1353,11 +1375,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_assignment.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_assignment.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :delete_assignment, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -1455,11 +1479,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.search_assignments.timeout, metadata: metadata, retry_policy: @config.rpcs.search_assignments.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :search_assignments, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @reservation_service_stub, :search_assignments, request, response, operation, options yield response, operation if block_given? @@ -1531,11 +1557,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.move_assignment.timeout, metadata: metadata, retry_policy: @config.rpcs.move_assignment.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :move_assignment, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -1598,11 +1626,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_bi_reservation.timeout, metadata: metadata, retry_policy: @config.rpcs.get_bi_reservation.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :get_bi_reservation, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -1673,11 +1703,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_bi_reservation.timeout, metadata: metadata, retry_policy: @config.rpcs.update_bi_reservation.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @reservation_service_stub.call_rpc :update_bi_reservation, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -1697,25 +1729,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_reservation - # to 20 seconds, and all remaining timeouts to 10 seconds: + # # Modify the global config, setting the timeout for + # # create_reservation to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_reservation.timeout = 20.0 + # end # - # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.create_reservation.timeout = 20.0 - # end - # - # To apply the above configuration only to a new client: - # - # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.create_reservation.timeout = 20.0 - # end + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_reservation.timeout = 20.0 + # end # # @!attribute [rw] endpoint # The hostname or hostname:port of the service endpoint. # Defaults to `"bigqueryreservation.googleapis.com"`. # @return [::String]