Class: Google::Cloud::Bigtable::Cluster::Job

Inherits:
LongrunningJob show all
Defined in:
lib/google/cloud/bigtable/cluster/job.rb

Overview

Job

A resource representing the long-running, asynchronous processing of an cluster create or update operation. The job can be refreshed to retrieve the cluster object once the operation has been completed.

See Instance#create_cluster and #save.

Examples:

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new

instance = bigtable.instance("my-instance")
job = instance.create_cluster(
  "my-new-cluster",
  "us-east-1b",
  nodes: 3,
  storage_type: :SSD
)

job.done? #=> false
job.reload! # API call
job.done? #=> true

# OR wail until  complete
job.wait_until_done!

if job.error?
  status = job.error
else
  cluster = job.cluster
end

See Also:

Instance Method Summary collapse

Instance Method Details

#clusterGoogle::Cloud::Bigtable::Cluster?

Get the cluster object from job results

Examples:

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new

instance = bigtable.instance("my-instance")
job = instance.create_cluster(
  "my-new-cluster",
  "us-east-1b",
  nodes: 3,
  storage_type: :SSD
)

job.done? #=> false
job.reload!
job.done? #=> true

# OR wait utill complete

job.wait_until_done!
cluster = job.cluster

Returns:



85
86
87
# File 'lib/google/cloud/bigtable/cluster/job.rb', line 85

def cluster
  Cluster.from_grpc(results, service) if results
end