Class: Serverspec::Type::AWS::ElasticLoadBalancing::LoadBalancer

Inherits:
Base
  • Object
show all
Defined in:
lib/resources/elasticloadbalancing/load_balancer.rb

Overview

The LoadBalancer class exposes the ElasticLoadBalancing::LoadBalancer resources

Instance Method Summary collapse

Constructor Details

#initialize(elb_name, instance = nil) ⇒ LoadBalancer

AWS SDK for Ruby v2 Aws::ElasticLoadBalancing::LoadBalancer wrapper for initializing a LoadBalancer resource rubocop:disable LineLength rubocop:enable LineLength

Parameters:

  • elb_name (String)

    The name of the LoadBalancer

  • instance (Class) (defaults to: nil)

    Aws::ElasticLoadBalancing::LoadBalancer instance

Raises:

  • (RuntimeError)

    if elbs.nil?

  • (RuntimeError)

    if elbs.length == 0

  • (RuntimeError)

    if elbs.length > 1



19
20
21
22
23
24
25
26
27
28
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 19

def initialize(elb_name, instance = nil)
  check_init_arg(
    'elb_name',
    'ElasticLoadBalancing::LoadBalancer',
    elb_name
  )
  @elb_name = elb_name
  get_instance instance
  get_elb elb_name
end

Instance Method Details

#availability_zonesArray(String)

The Availability Zones for the load balancer

Returns:

  • (Array(String))


86
87
88
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 86

def availability_zones
  @elb.availability_zones
end

#backend_server_descriptionsArray(Hash)

Information about the back-end servers

Returns:

  • (Array(Hash))


80
81
82
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 80

def backend_server_descriptions
  @elb.backend_server_descriptions
end

#canonical_hosted_zone_nameString

The Amazon Route 53 hosted zone associated with the load balancer

Returns:

  • (String)


55
56
57
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 55

def canonical_hosted_zone_name
  @elb.canonical_hosted_zone_name
end

#canonical_hosted_zone_name_idString

The ID of the Amazon Route 53 hosted zone name associated with the load balancer

Returns:

  • (String)


62
63
64
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 62

def canonical_hosted_zone_name_id
  @elb.canonical_hosted_zone_name_id
end

#dns_nameString

The external DNS name of the load balancer

Returns:

  • (String)


49
50
51
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 49

def dns_name
  @elb.dns_name
end

#health_checkHash

Information about the health checks conducted on the load balancer

Returns:

  • (Hash)


114
115
116
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 114

def health_check
  @elb.health_check
end

#instancesArray(Hash)

The IDs of the instances for the load balancer

Returns:

  • (Array(Hash))


104
105
106
107
108
109
110
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 104

def instances
  instances = []
  @elb.instances.each do |inst|
    instances << inst.instance_id
  end
  instances
end

#internal?Boolean

Indicates whether the scheme is internal

Returns:

  • (Boolean)


38
39
40
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 38

def internal?
  @elb.scheme == 'internal'
end

#internet_facing?Boolean

Indicates whether the scheme is internet-facing

Returns:

  • (Boolean)


43
44
45
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 43

def internet_facing?
  @elb.scheme == 'internet-facing'
end

#listenersArray(Hash)

The listeners for the load balancer

Returns:

  • (Array(Hash))


68
69
70
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 68

def listeners
  @elb.listener_descriptions
end

#policiesHash

The policies defined for the load balancer

Returns:

  • (Hash)


74
75
76
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 74

def policies
  @elb.policies
end

#security_groupsArray(String)

The security groups for the load balancer. Valid only for load balancers in a VPC

Returns:

  • (Array(String))


131
132
133
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 131

def security_groups
  @elb.security_groups
end

#source_security_groupHash

The security group that you can use as part of your inbound rules for your load balancer's back-end application instances. To only allow traffic from load balancers, add a security group rule to your back end instance that specifies this source security group as the inbound source

Returns:

  • (Hash)


124
125
126
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 124

def source_security_group
  @elb.source_security_group
end

#subnetsArray(String)

The IDs of the subnets for the load balancer

Returns:

  • (Array(String))


92
93
94
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 92

def subnets
  @elb.subnets
end

#to_sString

Returns the string representation of ElasticLoadBalancing::LoadBalancer

Returns:

  • (String)


33
34
35
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 33

def to_s
  "ElasticLoadBalancing LoadBalancer: #{@elb_name}"
end

#vpc_idString

The ID of the VPC for the load balancer

Returns:

  • (String)


98
99
100
# File 'lib/resources/elasticloadbalancing/load_balancer.rb', line 98

def vpc_id
  @elb.vpc_id
end