Sha256: c157f4b7e6e8c242117e8796e75c5fe048993c82f30e36d8a86f05721e5e602b

Contents?: true

Size: 1.31 KB

Versions: 17

Compression:

Stored size: 1.31 KB

Contents

module Awspec::Type
  class EcsCluster < ResourceBase
    def initialize(name)
      super
      @display_name = name
    end

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

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

    STATES = %w(ACTIVE INACTIVE)

    STATES.each do |state|
      define_method state.downcase + '?' do
        resource_via_client.status == state
      end
    end

    def has_container_instance?(uuid)
      uuid = arn_or_uuid.split('/').last
      find_ecs_container_instance(id, uuid)
    end

    # deprecated method
    def container_instance_arns
      puts ''
      warn Color.on_red(Color.white("!!! `#{__method__}` is deprecated. awspec don't provide complex result !!!"))
      @container_instance_arns ||= select_ecs_container_instance_arn_by_cluster_name(id)
    end

    # deprecated method
    def container_instances
      puts ''
      warn Color.on_red(Color.white("!!! `#{__method__}` is deprecated. awspec don't provide complex result !!!"))
      return @container_instances if @container_instances
      arns = container_instance_arns
      @container_instances ||=
        arns.empty? ? [] : find_ecs_container_instances(id, arns).map! { |ci| EcsContainerInstance.new(id, ci) }
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
awspec-0.79.0 lib/awspec/type/ecs_cluster.rb
awspec-0.78.1 lib/awspec/type/ecs_cluster.rb
awspec-0.77.1 lib/awspec/type/ecs_cluster.rb
awspec-0.77.0 lib/awspec/type/ecs_cluster.rb
awspec-0.76.1 lib/awspec/type/ecs_cluster.rb
awspec-0.76.0 lib/awspec/type/ecs_cluster.rb
awspec-0.75.2 lib/awspec/type/ecs_cluster.rb
awspec-0.75.1 lib/awspec/type/ecs_cluster.rb
awspec-0.75.0 lib/awspec/type/ecs_cluster.rb
awspec-0.74.1 lib/awspec/type/ecs_cluster.rb
awspec-0.74.0 lib/awspec/type/ecs_cluster.rb
awspec-0.73.2 lib/awspec/type/ecs_cluster.rb
awspec-0.73.1 lib/awspec/type/ecs_cluster.rb
awspec-0.73.0 lib/awspec/type/ecs_cluster.rb
awspec-0.72.0 lib/awspec/type/ecs_cluster.rb
awspec-0.71.0 lib/awspec/type/ecs_cluster.rb
awspec-0.70.0 lib/awspec/type/ecs_cluster.rb