Sha256: fc8189e576815ef9be2345cd63b787b43e43e471386c3fc34a876abc2fb04c97

Contents?: true

Size: 1.58 KB

Versions: 13

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true

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_launch_configuration?(name)
      @resource_via_client.launch_configuration_name == name
    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

    def has_nlb_target_group?(id)
      target_group = find_nlb_target_group(id)
      target_groups = select_lb_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

13 entries across 13 versions & 1 rubygems

Version Path
awspec-1.31.0 lib/awspec/type/autoscaling_group.rb
awspec-1.30.0 lib/awspec/type/autoscaling_group.rb
awspec-1.29.3 lib/awspec/type/autoscaling_group.rb
awspec-1.29.2 lib/awspec/type/autoscaling_group.rb
awspec-1.29.1 lib/awspec/type/autoscaling_group.rb
awspec-1.29.0 lib/awspec/type/autoscaling_group.rb
awspec-1.28.2 lib/awspec/type/autoscaling_group.rb
awspec-1.28.1 lib/awspec/type/autoscaling_group.rb
awspec-1.28.0 lib/awspec/type/autoscaling_group.rb
awspec-1.27.1 lib/awspec/type/autoscaling_group.rb
awspec-1.27.0 lib/awspec/type/autoscaling_group.rb
awspec-1.26.0 lib/awspec/type/autoscaling_group.rb
awspec-1.25.2 lib/awspec/type/autoscaling_group.rb