Class: Fog::Compute::Google::Image
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::Image
- Defined in:
- lib/fog/google/models/compute/image.rb
Constant Summary collapse
- READY_STATE =
"READY"
Instance Method Summary collapse
- #destroy(async = true) ⇒ Object
- #preferred_kernel ⇒ Object
- #preferred_kernel=(args) ⇒ Object
- #ready? ⇒ Boolean
- #reload ⇒ Object
- #resource_url ⇒ Object
- #save ⇒ Object
Instance Method Details
#destroy(async = true) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/fog/google/models/compute/image.rb', line 50 def destroy(async=true) data = service.delete_image(name) operation = Fog::Compute::Google::Operations.new(:service => service).get(data.body['name']) unless async operation.wait_for { ready? } end operation end |
#preferred_kernel ⇒ Object
39 40 41 42 |
# File 'lib/fog/google/models/compute/image.rb', line 39 def preferred_kernel Fog::Logger.deprecation("preferred_kernel is no longer used [light_black](#{caller.first})[/]") nil end |
#preferred_kernel=(args) ⇒ Object
35 36 37 |
# File 'lib/fog/google/models/compute/image.rb', line 35 def preferred_kernel=(args) Fog::Logger.deprecation("preferred_kernel= is no longer used [light_black](#{caller.first})[/]") end |
#ready? ⇒ Boolean
46 47 48 |
# File 'lib/fog/google/models/compute/image.rb', line 46 def ready? self.status == READY_STATE end |
#reload ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/fog/google/models/compute/image.rb', line 59 def reload requires :name self.project = self.service.project data = service.get_image(name, self.project).body self.merge_attributes(data) self end |
#resource_url ⇒ Object
84 85 86 |
# File 'lib/fog/google/models/compute/image.rb', line 84 def resource_url "#{self.project}/global/images/#{name}" end |
#save ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/fog/google/models/compute/image.rb', line 69 def save requires :name requires :raw_disk = { 'rawDisk' => raw_disk, 'description' => description, } data = service.insert_image(name, ) operation = Fog::Compute::Google::Operations.new(:service => service).get(data.body['name']) operation.wait_for { !pending? } reload end |