Class: Google::Cloud::Bigtable::AppProfile::Job

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

Overview

Job

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

See #save.

Examples:

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new

instance = bigtable.instance "my-instance"
app_profile = instance.app_profile "my-app-profile"

app_profile.description = "User data instance app profile"
routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing(
  "my-cluster",
  allow_transactional_writes: true
)
app_profile.routing_policy = routing_policy

job = app_profile.save

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

# OR
job.wait_until_done!

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

See Also:

Instance Method Summary collapse

Instance Method Details

#app_profileGoogle::Cloud::Bigtable::AppProfile?

The instance that is the object of the operation.

Examples:

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new

instance = bigtable.instance "my-instance"
app_profile = instance.app_profile "my-app-profile"

app_profile.description = "User data instance app profile"
routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing(
  "my-cluster",
  allow_transactional_writes: true
)
app_profile.routing_policy = routing_policy

job = app_profile.save

job.wait_until_done!

app_profile = job.app_profile

Returns:



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

def app_profile
  return nil unless done?
  return nil unless @grpc.grpc_op.result == :response
  AppProfile.from_grpc @grpc.results, service
end