class RubyAemAws::Component::PublishDispatcher

Interface to the AWS instance running the PublishDispatcher component of a full-set AEM stack.

Constants

EC2_COMPONENT
EC2_NAME
ELB_ID
ELB_NAME

Attributes

asg_client[R]
cloud_watch_client[R]
cloud_watch_log_client[R]
descriptor[R]
ec2_resource[R]
elb_client[R]

Public Class Methods

new(stack_prefix, params) click to toggle source

@param stack_prefix AWS tag: StackPrefix @param params Array of AWS Clients and Resource connections:

  • AutoScalingClient: AWS AutoScalingGroup Client.

  • CloudWatchClient: AWS Cloudwatch Client.

  • CloudWatchLogsClient: AWS Cloudwatch Logs Client.

  • Ec2Resource: AWS EC2 Resource connection.

  • ElbClient: AWS ElasticLoadBalancer Client.

@return new RubyAemAws::FullSet::PublishDispatcher

# File lib/ruby_aem_aws/component/publish_dispatcher.rb, line 46
def initialize(stack_prefix, params)
  @descriptor = ComponentDescriptor.new(stack_prefix,
                                        EC2Descriptor.new(EC2_COMPONENT, EC2_NAME),
                                        ELBDescriptor.new(ELB_ID, ELB_NAME))
  @asg_client = params[:AutoScalingClient]
  @cloud_watch_client = params[:CloudWatchClient]
  @cloud_watch_log_client = params[:CloudWatchLogsClient]
  @ec2_resource = params[:Ec2Resource]
  @elb_client = params[:ElbClient]
end

Public Instance Methods

get_tags() click to toggle source
# File lib/ruby_aem_aws/component/publish_dispatcher.rb, line 72
def get_tags
  tags = []
  get_all_instances.each do |i|
    next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING

    tags.push(i.tags)
  end
  tags
end
terminate_all_instances() click to toggle source
# File lib/ruby_aem_aws/component/publish_dispatcher.rb, line 57
def terminate_all_instances
  get_all_instances.each do |i|
    next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING

    i.terminate
    i.wait_until_terminated
  end
end
terminate_random_instance() click to toggle source
# File lib/ruby_aem_aws/component/publish_dispatcher.rb, line 66
def terminate_random_instance
  instance = get_random_instance
  instance.terminate
  instance.wait_until_terminated
end