Class: RubyAemAws::Component::PreviewPublishDispatcher
- Inherits:
-
Object
- Object
- RubyAemAws::Component::PreviewPublishDispatcher
- Includes:
- AbstractGroupedComponent, AbstractSnapshot, HealthyResourceVerifier, MetricVerifier, SnapshotVerifier
- Defined in:
- lib/ruby_aem_aws/component/preview_publish_dispatcher.rb
Overview
Interface to the AWS instance running the Preview PublishDispatcher component of a full-set AEM stack.
Constant Summary collapse
- EC2_COMPONENT =
'preview-publish-dispatcher'.freeze
- EC2_NAME =
'AEM Preview Publish Dispatcher'.freeze
- ELB_ID =
'PreviewPublishDispatcherLoadBalancer'.freeze
- ELB_NAME =
'AEM Preview Publish Dispatcher Load Balancer'.freeze
Instance Attribute Summary collapse
-
#asg_client ⇒ Object
readonly
Returns the value of attribute asg_client.
-
#cloud_watch_client ⇒ Object
readonly
Returns the value of attribute cloud_watch_client.
-
#cloud_watch_log_client ⇒ Object
readonly
Returns the value of attribute cloud_watch_log_client.
-
#descriptor ⇒ Object
readonly
Returns the value of attribute descriptor.
-
#ec2_resource ⇒ Object
readonly
Returns the value of attribute ec2_resource.
-
#elb_client ⇒ Object
readonly
Returns the value of attribute elb_client.
Instance Method Summary collapse
- #get_tags ⇒ Object
-
#initialize(stack_prefix, params) ⇒ Object
constructor
-
AutoScalingClient: AWS AutoScalingGroup Client.
-
- #terminate_all_instances ⇒ Object
- #terminate_random_instance ⇒ Object
Methods included from SnapshotVerifier
Methods included from MetricVerifier
#alarm?, #component_alarm?, #component_ec2_metric?, #component_log_event?, #component_log_stream?, #component_loggroup?, #component_metric?, #log_event?, #log_stream?, #loggroup?, #metric?
Methods included from RubyAemAws::CloudwatchClient
#get_alarm, #get_log_event, #get_log_streams, #get_metrics
Methods included from HealthyResourceVerifier
#health_state_asg, #health_state_elb, #healthy_asg?, #healthy_elb?, #wait_until_healthy_asg, #wait_until_healthy_elb
Methods included from AbstractSnapshot
#get_snapshot_by_id, #get_snapshots_by_type
Methods included from AbstractComponent
Methods included from InstanceDescriber
#describe_instance, #describe_instances
Methods included from AbstractGroupedComponent
#get_all_instances, #get_instance_by_id, #get_num_of_instances, #get_random_instance
Constructor Details
#initialize(stack_prefix, params) ⇒ Object
-
AutoScalingClient: AWS AutoScalingGroup Client.
-
CloudWatchClient: AWS Cloudwatch Client.
-
CloudWatchLogsClient: AWS Cloudwatch Logs Client.
-
Ec2Resource: AWS EC2 Resource connection.
-
ElbClient: AWS ElasticLoadBalancer v2 Client.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ruby_aem_aws/component/preview_publish_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 |
Instance Attribute Details
#asg_client ⇒ Object (readonly)
Returns the value of attribute asg_client.
26 27 28 |
# File 'lib/ruby_aem_aws/component/preview_publish_dispatcher.rb', line 26 def asg_client @asg_client end |
#cloud_watch_client ⇒ Object (readonly)
Returns the value of attribute cloud_watch_client.
26 27 28 |
# File 'lib/ruby_aem_aws/component/preview_publish_dispatcher.rb', line 26 def cloud_watch_client @cloud_watch_client end |
#cloud_watch_log_client ⇒ Object (readonly)
Returns the value of attribute cloud_watch_log_client.
26 27 28 |
# File 'lib/ruby_aem_aws/component/preview_publish_dispatcher.rb', line 26 def cloud_watch_log_client @cloud_watch_log_client end |
#descriptor ⇒ Object (readonly)
Returns the value of attribute descriptor.
26 27 28 |
# File 'lib/ruby_aem_aws/component/preview_publish_dispatcher.rb', line 26 def descriptor @descriptor end |
#ec2_resource ⇒ Object (readonly)
Returns the value of attribute ec2_resource.
26 27 28 |
# File 'lib/ruby_aem_aws/component/preview_publish_dispatcher.rb', line 26 def ec2_resource @ec2_resource end |
#elb_client ⇒ Object (readonly)
Returns the value of attribute elb_client.
26 27 28 |
# File 'lib/ruby_aem_aws/component/preview_publish_dispatcher.rb', line 26 def elb_client @elb_client end |
Instance Method Details
#get_tags ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/ruby_aem_aws/component/preview_publish_dispatcher.rb', line 73 def = [] get_all_instances.each do |i| next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING .push(i.) end end |
#terminate_all_instances ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/ruby_aem_aws/component/preview_publish_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 ⇒ Object
67 68 69 70 71 |
# File 'lib/ruby_aem_aws/component/preview_publish_dispatcher.rb', line 67 def terminate_random_instance instance = get_random_instance instance.terminate instance.wait_until_terminated end |