Module: DeltacloudVM::Client::Methods::Image
- Included in:
- Connection, Instance
- Defined in:
- lib/deltacloud_vm/client/methods/image.rb
Instance Method Summary collapse
-
#create_image(instance_id, create_opts = {}) ⇒ Object
Create a new image from instance.
-
#destroy_image(image_id) ⇒ Object
Destroy given image NOTE: This operation might not be supported for all drivers.
-
#image(image_id) ⇒ Object
Retrieve the given image.
-
#images(filter_opts = {}) ⇒ Object
Retrieve list of all images.
Instance Method Details
#create_image(instance_id, create_opts = {}) ⇒ Object
Create a new image from instance
-
instance_id -> The stopped instance used for creation
-
create_opts
-
:name -> Name of the new image
-
:description -> Description of the new image
-
48 49 50 |
# File 'lib/deltacloud_vm/client/methods/image.rb', line 48 def create_image(instance_id, create_opts={}) create_resource :image, { :instance_id => instance_id }.merge(create_opts) end |
#destroy_image(image_id) ⇒ Object
Destroy given image NOTE: This operation might not be supported for all drivers.
55 56 57 |
# File 'lib/deltacloud_vm/client/methods/image.rb', line 55 def destroy_image(image_id) destroy_resource :image, image_id end |
#image(image_id) ⇒ Object
Retrieve the given image
-
image_id -> Image to retrieve
36 37 38 39 |
# File 'lib/deltacloud_vm/client/methods/image.rb', line 36 def image(image_id) from_resource :image, connection.get(api_uri("images/#{image_id}")) end |
#images(filter_opts = {}) ⇒ Object
Retrieve list of all images
-
filter_opts:
-
:id -> Filter images using their ‘id’
-
:state -> Filter images by their ‘state’
-
:architecture -> Filter images by their ‘architecture’
-
27 28 29 30 |
# File 'lib/deltacloud_vm/client/methods/image.rb', line 27 def images(filter_opts={}) from_collection :images, connection.get(api_uri('images'), filter_opts) end |