|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jclouds.compute.internal.BaseComputeService
@Singleton public class BaseComputeService
| Field Summary | |
|---|---|
protected ComputeServiceContext |
context
|
protected Map<String,Credentials> |
credentialStore
|
protected Logger |
logger
|
| Constructor Summary | |
|---|---|
protected |
BaseComputeService(ComputeServiceContext context,
Map<String,Credentials> credentialStore,
com.google.common.base.Supplier<Set<? extends Image>> images,
com.google.common.base.Supplier<Set<? extends Hardware>> hardwareProfiles,
com.google.common.base.Supplier<Set<? extends Location>> locations,
ListNodesStrategy listNodesStrategy,
GetNodeMetadataStrategy getNodeMetadataStrategy,
CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy,
RebootNodeStrategy rebootNodeStrategy,
DestroyNodeStrategy destroyNodeStrategy,
ResumeNodeStrategy resumeNodeStrategy,
SuspendNodeStrategy suspendNodeStrategy,
javax.inject.Provider<TemplateBuilder> templateBuilderProvider,
javax.inject.Provider<TemplateOptions> templateOptionsProvider,
com.google.common.base.Predicate<AtomicReference<NodeMetadata>> nodeRunning,
com.google.common.base.Predicate<AtomicReference<NodeMetadata>> nodeTerminated,
com.google.common.base.Predicate<AtomicReference<NodeMetadata>> nodeSuspended,
InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
InitAdminAccess initAdminAccess,
RunScriptOnNode.Factory runScriptOnNodeFactory,
PersistNodeCredentials persistNodeCredentials,
ComputeServiceConstants.Timeouts timeouts,
ExecutorService executor)
|
| Method Summary | |
|---|---|
protected void |
cleanUpIncidentalResourcesOfDeadNodes(Set<? extends NodeMetadata> deadNodes)
|
Set<? extends NodeMetadata> |
createNodesInGroup(String group,
int count)
Like ComputeService.createNodesInGroup(String,int,TemplateOptions), except that the
options are default, as specified in ComputeService.templateOptions(). |
Set<? extends NodeMetadata> |
createNodesInGroup(String group,
int count,
Template template)
The compute api treats nodes as a group based on the name you specify. |
Set<? extends NodeMetadata> |
createNodesInGroup(String group,
int count,
TemplateOptions templateOptions)
Like ComputeService.createNodesInGroup(String,int,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 NodeMetadata> |
destroyNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter)
nodes matching the filter are treated as a logical set. |
protected NodeMetadata |
doDestroyNode(String id)
|
ComputeServiceContext |
getContext()
|
NodeMetadata |
getNodeMetadata(String id)
Find a node by its id. |
Set<? extends Location> |
listAssignableLocations()
The list locations command returns all the valid locations for nodes. |
Set<? extends Hardware> |
listHardwareProfiles()
The list hardware profiles command shows you the options including virtual cpu count, memory, and disks. |
Set<? extends Image> |
listImages()
Images define the operating system and metadata related to a node. |
Set<ComputeMetadata> |
listNodes()
all nodes available to the current user by id. |
Set<? extends NodeMetadata> |
listNodesDetailsMatching(com.google.common.base.Predicate<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<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<NodeMetadata> filter)
nodes matching the filter are treated as a logical set. |
ExecResponse |
runScriptOnNode(String id,
Statement runScript)
|
ExecResponse |
runScriptOnNode(String id,
Statement runScript,
RunScriptOptions options)
Run the script on a specific node |
ExecResponse |
runScriptOnNode(String id,
String runScript)
|
ExecResponse |
runScriptOnNode(String id,
String runScript,
RunScriptOptions options)
|
Map<NodeMetadata,ExecResponse> |
runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter,
Statement runScript)
|
Map<NodeMetadata,ExecResponse> |
runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter,
Statement runScript,
RunScriptOptions options)
Run the script on all nodes with the specific predicate. |
Map<NodeMetadata,ExecResponse> |
runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter,
String runScript)
|
Map<? extends NodeMetadata,ExecResponse> |
runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter,
String runScript,
RunScriptOptions options)
|
com.google.common.util.concurrent.ListenableFuture<ExecResponse> |
submitScriptOnNode(String id,
Statement runScript,
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<NodeMetadata> filter)
nodes matching the filter are treated as a logical set. |
TemplateBuilder |
templateBuilder()
Makes a new template builder for this service |
TemplateOptions |
templateOptions()
Makes a new set of options for running nodes |
protected NodeMetadata |
updateNodeWithCredentialsIfPresent(NodeMetadata node,
RunScriptOptions options)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Named(value="jclouds.compute") protected Logger logger
protected final ComputeServiceContext context
protected final Map<String,Credentials> credentialStore
| Constructor Detail |
|---|
@Inject
protected BaseComputeService(ComputeServiceContext context,
Map<String,Credentials> credentialStore,
com.google.common.base.Supplier<Set<? extends Image>> images,
com.google.common.base.Supplier<Set<? extends Hardware>> hardwareProfiles,
com.google.common.base.Supplier<Set<? extends Location>> locations,
ListNodesStrategy listNodesStrategy,
GetNodeMetadataStrategy getNodeMetadataStrategy,
CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy,
RebootNodeStrategy rebootNodeStrategy,
DestroyNodeStrategy destroyNodeStrategy,
ResumeNodeStrategy resumeNodeStrategy,
SuspendNodeStrategy suspendNodeStrategy,
javax.inject.Provider<TemplateBuilder> templateBuilderProvider,
javax.inject.Provider<TemplateOptions> templateOptionsProvider,
@Named(value="NODE_RUNNING")
com.google.common.base.Predicate<AtomicReference<NodeMetadata>> nodeRunning,
@Named(value="NODE_TERMINATED")
com.google.common.base.Predicate<AtomicReference<NodeMetadata>> nodeTerminated,
@Named(value="NODE_SUSPENDED")
com.google.common.base.Predicate<AtomicReference<NodeMetadata>> nodeSuspended,
InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
InitAdminAccess initAdminAccess,
RunScriptOnNode.Factory runScriptOnNodeFactory,
PersistNodeCredentials persistNodeCredentials,
ComputeServiceConstants.Timeouts timeouts,
@Named(value="jclouds.user-threads")
ExecutorService executor)
| Method Detail |
|---|
public ComputeServiceContext getContext()
getContext in interface ComputeService
public Set<? extends NodeMetadata> createNodesInGroup(String group,
int count,
Template template)
throws RunNodesException
ComputeService
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 ComputeServicegroup - - common identifier to group nodes by, cannot contain hyphenscount - - how many to fire up.template - - how to configure the nodes
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 NodeMetadata> createNodesInGroup(String group,
int count,
TemplateOptions templateOptions)
throws RunNodesException
ComputeServiceComputeService.createNodesInGroup(String,int,Template), except that the template
is default, equivalent to templateBuilder().any().options(templateOptions).
createNodesInGroup in interface ComputeServiceRunNodesException
public Set<? extends NodeMetadata> createNodesInGroup(String group,
int count)
throws RunNodesException
ComputeServiceComputeService.createNodesInGroup(String,int,TemplateOptions), except that the
options are default, as specified in ComputeService.templateOptions().
createNodesInGroup in interface ComputeServiceRunNodesExceptionpublic void destroyNode(String id)
destroyNode in interface ComputeServicepublic Set<? extends NodeMetadata> destroyNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter)
destroyNodesMatching in interface ComputeServiceprotected NodeMetadata doDestroyNode(String id)
protected void cleanUpIncidentalResourcesOfDeadNodes(Set<? extends NodeMetadata> deadNodes)
public Set<ComputeMetadata> listNodes()
NodeMetadata objects.
listNodes in interface ComputeServicepublic Set<? extends NodeMetadata> listNodesDetailsMatching(com.google.common.base.Predicate<ComputeMetadata> filter)
listNodesDetailsMatching in interface ComputeServicefilter - how to select the nodes you are interested in details on.public Set<? extends Hardware> listHardwareProfiles()
listHardwareProfiles in interface ComputeServicepublic Set<? extends Image> listImages()
listImages in interface ComputeServicepublic Set<? extends Location> listAssignableLocations()
listAssignableLocations in interface ComputeServicepublic TemplateBuilder templateBuilder()
templateBuilder in interface ComputeServicepublic NodeMetadata getNodeMetadata(String id)
getNodeMetadata in interface ComputeServicepublic void rebootNode(String id)
rebootNode in interface ComputeServicepublic void rebootNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter)
rebootNodesMatching in interface ComputeServicepublic void resumeNode(String id)
suspended state,
given its id.
resumeNode in interface ComputeServicepublic void resumeNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter)
resumeNodesMatching in interface ComputeServicepublic void suspendNode(String id)
suspended state.
suspendNode in interface ComputeServicepublic void suspendNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter)
suspendNodesMatching in interface ComputeService
public Map<NodeMetadata,ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter,
String runScript)
throws RunScriptOnNodesException
runScriptOnNodesMatching in interface ComputeServiceRunScriptOnNodesExceptionComputeService.runScriptOnNodesMatching(Predicate, Statement, RunScriptOptions)
public Map<NodeMetadata,ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter,
Statement runScript)
throws RunScriptOnNodesException
runScriptOnNodesMatching in interface ComputeServiceRunScriptOnNodesExceptionComputeService.runScriptOnNodesMatching(Predicate, Statement, RunScriptOptions)
public Map<? extends NodeMetadata,ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter,
String runScript,
RunScriptOptions options)
throws RunScriptOnNodesException
runScriptOnNodesMatching in interface ComputeServiceRunScriptOnNodesExceptionComputeService.runScriptOnNodesMatching(Predicate, Statement, RunScriptOptions)
public Map<NodeMetadata,ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter,
Statement runScript,
RunScriptOptions options)
throws RunScriptOnNodesException
runScriptOnNodesMatching in interface 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 credentials
RunScriptOnNodesException - if anything goes wrong during script executionNodePredicates.runningInGroup(String),
Statements
public ExecResponse runScriptOnNode(String id,
String runScript)
runScriptOnNode in interface ComputeServiceComputeService.runScriptOnNode(String, String, RunScriptOptions)
public ExecResponse runScriptOnNode(String id,
String runScript,
RunScriptOptions options)
runScriptOnNode in interface ComputeServiceComputeService.runScriptOnNode(String, Statement, RunScriptOptions),
Statements.exec(java.lang.String)
public ExecResponse runScriptOnNode(String id,
Statement runScript)
runScriptOnNode in interface ComputeServiceComputeService.runScriptOnNode(String, Statement, RunScriptOptions)
public ExecResponse runScriptOnNode(String id,
Statement runScript,
RunScriptOptions options)
runScriptOnNode in interface 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 credentials
NodePredicates.runningInGroup(String),
Statements
public com.google.common.util.concurrent.ListenableFuture<ExecResponse> submitScriptOnNode(String id,
Statement runScript,
RunScriptOptions options)
nohup
submitScriptOnNode in interface 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 credentials
NodePredicates.runningInGroup(String),
Statementspublic TemplateOptions templateOptions()
ComputeService
templateOptions in interface ComputeService
protected NodeMetadata updateNodeWithCredentialsIfPresent(NodeMetadata node,
RunScriptOptions options)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||