org.jclouds.compute.options
Class TemplateOptions

java.lang.Object
  extended by org.jclouds.compute.options.RunScriptOptions
      extended by org.jclouds.compute.options.TemplateOptions
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
CloudSigmaTemplateOptions, CloudStackTemplateOptions, EC2TemplateOptions, GleSYSTemplateOptions, GoGridTemplateOptions, SoftLayerTemplateOptions, TemplateOptions.ImmutableTemplateOptions, TerremarkVCloudTemplateOptions, VCloudTemplateOptions

public class TemplateOptions
extends RunScriptOptions
implements Cloneable

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 an instance mutator (if needed):

import static org.jclouds.compute.options.TemplateOptions.Builder.*;

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

Author:
Adrian Cole

Nested Class Summary
static class TemplateOptions.Builder
           
static class TemplateOptions.ImmutableTemplateOptions
           
 
Nested classes/interfaces inherited from class org.jclouds.compute.options.RunScriptOptions
RunScriptOptions.ImmutableRunScriptOptions
 
Field Summary
protected  boolean blockUntilRunning
           
protected  int[] inboundPorts
           
static TemplateOptions NONE
           
protected  String privateKey
           
protected  String publicKey
           
protected  Statement script
           
protected  Set<String> tags
           
protected  Map<String,String> userMetadata
           
 
Fields inherited from class org.jclouds.compute.options.RunScriptOptions
authenticateSudo, blockOnComplete, loginPassword, loginPrivateKey, loginUser, port, runAsRoot, seconds, taskName, wrapInInitScript
 
Constructor Summary
TemplateOptions()
           
 
Method Summary
<T extends TemplateOptions>
T
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 obj)
           
 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 overrideCredentialsWith(Credentials overridingCredentials)
          Deprecated. 
 TemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials)
           
 TemplateOptions overrideLoginCredentialWith(String loginCredential)
          Deprecated. 
 TemplateOptions overrideLoginPassword(String password)
           
 TemplateOptions overrideLoginPrivateKey(String privateKey)
           
 TemplateOptions overrideLoginUser(String loginUser)
           
 TemplateOptions overrideLoginUserWith(String loginUser)
          Deprecated. 
 TemplateOptions runAsRoot(boolean runAsRoot)
           
 TemplateOptions runScript(Payload script)
          Deprecated. 
 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()
           
 TemplateOptions tags(Iterable<String> tags)
          assigns tags to the created nodes
 String toString()
           
 TemplateOptions userMetadata(Map<String,String> userMetadata)
           
 TemplateOptions userMetadata(String key, String value)
           
 TemplateOptions wrapInInitScript(boolean wrapInInitScript)
          default true

 
Methods inherited from class org.jclouds.compute.options.RunScriptOptions
getLoginPassword, getLoginPrivateKey, getLoginUser, getOverridingCredentials, getPort, getSeconds, getTaskName, hasLoginPassword, hasLoginPasswordOption, hasLoginPrivateKey, hasLoginPrivateKeyOption, shouldAuthenticateSudo, shouldBlockOnComplete, shouldRunAsRoot, shouldWrapInInitScript
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final TemplateOptions NONE

inboundPorts

protected int[] inboundPorts

script

protected Statement script

tags

protected Set<String> tags

privateKey

protected String privateKey

publicKey

protected String publicKey

blockUntilRunning

protected boolean blockUntilRunning

userMetadata

protected Map<String,String> userMetadata
Constructor Detail

TemplateOptions

public TemplateOptions()
Method Detail

clone

public TemplateOptions clone()
Overrides:
clone in class Object

copyTo

public void copyTo(TemplateOptions to)

getInboundPorts

public int[] getInboundPorts()

getRunScript

public Statement getRunScript()

getTags

public Set<String> getTags()

getPrivateKey

public String getPrivateKey()

getPublicKey

public String getPublicKey()

shouldBlockUntilRunning

public boolean shouldBlockUntilRunning()
See Also:
TemplateOptions.ImmutableTemplateOptions.blockUntilRunning(boolean)

as

public <T extends TemplateOptions> T as(Class<T> clazz)

runScript

@Deprecated
public TemplateOptions runScript(Payload script)
Deprecated. 

to be removed in jclouds 1.4.0

See Also:
TemplateOptions.ImmutableTemplateOptions.runScript(Statement), Payloads

runScript

public TemplateOptions runScript(String 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


runScript

public TemplateOptions 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


installPrivateKey

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


dontAuthorizePublicKey

public TemplateOptions dontAuthorizePublicKey()

authorizePublicKey

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


tags

public TemplateOptions tags(Iterable<String> tags)
assigns tags to the created nodes


inboundPorts

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


toString

public String toString()
Overrides:
toString in class RunScriptOptions

blockUntilRunning

public TemplateOptions 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.

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

userMetadata

public TemplateOptions userMetadata(Map<String,String> userMetadata)
Parameters:
userMetadata - user-defined metadata to assign to this server

userMetadata

public TemplateOptions userMetadata(String key,
                                    String value)
Parameters:
key - key to place into the metadata map
value - value to associate with that key

getUserMetadata

public Map<String,String> getUserMetadata()
See Also:
userMetadata(Map)

hashCode

public int hashCode()
Overrides:
hashCode in class RunScriptOptions

equals

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

blockOnPort

public TemplateOptions blockOnPort(int port,
                                   int seconds)
Description copied from class: RunScriptOptions
When the node is started, wait until the following port is active

Overrides:
blockOnPort in class RunScriptOptions

nameTask

public TemplateOptions nameTask(String name)
Overrides:
nameTask in class RunScriptOptions
Returns:
What to call the task relating to this script; default jclouds-script-timestamp where timestamp is millis since epoch

runAsRoot

public TemplateOptions runAsRoot(boolean runAsRoot)
Overrides:
runAsRoot in class RunScriptOptions

wrapInInitScript

public TemplateOptions wrapInInitScript(boolean wrapInInitScript)
Description copied from class: RunScriptOptions
default true

Overrides:
wrapInInitScript in class RunScriptOptions
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

public TemplateOptions blockOnComplete(boolean 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 class RunScriptOptions
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)

overrideCredentialsWith

@Deprecated
public TemplateOptions overrideCredentialsWith(Credentials overridingCredentials)
Deprecated. 

Description copied from class: RunScriptOptions
to be removed in jclouds 1.4.0

Overrides:
overrideCredentialsWith in class RunScriptOptions
See Also:
RunScriptOptions.overrideLoginCredentials(org.jclouds.domain.LoginCredentials)

overrideLoginUserWith

@Deprecated
public TemplateOptions overrideLoginUserWith(String loginUser)
Deprecated. 

Description copied from class: RunScriptOptions
to be removed in jclouds 1.4.0

Overrides:
overrideLoginUserWith in class RunScriptOptions
See Also:
RunScriptOptions.overrideLoginCredentials(org.jclouds.domain.LoginCredentials)

overrideLoginCredentialWith

@Deprecated
public TemplateOptions overrideLoginCredentialWith(String loginCredential)
Deprecated. 

Description copied from class: RunScriptOptions
to be removed in jclouds 1.4.0

Overrides:
overrideLoginCredentialWith in class RunScriptOptions
See Also:
RunScriptOptions.overrideLoginCredentials(org.jclouds.domain.LoginCredentials)

overrideLoginCredentials

public TemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials)
Overrides:
overrideLoginCredentials in class RunScriptOptions

overrideLoginPassword

public TemplateOptions overrideLoginPassword(String password)
Overrides:
overrideLoginPassword in class RunScriptOptions

overrideLoginPrivateKey

public TemplateOptions overrideLoginPrivateKey(String privateKey)
Overrides:
overrideLoginPrivateKey in class RunScriptOptions

overrideLoginUser

public TemplateOptions overrideLoginUser(String loginUser)
Overrides:
overrideLoginUser in class RunScriptOptions

overrideAuthenticateSudo

public TemplateOptions overrideAuthenticateSudo(boolean authenticateSudo)
Overrides:
overrideAuthenticateSudo in class RunScriptOptions


Copyright © 2009-2012 jclouds. All Rights Reserved.