Class: CloudMaker::ElbInterface
- Inherits:
-
Object
- Object
- CloudMaker::ElbInterface
- Defined in:
- lib/cloud_maker/elb_interface.rb
Instance Attribute Summary collapse
-
#aws_access_key_id ⇒ Object
Public: Gets/Sets the AWS secret.
-
#aws_secret_access_key ⇒ Object
Public: Gets/Sets the AWS access key.
-
#elb_name ⇒ Object
Internal: Gets/Sets the the elb name.
-
#instance ⇒ Object
Public: Gets/Sets the EC2 instance.
Instance Method Summary collapse
- #attach ⇒ Object
-
#initialize(options) ⇒ ElbInterface
constructor
Public: Creates a new ElbInterface instance.
Constructor Details
#initialize(options) ⇒ ElbInterface
Public: Creates a new ElbInterface instance
options - Elb configuration options
:aws_access_key_id - (required) The AWS access key
:aws_secret_access_key - (required) The AWS secret
:elb_name - (required) The name of the elb to use
:instance - (required) The AWS instance
Returns a new CloudMaker::ElbInterface instance Raises RuntimeError if any of the required options are not specified
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cloud_maker/elb_interface.rb', line 23 def initialize() required_keys = [:aws_access_key_id, :aws_secret_access_key, :instance, :elb_name] unless (required_keys - .keys).empty? raise RuntimeError.new("Instantiated #{self.class} without required attributes: #{required_keys - .keys}.") end self.instance = [:instance] self.aws_access_key_id = [:aws_access_key_id] self.aws_secret_access_key = [:aws_secret_access_key] @elb = AWS::ELB.new( :access_key_id => self.aws_access_key_id, :secret_access_key => self.aws_secret_access_key ).load_balancers[[:elb_name]] end |
Instance Attribute Details
#aws_access_key_id ⇒ Object
Public: Gets/Sets the AWS secret.
6 7 8 |
# File 'lib/cloud_maker/elb_interface.rb', line 6 def aws_access_key_id @aws_access_key_id end |
#aws_secret_access_key ⇒ Object
Public: Gets/Sets the AWS access key.
4 5 6 |
# File 'lib/cloud_maker/elb_interface.rb', line 4 def aws_secret_access_key @aws_secret_access_key end |
#elb_name ⇒ Object
Internal: Gets/Sets the the elb name.
10 11 12 |
# File 'lib/cloud_maker/elb_interface.rb', line 10 def elb_name @elb_name end |
#instance ⇒ Object
Public: Gets/Sets the EC2 instance.
8 9 10 |
# File 'lib/cloud_maker/elb_interface.rb', line 8 def instance @instance end |
Instance Method Details
#attach ⇒ Object
39 40 41 42 |
# File 'lib/cloud_maker/elb_interface.rb', line 39 def attach @elb.instances.register([self.instance]) raise RuntimeError.new("The instance was not registerd correctly. id:#{self.instance.id}") unless @elb.instances[self.instance.id] end |