Search in sources :

Example 1 with TerminateEnvironmentResult

use of com.amazonaws.services.elasticbeanstalk.model.TerminateEnvironmentResult in project Synapse-Stack-Builder by Sage-Bionetworks.

the class ElasticBeanstalkSetup method terminateEnvironment.

/**
 * Delete a single environment
 */
public void terminateEnvironment(String servicePrefix) {
    final String environmentName = config.getEnvironmentName(servicePrefix);
    final String environmentCName = config.getEnvironmentCNAMEPrefix(servicePrefix);
    EnvironmentDescription environment = describeEnvironment(environmentName);
    if (environment == null) {
        // Nothing to do except logger
        logger.debug(String.format("Environment name: '%1$s' does not exist!!!", environmentName, environmentCName));
    } else {
        // Delete environment
        logger.debug(String.format("Terminating environment name: '%1$s' with CNAME: '%2$s' ", environmentName, environmentCName));
        String environmentId = environment.getEnvironmentId();
        TerminateEnvironmentRequest ter = new TerminateEnvironmentRequest().withEnvironmentId(environmentId).withTerminateResources(Boolean.TRUE);
        TerminateEnvironmentResult terminateResult = beanstalkClient.terminateEnvironment(ter);
    }
}
Also used : TerminateEnvironmentRequest(com.amazonaws.services.elasticbeanstalk.model.TerminateEnvironmentRequest) TerminateEnvironmentResult(com.amazonaws.services.elasticbeanstalk.model.TerminateEnvironmentResult) EnvironmentDescription(com.amazonaws.services.elasticbeanstalk.model.EnvironmentDescription)

Aggregations

EnvironmentDescription (com.amazonaws.services.elasticbeanstalk.model.EnvironmentDescription)1 TerminateEnvironmentRequest (com.amazonaws.services.elasticbeanstalk.model.TerminateEnvironmentRequest)1 TerminateEnvironmentResult (com.amazonaws.services.elasticbeanstalk.model.TerminateEnvironmentResult)1