Class: Fog::Compute::Google::Operation
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::Operation
- Defined in:
- lib/fog/compute/google/models/operation.rb
Constant Summary collapse
- PENDING_STATE =
"PENDING".freeze
- RUNNING_STATE =
"RUNNING".freeze
- DONE_STATE =
"DONE".freeze
Instance Method Summary collapse
- #destroy ⇒ Object
- #pending? ⇒ Boolean
- #ready? ⇒ Boolean
- #region_name ⇒ Object
- #reload ⇒ Object
- #zone_name ⇒ Object
Instance Method Details
#destroy ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fog/compute/google/models/operation.rb', line 45 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
33 34 35 |
# File 'lib/fog/compute/google/models/operation.rb', line 33 def pending? status == PENDING_STATE end |
#ready? ⇒ Boolean
29 30 31 |
# File 'lib/fog/compute/google/models/operation.rb', line 29 def ready? status == DONE_STATE end |
#region_name ⇒ Object
37 38 39 |
# File 'lib/fog/compute/google/models/operation.rb', line 37 def region_name region.nil? ? nil : region.split("/")[-1] end |
#reload ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/fog/compute/google/models/operation.rb', line 58 def reload requires :identity data = collection.get(identity, zone, region) new_attributes = data.attributes merge_attributes(new_attributes) self end |
#zone_name ⇒ Object
41 42 43 |
# File 'lib/fog/compute/google/models/operation.rb', line 41 def zone_name zone.nil? ? nil : zone.split("/")[-1] end |