lib/hako/schedulers/ecs_elb.rb in hako-0.13.3 vs lib/hako/schedulers/ecs_elb.rb in hako-0.14.0

- old
+ new

@@ -3,20 +3,26 @@ require 'hako' module Hako module Schedulers class EcsElb + # @param [String] app_id + # @param [Aws::ElasticLoadBalancing::Client] elb + # @param [Hash] elb_config def initialize(app_id, elb, elb_config) @app_id = app_id @elb = elb @elb_config = elb_config end + # @return [Aws::ElasticLoadBalancing::Types::LoadBalancerDescription] def describe_load_balancer @elb.describe_load_balancers(load_balancer_names: [name]).load_balancer_descriptions[0] end + # @param [Fixnum] front_port + # @return [nil] def find_or_create_load_balancer(front_port) if @elb_config unless exist? listeners = @elb_config.fetch('listeners').map do |l| { @@ -38,25 +44,28 @@ end name end end + # @return [nil] def destroy if exist? @elb.delete_load_balancer(load_balancer_name: name) Hako.logger.info "Deleted ELB #{name}" else Hako.logger.info "ELB #{name} doesn't exist" end end + # @return [Boolean] def exist? describe_load_balancer true rescue Aws::ElasticLoadBalancing::Errors::LoadBalancerNotFound false end + # @return [String] def name "hako-#{@app_id}" end end end