Class: Fog::Compute::Google::Snapshot

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/google/models/snapshot.rb

Constant Summary collapse

CREATING_STATE =
"CREATING"
DELETING_STATE =
"DELETING"
FAILED_STATE =
"FAILED"
READY_STATE =
"READY"
UPLOADING_STATE =
"UPLOADING"

Instance Method Summary collapse

Instance Method Details

#destroy(async = true) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fog/compute/google/models/snapshot.rb', line 25

def destroy(async = true)
  requires :identity

  data = service.delete_snapshot(identity)
  operation = Fog::Compute::Google::Operations.new(:service => service).get(data.body["name"])
  operation.wait_for { ready? } unless async
  operation
end

#ready?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/fog/compute/google/models/snapshot.rb', line 34

def ready?
  status == READY_STATE
end

#resource_urlObject



38
39
40
# File 'lib/fog/compute/google/models/snapshot.rb', line 38

def resource_url
  "#{service.project}/global/snapshots/#{name}"
end