Sha256: a17380050b420a660c098171738ee667a0098c0cc3ca01da5ada8007f9d8783e

Contents?: true

Size: 1.37 KB

Versions: 40

Compression:

Stored size: 1.37 KB

Contents

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

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

    def has_rule?(rule_id = nil, priority = nil, conditions = nil, actions = nil)
      rules = select_rule_by_nlb_listener_id(id)
      ret = rules.select do |rule|
        conditions = [conditions] if conditions.is_a?(Hash)
        actions = [actions] if actions.is_a?(Hash)
        next false if !rule_id.nil? && rule.rule_arn != rule_id
        next false if !priority.nil? && rule.priority != priority
        next false if !conditions.nil? && rule.conditions.map(&:to_h).sort_by(&:to_s) != conditions.sort_by(&:to_s)
        unless actions.nil?
          actions = actions.map do |action|
            if action.key?(:target_group_name)
              target_group = find_nlb_target_group(action[:target_group_name])
              action[:target_group_arn] = target_group.target_group_arn
              action.delete(:target_group_name)
            end
            action
          end
          next false if rule.actions.map(&:to_h).sort_by(&:to_s) != actions.sort_by(&:to_s)
        end
        true
      end
      ret.single_resource("rule_id = #{rule_id}, priority = #{priority}, \
conditions = #{conditions}, actions = #{actions}")
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
awspec-1.17.3 lib/awspec/type/nlb_listener.rb
awspec-1.17.2 lib/awspec/type/nlb_listener.rb
awspec-1.17.1 lib/awspec/type/nlb_listener.rb
awspec-1.17.0 lib/awspec/type/nlb_listener.rb
awspec-1.16.1 lib/awspec/type/nlb_listener.rb
awspec-1.16.0 lib/awspec/type/nlb_listener.rb
awspec-1.15.3 lib/awspec/type/nlb_listener.rb
awspec-1.15.2 lib/awspec/type/nlb_listener.rb
awspec-1.15.1 lib/awspec/type/nlb_listener.rb
awspec-1.15.0 lib/awspec/type/nlb_listener.rb
awspec-1.14.1 lib/awspec/type/nlb_listener.rb
awspec-1.14.0 lib/awspec/type/nlb_listener.rb
awspec-1.13.0 lib/awspec/type/nlb_listener.rb
awspec-1.12.7 lib/awspec/type/nlb_listener.rb
awspec-1.12.6 lib/awspec/type/nlb_listener.rb
awspec-1.12.5 lib/awspec/type/nlb_listener.rb
awspec-1.12.4 lib/awspec/type/nlb_listener.rb
awspec-1.12.3 lib/awspec/type/nlb_listener.rb
awspec-1.12.2 lib/awspec/type/nlb_listener.rb
awspec-1.12.1 lib/awspec/type/nlb_listener.rb