Class: Miasma::Models::Orchestration::Stack::Plan
- Inherits:
-
Types::Model
- Object
- Types::Data
- Types::Model
- Miasma::Models::Orchestration::Stack::Plan
- Defined in:
- lib/miasma/models/orchestration/plan.rb
Overview
Stack update plan
Defined Under Namespace
Constant Summary collapse
- DIFF_ATTRIBUTES =
[ :add, :remove, :replace, :interrupt, :unavailable, :unknown, ]
Instance Attribute Summary collapse
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Attributes inherited from Types::Model
Instance Method Summary collapse
-
#destroy ⇒ Stack
Destroy this stack plan.
-
#empty? ⇒ TrueClass, FalseClass
Plan has no modifications.
-
#execute! ⇒ Stack
Execute this stack plan.
-
#initialize(stack, args = {}) ⇒ Plan
constructor
A new instance of Plan.
-
#perform_reload ⇒ Object
Proxy reload action up to the API.
Methods inherited from Types::Model
from_json, #id?, #persisted?, #reload, #save
Methods included from Utils::ApiMethoding
Methods inherited from Types::Data
from_json, #from_json, #to_json
Constructor Details
#initialize(stack, args = {}) ⇒ Plan
Returns a new instance of Plan.
11 12 13 14 |
# File 'lib/miasma/models/orchestration/plan.rb', line 11 def initialize(stack, args = {}) @stack = stack super stack.api, args end |
Instance Attribute Details
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
9 10 11 |
# File 'lib/miasma/models/orchestration/plan.rb', line 9 def stack @stack end |
Instance Method Details
#destroy ⇒ Stack
Destroy this stack plan
70 71 72 73 74 75 76 77 |
# File 'lib/miasma/models/orchestration/plan.rb', line 70 def destroy if self == stack.plan stack.plan_destroy else raise Error::OrchestrationError::InvalidStackPlan.new "Plan is no longer valid for linked stack." end stack.reload end |
#empty? ⇒ TrueClass, FalseClass
Plan has no modifications
49 50 51 52 53 |
# File 'lib/miasma/models/orchestration/plan.rb', line 49 def empty? DIFF_ATTRIBUTES.all? { |attr| self.send(attr).empty? } && stacks.values.all? { |stk| stk.empty? } end |
#execute! ⇒ Stack
Execute this stack plan
58 59 60 61 62 63 64 65 |
# File 'lib/miasma/models/orchestration/plan.rb', line 58 def execute! if self == stack.plan stack.plan_execute else raise Error::OrchestrationError::InvalidStackPlan.new "Plan is no longer valid for linked stack." end stack.reload end |
#perform_reload ⇒ Object
Proxy reload action up to the API
80 81 82 |
# File 'lib/miasma/models/orchestration/plan.rb', line 80 def perform_reload api.stack_plan_reload(self) end |