lib/google/cloud/compute/v1/instances/rest/client.rb in google-cloud-compute-v1-1.8.0 vs lib/google/cloud/compute/v1/instances/rest/client.rb in google-cloud-compute-v1-1.9.0
- old
+ new
@@ -234,17 +234,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
@instances_stub = ::Google::Cloud::Compute::V1::Instances::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
end
@@ -268,12 +277,10 @@
# @param request [::Google::Cloud::Compute::V1::AddAccessConfigInstanceRequest, ::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 add_access_config(access_config_resource: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `add_access_config` 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).
@@ -306,21 +313,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.add_access_config.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.add_access_config.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.add_access_config.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.add_access_config request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -331,16 +342,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
##
# Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
#
@@ -351,12 +358,10 @@
# @param request [::Google::Cloud::Compute::V1::AddResourcePoliciesInstanceRequest, ::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 add_resource_policies(instance: nil, instances_add_resource_policies_request_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `add_resource_policies` 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).
@@ -387,21 +392,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.add_resource_policies.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.add_resource_policies.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.add_resource_policies.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.add_resource_policies request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -412,16 +421,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 an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances.
#
@@ -432,12 +437,10 @@
# @param request [::Google::Cloud::Compute::V1::AggregatedListInstancesRequest, ::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).
@@ -472,33 +475,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
@instances_stub.aggregated_list request, options do |result, response|
result = ::Gapic::Rest::PagedEnumerable.new @instances_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
##
# Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
#
@@ -509,12 +512,10 @@
# @param request [::Google::Cloud::Compute::V1::AttachDiskInstanceRequest, ::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 attach_disk(attached_disk_resource: nil, force_attach: nil, instance: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `attach_disk` 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).
@@ -547,21 +548,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.attach_disk.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.attach_disk.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.attach_disk.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.attach_disk request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -572,16 +577,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 multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.
#
@@ -592,12 +593,10 @@
# @param request [::Google::Cloud::Compute::V1::BulkInsertInstanceRequest, ::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 bulk_insert(bulk_insert_instance_resource_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `bulk_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).
@@ -626,21 +625,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.bulk_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.bulk_insert.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.bulk_insert.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.bulk_insert request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -651,16 +654,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 Instance resource. For more information, see Deleting an instance.
#
@@ -671,12 +670,10 @@
# @param request [::Google::Cloud::Compute::V1::DeleteInstanceRequest, ::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: 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).
@@ -705,21 +702,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
@instances_stub.delete request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -730,16 +731,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 an access config from an instance's network interface.
#
@@ -750,12 +747,10 @@
# @param request [::Google::Cloud::Compute::V1::DeleteAccessConfigInstanceRequest, ::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_access_config(access_config: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `delete_access_config` 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).
@@ -788,21 +783,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.delete_access_config.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_access_config.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.delete_access_config.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.delete_access_config request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -813,16 +812,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
##
# Detaches a disk from an instance.
#
@@ -833,12 +828,10 @@
# @param request [::Google::Cloud::Compute::V1::DetachDiskInstanceRequest, ::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 detach_disk(device_name: nil, instance: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `detach_disk` 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).
@@ -869,21 +862,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.detach_disk.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.detach_disk.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.detach_disk.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.detach_disk request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -894,16 +891,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 the specified Instance resource. Gets a list of available instances by making a list() request.
#
@@ -914,12 +907,10 @@
# @param request [::Google::Cloud::Compute::V1::GetInstanceRequest, ::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: 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).
@@ -946,32 +937,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
@instances_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
##
# Returns effective firewalls applied to an interface of the instance.
#
@@ -982,12 +973,10 @@
# @param request [::Google::Cloud::Compute::V1::GetEffectiveFirewallsInstanceRequest, ::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_effective_firewalls(instance: nil, network_interface: nil, project: nil, zone: nil)
# Pass arguments to `get_effective_firewalls` 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).
@@ -1016,32 +1005,32 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.get_effective_firewalls.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_effective_firewalls.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.get_effective_firewalls.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.get_effective_firewalls 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
##
# Returns the specified guest attributes entry.
#
@@ -1052,12 +1041,10 @@
# @param request [::Google::Cloud::Compute::V1::GetGuestAttributesInstanceRequest, ::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_guest_attributes(instance: nil, project: nil, query_path: nil, variable_key: nil, zone: nil)
# Pass arguments to `get_guest_attributes` 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).
@@ -1088,32 +1075,32 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.get_guest_attributes.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_guest_attributes.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.get_guest_attributes.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.get_guest_attributes 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
##
# Gets the access control policy for a resource. May be empty if no such policy or resource exists.
#
@@ -1124,12 +1111,10 @@
# @param request [::Google::Cloud::Compute::V1::GetIamPolicyInstanceRequest, ::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_iam_policy(options_requested_policy_version: nil, project: nil, resource: nil, zone: nil)
# Pass arguments to `get_iam_policy` 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).
@@ -1158,32 +1143,32 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.get_iam_policy.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_iam_policy.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.get_iam_policy 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
##
# Returns the screenshot from the specified instance.
#
@@ -1194,12 +1179,10 @@
# @param request [::Google::Cloud::Compute::V1::GetScreenshotInstanceRequest, ::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_screenshot(instance: nil, project: nil, zone: nil)
# Pass arguments to `get_screenshot` 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).
@@ -1226,32 +1209,32 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.get_screenshot.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_screenshot.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.get_screenshot.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.get_screenshot 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
##
# Returns the last 1 MB of serial port output from the specified instance.
#
@@ -1262,12 +1245,10 @@
# @param request [::Google::Cloud::Compute::V1::GetSerialPortOutputInstanceRequest, ::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_serial_port_output(instance: nil, port: nil, project: nil, start: nil, zone: nil)
# Pass arguments to `get_serial_port_output` 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).
@@ -1298,32 +1279,32 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.get_serial_port_output.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_serial_port_output.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.get_serial_port_output.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.get_serial_port_output 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
##
# Returns the Shielded Instance Identity of an instance
#
@@ -1334,12 +1315,10 @@
# @param request [::Google::Cloud::Compute::V1::GetShieldedInstanceIdentityInstanceRequest, ::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_shielded_instance_identity(instance: nil, project: nil, zone: nil)
# Pass arguments to `get_shielded_instance_identity` 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).
@@ -1366,32 +1345,32 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.get_shielded_instance_identity.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_shielded_instance_identity.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.get_shielded_instance_identity.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.get_shielded_instance_identity 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 an instance resource in the specified project using the data included in the request.
#
@@ -1402,12 +1381,10 @@
# @param request [::Google::Cloud::Compute::V1::InsertInstanceRequest, ::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_resource: nil, project: nil, request_id: nil, source_instance_template: nil, source_machine_image: 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).
@@ -1440,21 +1417,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
@instances_stub.insert request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -1465,16 +1446,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 instances contained within the specified zone.
#
@@ -1485,12 +1462,10 @@
# @param request [::Google::Cloud::Compute::V1::ListInstancesRequest, ::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).
@@ -1525,33 +1500,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
@instances_stub.list request, options do |result, response|
result = ::Gapic::Rest::PagedEnumerable.new @instances_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
##
# Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.
#
@@ -1562,12 +1537,10 @@
# @param request [::Google::Cloud::Compute::V1::ListReferrersInstancesRequest, ::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_referrers(filter: nil, instance: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil)
# Pass arguments to `list_referrers` 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).
@@ -1604,33 +1577,33 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.list_referrers.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_referrers.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.list_referrers.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.list_referrers request, options do |result, response|
result = ::Gapic::Rest::PagedEnumerable.new @instances_stub, :list_referrers, "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
##
# Removes resource policies from an instance.
#
@@ -1641,12 +1614,10 @@
# @param request [::Google::Cloud::Compute::V1::RemoveResourcePoliciesInstanceRequest, ::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 remove_resource_policies(instance: nil, instances_remove_resource_policies_request_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `remove_resource_policies` 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).
@@ -1677,21 +1648,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.remove_resource_policies.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.remove_resource_policies.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.remove_resource_policies.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.remove_resource_policies request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -1702,16 +1677,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
##
# Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.
#
@@ -1722,12 +1693,10 @@
# @param request [::Google::Cloud::Compute::V1::ResetInstanceRequest, ::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 reset(instance: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `reset` 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).
@@ -1756,21 +1725,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.reset.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.reset.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.reset.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.reset request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -1781,16 +1754,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
##
# Resumes an instance that was suspended using the instances().suspend method.
#
@@ -1801,12 +1770,10 @@
# @param request [::Google::Cloud::Compute::V1::ResumeInstanceRequest, ::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 resume(instance: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `resume` 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).
@@ -1835,21 +1802,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.resume.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.resume.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.resume.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.resume request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -1860,16 +1831,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
##
# Sends diagnostic interrupt to the instance.
#
@@ -1880,12 +1847,10 @@
# @param request [::Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceRequest, ::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 send_diagnostic_interrupt(instance: nil, project: nil, zone: nil)
# Pass arguments to `send_diagnostic_interrupt` 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).
@@ -1912,32 +1877,32 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.send_diagnostic_interrupt.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.send_diagnostic_interrupt.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.send_diagnostic_interrupt.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.send_diagnostic_interrupt 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
##
# Sets deletion protection on the instance.
#
@@ -1948,12 +1913,10 @@
# @param request [::Google::Cloud::Compute::V1::SetDeletionProtectionInstanceRequest, ::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_deletion_protection(deletion_protection: nil, project: nil, request_id: nil, resource: nil, zone: nil)
# Pass arguments to `set_deletion_protection` 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).
@@ -1984,21 +1947,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_deletion_protection.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_deletion_protection.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_deletion_protection.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_deletion_protection request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2009,16 +1976,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
##
# Sets the auto-delete flag for a disk attached to an instance.
#
@@ -2029,12 +1992,10 @@
# @param request [::Google::Cloud::Compute::V1::SetDiskAutoDeleteInstanceRequest, ::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_disk_auto_delete(auto_delete: nil, device_name: nil, instance: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `set_disk_auto_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).
@@ -2067,21 +2028,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_disk_auto_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.set_disk_auto_delete.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_disk_auto_delete.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_disk_auto_delete request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2092,16 +2057,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
##
# Sets the access control policy on the specified resource. Replaces any existing policy.
#
@@ -2112,12 +2073,10 @@
# @param request [::Google::Cloud::Compute::V1::SetIamPolicyInstanceRequest, ::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_iam_policy(project: nil, resource: nil, zone: nil, zone_set_policy_request_resource: nil)
# Pass arguments to `set_iam_policy` 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).
@@ -2146,32 +2105,32 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_iam_policy.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_iam_policy.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_iam_policy 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
##
# Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
#
@@ -2182,12 +2141,10 @@
# @param request [::Google::Cloud::Compute::V1::SetLabelsInstanceRequest, ::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_labels(instance: nil, instances_set_labels_request_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `set_labels` 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).
@@ -2218,21 +2175,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_labels.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_labels.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_labels.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_labels request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2243,16 +2204,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
##
# Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
#
@@ -2263,12 +2220,10 @@
# @param request [::Google::Cloud::Compute::V1::SetMachineResourcesInstanceRequest, ::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_machine_resources(instance: nil, instances_set_machine_resources_request_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `set_machine_resources` 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).
@@ -2299,21 +2254,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_machine_resources.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_machine_resources.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_machine_resources.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_machine_resources request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2324,16 +2283,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
##
# Changes the machine type for a stopped instance to the machine type specified in the request.
#
@@ -2344,12 +2299,10 @@
# @param request [::Google::Cloud::Compute::V1::SetMachineTypeInstanceRequest, ::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_machine_type(instance: nil, instances_set_machine_type_request_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `set_machine_type` 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).
@@ -2380,21 +2333,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_machine_type.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_machine_type.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_machine_type.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_machine_type request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2405,16 +2362,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
##
# Sets metadata for the specified instance to the data included in the request.
#
@@ -2425,12 +2378,10 @@
# @param request [::Google::Cloud::Compute::V1::SetMetadataInstanceRequest, ::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_metadata(instance: nil, metadata_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `set_metadata` 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).
@@ -2461,21 +2412,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_metadata.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_metadata.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_metadata.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_metadata request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2486,16 +2441,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
##
# Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
#
@@ -2506,12 +2457,10 @@
# @param request [::Google::Cloud::Compute::V1::SetMinCpuPlatformInstanceRequest, ::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_min_cpu_platform(instance: nil, instances_set_min_cpu_platform_request_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `set_min_cpu_platform` 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).
@@ -2542,21 +2491,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_min_cpu_platform.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_min_cpu_platform.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_min_cpu_platform.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_min_cpu_platform request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2567,16 +2520,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
##
# Sets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a `TERMINATED` state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.
#
@@ -2587,12 +2536,10 @@
# @param request [::Google::Cloud::Compute::V1::SetSchedulingInstanceRequest, ::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_scheduling(instance: nil, project: nil, request_id: nil, scheduling_resource: nil, zone: nil)
# Pass arguments to `set_scheduling` 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).
@@ -2623,21 +2570,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_scheduling.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_scheduling.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_scheduling.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_scheduling request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2648,16 +2599,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
##
# Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
#
@@ -2668,12 +2615,10 @@
# @param request [::Google::Cloud::Compute::V1::SetServiceAccountInstanceRequest, ::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_service_account(instance: nil, instances_set_service_account_request_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `set_service_account` 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).
@@ -2704,21 +2649,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_service_account.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_service_account.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_service_account.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_service_account request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2729,16 +2678,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
##
# Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
#
@@ -2749,12 +2694,10 @@
# @param request [::Google::Cloud::Compute::V1::SetShieldedInstanceIntegrityPolicyInstanceRequest, ::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_shielded_instance_integrity_policy(instance: nil, project: nil, request_id: nil, shielded_instance_integrity_policy_resource: nil, zone: nil)
# Pass arguments to `set_shielded_instance_integrity_policy` 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).
@@ -2785,21 +2728,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_shielded_instance_integrity_policy.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_shielded_instance_integrity_policy.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_shielded_instance_integrity_policy.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_shielded_instance_integrity_policy request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2810,16 +2757,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
##
# Sets network tags for the specified instance to the data included in the request.
#
@@ -2830,12 +2773,10 @@
# @param request [::Google::Cloud::Compute::V1::SetTagsInstanceRequest, ::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_tags(instance: nil, project: nil, request_id: nil, tags_resource: nil, zone: nil)
# Pass arguments to `set_tags` 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).
@@ -2866,21 +2807,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.set_tags.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_tags.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.set_tags.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.set_tags request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2891,16 +2836,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
##
# Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
#
@@ -2911,12 +2852,10 @@
# @param request [::Google::Cloud::Compute::V1::SimulateMaintenanceEventInstanceRequest, ::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 simulate_maintenance_event(instance: nil, project: nil, zone: nil)
# Pass arguments to `simulate_maintenance_event` 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).
@@ -2943,21 +2882,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.simulate_maintenance_event.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.simulate_maintenance_event.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.simulate_maintenance_event.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.simulate_maintenance_event request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -2968,16 +2911,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
##
# Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
#
@@ -2988,12 +2927,10 @@
# @param request [::Google::Cloud::Compute::V1::StartInstanceRequest, ::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 start(instance: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `start` 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).
@@ -3022,21 +2959,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.start.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.start.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.start.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.start request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -3047,16 +2988,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
##
# Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
#
@@ -3067,12 +3004,10 @@
# @param request [::Google::Cloud::Compute::V1::StartWithEncryptionKeyInstanceRequest, ::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 start_with_encryption_key(instance: nil, instances_start_with_encryption_key_request_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `start_with_encryption_key` 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).
@@ -3103,21 +3038,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.start_with_encryption_key.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.start_with_encryption_key.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.start_with_encryption_key.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.start_with_encryption_key request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -3128,16 +3067,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
##
# Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
#
@@ -3148,18 +3083,18 @@
# @param request [::Google::Cloud::Compute::V1::StopInstanceRequest, ::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 stop(instance: nil, project: nil, request_id: nil, zone: nil)
+ # @overload stop(discard_local_ssd: nil, instance: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `stop` 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).
#
+ # @param discard_local_ssd [::Boolean]
+ # If true, discard the contents of any attached localSSD partitions. Default value is false.
# @param instance [::String]
# Name of the instance resource to stop.
# @param project [::String]
# Project ID for this request.
# @param request_id [::String]
@@ -3182,21 +3117,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.stop.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.stop.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.stop.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.stop request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -3207,16 +3146,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
##
# This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
#
@@ -3227,18 +3162,18 @@
# @param request [::Google::Cloud::Compute::V1::SuspendInstanceRequest, ::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 suspend(instance: nil, project: nil, request_id: nil, zone: nil)
+ # @overload suspend(discard_local_ssd: nil, instance: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `suspend` 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).
#
+ # @param discard_local_ssd [::Boolean]
+ # If true, discard the contents of any attached localSSD partitions. Default value is false.
# @param instance [::String]
# Name of the instance resource to suspend.
# @param project [::String]
# Project ID for this request.
# @param request_id [::String]
@@ -3261,21 +3196,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.suspend.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.suspend.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.suspend.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.suspend request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -3286,16 +3225,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 permissions that a caller has on the specified resource.
#
@@ -3306,12 +3241,10 @@
# @param request [::Google::Cloud::Compute::V1::TestIamPermissionsInstanceRequest, ::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 test_iam_permissions(project: nil, resource: nil, test_permissions_request_resource: nil, zone: nil)
# Pass arguments to `test_iam_permissions` 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).
@@ -3340,32 +3273,32 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.test_iam_permissions.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.test_iam_permissions.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.test_iam_permissions 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
##
# Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
#
@@ -3376,12 +3309,10 @@
# @param request [::Google::Cloud::Compute::V1::UpdateInstanceRequest, ::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(instance: nil, instance_resource: nil, minimal_action: nil, most_disruptive_allowed_action: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `update` 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).
@@ -3418,21 +3349,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.update.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.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.update.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.update request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -3443,16 +3378,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
##
# Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
#
@@ -3463,12 +3394,10 @@
# @param request [::Google::Cloud::Compute::V1::UpdateAccessConfigInstanceRequest, ::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_access_config(access_config_resource: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `update_access_config` 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).
@@ -3501,21 +3430,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.update_access_config.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_access_config.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.update_access_config.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.update_access_config request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -3526,16 +3459,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
##
# Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
#
@@ -3546,12 +3475,10 @@
# @param request [::Google::Cloud::Compute::V1::UpdateDisplayDeviceInstanceRequest, ::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_display_device(display_device_resource: nil, instance: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `update_display_device` 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).
@@ -3582,21 +3509,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.update_display_device.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_display_device.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.update_display_device.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.update_display_device request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -3607,16 +3538,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
##
# Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
#
@@ -3627,12 +3554,10 @@
# @param request [::Google::Cloud::Compute::V1::UpdateNetworkInterfaceInstanceRequest, ::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_network_interface(instance: nil, network_interface: nil, network_interface_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `update_network_interface` 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).
@@ -3665,21 +3590,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.update_network_interface.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_network_interface.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.update_network_interface.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.update_network_interface request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -3690,16 +3619,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
##
# Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
#
@@ -3710,12 +3635,10 @@
# @param request [::Google::Cloud::Compute::V1::UpdateShieldedInstanceConfigInstanceRequest, ::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_shielded_instance_config(instance: nil, project: nil, request_id: nil, shielded_instance_config_resource: nil, zone: nil)
# Pass arguments to `update_shielded_instance_config` 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).
@@ -3746,21 +3669,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.update_shielded_instance_config.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_shielded_instance_config.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.update_shielded_instance_config.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@instances_stub.update_shielded_instance_config request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -3771,41 +3698,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 Instances REST API.
#
# This class represents the configuration for Instances 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::Instances::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
+ # # add_access_config to 20 seconds,
+ # # and all remaining timeouts to 10 seconds.
+ # ::Google::Cloud::Compute::V1::Instances::Rest::Client.configure do |config|
+ # config.timeout = 10.0
+ # config.rpcs.add_access_config.timeout = 20.0
+ # end
#
- # ::Google::Cloud::Compute::V1::Instances::Client.configure do |config|
- # config.timeout = 10.0
- # end
+ # # Apply the above configuration only to a new client.
+ # client = ::Google::Cloud::Compute::V1::Instances::Rest::Client.new do |config|
+ # config.timeout = 10.0
+ # config.rpcs.add_access_config.timeout = 20.0
+ # end
#
- # To apply the above configuration only to a new client:
- #
- # client = ::Google::Cloud::Compute::V1::Instances::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
@@ -3829,12 +3758,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
@@ -3845,10 +3785,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?
@@ -3873,12 +3815,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 `add_access_config`
# @return [::Gapic::Config::Method]