public class TemplateOptions extends RunScriptOptions implements Cloneable
ComputeService#createNodesInGroup
operation.
import static org.jclouds.compute.options.TemplateOptions.Builder.*;
ComputeService client = // get connection
templateBuilder.options(inboundPorts(22, 80, 8080, 443));
Set extends NodeMetadata> set = client.createNodesInGroup(tag, 2, templateBuilder.build());
Note that options can only be assigned to a builder once, so if assigning e.g. inboundPorts and tags,
that must be done in with mutators in a single call to options --
templateBuilder.options(inboundPorts(22, 80, 8080, 443).tags("I love it!"))
-- not as repeated calls to options
.
Modifier and Type | Class and Description |
---|---|
static class |
TemplateOptions.Builder |
static class |
TemplateOptions.ImmutableTemplateOptions |
RunScriptOptions.ImmutableRunScriptOptions
Modifier and Type | Field and Description |
---|---|
protected boolean |
blockUntilRunning |
protected Set<Integer> |
inboundPorts |
static TemplateOptions |
NONE |
protected String |
privateKey |
protected String |
publicKey |
protected Statement |
script |
protected Set<String> |
tags |
protected Map<String,String> |
userMetadata |
authenticateSudo, blockOnComplete, loginPassword, loginPrivateKey, loginUser, port, runAsRoot, seconds, taskName, wrapInInitScript
Constructor and Description |
---|
TemplateOptions() |
Modifier and Type | Method and Description |
---|---|
<T extends TemplateOptions> |
as(Class<T> clazz) |
TemplateOptions |
authorizePublicKey(String publicKey)
authorize an rsa ssh key.
|
TemplateOptions |
blockOnComplete(boolean blockOnComplete)
As of version 1.1.0, we cannot kick off a script unless a node is in
RUNNING state.
|
TemplateOptions |
blockOnPort(int port,
int seconds)
When the node is started, wait until the following port is active
|
TemplateOptions |
blockUntilRunning(boolean blockUntilRunning)
Note
|
TemplateOptions |
clone() |
void |
copyTo(TemplateOptions to) |
TemplateOptions |
dontAuthorizePublicKey() |
boolean |
equals(Object o) |
int[] |
getInboundPorts() |
String |
getPrivateKey() |
String |
getPublicKey() |
Statement |
getRunScript() |
Set<String> |
getTags() |
Map<String,String> |
getUserMetadata() |
int |
hashCode() |
TemplateOptions |
inboundPorts(int... ports)
Opens the set of ports to public access.
|
TemplateOptions |
installPrivateKey(String privateKey)
replaces the rsa ssh key used at login.
|
TemplateOptions |
nameTask(String name) |
TemplateOptions |
overrideAuthenticateSudo(boolean authenticateSudo) |
TemplateOptions |
overrideLoginCredentials(LoginCredentials overridingCredentials) |
TemplateOptions |
overrideLoginPassword(String password) |
TemplateOptions |
overrideLoginPrivateKey(String privateKey) |
TemplateOptions |
overrideLoginUser(String loginUser) |
TemplateOptions |
runAsRoot(boolean runAsRoot) |
TemplateOptions |
runScript(Statement script)
This script will be executed as the root user upon system startup.
|
TemplateOptions |
runScript(String script)
This script will be executed as the root user upon system startup.
|
boolean |
shouldBlockUntilRunning() |
com.google.common.base.Objects.ToStringHelper |
string() |
TemplateOptions |
tags(Iterable<String> tags)
assigns tags to the created nodes
|
TemplateOptions |
userMetadata(Map<String,String> userMetadata) |
TemplateOptions |
userMetadata(String key,
String value) |
TemplateOptions |
wrapInInitScript(boolean wrapInInitScript)
default true
|
getLoginPassword, getLoginPrivateKey, getLoginUser, getPort, getSeconds, getTaskName, hasLoginPassword, hasLoginPasswordOption, hasLoginPrivateKey, hasLoginPrivateKeyOption, shouldAuthenticateSudo, shouldBlockOnComplete, shouldRunAsRoot, shouldWrapInInitScript, toString
public static final TemplateOptions NONE
protected Statement script
protected String privateKey
protected String publicKey
protected boolean blockUntilRunning
public TemplateOptions clone()
public void copyTo(TemplateOptions to)
public boolean equals(Object o)
equals
in class RunScriptOptions
public int hashCode()
hashCode
in class RunScriptOptions
public com.google.common.base.Objects.ToStringHelper string()
string
in class RunScriptOptions
public int[] getInboundPorts()
public Statement getRunScript()
public String getPrivateKey()
public String getPublicKey()
public boolean shouldBlockUntilRunning()
public <T extends TemplateOptions> T as(Class<T> clazz)
public TemplateOptions runScript(String script)
public TemplateOptions runScript(Statement script)
public TemplateOptions installPrivateKey(String privateKey)
public TemplateOptions dontAuthorizePublicKey()
public TemplateOptions authorizePublicKey(String publicKey)
public TemplateOptions tags(Iterable<String> tags)
public TemplateOptions inboundPorts(int... ports)
public TemplateOptions blockUntilRunning(boolean blockUntilRunning)
TemplateOptions.ImmutableTemplateOptions.runScript(Statement)
and
RunScriptOptions.blockOnComplete(boolean)
, as all current
implementations utilize ssh in order to execute scripts.blockUntilRunning
- (default true) whether to block until the nodes in this template
are in Status#RUNNING
statepublic TemplateOptions userMetadata(Map<String,String> userMetadata)
userMetadata
- user-defined metadata to assign to this serverpublic TemplateOptions userMetadata(String key, String value)
key
- key to place into the metadata mapvalue
- value to associate with that keypublic Map<String,String> getUserMetadata()
userMetadata(Map)
public TemplateOptions blockOnPort(int port, int seconds)
RunScriptOptions
blockOnPort
in class RunScriptOptions
public TemplateOptions nameTask(String name)
nameTask
in class RunScriptOptions
jclouds-script-timestamp
where timestamp is millis since
epochpublic TemplateOptions runAsRoot(boolean runAsRoot)
runAsRoot
in class RunScriptOptions
public TemplateOptions wrapInInitScript(boolean wrapInInitScript)
RunScriptOptions
wrapInInitScript
in class RunScriptOptions
wrapInInitScript
- if the command is long-running, use this option to ensure it is
wrapInInitScripted properly. (ex. have jclouds wrap it an init
script, nohup, etc)public TemplateOptions blockOnComplete(boolean blockOnComplete)
RunScriptOptions
blockOnComplete
in class RunScriptOptions
blockOnComplete
- (default true) false means kick off the script in the
background, but don't wait for it to finish. (as of version
1.1.0, implemented as nohup)public TemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials)
overrideLoginCredentials
in class RunScriptOptions
public TemplateOptions overrideLoginPassword(String password)
overrideLoginPassword
in class RunScriptOptions
public TemplateOptions overrideLoginPrivateKey(String privateKey)
overrideLoginPrivateKey
in class RunScriptOptions
public TemplateOptions overrideLoginUser(String loginUser)
overrideLoginUser
in class RunScriptOptions
public TemplateOptions overrideAuthenticateSudo(boolean authenticateSudo)
overrideAuthenticateSudo
in class RunScriptOptions
Copyright © 2009-2013 jclouds. All Rights Reserved.