Class: Fog::Compute::Aliyun::Image
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Aliyun::Image
- Defined in:
- lib/fog/aliyun/models/compute/image.rb
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Image
constructor
A new instance of Image.
- #ready? ⇒ Boolean
- #save(options = {}) ⇒ Object
- #snapshot ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Image
Returns a new instance of Image.
29 30 31 32 |
# File 'lib/fog/aliyun/models/compute/image.rb', line 29 def initialize(attributes) self.snapshot_id = attributes['DiskDeviceMappings']['DiskDeviceMapping'][0]['SnapshotId'] super end |
Instance Method Details
#destroy ⇒ Object
43 44 45 46 47 |
# File 'lib/fog/aliyun/models/compute/image.rb', line 43 def destroy requires :id service.delete_image(id) true end |
#ready? ⇒ Boolean
49 50 51 |
# File 'lib/fog/aliyun/models/compute/image.rb', line 49 def ready? state == 'Available' end |
#save(options = {}) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/fog/aliyun/models/compute/image.rb', line 34 def save( = {}) requires :snapshot_id [:name] = name if name [:description] = description if description data = Fog::JSON.decode(service.create_image(snapshot_id, ).body) merge_attributes(data) true end |