class RubyAemAws::Component::AuthorDispatcher
Interface to the AWS instances playing and supporting the AuthorDispatcher
role in 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 v2 Client.
@return new RubyAemAws::FullSet::AuthorDispatcher
# File lib/ruby_aem_aws/component/author_dispatcher.rb, line 47 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
terminate_all_instances()
click to toggle source
# File lib/ruby_aem_aws/component/author_dispatcher.rb, line 58 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/author_dispatcher.rb, line 67 def terminate_random_instance instance = get_random_instance instance.terminate instance.wait_until_terminated end