Class PlanJson
DeploymentPlan as JSON and computes its content identity.
The document holds everything needed to diff, reconcile and resume the plan: every planned
resource with its logical key, the native multicloud links and Interconnects, pricing, the
validation state, the design-spec fingerprint, the deployment name, the name prefix and the
project. It does not hold the source OptimizationResult (a loaded plan's dryRun()
therefore skips the checks that need the optimizer's recommendations, and says so) nor the Fabric
client (bind one with DeploymentPlan.withFabric).
Plan id. planId(DeploymentPlan) is the first 16 hex characters of the SHA-256 of
the plan's desired state in canonical JSON (properties and map entries sorted): the planned
resources, Interconnects, native links, deployment name, name prefix, project and spec fingerprint.
Pricing and validation results are not part of it, so repricing or re-validating keeps the id; any
change to what would be built changes it. The id is written into the document, and fromJson(String)
refuses a document whose stored id does not match its content (an edited or corrupt file).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe document format version this release reads and writes. -
Method Summary
Modifier and TypeMethodDescriptionstatic DeploymentPlanParses a plan document and checks its integrity.static DeploymentPlanReads a plan document.static com.fasterxml.jackson.databind.ObjectMappermapper()The shared mapper for plan documents, checkpoints and live-state snapshots.static StringplanId(DeploymentPlan plan) The plan's content identity; see the class description.static voidsave(DeploymentPlan plan, Path file) Writes a plan document atomically (a temporary file in the same directory, then a rename).static StringtoJson(DeploymentPlan plan) Serializes a plan, including itsplanId.
-
Field Details
-
SCHEMA_VERSION
The document format version this release reads and writes.- See Also:
-
-
Method Details
-
mapper
public static com.fasterxml.jackson.databind.ObjectMapper mapper()The shared mapper for plan documents, checkpoints and live-state snapshots.- Returns:
- the configured mapper (do not reconfigure it)
-
toJson
Serializes a plan, including itsplanId.- Parameters:
plan- the plan- Returns:
- indented JSON
-
fromJson
Parses a plan document and checks its integrity.- Parameters:
json- the document- Returns:
- the plan, without a Fabric client bound
- Throws:
IllegalArgumentException- when the document is unreadable, of another schema version, or its storedplanIddoes not match its content
-
save
Writes a plan document atomically (a temporary file in the same directory, then a rename).- Parameters:
plan- the planfile- the destination, replaced if present- Throws:
UncheckedIOException- when the file cannot be written
-
load
Reads a plan document.- Parameters:
file- the file (UTF-8 JSON)- Returns:
- the plan, without a Fabric client bound
- Throws:
UncheckedIOException- when the file cannot be readIllegalArgumentException- when the content is not a valid plan document
-
planId
The plan's content identity; see the class description.- Parameters:
plan- the plan- Returns:
- 16 lowercase hex characters, equal for plans that would build the same thing
-