Class: OpenStax::Aws::DeploymentBase::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/openstax/aws/deployment_base.rb

Instance Method Summary collapse

Constructor Details

#initialize(deployment) ⇒ Status

Returns a new instance of Status.



4
5
6
# File 'lib/openstax/aws/deployment_base.rb', line 4

def initialize(deployment)
  @deployment = deployment
end

Instance Method Details

#failed?(reload: false) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/openstax/aws/deployment_base.rb', line 14

def failed?(reload: false)
  stack_statuses(reload: reload).values.any?(&:failed?)
end

#stack_statuses(reload: false) ⇒ Object



8
9
10
11
12
# File 'lib/openstax/aws/deployment_base.rb', line 8

def stack_statuses(reload: false)
  @deployment.stacks.each_with_object({}) do |stack, hash|
    hash[stack.name] = stack.status(reload: reload)
  end
end

#succeeded?(reload: false) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/openstax/aws/deployment_base.rb', line 18

def succeeded?(reload: false)
  stack_statuses(reload: reload).values.all?(&:succeeded?)
end

#to_hObject



22
23
24
25
26
27
28
# File 'lib/openstax/aws/deployment_base.rb', line 22

def to_h
  {
    stacks: stack_statuses.each_with_object({}) do |(stack_name, stack_status), new_hash|
      new_hash[stack_name] = stack_status.to_h # convert the stack status object to a hash
    end
  }
end

#to_jsonObject



30
31
32
# File 'lib/openstax/aws/deployment_base.rb', line 30

def to_json
  to_h.to_json
end