Sha256: 9d27dd3180946fb6b5f6ccbf44c21aec6b4f2bd0202512414a6295576c3b87fe

Contents?: true

Size: 822 Bytes

Versions: 7

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

module Awspec::Type
  class Nlb < ResourceBase
    def resource_via_client
      @resource_via_client ||= find_nlb(@display_name)
    end

    def id
      @id ||= resource_via_client.load_balancer_name if resource_via_client
    end

    STATES = %w[
      active provisioning failed
    ]

    STATES.each do |state|
      define_method "#{state}?" do
        resource_via_client.state.code == state
      end
    end

    def has_security_group?(_sg_id)
      false
    end

    def has_subnet?(subnet_id)
      azs = resource_via_client.availability_zones
      ret = azs.find do |az|
        az.subnet_id == subnet_id
      end
      return true if ret

      subnet2 = find_subnet(subnet_id)
      azs.find do |az|
        az.subnet_id == subnet2.subnet_id
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
awspec-1.32.0 lib/awspec/type/nlb.rb
awspec-1.31.0 lib/awspec/type/nlb.rb
awspec-1.30.0 lib/awspec/type/nlb.rb
awspec-1.29.3 lib/awspec/type/nlb.rb
awspec-1.29.2 lib/awspec/type/nlb.rb
awspec-1.29.1 lib/awspec/type/nlb.rb
awspec-1.29.0 lib/awspec/type/nlb.rb