@Singleton public class EC2ComputeService extends BaseComputeService
context, credentialStore, logger
Modifier | Constructor and Description |
---|---|
protected |
EC2ComputeService(ComputeServiceContext context,
Map<String,Credentials> credentialStore,
com.google.common.base.Supplier<Set<? extends Image>> images,
com.google.common.base.Supplier<Set<? extends Hardware>> sizes,
com.google.common.base.Supplier<Set<? extends Location>> locations,
ListNodesStrategy listNodesStrategy,
GetImageStrategy getImageStrategy,
GetNodeMetadataStrategy getNodeMetadataStrategy,
CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy,
RebootNodeStrategy rebootNodeStrategy,
DestroyNodeStrategy destroyNodeStrategy,
ResumeNodeStrategy startNodeStrategy,
SuspendNodeStrategy stopNodeStrategy,
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,
RunScriptOnNode.Factory runScriptOnNodeFactory,
InitAdminAccess initAdminAccess,
PersistNodeCredentials persistNodeCredentials,
ComputeServiceConstants.Timeouts timeouts,
com.google.common.util.concurrent.ListeningExecutorService userExecutor,
EC2Client client,
ConcurrentMap<RegionAndName,KeyPair> credentialsMap,
com.google.common.cache.LoadingCache<RegionAndName,String> securityGroupMap,
com.google.common.base.Optional<ImageExtension> imageExtension,
GroupNamingConvention.Factory namingConvention,
boolean generateInstanceNames) |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanUpIncidentalResources(String region,
String group) |
protected void |
cleanUpIncidentalResourcesOfDeadNodes(Set<? extends NodeMetadata> deadNodes)
Cleans implicit keypairs and security groups.
|
Set<? extends NodeMetadata> |
createNodesInGroup(String group,
int count,
Template template)
The compute api treats nodes as a group based on the name you specify.
|
protected com.google.common.collect.ImmutableSet<String> |
extractIdsFromInstances(Iterable<? extends RunningInstance> deadOnes) |
EC2TemplateOptions |
templateOptions()
returns template options, except of type
EC2TemplateOptions . |
protected com.google.common.base.Predicate<RunningInstance> |
usingKeyPairAndNotDead(KeyPair keyPair) |
createNodesInGroup, createNodesInGroup, destroyNode, destroyNodesMatching, doDestroyNode, getContext, getImage, getImageExtension, getNodeMetadata, listAssignableLocations, listHardwareProfiles, listImages, listNodes, listNodesByIds, listNodesDetailsMatching, rebootNode, rebootNodesMatching, resumeNode, resumeNodesMatching, runScriptOnNode, runScriptOnNode, runScriptOnNode, runScriptOnNode, runScriptOnNodesMatching, runScriptOnNodesMatching, runScriptOnNodesMatching, runScriptOnNodesMatching, submitScriptOnNode, submitScriptOnNode, suspendNode, suspendNodesMatching, templateBuilder, updateNodeWithCredentialsIfPresent
@Inject protected EC2ComputeService(ComputeServiceContext context, Map<String,Credentials> credentialStore, com.google.common.base.Supplier<Set<? extends Image>> images, com.google.common.base.Supplier<Set<? extends Hardware>> sizes, com.google.common.base.Supplier<Set<? extends Location>> locations, ListNodesStrategy listNodesStrategy, GetImageStrategy getImageStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy, CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy, DestroyNodeStrategy destroyNodeStrategy, ResumeNodeStrategy startNodeStrategy, SuspendNodeStrategy stopNodeStrategy, javax.inject.Provider<TemplateBuilder> templateBuilderProvider, @Named(value="DEFAULT") javax.inject.Provider<TemplateOptions> templateOptionsProvider, @Named(value="jclouds.compute.timeout.node-running") com.google.common.base.Predicate<AtomicReference<NodeMetadata>> nodeRunning, @Named(value="jclouds.compute.timeout.node-terminated") com.google.common.base.Predicate<AtomicReference<NodeMetadata>> nodeTerminated, @Named(value="jclouds.compute.timeout.node-suspended") com.google.common.base.Predicate<AtomicReference<NodeMetadata>> nodeSuspended, InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory, RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess, PersistNodeCredentials persistNodeCredentials, ComputeServiceConstants.Timeouts timeouts, @Named(value="jclouds.user-threads") com.google.common.util.concurrent.ListeningExecutorService userExecutor, EC2Client client, ConcurrentMap<RegionAndName,KeyPair> credentialsMap, @Named(value="SECURITY") com.google.common.cache.LoadingCache<RegionAndName,String> securityGroupMap, com.google.common.base.Optional<ImageExtension> imageExtension, GroupNamingConvention.Factory namingConvention, @Named(value="jclouds.ec2.generate-instance-names") boolean generateInstanceNames)
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
createNodesInGroup
in class BaseComputeService
group
- - common identifier to group nodes bycount
- - how many to fire up.template
- - how to configure the nodesRunNodesException
- 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.protected com.google.common.collect.ImmutableSet<String> extractIdsFromInstances(Iterable<? extends RunningInstance> deadOnes)
protected com.google.common.base.Predicate<RunningInstance> usingKeyPairAndNotDead(KeyPair keyPair)
protected void cleanUpIncidentalResourcesOfDeadNodes(Set<? extends NodeMetadata> deadNodes)
cleanUpIncidentalResourcesOfDeadNodes
in class BaseComputeService
public EC2TemplateOptions templateOptions()
EC2TemplateOptions
.templateOptions
in interface ComputeService
templateOptions
in class BaseComputeService
Copyright © 2009-2013 jclouds. All Rights Reserved.