@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getEnvironments() == null) ? 0 : getEnvironments().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; }
public DescribeEnvironmentsResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeEnvironmentsResult describeEnvironmentsResult = new DescribeEnvironmentsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeEnvironmentsResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Environments", targetDepth)) { describeEnvironmentsResult.withEnvironments(new ArrayList<EnvironmentDescription>()); continue; } if (context.testExpression("Environments/member", targetDepth)) { describeEnvironmentsResult.withEnvironments(EnvironmentDescriptionStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("NextToken", targetDepth)) { describeEnvironmentsResult.setNextToken(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeEnvironmentsResult; } } } }
/** * <p> * Returns an <a>EnvironmentDescription</a> list. * </p> * * @param environments * Returns an <a>EnvironmentDescription</a> list. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeEnvironmentsResult withEnvironments(java.util.Collection<EnvironmentDescription> environments) { setEnvironments(environments); return this; }
public static Optional<EnvironmentDescription> describe(AWSElasticBeanstalk client, String awsAppName, String environment) { return client.describeEnvironments(new DescribeEnvironmentsRequest() .withApplicationName(awsAppName) .withEnvironmentNames(Collections.singletonList(environment))) .getEnvironments().stream().findFirst(); } }
/** * <p> * In a paginated request, the token that you can pass in a subsequent request to get the next response page. * </p> * * @param nextToken * In a paginated request, the token that you can pass in a subsequent request to get the next response page. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeEnvironmentsResult withNextToken(String nextToken) { setNextToken(nextToken); return this; }
if (describeEnvironmentsResult.getEnvironments().size() > 1) { List<String> environmentIds = Lists.newArrayList(); Integer size = describeEnvironmentsResult.getEnvironments().size(); for (Integer i = 0; i < size; i++) { environmentIds.add(describeEnvironmentsResult.getEnvironments().get(i).getEnvironmentId()); if (describeEnvironmentsResult.getEnvironments().size() == 1) { String environmentId = describeEnvironmentsResult.getEnvironments().get(0).getEnvironmentId(); return FormValidation.ok("Environment found (environmentId: %s)", environmentId);
/** * <p> * In a paginated request, the token that you can pass in a subsequent request to get the next response page. * </p> * * @param nextToken * In a paginated request, the token that you can pass in a subsequent request to get the next response page. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeEnvironmentsResult withNextToken(String nextToken) { setNextToken(nextToken); return this; }
private Set<String> findDeployedLabels(String applicationName) { DescribeEnvironmentsRequest req = new DescribeEnvironmentsRequest(); req.setApplicationName(applicationName); Set<String> result = new TreeSet<String>(); for (EnvironmentDescription description : elasticBeanstalk.describeEnvironments(req).getEnvironments()) { if (description.getVersionLabel() != null) { // Ignore null value (for example when environment is launching) result.add(description.getVersionLabel()); } } return result; } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeEnvironmentsResult == false) return false; DescribeEnvironmentsResult other = (DescribeEnvironmentsResult) obj; if (other.getEnvironments() == null ^ this.getEnvironments() == null) return false; if (other.getEnvironments() != null && other.getEnvironments().equals(this.getEnvironments()) == 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; }
public DescribeEnvironmentsResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeEnvironmentsResult describeEnvironmentsResult = new DescribeEnvironmentsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeEnvironmentsResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Environments", targetDepth)) { describeEnvironmentsResult.withEnvironments(new ArrayList<EnvironmentDescription>()); continue; } if (context.testExpression("Environments/member", targetDepth)) { describeEnvironmentsResult.withEnvironments(EnvironmentDescriptionStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("NextToken", targetDepth)) { describeEnvironmentsResult.setNextToken(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeEnvironmentsResult; } } } }
/** * <p> * Returns an <a>EnvironmentDescription</a> list. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setEnvironments(java.util.Collection)} or {@link #withEnvironments(java.util.Collection)} if you want to * override the existing values. * </p> * * @param environments * Returns an <a>EnvironmentDescription</a> list. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeEnvironmentsResult withEnvironments(EnvironmentDescription... environments) { if (this.environments == null) { setEnvironments(new com.amazonaws.internal.SdkInternalList<EnvironmentDescription>(environments.length)); } for (EnvironmentDescription ele : environments) { this.environments.add(ele); } return this; }
private Set<String> findDeployedLabels(String applicationName) { DescribeEnvironmentsRequest req = new DescribeEnvironmentsRequest(); req.setApplicationName(applicationName); Set<String> result = new TreeSet<String>(); for (EnvironmentDescription description : elasticBeanstalk.describeEnvironments(req).getEnvironments()) { if (description.getVersionLabel() != null) { // Ignore null value (for example when environment is launching) result.add(description.getVersionLabel()); } } return result; } }
/** * 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 (getEnvironments() != null) sb.append("Environments: ").append(getEnvironments()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()); sb.append("}"); return sb.toString(); }
/** * <p> * Returns an <a>EnvironmentDescription</a> list. * </p> * * @param environments * Returns an <a>EnvironmentDescription</a> list. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeEnvironmentsResult withEnvironments(java.util.Collection<EnvironmentDescription> environments) { setEnvironments(environments); return this; }
@Override protected Object executeInternal() throws MojoExecutionException, MojoFailureException { DescribeEnvironmentsRequest req = new DescribeEnvironmentsRequest(); req.setApplicationName(applicationName); req.setIncludeDeleted(includeDeleted); // TODO add environmentNames / environmentIds / includeDeletedBackTo DescribeEnvironmentsResult result = getService().describeEnvironments(req); if (null != outputFile) { getLog().info("Writing results into " + outputFile.getName()); try { ObjectMapper objectMapper = new ObjectMapper(); ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter(); writer.writeValue(outputFile, result.getEnvironments()); } catch (Exception e) { throw new RuntimeException(e); } return null; } return result; } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getEnvironments() == null) ? 0 : getEnvironments().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; }
/** * <p> * Returns an <a>EnvironmentDescription</a> list. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setEnvironments(java.util.Collection)} or {@link #withEnvironments(java.util.Collection)} if you want to * override the existing values. * </p> * * @param environments * Returns an <a>EnvironmentDescription</a> list. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeEnvironmentsResult withEnvironments(EnvironmentDescription... environments) { if (this.environments == null) { setEnvironments(new com.amazonaws.internal.SdkInternalList<EnvironmentDescription>(environments.length)); } for (EnvironmentDescription ele : environments) { this.environments.add(ele); } return this; }
public List<EnvironmentDescription> getEnvironmentDescs(List<String> environmentNames) { DescribeEnvironmentsRequest req = new DescribeEnvironmentsRequest().withApplicationName(appName); if (environmentNames.isEmpty() == false) { req.setEnvironmentNames(environmentNames); } DescribeEnvironmentsResult der = getClient().describeEnvironments(req); return der.getEnvironments(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeEnvironmentsResult == false) return false; DescribeEnvironmentsResult other = (DescribeEnvironmentsResult) obj; if (other.getEnvironments() == null ^ this.getEnvironments() == null) return false; if (other.getEnvironments() != null && other.getEnvironments().equals(this.getEnvironments()) == 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; }
private EnvironmentDescription lookupEnvironmentIds(List<String> environmentNames) throws InvalidEnvironmentsSizeException, InvalidDeploymentTypeException { DescribeEnvironmentsResult environments = getAwseb() .describeEnvironments(new DescribeEnvironmentsRequest() .withApplicationName(c.config.getApplicationName()) .withIncludeDeleted(false)); for (EnvironmentDescription env : environments.getEnvironments()) { if (environmentNames.contains(env.getEnvironmentName())) { if (WORKER_ENVIRONMENT_TYPE.equals(env.getTier().getName())) { throw new InvalidDeploymentTypeException(); } return env; } } throw new InvalidEnvironmentsSizeException(c.config.getApplicationName(), environmentNames.get(0), environments.getEnvironments().size()); }