org.jclouds.compute.options
Class TemplateOptions

java.lang.Object
  extended by org.jclouds.compute.options.RunScriptOptions
      extended by org.jclouds.compute.options.TemplateOptions
Direct Known Subclasses:
TemplateOptions.ImmutableTemplateOptions

public class TemplateOptions
extends RunScriptOptions

Contains options supported in the ComputeService#runNodesWithTag 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.runNodesWithTag(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
           
protected  boolean includeMetadata
           
static TemplateOptions NONE
           
protected  String privateKey
           
protected  String publicKey
           
protected  Statement script
           
 
Fields inherited from class org.jclouds.compute.options.RunScriptOptions
blockOnComplete, overridingCredentials, port, runAsRoot, seconds, taskName, wrapInInitScript
 
Constructor Summary
TemplateOptions()
           
 
Method Summary
<T extends TemplateOptions>
T
as(Class<T> clazz)
           
 TemplateOptions authorizePublicKey(Payload publicKey)
          Deprecated. 
 TemplateOptions authorizePublicKey(String publicKey)
          authorize an rsa ssh key.
 TemplateOptions blockOnComplete(boolean blockOnComplete)
           
 TemplateOptions blockOnPort(int port, int seconds)
          When the node is started, wait until the following port is active
 TemplateOptions blockUntilRunning(boolean blockUntilRunning)
           
 TemplateOptions dontAuthorizePublicKey()
           
 boolean equals(Object obj)
           
 int[] getInboundPorts()
           
 String getPrivateKey()
           
 String getPublicKey()
           
 Statement getRunScript()
           
 int hashCode()
           
 TemplateOptions inboundPorts(int... ports)
          Opens the set of ports to public access.
 TemplateOptions installPrivateKey(Payload privateKey)
          Deprecated. 
 TemplateOptions installPrivateKey(String privateKey)
          replaces the rsa ssh key used at login.
 boolean isIncludeMetadata()
           
 TemplateOptions nameTask(String name)
           
 TemplateOptions runAsRoot(boolean runAsRoot)
           
 TemplateOptions runScript(byte[] script)
          Deprecated. 
 TemplateOptions runScript(Payload script)
          This script will be executed as the root user upon system startup.
 TemplateOptions runScript(Statement script)
           
 boolean shouldBlockUntilRunning()
           
 String toString()
           
 TemplateOptions withMetadata()
           
 TemplateOptions withOverridingCredentials(Credentials overridingCredentials)
           
 
Methods inherited from class org.jclouds.compute.options.RunScriptOptions
getOverrideCredentials, getPort, getSeconds, getTaskName, shouldBlockOnComplete, shouldRunAsRoot, shouldWrapInInitScript, wrapInInitScript
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final TemplateOptions NONE

inboundPorts

protected int[] inboundPorts

script

protected Statement script

privateKey

protected String privateKey

publicKey

protected String publicKey

includeMetadata

protected boolean includeMetadata

blockUntilRunning

protected boolean blockUntilRunning
Constructor Detail

TemplateOptions

public TemplateOptions()
Method Detail

getInboundPorts

public int[] getInboundPorts()

getRunScript

public Statement getRunScript()

getPrivateKey

public String getPrivateKey()

getPublicKey

public String getPublicKey()

isIncludeMetadata

public boolean isIncludeMetadata()

shouldBlockUntilRunning

public boolean shouldBlockUntilRunning()

as

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

runScript

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

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

please use alternative that uses the Statement object

See Also:
Payloads

runScript

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

See Also:
Payloads

runScript

public TemplateOptions runScript(Statement script)

installPrivateKey

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


installPrivateKey

@Deprecated
public TemplateOptions installPrivateKey(Payload privateKey)
Deprecated. 

replaces the rsa ssh key used at login.

please use alternative that uses String

See Also:
Payloads

dontAuthorizePublicKey

public TemplateOptions dontAuthorizePublicKey()

authorizePublicKey

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


authorizePublicKey

@Deprecated
public TemplateOptions authorizePublicKey(Payload publicKey)
Deprecated. 

authorize an rsa ssh key.

please use alternative that uses String

See Also:
Payloads

inboundPorts

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


withMetadata

public TemplateOptions withMetadata()

toString

public String toString()
Overrides:
toString in class RunScriptOptions

blockUntilRunning

public TemplateOptions blockUntilRunning(boolean blockUntilRunning)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

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

withOverridingCredentials

public TemplateOptions withOverridingCredentials(Credentials overridingCredentials)
Overrides:
withOverridingCredentials in class RunScriptOptions

blockOnComplete

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


Copyright © 2009-2011 jclouds. All Rights Reserved.