Class: OpenStax::Aws::DeploymentBase::Status
- Inherits:
-
Object
- Object
- OpenStax::Aws::DeploymentBase::Status
- Defined in:
- lib/openstax/aws/deployment_base.rb
Instance Method Summary collapse
- #failed?(reload: false) ⇒ Boolean
-
#initialize(deployment) ⇒ Status
constructor
A new instance of Status.
- #stack_statuses(reload: false) ⇒ Object
- #succeeded?(reload: false) ⇒ Boolean
- #to_h ⇒ Object
- #to_json ⇒ Object
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
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
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_h ⇒ Object
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_json ⇒ Object
30 31 32 |
# File 'lib/openstax/aws/deployment_base.rb', line 30 def to_json to_h.to_json end |