Class: Microsandbox::ModificationPlan
- Inherits:
-
Object
- Object
- Microsandbox::ModificationPlan
- Defined in:
- lib/microsandbox/modification.rb
Overview
The plan produced by Sandbox#modify / SandboxHandle#modify: the classified
set of changes a modification requested, and (for a non-dry-run apply) whether
they were applied plus any live-resize convergence outcomes. Mirrors the
official SDKs' SandboxModificationPlan.
The nested collections (#changes, #conflicts, #warnings,
#resize_status) are frozen Arrays of frozen, symbol-keyed Hashes carrying
the canonical snake_case fields verbatim (e.g. a config change is
{ kind: "config", field:, change:, before:, after:, disposition:, reason: };
a secret change adds name:, before_ref:, after_ref:, allow_hosts:).
Enum values stay as the runtime's strings (e.g. a disposition of
"next start", a state of "guest-refused").
Instance Attribute Summary collapse
-
#changes ⇒ Array<Hash>
readonly
The planned changes (config and secret).
-
#conflicts ⇒ Array<Hash>
readonly
Conflicts that must be resolved before applying.
-
#policy ⇒ Symbol
readonly
:no_restart, :next_start, or :restart.
-
#resize_status ⇒ Array<Hash>
readonly
Live resource-resize outcomes (populated by an apply).
-
#sandbox ⇒ String
readonly
The sandbox the plan applies to.
-
#status ⇒ String
readonly
The sandbox status used to classify the changes.
-
#warnings ⇒ Array<Hash>
readonly
Non-fatal warnings about the patch.
Instance Method Summary collapse
-
#applied? ⇒ Boolean
Whether the changes were applied (false for a dry run).
-
#initialize(data) ⇒ ModificationPlan
constructor
A new instance of ModificationPlan.
- #inspect ⇒ Object
Constructor Details
#initialize(data) ⇒ ModificationPlan
Returns a new instance of ModificationPlan.
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/microsandbox/modification.rb', line 77 def initialize(data) @sandbox = data["sandbox"] @status = data["status"] @applied = data["applied"] @policy = data["policy"]&.to_sym @changes = freeze_items(data["changes"]) @conflicts = freeze_items(data["conflicts"]) @warnings = freeze_items(data["warnings"]) @resize_status = freeze_items(data["resize_status"]) end |
Instance Attribute Details
#changes ⇒ Array<Hash> (readonly)
Returns the planned changes (config and secret).
69 70 71 |
# File 'lib/microsandbox/modification.rb', line 69 def changes @changes end |
#conflicts ⇒ Array<Hash> (readonly)
Returns conflicts that must be resolved before applying.
71 72 73 |
# File 'lib/microsandbox/modification.rb', line 71 def conflicts @conflicts end |
#policy ⇒ Symbol (readonly)
Returns :no_restart, :next_start, or :restart.
67 68 69 |
# File 'lib/microsandbox/modification.rb', line 67 def policy @policy end |
#resize_status ⇒ Array<Hash> (readonly)
Returns live resource-resize outcomes (populated by an apply).
75 76 77 |
# File 'lib/microsandbox/modification.rb', line 75 def resize_status @resize_status end |
#sandbox ⇒ String (readonly)
Returns the sandbox the plan applies to.
63 64 65 |
# File 'lib/microsandbox/modification.rb', line 63 def sandbox @sandbox end |
#status ⇒ String (readonly)
Returns the sandbox status used to classify the changes.
65 66 67 |
# File 'lib/microsandbox/modification.rb', line 65 def status @status end |
#warnings ⇒ Array<Hash> (readonly)
Returns non-fatal warnings about the patch.
73 74 75 |
# File 'lib/microsandbox/modification.rb', line 73 def warnings @warnings end |
Instance Method Details
#applied? ⇒ Boolean
Returns whether the changes were applied (false for a dry run).
89 90 91 |
# File 'lib/microsandbox/modification.rb', line 89 def applied? @applied end |
#inspect ⇒ Object
93 94 95 96 97 |
# File 'lib/microsandbox/modification.rb', line 93 def inspect "#<Microsandbox::ModificationPlan sandbox=#{@sandbox.inspect} applied=#{@applied} " \ "policy=#{@policy} changes=#{@changes.size} conflicts=#{@conflicts.size} " \ "warnings=#{@warnings.size}>" end |