Class GoogleComputeEngineTemplateOptions
- java.lang.Object
-
- org.jclouds.compute.options.RunScriptOptions
-
- org.jclouds.compute.options.TemplateOptions
-
- org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions
-
- All Implemented Interfaces:
Cloneable
public final class GoogleComputeEngineTemplateOptions extends TemplateOptions
Instance options specific to Google Compute Engine.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jclouds.compute.options.TemplateOptions
TemplateOptions.Builder, TemplateOptions.ImmutableTemplateOptions
-
Nested classes/interfaces inherited from class org.jclouds.compute.options.RunScriptOptions
RunScriptOptions.ImmutableRunScriptOptions
-
-
Field Summary
-
Fields inherited from class org.jclouds.compute.options.TemplateOptions
blockUntilRunning, inboundPorts, networks, nodeNames, NONE, 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 Constructor Description GoogleComputeEngineTemplateOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
assignExternalIp()
Gets whether an external IP address should be assigned to the machine.GoogleComputeEngineTemplateOptions
assignExternalIp(boolean assignExternalIp)
Sets whether an external IP address should be assigned to the machine.GoogleComputeEngineTemplateOptions
authorizePublicKey(String publicKey)
authorize an rsa ssh key.boolean
autoCreateKeyPair()
Gets whether an SSH key pair should be created automatically.GoogleComputeEngineTemplateOptions
autoCreateKeyPair(boolean autoCreateKeyPair)
Sets whether an SSH key pair should be created automatically.Boolean
autoCreateWindowsPassword()
Whether a Windows password should be created automatically; {@link null} means to generate the password if and only if the image is for a Windows VM.GoogleComputeEngineTemplateOptions
autoCreateWindowsPassword(Boolean autoCreateWindowsPassword)
Sets whether to auto-create a windows password.GoogleComputeEngineTemplateOptions
blockOnComplete(boolean blockOnComplete)
As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.GoogleComputeEngineTemplateOptions
blockOnPort(int port, int seconds)
When the node is started, wait until the following port is activeGoogleComputeEngineTemplateOptions
blockUntilRunning(boolean blockUntilRunning)
NoteString
bootDiskType()
Gets the boot disk type.GoogleComputeEngineTemplateOptions
bootDiskType(String diskType)
Sets the boot disk type.GoogleComputeEngineTemplateOptions
clone()
void
copyTo(TemplateOptions to)
GoogleComputeEngineTemplateOptions
dontAuthorizePublicKey()
GoogleComputeEngineTemplateOptions
inboundPorts(int... ports)
Opens the set of ports to public access.GoogleComputeEngineTemplateOptions
installPrivateKey(String privateKey)
replaces the rsa ssh key used at login.GoogleComputeEngineTemplateOptions
nameTask(String name)
GoogleComputeEngineTemplateOptions
networks(Iterable<String> networks)
Assigns the created nodes to these networksGoogleComputeEngineTemplateOptions
networks(String... networks)
GoogleComputeEngineTemplateOptions
nodeNames(Iterable<String> nodeNames)
specifies names to be used for the created nodes.GoogleComputeEngineTemplateOptions
overrideAuthenticateSudo(boolean authenticateSudo)
GoogleComputeEngineTemplateOptions
overrideLoginCredentials(LoginCredentials overridingCredentials)
GoogleComputeEngineTemplateOptions
overrideLoginPassword(String password)
GoogleComputeEngineTemplateOptions
overrideLoginPrivateKey(String privateKey)
GoogleComputeEngineTemplateOptions
overrideLoginUser(String loginUser)
boolean
preemptible()
Gets whether the resulting instance should be preemptible.GoogleComputeEngineTemplateOptions
preemptible(boolean preemptible)
Sets whether the resulting instance should be preemptible.GoogleComputeEngineTemplateOptions
runAsRoot(boolean runAsRoot)
GoogleComputeEngineTemplateOptions
runScript(String script)
This script will be executed as the root user upon system startup.GoogleComputeEngineTemplateOptions
runScript(Statement script)
This script will be executed as the root user upon system startup.List<Instance.ServiceAccount>
serviceAccounts()
Gets the list of service accounts, with their specified scopes, that will be authorize on created instances.GoogleComputeEngineTemplateOptions
serviceAccounts(List<Instance.ServiceAccount> serviceAccounts)
Sets a list of service accounts, with their specified scopes, to authorize on created instance.GoogleComputeEngineTemplateOptions
tags(Iterable<String> tags)
assigns tags to the created nodesGoogleComputeEngineTemplateOptions
userMetadata(String key, String value)
GoogleComputeEngineTemplateOptions
userMetadata(Map<String,String> userMetadata)
GoogleComputeEngineTemplateOptions
wrapInInitScript(boolean wrapInInitScript)
default true-
Methods inherited from class org.jclouds.compute.options.TemplateOptions
as, equals, getGroups, getInboundPorts, getNetworks, getNodeNames, getPrivateKey, getPublicKey, getRunScript, getTags, getUserMetadata, hashCode, securityGroups, securityGroups, shouldBlockUntilRunning, string
-
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
-
-
-
-
Method Detail
-
clone
public GoogleComputeEngineTemplateOptions clone()
- Overrides:
clone
in classTemplateOptions
-
copyTo
public void copyTo(TemplateOptions to)
- Overrides:
copyTo
in classTemplateOptions
-
bootDiskType
public GoogleComputeEngineTemplateOptions bootDiskType(String diskType)
Sets the boot disk type.
-
bootDiskType
public String bootDiskType()
Gets the boot disk type.
-
assignExternalIp
public GoogleComputeEngineTemplateOptions assignExternalIp(boolean assignExternalIp)
Sets whether an external IP address should be assigned to the machine.
-
assignExternalIp
public boolean assignExternalIp()
Gets whether an external IP address should be assigned to the machine.
-
autoCreateKeyPair
public GoogleComputeEngineTemplateOptions autoCreateKeyPair(boolean autoCreateKeyPair)
Sets whether an SSH key pair should be created automatically.
-
autoCreateKeyPair
public boolean autoCreateKeyPair()
Gets whether an SSH key pair should be created automatically.
-
serviceAccounts
public GoogleComputeEngineTemplateOptions serviceAccounts(List<Instance.ServiceAccount> serviceAccounts)
Sets a list of service accounts, with their specified scopes, to authorize on created instance. For example, to give a node the 'compute' scope you would add a service account with the email 'default' and the scope 'https://www.googleapis.com/auth/compute' These scopes will be given to all nodes created with these template options.
-
preemptible
public GoogleComputeEngineTemplateOptions preemptible(boolean preemptible)
Sets whether the resulting instance should be preemptible.
-
preemptible
public boolean preemptible()
Gets whether the resulting instance should be preemptible.
-
autoCreateWindowsPassword
public Boolean autoCreateWindowsPassword()
Whether a Windows password should be created automatically; {@link null} means to generate the password if and only if the image is for a Windows VM.
-
autoCreateWindowsPassword
public GoogleComputeEngineTemplateOptions autoCreateWindowsPassword(Boolean autoCreateWindowsPassword)
Sets whether to auto-create a windows password. The default (null
) is to always do so for Windows VMs, inferring this from the image. An explicit value of true or false overrides this.
-
serviceAccounts
public List<Instance.ServiceAccount> serviceAccounts()
Gets the list of service accounts, with their specified scopes, that will be authorize on created instances.
-
blockOnPort
public GoogleComputeEngineTemplateOptions blockOnPort(int port, int seconds)
When the node is started, wait until the following port is active- Overrides:
blockOnPort
in classTemplateOptions
-
inboundPorts
public GoogleComputeEngineTemplateOptions inboundPorts(int... ports)
Opens the set of ports to public access.- Overrides:
inboundPorts
in classTemplateOptions
-
authorizePublicKey
public GoogleComputeEngineTemplateOptions authorizePublicKey(String publicKey)
authorize an rsa ssh key.- Overrides:
authorizePublicKey
in classTemplateOptions
-
installPrivateKey
public GoogleComputeEngineTemplateOptions installPrivateKey(String privateKey)
replaces the rsa ssh key used at login.- Overrides:
installPrivateKey
in classTemplateOptions
-
blockUntilRunning
public GoogleComputeEngineTemplateOptions blockUntilRunning(boolean 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 inStatus#RUNNING
state
-
dontAuthorizePublicKey
public GoogleComputeEngineTemplateOptions dontAuthorizePublicKey()
- Overrides:
dontAuthorizePublicKey
in classTemplateOptions
-
nameTask
public GoogleComputeEngineTemplateOptions nameTask(String name)
- 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
public GoogleComputeEngineTemplateOptions runAsRoot(boolean runAsRoot)
- Overrides:
runAsRoot
in classTemplateOptions
-
runScript
public GoogleComputeEngineTemplateOptions 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 classTemplateOptions
-
overrideLoginCredentials
public GoogleComputeEngineTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials)
- Overrides:
overrideLoginCredentials
in classTemplateOptions
-
overrideLoginPassword
public GoogleComputeEngineTemplateOptions overrideLoginPassword(String password)
- Overrides:
overrideLoginPassword
in classTemplateOptions
-
overrideLoginPrivateKey
public GoogleComputeEngineTemplateOptions overrideLoginPrivateKey(String privateKey)
- Overrides:
overrideLoginPrivateKey
in classTemplateOptions
-
overrideLoginUser
public GoogleComputeEngineTemplateOptions overrideLoginUser(String loginUser)
- Overrides:
overrideLoginUser
in classTemplateOptions
-
overrideAuthenticateSudo
public GoogleComputeEngineTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo)
- Overrides:
overrideAuthenticateSudo
in classTemplateOptions
-
userMetadata
public GoogleComputeEngineTemplateOptions userMetadata(Map<String,String> userMetadata)
- Overrides:
userMetadata
in classTemplateOptions
- Parameters:
userMetadata
- user-defined metadata to assign to this server
-
userMetadata
public GoogleComputeEngineTemplateOptions userMetadata(String key, String value)
- Overrides:
userMetadata
in classTemplateOptions
- Parameters:
key
- key to place into the metadata mapvalue
- value to associate with that key
-
nodeNames
public GoogleComputeEngineTemplateOptions nodeNames(Iterable<String> 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
public GoogleComputeEngineTemplateOptions networks(Iterable<String> networks)
Assigns the created nodes to these networks- Overrides:
networks
in classTemplateOptions
-
networks
public GoogleComputeEngineTemplateOptions networks(String... networks)
- Overrides:
networks
in classTemplateOptions
- See Also:
TemplateOptions.networks(Iterable)
-
tags
public GoogleComputeEngineTemplateOptions tags(Iterable<String> tags)
assigns tags to the created nodes- Overrides:
tags
in classTemplateOptions
-
wrapInInitScript
public GoogleComputeEngineTemplateOptions wrapInInitScript(boolean 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:
-
runScript
public GoogleComputeEngineTemplateOptions 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- Overrides:
runScript
in classTemplateOptions
-
blockOnComplete
public GoogleComputeEngineTemplateOptions blockOnComplete(boolean 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)
-
-