Sha256: e5ece0e270270b51651a740d46296fff0bf12a5c8cfdf5ba1ee717130201822c

Contents?: true

Size: 1.26 KB

Versions: 26

Compression:

Stored size: 1.26 KB

Contents

module Awspec::Type
  class Alb < ResourceBase
    tags_allowed
    def resource_via_client
      @resource_via_client ||= find_alb(@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
        check_existence
        resource_via_client.state.code == state
      end
    end

    def has_security_group?(sg_id)
      check_existence
      sgs = resource_via_client.security_groups
      ret = sgs.find do |sg|
        sg == sg_id
      end
      return true if ret
      sg2 = find_security_group(sg_id)
      return true if sgs.include? sg2.group_id
      false
    end

    def has_subnet?(subnet_id)
      check_existence
      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)
      subnet2.subnet_id = subnet_id
    end

    def has_tag?(tag_key, tag_value)
      alb_arn = resource_via_client.load_balancer_arn
      tag_set = select_all_alb_tags(alb_arn)
      tag_set.find do |tag|
        tag.key == tag_key && tag.value == tag_value
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
awspec-1.25.1 lib/awspec/type/alb.rb
awspec-1.25.0 lib/awspec/type/alb.rb
awspec-1.24.4 lib/awspec/type/alb.rb
awspec-1.24.3 lib/awspec/type/alb.rb
awspec-1.24.2 lib/awspec/type/alb.rb
awspec-1.24.1 lib/awspec/type/alb.rb
awspec-1.24.0 lib/awspec/type/alb.rb
awspec-1.23.0 lib/awspec/type/alb.rb
awspec-1.22.1 lib/awspec/type/alb.rb
awspec-1.22.0 lib/awspec/type/alb.rb
awspec-1.21.1 lib/awspec/type/alb.rb
awspec-1.21.0 lib/awspec/type/alb.rb
awspec-1.20.0 lib/awspec/type/alb.rb
awspec-1.19.2 lib/awspec/type/alb.rb
awspec-1.19.1 lib/awspec/type/alb.rb
awspec-1.19.0 lib/awspec/type/alb.rb
cthiesfork-awspec-1.2.4 lib/awspec/type/alb.rb
awspec-api_gateway_extended-1.2.4 lib/awspec/type/alb.rb
awspec-api_gateway_extended-1.2.3 lib/awspec/type/alb.rb
awspec-1.18.6 lib/awspec/type/alb.rb