Google Cloud Compute V1 API - Class Google::Cloud::Compute::V1::Projects::Rest::Client (v2.13.0)

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

REST client for the Projects service.

The Projects API.

Inherits

  • Object

Methods

.configure

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

Configure the Projects 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 Projects clients
::Google::Cloud::Compute::V1::Projects::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the Projects 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

#disable_xpn_host

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

Disable this project as a shared VPC host project.

Overloads
def disable_xpn_host(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to disable_xpn_host via a request object, either of type DisableXpnHostProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::DisableXpnHostProjectRequest, ::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 disable_xpn_host(project: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to disable_xpn_host 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.
  • 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).
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::Projects::Rest::Client.new

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

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

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

#disable_xpn_resource

def disable_xpn_resource(request, options = nil) -> ::Gapic::GenericLRO::Operation
def disable_xpn_resource(project: nil, projects_disable_xpn_resource_request_resource: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation

Disable a service resource (also known as service project) associated with this host project.

Overloads
def disable_xpn_resource(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to disable_xpn_resource via a request object, either of type DisableXpnResourceProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::DisableXpnResourceProjectRequest, ::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 disable_xpn_resource(project: nil, projects_disable_xpn_resource_request_resource: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to disable_xpn_resource 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.
  • projects_disable_xpn_resource_request_resource (::Google::Cloud::Compute::V1::ProjectsDisableXpnResourceRequest, ::Hash) — The body resource 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).
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::Projects::Rest::Client.new

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

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

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

#enable_xpn_host

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

Enable this project as a shared VPC host project.

Overloads
def enable_xpn_host(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to enable_xpn_host via a request object, either of type EnableXpnHostProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::EnableXpnHostProjectRequest, ::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 enable_xpn_host(project: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to enable_xpn_host 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.
  • 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).
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::Projects::Rest::Client.new

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

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

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

#enable_xpn_resource

def enable_xpn_resource(request, options = nil) -> ::Gapic::GenericLRO::Operation
def enable_xpn_resource(project: nil, projects_enable_xpn_resource_request_resource: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation

Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project.

Overloads
def enable_xpn_resource(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to enable_xpn_resource via a request object, either of type EnableXpnResourceProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::EnableXpnResourceProjectRequest, ::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 enable_xpn_resource(project: nil, projects_enable_xpn_resource_request_resource: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to enable_xpn_resource 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.
  • projects_enable_xpn_resource_request_resource (::Google::Cloud::Compute::V1::ProjectsEnableXpnResourceRequest, ::Hash) — The body resource 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).
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::Projects::Rest::Client.new

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

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

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

#get

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

Returns the specified Project resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas field). To exclude one or more fields, set your request's fields query parameter to only include the fields you need. For example, to only include the id and selfLink fields, add the query parameter ?fields=id,selfLink to your request.

Overloads
def get(request, options = nil) -> ::Google::Cloud::Compute::V1::Project
Pass arguments to get via a request object, either of type GetProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::GetProjectRequest, ::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(project: nil) -> ::Google::Cloud::Compute::V1::Project
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).
Parameter
  • project (::String) — Project ID 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::Projects::Rest::Client.new

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

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

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

#get_xpn_host

def get_xpn_host(request, options = nil) -> ::Google::Cloud::Compute::V1::Project
def get_xpn_host(project: nil) -> ::Google::Cloud::Compute::V1::Project

Gets the shared VPC host project that this project links to. May be empty if no link exists.

Overloads
def get_xpn_host(request, options = nil) -> ::Google::Cloud::Compute::V1::Project
Pass arguments to get_xpn_host via a request object, either of type GetXpnHostProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::GetXpnHostProjectRequest, ::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_xpn_host(project: nil) -> ::Google::Cloud::Compute::V1::Project
Pass arguments to get_xpn_host 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).
Parameter
  • project (::String) — Project ID 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::Projects::Rest::Client.new

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

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

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

#get_xpn_resources

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

Gets service resources (a.k.a service project) associated with this host project.

Overloads
def get_xpn_resources(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::XpnResourceId>
Pass arguments to get_xpn_resources via a request object, either of type GetXpnResourcesProjectsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::GetXpnResourcesProjectsRequest, ::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_xpn_resources(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::XpnResourceId>
Pass arguments to get_xpn_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
  • 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.
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::Projects::Rest::Client.new

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

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

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

#global_operations

def global_operations() -> ::Google::Cloud::Compute::V1::GlobalOperations::Rest::Client

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

#initialize

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

Create a new Projects REST client object.

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

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

#list_xpn_hosts

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

Lists all shared VPC host projects visible to the user in an organization.

Overloads
def list_xpn_hosts(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Project>
Pass arguments to list_xpn_hosts via a request object, either of type ListXpnHostsProjectsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::ListXpnHostsProjectsRequest, ::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_xpn_hosts(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, projects_list_xpn_hosts_request_resource: nil, return_partial_success: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Project>
Pass arguments to list_xpn_hosts 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.
  • projects_list_xpn_hosts_request_resource (::Google::Cloud::Compute::V1::ProjectsListXpnHostsRequest, ::Hash) — The body resource 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.
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::Projects::Rest::Client.new

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

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

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

#move_disk

def move_disk(request, options = nil) -> ::Gapic::GenericLRO::Operation
def move_disk(disk_move_request_resource: nil, project: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation

Moves a persistent disk from one zone to another.

Overloads
def move_disk(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to move_disk via a request object, either of type MoveDiskProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::MoveDiskProjectRequest, ::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 move_disk(disk_move_request_resource: nil, project: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to move_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
  • disk_move_request_resource (::Google::Cloud::Compute::V1::DiskMoveRequest, ::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).
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::Projects::Rest::Client.new

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

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

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

#move_instance

def move_instance(request, options = nil) -> ::Gapic::GenericLRO::Operation
def move_instance(instance_move_request_resource: nil, project: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation

Moves an instance and its attached persistent disks from one zone to another. Note: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the known issue. [Deprecated] This method is deprecated. See moving instance across zones instead.

Overloads
def move_instance(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to move_instance via a request object, either of type MoveInstanceProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::MoveInstanceProjectRequest, ::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 move_instance(instance_move_request_resource: nil, project: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to move_instance 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_move_request_resource (::Google::Cloud::Compute::V1::InstanceMoveRequest, ::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).
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::Projects::Rest::Client.new

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

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

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

#set_cloud_armor_tier

def set_cloud_armor_tier(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_cloud_armor_tier(project: nil, projects_set_cloud_armor_tier_request_resource: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation

Sets the Cloud Armor tier of the project. To set ENTERPRISE or above the billing account of the project must be subscribed to Cloud Armor Enterprise. See Subscribing to Cloud Armor Enterprise for more information.

Overloads
def set_cloud_armor_tier(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_cloud_armor_tier via a request object, either of type SetCloudArmorTierProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::SetCloudArmorTierProjectRequest, ::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_cloud_armor_tier(project: nil, projects_set_cloud_armor_tier_request_resource: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_cloud_armor_tier 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.
  • projects_set_cloud_armor_tier_request_resource (::Google::Cloud::Compute::V1::ProjectsSetCloudArmorTierRequest, ::Hash) — The body resource 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).
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::Projects::Rest::Client.new

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

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

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

#set_common_instance_metadata

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

Sets metadata common to all instances within the specified project using the data included in the request.

Overloads
def set_common_instance_metadata(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_common_instance_metadata via a request object, either of type SetCommonInstanceMetadataProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::SetCommonInstanceMetadataProjectRequest, ::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_common_instance_metadata(metadata_resource: nil, project: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_common_instance_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
  • 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).
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::Projects::Rest::Client.new

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

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

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

#set_default_network_tier

def set_default_network_tier(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_default_network_tier(project: nil, projects_set_default_network_tier_request_resource: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation

Sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field.

Overloads
def set_default_network_tier(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_default_network_tier via a request object, either of type SetDefaultNetworkTierProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::SetDefaultNetworkTierProjectRequest, ::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_default_network_tier(project: nil, projects_set_default_network_tier_request_resource: nil, request_id: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_default_network_tier 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.
  • projects_set_default_network_tier_request_resource (::Google::Cloud::Compute::V1::ProjectsSetDefaultNetworkTierRequest, ::Hash) — The body resource 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).
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::Projects::Rest::Client.new

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

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

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

#set_usage_export_bucket

def set_usage_export_bucket(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_usage_export_bucket(project: nil, request_id: nil, usage_export_location_resource: nil) -> ::Gapic::GenericLRO::Operation

Enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled.

Overloads
def set_usage_export_bucket(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_usage_export_bucket via a request object, either of type SetUsageExportBucketProjectRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::SetUsageExportBucketProjectRequest, ::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_usage_export_bucket(project: nil, request_id: nil, usage_export_location_resource: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_usage_export_bucket 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.
  • 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).
  • usage_export_location_resource (::Google::Cloud::Compute::V1::UsageExportLocation, ::Hash) — The body resource 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::Projects::Rest::Client.new

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

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

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

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)