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 ifloginUser
is 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
hardwareId
and any ofminCores
minRam
hypervisorMatches
imageId
and any ofimageNameMatches
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface
Parses a single value. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final com.google.common.base.Splitter
Splits the key from the value.protected static final com.google.common.base.Splitter
Splits each key-value pair.protected String
Specification; 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.boolean
int
hashCode()
static TemplateBuilderSpec
Creates 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 aTemplateBuilderSpec
equal 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
-