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 reads
name - short identifier for the design
description - free text; may be null
sites - places to serve
workloads - what runs
clouds - clouds and service providers to reach
peers - networks to peer with
constraints - hard limits; never null
objectives - how options are ranked; never null
commercial - budget, currency, term and growth; never null
labels - 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 Details

    • SCHEMA_VERSION

      public static final String SCHEMA_VERSION
      The document format version this release reads and writes.
      See Also:
  • Constructor Details

  • Method Details

    • cloud

      public CloudIntent cloud(String id)
      Looks up a cloud by its id.
      Parameters:
      id - the CloudIntent.id()
      Returns:
      the cloud, or null when the spec declares none with that id
    • fingerprint

      public String 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

      public List<SpecIssue> 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). Never throws.
      Returns:
      the issues found, errors first; empty when the spec is clean
    • requireValid

      public DesignSpec requireValid()
      Throws when validate() reports any error. Warnings do not throw.
      Returns:
      this spec, for chaining
      Throws:
      IllegalArgumentException - listing every error
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • schemaVersion

      public String schemaVersion()
      Returns the value of the schemaVersion record component.
      Returns:
      the value of the schemaVersion record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • sites

      public List<SiteIntent> sites()
      Returns the value of the sites record component.
      Returns:
      the value of the sites record component
    • workloads

      public List<WorkloadIntent> workloads()
      Returns the value of the workloads record component.
      Returns:
      the value of the workloads record component
    • clouds

      public List<CloudIntent> clouds()
      Returns the value of the clouds record component.
      Returns:
      the value of the clouds record component
    • peers

      public List<PeerIntent> peers()
      Returns the value of the peers record component.
      Returns:
      the value of the peers record component
    • constraints

      public DesignConstraints constraints()
      Returns the value of the constraints record component.
      Returns:
      the value of the constraints record component
    • objectives

      public DesignObjectives objectives()
      Returns the value of the objectives record component.
      Returns:
      the value of the objectives record component
    • commercial

      public CommercialTerms commercial()
      Returns the value of the commercial record component.
      Returns:
      the value of the commercial record component
    • labels

      public Map<String,String> labels()
      Returns the value of the labels record component.
      Returns:
      the value of the labels record component