Package org.jclouds.compute.options
Class TemplateOptions
java.lang.Object
org.jclouds.compute.options.RunScriptOptions
org.jclouds.compute.options.TemplateOptions
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
AzureTemplateOptions
,CloudStackTemplateOptions
,DigitalOcean2TemplateOptions
,DockerTemplateOptions
,EC2TemplateOptions
,GleSYSTemplateOptions
,GoGridTemplateOptions
,GoogleComputeEngineTemplateOptions
,NovaTemplateOptions
,PacketTemplateOptions
,SoftLayerTemplateOptions
,TemplateOptions.ImmutableTemplateOptions
Contains options supported in the
ComputeService#createNodesInGroup
operation. Usage
The recommended way to instantiate a TemplateOptions object is to statically import TemplateOptions.* and invoke a static creation method followed by any/all desired instance mutators.
import static org.jclouds.compute.options.TemplateOptions.Builder.*;
ComputeService client = // get connection
templateBuilder.options(inboundPorts(22, 80, 8080, 443));
Setinvalid input: '<'? 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
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
Nested classes/interfaces inherited from class org.jclouds.compute.options.RunScriptOptions
RunScriptOptions.ImmutableRunScriptOptions
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
static final TemplateOptions
protected String
protected String
protected Statement
Fields inherited from class org.jclouds.compute.options.RunScriptOptions
authenticateSudo, blockOnComplete, loginPassword, loginPrivateKey, loginUser, port, runAsRoot, seconds, taskName, wrapInInitScript
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends TemplateOptions>
TauthorizePublicKey
(String publicKey) authorize an rsa ssh key.blockOnComplete
(boolean blockOnComplete) As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.blockOnPort
(int port, int seconds) When the node is started, wait until the following port is activeblockUntilRunning
(boolean blockUntilRunning) Noteclone()
void
boolean
int[]
getTags()
int
hashCode()
inboundPorts
(int... ports) Opens the set of ports to public access.installPrivateKey
(String privateKey) replaces the rsa ssh key used at login.Assigns the created nodes to these networksspecifies names to be used for the created nodes.overrideAuthenticateSudo
(boolean authenticateSudo) overrideLoginCredentials
(LoginCredentials overridingCredentials) overrideLoginPassword
(String password) overrideLoginPrivateKey
(String privateKey) overrideLoginUser
(String loginUser) runAsRoot
(boolean runAsRoot) This script will be executed as the root user upon system startup.This script will be executed as the root user upon system startup.securityGroups
(Iterable<String> securityGroups) assigns the created nodes to these security groupssecurityGroups
(String... securityGroups) boolean
com.google.common.base.MoreObjects.ToStringHelper
string()
assigns tags to the created nodesuserMetadata
(String key, String value) userMetadata
(Map<String, String> userMetadata) wrapInInitScript
(boolean wrapInInitScript) default trueMethods inherited from class org.jclouds.compute.options.RunScriptOptions
copyTo, getLoginPassword, getLoginPrivateKey, getLoginUser, getPort, getSeconds, getTaskName, hasLoginPassword, hasLoginPasswordOption, hasLoginPrivateKey, hasLoginPrivateKeyOption, overrideLoginPassword, overrideLoginPrivateKey, shouldAuthenticateSudo, shouldBlockOnComplete, shouldRunAsRoot, shouldWrapInInitScript, toString
-
Field Details
-
NONE
-
inboundPorts
-
script
-
tags
-
securityGroups
-
privateKey
-
publicKey
-
blockUntilRunning
protected boolean blockUntilRunning -
userMetadata
-
nodeNames
-
networks
-
-
Constructor Details
-
TemplateOptions
public TemplateOptions()
-
-
Method Details
-
clone
-
copyTo
-
equals
- Overrides:
equals
in classRunScriptOptions
-
hashCode
public int hashCode()- Overrides:
hashCode
in classRunScriptOptions
-
string
public com.google.common.base.MoreObjects.ToStringHelper string()- Overrides:
string
in classRunScriptOptions
-
getInboundPorts
public int[] getInboundPorts() -
getRunScript
-
getTags
-
getNodeNames
-
getGroups
-
getPrivateKey
-
getPublicKey
-
getNetworks
-
shouldBlockUntilRunning
public boolean shouldBlockUntilRunning()- See Also:
-
as
-
runScript
This script will be executed as the root user upon system startup. This script gets a prologue, so no #!/bin/bash required, path set up, etc -
runScript
This script will be executed as the root user upon system startup. This script gets a prologue, so no #!/bin/bash required, path set up, etc -
installPrivateKey
replaces the rsa ssh key used at login. -
dontAuthorizePublicKey
-
authorizePublicKey
authorize an rsa ssh key. -
tags
assigns tags to the created nodes -
nodeNames
specifies names to be used for the created nodes. Note that this does not guarantee uniqueness - if there are already existing nodes with a name specified here, there will still be a new node created with the same name. Also, if more nodes are to be created than there are names, subsequent names will use the default naming strategy for that cloud. -
securityGroups
assigns the created nodes to these security groups -
securityGroups
- See Also:
-
networks
Assigns the created nodes to these networks -
networks
- See Also:
-
inboundPorts
Opens the set of ports to public access. -
blockUntilRunning
Note
As of version 1.1.0, this option is incompatible withrunScript(Statement)
andRunScriptOptions.blockOnComplete(boolean)
, as all current implementations utilize ssh in order to execute scripts.- Parameters:
blockUntilRunning
- (default true) whether to block until the nodes in this template are ininvalid reference
Status#RUNNING
-
userMetadata
- Parameters:
userMetadata
- user-defined metadata to assign to this server
-
userMetadata
- Parameters:
key
- key to place into the metadata mapvalue
- value to associate with that key
-
getUserMetadata
- See Also:
-
blockOnPort
Description copied from class:RunScriptOptions
When the node is started, wait until the following port is active- Overrides:
blockOnPort
in classRunScriptOptions
-
nameTask
- Overrides:
nameTask
in classRunScriptOptions
- Returns:
- What to call the task relating to this script; default
jclouds-script-timestamp
where timestamp is millis since epoch
-
runAsRoot
- Overrides:
runAsRoot
in classRunScriptOptions
-
wrapInInitScript
Description copied from class:RunScriptOptions
default true- Overrides:
wrapInInitScript
in classRunScriptOptions
- Parameters:
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)- Returns:
-
blockOnComplete
Description copied from class:RunScriptOptions
As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.- Overrides:
blockOnComplete
in classRunScriptOptions
- Parameters:
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)
-
overrideLoginCredentials
- Overrides:
overrideLoginCredentials
in classRunScriptOptions
-
overrideLoginPassword
- Overrides:
overrideLoginPassword
in classRunScriptOptions
-
overrideLoginPrivateKey
- Overrides:
overrideLoginPrivateKey
in classRunScriptOptions
-
overrideLoginUser
- Overrides:
overrideLoginUser
in classRunScriptOptions
-
overrideAuthenticateSudo
- Overrides:
overrideAuthenticateSudo
in classRunScriptOptions
-