Google Cloud Compute V1 API - Class Google::Cloud::Compute::V1::Instances::Rest::Client (v2.12.0)

Reference documentation and code samples for the Google Cloud Compute V1 API class Google::Cloud::Compute::V1::Instances::Rest::Client.

REST client for the Instances service.

The Instances API.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the Instances Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all Instances clients
::Google::Cloud::Compute::V1::Instances::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#add_access_config

def add_access_config(request, options = nil) -> ::Gapic::GenericLRO::Operation
def add_access_config(access_config_resource: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Adds an access config to an instance's network interface.

Overloads
def add_access_config(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to add_access_config via a request object, either of type AddAccessConfigInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def add_access_config(access_config_resource: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • access_config_resource (::Google::Cloud::Compute::V1::AccessConfig, ::Hash) — The body resource for this request
  • instance (::String) — The instance name for this request.
  • network_interface (::String) — The name of the network interface to add to this instance.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::AddAccessConfigInstanceRequest.new

# Call the add_access_config method.
result = client.add_access_config request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#add_resource_policies

def add_resource_policies(request, options = nil) -> ::Gapic::GenericLRO::Operation
def add_resource_policies(instance: nil, instances_add_resource_policies_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def add_resource_policies(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to add_resource_policies via a request object, either of type AddResourcePoliciesInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def add_resource_policies(instance: nil, instances_add_resource_policies_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — The instance name for this request.
  • instances_add_resource_policies_request_resource (::Google::Cloud::Compute::V1::InstancesAddResourcePoliciesRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::AddResourcePoliciesInstanceRequest.new

# Call the add_resource_policies method.
result = client.add_resource_policies request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#aggregated_list

def aggregated_list(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstancesScopedList>
def aggregated_list(filter: nil, include_all_scopes: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, service_project_number: nil) -> ::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstancesScopedList>

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. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

Overloads
def aggregated_list(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstancesScopedList>
Pass arguments to aggregated_list via a request object, either of type AggregatedListInstancesRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def aggregated_list(filter: nil, include_all_scopes: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, service_project_number: nil) -> ::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstancesScopedList>
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).
Parameters
  • filter (::String) — A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either =, !=, >, <, <=, >= or :. For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. The :* comparison can be used to test whether a key has been defined. For example, to find all objects with owner label use: labels.owner:* You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example: (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) If you want to use a regular expression, use the eq (equal) or ne (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: fieldname eq unquoted literal fieldname eq 'single quoted literal' fieldname eq "double quoted literal" (fieldname1 eq literal) (fieldname2 ne "literal") The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use name ne .*instance. You cannot combine constraints on multiple fields using regular expressions.
  • include_all_scopes (::Boolean) — Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included.
  • max_results (::Integer) — The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500)
  • order_by (::String) — Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by name or creationTimestamp desc is supported.
  • page_token (::String) — Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
  • project (::String) — Project ID for this request.
  • return_partial_success (::Boolean) — Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code.
  • service_project_number (::Integer) — The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstancesScopedList>)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstancesScopedList>)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::AggregatedListInstancesRequest.new

# Call the aggregated_list method.
result = client.aggregated_list request

# The returned object is of type Google::Cloud::Compute::V1::InstanceAggregatedList.
p result

#attach_disk

def attach_disk(request, options = nil) -> ::Gapic::GenericLRO::Operation
def attach_disk(attached_disk_resource: nil, force_attach: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def attach_disk(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to attach_disk via a request object, either of type AttachDiskInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def attach_disk(attached_disk_resource: nil, force_attach: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • attached_disk_resource (::Google::Cloud::Compute::V1::AttachedDisk, ::Hash) — The body resource for this request
  • force_attach (::Boolean) — Whether to force attach the regional disk even if it's currently attached to another instance. If you try to force attach a zonal disk to an instance, you will receive an error.
  • instance (::String) — The instance name for this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::AttachDiskInstanceRequest.new

# Call the attach_disk method.
result = client.attach_disk request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#bulk_insert

def bulk_insert(request, options = nil) -> ::Gapic::GenericLRO::Operation
def bulk_insert(bulk_insert_instance_resource_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.

Overloads
def bulk_insert(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to bulk_insert via a request object, either of type BulkInsertInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def bulk_insert(bulk_insert_instance_resource_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • bulk_insert_instance_resource_resource (::Google::Cloud::Compute::V1::BulkInsertInstanceResource, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::BulkInsertInstanceRequest.new

# Call the bulk_insert method.
result = client.bulk_insert request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the Instances Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#delete

def delete(request, options = nil) -> ::Gapic::GenericLRO::Operation
def delete(instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Deletes the specified Instance resource. For more information, see Deleting an instance.

Overloads
def delete(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to delete via a request object, either of type DeleteInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete(instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance resource to delete.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::DeleteInstanceRequest.new

# Call the delete method.
result = client.delete request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#delete_access_config

def delete_access_config(request, options = nil) -> ::Gapic::GenericLRO::Operation
def delete_access_config(access_config: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Deletes an access config from an instance's network interface.

Overloads
def delete_access_config(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to delete_access_config via a request object, either of type DeleteAccessConfigInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_access_config(access_config: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • access_config (::String) — The name of the access config to delete.
  • instance (::String) — The instance name for this request.
  • network_interface (::String) — The name of the network interface.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::DeleteAccessConfigInstanceRequest.new

# Call the delete_access_config method.
result = client.delete_access_config request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#detach_disk

def detach_disk(request, options = nil) -> ::Gapic::GenericLRO::Operation
def detach_disk(device_name: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Detaches a disk from an instance.

Overloads
def detach_disk(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to detach_disk via a request object, either of type DetachDiskInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def detach_disk(device_name: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • device_name (::String) — The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names.
  • instance (::String) — Instance name for this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::DetachDiskInstanceRequest.new

# Call the detach_disk method.
result = client.detach_disk request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#get

def get(request, options = nil) -> ::Google::Cloud::Compute::V1::Instance
def get(instance: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::Instance

Returns the specified Instance resource.

Overloads
def get(request, options = nil) -> ::Google::Cloud::Compute::V1::Instance
Pass arguments to get via a request object, either of type GetInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get(instance: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::Instance
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).
Parameters
  • instance (::String) — Name of the instance resource to return.
  • project (::String) — Project ID for this request.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::GetInstanceRequest.new

# Call the get method.
result = client.get request

# The returned object is of type Google::Cloud::Compute::V1::Instance.
p result

#get_effective_firewalls

def get_effective_firewalls(request, options = nil) -> ::Google::Cloud::Compute::V1::InstancesGetEffectiveFirewallsResponse
def get_effective_firewalls(instance: nil, network_interface: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::InstancesGetEffectiveFirewallsResponse

Returns effective firewalls applied to an interface of the instance.

Overloads
def get_effective_firewalls(request, options = nil) -> ::Google::Cloud::Compute::V1::InstancesGetEffectiveFirewallsResponse
Pass arguments to get_effective_firewalls via a request object, either of type GetEffectiveFirewallsInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_effective_firewalls(instance: nil, network_interface: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::InstancesGetEffectiveFirewallsResponse
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • network_interface (::String) — The name of the network interface to get the effective firewalls.
  • project (::String) — Project ID for this request.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::GetEffectiveFirewallsInstanceRequest.new

# Call the get_effective_firewalls method.
result = client.get_effective_firewalls request

# The returned object is of type Google::Cloud::Compute::V1::InstancesGetEffectiveFirewallsResponse.
p result

#get_guest_attributes

def get_guest_attributes(request, options = nil) -> ::Google::Cloud::Compute::V1::GuestAttributes
def get_guest_attributes(instance: nil, project: nil, query_path: nil, variable_key: nil, zone: nil) -> ::Google::Cloud::Compute::V1::GuestAttributes

Returns the specified guest attributes entry.

Overloads
def get_guest_attributes(request, options = nil) -> ::Google::Cloud::Compute::V1::GuestAttributes
Pass arguments to get_guest_attributes via a request object, either of type GetGuestAttributesInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_guest_attributes(instance: nil, project: nil, query_path: nil, variable_key: nil, zone: nil) -> ::Google::Cloud::Compute::V1::GuestAttributes
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • query_path (::String) — Specifies the guest attributes path to be queried.
  • variable_key (::String) — Specifies the key for the guest attributes entry.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::GetGuestAttributesInstanceRequest.new

# Call the get_guest_attributes method.
result = client.get_guest_attributes request

# The returned object is of type Google::Cloud::Compute::V1::GuestAttributes.
p result

#get_iam_policy

def get_iam_policy(request, options = nil) -> ::Google::Cloud::Compute::V1::Policy
def get_iam_policy(options_requested_policy_version: nil, project: nil, resource: nil, zone: nil) -> ::Google::Cloud::Compute::V1::Policy

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Overloads
def get_iam_policy(request, options = nil) -> ::Google::Cloud::Compute::V1::Policy
Pass arguments to get_iam_policy via a request object, either of type GetIamPolicyInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_iam_policy(options_requested_policy_version: nil, project: nil, resource: nil, zone: nil) -> ::Google::Cloud::Compute::V1::Policy
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).
Parameters
  • options_requested_policy_version (::Integer) — Requested IAM Policy version.
  • project (::String) — Project ID for this request.
  • resource (::String) — Name or id of the resource for this request.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::GetIamPolicyInstanceRequest.new

# Call the get_iam_policy method.
result = client.get_iam_policy request

# The returned object is of type Google::Cloud::Compute::V1::Policy.
p result

#get_screenshot

def get_screenshot(request, options = nil) -> ::Google::Cloud::Compute::V1::Screenshot
def get_screenshot(instance: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::Screenshot

Returns the screenshot from the specified instance.

Overloads
def get_screenshot(request, options = nil) -> ::Google::Cloud::Compute::V1::Screenshot
Pass arguments to get_screenshot via a request object, either of type GetScreenshotInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_screenshot(instance: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::Screenshot
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::GetScreenshotInstanceRequest.new

# Call the get_screenshot method.
result = client.get_screenshot request

# The returned object is of type Google::Cloud::Compute::V1::Screenshot.
p result

#get_serial_port_output

def get_serial_port_output(request, options = nil) -> ::Google::Cloud::Compute::V1::SerialPortOutput
def get_serial_port_output(instance: nil, port: nil, project: nil, start: nil, zone: nil) -> ::Google::Cloud::Compute::V1::SerialPortOutput

Returns the last 1 MB of serial port output from the specified instance.

Overloads
def get_serial_port_output(request, options = nil) -> ::Google::Cloud::Compute::V1::SerialPortOutput
Pass arguments to get_serial_port_output via a request object, either of type GetSerialPortOutputInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_serial_port_output(instance: nil, port: nil, project: nil, start: nil, zone: nil) -> ::Google::Cloud::Compute::V1::SerialPortOutput
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).
Parameters
  • instance (::String) — Name of the instance for this request.
  • port (::Integer) — Specifies which COM or serial port to retrieve data from.
  • project (::String) — Project ID for this request.
  • start (::Integer) — Specifies the starting byte position of the output to return. To start with the first byte of output to the specified port, omit this field or set it to 0. If the output for that byte position is available, this field matches the start parameter sent with the request. If the amount of serial console output exceeds the size of the buffer (1 MB), the oldest output is discarded and is no longer available. If the requested start position refers to discarded output, the start position is adjusted to the oldest output still available, and the adjusted start position is returned as the start property value. You can also provide a negative start position, which translates to the most recent number of bytes written to the serial port. For example, -3 is interpreted as the most recent 3 bytes written to the serial console.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::GetSerialPortOutputInstanceRequest.new

# Call the get_serial_port_output method.
result = client.get_serial_port_output request

# The returned object is of type Google::Cloud::Compute::V1::SerialPortOutput.
p result

#get_shielded_instance_identity

def get_shielded_instance_identity(request, options = nil) -> ::Google::Cloud::Compute::V1::ShieldedInstanceIdentity
def get_shielded_instance_identity(instance: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::ShieldedInstanceIdentity

Returns the Shielded Instance Identity of an instance

Overloads
def get_shielded_instance_identity(request, options = nil) -> ::Google::Cloud::Compute::V1::ShieldedInstanceIdentity
Pass arguments to get_shielded_instance_identity via a request object, either of type GetShieldedInstanceIdentityInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_shielded_instance_identity(instance: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::ShieldedInstanceIdentity
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).
Parameters
  • instance (::String) — Name or id of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::GetShieldedInstanceIdentityInstanceRequest.new

# Call the get_shielded_instance_identity method.
result = client.get_shielded_instance_identity request

# The returned object is of type Google::Cloud::Compute::V1::ShieldedInstanceIdentity.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new Instances REST client object.

Yields
  • (config) — Configure the Instances client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Compute::V1::Instances::Rest::Client.new do |config|
  config.timeout = 10.0
end

#insert

def insert(request, options = nil) -> ::Gapic::GenericLRO::Operation
def insert(instance_resource: nil, project: nil, request_id: nil, source_instance_template: nil, source_machine_image: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Creates an instance resource in the specified project using the data included in the request.

Overloads
def insert(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to insert via a request object, either of type Google::Cloud::Compute::V1::InsertInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def insert(instance_resource: nil, project: nil, request_id: nil, source_instance_template: nil, source_machine_image: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance_resource (::Google::Cloud::Compute::V1::Instance, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • source_instance_template (::String) — Specifies instance template to create the instance. This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to an instance template: - https://www.googleapis.com/compute/v1/projects/project /global/instanceTemplates/instanceTemplate - projects/project/global/instanceTemplates/instanceTemplate - global/instanceTemplates/instanceTemplate
  • source_machine_image (::String) — Specifies the machine image to use to create the instance. This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to a machine image: - https://www.googleapis.com/compute/v1/projects/project/global/global /machineImages/machineImage - projects/project/global/global/machineImages/machineImage - global/machineImages/machineImage
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::InsertInstanceRequest.new

# Call the insert method.
result = client.insert request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#list

def list(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Instance>
def list(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Instance>

Retrieves the list of instances contained within the specified zone.

Overloads
def list(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Instance>
Pass arguments to list via a request object, either of type ListInstancesRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Instance>
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).
Parameters
  • filter (::String) — A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either =, !=, >, <, <=, >= or :. For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. The :* comparison can be used to test whether a key has been defined. For example, to find all objects with owner label use: labels.owner:* You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example: (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) If you want to use a regular expression, use the eq (equal) or ne (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: fieldname eq unquoted literal fieldname eq 'single quoted literal' fieldname eq "double quoted literal" (fieldname1 eq literal) (fieldname2 ne "literal") The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use name ne .*instance. You cannot combine constraints on multiple fields using regular expressions.
  • max_results (::Integer) — The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500)
  • order_by (::String) — Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by name or creationTimestamp desc is supported.
  • page_token (::String) — Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
  • project (::String) — Project ID for this request.
  • return_partial_success (::Boolean) — Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::ListInstancesRequest.new

# Call the list method.
result = client.list request

# The returned object is of type Google::Cloud::Compute::V1::InstanceList.
p result

#list_referrers

def list_referrers(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Reference>
def list_referrers(filter: nil, instance: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Reference>

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.

Overloads
def list_referrers(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Reference>
Pass arguments to list_referrers via a request object, either of type ListReferrersInstancesRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_referrers(filter: nil, instance: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Reference>
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).
Parameters
  • filter (::String) — A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either =, !=, >, <, <=, >= or :. For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. The :* comparison can be used to test whether a key has been defined. For example, to find all objects with owner label use: labels.owner:* You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example: (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) If you want to use a regular expression, use the eq (equal) or ne (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: fieldname eq unquoted literal fieldname eq 'single quoted literal' fieldname eq "double quoted literal" (fieldname1 eq literal) (fieldname2 ne "literal") The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use name ne .*instance. You cannot combine constraints on multiple fields using regular expressions.
  • instance (::String) — Name of the target instance scoping this request, or '-' if the request should span over all instances in the container.
  • max_results (::Integer) — The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500)
  • order_by (::String) — Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by name or creationTimestamp desc is supported.
  • page_token (::String) — Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
  • project (::String) — Project ID for this request.
  • return_partial_success (::Boolean) — Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::ListReferrersInstancesRequest.new

# Call the list_referrers method.
result = client.list_referrers request

# The returned object is of type Google::Cloud::Compute::V1::InstanceListReferrers.
p result

#perform_maintenance

def perform_maintenance(request, options = nil) -> ::Gapic::GenericLRO::Operation
def perform_maintenance(instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Perform a manual maintenance on the instance.

Overloads
def perform_maintenance(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to perform_maintenance via a request object, either of type PerformMaintenanceInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::PerformMaintenanceInstanceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def perform_maintenance(instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to perform_maintenance 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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::PerformMaintenanceInstanceRequest.new

# Call the perform_maintenance method.
result = client.perform_maintenance request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#remove_resource_policies

def remove_resource_policies(request, options = nil) -> ::Gapic::GenericLRO::Operation
def remove_resource_policies(instance: nil, instances_remove_resource_policies_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Removes resource policies from an instance.

Overloads
def remove_resource_policies(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to remove_resource_policies via a request object, either of type RemoveResourcePoliciesInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def remove_resource_policies(instance: nil, instances_remove_resource_policies_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — The instance name for this request.
  • instances_remove_resource_policies_request_resource (::Google::Cloud::Compute::V1::InstancesRemoveResourcePoliciesRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::RemoveResourcePoliciesInstanceRequest.new

# Call the remove_resource_policies method.
result = client.remove_resource_policies request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#reset

def reset(request, options = nil) -> ::Gapic::GenericLRO::Operation
def reset(instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def reset(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to reset via a request object, either of type ResetInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def reset(instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::ResetInstanceRequest.new

# Call the reset method.
result = client.reset request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#resume

def resume(request, options = nil) -> ::Gapic::GenericLRO::Operation
def resume(instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Resumes an instance that was suspended using the instances().suspend method.

Overloads
def resume(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to resume via a request object, either of type ResumeInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def resume(instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance resource to resume.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::ResumeInstanceRequest.new

# Call the resume method.
result = client.resume request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#send_diagnostic_interrupt

def send_diagnostic_interrupt(request, options = nil) -> ::Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceResponse
def send_diagnostic_interrupt(instance: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceResponse

Sends diagnostic interrupt to the instance.

Overloads
def send_diagnostic_interrupt(request, options = nil) -> ::Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceResponse
Pass arguments to send_diagnostic_interrupt via a request object, either of type SendDiagnosticInterruptInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def send_diagnostic_interrupt(instance: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceResponse
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceRequest.new

# Call the send_diagnostic_interrupt method.
result = client.send_diagnostic_interrupt request

# The returned object is of type Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceResponse.
p result

#set_deletion_protection

def set_deletion_protection(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_deletion_protection(deletion_protection: nil, project: nil, request_id: nil, resource: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Sets deletion protection on the instance.

Overloads
def set_deletion_protection(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_deletion_protection via a request object, either of type SetDeletionProtectionInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_deletion_protection(deletion_protection: nil, project: nil, request_id: nil, resource: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • deletion_protection (::Boolean) — Whether the resource should be protected against deletion.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • resource (::String) — Name or id of the resource for this request.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetDeletionProtectionInstanceRequest.new

# Call the set_deletion_protection method.
result = client.set_deletion_protection request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_disk_auto_delete

def set_disk_auto_delete(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_disk_auto_delete(auto_delete: nil, device_name: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Sets the auto-delete flag for a disk attached to an instance.

Overloads
def set_disk_auto_delete(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_disk_auto_delete via a request object, either of type SetDiskAutoDeleteInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_disk_auto_delete(auto_delete: nil, device_name: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • auto_delete (::Boolean) — Whether to auto-delete the disk when the instance is deleted.
  • device_name (::String) — The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names.
  • instance (::String) — The instance name for this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetDiskAutoDeleteInstanceRequest.new

# Call the set_disk_auto_delete method.
result = client.set_disk_auto_delete request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_iam_policy

def set_iam_policy(request, options = nil) -> ::Google::Cloud::Compute::V1::Policy
def set_iam_policy(project: nil, resource: nil, zone: nil, zone_set_policy_request_resource: nil) -> ::Google::Cloud::Compute::V1::Policy

Sets the access control policy on the specified resource. Replaces any existing policy.

Overloads
def set_iam_policy(request, options = nil) -> ::Google::Cloud::Compute::V1::Policy
Pass arguments to set_iam_policy via a request object, either of type SetIamPolicyInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_iam_policy(project: nil, resource: nil, zone: nil, zone_set_policy_request_resource: nil) -> ::Google::Cloud::Compute::V1::Policy
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).
Parameters
  • project (::String) — Project ID for this request.
  • resource (::String) — Name or id of the resource for this request.
  • zone (::String) — The name of the zone for this request.
  • zone_set_policy_request_resource (::Google::Cloud::Compute::V1::ZoneSetPolicyRequest, ::Hash) — The body resource for this request
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetIamPolicyInstanceRequest.new

# Call the set_iam_policy method.
result = client.set_iam_policy request

# The returned object is of type Google::Cloud::Compute::V1::Policy.
p result

#set_labels

def set_labels(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_labels(instance: nil, instances_set_labels_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.

Overloads
def set_labels(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_labels via a request object, either of type SetLabelsInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_labels(instance: nil, instances_set_labels_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • instances_set_labels_request_resource (::Google::Cloud::Compute::V1::InstancesSetLabelsRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetLabelsInstanceRequest.new

# Call the set_labels method.
result = client.set_labels request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_machine_resources

def set_machine_resources(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_machine_resources(instance: nil, instances_set_machine_resources_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.

Overloads
def set_machine_resources(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_machine_resources via a request object, either of type SetMachineResourcesInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_machine_resources(instance: nil, instances_set_machine_resources_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • instances_set_machine_resources_request_resource (::Google::Cloud::Compute::V1::InstancesSetMachineResourcesRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetMachineResourcesInstanceRequest.new

# Call the set_machine_resources method.
result = client.set_machine_resources request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_machine_type

def set_machine_type(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_machine_type(instance: nil, instances_set_machine_type_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Changes the machine type for a stopped instance to the machine type specified in the request.

Overloads
def set_machine_type(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_machine_type via a request object, either of type SetMachineTypeInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_machine_type(instance: nil, instances_set_machine_type_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • instances_set_machine_type_request_resource (::Google::Cloud::Compute::V1::InstancesSetMachineTypeRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetMachineTypeInstanceRequest.new

# Call the set_machine_type method.
result = client.set_machine_type request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_metadata

def set_metadata(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_metadata(instance: nil, metadata_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Sets metadata for the specified instance to the data included in the request.

Overloads
def set_metadata(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_metadata via a request object, either of type SetMetadataInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_metadata(instance: nil, metadata_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • metadata_resource (::Google::Cloud::Compute::V1::Metadata, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetMetadataInstanceRequest.new

# Call the set_metadata method.
result = client.set_metadata request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_min_cpu_platform

def set_min_cpu_platform(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_min_cpu_platform(instance: nil, instances_set_min_cpu_platform_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def set_min_cpu_platform(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_min_cpu_platform via a request object, either of type SetMinCpuPlatformInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_min_cpu_platform(instance: nil, instances_set_min_cpu_platform_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • instances_set_min_cpu_platform_request_resource (::Google::Cloud::Compute::V1::InstancesSetMinCpuPlatformRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetMinCpuPlatformInstanceRequest.new

# Call the set_min_cpu_platform method.
result = client.set_min_cpu_platform request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_name

def set_name(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_name(instance: nil, instances_set_name_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Sets name of an instance.

Overloads
def set_name(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_name via a request object, either of type SetNameInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::SetNameInstanceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_name(instance: nil, instances_set_name_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_name 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).
Parameters
  • instance (::String) — The instance name for this request.
  • instances_set_name_request_resource (::Google::Cloud::Compute::V1::InstancesSetNameRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetNameInstanceRequest.new

# Call the set_name method.
result = client.set_name request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_scheduling

def set_scheduling(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_scheduling(instance: nil, project: nil, request_id: nil, scheduling_resource: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def set_scheduling(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_scheduling via a request object, either of type SetSchedulingInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_scheduling(instance: nil, project: nil, request_id: nil, scheduling_resource: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Instance name for this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • scheduling_resource (::Google::Cloud::Compute::V1::Scheduling, ::Hash) — The body resource for this request
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetSchedulingInstanceRequest.new

# Call the set_scheduling method.
result = client.set_scheduling request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_security_policy

def set_security_policy(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_security_policy(instance: nil, instances_set_security_policy_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Sets the Google Cloud Armor security policy for the specified instance. For more information, see Google Cloud Armor Overview

Overloads
def set_security_policy(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_security_policy via a request object, either of type SetSecurityPolicyInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::SetSecurityPolicyInstanceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_security_policy(instance: nil, instances_set_security_policy_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_security_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).
Parameters
  • instance (::String) — Name of the Instance resource to which the security policy should be set. The name should conform to RFC1035.
  • instances_set_security_policy_request_resource (::Google::Cloud::Compute::V1::InstancesSetSecurityPolicyRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — Name of the zone scoping this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetSecurityPolicyInstanceRequest.new

# Call the set_security_policy method.
result = client.set_security_policy request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_service_account

def set_service_account(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_service_account(instance: nil, instances_set_service_account_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.

Overloads
def set_service_account(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_service_account via a request object, either of type SetServiceAccountInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_service_account(instance: nil, instances_set_service_account_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance resource to start.
  • instances_set_service_account_request_resource (::Google::Cloud::Compute::V1::InstancesSetServiceAccountRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetServiceAccountInstanceRequest.new

# Call the set_service_account method.
result = client.set_service_account request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_shielded_instance_integrity_policy

def set_shielded_instance_integrity_policy(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_shielded_instance_integrity_policy(instance: nil, project: nil, request_id: nil, shielded_instance_integrity_policy_resource: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def set_shielded_instance_integrity_policy(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_shielded_instance_integrity_policy via a request object, either of type SetShieldedInstanceIntegrityPolicyInstanceRequest or an equivalent Hash.
Parameters
def set_shielded_instance_integrity_policy(instance: nil, project: nil, request_id: nil, shielded_instance_integrity_policy_resource: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name or id of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • shielded_instance_integrity_policy_resource (::Google::Cloud::Compute::V1::ShieldedInstanceIntegrityPolicy, ::Hash) — The body resource for this request
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetShieldedInstanceIntegrityPolicyInstanceRequest.new

# Call the set_shielded_instance_integrity_policy method.
result = client.set_shielded_instance_integrity_policy request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#set_tags

def set_tags(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_tags(instance: nil, project: nil, request_id: nil, tags_resource: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Sets network tags for the specified instance to the data included in the request.

Overloads
def set_tags(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_tags via a request object, either of type SetTagsInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_tags(instance: nil, project: nil, request_id: nil, tags_resource: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • tags_resource (::Google::Cloud::Compute::V1::Tags, ::Hash) — The body resource for this request
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetTagsInstanceRequest.new

# Call the set_tags method.
result = client.set_tags request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#simulate_maintenance_event

def simulate_maintenance_event(request, options = nil) -> ::Gapic::GenericLRO::Operation
def simulate_maintenance_event(instance: nil, project: nil, request_id: nil, with_extended_notifications: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.

Overloads
def simulate_maintenance_event(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to simulate_maintenance_event via a request object, either of type SimulateMaintenanceEventInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def simulate_maintenance_event(instance: nil, project: nil, request_id: nil, with_extended_notifications: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • with_extended_notifications (::Boolean) — Determines whether the customers receive notifications before migration. Only applicable to SF vms.
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SimulateMaintenanceEventInstanceRequest.new

# Call the simulate_maintenance_event method.
result = client.simulate_maintenance_event request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#start

def start(request, options = nil) -> ::Gapic::GenericLRO::Operation
def start(instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Overloads
def start(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to start via a request object, either of type StartInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def start(instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance resource to start.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::StartInstanceRequest.new

# Call the start method.
result = client.start request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#start_with_encryption_key

def start_with_encryption_key(request, options = nil) -> ::Gapic::GenericLRO::Operation
def start_with_encryption_key(instance: nil, instances_start_with_encryption_key_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Overloads
def start_with_encryption_key(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to start_with_encryption_key via a request object, either of type StartWithEncryptionKeyInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def start_with_encryption_key(instance: nil, instances_start_with_encryption_key_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance resource to start.
  • instances_start_with_encryption_key_request_resource (::Google::Cloud::Compute::V1::InstancesStartWithEncryptionKeyRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::StartWithEncryptionKeyInstanceRequest.new

# Call the start_with_encryption_key method.
result = client.start_with_encryption_key request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#stop

def stop(request, options = nil) -> ::Gapic::GenericLRO::Operation
def stop(discard_local_ssd: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def stop(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to stop via a request object, either of type StopInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def stop(discard_local_ssd: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • discard_local_ssd (::Boolean) — This property is required if the instance has any attached Local SSD disks. If false, Local SSD data will be preserved when the instance is suspended. If true, the contents of any attached Local SSD disks will be discarded.
  • instance (::String) — Name of the instance resource to stop.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::StopInstanceRequest.new

# Call the stop method.
result = client.stop request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#suspend

def suspend(request, options = nil) -> ::Gapic::GenericLRO::Operation
def suspend(discard_local_ssd: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def suspend(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to suspend via a request object, either of type SuspendInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def suspend(discard_local_ssd: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • discard_local_ssd (::Boolean) — This property is required if the instance has any attached Local SSD disks. If false, Local SSD data will be preserved when the instance is suspended. If true, the contents of any attached Local SSD disks will be discarded.
  • instance (::String) — Name of the instance resource to suspend.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SuspendInstanceRequest.new

# Call the suspend method.
result = client.suspend request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#test_iam_permissions

def test_iam_permissions(request, options = nil) -> ::Google::Cloud::Compute::V1::TestPermissionsResponse
def test_iam_permissions(project: nil, resource: nil, test_permissions_request_resource: nil, zone: nil) -> ::Google::Cloud::Compute::V1::TestPermissionsResponse

Returns permissions that a caller has on the specified resource.

Overloads
def test_iam_permissions(request, options = nil) -> ::Google::Cloud::Compute::V1::TestPermissionsResponse
Pass arguments to test_iam_permissions via a request object, either of type TestIamPermissionsInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def test_iam_permissions(project: nil, resource: nil, test_permissions_request_resource: nil, zone: nil) -> ::Google::Cloud::Compute::V1::TestPermissionsResponse
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).
Parameters
  • project (::String) — Project ID for this request.
  • resource (::String) — Name or id of the resource for this request.
  • test_permissions_request_resource (::Google::Cloud::Compute::V1::TestPermissionsRequest, ::Hash) — The body resource for this request
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::TestIamPermissionsInstanceRequest.new

# Call the test_iam_permissions method.
result = client.test_iam_permissions request

# The returned object is of type Google::Cloud::Compute::V1::TestPermissionsResponse.
p result

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update

def update(request, options = nil) -> ::Gapic::GenericLRO::Operation
def update(instance: nil, instance_resource: nil, minimal_action: nil, most_disruptive_allowed_action: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def update(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to update via a request object, either of type UpdateInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update(instance: nil, instance_resource: nil, minimal_action: nil, most_disruptive_allowed_action: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name of the instance resource to update.
  • instance_resource (::Google::Cloud::Compute::V1::Instance, ::Hash) — The body resource for this request
  • minimal_action (::String) — Specifies the action to take when updating an instance even if the updated properties do not require it. If not specified, then Compute Engine acts based on the minimum action that the updated properties require. Check the MinimalAction enum for the list of possible values.
  • most_disruptive_allowed_action (::String) — Specifies the most disruptive action that can be taken on the instance as part of the update. Compute Engine returns an error if the instance properties require a more disruptive action as part of the instance update. Valid options from lowest to highest are NO_EFFECT, REFRESH, and RESTART. Check the MostDisruptiveAllowedAction enum for the list of possible values.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::UpdateInstanceRequest.new

# Call the update method.
result = client.update request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#update_access_config

def update_access_config(request, options = nil) -> ::Gapic::GenericLRO::Operation
def update_access_config(access_config_resource: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def update_access_config(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to update_access_config via a request object, either of type UpdateAccessConfigInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_access_config(access_config_resource: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • access_config_resource (::Google::Cloud::Compute::V1::AccessConfig, ::Hash) — The body resource for this request
  • instance (::String) — The instance name for this request.
  • network_interface (::String) — The name of the network interface where the access config is attached.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::UpdateAccessConfigInstanceRequest.new

# Call the update_access_config method.
result = client.update_access_config request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#update_display_device

def update_display_device(request, options = nil) -> ::Gapic::GenericLRO::Operation
def update_display_device(display_device_resource: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def update_display_device(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to update_display_device via a request object, either of type UpdateDisplayDeviceInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_display_device(display_device_resource: nil, instance: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • display_device_resource (::Google::Cloud::Compute::V1::DisplayDevice, ::Hash) — The body resource for this request
  • instance (::String) — Name of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::UpdateDisplayDeviceInstanceRequest.new

# Call the update_display_device method.
result = client.update_display_device request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#update_network_interface

def update_network_interface(request, options = nil) -> ::Gapic::GenericLRO::Operation
def update_network_interface(instance: nil, network_interface: nil, network_interface_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def update_network_interface(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to update_network_interface via a request object, either of type UpdateNetworkInterfaceInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_network_interface(instance: nil, network_interface: nil, network_interface_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — The instance name for this request.
  • network_interface (::String) — The name of the network interface to update.
  • network_interface_resource (::Google::Cloud::Compute::V1::NetworkInterface, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::UpdateNetworkInterfaceInstanceRequest.new

# Call the update_network_interface method.
result = client.update_network_interface request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#update_shielded_instance_config

def update_shielded_instance_config(request, options = nil) -> ::Gapic::GenericLRO::Operation
def update_shielded_instance_config(instance: nil, project: nil, request_id: nil, shielded_instance_config_resource: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

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.

Overloads
def update_shielded_instance_config(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to update_shielded_instance_config via a request object, either of type UpdateShieldedInstanceConfigInstanceRequest or an equivalent Hash.
Parameters
  • 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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_shielded_instance_config(instance: nil, project: nil, request_id: nil, shielded_instance_config_resource: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
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).
Parameters
  • instance (::String) — Name or id of the instance scoping this request.
  • project (::String) — Project ID for this request.
  • request_id (::String) — An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
  • shielded_instance_config_resource (::Google::Cloud::Compute::V1::ShieldedInstanceConfig, ::Hash) — The body resource for this request
  • zone (::String) — The name of the zone for this request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::GenericLRO::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Instances::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::UpdateShieldedInstanceConfigInstanceRequest.new

# Call the update_shielded_instance_config method.
result = client.update_shielded_instance_config request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

#zone_operations

def zone_operations() -> ::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client

Get the associated client for long-running operations via ZoneOperations.