lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb in google-cloud-compute-v1-1.8.0 vs lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb in google-cloud-compute-v1-1.9.0

- old
+ new

@@ -166,17 +166,26 @@ # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope + # 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 == 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 end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + @zone_operations = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client.new do |config| config.credentials = credentials + config.quota_project = @quota_project_id config.endpoint = @config.endpoint end @instance_group_managers_stub = ::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials end @@ -200,12 +209,10 @@ # @param request [::Google::Cloud::Compute::V1::AbandonInstancesInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload abandon_instances(instance_group_manager: nil, instance_group_managers_abandon_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `abandon_instances` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -236,21 +243,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.abandon_instances.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.abandon_instances.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.abandon_instances.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.abandon_instances request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -261,16 +272,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Retrieves the list of managed instance groups and groups them by zone. # @@ -281,12 +288,10 @@ # @param request [::Google::Cloud::Compute::V1::AggregatedListInstanceGroupManagersRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload aggregated_list(filter: nil, include_all_scopes: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil) # Pass arguments to `aggregated_list` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -321,33 +326,33 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.aggregated_list.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.aggregated_list.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.aggregated_list.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @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 - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Applies changes to selected instances on the managed instance group. This method can be used to apply new overrides and/or new versions. # @@ -358,12 +363,10 @@ # @param request [::Google::Cloud::Compute::V1::ApplyUpdatesToInstancesInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload apply_updates_to_instances(instance_group_manager: nil, instance_group_managers_apply_updates_request_resource: nil, project: nil, zone: nil) # Pass arguments to `apply_updates_to_instances` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -392,21 +395,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.apply_updates_to_instances.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.apply_updates_to_instances.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.apply_updates_to_instances.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.apply_updates_to_instances request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -417,16 +424,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Creates instances with per-instance configurations in this managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method. # @@ -437,12 +440,10 @@ # @param request [::Google::Cloud::Compute::V1::CreateInstancesInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload create_instances(instance_group_manager: nil, instance_group_managers_create_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `create_instances` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -473,21 +474,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.create_instances.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.create_instances.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.create_instances.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.create_instances request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -498,16 +503,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information. # @@ -518,12 +519,10 @@ # @param request [::Google::Cloud::Compute::V1::DeleteInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload delete(instance_group_manager: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `delete` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -552,21 +551,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.delete.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.delete.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.delete.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.delete request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -577,16 +580,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Flags the specified instances in the managed instance group for immediate deletion. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. 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. # @@ -597,12 +596,10 @@ # @param request [::Google::Cloud::Compute::V1::DeleteInstancesInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload delete_instances(instance_group_manager: nil, instance_group_managers_delete_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `delete_instances` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -633,21 +630,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.delete_instances.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.delete_instances.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.delete_instances.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.delete_instances request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -658,16 +659,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Deletes selected per-instance configurations for the managed instance group. # @@ -678,12 +675,10 @@ # @param request [::Google::Cloud::Compute::V1::DeletePerInstanceConfigsInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload delete_per_instance_configs(instance_group_manager: nil, instance_group_managers_delete_per_instance_configs_req_resource: nil, project: nil, zone: nil) # Pass arguments to `delete_per_instance_configs` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -712,21 +707,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.delete_per_instance_configs.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.delete_per_instance_configs.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.delete_per_instance_configs.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.delete_per_instance_configs request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -737,16 +736,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Returns all of the details about the specified managed instance group. Gets a list of available managed instance groups by making a list() request. # @@ -757,12 +752,10 @@ # @param request [::Google::Cloud::Compute::V1::GetInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload get(instance_group_manager: nil, project: nil, zone: nil) # Pass arguments to `get` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -789,32 +782,32 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.get.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.get.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.get.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.get request, options do |result, response| yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit. # @@ -825,12 +818,10 @@ # @param request [::Google::Cloud::Compute::V1::InsertInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload insert(instance_group_manager_resource: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `insert` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -859,21 +850,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.insert.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.insert.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.insert.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.insert request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -884,16 +879,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Retrieves a list of managed instance groups that are contained within the specified project and zone. # @@ -904,12 +895,10 @@ # @param request [::Google::Cloud::Compute::V1::ListInstanceGroupManagersRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload list(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) # Pass arguments to `list` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -944,33 +933,33 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.list.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.list.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.list.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @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 - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Lists all errors thrown by actions on instances for a given managed instance group. The filter and orderBy query parameters are not supported. # @@ -981,12 +970,10 @@ # @param request [::Google::Cloud::Compute::V1::ListErrorsInstanceGroupManagersRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload list_errors(filter: nil, instance_group_manager: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) # Pass arguments to `list_errors` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -1023,33 +1010,33 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.list_errors.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.list_errors.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.list_errors.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @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 - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action. The orderBy query parameter is not supported. The `pageToken` query parameter is supported only in the alpha and beta API and only if the group's `listManagedInstancesResults` field is set to `PAGINATED`. # @@ -1060,12 +1047,10 @@ # @param request [::Google::Cloud::Compute::V1::ListManagedInstancesInstanceGroupManagersRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload list_managed_instances(filter: nil, instance_group_manager: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) # Pass arguments to `list_managed_instances` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -1102,33 +1087,33 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.list_managed_instances.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.list_managed_instances.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.list_managed_instances.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @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 - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Lists all of the per-instance configurations defined for the managed instance group. The orderBy query parameter is not supported. # @@ -1139,12 +1124,10 @@ # @param request [::Google::Cloud::Compute::V1::ListPerInstanceConfigsInstanceGroupManagersRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload list_per_instance_configs(filter: nil, instance_group_manager: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) # Pass arguments to `list_per_instance_configs` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -1181,33 +1164,33 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.list_per_instance_configs.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.list_per_instance_configs.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.list_per_instance_configs.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @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 - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. If you update your group to specify a new template or instance configuration, it's possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG. # @@ -1218,12 +1201,10 @@ # @param request [::Google::Cloud::Compute::V1::PatchInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload patch(instance_group_manager: nil, instance_group_manager_resource: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `patch` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -1254,21 +1235,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.patch.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.patch.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.patch.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.patch request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -1279,16 +1264,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Inserts or patches per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch. # @@ -1299,12 +1280,10 @@ # @param request [::Google::Cloud::Compute::V1::PatchPerInstanceConfigsInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload patch_per_instance_configs(instance_group_manager: nil, instance_group_managers_patch_per_instance_configs_req_resource: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `patch_per_instance_configs` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -1335,21 +1314,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.patch_per_instance_configs.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.patch_per_instance_configs.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.patch_per_instance_configs.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.patch_per_instance_configs request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -1360,16 +1343,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # 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. # @@ -1380,12 +1359,10 @@ # @param request [::Google::Cloud::Compute::V1::RecreateInstancesInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload recreate_instances(instance_group_manager: nil, instance_group_managers_recreate_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `recreate_instances` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -1416,21 +1393,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.recreate_instances.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.recreate_instances.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.recreate_instances.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.recreate_instances request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -1441,16 +1422,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: + The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. This list is subject to change. 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. # @@ -1461,12 +1438,10 @@ # @param request [::Google::Cloud::Compute::V1::ResizeInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload resize(instance_group_manager: nil, project: nil, request_id: nil, size: nil, zone: nil) # Pass arguments to `resize` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -1497,21 +1472,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.resize.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.resize.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.resize.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.resize request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -1522,16 +1501,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Specifies the instance template to use when creating new instances in this group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE. # @@ -1542,12 +1517,10 @@ # @param request [::Google::Cloud::Compute::V1::SetInstanceTemplateInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload set_instance_template(instance_group_manager: nil, instance_group_managers_set_instance_template_request_resource: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `set_instance_template` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -1578,21 +1551,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.set_instance_template.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.set_instance_template.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.set_instance_template.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.set_instance_template request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -1603,16 +1580,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Modifies the target pools to which all instances in this managed instance group are assigned. The target pools automatically apply to all of the instances in the managed instance group. This operation is marked DONE when you make the request even if the instances have not yet been added to their target pools. The change might take some time to apply to all of the instances in the group depending on the size of the group. # @@ -1623,12 +1596,10 @@ # @param request [::Google::Cloud::Compute::V1::SetTargetPoolsInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload set_target_pools(instance_group_manager: nil, instance_group_managers_set_target_pools_request_resource: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `set_target_pools` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -1659,21 +1630,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.set_target_pools.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.set_target_pools.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.set_target_pools.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.set_target_pools request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -1684,16 +1659,12 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Inserts or updates per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch. # @@ -1704,12 +1675,10 @@ # @param request [::Google::Cloud::Compute::V1::UpdatePerInstanceConfigsInstanceGroupManagerRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # Note: currently retry functionality is not implemented. While it is possible - # to set it using ::Gapic::CallOptions, it will not be applied # # @overload update_per_instance_configs(instance_group_manager: nil, instance_group_managers_update_per_instance_configs_req_resource: nil, project: nil, request_id: nil, zone: nil) # Pass arguments to `update_per_instance_configs` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -1740,21 +1709,25 @@ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.update_per_instance_configs.metadata.to_h - # Set x-goog-api-client header + # Set x-goog-api-client and x-goog-user-project headers 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] + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + options.apply_defaults timeout: @config.rpcs.update_per_instance_configs.timeout, - metadata: call_metadata + metadata: call_metadata, + retry_policy: @config.rpcs.update_per_instance_configs.retry_policy options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata + metadata: @config.metadata, + retry_policy: @config.retry_policy @instance_group_managers_stub.update_per_instance_configs request, options do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, @@ -1765,41 +1738,43 @@ options: options ) yield result, response if block_given? return result end - rescue ::Faraday::Error => e - begin - raise ::Gapic::Rest::Error.wrap_faraday_error e - rescue ::Gapic::Rest::Error => gapic_error - raise ::Google::Cloud::Error.from_error gapic_error - end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) end ## # Configuration class for the InstanceGroupManagers REST API. # # This class represents the configuration for InstanceGroupManagers REST, - # providing control over credentials, timeouts, retry behavior, logging. + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client::Configuration::Rpcs} + # 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 all calls to 10 seconds: + # # Modify the global config, setting the timeout for + # # abandon_instances to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.abandon_instances.timeout = 20.0 + # end # - # ::Google::Cloud::Compute::V1::InstanceGroupManagers::Client.configure do |config| - # config.timeout = 10.0 - # end + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.abandon_instances.timeout = 20.0 + # end # - # To apply the above configuration only to a new client: - # - # client = ::Google::Cloud::Compute::V1::InstanceGroupManagers::Client.new do |config| - # config.timeout = 10.0 - # end - # # @!attribute [rw] endpoint # The hostname or hostname:port of the service endpoint. # Defaults to `"compute.googleapis.com"`. # @return [::String] # @!attribute [rw] credentials @@ -1823,12 +1798,23 @@ # @return [::String] # @!attribute [rw] timeout # The call timeout in seconds. # @return [::Numeric] # @!attribute [rw] metadata - # Additional REST headers to be sent with the call. + # Additional headers to be sent with the call. # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] # class Configuration extend ::Gapic::Config config_attr :endpoint, "compute.googleapis.com", ::String @@ -1839,10 +1825,12 @@ 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 + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil # @private def initialize parent_config = nil @parent_config = parent_config unless parent_config.nil? @@ -1867,12 +1855,17 @@ # 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. + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should + # trigger a retry. # class Rpcs ## # RPC-specific configuration for `abandon_instances` # @return [::Gapic::Config::Method]