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 booleanassignExternalIp()Gets whether an external IP address should be assigned to the machine.GoogleComputeEngineTemplateOptionsassignExternalIp(boolean assignExternalIp)Sets whether an external IP address should be assigned to the machine.GoogleComputeEngineTemplateOptionsauthorizePublicKey(String publicKey)authorize an rsa ssh key.booleanautoCreateKeyPair()Gets whether an SSH key pair should be created automatically.GoogleComputeEngineTemplateOptionsautoCreateKeyPair(boolean autoCreateKeyPair)Sets whether an SSH key pair should be created automatically.BooleanautoCreateWindowsPassword()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.GoogleComputeEngineTemplateOptionsautoCreateWindowsPassword(Boolean autoCreateWindowsPassword)Sets whether to auto-create a windows password.GoogleComputeEngineTemplateOptionsblockOnComplete(boolean blockOnComplete)As of version 1.1.0, we cannot kick off a script unless a node is in RUNNING state.GoogleComputeEngineTemplateOptionsblockOnPort(int port, int seconds)When the node is started, wait until the following port is activeGoogleComputeEngineTemplateOptionsblockUntilRunning(boolean blockUntilRunning)NoteStringbootDiskType()Gets the boot disk type.GoogleComputeEngineTemplateOptionsbootDiskType(String diskType)Sets the boot disk type.GoogleComputeEngineTemplateOptionsclone()voidcopyTo(TemplateOptions to)GoogleComputeEngineTemplateOptionsdontAuthorizePublicKey()GoogleComputeEngineTemplateOptionsinboundPorts(int... ports)Opens the set of ports to public access.GoogleComputeEngineTemplateOptionsinstallPrivateKey(String privateKey)replaces the rsa ssh key used at login.GoogleComputeEngineTemplateOptionsnameTask(String name)GoogleComputeEngineTemplateOptionsnetworks(Iterable<String> networks)Assigns the created nodes to these networksGoogleComputeEngineTemplateOptionsnetworks(String... networks)GoogleComputeEngineTemplateOptionsnodeNames(Iterable<String> nodeNames)specifies names to be used for the created nodes.GoogleComputeEngineTemplateOptionsoverrideAuthenticateSudo(boolean authenticateSudo)GoogleComputeEngineTemplateOptionsoverrideLoginCredentials(LoginCredentials overridingCredentials)GoogleComputeEngineTemplateOptionsoverrideLoginPassword(String password)GoogleComputeEngineTemplateOptionsoverrideLoginPrivateKey(String privateKey)GoogleComputeEngineTemplateOptionsoverrideLoginUser(String loginUser)booleanpreemptible()Gets whether the resulting instance should be preemptible.GoogleComputeEngineTemplateOptionspreemptible(boolean preemptible)Sets whether the resulting instance should be preemptible.GoogleComputeEngineTemplateOptionsrunAsRoot(boolean runAsRoot)GoogleComputeEngineTemplateOptionsrunScript(String script)This script will be executed as the root user upon system startup.GoogleComputeEngineTemplateOptionsrunScript(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.GoogleComputeEngineTemplateOptionsserviceAccounts(List<Instance.ServiceAccount> serviceAccounts)Sets a list of service accounts, with their specified scopes, to authorize on created instance.GoogleComputeEngineTemplateOptionstags(Iterable<String> tags)assigns tags to the created nodesGoogleComputeEngineTemplateOptionsuserMetadata(String key, String value)GoogleComputeEngineTemplateOptionsuserMetadata(Map<String,String> userMetadata)GoogleComputeEngineTemplateOptionswrapInInitScript(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:
clonein classTemplateOptions
-
copyTo
public void copyTo(TemplateOptions to)
- Overrides:
copyToin 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:
blockOnPortin classTemplateOptions
-
inboundPorts
public GoogleComputeEngineTemplateOptions inboundPorts(int... ports)
Opens the set of ports to public access.- Overrides:
inboundPortsin classTemplateOptions
-
authorizePublicKey
public GoogleComputeEngineTemplateOptions authorizePublicKey(String publicKey)
authorize an rsa ssh key.- Overrides:
authorizePublicKeyin classTemplateOptions
-
installPrivateKey
public GoogleComputeEngineTemplateOptions installPrivateKey(String privateKey)
replaces the rsa ssh key used at login.- Overrides:
installPrivateKeyin 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:
blockUntilRunningin classTemplateOptions- Parameters:
blockUntilRunning- (default true) whether to block until the nodes in this template are inStatus#RUNNINGstate
-
dontAuthorizePublicKey
public GoogleComputeEngineTemplateOptions dontAuthorizePublicKey()
- Overrides:
dontAuthorizePublicKeyin classTemplateOptions
-
nameTask
public GoogleComputeEngineTemplateOptions nameTask(String name)
- Overrides:
nameTaskin classTemplateOptions- Returns:
- What to call the task relating to this script; default
jclouds-script-timestampwhere timestamp is millis since epoch
-
runAsRoot
public GoogleComputeEngineTemplateOptions runAsRoot(boolean runAsRoot)
- Overrides:
runAsRootin 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:
runScriptin classTemplateOptions
-
overrideLoginCredentials
public GoogleComputeEngineTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials)
- Overrides:
overrideLoginCredentialsin classTemplateOptions
-
overrideLoginPassword
public GoogleComputeEngineTemplateOptions overrideLoginPassword(String password)
- Overrides:
overrideLoginPasswordin classTemplateOptions
-
overrideLoginPrivateKey
public GoogleComputeEngineTemplateOptions overrideLoginPrivateKey(String privateKey)
- Overrides:
overrideLoginPrivateKeyin classTemplateOptions
-
overrideLoginUser
public GoogleComputeEngineTemplateOptions overrideLoginUser(String loginUser)
- Overrides:
overrideLoginUserin classTemplateOptions
-
overrideAuthenticateSudo
public GoogleComputeEngineTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo)
- Overrides:
overrideAuthenticateSudoin classTemplateOptions
-
userMetadata
public GoogleComputeEngineTemplateOptions userMetadata(Map<String,String> userMetadata)
- Overrides:
userMetadatain classTemplateOptions- Parameters:
userMetadata- user-defined metadata to assign to this server
-
userMetadata
public GoogleComputeEngineTemplateOptions userMetadata(String key, String value)
- Overrides:
userMetadatain 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:
nodeNamesin classTemplateOptions
-
networks
public GoogleComputeEngineTemplateOptions networks(Iterable<String> networks)
Assigns the created nodes to these networks- Overrides:
networksin classTemplateOptions
-
networks
public GoogleComputeEngineTemplateOptions networks(String... networks)
- Overrides:
networksin classTemplateOptions- See Also:
TemplateOptions.networks(Iterable)
-
tags
public GoogleComputeEngineTemplateOptions tags(Iterable<String> tags)
assigns tags to the created nodes- Overrides:
tagsin classTemplateOptions
-
wrapInInitScript
public GoogleComputeEngineTemplateOptions wrapInInitScript(boolean wrapInInitScript)
default true- Overrides:
wrapInInitScriptin 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:
runScriptin 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:
blockOnCompletein 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)
-
-