Class TemplateBuilderSpec

java.lang.Object
org.jclouds.compute.domain.TemplateBuilderSpec

@Beta public class TemplateBuilderSpec extends Object
A specification of a TemplateBuilder configuration.

TemplateBuilderSpec supports parsing configuration off of a string, which makes it especially useful for command-line configuration of a TemplateBuilder.

The string syntax is a series of comma-separated keys or key-value pairs, each corresponding to a TemplateBuilder method.

The set of supported keys will grow as TemplateBuilder evolves, but existing keys will never be removed.

Whitespace before and after commas and equal signs is ignored. Keys may not be repeated.

It is also illegal to use the following combination of keys

  • hardwareId and any of
    • minCores
    • minRam
    • hypervisorMatches
  • imageId and any of
    • imageNameMatches
    • osFamily
    • osVersionMatches
    • os64Bit
    • osArchMatches
    • osDescriptionMatches

TemplateBuilderSpec does not support configuring TemplateBuilder methods with non-value parameters. These must be configured in code.

A new TemplateBuilder can be instantiated from a TemplateBuilderSpec using TemplateBuilder.from(TemplateBuilderSpec) or TemplateBuilder.from(String).

Design inspired by

invalid reference
CacheBuilderSpec
Since:
1.5
  • Field Details

    • KEYS_SPLITTER

      protected static final com.google.common.base.Splitter KEYS_SPLITTER
      Splits each key-value pair.
    • KEY_VALUE_SPLITTER

      protected static final com.google.common.base.Splitter KEY_VALUE_SPLITTER
      Splits the key from the value.
    • VALUE_PARSERS

      protected static final com.google.common.collect.ImmutableMap<String,TemplateBuilderSpec.ValueParser> VALUE_PARSERS
      Map of names to ValueParser.
    • specification

      protected transient String specification
      Specification; used for toParseableString().
  • Constructor Details

    • TemplateBuilderSpec

      protected TemplateBuilderSpec()
    • TemplateBuilderSpec

      protected TemplateBuilderSpec(String specification)
  • Method Details

    • parse

      public static TemplateBuilderSpec parse(String templateBuilderSpecification)
      Creates a TemplateBuilderSpec from a string.
      Parameters:
      templateBuilderSpecification - the string form
    • copyTo

      public TemplateBuilder copyTo(TemplateBuilder builder, TemplateOptions templateOptions)
      Returns a TemplateBuilder configured according to this instance's specification.
      Parameters:
      templateOptions -
    • toParsableString

      public String toParsableString()
      Returns a string that can be used to parse an equivalent TemplateBuilderSpec. The order and form of this representation is not guaranteed, except that reparsing its output will produce a TemplateBuilderSpec equal to this instance.
    • toString

      public String toString()
      Returns a string representation for this TemplateBuilderSpec instance. The form of this representation is not guaranteed.
      Overrides:
      toString in class Object
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getHardwareId

      public String getHardwareId()
    • getMinCores

      public Double getMinCores()
    • getMinRam

      public Integer getMinRam()
    • getHypervisorMatches

      public String getHypervisorMatches()
    • getImageId

      public String getImageId()
    • getImageNameMatches

      public String getImageNameMatches()
    • getOsFamily

      public OsFamily getOsFamily()
    • getOsVersionMatches

      public String getOsVersionMatches()
    • getOs64Bit

      public Boolean getOs64Bit()
    • getOsArchMatches

      public String getOsArchMatches()
    • getOsDescriptionMatches

      public String getOsDescriptionMatches()
    • getLoginUser

      public String getLoginUser()
    • getAuthenticateSudo

      public Boolean getAuthenticateSudo()
    • getLocationId

      public String getLocationId()
    • getSpecification

      public String getSpecification()
    • getForceCacheReload

      public Boolean getForceCacheReload()