Class DeploymentSpec


  • public class DeploymentSpec
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      static DeploymentSpec empty
      The empty deployment spec, specifying no zones or rotation, and defaults for all settings
    • Constructor Summary

      Constructors 
      Constructor Description
      DeploymentSpec​(java.util.List<DeploymentSpec.Step> steps, java.util.Optional<java.lang.Integer> majorVersion, java.util.Optional<com.yahoo.config.provision.AthenzDomain> athenzDomain, java.util.Optional<com.yahoo.config.provision.AthenzService> athenzService, java.lang.String xmlForm)  
      DeploymentSpec​(java.util.Optional<java.lang.String> globalServiceId, DeploymentSpec.UpgradePolicy upgradePolicy, java.util.Optional<java.lang.Integer> majorVersion, java.util.List<DeploymentSpec.ChangeBlocker> changeBlockers, java.util.List<DeploymentSpec.Step> steps, java.lang.String xmlForm, java.util.Optional<com.yahoo.config.provision.AthenzDomain> athenzDomain, java.util.Optional<com.yahoo.config.provision.AthenzService> athenzService, Notifications notifications, java.util.List<Endpoint> endpoints)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<com.yahoo.config.provision.AthenzDomain> athenzDomain()
      Returns the Athenz domain set on the root tag, if any
      java.util.Optional<com.yahoo.config.provision.AthenzService> athenzService​(com.yahoo.config.provision.Environment environment, com.yahoo.config.provision.RegionName region)
      Returns the Athenz service to use for the given environment and region, if any
      java.util.Optional<com.yahoo.config.provision.AthenzService> athenzService​(com.yahoo.config.provision.InstanceName instanceName, com.yahoo.config.provision.Environment environment, com.yahoo.config.provision.RegionName region)
      Returns the Athenz service to use for the given instance, environment and region, if any.
      boolean canChangeRevisionAt​(java.time.Instant instant)  
      boolean canUpgradeAt​(java.time.Instant instant)  
      java.util.List<DeploymentSpec.ChangeBlocker> changeBlocker()  
      java.util.List<Endpoint> endpoints()  
      boolean equals​(java.lang.Object o)  
      static DeploymentSpec fromXml​(java.io.Reader reader)
      Creates a deployment spec from XML.
      static DeploymentSpec fromXml​(java.lang.String xmlForm)
      Creates a deployment spec from XML.
      static DeploymentSpec fromXml​(java.lang.String xmlForm, boolean validate)
      Creates a deployment spec from XML.
      java.util.Optional<java.lang.String> globalServiceId()  
      int hashCode()  
      boolean includes​(com.yahoo.config.provision.Environment environment, java.util.Optional<com.yahoo.config.provision.RegionName> region)  
      java.util.Optional<DeploymentInstanceSpec> instance​(com.yahoo.config.provision.InstanceName name)
      Returns the instance step containing the given instance name
      java.util.List<com.yahoo.config.provision.InstanceName> instanceNames()
      Returns the instance names declared in this
      java.util.List<DeploymentInstanceSpec> instances()
      Returns the step descendants of this which are instances
      static void main​(java.lang.String[] args)
      This may be invoked by a continuous build
      java.util.Optional<java.lang.Integer> majorVersion()
      Returns the major version this application is pinned to, or empty (default) to allow all major versions
      Notifications notifications()  
      DeploymentInstanceSpec requireInstance​(com.yahoo.config.provision.InstanceName name)  
      DeploymentInstanceSpec requireInstance​(java.lang.String name)  
      java.util.List<DeploymentSpec.Step> steps()
      Returns the deployment steps of this in the order they will be performed
      static java.lang.String toMessageString​(java.lang.Throwable t)  
      DeploymentSpec.UpgradePolicy upgradePolicy()  
      java.lang.String xmlForm()
      Returns the XML form of this spec, or null if it was not created by fromXml, nor is empty
      java.util.List<DeploymentSpec.DeclaredZone> zones()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • empty

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

      • DeploymentSpec

        public DeploymentSpec​(java.util.List<DeploymentSpec.Step> steps,
                              java.util.Optional<java.lang.Integer> majorVersion,
                              java.util.Optional<com.yahoo.config.provision.AthenzDomain> athenzDomain,
                              java.util.Optional<com.yahoo.config.provision.AthenzService> athenzService,
                              java.lang.String xmlForm)
      • DeploymentSpec

        public DeploymentSpec​(java.util.Optional<java.lang.String> globalServiceId,
                              DeploymentSpec.UpgradePolicy upgradePolicy,
                              java.util.Optional<java.lang.Integer> majorVersion,
                              java.util.List<DeploymentSpec.ChangeBlocker> changeBlockers,
                              java.util.List<DeploymentSpec.Step> steps,
                              java.lang.String xmlForm,
                              java.util.Optional<com.yahoo.config.provision.AthenzDomain> athenzDomain,
                              java.util.Optional<com.yahoo.config.provision.AthenzService> athenzService,
                              Notifications notifications,
                              java.util.List<Endpoint> endpoints)
    • Method Detail

      • globalServiceId

        public java.util.Optional<java.lang.String> globalServiceId()
      • majorVersion

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

        public boolean canUpgradeAt​(java.time.Instant instant)
      • canChangeRevisionAt

        public boolean canChangeRevisionAt​(java.time.Instant instant)
      • steps

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

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

        public java.util.Optional<com.yahoo.config.provision.AthenzService> athenzService​(com.yahoo.config.provision.Environment environment,
                                                                                          com.yahoo.config.provision.RegionName region)
        Returns the Athenz service to use for the given environment and region, if any
      • athenzService

        public java.util.Optional<com.yahoo.config.provision.AthenzService> athenzService​(com.yahoo.config.provision.InstanceName instanceName,
                                                                                          com.yahoo.config.provision.Environment environment,
                                                                                          com.yahoo.config.provision.RegionName region)
        Returns the Athenz service to use for the given instance, environment and region, if any. This returns the default set on the deploy tag (if any) if nothing is set for this particular combination of instance, environment and region, and also if that combination is not specified at all in services.
      • endpoints

        public java.util.List<Endpoint> endpoints()
      • xmlForm

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

        public boolean includes​(com.yahoo.config.provision.Environment environment,
                                java.util.Optional<com.yahoo.config.provision.RegionName> region)
      • instance

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

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

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

        public java.util.List<DeploymentInstanceSpec> instances()
        Returns the step descendants of this which are instances
      • fromXml

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

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

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

        public static java.lang.String toMessageString​(java.lang.Throwable t)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • main

        public static void main​(java.lang.String[] args)
        This may be invoked by a continuous build