Record Class DesignSpec
java.lang.Object
java.lang.Record
com.eqixiac.equinix.design.spec.DesignSpec
- Record Components:
schemaVersion- the document format version; "1" is the only one this release readsname- short identifier for the designdescription- free text; may benullsites- places to serveworkloads- what runsclouds- clouds and service providers to reachpeers- networks to peer withconstraints- hard limits; nevernullobjectives- how options are ranked; nevernullcommercial- budget, currency, term and growth; nevernulllabels- free-form key/value tags carried through to results
public record DesignSpec(String schemaVersion, String name, String description, List<SiteIntent> sites, List<WorkloadIntent> workloads, List<CloudIntent> clouds, List<PeerIntent> peers, DesignConstraints constraints, DesignObjectives objectives, CommercialTerms commercial, Map<String,String> labels)
extends Record
One design, stated as intent. See the package description for the role it plays.
Build one fluently:
DesignSpec spec = DesignSpec.builder()
.name("payments-eu")
.site(SiteIntent.builder().label("London HQ").metro("LD").headcount(400).build())
.cloud(CloudIntent.builder().id("aws").provider(CloudProviderType.AWS).region("eu-west-2")
.monthlyEgressGb(50_000d).build())
.workload(WorkloadIntent.builder().label("api").bandwidthMbps(1000).clouds(List.of("aws")).build())
.constraints(DesignConstraints.builder().maxMetros(2).geoZones(List.of("UK", "EU")).build())
.build();
spec.requireValid();
or load it from a file with DesignSpecIO. Instances are immutable; use
toBuilder() to derive a variant (for a what-if comparison).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe document format version this release reads and writes. -
Constructor Summary
ConstructorsConstructorDescriptionDesignSpec(String schemaVersion, String name, String description, List<SiteIntent> sites, List<WorkloadIntent> workloads, List<CloudIntent> clouds, List<PeerIntent> peers, DesignConstraints constraints, DesignObjectives objectives, CommercialTerms commercial, Map<String, String> labels) Applies defaults and makes every collection immutable and non-null. -
Method Summary
Modifier and TypeMethodDescriptionLooks up a cloud by its id.clouds()Returns the value of thecloudsrecord component.Returns the value of thecommercialrecord component.Returns the value of theconstraintsrecord component.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.A stable identity for this spec's content: the SHA-256 of its canonical JSON.final inthashCode()Returns a hash code value for this object.labels()Returns the value of thelabelsrecord component.name()Returns the value of thenamerecord component.Returns the value of theobjectivesrecord component.peers()Returns the value of thepeersrecord component.Throws whenvalidate()reports any error.Returns the value of theschemaVersionrecord component.sites()Returns the value of thesitesrecord component.final StringtoString()Returns a string representation of this record class.validate()Checks the document for problems an engine could not recover from (errors) and for gaps that would leave part of a result unknown (warnings).Returns the value of theworkloadsrecord component.
-
Field Details
-
SCHEMA_VERSION
The document format version this release reads and writes.- See Also:
-
-
Constructor Details
-
DesignSpec
public DesignSpec(String schemaVersion, String name, String description, List<SiteIntent> sites, List<WorkloadIntent> workloads, List<CloudIntent> clouds, List<PeerIntent> peers, DesignConstraints constraints, DesignObjectives objectives, CommercialTerms commercial, Map<String, String> labels) Applies defaults and makes every collection immutable and non-null.
-
-
Method Details
-
cloud
Looks up a cloud by its id.- Parameters:
id- theCloudIntent.id()- Returns:
- the cloud, or
nullwhen the spec declares none with that id
-
fingerprint
A stable identity for this spec's content: the SHA-256 of its canonical JSON. Two specs with the same content have the same fingerprint whatever order their map entries were added in.- Returns:
- 64 lowercase hex characters
-
validate
-
requireValid
Throws whenvalidate()reports any error. Warnings do not throw.- Returns:
- this spec, for chaining
- Throws:
IllegalArgumentException- listing every error
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
schemaVersion
Returns the value of theschemaVersionrecord component.- Returns:
- the value of the
schemaVersionrecord component
-
name
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
sites
-
workloads
-
clouds
-
peers
-
constraints
Returns the value of theconstraintsrecord component.- Returns:
- the value of the
constraintsrecord component
-
objectives
Returns the value of theobjectivesrecord component.- Returns:
- the value of the
objectivesrecord component
-
commercial
Returns the value of thecommercialrecord component.- Returns:
- the value of the
commercialrecord component
-
labels
-