Class TemplateBuilderSpec
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.
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).
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
hardwareIdand any ofminCoresminRamhypervisorMatches
imageIdand any ofimageNameMatchesosFamilyosVersionMatchesos64BitosArchMatchesosDescriptionMatches
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceParses a single value. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final com.google.common.base.SplitterSplits the key from the value.protected static final com.google.common.base.SplitterSplits each key-value pair.protected StringSpecification; used for toParseableString().protected static final com.google.common.collect.ImmutableMap<String, TemplateBuilderSpec.ValueParser> Map of names to ValueParser. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopyTo(TemplateBuilder builder, TemplateOptions templateOptions) Returns a TemplateBuilder configured according to this instance's specification.booleaninthashCode()static TemplateBuilderSpecCreates a TemplateBuilderSpec from a string.Returns a string that can be used to parse an equivalentTemplateBuilderSpec.toString()Returns a string representation for this TemplateBuilderSpec instance.
-
Field Details
-
KEYS_SPLITTER
protected static final com.google.common.base.Splitter KEYS_SPLITTERSplits each key-value pair. -
KEY_VALUE_SPLITTER
protected static final com.google.common.base.Splitter KEY_VALUE_SPLITTERSplits the key from the value. -
VALUE_PARSERS
protected static final com.google.common.collect.ImmutableMap<String,TemplateBuilderSpec.ValueParser> VALUE_PARSERSMap of names to ValueParser. -
specification
Specification; used for toParseableString().
-
-
Constructor Details
-
TemplateBuilderSpec
protected TemplateBuilderSpec() -
TemplateBuilderSpec
-
-
Method Details
-
parse
Creates a TemplateBuilderSpec from a string.- Parameters:
templateBuilderSpecification- the string form
-
copyTo
Returns a TemplateBuilder configured according to this instance's specification.- Parameters:
templateOptions-
-
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
Returns a string representation for this TemplateBuilderSpec instance. The form of this representation is not guaranteed. -
hashCode
public int hashCode() -
equals
-
getHardwareId
-
getMinCores
-
getMinRam
-
getHypervisorMatches
-
getImageId
-
getImageNameMatches
-
getOsFamily
-
getOsVersionMatches
-
getOs64Bit
-
getOsArchMatches
-
getOsDescriptionMatches
-
getLoginUser
-
getAuthenticateSudo
-
getLocationId
-
getSpecification
-
getForceCacheReload
-