public class ComputeServiceEventProxy extends Object implements org.jclouds.compute.ComputeService
ComputeService which delegates calls to the underlying impl and notifies
NodeListeners about node creation/destruction events.| Constructor and Description |
|---|
ComputeServiceEventProxy(org.osgi.framework.BundleContext bundleContext,
org.jclouds.compute.ComputeService computeService)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Set<? extends org.jclouds.compute.domain.NodeMetadata> |
createNodesInGroup(String group,
int count)
Like
ComputeService.createNodesInGroup(String, int, org.jclouds.compute.options.TemplateOptions), except that the
options are default, as specified in ComputeService.templateOptions(). |
Set<? extends org.jclouds.compute.domain.NodeMetadata> |
createNodesInGroup(String group,
int count,
org.jclouds.compute.domain.Template template)
The compute api treats nodes as a group based on the name you specify.
|
Set<? extends org.jclouds.compute.domain.NodeMetadata> |
createNodesInGroup(String group,
int count,
org.jclouds.compute.options.TemplateOptions templateOptions)
Like
ComputeService.createNodesInGroup(String, int, org.jclouds.compute.domain.Template), except that the template
is default, equivalent to templateBuilder().any().options(templateOptions). |
void |
destroyNode(String id)
destroy the node, given its id.
|
Set<? extends org.jclouds.compute.domain.NodeMetadata> |
destroyNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter)
nodes matching the filter are treated as a logical set.
|
org.jclouds.compute.ComputeServiceContext |
getContext() |
org.jclouds.compute.domain.Image |
getImage(String id)
Find an image by its id.
|
com.google.common.base.Optional<org.jclouds.compute.extensions.ImageExtension> |
getImageExtension()
Returns the
ImageExtension for this provider if it implements it. |
org.jclouds.compute.domain.NodeMetadata |
getNodeMetadata(String id)
Find a node by its id.
|
Set<? extends org.jclouds.domain.Location> |
listAssignableLocations()
The list locations command returns all the valid locations for nodes.
|
Set<? extends org.jclouds.compute.domain.Hardware> |
listHardwareProfiles()
The list hardware profiles command shows you the options including virtual cpu count, memory,
and disks.
|
Set<? extends org.jclouds.compute.domain.Image> |
listImages()
Images define the operating system and metadata related to a node.
|
Set<? extends org.jclouds.compute.domain.ComputeMetadata> |
listNodes()
all nodes available to the current user by id.
|
Set<? extends org.jclouds.compute.domain.NodeMetadata> |
listNodesDetailsMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.ComputeMetadata> filter)
get all nodes including details such as image and ip addresses even if it incurs extra
requests to the service.
|
void |
rebootNode(String id)
reboot the node, given its id.
|
void |
rebootNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter)
nodes matching the filter are treated as a logical set.
|
void |
resumeNode(String id)
resume the node from
suspended state,
given its id. |
void |
resumeNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter)
nodes matching the filter are treated as a logical set.
|
org.jclouds.compute.domain.ExecResponse |
runScriptOnNode(String id,
org.jclouds.scriptbuilder.domain.Statement runScript) |
org.jclouds.compute.domain.ExecResponse |
runScriptOnNode(String id,
org.jclouds.scriptbuilder.domain.Statement runScript,
org.jclouds.compute.options.RunScriptOptions options)
Run the script on a specific node
|
org.jclouds.compute.domain.ExecResponse |
runScriptOnNode(String id,
String runScript) |
org.jclouds.compute.domain.ExecResponse |
runScriptOnNode(String id,
String runScript,
org.jclouds.compute.options.RunScriptOptions options) |
Map<? extends org.jclouds.compute.domain.NodeMetadata,org.jclouds.compute.domain.ExecResponse> |
runScriptOnNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter,
org.jclouds.scriptbuilder.domain.Statement runScript) |
Map<? extends org.jclouds.compute.domain.NodeMetadata,org.jclouds.compute.domain.ExecResponse> |
runScriptOnNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter,
org.jclouds.scriptbuilder.domain.Statement runScript,
org.jclouds.compute.options.RunScriptOptions options)
Run the script on all nodes with the specific predicate.
|
Map<? extends org.jclouds.compute.domain.NodeMetadata,org.jclouds.compute.domain.ExecResponse> |
runScriptOnNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter,
String runScript) |
Map<? extends org.jclouds.compute.domain.NodeMetadata,org.jclouds.compute.domain.ExecResponse> |
runScriptOnNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter,
String runScript,
org.jclouds.compute.options.RunScriptOptions options) |
com.google.common.util.concurrent.ListenableFuture<org.jclouds.compute.domain.ExecResponse> |
submitScriptOnNode(String id,
org.jclouds.scriptbuilder.domain.Statement runScript,
org.jclouds.compute.options.RunScriptOptions options)
Run the script on a specific node in the background, typically as
nohup |
void |
suspendNode(String id)
suspend the node, given its id.
|
void |
suspendNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter)
nodes matching the filter are treated as a logical set.
|
org.jclouds.compute.domain.TemplateBuilder |
templateBuilder()
Makes a new template builder for this service
|
org.jclouds.compute.options.TemplateOptions |
templateOptions()
Makes a new set of options for running nodes
|
public ComputeServiceEventProxy(org.osgi.framework.BundleContext bundleContext,
org.jclouds.compute.ComputeService computeService)
bundleContext - computeService - public org.jclouds.compute.ComputeServiceContext getContext()
getContext in interface org.jclouds.compute.ComputeServicepublic org.jclouds.compute.domain.TemplateBuilder templateBuilder()
templateBuilder in interface org.jclouds.compute.ComputeServicepublic org.jclouds.compute.options.TemplateOptions templateOptions()
templateOptions in interface org.jclouds.compute.ComputeServicepublic Set<? extends org.jclouds.compute.domain.Hardware> listHardwareProfiles()
listHardwareProfiles in interface org.jclouds.compute.ComputeServicepublic Set<? extends org.jclouds.compute.domain.Image> listImages()
listImages in interface org.jclouds.compute.ComputeServicepublic Set<? extends org.jclouds.compute.domain.ComputeMetadata> listNodes()
NodeMetadata objects.listNodes in interface org.jclouds.compute.ComputeServicepublic Set<? extends org.jclouds.domain.Location> listAssignableLocations()
listAssignableLocations in interface org.jclouds.compute.ComputeServicepublic Set<? extends org.jclouds.compute.domain.NodeMetadata> createNodesInGroup(String group, int count, org.jclouds.compute.domain.Template template) throws org.jclouds.compute.RunNodesException
if (node.getCredentials().key.startsWith("-----BEGIN RSA PRIVATE KEY-----"))
// it is a private key, not a password.
Note. if all you want to do is execute a script at bootup, you should consider use of the
runscript option.
If resources such as security groups are needed, they will be reused or created for you.
Inbound port 22 will always be opened up.createNodesInGroup in interface org.jclouds.compute.ComputeServicegroup - - common identifier to group nodes by, cannot contain hyphenscount - - how many to fire up.template - - how to configure the nodesorg.jclouds.compute.RunNodesException - when there's a problem applying options to nodes. Note that successful and failed
nodes are a part of this exception, so be sure to inspect this carefully.public Set<? extends org.jclouds.compute.domain.NodeMetadata> createNodesInGroup(String group, int count, org.jclouds.compute.options.TemplateOptions templateOptions) throws org.jclouds.compute.RunNodesException
ComputeService.createNodesInGroup(String, int, org.jclouds.compute.domain.Template), except that the template
is default, equivalent to templateBuilder().any().options(templateOptions).createNodesInGroup in interface org.jclouds.compute.ComputeServiceorg.jclouds.compute.RunNodesExceptionpublic Set<? extends org.jclouds.compute.domain.NodeMetadata> createNodesInGroup(String group, int count) throws org.jclouds.compute.RunNodesException
ComputeService.createNodesInGroup(String, int, org.jclouds.compute.options.TemplateOptions), except that the
options are default, as specified in ComputeService.templateOptions().createNodesInGroup in interface org.jclouds.compute.ComputeServiceorg.jclouds.compute.RunNodesExceptionpublic void resumeNode(String id)
suspended state,
given its id.
resumeNode in interface org.jclouds.compute.ComputeServicepublic void resumeNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter)
resumeNodesMatching in interface org.jclouds.compute.ComputeServiceUnsupportedOperationException - if the underlying provider doesn't support suspend/resumeNoSuchElementException - if no nodes matched the predicate specifiedpublic void suspendNode(String id)
suspended state.
suspendNode in interface org.jclouds.compute.ComputeServiceUnsupportedOperationException - if the underlying provider doesn't support suspend/resumepublic void suspendNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter)
suspendNodesMatching in interface org.jclouds.compute.ComputeServiceUnsupportedOperationException - if the underlying provider doesn't support suspend/resumeNoSuchElementException - if no nodes matched the predicate specifiedpublic void destroyNode(String id)
destroyNode in interface org.jclouds.compute.ComputeServicepublic Set<? extends org.jclouds.compute.domain.NodeMetadata> destroyNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter)
destroyNodesMatching in interface org.jclouds.compute.ComputeServicepublic void rebootNode(String id)
rebootNode in interface org.jclouds.compute.ComputeServicepublic void rebootNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter)
rebootNodesMatching in interface org.jclouds.compute.ComputeServiceNoSuchElementException - if no nodes matched the predicate specifiedpublic org.jclouds.compute.domain.NodeMetadata getNodeMetadata(String id)
getNodeMetadata in interface org.jclouds.compute.ComputeServicepublic Set<? extends org.jclouds.compute.domain.NodeMetadata> listNodesDetailsMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.ComputeMetadata> filter)
listNodesDetailsMatching in interface org.jclouds.compute.ComputeServicefilter - how to select the nodes you are interested in details on.public Map<? extends org.jclouds.compute.domain.NodeMetadata,org.jclouds.compute.domain.ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter, String runScript) throws org.jclouds.compute.RunScriptOnNodesException
runScriptOnNodesMatching in interface org.jclouds.compute.ComputeServiceorg.jclouds.compute.RunScriptOnNodesExceptionComputeService.runScriptOnNodesMatching(com.google.common.base.Predicate, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions)public Map<? extends org.jclouds.compute.domain.NodeMetadata,org.jclouds.compute.domain.ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter, org.jclouds.scriptbuilder.domain.Statement runScript) throws org.jclouds.compute.RunScriptOnNodesException
runScriptOnNodesMatching in interface org.jclouds.compute.ComputeServiceorg.jclouds.compute.RunScriptOnNodesExceptionComputeService.runScriptOnNodesMatching(com.google.common.base.Predicate, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions)public Map<? extends org.jclouds.compute.domain.NodeMetadata,org.jclouds.compute.domain.ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter, String runScript, org.jclouds.compute.options.RunScriptOptions options) throws org.jclouds.compute.RunScriptOnNodesException
runScriptOnNodesMatching in interface org.jclouds.compute.ComputeServiceorg.jclouds.compute.RunScriptOnNodesExceptionComputeService.runScriptOnNodesMatching(com.google.common.base.Predicate, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions)public Map<? extends org.jclouds.compute.domain.NodeMetadata,org.jclouds.compute.domain.ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<org.jclouds.compute.domain.NodeMetadata> filter, org.jclouds.scriptbuilder.domain.Statement runScript, org.jclouds.compute.options.RunScriptOptions options) throws org.jclouds.compute.RunScriptOnNodesException
runScriptOnNodesMatching in interface org.jclouds.compute.ComputeServicefilter - Predicate-based filter to define on which nodes the script is to be executedrunScript - statement containing the script to runoptions - nullable options to how to run the script, whether to override credentialsNoSuchElementException - if no nodes matched the predicate specifiedorg.jclouds.compute.RunScriptOnNodesException - if anything goes wrong during script executionorg.jclouds.compute.predicates.NodePredicates#runningInGroup(String),
Statementspublic org.jclouds.compute.domain.ExecResponse runScriptOnNode(String id, org.jclouds.scriptbuilder.domain.Statement runScript, org.jclouds.compute.options.RunScriptOptions options)
runScriptOnNode in interface org.jclouds.compute.ComputeServiceid - node the script is to be executed onrunScript - statement containing the script to runoptions - nullable options to how to run the script, whether to override credentialsNoSuchElementException - if the node is not foundIllegalStateException - if the node is not in running stateorg.jclouds.compute.callables.ScriptStillRunningException - if the script was still running after org.jclouds.compute.reference.ComputeServiceConstants.Timeouts#scriptCompleteorg.jclouds.compute.predicates.NodePredicates#runningInGroup(String),
Statements@Beta public com.google.common.util.concurrent.ListenableFuture<org.jclouds.compute.domain.ExecResponse> submitScriptOnNode(String id, org.jclouds.scriptbuilder.domain.Statement runScript, org.jclouds.compute.options.RunScriptOptions options)
nohupsubmitScriptOnNode in interface org.jclouds.compute.ComputeServiceid - node the script is to be executed onrunScript - statement containing the script to runoptions - nullable options to how to run the script, whether to override credentialsNoSuchElementException - if the node is not foundIllegalStateException - if the node is not in running stateorg.jclouds.compute.predicates.NodePredicates#runningInGroup(String),
Statementspublic org.jclouds.compute.domain.ExecResponse runScriptOnNode(String id, org.jclouds.scriptbuilder.domain.Statement runScript)
runScriptOnNode in interface org.jclouds.compute.ComputeServicerunScriptOnNode(String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions)public org.jclouds.compute.domain.ExecResponse runScriptOnNode(String id, String runScript, org.jclouds.compute.options.RunScriptOptions options)
runScriptOnNode in interface org.jclouds.compute.ComputeServicerunScriptOnNode(String, org.jclouds.scriptbuilder.domain.Statement, org.jclouds.compute.options.RunScriptOptions),
Statements.exec(java.lang.String)public org.jclouds.compute.domain.ExecResponse runScriptOnNode(String id, String runScript)
runScriptOnNode in interface org.jclouds.compute.ComputeServicerunScriptOnNode(String, String, org.jclouds.compute.options.RunScriptOptions)public org.jclouds.compute.domain.Image getImage(String id)
getImage in interface org.jclouds.compute.ComputeServicepublic com.google.common.base.Optional<org.jclouds.compute.extensions.ImageExtension> getImageExtension()
ImageExtension for this provider if it implements it.getImageExtension in interface org.jclouds.compute.ComputeServiceImageExtension or Optional.absent() if not
implementedCopyright © 2012. All Rights Reserved.