@Beta public class TemplateBuilderSpec extends Object
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]
: sets TemplateBuilder.hardwareId(java.lang.String)
.
minCores=[double]
: sets TemplateBuilder.minCores(double)
.
minRam=[integer]
: sets TemplateBuilder.minRam(int)
.
hypervisorMatches=[String]
: sets
TemplateBuilder.hypervisorMatches(java.lang.String)
.
imageId=[String]
: sets TemplateBuilder.imageId(java.lang.String)
.
imageNameMatches=[String]
: sets
TemplateBuilder.imageNameMatches(java.lang.String)
.
osFamily=[OsFamily]
: sets TemplateBuilder.osFamily(org.jclouds.compute.domain.OsFamily)
.
osVersionMatches=[String]
: sets
TemplateBuilder.osVersionMatches(java.lang.String)
.
os64Bit=[boolean]
: sets TemplateBuilder.os64Bit(boolean)
.
osArchMatches=[String]
: sets
TemplateBuilder.osArchMatches(java.lang.String)
.
osDescriptionMatches=[String]
: sets
TemplateBuilder.osDescriptionMatches(java.lang.String)
.
loginUser=[String]
: sets
TemplateOptions.overrideLoginCredentials(org.jclouds.domain.LoginCredentials)
parsing password, if colon
delimited.
authenticateSudo=[Boolean]
: sets
TemplateOptions.overrideLoginCredentials(org.jclouds.domain.LoginCredentials)
, but only if
loginUser
is set.
locationId=[String]
: sets TemplateBuilder.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 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 CacheBuilderSpec
Modifier and Type | Class and Description |
---|---|
protected static interface |
TemplateBuilderSpec.ValueParser
Parses a single value.
|
Modifier and Type | Field and Description |
---|---|
protected static com.google.common.base.Splitter |
KEY_VALUE_SPLITTER
Splits the key from the value.
|
protected static com.google.common.base.Splitter |
KEYS_SPLITTER
Splits each key-value pair.
|
protected String |
specification
Specification; used for toParseableString().
|
protected static com.google.common.collect.ImmutableMap<String,TemplateBuilderSpec.ValueParser> |
VALUE_PARSERS
Map of names to ValueParser.
|
Modifier | Constructor and Description |
---|---|
protected |
TemplateBuilderSpec() |
protected |
TemplateBuilderSpec(String specification) |
Modifier and Type | Method and Description |
---|---|
TemplateBuilder |
copyTo(TemplateBuilder builder,
TemplateOptions templateOptions)
Returns a TemplateBuilder configured according to this instance's
specification.
|
boolean |
equals(Object obj) |
Boolean |
getAuthenticateSudo() |
String |
getHardwareId() |
String |
getHypervisorMatches() |
String |
getImageId() |
String |
getImageNameMatches() |
String |
getLocationId() |
String |
getLoginUser() |
Double |
getMinCores() |
Integer |
getMinRam() |
Boolean |
getOs64Bit() |
String |
getOsArchMatches() |
String |
getOsDescriptionMatches() |
OsFamily |
getOsFamily() |
String |
getOsVersionMatches() |
String |
getSpecification() |
int |
hashCode() |
static TemplateBuilderSpec |
parse(String templateBuilderSpecification)
Creates a TemplateBuilderSpec from a string.
|
String |
toParsableString()
Returns a string that can be used to parse an equivalent
TemplateBuilderSpec . |
String |
toString()
Returns a string representation for this TemplateBuilderSpec instance.
|
protected static final com.google.common.base.Splitter KEYS_SPLITTER
protected static final com.google.common.base.Splitter KEY_VALUE_SPLITTER
protected static final com.google.common.collect.ImmutableMap<String,TemplateBuilderSpec.ValueParser> VALUE_PARSERS
protected transient String specification
protected TemplateBuilderSpec()
protected TemplateBuilderSpec(String specification)
public static TemplateBuilderSpec parse(String templateBuilderSpecification)
templateBuilderSpecification
- the string formpublic TemplateBuilder copyTo(TemplateBuilder builder, TemplateOptions templateOptions)
templateOptions
- public String toParsableString()
TemplateBuilderSpec
. The order and form of this representation is
not guaranteed, except that reparsing its output will produce a
TemplateBuilderSpec
equal to this instance.public String toString()
public String getHardwareId()
public Double getMinCores()
public Integer getMinRam()
public String getHypervisorMatches()
public String getImageId()
public String getImageNameMatches()
public OsFamily getOsFamily()
public String getOsVersionMatches()
public Boolean getOs64Bit()
public String getOsArchMatches()
public String getOsDescriptionMatches()
public String getLoginUser()
public Boolean getAuthenticateSudo()
public String getLocationId()
public String getSpecification()
Copyright © 2009-2013 jclouds. All Rights Reserved.