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

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/google/models/compute/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



27
28
29
30
31
32
33
34
35
36
# File 'lib/fog/google/models/compute/snapshot.rb', line 27

def destroy(async=true)
  requires :identity

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

#ready?Boolean

Returns:

  • (Boolean)


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

def ready?
  self.status == READY_STATE
end

#resource_urlObject



42
43
44
# File 'lib/fog/google/models/compute/snapshot.rb', line 42

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