Module: Awsome::Elb
- Defined in:
- lib/awsome/elb.rb,
lib/awsome/elb/load_balancer.rb
Defined Under Namespace
Classes: LoadBalancer
Constant Summary collapse
- @@delimiter =
" OH YEAH BANANAS "
- @@describe_lbs_columns =
%w( identifier name dns_name canonical_hosted_zone_name canonical_hosted_zone_name_id health_check availability_zones subnets vpc_id instance_ids listener_descriptions backend_server_descriptions app_cookie_stickiness_policies lb_cookie_stickiness_policies other_policies source_security_group security_groups created_time scheme pagination_marker )
Class Method Summary collapse
- .command(*cmd) ⇒ Object
- .config ⇒ Object
- .deregister_instance_from_lb(load_balancer_name, instance_id) ⇒ Object
- .describe_lbs(*load_balancer_names) ⇒ Object
- .register_instance_with_lb(load_balancer_name, instance_id) ⇒ Object
Class Method Details
.command(*cmd) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/awsome/elb.rb', line 9 def self.command(*cmd) args = cmd.last.is_a?(Hash) && cmd.pop = cmd << "--region #{config.region}" # options << "--url #{config.url}" # explicitly setting the url this way breaks the elb tools << "--access-key-id #{config.aws_access_key}" << "--secret-key #{config.aws_secret_key}" << "--show-long" << "--delimiter \"#{@@delimiter}\"" << "--show-request" if config.show_request << "--show-empty-fields" if config.show_empty_fields << "--connection-timeout #{config.connection_timeout}" if config.connection_timeout args && args.each { |k,v| << "--#{k} #{v}" } .join(' ') end |
.deregister_instance_from_lb(load_balancer_name, instance_id) ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/awsome/elb.rb', line 59 def self.deregister_instance_from_lb(load_balancer_name, instance_id) cmd = Awsome::Elb.command('elb-deregister-instances-from-lb', load_balancer_name, instances: instance_id) Awsome.execute( cmd, delimiter: @@delimiter, task: 'deregistering from elb' ) end |
.describe_lbs(*load_balancer_names) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/awsome/elb.rb', line 48 def self.describe_lbs(*load_balancer_names) cmd = Awsome::Elb.command("elb-describe-lbs #{load_balancer_names.join(' ')}") properties = Awsome.execute( cmd, columns: @@describe_lbs_columns, delimiter: @@delimiter, verbose: false ) properties.collect { |p| Awsome::Elb::LoadBalancer.new(p) } end |
.register_instance_with_lb(load_balancer_name, instance_id) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/awsome/elb.rb', line 68 def self.register_instance_with_lb(load_balancer_name, instance_id) cmd = Awsome::Elb.command('elb-register-instances-with-lb', load_balancer_name, instances: instance_id) Awsome.execute( cmd, delimiter: @@delimiter, task: 'registering with elb' ) end |