Sha256: b922355b6ee29ee6239000ecf7dbe5bacc14506198821605ec9f0c8510d6a25d

Contents?: true

Size: 1.55 KB

Versions: 72

Compression:

Stored size: 1.55 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_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

72 entries across 72 versions & 3 rubygems

Version Path
awspec-1.15.1 lib/awspec/type/autoscaling_group.rb
awspec-1.15.0 lib/awspec/type/autoscaling_group.rb
awspec-1.14.1 lib/awspec/type/autoscaling_group.rb
awspec-1.14.0 lib/awspec/type/autoscaling_group.rb
awspec-1.13.0 lib/awspec/type/autoscaling_group.rb
awspec-1.12.7 lib/awspec/type/autoscaling_group.rb
awspec-1.12.6 lib/awspec/type/autoscaling_group.rb
awspec-1.12.5 lib/awspec/type/autoscaling_group.rb
awspec-1.12.4 lib/awspec/type/autoscaling_group.rb
awspec-1.12.3 lib/awspec/type/autoscaling_group.rb
awspec-1.12.2 lib/awspec/type/autoscaling_group.rb
awspec-1.12.1 lib/awspec/type/autoscaling_group.rb
awspec-1.12.0 lib/awspec/type/autoscaling_group.rb
awspec-1.11.1 lib/awspec/type/autoscaling_group.rb
awspec-1.11.0 lib/awspec/type/autoscaling_group.rb
awspec-1.10.0 lib/awspec/type/autoscaling_group.rb
awspec-1.9.0 lib/awspec/type/autoscaling_group.rb
awspec-1.8.0 lib/awspec/type/autoscaling_group.rb
awspec-1.7.0 lib/awspec/type/autoscaling_group.rb
awspec-1.6.1 lib/awspec/type/autoscaling_group.rb