Sha256: 9333bd4ea94876f13ecb61a68e729b32ce76c05fe265ec346da9af49714a13b0

Contents?: true

Size: 905 Bytes

Versions: 53

Compression:

Stored size: 905 Bytes

Contents

module Awspec::Type
  class Emr < ResourceBase
    attr_reader :id

    def initialize(id)
      super
      @id = id
    end

    def resource_via_client
      @resource_via_client ||= find_emr_cluster(@id)
    end

    STARTING_STATES = %w(STARTING BOOTSTRAPPING)
    READY_STATES = %w(RUNNING WAITING)
    STATES = (READY_STATES + STARTING_STATES)

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

    def applications
      resource_via_client.applications.map { |a| { name: a.name, version: a.version } }
    end

    def tags
      resource_via_client.tags.map { |t| { t.key.to_sym => t.value } }
    end

    def ok?
      READY_STATES.include?(resource_via_client.status.state)
    end

    alias_method :healthy?, :ok?
    alias_method :ready?, :ok?
    alias_method :bootstrapping?, :starting?
  end
end

Version data entries

53 entries across 53 versions & 3 rubygems

Version Path
awspec-1.25.1 lib/awspec/type/emr.rb
awspec-1.25.0 lib/awspec/type/emr.rb
awspec-1.24.4 lib/awspec/type/emr.rb
awspec-1.24.3 lib/awspec/type/emr.rb
awspec-1.24.2 lib/awspec/type/emr.rb
awspec-1.24.1 lib/awspec/type/emr.rb
awspec-1.24.0 lib/awspec/type/emr.rb
awspec-1.23.0 lib/awspec/type/emr.rb
awspec-1.22.1 lib/awspec/type/emr.rb
awspec-1.22.0 lib/awspec/type/emr.rb
awspec-1.21.1 lib/awspec/type/emr.rb
awspec-1.21.0 lib/awspec/type/emr.rb
awspec-1.20.0 lib/awspec/type/emr.rb
awspec-1.19.2 lib/awspec/type/emr.rb
awspec-1.19.1 lib/awspec/type/emr.rb
awspec-1.19.0 lib/awspec/type/emr.rb
cthiesfork-awspec-1.2.4 lib/awspec/type/emr.rb
awspec-api_gateway_extended-1.2.4 lib/awspec/type/emr.rb
awspec-api_gateway_extended-1.2.3 lib/awspec/type/emr.rb
awspec-1.18.6 lib/awspec/type/emr.rb