Sha256: 6b90db309bb45bdc7598ffaf62d26be4d64a29a201b2217c26d986457eb7d7f9

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module Awspec::Type
  class AutoscalingGroup < ResourceBase
    aws_resource Aws::AutoScaling::AutoScalingGroup
    tags_allowed

    def resource_via_client
      @resource_via_client ||= find_autoscaling_group(@display_name)
    end

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

    def has_elb?(name)
      resource_via_client.load_balancer_names.one? do |lb_name|
        lb_name == name
      end
    end

    def has_ec2?(id)
      ec2 = find_ec2(id)
      return nil unless ec2
      resource_via_client.instances.one? do |instance|
        instance.instance_id == ec2.instance_id
      end
    end

    def has_suspended_process?(id)
      resource_via_client.suspended_processes.one? do |process|
        process.process_name == id
      end
    end

    def has_alb_target_group?(id)
      target_group = find_alb_target_group(id)
      target_groups = select_alb_target_group_by_autoscaling_group_name(@resource_via_client.auto_scaling_group_name)
      target_groups.one? do |tg|
        tg.load_balancer_target_group_arn == target_group.target_group_arn
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
awspec-0.84.1 lib/awspec/type/autoscaling_group.rb