class Awsrm::Alb

Constants

FILTER_MAP

Public Class Methods

all(params) click to toggle source
# File lib/awsrm/resources/alb.rb, line 13
def all(params)
  lbs = elbv2_client.describe_load_balancers.map do |responce|
    responce.load_balancers
  end.flatten
  albs = lbs.select do |lb|
    lb.type == 'application'
  end
  albs.map do |lb|
    ret = params.all? do |key, value|
      raise UndefinedFilterParamError, key unless self::FILTER_MAP.key?(key)
      next self::FILTER_MAP[key].call(lb, value) if self::FILTER_MAP[key].is_a?(Proc)
      lb[self::FILTER_MAP[key]] == value
    end
    AlbReader.new(lb) if ret
  end.compact
end
filters(_params) click to toggle source
# File lib/awsrm/resources/alb.rb, line 30
def filters(_params)
  raise NoMethodError
end
has_tags?(arn, tag_hash) click to toggle source
# File lib/awsrm/resources/alb.rb, line 34
def has_tags?(arn, tag_hash)
  tag_descriptions = elbv2_client.describe_tags(resource_arns: [arn]).tag_descriptions.flatten
  ret = tag_descriptions.find do |desc|
    desc.resource_arn == arn
  end
  return false if ret.nil?
  tag_hash.all? do |key, value|
    ret.tags.any? do |tag|
      tag.key == key.to_s && tag.value == value.to_s
    end
  end
end