|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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<NodeMetadata> nodeRunning,
com.google.common.base.Predicate<NodeMetadata> nodeTerminated,
com.google.common.base.Predicate<NodeMetadata> nodeSuspended,
InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
InitAdminAccess initAdminAccess,
RunScriptOnNode.Factory runScriptOnNodeFactory,
PersistNodeCredentials persistNodeCredentials,
ComputeServiceConstants.Timeouts timeouts,
ExecutorService executor)
|
Method Summary | |
---|---|
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. |
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. |
Set<? extends NodeMetadata> |
runNodesWithTag(String group,
int count)
|
Set<? extends NodeMetadata> |
runNodesWithTag(String group,
int count,
Template template)
|
Set<? extends NodeMetadata> |
runNodesWithTag(String group,
int count,
TemplateOptions templateOptions)
|
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,
Payload runScript)
|
Map<NodeMetadata,ExecResponse> |
runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter,
Payload 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<NodeMetadata> nodeRunning, @Named(value="NODE_TERMINATED") com.google.common.base.Predicate<NodeMetadata> nodeTerminated, @Named(value="NODE_SUSPENDED") com.google.common.base.Predicate<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> runNodesWithTag(String group, int count, Template template) throws RunNodesException
runNodesWithTag
in interface ComputeService
RunNodesException
ComputeService.createNodesInGroup(String , int , Template )
public Set<? extends NodeMetadata> runNodesWithTag(String group, int count, TemplateOptions templateOptions) throws RunNodesException
runNodesWithTag
in interface ComputeService
RunNodesException
ComputeService.createNodesInGroup(String , int , TemplateOptions )
public Set<? extends NodeMetadata> runNodesWithTag(String group, int count) throws RunNodesException
runNodesWithTag
in interface ComputeService
RunNodesException
ComputeService.createNodesInGroup(String , int )
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 ComputeService
group
- - 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
ComputeService
ComputeService.createNodesInGroup(String,int,Template)
, except that the template
is default, equivalent to templateBuilder().any().options(templateOptions)
.
createNodesInGroup
in interface ComputeService
RunNodesException
public Set<? extends NodeMetadata> createNodesInGroup(String group, int count) throws RunNodesException
ComputeService
ComputeService.createNodesInGroup(String,int,TemplateOptions)
, except that the
options are default, as specified in ComputeService.templateOptions()
.
createNodesInGroup
in interface ComputeService
RunNodesException
public void destroyNode(String id)
destroyNode
in interface ComputeService
public Set<? extends NodeMetadata> destroyNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter)
destroyNodesMatching
in interface ComputeService
public Set<ComputeMetadata> listNodes()
NodeMetadata
objects.
listNodes
in interface ComputeService
public Set<? extends NodeMetadata> listNodesDetailsMatching(com.google.common.base.Predicate<ComputeMetadata> filter)
listNodesDetailsMatching
in interface ComputeService
filter
- how to select the nodes you are interested in details on.public Set<? extends Hardware> listHardwareProfiles()
listHardwareProfiles
in interface ComputeService
public Set<? extends Image> listImages()
listImages
in interface ComputeService
public Set<? extends Location> listAssignableLocations()
listAssignableLocations
in interface ComputeService
public TemplateBuilder templateBuilder()
templateBuilder
in interface ComputeService
public NodeMetadata getNodeMetadata(String id)
getNodeMetadata
in interface ComputeService
public void rebootNode(String id)
rebootNode
in interface ComputeService
public void rebootNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter)
rebootNodesMatching
in interface ComputeService
public void resumeNode(String id)
suspended
state,
given its id.
resumeNode
in interface ComputeService
public void resumeNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter)
resumeNodesMatching
in interface ComputeService
public void suspendNode(String id)
suspended
state.
suspendNode
in interface ComputeService
public 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, Payload runScript) throws RunScriptOnNodesException
runScriptOnNodesMatching
in interface ComputeService
RunScriptOnNodesException
Payloads
,
ComputeService.runScriptOnNodesMatching(Predicate, Statement, RunScriptOptions)
public Map<NodeMetadata,ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter, Payload runScript, RunScriptOptions options) throws RunScriptOnNodesException
runScriptOnNodesMatching
in interface ComputeService
RunScriptOnNodesException
Payloads
,
ComputeService.runScriptOnNodesMatching(Predicate, Statement, RunScriptOptions)
public Map<NodeMetadata,ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter, String runScript) throws RunScriptOnNodesException
runScriptOnNodesMatching
in interface ComputeService
RunScriptOnNodesException
ComputeService.runScriptOnNodesMatching(Predicate, Statement, RunScriptOptions)
public Map<NodeMetadata,ExecResponse> runScriptOnNodesMatching(com.google.common.base.Predicate<NodeMetadata> filter, Statement runScript) throws RunScriptOnNodesException
runScriptOnNodesMatching
in interface ComputeService
RunScriptOnNodesException
ComputeService.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 ComputeService
RunScriptOnNodesException
ComputeService.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 ComputeService
filter
- 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.runningWithTag(String)
,
Statements
public ExecResponse runScriptOnNode(String id, String runScript)
runScriptOnNode
in interface ComputeService
ComputeService.runScriptOnNode(String, String, RunScriptOptions)
public ExecResponse runScriptOnNode(String id, String runScript, RunScriptOptions options)
runScriptOnNode
in interface ComputeService
ComputeService.runScriptOnNode(String, Statement, RunScriptOptions)
,
Statements.exec(java.lang.String)
public ExecResponse runScriptOnNode(String id, Statement runScript)
runScriptOnNode
in interface ComputeService
ComputeService.runScriptOnNode(String, Statement, RunScriptOptions)
public ExecResponse runScriptOnNode(String id, Statement runScript, RunScriptOptions options)
runScriptOnNode
in interface ComputeService
id
- 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.runningWithTag(String)
,
Statements
public com.google.common.util.concurrent.ListenableFuture<ExecResponse> submitScriptOnNode(String id, Statement runScript, RunScriptOptions options)
nohup
submitScriptOnNode
in interface ComputeService
id
- 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.runningWithTag(String)
,
Statements
public 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 |