Class: AwsRo::ElasticLoadBalancingV2::TargetGroup

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/aws_ro/elastic_load_balancing_v2/load_balancer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arn, client) ⇒ TargetGroup



76
77
78
79
# File 'lib/aws_ro/elastic_load_balancing_v2/load_balancer.rb', line 76

def initialize(arn, client)
  @target_group_arn = arn
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



72
73
74
# File 'lib/aws_ro/elastic_load_balancing_v2/load_balancer.rb', line 72

def client
  @client
end

#target_group_arnObject (readonly) Also known as: arn

Returns the value of attribute target_group_arn.



72
73
74
# File 'lib/aws_ro/elastic_load_balancing_v2/load_balancer.rb', line 72

def target_group_arn
  @target_group_arn
end

Instance Method Details

#health(instance_id = nil) ⇒ Object



81
82
83
84
# File 'lib/aws_ro/elastic_load_balancing_v2/load_balancer.rb', line 81

def health(instance_id = nil)
  return health_descriptions[instance_id] if instance_id
  health_descriptions.values
end

#instances(ec2_repository = nil) ⇒ Object



90
91
92
93
94
95
96
# File 'lib/aws_ro/elastic_load_balancing_v2/load_balancer.rb', line 90

def instances(ec2_repository = nil)
  ec2_repository ||= AwsRo::EC2::Repository.new(
    region: client.config.region,
    credentials: client.config.credentials
  )
  health_descriptions.empty? ? [] : ec2_repository.instance_ids(health_descriptions.keys)
end

#target_groupObject



86
87
88
# File 'lib/aws_ro/elastic_load_balancing_v2/load_balancer.rb', line 86

def target_group
  @target_group ||= client.describe_target_groups(target_group_arns: [arn]).target_groups.first
end