ruby_aem_aws 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edf9ceb92a749def70b1e6e77657080a4757495f
4
- data.tar.gz: a8d1f5d6c776d8a9be4d0d9b59e16e8279ceb289
3
+ metadata.gz: 631ffea7c2e71618e87352d28061102390ef2005
4
+ data.tar.gz: f1cd6d63244d9f05caffce66d4755829f9430abc
5
5
  SHA512:
6
- metadata.gz: dcc5fe4b4d0a0e197b6f743a3c63532b4e069b5c50b038b2545acd649bc1d7cf7f49b780c3d16c3a7d0bb28318a55b248d29ce9aaf77c164b4b8315ad4aafb10
7
- data.tar.gz: 7ef88b57050e47973b5c122ea46ec87400e665f92f305183dc34f1ba1ac743cf1d0e323f5312b7eda6414a5c135954ad5b31460fe051f7927616bcfee769aa72
6
+ metadata.gz: 53bb0273d04b6f930af17d0cd6465bf712d33aa962f09e57184e0b565ef64f57b48489dddb7c8220d0d8f13e58e23e5084618056c96834058adc406aad81d607
7
+ data.tar.gz: e33ea47a4e3abd0269e145af2f3235c09006469309bd6ebc35ae0a04ae732f6b6840903761a47e1aef90bcae519a46e536dc08f14561a84aa143551a34cd36fc
data/conf/gem.yaml CHANGED
@@ -1 +1 @@
1
- version: 2.1.0
1
+ version: 2.3.0
@@ -12,7 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require 'aws-sdk'
16
15
  require_relative 'component'
17
16
 
18
17
  module RubyAemAws
@@ -12,7 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require 'aws-sdk'
16
15
  require_relative 'component'
17
16
 
18
17
  module RubyAemAws
@@ -12,7 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require 'aws-sdk'
16
15
  require_relative 'component'
17
16
 
18
17
  module RubyAemAws
@@ -24,6 +24,7 @@ module RubyAemAws
24
24
  # Factory for the full-set AEM stack component interfaces.
25
25
  class FullSetStack
26
26
  attr_reader :cloudformation_client, :cloud_watch_client
27
+
27
28
  include MetricVerifier
28
29
 
29
30
  # @param stack_prefix AWS tag: StackPrefix
@@ -18,6 +18,7 @@ module RubyAemAws
18
18
  # Interface to interact with AEM StackManager
19
19
  class StackManager
20
20
  attr_reader :sm_resources, :cloudformation_client
21
+
21
22
  # @param stack_prefix AWS tag: StackPrefix
22
23
  # @param params Array of AWS Clients and Resource connections:
23
24
  # - CloudFormationClient: AWS Cloudformation Client.
@@ -36,13 +36,24 @@ module RubyAemAws
36
36
  # @param log_message Log message to filter for
37
37
  # @return Cloudwatch log client filter_log_events response
38
38
  def get_log_event(loggroup_name, log_stream_name, log_message)
39
+ # Initialise response as an empty response having no events and no next token
40
+ # This is needed to handle the scenario when initial filter log events returns
41
+ # a response with nil next token, ensuring the clients of this method to
42
+ # be able to identify any empty response events.
43
+ response = { events: [], next_token: nil }
44
+
39
45
  filter = filter_for_cloudwatch_log_event(loggroup_name, log_stream_name, log_message)
40
- response = cloud_watch_log_client.filter_log_events(filter)
46
+ curr_response = cloud_watch_log_client.filter_log_events(filter)
41
47
 
42
- until response.next_token.nil?
43
- next_token = { next_token: response.next_token }
48
+ # Since late 2021 (circa aws-sdk-cloudwatchlog 1.45.0), the last response
49
+ # is always empty (empty response events and nil next token).
50
+ # Previous to late 2021, the last response used to contain the filtered events
51
+ # with nil next token.
52
+ until curr_response.next_token.nil?
53
+ next_token = { next_token: curr_response.next_token }
44
54
  filter.update(next_token)
45
- response = cloud_watch_client.filter_log_events(filter)
55
+ response = curr_response
56
+ curr_response = cloud_watch_log_client.filter_log_events(filter)
46
57
  end
47
58
 
48
59
  response
@@ -25,6 +25,7 @@ module RubyAemAws
25
25
  # Interface to the AWS instances playing and supporting the AuthorDispatcher role in a full-set AEM stack.
26
26
  class AuthorDispatcher
27
27
  attr_reader :descriptor, :ec2_resource, :asg_client, :elb_client, :cloud_watch_client, :cloud_watch_log_client
28
+
28
29
  include AbstractGroupedComponent
29
30
  include AbstractSnapshot
30
31
  include HealthyResourceVerifier
@@ -23,6 +23,7 @@ module RubyAemAws
23
23
  # Interface to the AWS instance running the Author-Primary component of a full-set AEM stack.
24
24
  class AuthorPrimary
25
25
  attr_reader :descriptor, :ec2_resource, :cloud_watch_client, :cloud_watch_log_client
26
+
26
27
  include AbstractSingleComponent
27
28
  include AbstractSnapshot
28
29
  include HealthyStateVerifier
@@ -24,6 +24,7 @@ module RubyAemAws
24
24
  # Interface to a single AWS instance running all three AEM components as a consolidated stack.
25
25
  class AuthorPublishDispatcher
26
26
  attr_reader :descriptor, :ec2_resource, :cloud_watch_client, :cloud_watch_log_client
27
+
27
28
  include AbstractSingleComponent
28
29
  include AbstractSnapshot
29
30
  include HealthyStateVerifier
@@ -23,6 +23,7 @@ module RubyAemAws
23
23
  # Interface to the AWS instance running the Author-Standby component of a full-set AEM stack.
24
24
  class AuthorStandby
25
25
  attr_reader :descriptor, :ec2_resource, :cloud_watch_client, :cloud_watch_log_client
26
+
26
27
  include AbstractSingleComponent
27
28
  include AbstractSnapshot
28
29
  include HealthyStateVerifier
@@ -24,6 +24,7 @@ module RubyAemAws
24
24
  # Interface to the AWS instance running the ChaosMonkey component of a full-set AEM stack.
25
25
  class ChaosMonkey
26
26
  attr_reader :descriptor, :ec2_resource, :asg_client, :cloud_watch_client, :cloud_watch_log_client
27
+
27
28
  include AbstractGroupedComponent
28
29
  include AbstractSnapshot
29
30
  include HealthyResourceVerifier
@@ -24,6 +24,7 @@ module RubyAemAws
24
24
  # Interface to the AWS instance running the Orchestrator component of a full-set AEM stack.
25
25
  class Orchestrator
26
26
  attr_reader :descriptor, :ec2_resource, :asg_client, :cloud_watch_client, :cloud_watch_log_client
27
+
27
28
  include AbstractGroupedComponent
28
29
  include AbstractSnapshot
29
30
  include HealthyResourceVerifier
@@ -24,6 +24,7 @@ module RubyAemAws
24
24
  # Interface to the AWS instance running the Publish component of a full-set AEM stack.
25
25
  class Publish
26
26
  attr_reader :descriptor, :ec2_resource, :cloud_watch_client, :asg_client, :cloud_watch_log_client
27
+
27
28
  include AbstractGroupedComponent
28
29
  include AbstractSnapshot
29
30
  include HealthyResourceVerifier
@@ -24,6 +24,7 @@ module RubyAemAws
24
24
  # Interface to the AWS instance running the PublishDispatcher component of a full-set AEM stack.
25
25
  class PublishDispatcher
26
26
  attr_reader :descriptor, :ec2_resource, :asg_client, :elb_client, :cloud_watch_client, :cloud_watch_log_client
27
+
27
28
  include AbstractGroupedComponent
28
29
  include AbstractSnapshot
29
30
  include HealthyResourceVerifier
@@ -23,6 +23,7 @@ module RubyAemAws
23
23
  # Interface to the AWS StackManager to send out commands
24
24
  class StackManagerResources
25
25
  attr_reader :dynamodb_client, :s3_client, :s3_resource, :cloud_watch_client, :cloud_watch_log_client
26
+
26
27
  include AbstractStackManager
27
28
  include DynamoDB
28
29
  include MetricVerifier
@@ -47,10 +47,10 @@ module RubyAemAws
47
47
 
48
48
  class Constants
49
49
  REGION_DEFAULT = ENV['AWS_DEFAULT_REGION'] || ENV['aws_default_region'] || ENV['AWS_REGION'] || ENV['aws_region'] || 'ap-southeast-2'.freeze
50
- ACCESS_KEY_ID = ENV['AWS_ACCESS_KEY_ID'] || ENV['aws_access_key_id']
51
- SECRET_ACCESS_KEY = ENV['AWS_SECRET_ACCESS_KEY'] || ENV['aws_secret_access_key']
52
- SESSION_TOKEN = ENV['AWS_SESSION_TOKEN'] || ENV['aws_session_token']
53
- PROFILE = ENV['AWS_PROFILE']
50
+ ACCESS_KEY_ID = ENV['AWS_ACCESS_KEY_ID'] || ENV.fetch('aws_access_key_id', nil)
51
+ SECRET_ACCESS_KEY = ENV['AWS_SECRET_ACCESS_KEY'] || ENV.fetch('aws_secret_access_key', nil)
52
+ SESSION_TOKEN = ENV['AWS_SESSION_TOKEN'] || ENV.fetch('aws_session_token', nil)
53
+ PROFILE = ENV['AWS_PROFILE'] || ENV.fetch('aws_profile', nil)
54
54
  INSTANCE_STATE_HEALTHY = RubyAemAws::InstanceState::RUNNING.freeze
55
55
  INSTANCE_STATE_CODE_RUNNING = RubyAemAws::InstanceStateCode::RUNNING
56
56
  ELB_INSTANCE_INSERVICE = RubyAemAws::ELBInstanceState::HEALTHY.freeze
data/lib/ruby_aem_aws.rb CHANGED
@@ -12,6 +12,15 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ require 'aws-sdk-autoscaling'
16
+ require 'aws-sdk-cloudformation'
17
+ require 'aws-sdk-cloudwatch'
18
+ require 'aws-sdk-cloudwatchlogs'
19
+ require 'aws-sdk-dynamodb'
20
+ require 'aws-sdk-ec2'
21
+ require 'aws-sdk-elasticloadbalancingv2'
22
+ require 'aws-sdk-sns'
23
+ require 'aws-sdk-s3'
15
24
  require_relative 'ruby_aem_aws/architecture/consolidated_stack'
16
25
  require_relative 'ruby_aem_aws/architecture/full_set_stack'
17
26
  require_relative 'ruby_aem_aws/architecture/stack_manager'
@@ -23,6 +32,7 @@ module RubyAemAws
23
32
  # - aws_region: the AWS region (eg ap-southeast-2)
24
33
  # - aws_access_key_id: the AWS access key
25
34
  # - aws_secret_access_key: the AWS secret access key
35
+ # - aws_session_token: session token from STS
26
36
  # - aws_profile: AWS profile name
27
37
  # @return new RubyAemAws::AemAws instance
28
38
  def initialize(conf = {})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_aem_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shine Solutions
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-19 00:00:00.000000000 Z
11
+ date: 2022-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk