Class TemplateBuilderSpec
- java.lang.Object
-
- org.jclouds.compute.domain.TemplateBuilderSpec
-
@Beta public class TemplateBuilderSpec extends Object
A specification of aTemplateBuilderconfiguration.TemplateBuilderSpecsupports parsing configuration off of a string, which makes it especially useful for command-line configuration of aTemplateBuilder.The string syntax is a series of comma-separated keys or key-value pairs, each corresponding to a
TemplateBuildermethod.hardwareId=[String]: setsTemplateBuilder.hardwareId(java.lang.String).minCores=[double]: setsTemplateBuilder.minCores(double).minRam=[integer]: setsTemplateBuilder.minRam(int).hypervisorMatches=[String]: setsTemplateBuilder.hypervisorMatches(java.lang.String).imageId=[String]: setsTemplateBuilder.imageId(java.lang.String).imageNameMatches=[String]: setsTemplateBuilder.imageNameMatches(java.lang.String).osFamily=[OsFamily]: setsTemplateBuilder.osFamily(org.jclouds.compute.domain.OsFamily).osVersionMatches=[String]: setsTemplateBuilder.osVersionMatches(java.lang.String).os64Bit=[boolean]: setsTemplateBuilder.os64Bit(boolean).osArchMatches=[String]: setsTemplateBuilder.osArchMatches(java.lang.String).osDescriptionMatches=[String]: setsTemplateBuilder.osDescriptionMatches(java.lang.String).loginUser=[String]: setsTemplateOptions.overrideLoginCredentials(org.jclouds.domain.LoginCredentials)parsing password, if colon delimited.authenticateSudo=[Boolean]: setsTemplateOptions.overrideLoginCredentials(org.jclouds.domain.LoginCredentials), but only ifloginUseris set.locationId=[String]: setsTemplateBuilder.locationId(java.lang.String).
TemplateBuilderevolves, 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
hardwareIdand any ofminCoresminRamhypervisorMatches
imageIdand any ofimageNameMatchesosFamilyosVersionMatchesos64BitosArchMatchesosDescriptionMatches
TemplateBuilderSpecdoes not support configuringTemplateBuildermethods with non-value parameters. These must be configured in code.A new
TemplateBuildercan be instantiated from aTemplateBuilderSpecusingTemplateBuilder.from(TemplateBuilderSpec)orTemplateBuilder.from(String).Design inspired by
CacheBuilderSpec- Since:
- 1.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceTemplateBuilderSpec.ValueParserParses a single value.
-
Field Summary
Fields Modifier and Type Field Description protected static com.google.common.base.SplitterKEY_VALUE_SPLITTERSplits the key from the value.protected static com.google.common.base.SplitterKEYS_SPLITTERSplits each key-value pair.protected StringspecificationSpecification; used for toParseableString().protected static com.google.common.collect.ImmutableMap<String,TemplateBuilderSpec.ValueParser>VALUE_PARSERSMap of names to ValueParser.
-
Constructor Summary
Constructors Modifier Constructor Description protectedTemplateBuilderSpec()protectedTemplateBuilderSpec(String specification)
-
Method Summary
-
-
-
Field Detail
-
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 Detail
-
TemplateBuilderSpec
protected TemplateBuilderSpec()
-
TemplateBuilderSpec
protected TemplateBuilderSpec(String specification)
-
-
Method Detail
-
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 equivalentTemplateBuilderSpec. The order and form of this representation is not guaranteed, except that reparsing its output will produce aTemplateBuilderSpecequal to this instance.
-
toString
public String toString()
Returns a string representation for this TemplateBuilderSpec instance. The form of this representation is not guaranteed.
-
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()
-
-