public abstract class EC2Cloud
extends hudson.slaves.Cloud
Modifier and Type | Class and Description |
---|---|
static class |
EC2Cloud.DescriptorImpl |
Modifier and Type | Field and Description |
---|---|
static String |
AWS_URL_HOST |
protected com.amazonaws.services.ec2.AmazonEC2 |
connection |
static String |
DEFAULT_EC2_HOST |
static String |
EC2_SLAVE_TYPE_DEMAND |
static String |
EC2_SLAVE_TYPE_SPOT |
int |
instanceCap
Upper bound on how many instances we may provision.
|
protected EC2PrivateKey |
privateKey |
Modifier | Constructor and Description |
---|---|
protected |
EC2Cloud(String id,
boolean useInstanceProfileForCredentials,
String credentialsId,
String privateKey,
String instanceCapStr,
List<? extends SlaveTemplate> templates) |
Modifier and Type | Method and Description |
---|---|
URL |
buildPresignedURL(String path)
Computes the presigned URL for the given S3 resource.
|
boolean |
canProvision(hudson.model.Label label) |
static URL |
checkEndPoint(String url) |
com.amazonaws.services.ec2.AmazonEC2 |
connect()
Connects to EC2 and returns
AmazonEC2 , which can then be used to communicate with EC2. |
static com.amazonaws.services.ec2.AmazonEC2 |
connect(com.amazonaws.auth.AWSCredentialsProvider credentialsProvider,
URL endpoint)
Connect to an EC2 instance.
|
static String |
convertHostName(String ec2HostName)
Convert a configured hostname like 'us-east-1' to a FQDN or ip address
|
static Integer |
convertPort(String ec2Port)
Convert a user entered string into a port number "" -> -1 to indicate default based on SSL setting
|
static com.amazonaws.auth.AWSCredentialsProvider |
createCredentialsProvider(boolean useInstanceProfileForCredentials,
String credentialsId) |
void |
doAttach(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp,
String id)
Debug command to attach to a running instance.
|
org.kohsuke.stapler.HttpResponse |
doProvision(String template) |
String |
getCredentialsId() |
abstract URL |
getEc2EndpointUrl() |
String |
getInstanceCapStr() |
com.amazonaws.services.ec2.model.KeyPair |
getKeyPair()
Gets the
KeyPairInfo used for the launch. |
EC2PrivateKey |
getPrivateKey() |
abstract URL |
getS3EndpointUrl() |
static String |
getSlaveTypeTagValue(String slaveType,
String templateDescription) |
SlaveTemplate |
getTemplate(hudson.model.Label label)
Gets
SlaveTemplate that has the matching Label . |
SlaveTemplate |
getTemplate(String template) |
List<SlaveTemplate> |
getTemplates() |
boolean |
isUseInstanceProfileForCredentials() |
static void |
log(Logger logger,
Level level,
hudson.model.TaskListener listener,
String message) |
static void |
log(Logger logger,
Level level,
hudson.model.TaskListener listener,
String message,
Throwable exception) |
Collection<hudson.slaves.NodeProvisioner.PlannedNode> |
provision(hudson.model.Label label,
int excessWorkload) |
protected Object |
readResolve() |
all, checkPermission, getACL, getDescriptor, getDisplayName, getSearchUrl, hasPermission
public static final String DEFAULT_EC2_HOST
public static final String AWS_URL_HOST
public static final String EC2_SLAVE_TYPE_SPOT
public static final String EC2_SLAVE_TYPE_DEMAND
protected final EC2PrivateKey privateKey
public final int instanceCap
protected transient com.amazonaws.services.ec2.AmazonEC2 connection
public abstract URL getEc2EndpointUrl() throws IOException
IOException
public abstract URL getS3EndpointUrl() throws IOException
IOException
protected Object readResolve()
public boolean isUseInstanceProfileForCredentials()
public String getCredentialsId()
public EC2PrivateKey getPrivateKey()
public String getInstanceCapStr()
public List<SlaveTemplate> getTemplates()
public SlaveTemplate getTemplate(String template)
public SlaveTemplate getTemplate(hudson.model.Label label)
SlaveTemplate
that has the matching Label
.public com.amazonaws.services.ec2.model.KeyPair getKeyPair() throws com.amazonaws.AmazonClientException, IOException
KeyPairInfo
used for the launch.com.amazonaws.AmazonClientException
IOException
public void doAttach(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter String id) throws javax.servlet.ServletException, IOException, com.amazonaws.AmazonClientException
javax.servlet.ServletException
IOException
com.amazonaws.AmazonClientException
public org.kohsuke.stapler.HttpResponse doProvision(@QueryParameter String template) throws javax.servlet.ServletException, IOException
javax.servlet.ServletException
IOException
public Collection<hudson.slaves.NodeProvisioner.PlannedNode> provision(hudson.model.Label label, int excessWorkload)
provision
in class hudson.slaves.Cloud
public boolean canProvision(hudson.model.Label label)
canProvision
in class hudson.slaves.Cloud
public static String getSlaveTypeTagValue(String slaveType, String templateDescription)
public static com.amazonaws.auth.AWSCredentialsProvider createCredentialsProvider(boolean useInstanceProfileForCredentials, String credentialsId)
public com.amazonaws.services.ec2.AmazonEC2 connect() throws com.amazonaws.AmazonClientException
AmazonEC2
, which can then be used to communicate with EC2.com.amazonaws.AmazonClientException
public static com.amazonaws.services.ec2.AmazonEC2 connect(com.amazonaws.auth.AWSCredentialsProvider credentialsProvider, URL endpoint)
AmazonEC2
clientpublic static String convertHostName(String ec2HostName)
public static Integer convertPort(String ec2Port)
public URL buildPresignedURL(String path) throws com.amazonaws.AmazonClientException
path
- String like "/bucketName/folder/folder/abc.txt" that represents the resource to request.com.amazonaws.AmazonClientException
public static URL checkEndPoint(String url) throws hudson.util.FormValidation
hudson.util.FormValidation
public static void log(Logger logger, Level level, hudson.model.TaskListener listener, String message)
Copyright © 2004-2016. All Rights Reserved.