Module: Tapjoy::TassLib::AWS::ELB

Defined in:
lib/tapjoy/tass-lib/elb.rb

Overview

This class contains AWS methods for ELB

Class Method Summary collapse

Class Method Details

.clientObject



7
8
9
# File 'lib/tapjoy/tass-lib/elb.rb', line 7

def client
  @client ||= Aws::ElasticLoadBalancing::Client.new
end

.create(elb_protocol:, elb_port:, instance_protocol:, instance_port:, zones:, **unused_values) ⇒ Object

Creates ELB



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/tapjoy/tass-lib/elb.rb', line 12

def create(elb_protocol:, elb_port:, instance_protocol:,
  instance_port:, zones:, **unused_values)
  self.client.create_load_balancer(
    load_balancer_name: Tapjoy::TassLib.elb_name,
    listeners: [
      { protocol: elb_protocol, load_balancer_port: elb_port,
        instance_protocol: instance_protocol,
        instance_port: instance_port
      }
    ],
    availability_zones: zones)
end

.deleteObject

Deletes existing ELB



42
43
44
45
# File 'lib/tapjoy/tass-lib/elb.rb', line 42

def delete
  self.client.delete_load_balancer(
    load_balancer_name: Tapjoy::TassLib.elb_name)
end

.describeObject



47
48
49
50
# File 'lib/tapjoy/tass-lib/elb.rb', line 47

def describe
  self.client.describe_load_balancers(
    load_balancer_names: [Tapjoy::TassLib.elb_name])
end

.health_check(elb_health_target:, elb_health_interval:, elb_health_timeout:, elb_unhealthy_threshold:, elb_healthy_threshold:, **unused_values) ⇒ Object

Configures health check in AWS



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tapjoy/tass-lib/elb.rb', line 26

def health_check(elb_health_target:, elb_health_interval:,
  elb_health_timeout:, elb_unhealthy_threshold:,
  elb_healthy_threshold:, **unused_values)

  self.client.configure_health_check(
    load_balancer_name: Tapjoy::TassLib.elb_name,
    health_check: {
      target: elb_health_target,
      interval: elb_health_interval,
      timeout: elb_health_timeout,
      unhealthy_threshold: elb_unhealthy_threshold,
      healthy_threshold: elb_healthy_threshold
    })
end