com.amazonaws.waiters.WaiterUnrecoverableException Java Examples
The following examples show how to use
com.amazonaws.waiters.WaiterUnrecoverableException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AWSProvider.java From testgrid with Apache License 2.0 | 5 votes |
/** * This method releases the provisioned AWS infrastructure. * * @param script the script config * @param inputs * @return true or false to indicate the result of destroy operation. * @throws TestGridInfrastructureException when AWS error occurs in deletion process. * @throws InterruptedException when there is an interruption while waiting for the result. */ private boolean doRelease(Script script, Properties inputs, TestPlan testPlan) throws TestGridInfrastructureException, InterruptedException, TestGridDAOException { Path configFilePath; String stackName = script.getName(); String region = inputs.getProperty(AWS_REGION_PARAMETER); configFilePath = TestGridUtil.getConfigFilePath(); AmazonCloudFormation stackdestroy = AmazonCloudFormationClientBuilder.standard() .withCredentials(new PropertiesFileCredentialsProvider(configFilePath.toString())) .withRegion(region) .build(); DeleteStackRequest deleteStackRequest = new DeleteStackRequest(); deleteStackRequest.setStackName(stackName); stackdestroy.deleteStack(deleteStackRequest); logger.info(StringUtil.concatStrings("Stack : ", stackName, " is handed over for deletion!")); //Notify AWSResourceManager about stack destruction to release acquired resources AWSResourceManager awsResourceManager = new AWSResourceManager(); awsResourceManager.notifyStackDeletion(testPlan, script, region); boolean waitForStackDeletion = Boolean .parseBoolean(getProperty(ConfigurationProperties.WAIT_FOR_STACK_DELETION)); if (waitForStackDeletion) { logger.info(StringUtil.concatStrings("Waiting for stack : ", stackName, " to delete..")); Waiter<DescribeStacksRequest> describeStacksRequestWaiter = new AmazonCloudFormationWaiters(stackdestroy).stackDeleteComplete(); try { describeStacksRequestWaiter.run(new WaiterParameters<>(new DescribeStacksRequest() .withStackName(stackName))); } catch (WaiterUnrecoverableException e) { throw new TestGridInfrastructureException("Error occurred while waiting for Stack :" + stackName + " deletion !"); } } return true; }
Example #2
Source File: CodeDeployUtils.java From herd-mdl with Apache License 2.0 | 4 votes |
/** * Waits for a given deployment to succeed (or fail). * * @param deploymentId: String. The specified deployment's id. */ public static void waitForMostRecentDeployment(String deploymentId) { LOGGER.debug("Waiting on deployment with id: \'{}\'", deploymentId); AmazonCodeDeploy codeDeployClient = AmazonCodeDeployClientBuilder.standard() .withRegion(Regions.US_EAST_1).build(); GetDeploymentRequest getDeploymentRequest = new GetDeploymentRequest(); getDeploymentRequest.setDeploymentId(deploymentId); Waiter<GetDeploymentRequest> waiter = codeDeployClient.waiters().deploymentSuccessful(); try { waiter.run(new WaiterParameters<>(getDeploymentRequest)); LOGGER.info("Deployment was successful."); } catch (WaiterUnrecoverableException | WaiterTimedOutException e) { LOGGER.error("Deployment with id: {} was unsuccessful.", deploymentId); } }