org.jclouds.compute.options
Class RunScriptOptions

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

public class RunScriptOptions
extends Object

Enables additional options for running a script.

Author:
Oleksiy Yarmula

Nested Class Summary
static class RunScriptOptions.Builder
           
static class RunScriptOptions.ImmutableRunScriptOptions
           
 
Field Summary
protected  Boolean authenticateSudo
           
protected  boolean blockOnComplete
           
protected  com.google.common.base.Optional<String> loginPassword
           
protected  com.google.common.base.Optional<String> loginPrivateKey
           
protected  String loginUser
           
static RunScriptOptions NONE
          Default options.
protected  int port
           
protected  boolean runAsRoot
           
protected  int seconds
           
protected  String taskName
           
protected  boolean wrapInInitScript
           
 
Constructor Summary
RunScriptOptions()
           
 
Method Summary
 RunScriptOptions blockOnComplete(boolean blockOnComplete)
          As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.
 RunScriptOptions blockOnPort(int port, int seconds)
          When the node is started, wait until the following port is active
 boolean equals(Object obj)
           
 String getLoginPassword()
           
 String getLoginPrivateKey()
           
 String getLoginUser()
           
 Credentials getOverridingCredentials()
          Deprecated. 
 int getPort()
           
 int getSeconds()
           
 String getTaskName()
           
 int hashCode()
           
 boolean hasLoginPassword()
           
 boolean hasLoginPasswordOption()
           
 boolean hasLoginPrivateKey()
           
 boolean hasLoginPrivateKeyOption()
           
 RunScriptOptions nameTask(String name)
           
 RunScriptOptions overrideAuthenticateSudo(boolean authenticateSudo)
           
 RunScriptOptions overrideCredentialsWith(Credentials overridingCredentials)
          Deprecated. 
 RunScriptOptions overrideLoginCredentials(LoginCredentials overridingCredentials)
           
 RunScriptOptions overrideLoginCredentialWith(String loginCredential)
          Deprecated. 
 RunScriptOptions overrideLoginPassword(String password)
           
 RunScriptOptions overrideLoginPrivateKey(String privateKey)
           
 RunScriptOptions overrideLoginUser(String loginUser)
           
 RunScriptOptions overrideLoginUserWith(String loginUser)
          Deprecated. 
 RunScriptOptions runAsRoot(boolean runAsRoot)
           
 Boolean shouldAuthenticateSudo()
           
 boolean shouldBlockOnComplete()
           
 boolean shouldRunAsRoot()
          Whether to run the script as root (or run with current privileges).
 boolean shouldWrapInInitScript()
          Whether to wait until the script has completed.
 String toString()
           
 RunScriptOptions wrapInInitScript(boolean wrapInInitScript)
          default true

 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final RunScriptOptions NONE
Default options. The default settings are:


port

protected int port

seconds

protected int seconds

taskName

protected String taskName

runAsRoot

protected boolean runAsRoot

blockOnComplete

protected boolean blockOnComplete

wrapInInitScript

protected boolean wrapInInitScript

loginUser

protected String loginUser

authenticateSudo

protected Boolean authenticateSudo

loginPassword

protected com.google.common.base.Optional<String> loginPassword

loginPrivateKey

protected com.google.common.base.Optional<String> loginPrivateKey
Constructor Detail

RunScriptOptions

public RunScriptOptions()
Method Detail

overrideCredentialsWith

@Deprecated
public RunScriptOptions overrideCredentialsWith(Credentials overridingCredentials)
Deprecated. 

to be removed in jclouds 1.4.0

See Also:
overrideLoginCredentials(org.jclouds.domain.LoginCredentials)

overrideLoginCredentials

public RunScriptOptions overrideLoginCredentials(LoginCredentials overridingCredentials)

overrideLoginUserWith

@Deprecated
public RunScriptOptions overrideLoginUserWith(String loginUser)
Deprecated. 

to be removed in jclouds 1.4.0

See Also:
overrideLoginCredentials(org.jclouds.domain.LoginCredentials)

overrideLoginUser

public RunScriptOptions overrideLoginUser(String loginUser)

overrideLoginCredentialWith

@Deprecated
public RunScriptOptions overrideLoginCredentialWith(String loginCredential)
Deprecated. 

to be removed in jclouds 1.4.0

See Also:
overrideLoginCredentials(org.jclouds.domain.LoginCredentials)

overrideLoginPassword

public RunScriptOptions overrideLoginPassword(String password)

overrideLoginPrivateKey

public RunScriptOptions overrideLoginPrivateKey(String privateKey)

overrideAuthenticateSudo

public RunScriptOptions overrideAuthenticateSudo(boolean authenticateSudo)

nameTask

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

runAsRoot

public RunScriptOptions runAsRoot(boolean runAsRoot)

wrapInInitScript

public RunScriptOptions wrapInInitScript(boolean wrapInInitScript)
default true

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 RunScriptOptions blockOnComplete(boolean blockOnComplete)
As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.

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)

blockOnPort

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


getTaskName

public String getTaskName()

getPort

public int getPort()

getSeconds

public int getSeconds()

getLoginUser

@Nullable
public String getLoginUser()
Returns:
the login user for ComputeService.runScriptOnNode(java.lang.String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions). By default, null.

shouldAuthenticateSudo

@Nullable
public Boolean shouldAuthenticateSudo()
Returns:
Whether the login user should authenticate sudo during ComputeService.runScriptOnNode(java.lang.String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions). By default, null.

getOverridingCredentials

@Deprecated
public Credentials getOverridingCredentials()
Deprecated. 

This will be removed in jclouds 1.4.0

See Also:
getLoginPassword(), getLoginPrivateKey(), getLoginUser()

hasLoginPasswordOption

public boolean hasLoginPasswordOption()
Returns:
true if the login password has been configured

hasLoginPassword

public boolean hasLoginPassword()
Returns:
true if the login password is set

getLoginPassword

@Nullable
public String getLoginPassword()
Returns:
the login password for ComputeService.runScriptOnNode(java.lang.String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions). By default, null.

hasLoginPrivateKeyOption

public boolean hasLoginPrivateKeyOption()
Returns:
true if the login ssh key has been configured

hasLoginPrivateKey

public boolean hasLoginPrivateKey()
Returns:
true if the login ssh key is set

getLoginPrivateKey

@Nullable
public String getLoginPrivateKey()
Returns:
the login ssh key for ComputeService.runScriptOnNode(java.lang.String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions). By default, null.

shouldRunAsRoot

public boolean shouldRunAsRoot()
Whether to run the script as root (or run with current privileges). By default, true.

Returns:
value

shouldBlockOnComplete

public boolean shouldBlockOnComplete()
See Also:
blockOnComplete(boolean)

shouldWrapInInitScript

public boolean shouldWrapInInitScript()
Whether to wait until the script has completed. By default, true.

Returns:
value

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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


Copyright © 2009-2012 jclouds. All Rights Reserved.