Package org.jclouds.ec2.compute.options
Class EC2TemplateOptions
java.lang.Object
org.jclouds.compute.options.RunScriptOptions
org.jclouds.compute.options.TemplateOptions
org.jclouds.ec2.compute.options.EC2TemplateOptions
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
AWSEC2TemplateOptions
Contains options supported in the
ComputeService#runNode
operation on
the "ec2" provider. Usage
The recommended way to instantiate a EC2TemplateOptions object is to statically import EC2TemplateOptions.* and invoke a static creation method followed by an instance mutator (if needed):
import static org.jclouds.aws.ec2.compute.options.EC2TemplateOptions.Builder.*;
ComputeService client = // get connection
templateBuilder.options(inboundPorts(22, 80, 8080, 443));
Setinvalid input: '<'? extends NodeMetadata> set = client.createNodesInGroup(tag, 2, templateBuilder.build());
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.jclouds.compute.options.TemplateOptions
TemplateOptions.ImmutableTemplateOptions
Nested classes/interfaces inherited from class org.jclouds.compute.options.RunScriptOptions
RunScriptOptions.ImmutableRunScriptOptions
-
Field Summary
FieldsFields inherited from class org.jclouds.compute.options.TemplateOptions
blockUntilRunning, inboundPorts, networks, nodeNames, privateKey, publicKey, script, securityGroups, tags, userMetadata
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 TypeMethodDescriptionauthorizePublicKey
(String publicKey) authorize an rsa ssh key.blockDeviceMappings
(Iterable<? extends BlockDeviceMapping> blockDeviceMappings) 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) NoteclientToken
(String clientToken) clone()
void
boolean
See here for more information.int
byte[]
int
hashCode()
inboundPorts
(int... ports) Opens the set of ports to public access.installPrivateKey
(String privateKey) replaces the rsa ssh key used at login.Specifies the keypair used to run instances withmapEBSSnapshotToDeviceName
(String deviceName, String snapshotId, Integer sizeInGib, boolean deleteOnTermination) mapEBSSnapshotToDeviceName
(String deviceName, String snapshotId, Integer sizeInGib, boolean deleteOnTermination, String volumeType, Integer iops, boolean encrypted) mapEphemeralDeviceToDeviceName
(String deviceName, String virtualName) mapNewVolumeToDeviceName
(String deviceName, int sizeInGib, boolean deleteOnTermination) mapNewVolumeToDeviceName
(String deviceName, int sizeInGib, boolean deleteOnTermination, String volumeType, Integer iops, boolean encrypted) Assigns the created nodes to these networksspecifies names to be used for the created nodes.Do not use a keypair on instancesoverrideAuthenticateSudo
(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> groupNames) Specifies the security groups to be used for nodes with this templatesecurityGroups
(String... groupNames) boolean
com.google.common.base.MoreObjects.ToStringHelper
string()
assigns tags to the created nodesunmapDeviceNamed
(String deviceName) userData
(byte[] unencodedData) Unencoded datauserMetadata
(String key, String value) userMetadata
(Map<String, String> userMetadata) wrapInInitScript
(boolean wrapInInitScript) default trueMethods inherited from class org.jclouds.compute.options.TemplateOptions
as, getInboundPorts, getNetworks, getNodeNames, getPrivateKey, getPublicKey, getRunScript, getTags, getUserMetadata, networks, shouldBlockUntilRunning
Methods 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
-
-
Constructor Details
-
EC2TemplateOptions
public EC2TemplateOptions()
-
-
Method Details
-
clone
- Overrides:
clone
in classTemplateOptions
-
copyTo
- Overrides:
copyTo
in classTemplateOptions
-
equals
- Overrides:
equals
in classTemplateOptions
-
hashCode
public int hashCode()- Overrides:
hashCode
in classTemplateOptions
-
string
public com.google.common.base.MoreObjects.ToStringHelper string()- Overrides:
string
in classTemplateOptions
-
securityGroups
- Overrides:
securityGroups
in classTemplateOptions
- See Also:
-
securityGroups
Specifies the security groups to be used for nodes with this template- Overrides:
securityGroups
in classTemplateOptions
-
userData
Unencoded data -
keyPair
Specifies the keypair used to run instances with -
noKeyPair
Do not use a keypair on instances -
mapEBSSnapshotToDeviceName
public EC2TemplateOptions mapEBSSnapshotToDeviceName(String deviceName, String snapshotId, @Nullable Integer sizeInGib, boolean deleteOnTermination) -
mapEBSSnapshotToDeviceName
-
mapNewVolumeToDeviceName
public EC2TemplateOptions mapNewVolumeToDeviceName(String deviceName, int sizeInGib, boolean deleteOnTermination) -
mapNewVolumeToDeviceName
-
mapEphemeralDeviceToDeviceName
-
unmapDeviceNamed
-
blockDeviceMappings
public EC2TemplateOptions blockDeviceMappings(Iterable<? extends BlockDeviceMapping> blockDeviceMappings) -
maxCount
-
clientToken
-
blockOnPort
When the node is started, wait until the following port is active- Overrides:
blockOnPort
in classTemplateOptions
-
inboundPorts
Opens the set of ports to public access.- Overrides:
inboundPorts
in classTemplateOptions
-
authorizePublicKey
authorize an rsa ssh key.- Overrides:
authorizePublicKey
in classTemplateOptions
-
installPrivateKey
replaces the rsa ssh key used at login.- Overrides:
installPrivateKey
in classTemplateOptions
-
blockUntilRunning
Note
As of version 1.1.0, this option is incompatible withTemplateOptions.runScript(Statement)
andRunScriptOptions.blockOnComplete(boolean)
, as all current implementations utilize ssh in order to execute scripts.- Overrides:
blockUntilRunning
in classTemplateOptions
- Parameters:
blockUntilRunning
- (default true) whether to block until the nodes in this template are ininvalid reference
Status#RUNNING
-
dontAuthorizePublicKey
- Overrides:
dontAuthorizePublicKey
in classTemplateOptions
-
nameTask
- Overrides:
nameTask
in classTemplateOptions
- Returns:
- What to call the task relating to this script; default
jclouds-script-timestamp
where timestamp is millis since epoch
-
runAsRoot
- Overrides:
runAsRoot
in classTemplateOptions
-
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- Overrides:
runScript
in classTemplateOptions
-
overrideLoginCredentials
- Overrides:
overrideLoginCredentials
in classTemplateOptions
-
overrideLoginPassword
- Overrides:
overrideLoginPassword
in classTemplateOptions
-
overrideLoginPrivateKey
- Overrides:
overrideLoginPrivateKey
in classTemplateOptions
-
overrideLoginUser
- Overrides:
overrideLoginUser
in classTemplateOptions
-
overrideAuthenticateSudo
- Overrides:
overrideAuthenticateSudo
in classTemplateOptions
-
userMetadata
- Overrides:
userMetadata
in classTemplateOptions
- Parameters:
userMetadata
- user-defined metadata to assign to this server
-
userMetadata
- Overrides:
userMetadata
in classTemplateOptions
- Parameters:
key
- key to place into the metadata mapvalue
- value to associate with that key
-
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.- Overrides:
nodeNames
in classTemplateOptions
-
networks
Assigns the created nodes to these networks- Overrides:
networks
in classTemplateOptions
-
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- Overrides:
runScript
in classTemplateOptions
-
tags
assigns tags to the created nodes- Overrides:
tags
in classTemplateOptions
-
wrapInInitScript
default true- Overrides:
wrapInInitScript
in classTemplateOptions
- 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
As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.- Overrides:
blockOnComplete
in classTemplateOptions
- 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)
-
getGroups
- Overrides:
getGroups
in classTemplateOptions
- Returns:
- groupNames the user specified to run instances with, or zero length set to create an implicit group
-
getKeyPair
- Returns:
- keyPair to use when running the instance or null, to generate a keypair.
-
shouldAutomaticallyCreateKeyPair
public boolean shouldAutomaticallyCreateKeyPair()- Returns:
- true (default) if we are supposed to use a keypair
-
getUserData
public byte[] getUserData()- Returns:
- unencoded user data.
-
getBlockDeviceMappings
- Returns:
- BlockDeviceMapping to use when running the instance or null.
-
getMaxCount
public int getMaxCount()- Returns:
- the maximum number of instances to create
-
getClientToken
See here for more information.- Returns:
- the optional client token string, used for idempotency
-