Class: AwsRo::ElasticLoadBalancingV2::Repository
- Inherits:
-
Object
- Object
- AwsRo::ElasticLoadBalancingV2::Repository
- Defined in:
- lib/aws_ro/elastic_load_balancing_v2/repository.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #all ⇒ Object
- #ec2_repository ⇒ Object
- #find_by_name(name) ⇒ Object
-
#initialize(client_or_options) ⇒ Repository
constructor
A new instance of Repository.
Constructor Details
#initialize(client_or_options) ⇒ Repository
Returns a new instance of Repository.
10 11 12 13 14 15 16 |
# File 'lib/aws_ro/elastic_load_balancing_v2/repository.rb', line 10 def initialize() @client = if .is_a? Aws::ElasticLoadBalancingV2::Client else Aws::ElasticLoadBalancingV2::Client.new() end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/aws_ro/elastic_load_balancing_v2/repository.rb', line 8 def client @client end |
Instance Method Details
#all ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/aws_ro/elastic_load_balancing_v2/repository.rb', line 25 def all client.describe_load_balancers.each_with_object([]) do |page, arr| page.load_balancers.each do |alb| arr << LoadBalancer.new(alb, client) end end end |
#ec2_repository ⇒ Object
18 19 20 21 22 23 |
# File 'lib/aws_ro/elastic_load_balancing_v2/repository.rb', line 18 def ec2_repository @ec2_repository ||= AwsRo::EC2::Repository.new( region: client.config.region, credentials: client.config.credentials ) end |
#find_by_name(name) ⇒ Object
33 34 35 36 |
# File 'lib/aws_ro/elastic_load_balancing_v2/repository.rb', line 33 def find_by_name(name) alb = client.describe_load_balancers(names: [name]).load_balancers.first LoadBalancer.new(alb, client) if alb end |