Package hudson.plugins.ec2
Class EC2Cloud
java.lang.Object
hudson.model.AbstractModelObject
hudson.model.Actionable
hudson.slaves.Cloud
hudson.plugins.ec2.EC2Cloud
- All Implemented Interfaces:
ExtensionPoint
,Describable<Cloud>
,ModelObject
,SearchableModelObject
,SearchItem
,AccessControlled
,ModelObjectWithContextMenu
- Direct Known Subclasses:
AmazonEC2Cloud
Hudson's view of EC2.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
Nested classes/interfaces inherited from class hudson.slaves.Cloud
Cloud.CloudState
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionEC2Cloud
(String name, boolean useInstanceProfileForCredentials, String credentialsId, String region, String privateKey, String sshKeysCredentialsId, String instanceCapStr, List<? extends SlaveTemplate> templates, String roleArn, String roleSessionName) EC2Cloud
(String name, boolean useInstanceProfileForCredentials, String credentialsId, String region, String privateKey, String instanceCapStr, List<? extends SlaveTemplate> templates, String roleArn, String roleSessionName) Deprecated.protected
EC2Cloud
(String id, boolean useInstanceProfileForCredentials, String credentialsId, String privateKey, String instanceCapStr, List<? extends SlaveTemplate> templates, String roleArn, String roleSessionName) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTemplate
(SlaveTemplate newTemplate) boolean
canProvision
(Label label) static URL
checkEndPoint
(String url) software.amazon.awssdk.services.ec2.Ec2Client
connect()
Connects to EC2 and returnsEc2Client
, which can then be used to communicate with EC2.static software.amazon.awssdk.core.client.config.ClientOverrideConfiguration
protected software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
static software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
createCredentialsProvider
(boolean useInstanceProfileForCredentials, String credentialsId) static software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
createCredentialsProvider
(boolean useInstanceProfileForCredentials, String credentialsId, String roleArn, String roleSessionName, String region) void
doAttach
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String id) Debug command to attach to a running instance.org.kohsuke.stapler.HttpResponse
doProvision
(String template) Deprecated.Use public field "name" instead.static software.amazon.awssdk.http.SdkHttpClient
int
Gets theKeyPairInfo
used for the launch.Deprecated.static String
getSlaveTypeTagValue
(String slaveType, String templateDescription) getTemplate
(Label label) Deprecated.getTemplate
(String template) getTemplates
(Label label) Gets list ofSlaveTemplate
that matchesLabel
.boolean
boolean
static void
log
(Logger logger, Level level, TaskListener listener, String message) static void
static URI
parseEndpoint
(String input) static software.amazon.awssdk.regions.Region
parseRegion
(String input) void
provision
(SlaveTemplate t, int number) protected Object
void
setAltEC2Endpoint
(String altEC2Endpoint) void
setNoDelayProvisioning
(boolean noDelayProvisioning) void
updateTemplate
(SlaveTemplate newTemplate, String oldTemplateDescription) Methods inherited from class hudson.slaves.Cloud
all, canProvision, doConfigSubmit, doDoDelete, getACL, getDescriptor, getDisplayName, getIcon, getIconAltText, getIconClassName, getSearchUrl, getUrl, provision, reconfigure, reconfigure, registerPermissions
Methods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, getDynamic, removeAction, removeActions, replaceAction, replaceActions
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendError
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
-
Field Details
-
DEFAULT_EC2_HOST
- See Also:
-
EC2_SLAVE_TYPE_SPOT
- See Also:
-
EC2_SLAVE_TYPE_DEMAND
- See Also:
-
EC2_REQUEST_EXPIRED_ERROR_CODE
- See Also:
-
SSH_PRIVATE_KEY_FILEPATH
-
-
Constructor Details
-
EC2Cloud
-
EC2Cloud
@Deprecated public EC2Cloud(String name, boolean useInstanceProfileForCredentials, String credentialsId, String region, String privateKey, String instanceCapStr, List<? extends SlaveTemplate> templates, String roleArn, String roleSessionName) Deprecated. -
EC2Cloud
@Deprecated protected EC2Cloud(String id, boolean useInstanceProfileForCredentials, String credentialsId, String privateKey, String instanceCapStr, List<? extends SlaveTemplate> templates, String roleArn, String roleSessionName) Deprecated.
-
-
Method Details
-
resolvePrivateKey
-
getCloudName
Deprecated.Use public field "name" instead. -
getRegion
-
parseRegion
@CheckForNull @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static software.amazon.awssdk.regions.Region parseRegion(@CheckForNull String input) -
parseEndpoint
-
isNoDelayProvisioning
public boolean isNoDelayProvisioning() -
setNoDelayProvisioning
@DataBoundSetter public void setNoDelayProvisioning(boolean noDelayProvisioning) -
getAltEC2Endpoint
-
setAltEC2Endpoint
-
addTemplate
- Throws:
Exception
-
updateTemplate
public void updateTemplate(SlaveTemplate newTemplate, String oldTemplateDescription) throws Exception - Throws:
Exception
-
readResolve
-
isUseInstanceProfileForCredentials
public boolean isUseInstanceProfileForCredentials() -
getRoleArn
-
getRoleSessionName
-
getCredentialsId
-
getSshKeysCredentialsId
-
getPrivateKey
Deprecated. -
getInstanceCapStr
-
getInstanceCap
public int getInstanceCap() -
getTemplates
-
getTemplate
-
getTemplate
Deprecated.GetsSlaveTemplate
that has the matchingLabel
. -
getTemplates
Gets list ofSlaveTemplate
that matchesLabel
. -
getKeyPair
@CheckForNull public KeyPair getKeyPair() throws software.amazon.awssdk.core.exception.SdkException, IOExceptionGets theKeyPairInfo
used for the launch.- Throws:
software.amazon.awssdk.core.exception.SdkException
IOException
-
doAttach
public void doAttach(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String id) throws jakarta.servlet.ServletException, IOException, software.amazon.awssdk.core.exception.SdkException Debug command to attach to a running instance.- Throws:
jakarta.servlet.ServletException
IOException
software.amazon.awssdk.core.exception.SdkException
-
doProvision
public org.kohsuke.stapler.HttpResponse doProvision(@QueryParameter String template) throws jakarta.servlet.ServletException, IOException - Throws:
jakarta.servlet.ServletException
IOException
-
provision
-
provision
-
canProvision
- Overrides:
canProvision
in classCloud
-
createCredentialsProvider
protected software.amazon.awssdk.auth.credentials.AwsCredentialsProvider createCredentialsProvider() -
getSlaveTypeTagValue
-
createCredentialsProvider
public static software.amazon.awssdk.auth.credentials.AwsCredentialsProvider createCredentialsProvider(boolean useInstanceProfileForCredentials, String credentialsId) -
createCredentialsProvider
-
connect
public software.amazon.awssdk.services.ec2.Ec2Client connect() throws software.amazon.awssdk.core.exception.SdkExceptionConnects to EC2 and returnsEc2Client
, which can then be used to communicate with EC2.- Throws:
software.amazon.awssdk.core.exception.SdkException
-
getHttpClient
public static software.amazon.awssdk.http.SdkHttpClient getHttpClient() -
createClientOverrideConfiguration
public static software.amazon.awssdk.core.client.config.ClientOverrideConfiguration createClientOverrideConfiguration() -
checkEndPoint
- Throws:
FormValidation
-
log
-
log
public static void log(Logger logger, Level level, TaskListener listener, String message, Throwable exception)
-