Class AdminAccessBuilderSpec
- java.lang.Object
-
- org.jclouds.scriptbuilder.statements.login.AdminAccessBuilderSpec
-
public class AdminAccessBuilderSpec extends Object
A specification of aAdminAccess.Builder
configuration.AdminAccess.Builder
supports parsing configuration off of a string, which makes it especially useful for command-line configuration of aAdminAccess.Builder
.The string syntax is a series of comma-separated keys or key-value pairs, each corresponding to a
AdminAccess.Builder
method.adminUsername=[String]
: setsAdminAccess.Builder.adminUsername
.adminHome=[String]
: setsAdminAccess.Builder.adminHome
.adminPublicKeyFile=[String]
: setsAdminAccess.Builder.adminPublicKeyFile
.adminPrivateKeyFile=[String]
: setsAdminAccess.Builder.adminPrivateKeyFile
. *adminPassword=[String]
: setsAdminAccess.Builder.adminPassword
.loginPassword=[String]
: setsAdminAccess.Builder.loginPassword
.lockSsh=[Boolean]
: setsTemplateBuilder#lockSsh
.grantSudoToAdminUser=[Boolean]
: setsTemplateBuilder#grantSudoToAdminUser
.authorizeAdminPublicKey=[Boolean]
: setsTemplateBuilder#authorizeAdminPublicKey
.installAdminPrivateKey=[Boolean]
: setsTemplateBuilder#installAdminPrivateKey
.resetLoginPassword=[Boolean]
: setsTemplateBuilder#resetLoginPassword
.
Whitespace before and after commas and equal signs is ignored. Keys may not be repeated and both private key and public key must be passed through files, as they might include weird characters.
AdminAccessBuilderSpec
does not support configuringAdminAccess.Builder
methods with non-value parameters. These must be configured in code.A new
AdminAccess.Builder
can be instantiated from aAdminAccessBuilderSpec
usingAdminAccess.Builder.from(AdminAccessBuilderSpec)
orAdminAccess.Builder.from(String)
.Design inspired by
CacheBuilderSpec
- Since:
- 1.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
AdminAccessBuilderSpec.ValueParser
Parses a single value.
-
Field Summary
Fields Modifier and Type Field 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[]
specifications
Specification; used for toParseableString().protected static com.google.common.collect.ImmutableMap<String,AdminAccessBuilderSpec.ValueParser>
VALUE_PARSERS
Map of names to ValueParser.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AdminAccessBuilderSpec()
protected
AdminAccessBuilderSpec(String... specifications)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AdminAccess.Builder
copyTo(AdminAccess.Builder builder)
Returns a AdminAccess.Builder configured according to this instance's specification.boolean
equals(Object obj)
String
getAdminHome()
String
getAdminPassword()
File
getAdminPrivateKeyFile()
File
getAdminPublicKeyFile()
String
getAdminUsername()
Boolean
getGrantSudoToAdminUser()
Boolean
getInstallAdminPrivateKey()
Boolean
getLockSsh()
String
getLoginPassword()
Boolean
getResetLoginPassword()
int
hashCode()
static AdminAccessBuilderSpec
parse(String adminAccessSpecification)
Creates a AdminAccessBuilderSpec from multiple specifications,String[]
toParsableStrings()
Returns a string that can be used to parse an equivalentAdminAccessSpec
.String
toString()
Returns a string representation for this AdminAccessSpec instance.
-
-
-
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,AdminAccessBuilderSpec.ValueParser> VALUE_PARSERS
Map of names to ValueParser.
-
specifications
protected transient String[] specifications
Specification; used for toParseableString().
-
-
Constructor Detail
-
AdminAccessBuilderSpec
protected AdminAccessBuilderSpec()
-
AdminAccessBuilderSpec
protected AdminAccessBuilderSpec(String... specifications)
-
-
Method Detail
-
parse
public static AdminAccessBuilderSpec parse(String adminAccessSpecification)
Creates a AdminAccessBuilderSpec from multiple specifications,- Parameters:
adminAccessSpecification
- the string form
-
copyTo
public AdminAccess.Builder copyTo(AdminAccess.Builder builder)
Returns a AdminAccess.Builder configured according to this instance's specification.
-
toParsableStrings
public String[] toParsableStrings()
Returns a string that can be used to parse an equivalentAdminAccessSpec
. The order and form of this representation is not guaranteed, except that reparsing its output will produce aAdminAccessSpec
equal to this instance.
-
toString
public String toString()
Returns a string representation for this AdminAccessSpec instance. The form of this representation is not guaranteed.
-
getAdminUsername
public String getAdminUsername()
-
getAdminHome
public String getAdminHome()
-
getAdminPublicKeyFile
public File getAdminPublicKeyFile()
-
getAdminPrivateKeyFile
public File getAdminPrivateKeyFile()
-
getAdminPassword
public String getAdminPassword()
-
getLoginPassword
public String getLoginPassword()
-
getLockSsh
public Boolean getLockSsh()
-
getGrantSudoToAdminUser
public Boolean getGrantSudoToAdminUser()
-
getInstallAdminPrivateKey
public Boolean getInstallAdminPrivateKey()
-
getResetLoginPassword
public Boolean getResetLoginPassword()
-
-