Class: Cloud
- Inherits:
-
Object
- Object
- Cloud
- Defined in:
- lib/sproutr/cloud.rb
Class Attribute Summary collapse
-
.images ⇒ Object
Returns the value of attribute images.
-
.instances ⇒ Object
Returns the value of attribute instances.
Instance Method Summary collapse
- #describe_image(ami) ⇒ Object
- #get_images ⇒ Object
- #get_instances ⇒ Object
-
#initialize ⇒ Cloud
constructor
A new instance of Cloud.
Constructor Details
#initialize ⇒ Cloud
Returns a new instance of Cloud.
10 11 12 |
# File 'lib/sproutr/cloud.rb', line 10 def initialize @ec2 ||= Swirl::AWS.new :ec2, load_config end |
Class Attribute Details
.images ⇒ Object
Returns the value of attribute images.
7 8 9 |
# File 'lib/sproutr/cloud.rb', line 7 def images @images end |
.instances ⇒ Object
Returns the value of attribute instances.
7 8 9 |
# File 'lib/sproutr/cloud.rb', line 7 def instances @instances end |
Instance Method Details
#describe_image(ami) ⇒ Object
29 30 31 |
# File 'lib/sproutr/cloud.rb', line 29 def describe_image(ami) @ec2.call "DescribeImages", "ImageId" => ami end |
#get_images ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/sproutr/cloud.rb', line 21 def get_images aws_images = @ec2.call "DescribeImages", "Owner" => "self" images = aws_images["imagesSet"].select { |img| img["name"] } rescue nil @images = Array.new images.each { |image| @images << Ami.new(image) } @images end |