Java 类com.amazonaws.services.cloudformation.model.DeleteStackRequest 实例源码

项目:aws-maven-plugin    文件:CloudFormationDeployer.java   
private void deleteFailedCreate(final String stackName, AmazonCloudFormation cf, int statusPollingIntervalMs) {
    {
        // delete an application in ROLLBACK_COMPLETE status

        ListStacksResult r = cf.listStacks();
        r.getStackSummaries() //
                .stream() //
                .filter(x -> x.getStackName().equals(stackName)) //
                .limit(1) //
                .filter(x -> StackStatus.ROLLBACK_COMPLETE.toString().equals(x.getStackStatus())) //
                .forEach(x -> {
                    log.info("Deleting stack with status " + x.getStackStatus()); //
                    cf.deleteStack(new DeleteStackRequest().withStackName(stackName));
                    waitForCompletion(cf, stackName, statusPollingIntervalMs, log);
                });

    }
}
项目:spring-cloud-stream-app-starters    文件:AwsIntegrationTestStackRule.java   
@Override
protected void after() {
    this.cloudFormation.deleteStack(new DeleteStackRequest()
            .withStackName(this.stackName));
    try {
        waitForCompletion();
    }
    catch (InterruptedException e) {
        // Ignore the InterruptedException
    }
    finally {
        System.clearProperty("cloud.aws.credentials.accessKey");
        System.clearProperty("cloud.aws.credentials.secretKey");
    }
}
项目:enhanced-snapshots    文件:ClusterConfigurationServiceImpl.java   
@Override
public void removeClusterInfrastructure() {
    autoScaling.deletePolicy(new DeletePolicyRequest().withAutoScalingGroupName(getAutoScalingGroup().getAutoScalingGroupName()).withPolicyName(SCALE_UP_POLICY));
    autoScaling.deletePolicy(new DeletePolicyRequest().withAutoScalingGroupName(getAutoScalingGroup().getAutoScalingGroupName()).withPolicyName(SCALE_DOWN_POLICY));
    cloudWatch.deleteAlarms(new DeleteAlarmsRequest().withAlarmNames(ESS_OVERLOAD_ALARM, ESS_IDLE_ALARM));
    // CloudWatch metrics are stored for two weeks. Old data will be removed automatically.

    amazonSQS.deleteQueue(new DeleteQueueRequest().withQueueUrl(ESS_QUEUE_NAME));
    cloudFormation.deleteStack(new DeleteStackRequest().withStackName(SystemUtils.getCloudFormationStackName()));
}
项目:spring-cloud-aws    文件:TestStackEnvironment.java   
private DescribeStackResourcesResult getStackResources(String stackName) throws InterruptedException, IOException {
    try {
        DescribeStacksResult describeStacksResult = this.amazonCloudFormationClient.describeStacks(new DescribeStacksRequest().withStackName(stackName));
        for (Stack stack : describeStacksResult.getStacks()) {
            if (isAvailable(stack)) {
                return this.amazonCloudFormationClient.describeStackResources(new DescribeStackResourcesRequest().withStackName(stack.getStackName()));
            }
            if (isError(stack)) {
                if (this.stackCreatedByThisInstance) {
                    throw new IllegalArgumentException("Could not create stack");
                }
                this.amazonCloudFormationClient.deleteStack(new DeleteStackRequest().withStackName(stack.getStackName()));
                return getStackResources(stackName);
            }
            if (isInProgress(stack)) {
                //noinspection BusyWait
                Thread.sleep(5000L);
                return getStackResources(stackName);
            }
        }
    } catch (AmazonClientException e) {
        String templateBody = FileCopyUtils.copyToString(new InputStreamReader(new ClassPathResource(TEMPLATE_PATH).getInputStream()));
        this.amazonCloudFormationClient.createStack(new CreateStackRequest().withTemplateBody(templateBody).withOnFailure(OnFailure.DELETE).
                withStackName(stackName).withTags(new Tag().withKey("tag1").withValue("value1")).
                withParameters(new Parameter().withParameterKey("RdsPassword").withParameterValue(this.rdsPassword)));
        this.stackCreatedByThisInstance = true;
    }

    return getStackResources(stackName);
}
项目:aws-ant-tasks    文件:TearDownCloudFormationTestsTask.java   
public void execute() {
    checkParams();
    AmazonEC2Client ec2Client = getOrCreateClient(AmazonEC2Client.class);
    ec2Client
            .deleteKeyPair(new DeleteKeyPairRequest().withKeyName(keyName));
    AmazonCloudFormationClient cloudFormationClient = getOrCreateClient(AmazonCloudFormationClient.class);
    cloudFormationClient.deleteStack(new DeleteStackRequest()
            .withStackName(stackName));
}
项目:cloudbreak    文件:AwsDeleteVpcTest.java   
@AfterSuite
@Parameters({ "regionName", "vpcStackName" })
public void deleteNetwork(String regionName, @Optional("it-vpc-stack") String vpcStackName) {
    AmazonCloudFormationClient client = new AmazonCloudFormationClient();
    client.setRegion(RegionUtils.getRegion(regionName));
    client.deleteStack(new DeleteStackRequest().withStackName(vpcStackName));
}
项目:cfnassist    文件:DeletesStacks.java   
private void requestDeletion(List<String> deletionList) {
    for(String stackName : deletionList) {
        DeleteStackRequest request = new DeleteStackRequest();
        request.setStackName(stackName);
        cfnClient.deleteStack(request);
        logger.info("Requested deletion of " + stackName);
    }
}
项目:aws-sam-gradle    文件:CloudformationService.java   
public void deleteStack(String stackName) {
    LOG.info("Delete stack '{}'", stackName);
    cloudFormation.deleteStack(new DeleteStackRequest().withStackName(stackName));
}
项目:spring-cloud-aws    文件:TestStackEnvironment.java   
@Override
public void destroy() throws Exception {
    if (this.stackCreatedByThisInstance) {
        this.amazonCloudFormationClient.deleteStack(new DeleteStackRequest().withStackName(DEFAULT_STACK_NAME));
    }
}
项目:jwrapper-maven-plugin    文件:CarrotCloudForm.java   
/**
 */
public Stack stackDelete() throws Exception {

    final DeleteStackRequest request = new DeleteStackRequest();

    request.withStackName(name);

    amazonClient.deleteStack(request);

    final Stack stack = waitForStackDelete();

    return stack;

}
项目:cerberus-lifecycle-cli    文件:CloudFormationService.java   
/**
 * Deletes an existing stack by name.
 *
 * @param stackId Stack ID.
 */
public void deleteStack(final String stackId) {
    final DeleteStackRequest request = new DeleteStackRequest().withStackName(stackId);
    cloudFormationClient.deleteStack(request);
}