lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb in google-cloud-compute-v1-0.2.0 vs lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb in google-cloud-compute-v1-0.3.0

- old
+ new

@@ -16,10 +16,11 @@ # Auto-generated by gapic-generator-ruby. DO NOT EDIT! require "google/cloud/errors" require "google/cloud/compute/v1/compute_pb" +require "google/cloud/compute/v1/instance_group_managers/rest/service_stub" module Google module Cloud module Compute module V1 @@ -29,29 +30,26 @@ # REST client for the InstanceGroupManagers service. # # The InstanceGroupManagers API. # class Client - include GrpcTranscoding - # @private attr_reader :instance_group_managers_stub ## # Configure the InstanceGroupManagers Client class. # # See {::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client::Configuration} # for a description of the configuration fields. # - # ## Example + # @example # - # To modify the configuration for all InstanceGroupManagers clients: + # # Modify the configuration for all InstanceGroupManagers clients + # ::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end # - # ::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # @@ -64,10 +62,62 @@ break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config + default_config.rpcs.abandon_instances.timeout = 600.0 + + default_config.rpcs.aggregated_list.timeout = 600.0 + default_config.rpcs.aggregated_list.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config.rpcs.apply_updates_to_instances.timeout = 600.0 + + default_config.rpcs.create_instances.timeout = 600.0 + + default_config.rpcs.delete.timeout = 600.0 + + default_config.rpcs.delete_instances.timeout = 600.0 + + default_config.rpcs.delete_per_instance_configs.timeout = 600.0 + + default_config.rpcs.get.timeout = 600.0 + default_config.rpcs.get.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config.rpcs.insert.timeout = 600.0 + + default_config.rpcs.list.timeout = 600.0 + default_config.rpcs.list.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config.rpcs.list_errors.timeout = 600.0 + default_config.rpcs.list_errors.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config.rpcs.list_managed_instances.timeout = 600.0 + + default_config.rpcs.list_per_instance_configs.timeout = 600.0 + + default_config.rpcs.patch.timeout = 600.0 + + default_config.rpcs.patch_per_instance_configs.timeout = 600.0 + + default_config.rpcs.recreate_instances.timeout = 600.0 + + default_config.rpcs.resize.timeout = 600.0 + + default_config.rpcs.set_instance_template.timeout = 600.0 + + default_config.rpcs.set_target_pools.timeout = 600.0 + + default_config.rpcs.update_per_instance_configs.timeout = 600.0 + default_config end yield @configure if block_given? @configure end @@ -93,46 +143,38 @@ end ## # Create a new InstanceGroupManagers REST client object. # - # ## Examples + # @example # - # To create a new InstanceGroupManagers REST client with the default - # configuration: + # # Create a client using the default configuration + # client = ::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client.new # - # client = ::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client.new + # # Create a client using a custom configuration + # client = ::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client.new do |config| + # config.timeout = 10.0 + # end # - # To create a new InstanceGroupManagers REST client with a custom - # configuration: - # - # client = ::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the InstanceGroupManagers client. # @yieldparam config [Client::Configuration] # def initialize - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(String) || credentials.is_a?(Hash) + if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: @config.endpoint, credentials: credentials + @instance_group_managers_stub = ::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials end # Service calls ## @@ -171,15 +213,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where the managed instance group is located. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def abandon_instances request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -187,32 +229,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.abandon_instances.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.abandon_instances.timeout, metadata: call_metadata - uri, body, query_string_params = transcode_abandon_instances request - response = @client_stub.make_post_request( - uri: uri, - body: body, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.abandon_instances request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -257,16 +296,16 @@ # @param page_token [::String] # Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. # @param project [::String] # Project ID for this request. # @param return_partial_success [::Boolean] - # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false and the logic is the same as today. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::InstanceGroupManagerAggregatedList] + # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstanceGroupManagersScopedList>] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::InstanceGroupManagerAggregatedList] + # @return [::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstanceGroupManagersScopedList>] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def aggregated_list request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -274,31 +313,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.aggregated_list.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.aggregated_list.timeout, metadata: call_metadata - uri, _body, query_string_params = transcode_aggregated_list request - response = @client_stub.make_get_request( - uri: uri, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::InstanceGroupManagerAggregatedList.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.aggregated_list request, options do |result, response| + result = ::Gapic::Rest::PagedEnumerable.new @instance_group_managers_stub, :aggregated_list, "items", request, result, options + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -328,15 +365,15 @@ # The body resource for this request # @param project [::String] # Project ID for this request. # @param zone [::String] # The name of the zone where the managed instance group is located. Should conform to RFC1035. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def apply_updates_to_instances request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -344,31 +381,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.apply_updates_to_instances.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.apply_updates_to_instances.timeout, metadata: call_metadata - uri, body, _query_string_params = transcode_apply_updates_to_instances request - response = @client_stub.make_post_request( - uri: uri, - body: body, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.apply_updates_to_instances request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -404,15 +439,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where the managed instance group is located. It should conform to RFC1035. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def create_instances request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -420,32 +455,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.create_instances.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.create_instances.timeout, metadata: call_metadata - uri, body, query_string_params = transcode_create_instances request - response = @client_stub.make_post_request( - uri: uri, - body: body, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.create_instances request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -479,15 +511,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where the managed instance group is located. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def delete request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -495,31 +527,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.delete.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.delete.timeout, metadata: call_metadata - uri, _body, query_string_params = transcode_delete request - response = @client_stub.make_delete_request( - uri: uri, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.delete request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -559,15 +589,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where the managed instance group is located. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def delete_instances request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -575,32 +605,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.delete_instances.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.delete_instances.timeout, metadata: call_metadata - uri, body, query_string_params = transcode_delete_instances request - response = @client_stub.make_post_request( - uri: uri, - body: body, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.delete_instances request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -630,15 +657,15 @@ # The body resource for this request # @param project [::String] # Project ID for this request. # @param zone [::String] # The name of the zone where the managed instance group is located. It should conform to RFC1035. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def delete_per_instance_configs request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -646,31 +673,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.delete_per_instance_configs.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.delete_per_instance_configs.timeout, metadata: call_metadata - uri, body, _query_string_params = transcode_delete_per_instance_configs request - response = @client_stub.make_post_request( - uri: uri, - body: body, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.delete_per_instance_configs request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -698,11 +723,11 @@ # The name of the managed instance group. # @param project [::String] # Project ID for this request. # @param zone [::String] # The name of the zone where the managed instance group is located. - # @yield [result, env] Access the result along with the Faraday environment object + # @yield [result, response] Access the result along with the Faraday response object # @yieldparam result [::Google::Cloud::Compute::V1::InstanceGroupManager] # @yieldparam response [::Faraday::Response] # # @return [::Google::Cloud::Compute::V1::InstanceGroupManager] # @@ -714,30 +739,28 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.get.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.get.timeout, metadata: call_metadata - uri, _body, _query_string_params = transcode_get request - response = @client_stub.make_get_request( - uri: uri, - options: options - ) - result = ::Google::Cloud::Compute::V1::InstanceGroupManager.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.get request, options do |result, response| + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -773,15 +796,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where you want to create the managed instance group. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def insert request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -789,32 +812,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.insert.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.insert.timeout, metadata: call_metadata - uri, body, query_string_params = transcode_insert request - response = @client_stub.make_post_request( - uri: uri, - body: body, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.insert request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -857,18 +877,18 @@ # @param page_token [::String] # Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. # @param project [::String] # Project ID for this request. # @param return_partial_success [::Boolean] - # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false and the logic is the same as today. + # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. # @param zone [::String] # The name of the zone where the managed instance group is located. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::InstanceGroupManagerList] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstanceGroupManager>] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::InstanceGroupManagerList] + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstanceGroupManager>] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def list request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -876,31 +896,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.list.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.list.timeout, metadata: call_metadata - uri, _body, query_string_params = transcode_list request - response = @client_stub.make_get_request( - uri: uri, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::InstanceGroupManagerList.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.list request, options do |result, response| + result = ::Gapic::Rest::PagedEnumerable.new @instance_group_managers_stub, :list, "items", request, result, options + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -945,18 +963,18 @@ # @param page_token [::String] # Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. # @param project [::String] # Project ID for this request. # @param return_partial_success [::Boolean] - # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false and the logic is the same as today. + # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. # @param zone [::String] # The name of the zone where the managed instance group is located. It should conform to RFC1035. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::InstanceGroupManagersListErrorsResponse] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstanceManagedByIgmError>] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::InstanceGroupManagersListErrorsResponse] + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstanceManagedByIgmError>] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def list_errors request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -964,31 +982,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.list_errors.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.list_errors.timeout, metadata: call_metadata - uri, _body, query_string_params = transcode_list_errors request - response = @client_stub.make_get_request( - uri: uri, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::InstanceGroupManagersListErrorsResponse.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.list_errors request, options do |result, response| + result = ::Gapic::Rest::PagedEnumerable.new @instance_group_managers_stub, :list_errors, "items", request, result, options + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -1033,18 +1049,18 @@ # @param page_token [::String] # Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. # @param project [::String] # Project ID for this request. # @param return_partial_success [::Boolean] - # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false and the logic is the same as today. + # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. # @param zone [::String] # The name of the zone where the managed instance group is located. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::InstanceGroupManagersListManagedInstancesResponse] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::ManagedInstance>] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::InstanceGroupManagersListManagedInstancesResponse] + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::ManagedInstance>] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def list_managed_instances request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -1052,31 +1068,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.list_managed_instances.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.list_managed_instances.timeout, metadata: call_metadata - uri, _body, query_string_params = transcode_list_managed_instances request - response = @client_stub.make_post_request( - uri: uri, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::InstanceGroupManagersListManagedInstancesResponse.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.list_managed_instances request, options do |result, response| + result = ::Gapic::Rest::PagedEnumerable.new @instance_group_managers_stub, :list_managed_instances, "managed_instances", request, result, options + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -1121,18 +1135,18 @@ # @param page_token [::String] # Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. # @param project [::String] # Project ID for this request. # @param return_partial_success [::Boolean] - # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false and the logic is the same as today. + # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. # @param zone [::String] # The name of the zone where the managed instance group is located. It should conform to RFC1035. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::InstanceGroupManagersListPerInstanceConfigsResp] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::PerInstanceConfig>] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::InstanceGroupManagersListPerInstanceConfigsResp] + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::PerInstanceConfig>] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def list_per_instance_configs request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -1140,31 +1154,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.list_per_instance_configs.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.list_per_instance_configs.timeout, metadata: call_metadata - uri, _body, query_string_params = transcode_list_per_instance_configs request - response = @client_stub.make_post_request( - uri: uri, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::InstanceGroupManagersListPerInstanceConfigsResp.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.list_per_instance_configs request, options do |result, response| + result = ::Gapic::Rest::PagedEnumerable.new @instance_group_managers_stub, :list_per_instance_configs, "items", request, result, options + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -1200,15 +1212,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where you want to create the managed instance group. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def patch request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -1216,32 +1228,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.patch.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.patch.timeout, metadata: call_metadata - uri, body, query_string_params = transcode_patch request - response = @client_stub.make_patch_request( - uri: uri, - body: body, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.patch request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -1277,15 +1286,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where the managed instance group is located. It should conform to RFC1035. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def patch_per_instance_configs request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -1293,39 +1302,36 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.patch_per_instance_configs.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.patch_per_instance_configs.timeout, metadata: call_metadata - uri, body, query_string_params = transcode_patch_per_instance_configs request - response = @client_stub.make_post_request( - uri: uri, - body: body, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.patch_per_instance_configs request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end ## - # Flags the specified instances in the managed instance group to be immediately recreated. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. + # Flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group's current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. # # If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. # # You can specify a maximum of 1000 instances with this method per request. # @@ -1358,15 +1364,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where the managed instance group is located. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def recreate_instances request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -1374,32 +1380,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.recreate_instances.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.recreate_instances.timeout, metadata: call_metadata - uri, body, query_string_params = transcode_recreate_instances request - response = @client_stub.make_post_request( - uri: uri, - body: body, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.recreate_instances request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -1443,15 +1446,15 @@ # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param size [::Integer] # The number of running instances that the managed instance group should maintain at any given time. The group automatically adds or removes instances to maintain the number of instances specified by this parameter. # @param zone [::String] # The name of the zone where the managed instance group is located. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def resize request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -1459,31 +1462,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.resize.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.resize.timeout, metadata: call_metadata - uri, _body, query_string_params = transcode_resize request - response = @client_stub.make_post_request( - uri: uri, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.resize request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -1519,15 +1520,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where the managed instance group is located. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def set_instance_template request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -1535,32 +1536,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.set_instance_template.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.set_instance_template.timeout, metadata: call_metadata - uri, body, query_string_params = transcode_set_instance_template request - response = @client_stub.make_post_request( - uri: uri, - body: body, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.set_instance_template request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -1596,15 +1594,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where the managed instance group is located. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def set_target_pools request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -1612,32 +1610,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.set_target_pools.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.set_target_pools.timeout, metadata: call_metadata - uri, body, query_string_params = transcode_set_target_pools request - response = @client_stub.make_post_request( - uri: uri, - body: body, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.set_target_pools request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -1673,15 +1668,15 @@ # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). # @param zone [::String] # The name of the zone where the managed instance group is located. It should conform to RFC1035. - # @yield [result, env] Access the result along with the Faraday environment object - # @yieldparam result [::Google::Cloud::Compute::V1::Operation] + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Gapic::Rest::BaseOperation] # @yieldparam response [::Faraday::Response] # - # @return [::Google::Cloud::Compute::V1::Operation] + # @return [::Gapic::Rest::BaseOperation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def update_per_instance_configs request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -1689,32 +1684,29 @@ # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults - call_metadata = {} + call_metadata = @config.rpcs.update_per_instance_configs.metadata.to_h # Set x-goog-api-client header call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] - options.apply_defaults timeout: @config.timeout, + options.apply_defaults timeout: @config.rpcs.update_per_instance_configs.timeout, metadata: call_metadata - uri, body, query_string_params = transcode_update_per_instance_configs request - response = @client_stub.make_post_request( - uri: uri, - body: body, - params: query_string_params, - options: options - ) - result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata - yield result, response if block_given? - result + @instance_group_managers_stub.update_per_instance_configs request, options do |result, response| + result = ::Gapic::Rest::BaseOperation.new result + yield result, response if block_given? + return result + end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end @@ -1765,10 +1757,13 @@ # The library version as recorded in instrumentation and logging # @return [::String] # @!attribute [rw] timeout # The call timeout in seconds. # @return [::Numeric] + # @!attribute [rw] metadata + # Additional REST headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] # class Configuration extend ::Gapic::Config config_attr :endpoint, "compute.googleapis.com", ::String @@ -1778,15 +1773,189 @@ end config_attr :scope, nil, ::String, ::Array, nil config_attr :lib_name, nil, ::String, nil config_attr :lib_version, nil, ::String, nil config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil # @private def initialize parent_config = nil @parent_config = parent_config unless parent_config.nil? yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the InstanceGroupManagers API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # + # there is one other field (`retry_policy`) that can be set + # but is currently not supported for REST Gapic libraries. + # + class Rpcs + ## + # RPC-specific configuration for `abandon_instances` + # @return [::Gapic::Config::Method] + # + attr_reader :abandon_instances + ## + # RPC-specific configuration for `aggregated_list` + # @return [::Gapic::Config::Method] + # + attr_reader :aggregated_list + ## + # RPC-specific configuration for `apply_updates_to_instances` + # @return [::Gapic::Config::Method] + # + attr_reader :apply_updates_to_instances + ## + # RPC-specific configuration for `create_instances` + # @return [::Gapic::Config::Method] + # + attr_reader :create_instances + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `delete_instances` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_instances + ## + # RPC-specific configuration for `delete_per_instance_configs` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_per_instance_configs + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + ## + # RPC-specific configuration for `list_errors` + # @return [::Gapic::Config::Method] + # + attr_reader :list_errors + ## + # RPC-specific configuration for `list_managed_instances` + # @return [::Gapic::Config::Method] + # + attr_reader :list_managed_instances + ## + # RPC-specific configuration for `list_per_instance_configs` + # @return [::Gapic::Config::Method] + # + attr_reader :list_per_instance_configs + ## + # RPC-specific configuration for `patch` + # @return [::Gapic::Config::Method] + # + attr_reader :patch + ## + # RPC-specific configuration for `patch_per_instance_configs` + # @return [::Gapic::Config::Method] + # + attr_reader :patch_per_instance_configs + ## + # RPC-specific configuration for `recreate_instances` + # @return [::Gapic::Config::Method] + # + attr_reader :recreate_instances + ## + # RPC-specific configuration for `resize` + # @return [::Gapic::Config::Method] + # + attr_reader :resize + ## + # RPC-specific configuration for `set_instance_template` + # @return [::Gapic::Config::Method] + # + attr_reader :set_instance_template + ## + # RPC-specific configuration for `set_target_pools` + # @return [::Gapic::Config::Method] + # + attr_reader :set_target_pools + ## + # RPC-specific configuration for `update_per_instance_configs` + # @return [::Gapic::Config::Method] + # + attr_reader :update_per_instance_configs + + # @private + def initialize parent_rpcs = nil + abandon_instances_config = parent_rpcs.abandon_instances if parent_rpcs.respond_to? :abandon_instances + @abandon_instances = ::Gapic::Config::Method.new abandon_instances_config + aggregated_list_config = parent_rpcs.aggregated_list if parent_rpcs.respond_to? :aggregated_list + @aggregated_list = ::Gapic::Config::Method.new aggregated_list_config + apply_updates_to_instances_config = parent_rpcs.apply_updates_to_instances if parent_rpcs.respond_to? :apply_updates_to_instances + @apply_updates_to_instances = ::Gapic::Config::Method.new apply_updates_to_instances_config + create_instances_config = parent_rpcs.create_instances if parent_rpcs.respond_to? :create_instances + @create_instances = ::Gapic::Config::Method.new create_instances_config + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + delete_instances_config = parent_rpcs.delete_instances if parent_rpcs.respond_to? :delete_instances + @delete_instances = ::Gapic::Config::Method.new delete_instances_config + delete_per_instance_configs_config = parent_rpcs.delete_per_instance_configs if parent_rpcs.respond_to? :delete_per_instance_configs + @delete_per_instance_configs = ::Gapic::Config::Method.new delete_per_instance_configs_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + list_errors_config = parent_rpcs.list_errors if parent_rpcs.respond_to? :list_errors + @list_errors = ::Gapic::Config::Method.new list_errors_config + list_managed_instances_config = parent_rpcs.list_managed_instances if parent_rpcs.respond_to? :list_managed_instances + @list_managed_instances = ::Gapic::Config::Method.new list_managed_instances_config + list_per_instance_configs_config = parent_rpcs.list_per_instance_configs if parent_rpcs.respond_to? :list_per_instance_configs + @list_per_instance_configs = ::Gapic::Config::Method.new list_per_instance_configs_config + patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch + @patch = ::Gapic::Config::Method.new patch_config + patch_per_instance_configs_config = parent_rpcs.patch_per_instance_configs if parent_rpcs.respond_to? :patch_per_instance_configs + @patch_per_instance_configs = ::Gapic::Config::Method.new patch_per_instance_configs_config + recreate_instances_config = parent_rpcs.recreate_instances if parent_rpcs.respond_to? :recreate_instances + @recreate_instances = ::Gapic::Config::Method.new recreate_instances_config + resize_config = parent_rpcs.resize if parent_rpcs.respond_to? :resize + @resize = ::Gapic::Config::Method.new resize_config + set_instance_template_config = parent_rpcs.set_instance_template if parent_rpcs.respond_to? :set_instance_template + @set_instance_template = ::Gapic::Config::Method.new set_instance_template_config + set_target_pools_config = parent_rpcs.set_target_pools if parent_rpcs.respond_to? :set_target_pools + @set_target_pools = ::Gapic::Config::Method.new set_target_pools_config + update_per_instance_configs_config = parent_rpcs.update_per_instance_configs if parent_rpcs.respond_to? :update_per_instance_configs + @update_per_instance_configs = ::Gapic::Config::Method.new update_per_instance_configs_config + + yield self if block_given? + end end end end end end