Class: Fog::Compute::Google::Image
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::Image
- Defined in:
- lib/fog/compute/google/models/image.rb
Constant Summary collapse
- READY_STATE =
"READY".freeze
Instance Method Summary collapse
- #destroy(async = true) ⇒ Object
- #ready? ⇒ Boolean
- #reload ⇒ Object
- #resource_url ⇒ Object
- #save ⇒ Object
Instance Method Details
#destroy(async = true) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/fog/compute/google/models/image.rb', line 50 def destroy(async = true) data = service.delete_image(name) 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/image.rb', line 46 def ready? status == READY_STATE end |
#reload ⇒ Object
58 59 60 61 62 63 |
# File 'lib/fog/compute/google/models/image.rb', line 58 def reload requires :name data = service.get_image(name, project) merge_attributes(data.to_h) self end |
#resource_url ⇒ Object
75 76 77 |
# File 'lib/fog/compute/google/models/image.rb', line 75 def resource_url "#{project}/global/images/#{name}" end |
#save ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/fog/compute/google/models/image.rb', line 65 def save requires :name data = service.insert_image(name, attributes) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { ready? } reload end |