Class: Fog::Compute::Google::Operation
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::Operation
- Defined in:
- lib/fog/google/models/compute/operation.rb
Constant Summary collapse
- PENDING_STATE =
"PENDING"
- RUNNING_STATE =
"RUNNING"
- DONE_STATE =
"DONE"
Instance Method Summary collapse
- #destroy ⇒ Object
- #pending? ⇒ Boolean
- #ready? ⇒ Boolean
- #region_name ⇒ Object
- #reload ⇒ Object
- #zone_name ⇒ Object
Instance Method Details
#destroy ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fog/google/models/compute/operation.rb', line 47 def destroy requires :identity if zone service.delete_zone_operation(zone, identity) elsif region service.delete_region_operation(region, identity) else service.delete_global_operation(identity) end true end |
#pending? ⇒ Boolean
35 36 37 |
# File 'lib/fog/google/models/compute/operation.rb', line 35 def pending? self.status == PENDING_STATE end |
#ready? ⇒ Boolean
31 32 33 |
# File 'lib/fog/google/models/compute/operation.rb', line 31 def ready? self.status == DONE_STATE end |
#region_name ⇒ Object
39 40 41 |
# File 'lib/fog/google/models/compute/operation.rb', line 39 def region_name region.nil? ? nil : region.split('/')[-1] end |
#reload ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/fog/google/models/compute/operation.rb', line 60 def reload requires :identity data = collection.get(identity, zone, region) new_attributes = data.attributes merge_attributes(new_attributes) self end |
#zone_name ⇒ Object
43 44 45 |
# File 'lib/fog/google/models/compute/operation.rb', line 43 def zone_name zone.nil? ? nil : zone.split('/')[-1] end |