org.jclouds.aws.ec2.compute
Class AWSEC2TemplateOptions

java.lang.Object
  extended by org.jclouds.compute.options.RunScriptOptions
      extended by org.jclouds.compute.options.TemplateOptions
          extended by org.jclouds.ec2.compute.options.EC2TemplateOptions
              extended by org.jclouds.aws.ec2.compute.AWSEC2TemplateOptions
All Implemented Interfaces:
Cloneable

public class AWSEC2TemplateOptions
extends EC2TemplateOptions
implements Cloneable

Contains options supported in the ComputeService#runNode operation on the "ec2" provider.

Usage

The recommended way to instantiate a AWSEC2TemplateOptions object is to statically import AWSEC2TemplateOptions.* and invoke a static creation method followed by an instance mutator (if needed):

import static org.jclouds.aws.ec2.compute.options.AWSEC2TemplateOptions.Builder.*;

ComputeService client = // get connection templateBuilder.options(inboundPorts(22, 80, 8080, 443)); Set set = client.runNodesWithTag(tag, 2, templateBuilder.build());

Author:
Adrian Cole

Nested Class Summary
static class AWSEC2TemplateOptions.Builder
           
 
Nested 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
static AWSEC2TemplateOptions NONE
           
 
Fields inherited from class org.jclouds.compute.options.TemplateOptions
blockUntilRunning, inboundPorts, privateKey, publicKey, script, tags, userMetadata
 
Fields inherited from class org.jclouds.compute.options.RunScriptOptions
blockOnComplete, overridingCredentials, port, runAsRoot, seconds, taskName, wrapInInitScript
 
Constructor Summary
AWSEC2TemplateOptions()
           
 
Method Summary
 AWSEC2TemplateOptions authorizePublicKey(Payload publicKey)
          Deprecated. 
 AWSEC2TemplateOptions authorizePublicKey(String publicKey)
          authorize an rsa ssh key.
 AWSEC2TemplateOptions blockDeviceMappings(Iterable<? extends BlockDeviceMapping> blockDeviceMappings)
          
 AWSEC2TemplateOptions blockOnPort(int port, int seconds)
          When the node is started, wait until the following port is active
 AWSEC2TemplateOptions blockUntilRunning(boolean blockUntilRunning)
          Note
 AWSEC2TemplateOptions clone()
           
 void copyTo(TemplateOptions to)
           
 AWSEC2TemplateOptions dontAuthorizePublicKey()
          
 AWSEC2TemplateOptions enableMonitoring()
          Enable Cloudwatch monitoring
 boolean equals(Object obj)
           
 Set<String> getGroupIds()
           
 String getPlacementGroup()
           
 RequestSpotInstancesOptions getSpotOptions()
           
 Float getSpotPrice()
           
 String getSubnetId()
           
 int hashCode()
           
 AWSEC2TemplateOptions inboundPorts(int... ports)
          Opens the set of ports to public access.
 AWSEC2TemplateOptions installPrivateKey(Payload privateKey)
          Deprecated. 
 AWSEC2TemplateOptions installPrivateKey(String privateKey)
          replaces the rsa ssh key used at login.
 boolean isMonitoringEnabled()
           
 AWSEC2TemplateOptions keyPair(String keyPair)
          Specifies the keypair used to run instances with
 AWSEC2TemplateOptions mapEBSSnapshotToDeviceName(String deviceName, String snapshotId, Integer sizeInGib, boolean deleteOnTermination)
          
 AWSEC2TemplateOptions mapEphemeralDeviceToDeviceName(String deviceName, String virtualName)
          
 AWSEC2TemplateOptions mapNewVolumeToDeviceName(String deviceName, int sizeInGib, boolean deleteOnTermination)
          
 AWSEC2TemplateOptions nameTask(String name)
          
 AWSEC2TemplateOptions noKeyPair()
          Do not use a keypair on instances
 AWSEC2TemplateOptions noPlacementGroup()
          Do not use a keypair on instances
 AWSEC2TemplateOptions overrideCredentialsWith(Credentials overridingCredentials)
          
 AWSEC2TemplateOptions placementGroup(String placementGroup)
          Specifies the keypair used to run instances with
 AWSEC2TemplateOptions runAsRoot(boolean runAsRoot)
          
 AWSEC2TemplateOptions runScript(byte[] script)
          Deprecated. 
 AWSEC2TemplateOptions runScript(Payload script)
          
 AWSEC2TemplateOptions runScript(Statement script)
          This script will be executed as the root user upon system startup.
 AWSEC2TemplateOptions securityGroupIds(Iterable<String> groupIds)
          Specifies the security group ids to be used for nodes with this template
 AWSEC2TemplateOptions securityGroupIds(String... groupIds)
           
 AWSEC2TemplateOptions securityGroups(Iterable<String> groupIds)
          Specifies the security groups to be used for nodes with this template
 AWSEC2TemplateOptions securityGroups(String... groupIds)
          
 boolean shouldAutomaticallyCreatePlacementGroup()
           
 AWSEC2TemplateOptions spotOptions(RequestSpotInstancesOptions spotOptions)
          Options for starting spot instances
 AWSEC2TemplateOptions spotPrice(Float spotPrice)
          Specifies the maximum spot price to use
 AWSEC2TemplateOptions subnetId(String subnetId)
          Specifies the subnetId used to run instances in
 String toString()
           
 AWSEC2TemplateOptions unmapDeviceNamed(String deviceName)
          
 AWSEC2TemplateOptions userData(byte[] unencodedData)
          Unencoded data
 AWSEC2TemplateOptions userMetadata(Map<String,String> userMetadata)
          
 AWSEC2TemplateOptions userMetadata(String key, String value)
          
 
Methods inherited from class org.jclouds.ec2.compute.options.EC2TemplateOptions
getBlockDeviceMappings, getGroups, getKeyPair, getUserData, shouldAutomaticallyCreateKeyPair
 
Methods inherited from class org.jclouds.compute.options.TemplateOptions
as, blockOnComplete, getInboundPorts, getPrivateKey, getPublicKey, getRunScript, getTags, getUserMetadata, overrideLoginCredentialWith, overrideLoginUserWith, shouldBlockUntilRunning, tags, wrapInInitScript
 
Methods inherited from class org.jclouds.compute.options.RunScriptOptions
getOverridingCredentials, getPort, getSeconds, getTaskName, shouldBlockOnComplete, shouldRunAsRoot, shouldWrapInInitScript
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final AWSEC2TemplateOptions NONE
Constructor Detail

AWSEC2TemplateOptions

public AWSEC2TemplateOptions()
Method Detail

clone

public AWSEC2TemplateOptions clone()
Overrides:
clone in class EC2TemplateOptions

copyTo

public void copyTo(TemplateOptions to)
Overrides:
copyTo in class EC2TemplateOptions

enableMonitoring

public AWSEC2TemplateOptions enableMonitoring()
Enable Cloudwatch monitoring

See Also:
CloudWatchClient

placementGroup

public AWSEC2TemplateOptions placementGroup(String placementGroup)
Specifies the keypair used to run instances with


noPlacementGroup

public AWSEC2TemplateOptions noPlacementGroup()
Do not use a keypair on instances


subnetId

public AWSEC2TemplateOptions subnetId(String subnetId)
Specifies the subnetId used to run instances in


spotPrice

public AWSEC2TemplateOptions spotPrice(Float spotPrice)
Specifies the maximum spot price to use


spotOptions

public AWSEC2TemplateOptions spotOptions(RequestSpotInstancesOptions spotOptions)
Options for starting spot instances


securityGroupIds

public AWSEC2TemplateOptions securityGroupIds(String... groupIds)
See Also:
AWSEC2TemplateOptions#securityGroupIds(Iterable)

securityGroupIds

public AWSEC2TemplateOptions securityGroupIds(Iterable<String> groupIds)
Specifies the security group ids to be used for nodes with this template


getGroupIds

public Set<String> getGroupIds()

blockDeviceMappings

public AWSEC2TemplateOptions blockDeviceMappings(Iterable<? extends BlockDeviceMapping> blockDeviceMappings)

Overrides:
blockDeviceMappings in class EC2TemplateOptions

userMetadata

public AWSEC2TemplateOptions userMetadata(Map<String,String> userMetadata)

Overrides:
userMetadata in class EC2TemplateOptions
Parameters:
userMetadata - user-defined metadata to assign to this server

userMetadata

public AWSEC2TemplateOptions userMetadata(String key,
                                          String value)

Overrides:
userMetadata in class EC2TemplateOptions
Parameters:
key - key to place into the metadata map
value - value to associate with that key

keyPair

public AWSEC2TemplateOptions keyPair(String keyPair)
Specifies the keypair used to run instances with

Overrides:
keyPair in class EC2TemplateOptions

mapEBSSnapshotToDeviceName

public AWSEC2TemplateOptions mapEBSSnapshotToDeviceName(String deviceName,
                                                        String snapshotId,
                                                        Integer sizeInGib,
                                                        boolean deleteOnTermination)

Overrides:
mapEBSSnapshotToDeviceName in class EC2TemplateOptions

mapEphemeralDeviceToDeviceName

public AWSEC2TemplateOptions mapEphemeralDeviceToDeviceName(String deviceName,
                                                            String virtualName)

Overrides:
mapEphemeralDeviceToDeviceName in class EC2TemplateOptions

mapNewVolumeToDeviceName

public AWSEC2TemplateOptions mapNewVolumeToDeviceName(String deviceName,
                                                      int sizeInGib,
                                                      boolean deleteOnTermination)

Overrides:
mapNewVolumeToDeviceName in class EC2TemplateOptions

noKeyPair

public AWSEC2TemplateOptions noKeyPair()
Do not use a keypair on instances

Overrides:
noKeyPair in class EC2TemplateOptions

securityGroups

public AWSEC2TemplateOptions securityGroups(Iterable<String> groupIds)
Specifies the security groups to be used for nodes with this template

Overrides:
securityGroups in class EC2TemplateOptions

securityGroups

public AWSEC2TemplateOptions securityGroups(String... groupIds)

Overrides:
securityGroups in class EC2TemplateOptions
See Also:
EC2TemplateOptions#securityGroups(Iterable)

unmapDeviceNamed

public AWSEC2TemplateOptions unmapDeviceNamed(String deviceName)

Overrides:
unmapDeviceNamed in class EC2TemplateOptions

userData

public AWSEC2TemplateOptions userData(byte[] unencodedData)
Unencoded data

Overrides:
userData in class EC2TemplateOptions

blockOnPort

public AWSEC2TemplateOptions blockOnPort(int port,
                                         int seconds)
When the node is started, wait until the following port is active

Overrides:
blockOnPort in class EC2TemplateOptions

inboundPorts

public AWSEC2TemplateOptions inboundPorts(int... ports)
Opens the set of ports to public access.

Overrides:
inboundPorts in class EC2TemplateOptions

authorizePublicKey

public AWSEC2TemplateOptions authorizePublicKey(String publicKey)
authorize an rsa ssh key.

Overrides:
authorizePublicKey in class EC2TemplateOptions

authorizePublicKey

@Deprecated
public AWSEC2TemplateOptions authorizePublicKey(Payload publicKey)
Deprecated. 

authorize an rsa ssh key.

please use alternative that uses String

Overrides:
authorizePublicKey in class EC2TemplateOptions
See Also:
Payloads

installPrivateKey

public AWSEC2TemplateOptions installPrivateKey(String privateKey)
replaces the rsa ssh key used at login.

Overrides:
installPrivateKey in class EC2TemplateOptions

installPrivateKey

@Deprecated
public AWSEC2TemplateOptions installPrivateKey(Payload privateKey)
Deprecated. 

replaces the rsa ssh key used at login.

please use alternative that uses String

Overrides:
installPrivateKey in class EC2TemplateOptions
See Also:
Payloads

runScript

public AWSEC2TemplateOptions runScript(Payload script)

Overrides:
runScript in class EC2TemplateOptions
See Also:
TemplateOptions.ImmutableTemplateOptions.runScript(Statement), Payloads

runScript

@Deprecated
public AWSEC2TemplateOptions runScript(byte[] script)
Deprecated. 

please use alternative that uses the Statement object

Overrides:
runScript in class EC2TemplateOptions
See Also:
TemplateOptions.ImmutableTemplateOptions.runScript(Statement), Payloads

blockUntilRunning

public AWSEC2TemplateOptions blockUntilRunning(boolean blockUntilRunning)

Note

As of version 1.1.0, this option is incompatible with TemplateOptions.ImmutableTemplateOptions.runScript(Statement) and RunScriptOptions.blockOnComplete(boolean), as all current implementations utilize ssh in order to execute scripts.

Overrides:
blockUntilRunning in class EC2TemplateOptions
Parameters:
blockUntilRunning - (default true) whether to block until the nodes in this template are in NodeState.RUNNING state

dontAuthorizePublicKey

public AWSEC2TemplateOptions dontAuthorizePublicKey()

Overrides:
dontAuthorizePublicKey in class EC2TemplateOptions

nameTask

public AWSEC2TemplateOptions nameTask(String name)

Overrides:
nameTask in class EC2TemplateOptions
Returns:
What to call the task relating to this script; default jclouds-script-timestamp where timestamp is millis since epoch

runAsRoot

public AWSEC2TemplateOptions runAsRoot(boolean runAsRoot)

Overrides:
runAsRoot in class EC2TemplateOptions

runScript

public AWSEC2TemplateOptions runScript(Statement script)
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 class EC2TemplateOptions

overrideCredentialsWith

public AWSEC2TemplateOptions overrideCredentialsWith(Credentials overridingCredentials)

Overrides:
overrideCredentialsWith in class EC2TemplateOptions

getPlacementGroup

public String getPlacementGroup()
Returns:
placementGroup to use when running the instance or null, to generate a placementGroup.

shouldAutomaticallyCreatePlacementGroup

public boolean shouldAutomaticallyCreatePlacementGroup()
Returns:
true (default) if we are supposed to use a placementGroup

isMonitoringEnabled

public boolean isMonitoringEnabled()
Returns:
true (default) if we are supposed to enable cloudwatch

getSubnetId

public String getSubnetId()
Returns:
subnetId to use when running the instance or null.

getSpotPrice

public Float getSpotPrice()
Returns:
maximum spot price or null.

getSpotOptions

public RequestSpotInstancesOptions getSpotOptions()
Returns:
options for controlling spot instance requests.

hashCode

public int hashCode()
Overrides:
hashCode in class EC2TemplateOptions

equals

public boolean equals(Object obj)
Overrides:
equals in class EC2TemplateOptions

toString

public String toString()
Overrides:
toString in class EC2TemplateOptions


Copyright © 2009-2011 jclouds. All Rights Reserved.