Class: Google::Cloud::Bigtable::Instance::Job

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

Overview

Job

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

See Project#create_instance and #update.

Examples:

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new

job = bigtable.create_instance(
  "my-instance",
  display_name: "Instance for user data",
  type: :DEVELOPMENT,
  labels: { "env" => "dev"}
) do |clusters|
  clusters.add("test-cluster", "us-east1-b") # nodes not allowed
end

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

# OR - Wailt until complete
job.wait_until_done!
job.done? #=> true

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

See Also:

Instance Method Summary collapse

Instance Method Details

#instanceGoogle::Cloud::Bigtable::Instance?

Get the instance object from operation results.

Examples:

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new

job = bigtable.create_instance(
  "my-instance",
  display_name: "Instance for user data",
  type: :DEVELOPMENT,
  labels: { "env" => "dev"}
) do |clusters|
  clusters.add("test-cluster", "us-east1-b") # nodes not allowed
end

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

# OR
job.wait_until_done!

instance = job.instance

Returns:



91
92
93
# File 'lib/google/cloud/bigtable/instance/job.rb', line 91

def instance
  Instance.from_grpc results, service if results
end