/** * Simplified method form for invoking the DescribeApplicationVersions operation. * * @see #describeApplicationVersionsAsync(DescribeApplicationVersionsRequest) */ @Override public java.util.concurrent.Future<DescribeApplicationVersionsResult> describeApplicationVersionsAsync() { return describeApplicationVersionsAsync(new DescribeApplicationVersionsRequest()); }
/** * <p> * Specify an application name to show only application versions for that application. * </p> * * @param applicationName * Specify an application name to show only application versions for that application. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeApplicationVersionsRequest withApplicationName(String applicationName) { setApplicationName(applicationName); return this; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getApplicationName() == null) ? 0 : getApplicationName().hashCode()); hashCode = prime * hashCode + ((getVersionLabels() == null) ? 0 : getVersionLabels().hashCode()); hashCode = prime * hashCode + ((getMaxRecords() == null) ? 0 : getMaxRecords().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; }
protected String lookupVersionLabelForCommitId(String commitId) throws Exception { String versionLabel = null; String prefixToLookup = format("git-%s-", commitId); DescribeApplicationVersionsResult describeApplicationVersions = getService().describeApplicationVersions(new DescribeApplicationVersionsRequest().withApplicationName(applicationName)); for (ApplicationVersionDescription avd : describeApplicationVersions.getApplicationVersions()) { if (avd.getVersionLabel().startsWith(prefixToLookup)) { versionLabel = avd.getVersionLabel(); break; } } return versionLabel; }
protected Object executeInternal() throws MojoExecutionException { DescribeApplicationVersionsRequest describeApplicationVersionsRequest = new DescribeApplicationVersionsRequest(); describeApplicationVersionsRequest.setApplicationName(applicationName); return getService().describeApplicationVersions(describeApplicationVersionsRequest); } }
private boolean versionLabelExists() { /* * Builds a request for this very specific version label */ DescribeApplicationVersionsRequest davRequest = new DescribeApplicationVersionsRequest().withApplicationName(applicationName).withVersionLabels(versionLabel); /* * Sends the request */ DescribeApplicationVersionsResult result = getService().describeApplicationVersions(davRequest); /* * Non-empty means the application version label *DOES* exist. */ return !result.getApplicationVersions().isEmpty(); } }
protected String lookupVersionLabel(String appName, String versionLabel) { if (StringUtils.isBlank(versionLabel)) { DescribeApplicationVersionsResult appVersionsResult = getService().describeApplicationVersions(new DescribeApplicationVersionsRequest().withApplicationName(appName));
public void deleteOldVersions(String applicationName) { DescribeApplicationVersionsRequest search = new DescribeApplicationVersionsRequest(); search.setApplicationName(applicationName); List<ApplicationVersionDescription> versions = elasticBeanstalk.describeApplicationVersions(search).getApplicationVersions(); List<ApplicationVersionDescription> versionsToRemove = versionsToRemove(versions); Set<String> deployedLabels = findDeployedLabels(applicationName); log.info("Removing {} oldest versions of total {} versions", versionsToRemove.size(), versions.size()); for (ApplicationVersionDescription version : versionsToRemove) { if (deployedLabels.contains(version.getVersionLabel())) { log.info("Not removing version {} because it is deployed", version.getVersionLabel()); } else { deleteApplicationVersion(version); } } }
@Override public DescribeApplicationVersionsResult describeApplicationVersions() { return describeApplicationVersions(new DescribeApplicationVersionsRequest()); }
@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.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)); }); } }
public void deleteOldVersions(String applicationName) { DescribeApplicationVersionsRequest search = new DescribeApplicationVersionsRequest(); search.setApplicationName(applicationName); List<ApplicationVersionDescription> versions = elasticBeanstalk.describeApplicationVersions(search).getApplicationVersions(); List<ApplicationVersionDescription> versionsToRemove = versionsToRemove(versions); Set<String> deployedLabels = findDeployedLabels(applicationName); log.info("Removing {} oldest versions of total {} versions", versionsToRemove.size(), versions.size()); for (ApplicationVersionDescription version : versionsToRemove) { if (deployedLabels.contains(version.getVersionLabel())) { log.info("Not removing version {} because it is deployed", version.getVersionLabel()); } else { deleteApplicationVersion(version); } } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeApplicationVersionsRequest == false) return false; DescribeApplicationVersionsRequest other = (DescribeApplicationVersionsRequest) obj; if (other.getApplicationName() == null ^ this.getApplicationName() == null) return false; if (other.getApplicationName() != null && other.getApplicationName().equals(this.getApplicationName()) == false) return false; if (other.getVersionLabels() == null ^ this.getVersionLabels() == null) return false; if (other.getVersionLabels() != null && other.getVersionLabels().equals(this.getVersionLabels()) == false) return false; if (other.getMaxRecords() == null ^ this.getMaxRecords() == null) return false; if (other.getMaxRecords() != null && other.getMaxRecords().equals(this.getMaxRecords()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; return true; }
/** * <p> * Specify an application name to show only application versions for that application. * </p> * * @param applicationName * Specify an application name to show only application versions for that application. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeApplicationVersionsRequest withApplicationName(String applicationName) { setApplicationName(applicationName); return this; }
/** * Simplified method form for invoking the DescribeApplicationVersions operation with an AsyncHandler. * * @see #describeApplicationVersionsAsync(DescribeApplicationVersionsRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<DescribeApplicationVersionsResult> describeApplicationVersionsAsync( com.amazonaws.handlers.AsyncHandler<DescribeApplicationVersionsRequest, DescribeApplicationVersionsResult> asyncHandler) { return describeApplicationVersionsAsync(new DescribeApplicationVersionsRequest(), asyncHandler); }
@Override protected Object executeInternal() throws MojoExecutionException, MojoFailureException { DescribeApplicationVersionsRequest describeApplicationVersionsRequest = new DescribeApplicationVersionsRequest().withApplicationName(applicationName);
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getApplicationName() != null) sb.append("ApplicationName: ").append(getApplicationName()).append(","); if (getVersionLabels() != null) sb.append("VersionLabels: ").append(getVersionLabels()).append(","); if (getMaxRecords() != null) sb.append("MaxRecords: ").append(getMaxRecords()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()); sb.append("}"); return sb.toString(); }
/** * Simplified method form for invoking the DescribeApplicationVersions operation. * * @see #describeApplicationVersionsAsync(DescribeApplicationVersionsRequest) */ @Override public java.util.concurrent.Future<DescribeApplicationVersionsResult> describeApplicationVersionsAsync() { return describeApplicationVersionsAsync(new DescribeApplicationVersionsRequest()); }
DescribeApplicationVersionsRequest describeApplicationVersionsRequest = new DescribeApplicationVersionsRequest().withApplicationName(applicationName);
request.setHttpMethod(HttpMethodName.POST); if (describeApplicationVersionsRequest.getApplicationName() != null) { request.addParameter("ApplicationName", StringUtils.fromString(describeApplicationVersionsRequest.getApplicationName())); if (!describeApplicationVersionsRequest.getVersionLabels().isEmpty() || !((com.amazonaws.internal.SdkInternalList<String>) describeApplicationVersionsRequest.getVersionLabels()).isAutoConstruct()) { com.amazonaws.internal.SdkInternalList<String> versionLabelsList = (com.amazonaws.internal.SdkInternalList<String>) describeApplicationVersionsRequest .getVersionLabels(); int versionLabelsListIndex = 1; if (describeApplicationVersionsRequest.getMaxRecords() != null) { request.addParameter("MaxRecords", StringUtils.fromInteger(describeApplicationVersionsRequest.getMaxRecords())); if (describeApplicationVersionsRequest.getNextToken() != null) { request.addParameter("NextToken", StringUtils.fromString(describeApplicationVersionsRequest.getNextToken()));
/** * Simplified method form for invoking the DescribeApplicationVersions operation with an AsyncHandler. * * @see #describeApplicationVersionsAsync(DescribeApplicationVersionsRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<DescribeApplicationVersionsResult> describeApplicationVersionsAsync( com.amazonaws.handlers.AsyncHandler<DescribeApplicationVersionsRequest, DescribeApplicationVersionsResult> asyncHandler) { return describeApplicationVersionsAsync(new DescribeApplicationVersionsRequest(), asyncHandler); }