Class: Fog::Compute::Google::Snapshot
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::Snapshot
- Defined in:
- lib/fog/compute/google/models/snapshot.rb
Constant Summary collapse
- CREATING_STATE =
"CREATING".freeze
- DELETING_STATE =
"DELETING".freeze
- FAILED_STATE =
"FAILED".freeze
- READY_STATE =
"READY".freeze
- UPLOADING_STATE =
"UPLOADING".freeze
Instance Method Summary collapse
- #destroy(async = true) ⇒ Object
- #ready? ⇒ Boolean
- #resource_url ⇒ Object
- #set_labels(new_labels) ⇒ Object
Instance Method Details
#destroy(async = true) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/fog/compute/google/models/snapshot.rb', line 30 def destroy(async = true) requires :identity data = service.delete_snapshot(identity) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { ready? } unless async operation end |
#ready? ⇒ Boolean
46 47 48 |
# File 'lib/fog/compute/google/models/snapshot.rb', line 46 def ready? status == READY_STATE end |
#resource_url ⇒ Object
50 51 52 |
# File 'lib/fog/compute/google/models/snapshot.rb', line 50 def resource_url "#{service.project}/global/snapshots/#{name}" end |
#set_labels(new_labels) ⇒ Object
40 41 42 43 44 |
# File 'lib/fog/compute/google/models/snapshot.rb', line 40 def set_labels(new_labels) requires :identity, :label_fingerprint service.set_snapshot_labels(identity, label_fingerprint, new_labels) reload end |