Class: RubyAemAws::Component::Author

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_aem_aws/component/author.rb

Overview

Interface to the AWS instances running the Author components of a full-set AEM stack.

Constant Summary collapse

ELB_ID =
'AuthorLoadBalancer'.freeze
ELB_NAME =
'AEM Author Load Balancer'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stack_prefix, params) ⇒ Object

  • CloudWatchClient: AWS Cloudwatch Client.

  • CloudWatchLogsClient: AWS Cloudwatch Logs Client.

  • Ec2Resource: AWS EC2 Resource connection.

  • ElbClient: AWS ElasticLoadBalancer v2 Client.

Parameters:

  • stack_prefix

    AWS tag: StackPrefix

  • params

    Array of AWS Clients and Resource connections:



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ruby_aem_aws/component/author.rb', line 34

def initialize(stack_prefix, params)
  author_aws_clients = {
    CloudWatchClient: params[:CloudWatchClient],
    CloudWatchLogsClient: params[:CloudWatchLogsClient],
    Ec2Resource: params[:Ec2Resource]
  }

  @author_primary = Component::AuthorPrimary.new(stack_prefix, author_aws_clients)
  @author_standby = Component::AuthorStandby.new(stack_prefix, author_aws_clients)
  @ec2_resource = params[:Ec2Resource]
  @elb_client = params[:ElbClient]
end

Instance Attribute Details

#author_primaryObject (readonly)

Returns the value of attribute author_primary.



22
23
24
# File 'lib/ruby_aem_aws/component/author.rb', line 22

def author_primary
  @author_primary
end

#author_standbyObject (readonly)

Returns the value of attribute author_standby.



22
23
24
# File 'lib/ruby_aem_aws/component/author.rb', line 22

def author_standby
  @author_standby
end

Instance Method Details

#get_tagsObject



63
64
65
66
67
68
# File 'lib/ruby_aem_aws/component/author.rb', line 63

def get_tags
  tags = []
  tags.push(author_primary.get_tags)
  tags.push(author_standby.get_tags)
  tags
end

#healthy?Boolean

Returns true, if all author instances are healthy.

Returns:

  • (Boolean)

    true, if all author instances are healthy



48
49
50
51
52
53
# File 'lib/ruby_aem_aws/component/author.rb', line 48

def healthy?
  instance = 0
  instance += 1 if author_primary.healthy?
  instance += 1 if author_standby.healthy?
  return true unless instance < 2
end

#wait_until_healthyObject

Returns true, if all author instances are healthy.

Returns:

  • true, if all author instances are healthy



56
57
58
59
60
61
# File 'lib/ruby_aem_aws/component/author.rb', line 56

def wait_until_healthy
  instance = 0
  instance += 1 if author_primary.wait_until_healthy.eql? true
  instance += 1 if author_standby.wait_until_healthy.eql? true
  return true unless instance < 2
end