Example usage for com.amazonaws.services.elasticbeanstalk.model DeleteApplicationVersionRequest DeleteApplicationVersionRequest

List of usage examples for com.amazonaws.services.elasticbeanstalk.model DeleteApplicationVersionRequest DeleteApplicationVersionRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.elasticbeanstalk.model DeleteApplicationVersionRequest DeleteApplicationVersionRequest.

Prototype

public DeleteApplicationVersionRequest() 

Source Link

Document

Default constructor for DeleteApplicationVersionRequest object.

Usage

From source file:br.com.ingenieux.mojo.beanstalk.version.CleanPreviousVersionsMojo.java

License:Apache License

void deleteVersion(ApplicationVersionDescription versionToRemove) {
    getLog().info("Must delete version: " + versionToRemove.getVersionLabel());

    DeleteApplicationVersionRequest req = new DeleteApplicationVersionRequest()
            .withApplicationName(versionToRemove.getApplicationName())//
            .withDeleteSourceBundle(deleteSourceBundle)//
            .withVersionLabel(versionToRemove.getVersionLabel());

    if (!dryRun) {
        getService().deleteApplicationVersion(req);
        deletedVersionsCount++;/*from   w w  w . j  av  a  2  s  .co m*/
    }
}

From source file:br.com.ingenieux.mojo.beanstalk.version.DeleteApplicationVersionMojo.java

License:Apache License

@Override
protected Object executeInternal() throws MojoExecutionException, MojoFailureException {
    DeleteApplicationVersionRequest req = new DeleteApplicationVersionRequest();

    req.setApplicationName(applicationName);
    req.setDeleteSourceBundle(deleteSourceBundle);
    req.setVersionLabel(versionLabel);//from w  w  w  .j a  va  2 s . c om

    getService().deleteApplicationVersion(req);

    return null;
}

From source file:jp.classmethod.aws.gradle.elasticbeanstalk.AWSElasticBeanstalkCleanupApplicationVersionTask.java

License:Apache License

@TaskAction
public void deleteVersion() {
    // to enable conventionMappings feature
    String appName = getAppName();
    boolean deleteSourceBundle = isDeleteSourceBundle();

    AwsBeanstalkPluginExtension ext = getProject().getExtensions().getByType(AwsBeanstalkPluginExtension.class);
    AWSElasticBeanstalk eb = ext.getClient();

    DescribeEnvironmentsResult der = eb/*from   w  ww . j a  va 2s  . co  m*/
            .describeEnvironments(new DescribeEnvironmentsRequest().withApplicationName(appName));
    List<String> usingVersions = der.getEnvironments().stream().map(ed -> ed.getVersionLabel())
            .collect(Collectors.toList());

    DescribeApplicationVersionsResult davr = eb
            .describeApplicationVersions(new DescribeApplicationVersionsRequest().withApplicationName(appName));
    List<String> versionLabelsToDelete = davr.getApplicationVersions().stream()
            .filter(avd -> usingVersions.contains(avd.getVersionLabel()) == false
                    && avd.getVersionLabel().contains("-SNAPSHOT-"))
            .map(avd -> avd.getVersionLabel()).collect(Collectors.toList());

    versionLabelsToDelete.forEach(versionLabel -> {
        getLogger().info("version " + versionLabel + " deleted");
        eb.deleteApplicationVersion(new DeleteApplicationVersionRequest().withApplicationName(appName)
                .withVersionLabel(versionLabel).withDeleteSourceBundle(deleteSourceBundle));
    });
}

From source file:jp.classmethod.aws.gradle.elasticbeanstalk.AWSElasticBeanstalkDeleteApplicationVersionTask.java

License:Apache License

@TaskAction
public void deleteVersion() {
    // to enable conventionMappings feature
    String applicationName = getApplicationName();
    String versionLabel = getVersionLabel();
    boolean deleteSourceBundle = isDeleteSourceBundle();

    AwsBeanstalkPluginExtension ext = getProject().getExtensions().getByType(AwsBeanstalkPluginExtension.class);
    AWSElasticBeanstalk eb = ext.getClient();

    eb.deleteApplicationVersion(new DeleteApplicationVersionRequest().withApplicationName(applicationName)
            .withVersionLabel(versionLabel).withDeleteSourceBundle(deleteSourceBundle));
    getLogger().info("version " + versionLabel + " deleted");
}