Class: Provider::Ec2
- Inherits:
-
Object
- Object
- Provider::Ec2
- Defined in:
- lib/providers/ec2/ec2.rb,
lib/providers/ec2/image.rb,
lib/providers/ec2/instance.rb
Defined Under Namespace
Instance Method Summary collapse
- #ec2 ⇒ Object
- #image ⇒ Object
-
#initialize(config) ⇒ Ec2
constructor
A new instance of Ec2.
- #instance ⇒ Object
- #instances ⇒ Object
- #regions ⇒ Object
Constructor Details
#initialize(config) ⇒ Ec2
Returns a new instance of Ec2.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/providers/ec2/ec2.rb', line 8 def initialize(config) @name = config[:name] @region = config[:region] @role = config[:role] @access_key_id = config[:cloudprovider_access_key_id] @secret_access_key = config[:cloudprovider_secret_access_key] @owner_id = config[:cloudprovider_images_owner_id] @image = config[:image] || config[:name] @ec2 = ec2 end |
Instance Method Details
#ec2 ⇒ Object
39 40 41 42 43 |
# File 'lib/providers/ec2/ec2.rb', line 39 def ec2 AWS.memoize do AWS::EC2.new(:access_key_id => @access_key_id, :secret_access_key => @secret_access_key, :region => @region) end end |
#image ⇒ Object
19 20 21 |
# File 'lib/providers/ec2/ec2.rb', line 19 def image Provider::Ec2::Image.new(@ec2, @role, @owner_id, @image) end |
#instance ⇒ Object
23 24 25 |
# File 'lib/providers/ec2/ec2.rb', line 23 def instance Provider::Ec2::Instance.new(@ec2, @name, @image) end |
#instances ⇒ Object
27 28 29 30 31 |
# File 'lib/providers/ec2/ec2.rb', line 27 def instances AWS.memoize do @instances ||= @ec2.instances end end |
#regions ⇒ Object
33 34 35 36 37 |
# File 'lib/providers/ec2/ec2.rb', line 33 def regions AWS.memoize do @ec2.regions end end |