Class CloudFormation
- java.lang.Object
-
- com.syncapse.jenkinsci.plugins.awscloudformationwrapper.CloudFormation
-
public class CloudFormation extends Object
Class for interacting with CloudFormation stacks, including creating them, deleting them and getting the outputs.- Author:
- erickdovale
-
-
Field Summary
Fields Modifier and Type Field Description static long
MIN_TIMEOUT
Minimum time to wait before considering the creation of the stack a failure.
-
Constructor Summary
Constructors Constructor Description CloudFormation(PrintStream logger, String stackName, Boolean isRecipeURL, String recipeBody, Map<String,String> parameters, long timeout, String awsAccessKey, String awsSecretKey, boolean autoDeleteStack, EnvVars envVars, Boolean isPrefixSelected)
CloudFormation(PrintStream logger, String stackName, Boolean isRecipeURL, String recipeBody, Map<String,String> parameters, long timeout, String awsAccessKey, String awsSecretKey, Region region, boolean autoDeleteStack, EnvVars envVars, Boolean isPrefixSelected)
CloudFormation(PrintStream logger, String stackName, Boolean isRecipeURL, String recipeBody, Map<String,String> parameters, long timeout, String awsAccessKey, String awsSecretKey, Region region, EnvVars envVars, Boolean isPrefixSelected, long sleep)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
create()
boolean
delete()
boolean
getAutoDeleteStack()
Return true if this stack should be automatically deleted at the end of the job, or false if it should not be automatically deleted.protected com.amazonaws.services.cloudformation.AmazonCloudFormation
getAWSClient()
Map<String,String>
getOutputs()
Map<String,String>
getStackParameters(String stackName)
static boolean
isRecipeURL(String recipe)
-
-
-
Field Detail
-
MIN_TIMEOUT
public static final long MIN_TIMEOUT
Minimum time to wait before considering the creation of the stack a failure. Default value is 5 minutes. (300 seconds)- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CloudFormation
public CloudFormation(PrintStream logger, String stackName, Boolean isRecipeURL, String recipeBody, Map<String,String> parameters, long timeout, String awsAccessKey, String awsSecretKey, Region region, boolean autoDeleteStack, EnvVars envVars, Boolean isPrefixSelected)
- Parameters:
logger
- a logger to write progress information.stackName
- the name of the stack as defined in the AWS CloudFormation API.isRecipeURL
- true to treat the recipeBody as a URLrecipeBody
- the body of the json document describing the stack.parameters
- a Map of where the keys are the param name and the value the param value.timeout
- Time to wait for the creation of a stack to complete. This value will be the greater betweenMIN_TIMEOUT
and the given value.awsAccessKey
- the AWS API Access Key.awsSecretKey
- the AWS API Secret Key.
-
CloudFormation
public CloudFormation(PrintStream logger, String stackName, Boolean isRecipeURL, String recipeBody, Map<String,String> parameters, long timeout, String awsAccessKey, String awsSecretKey, Region region, EnvVars envVars, Boolean isPrefixSelected, long sleep)
-
-
Method Detail
-
getAutoDeleteStack
public boolean getAutoDeleteStack()
Return true if this stack should be automatically deleted at the end of the job, or false if it should not be automatically deleted.- Returns:
- true if this stack should be automatically deleted at the end of the job, or false if it should not be automatically deleted.
-
delete
public boolean delete()
-
create
public boolean create() throws TimeoutException, InterruptedException
- Returns:
- True of the stack was created successfully. False otherwise.
- Throws:
TimeoutException
- if creating the stack takes longer than the timeout value passed during creation.InterruptedException
-
getAWSClient
protected com.amazonaws.services.cloudformation.AmazonCloudFormation getAWSClient()
-
isRecipeURL
public static boolean isRecipeURL(String recipe)
-
-