Module: RubyAemAws::AbstractSingleComponent

Includes:
AbstractComponent
Included in:
Component::AuthorPrimary, Component::AuthorPublishDispatcher, Component::AuthorStandby
Defined in:
lib/ruby_aem_aws/abstract/single_component.rb

Overview

Add common methods to all Components.

Instance Method Summary collapse

Methods included from AbstractComponent

#to_s

Methods included from InstanceDescriber

#describe_instance, #describe_instances

Instance Method Details

#get_all_instancesObject



32
33
34
# File 'lib/ruby_aem_aws/abstract/single_component.rb', line 32

def get_all_instances
  [get_instance]
end

#get_instanceObject



23
24
25
26
27
28
29
30
# File 'lib/ruby_aem_aws/abstract/single_component.rb', line 23

def get_instance
  instances = ec2_resource.instances(filter_for_descriptor).select { |instance| InstanceState::ALL_ACTIVE.include?(instance.state.name) }
  count = instances.count
  raise RubyAemAws::ExpectedSingleInstanceError if count > 1
  return nil if count.zero?

  instances.first
end