-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from shinesolutions/RS-160
Add Preview components
- Loading branch information
Showing
6 changed files
with
184 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version: 2.4.1-pre.0 | ||
version: 2.4.2-pre.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Copyright 2018-2021 Shine Solutions Group | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
require_relative '../abstract/grouped_component' | ||
require_relative '../abstract/snapshot' | ||
require_relative '../constants' | ||
require_relative '../mixins/healthy_resource_verifier' | ||
require_relative '../mixins/metric_verifier' | ||
require_relative '../mixins/snapshot_verifier' | ||
|
||
module RubyAemAws | ||
module Component | ||
# Interface to the AWS instance running the Preview Publish component of a full-set AEM stack. | ||
class PreviewPublish | ||
attr_reader :descriptor, :ec2_resource, :cloud_watch_client, :asg_client, :cloud_watch_log_client | ||
|
||
include AbstractGroupedComponent | ||
include AbstractSnapshot | ||
include HealthyResourceVerifier | ||
include MetricVerifier | ||
include SnapshotVerifier | ||
|
||
EC2_COMPONENT = 'preview-publish'.freeze | ||
EC2_NAME = 'AEM Preview Publish'.freeze | ||
|
||
# @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. | ||
# @return new RubyAemAws::FullSet::PreviewPublish | ||
def initialize(stack_prefix, params) | ||
@descriptor = ComponentDescriptor.new(stack_prefix, | ||
EC2Descriptor.new(EC2_COMPONENT, EC2_NAME)) | ||
@asg_client = params[:AutoScalingClient] | ||
@cloud_watch_client = params[:CloudWatchClient] | ||
@cloud_watch_log_client = params[:CloudWatchLogsClient] | ||
@ec2_resource = params[:Ec2Resource] | ||
end | ||
|
||
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 | ||
|
||
def terminate_random_instance | ||
instance = get_random_instance | ||
instance.terminate | ||
instance.wait_until_terminated | ||
end | ||
|
||
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 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Copyright 2018-2021 Shine Solutions Group | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
require_relative '../abstract/grouped_component' | ||
require_relative '../abstract/snapshot' | ||
require_relative '../constants' | ||
require_relative '../mixins/healthy_resource_verifier' | ||
require_relative '../mixins/metric_verifier' | ||
require_relative '../mixins/snapshot_verifier' | ||
|
||
module RubyAemAws | ||
module Component | ||
# Interface to the AWS instance running the Preview PublishDispatcher component of a full-set AEM stack. | ||
class PreviewPublishDispatcher | ||
attr_reader :descriptor, :ec2_resource, :asg_client, :elb_client, :cloud_watch_client, :cloud_watch_log_client | ||
|
||
include AbstractGroupedComponent | ||
include AbstractSnapshot | ||
include HealthyResourceVerifier | ||
include MetricVerifier | ||
include SnapshotVerifier | ||
|
||
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 | ||
|
||
# @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::PreviewPublishDispatcher | ||
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 | ||
|
||
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 | ||
|
||
def terminate_random_instance | ||
instance = get_random_instance | ||
instance.terminate | ||
instance.wait_until_terminated | ||
end | ||
|
||
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 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters