You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::AutoScaling::LoadBalancer

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb

Defined Under Namespace

Classes: Collection

Actions collapse

Associations collapse

Read-Only Attributes collapse

Instance Method Summary collapse

Constructor Details

#initialize(group_name, name, options = {}) ⇒ LoadBalancer #initialize(options = {}) ⇒ LoadBalancer

Returns a new instance of LoadBalancer

Overloads:

  • #initialize(group_name, name, options = {}) ⇒ LoadBalancer

    Parameters:

    • group_name (String)
    • name (String)

    Options Hash (options):

  • #initialize(options = {}) ⇒ LoadBalancer

    Options Hash (options):

    • :group_name (required, String)
    • :name (required, String)
    • :client (Client)


21
22
23
24
25
26
27
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb', line 21

def initialize(*args)
  options = Hash === args.last ? args.pop.dup : {}
  @group_name = extract_group_name(args, options)
  @name = extract_name(args, options)
  @data = options.delete(:data)
  @client = options.delete(:client) || Client.new(options)
end

Instance Method Details

#attach(options = {}) ⇒ Types::AttachLoadBalancersResultType

Examples:

Request syntax with placeholder values


load_balancer.attach()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:



102
103
104
105
106
107
108
109
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb', line 102

def attach(options = {})
  options = Aws::Util.deep_merge(options,
    auto_scaling_group_name: @group_name,
    load_balancer_names: [@name]
  )
  resp = @client.attach_load_balancers(options)
  resp.data
end

#clientClient

Returns:



68
69
70
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb', line 68

def client
  @client
end

#dataTypes::LoadBalancerState

Returns the data for this Aws::AutoScaling::LoadBalancer.

Returns:

Raises:



83
84
85
86
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb', line 83

def data
  load unless @data
  @data
end

#data_loaded?Boolean

Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.

Returns:

  • (Boolean)

    Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.



91
92
93
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb', line 91

def data_loaded?
  !!@data
end

#detach(options = {}) ⇒ Types::DetachLoadBalancersResultType

Examples:

Request syntax with placeholder values


load_balancer.detach()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:



116
117
118
119
120
121
122
123
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb', line 116

def detach(options = {})
  options = Aws::Util.deep_merge(options,
    auto_scaling_group_name: @group_name,
    load_balancer_names: [@name]
  )
  resp = @client.detach_load_balancers(options)
  resp.data
end

#groupAutoScalingGroup

Returns:



128
129
130
131
132
133
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb', line 128

def group
  AutoScalingGroup.new(
    name: @group_name,
    client: @client
  )
end

#group_nameString

Returns:

  • (String)


32
33
34
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb', line 32

def group_name
  @group_name
end

#nameString Also known as: load_balancer_name

Returns:

  • (String)


37
38
39
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb', line 37

def name
  @name
end

#stateString

One of the following load balancer states:

  • Adding - The instances in the group are being registered with the load balancer.

  • Added - All instances in the group are registered with the load balancer.

  • InService - At least one instance in the group passed an ELB health check.

  • Removing - The instances in the group are being deregistered from the load balancer. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances.

  • Removed - All instances in the group are deregistered from the load balancer.

Returns:

  • (String)


61
62
63
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/load_balancer.rb', line 61

def state
  data.state
end