Google Cloud Compute V1 API - Class Google::Cloud::Compute::V1::InstanceGroupManagers::Rest::Client (v2.5.0)

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

REST client for the InstanceGroupManagers service.

The InstanceGroupManagers API.

Inherits

  • Object

Methods

.configure

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

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

#abandon_instances

def abandon_instances(request, options = nil) -> ::Gapic::GenericLRO::Operation
def abandon_instances(instance_group_manager: nil, instance_group_managers_abandon_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.

Overloads
def abandon_instances(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to abandon_instances via a request object, either of type AbandonInstancesInstanceGroupManagerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::AbandonInstancesInstanceGroupManagerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def abandon_instances(instance_group_manager: nil, instance_group_managers_abandon_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to abandon_instances via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group.
  • instance_group_managers_abandon_instances_request_resource (::Google::Cloud::Compute::V1::InstanceGroupManagersAbandonInstancesRequest, ::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 where the managed instance group is located.
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::InstanceGroupManagers::Rest::Client.new

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

# Call the abandon_instances method.
result = client.abandon_instances 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::InstanceGroupManagersScopedList>
def aggregated_list(filter: nil, include_all_scopes: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil) -> ::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstanceGroupManagersScopedList>

Retrieves the list of managed instance groups and groups them by zone.

Overloads
def aggregated_list(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstanceGroupManagersScopedList>
Pass arguments to aggregated_list via a request object, either of type AggregatedListInstanceGroupManagersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::AggregatedListInstanceGroupManagersRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • 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) -> ::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstanceGroupManagersScopedList>
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. 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 : operator can be used with string fields to match substrings. For non-string fields it is equivalent to the = operator. 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.
  • 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.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstanceGroupManagersScopedList>)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstanceGroupManagersScopedList>)
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#apply_updates_to_instances

def apply_updates_to_instances(request, options = nil) -> ::Gapic::GenericLRO::Operation
def apply_updates_to_instances(instance_group_manager: nil, instance_group_managers_apply_updates_request_resource: nil, project: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Applies changes to selected instances on the managed instance group. This method can be used to apply new overrides and/or new versions.

Overloads
def apply_updates_to_instances(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to apply_updates_to_instances via a request object, either of type ApplyUpdatesToInstancesInstanceGroupManagerRequest or an equivalent Hash.
Parameters
def apply_updates_to_instances(instance_group_manager: nil, instance_group_managers_apply_updates_request_resource: nil, project: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to apply_updates_to_instances via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group, should conform to RFC1035.
  • instance_group_managers_apply_updates_request_resource (::Google::Cloud::Compute::V1::InstanceGroupManagersApplyUpdatesRequest, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • zone (::String) — The name of the zone where the managed instance group is located. Should conform to RFC1035.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#configure

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

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

#create_instances

def create_instances(request, options = nil) -> ::Gapic::GenericLRO::Operation
def create_instances(instance_group_manager: nil, instance_group_managers_create_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Creates instances with per-instance configurations in this managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method.

Overloads
def create_instances(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to create_instances via a request object, either of type CreateInstancesInstanceGroupManagerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::CreateInstancesInstanceGroupManagerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_instances(instance_group_manager: nil, instance_group_managers_create_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to create_instances via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group. It should conform to RFC1035.
  • instance_group_managers_create_instances_request_resource (::Google::Cloud::Compute::V1::InstanceGroupManagersCreateInstancesRequest, ::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. 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 where the managed instance group is located. It should conform to RFC1035.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#delete

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

Deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information.

Overloads
def delete(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to delete via a request object, either of type DeleteInstanceGroupManagerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::DeleteInstanceGroupManagerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete(instance_group_manager: 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_group_manager (::String) — The name of the managed instance group 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 where the managed instance group is located.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#delete_instances

def delete_instances(request, options = nil) -> ::Gapic::GenericLRO::Operation
def delete_instances(instance_group_manager: nil, instance_group_managers_delete_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Flags the specified instances in the managed instance group for immediate deletion. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.

Overloads
def delete_instances(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to delete_instances via a request object, either of type DeleteInstancesInstanceGroupManagerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::DeleteInstancesInstanceGroupManagerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_instances(instance_group_manager: nil, instance_group_managers_delete_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to delete_instances via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group.
  • instance_group_managers_delete_instances_request_resource (::Google::Cloud::Compute::V1::InstanceGroupManagersDeleteInstancesRequest, ::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 where the managed instance group is located.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#delete_per_instance_configs

def delete_per_instance_configs(request, options = nil) -> ::Gapic::GenericLRO::Operation
def delete_per_instance_configs(instance_group_manager: nil, instance_group_managers_delete_per_instance_configs_req_resource: nil, project: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Deletes selected per-instance configurations for the managed instance group.

Overloads
def delete_per_instance_configs(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to delete_per_instance_configs via a request object, either of type DeletePerInstanceConfigsInstanceGroupManagerRequest or an equivalent Hash.
Parameters
def delete_per_instance_configs(instance_group_manager: nil, instance_group_managers_delete_per_instance_configs_req_resource: nil, project: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to delete_per_instance_configs via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group. It should conform to RFC1035.
  • instance_group_managers_delete_per_instance_configs_req_resource (::Google::Cloud::Compute::V1::InstanceGroupManagersDeletePerInstanceConfigsReq, ::Hash) — The body resource for this request
  • project (::String) — Project ID for this request.
  • zone (::String) — The name of the zone where the managed instance group is located. It should conform to RFC1035.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#get

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

Returns all of the details about the specified managed instance group.

Overloads
def get(request, options = nil) -> ::Google::Cloud::Compute::V1::InstanceGroupManager
Pass arguments to get via a request object, either of type GetInstanceGroupManagerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::GetInstanceGroupManagerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get(instance_group_manager: nil, project: nil, zone: nil) -> ::Google::Cloud::Compute::V1::InstanceGroupManager
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_group_manager (::String) — The name of the managed instance group.
  • project (::String) — Project ID for this request.
  • zone (::String) — The name of the zone where the managed instance group is located.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#initialize

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

Create a new InstanceGroupManagers REST client object.

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

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

#insert

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

Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit.

Overloads
def insert(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to insert via a request object, either of type Google::Cloud::Compute::V1::InsertInstanceGroupManagerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::InsertInstanceGroupManagerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def insert(instance_group_manager_resource: nil, project: nil, request_id: 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_group_manager_resource (::Google::Cloud::Compute::V1::InstanceGroupManager, ::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 where you want to create the managed instance group.
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::InstanceGroupManagers::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::InsertInstanceGroupManagerRequest.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::InstanceGroupManager>
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::InstanceGroupManager>

Retrieves a list of managed instance groups that are contained within the specified project and zone.

Overloads
def list(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstanceGroupManager>
Pass arguments to list via a request object, either of type ListInstanceGroupManagersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::ListInstanceGroupManagersRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • 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::InstanceGroupManager>
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. 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 : operator can be used with string fields to match substrings. For non-string fields it is equivalent to the = operator. 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.
  • 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.
  • zone (::String) — The name of the zone where the managed instance group is located.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#list_errors

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

Lists all errors thrown by actions on instances for a given managed instance group. The filter and orderBy query parameters are not supported.

Overloads
def list_errors(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstanceManagedByIgmError>
Pass arguments to list_errors via a request object, either of type ListErrorsInstanceGroupManagersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::ListErrorsInstanceGroupManagersRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_errors(filter: nil, instance_group_manager: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstanceManagedByIgmError>
Pass arguments to list_errors via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
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. 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 : operator can be used with string fields to match substrings. For non-string fields it is equivalent to the = operator. 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.
  • instance_group_manager (::String) — The name of the managed instance group. It must be a string that meets the requirements in RFC1035, or an unsigned long integer: must match regexp pattern: (?:a-z?)|1-9{0,19}.
  • 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.
  • zone (::String) — The name of the zone where the managed instance group is located. It should conform to RFC1035.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#list_managed_instances

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

Lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action. The orderBy query parameter is not supported. The pageToken query parameter is supported only in the alpha and beta API and only if the group's listManagedInstancesResults field is set to PAGINATED.

Overloads
def list_managed_instances(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::ManagedInstance>
Pass arguments to list_managed_instances via a request object, either of type ListManagedInstancesInstanceGroupManagersRequest or an equivalent Hash.
Parameters
def list_managed_instances(filter: nil, instance_group_manager: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::ManagedInstance>
Pass arguments to list_managed_instances via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
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. 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 : operator can be used with string fields to match substrings. For non-string fields it is equivalent to the = operator. 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.
  • instance_group_manager (::String) — The name of the managed instance group.
  • 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.
  • zone (::String) — The name of the zone where the managed instance group is located.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#list_per_instance_configs

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

Lists all of the per-instance configurations defined for the managed instance group. The orderBy query parameter is not supported.

Overloads
def list_per_instance_configs(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::PerInstanceConfig>
Pass arguments to list_per_instance_configs via a request object, either of type ListPerInstanceConfigsInstanceGroupManagersRequest or an equivalent Hash.
Parameters
def list_per_instance_configs(filter: nil, instance_group_manager: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::PerInstanceConfig>
Pass arguments to list_per_instance_configs via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
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. 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 : operator can be used with string fields to match substrings. For non-string fields it is equivalent to the = operator. 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.
  • instance_group_manager (::String) — The name of the managed instance group. It should conform to RFC1035.
  • 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.
  • zone (::String) — The name of the zone where the managed instance group is located. It should conform to RFC1035.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#patch

def patch(request, options = nil) -> ::Gapic::GenericLRO::Operation
def patch(instance_group_manager: nil, instance_group_manager_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. If you update your group to specify a new template or instance configuration, it's possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG.

Overloads
def patch(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to patch via a request object, either of type PatchInstanceGroupManagerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::PatchInstanceGroupManagerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def patch(instance_group_manager: nil, instance_group_manager_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to patch via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the instance group manager.
  • instance_group_manager_resource (::Google::Cloud::Compute::V1::InstanceGroupManager, ::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 where you want to create the managed instance group.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#patch_per_instance_configs

def patch_per_instance_configs(request, options = nil) -> ::Gapic::GenericLRO::Operation
def patch_per_instance_configs(instance_group_manager: nil, instance_group_managers_patch_per_instance_configs_req_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Inserts or patches per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch.

Overloads
def patch_per_instance_configs(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to patch_per_instance_configs via a request object, either of type PatchPerInstanceConfigsInstanceGroupManagerRequest or an equivalent Hash.
Parameters
def patch_per_instance_configs(instance_group_manager: nil, instance_group_managers_patch_per_instance_configs_req_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to patch_per_instance_configs via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group. It should conform to RFC1035.
  • instance_group_managers_patch_per_instance_configs_req_resource (::Google::Cloud::Compute::V1::InstanceGroupManagersPatchPerInstanceConfigsReq, ::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 where the managed instance group is located. It should conform to RFC1035.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#recreate_instances

def recreate_instances(request, options = nil) -> ::Gapic::GenericLRO::Operation
def recreate_instances(instance_group_manager: nil, instance_group_managers_recreate_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group's current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.

Overloads
def recreate_instances(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to recreate_instances via a request object, either of type RecreateInstancesInstanceGroupManagerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::RecreateInstancesInstanceGroupManagerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def recreate_instances(instance_group_manager: nil, instance_group_managers_recreate_instances_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to recreate_instances via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group.
  • instance_group_managers_recreate_instances_request_resource (::Google::Cloud::Compute::V1::InstanceGroupManagersRecreateInstancesRequest, ::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 where the managed instance group is located.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#resize

def resize(request, options = nil) -> ::Gapic::GenericLRO::Operation
def resize(instance_group_manager: nil, project: nil, request_id: nil, size: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: + The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. This list is subject to change. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted.

Overloads
def resize(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to resize via a request object, either of type ResizeInstanceGroupManagerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::ResizeInstanceGroupManagerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def resize(instance_group_manager: nil, project: nil, request_id: nil, size: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to resize via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group.
  • 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).
  • size (::Integer) — The number of running instances that the managed instance group should maintain at any given time. The group automatically adds or removes instances to maintain the number of instances specified by this parameter.
  • zone (::String) — The name of the zone where the managed instance group is located.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#set_instance_template

def set_instance_template(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_instance_template(instance_group_manager: nil, instance_group_managers_set_instance_template_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Specifies the instance template to use when creating new instances in this group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE.

Overloads
def set_instance_template(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_instance_template via a request object, either of type SetInstanceTemplateInstanceGroupManagerRequest or an equivalent Hash.
Parameters
def set_instance_template(instance_group_manager: nil, instance_group_managers_set_instance_template_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_instance_template via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group.
  • instance_group_managers_set_instance_template_request_resource (::Google::Cloud::Compute::V1::InstanceGroupManagersSetInstanceTemplateRequest, ::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 where the managed instance group is located.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#set_target_pools

def set_target_pools(request, options = nil) -> ::Gapic::GenericLRO::Operation
def set_target_pools(instance_group_manager: nil, instance_group_managers_set_target_pools_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Modifies the target pools to which all instances in this managed instance group are assigned. The target pools automatically apply to all of the instances in the managed instance group. This operation is marked DONE when you make the request even if the instances have not yet been added to their target pools. The change might take some time to apply to all of the instances in the group depending on the size of the group.

Overloads
def set_target_pools(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_target_pools via a request object, either of type SetTargetPoolsInstanceGroupManagerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Compute::V1::SetTargetPoolsInstanceGroupManagerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_target_pools(instance_group_manager: nil, instance_group_managers_set_target_pools_request_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to set_target_pools via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group.
  • instance_group_managers_set_target_pools_request_resource (::Google::Cloud::Compute::V1::InstanceGroupManagersSetTargetPoolsRequest, ::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 where the managed instance group is located.
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::InstanceGroupManagers::Rest::Client.new

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

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

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

#update_per_instance_configs

def update_per_instance_configs(request, options = nil) -> ::Gapic::GenericLRO::Operation
def update_per_instance_configs(instance_group_manager: nil, instance_group_managers_update_per_instance_configs_req_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation

Inserts or updates per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch.

Overloads
def update_per_instance_configs(request, options = nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to update_per_instance_configs via a request object, either of type UpdatePerInstanceConfigsInstanceGroupManagerRequest or an equivalent Hash.
Parameters
def update_per_instance_configs(instance_group_manager: nil, instance_group_managers_update_per_instance_configs_req_resource: nil, project: nil, request_id: nil, zone: nil) -> ::Gapic::GenericLRO::Operation
Pass arguments to update_per_instance_configs via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • instance_group_manager (::String) — The name of the managed instance group. It should conform to RFC1035.
  • instance_group_managers_update_per_instance_configs_req_resource (::Google::Cloud::Compute::V1::InstanceGroupManagersUpdatePerInstanceConfigsReq, ::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 where the managed instance group is located. It should conform to RFC1035.
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::InstanceGroupManagers::Rest::Client.new

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

# Call the update_per_instance_configs method.
result = client.update_per_instance_configs 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.