Cloud Dataproc V1 API - Class Google::Cloud::Dataproc::V1::NodeGroupController::Client (v0.22.0)

Reference documentation and code samples for the Cloud Dataproc V1 API class Google::Cloud::Dataproc::V1::NodeGroupController::Client.

Client for the NodeGroupController service.

The NodeGroupControllerService provides methods to manage node groups of Compute Engine managed instances.

Inherits

  • Object

Methods

.configure

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

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

#configure

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

Configure the NodeGroupController 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_node_group

def create_node_group(request, options = nil) -> ::Gapic::Operation
def create_node_group(parent: nil, node_group: nil, node_group_id: nil, request_id: nil) -> ::Gapic::Operation

Creates a node group in a cluster. The returned Operation.metadata is NodeGroupOperationMetadata.

Overloads
def create_node_group(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_node_group via a request object, either of type CreateNodeGroupRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::CreateNodeGroupRequest, ::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_node_group(parent: nil, node_group: nil, node_group_id: nil, request_id: nil) -> ::Gapic::Operation
Pass arguments to create_node_group 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
  • parent (::String) — Required. The parent resource where this node group will be created. Format: projects/{project}/regions/{region}/clusters/{cluster}
  • node_group (::Google::Cloud::Dataproc::V1::NodeGroup, ::Hash) — Required. The node group to create.
  • node_group_id (::String) — Optional. An optional node group ID. Generated if not specified.

    The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of from 3 to 33 characters.

  • request_id (::String) — Optional. A unique ID used to identify the request. If the server receives two CreateNodeGroupRequest with the same ID, the second request is ignored and the first google.longrunning.Operation created and stored in the backend is returned.

    Recommendation: Set this value to a UUID.

    The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

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

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

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#get_node_group

def get_node_group(request, options = nil) -> ::Google::Cloud::Dataproc::V1::NodeGroup
def get_node_group(name: nil) -> ::Google::Cloud::Dataproc::V1::NodeGroup

Gets the resource representation for a node group in a cluster.

Overloads
def get_node_group(request, options = nil) -> ::Google::Cloud::Dataproc::V1::NodeGroup
Pass arguments to get_node_group via a request object, either of type GetNodeGroupRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::GetNodeGroupRequest, ::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_node_group(name: nil) -> ::Google::Cloud::Dataproc::V1::NodeGroup
Pass arguments to get_node_group 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
  • name (::String) — Required. The name of the node group to retrieve. Format: projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

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

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

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

# The returned object is of type Google::Cloud::Dataproc::V1::NodeGroup.
p result

#iam_policy_client

def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Client

Get the associated client for mix-in of the IAMPolicy.

Returns
  • (Google::Iam::V1::IAMPolicy::Client)

#initialize

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

Create a new NodeGroupController client object.

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

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

#operations_client

def operations_client() -> ::Google::Cloud::Dataproc::V1::NodeGroupController::Operations

Get the associated client for long-running operations.

#resize_node_group

def resize_node_group(request, options = nil) -> ::Gapic::Operation
def resize_node_group(name: nil, size: nil, request_id: nil, graceful_decommission_timeout: nil) -> ::Gapic::Operation

Resizes a node group in a cluster. The returned Operation.metadata is NodeGroupOperationMetadata.

Overloads
def resize_node_group(request, options = nil) -> ::Gapic::Operation
Pass arguments to resize_node_group via a request object, either of type ResizeNodeGroupRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::ResizeNodeGroupRequest, ::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_node_group(name: nil, size: nil, request_id: nil, graceful_decommission_timeout: nil) -> ::Gapic::Operation
Pass arguments to resize_node_group 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
  • name (::String) — Required. The name of the node group to resize. Format: projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}
  • size (::Integer) — Required. The number of running instances for the node group to maintain. The group adds or removes instances to maintain the number of instances specified by this parameter.
  • request_id (::String) — Optional. A unique ID used to identify the request. If the server receives two ResizeNodeGroupRequest with the same ID, the second request is ignored and the first google.longrunning.Operation created and stored in the backend is returned.

    Recommendation: Set this value to a UUID.

    The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

  • graceful_decommission_timeout (::Google::Protobuf::Duration, ::Hash) — Optional. Timeout for graceful YARN decommissioning. Graceful decommissioning allows the removal of nodes from the Compute Engine node group without interrupting jobs in progress. This timeout specifies how long to wait for jobs in progress to finish before forcefully removing nodes (and potentially interrupting jobs). Default timeout is 0 (for forceful decommission), and the maximum allowed timeout is 1 day. (see JSON representation of Duration).

    Only supported on Dataproc image versions 1.2 and higher.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

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

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

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end