Class DeploymentSpec

java.lang.Object
com.yahoo.config.application.api.DeploymentSpec

public class DeploymentSpec extends Object
Specifies the environments and regions to which an application should be deployed. This may be used both for inspection as part of an application model and to answer queries about deployment from the command line. A main method is included for the latter usage. A deployment consists of a number of steps executed in the order listed in deployment xml, as well as some additional settings. This is immutable.
Author:
bratseth
  • Field Details

    • empty

      public static final DeploymentSpec empty
      The empty deployment spec, specifying no zones or rotation, and defaults for all settings
  • Constructor Details

  • Method Details

    • isEmpty

      public boolean isEmpty()
    • majorVersion

      public Optional<Integer> majorVersion()
      Returns the major version this application is pinned to, or empty (default) to allow all major versions
    • steps

      public List<DeploymentSpec.Step> steps()
      Returns the deployment steps of this in the order they will be performed
    • athenzDomain

      public Optional<com.yahoo.config.provision.AthenzDomain> athenzDomain()
      Returns the Athenz domain set on the root tag, if any
    • athenzService

      public Optional<com.yahoo.config.provision.AthenzService> athenzService()
      Returns the Athenz service set on the root tag, if any
    • athenzService

      public Optional<com.yahoo.config.provision.AthenzService> athenzService(com.yahoo.config.provision.InstanceName instance, com.yahoo.config.provision.Environment environment, com.yahoo.config.provision.RegionName region)
      The most specific Athenz service for the given arguments.
    • cloudAccount

      public com.yahoo.config.provision.CloudAccount cloudAccount(com.yahoo.config.provision.CloudName cloud, com.yahoo.config.provision.InstanceName instance, com.yahoo.config.provision.zone.ZoneId zone)
      The most specific Cloud account for the given arguments.
    • cloudAccounts

      public Map<com.yahoo.config.provision.CloudName,com.yahoo.config.provision.CloudAccount> cloudAccounts()
    • hostTTL

      public Optional<Duration> hostTTL(com.yahoo.config.provision.InstanceName instance, com.yahoo.config.provision.Environment environment, com.yahoo.config.provision.RegionName region)
      Additional host time-to-live for this application. Requires a custom cloud account to be set. This also applies only to zones with dynamic provisioning, and is then the time hosts are allowed remain empty, before being deprovisioned. This is useful for applications which frequently deploy to, e.g., test and staging zones, and want to avoid the delay of having to provision hosts.
    • zoneEndpoint

      public com.yahoo.config.provision.ZoneEndpoint zoneEndpoint(com.yahoo.config.provision.InstanceName instance, com.yahoo.config.provision.zone.ZoneId zone, com.yahoo.config.provision.ClusterSpec.Id cluster)
      Returns the most specific zone endpoint, where specificity is given, in decreasing order: 1. The given instance has declared a zone endpoint for the cluster, for the given region. 2. The given instance has declared a universal zone endpoint for the cluster. 3. The application has declared a zone endpoint for the cluster, for the given region. 4. The application has declared a universal zone endpoint for the cluster. 5. None of the above apply, and the default of a publicly visible endpoint is used.
    • bcp

      @Deprecated public Bcp bcp()
      Deprecated.
      returns Bcp.empty().
    • xmlForm

      public String xmlForm()
      Returns the XML form of this spec, or null if it was not created by fromXml, nor is empty
    • instance

      public Optional<DeploymentInstanceSpec> instance(com.yahoo.config.provision.InstanceName name)
      Returns the instance step containing the given instance name
    • requireInstance

      public DeploymentInstanceSpec requireInstance(String name)
    • requireInstance

      public DeploymentInstanceSpec requireInstance(com.yahoo.config.provision.InstanceName name)
    • instanceNames

      public List<com.yahoo.config.provision.InstanceName> instanceNames()
      Returns the instance names declared in this
    • instances

      public List<DeploymentInstanceSpec> instances()
      Returns the step descendants of this which are instances
    • endpoints

      public List<Endpoint> endpoints()
      Returns the application-level endpoints of this, if any
    • deprecatedElements

      public List<DeploymentSpec.DeprecatedElement> deprecatedElements()
      Returns the deprecated elements used when creating this
    • fromXml

      public static DeploymentSpec fromXml(Reader reader)
      Creates a deployment spec from XML.
      Throws:
      IllegalArgumentException - if the XML is invalid
    • fromXml

      public static DeploymentSpec fromXml(String xmlForm)
      Creates a deployment spec from XML.
      Throws:
      IllegalArgumentException - if the XML is invalid
    • fromXml

      public static DeploymentSpec fromXml(String xmlForm, boolean validate)
      Creates a deployment spec from XML.
      Throws:
      IllegalArgumentException - if the XML is invalid
    • toMessageString

      public static String toMessageString(Throwable t)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • deployableHashCode

      public int deployableHashCode()
      Computes a hash of all fields that influence what is deployed with this spec, i.e., not orchestration.