if (getStackId() != null) sb.append("StackId: ").append(getStackId()).append(","); if (getStackName() != null) sb.append("StackName: ").append(getStackName()).append(","); if (getChangeSetId() != null) sb.append("ChangeSetId: ").append(getChangeSetId()).append(",");
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStackId() == null) ? 0 : getStackId().hashCode()); hashCode = prime * hashCode + ((getStackName() == null) ? 0 : getStackName().hashCode()); hashCode = prime * hashCode + ((getChangeSetId() == null) ? 0 : getChangeSetId().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode()); hashCode = prime * hashCode + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode()); hashCode = prime * hashCode + ((getDeletionTime() == null) ? 0 : getDeletionTime().hashCode()); hashCode = prime * hashCode + ((getLastUpdatedTime() == null) ? 0 : getLastUpdatedTime().hashCode()); hashCode = prime * hashCode + ((getRollbackConfiguration() == null) ? 0 : getRollbackConfiguration().hashCode()); hashCode = prime * hashCode + ((getStackStatus() == null) ? 0 : getStackStatus().hashCode()); hashCode = prime * hashCode + ((getStackStatusReason() == null) ? 0 : getStackStatusReason().hashCode()); hashCode = prime * hashCode + ((getDisableRollback() == null) ? 0 : getDisableRollback().hashCode()); hashCode = prime * hashCode + ((getNotificationARNs() == null) ? 0 : getNotificationARNs().hashCode()); hashCode = prime * hashCode + ((getTimeoutInMinutes() == null) ? 0 : getTimeoutInMinutes().hashCode()); hashCode = prime * hashCode + ((getCapabilities() == null) ? 0 : getCapabilities().hashCode()); hashCode = prime * hashCode + ((getOutputs() == null) ? 0 : getOutputs().hashCode()); hashCode = prime * hashCode + ((getRoleARN() == null) ? 0 : getRoleARN().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getEnableTerminationProtection() == null) ? 0 : getEnableTerminationProtection().hashCode()); hashCode = prime * hashCode + ((getParentId() == null) ? 0 : getParentId().hashCode()); hashCode = prime * hashCode + ((getRootId() == null) ? 0 : getRootId().hashCode()); hashCode = prime * hashCode + ((getDriftInformation() == null) ? 0 : getDriftInformation().hashCode()); return hashCode; }
if (other.getStackId() != null && other.getStackId().equals(this.getStackId()) == false) return false; if (other.getStackName() == null ^ this.getStackName() == null) return false; if (other.getStackName() != null && other.getStackName().equals(this.getStackName()) == false) return false; if (other.getChangeSetId() == null ^ this.getChangeSetId() == null)
private Stack getStack(DescribeStacksResult result) { for (Stack aStack : result.getStacks()) { if (getExpandedStackName().equals(aStack.getStackName())) { return aStack; } } return null; }
public boolean stackExists(String stackName) { try { return describeStack(stackName).stream() // .peek(s -> logger.info("Found stack {}", s)) // .filter(s -> s.getStackName().equals(stackName)) // .anyMatch(s -> !s.getStackStatus().equals("REVIEW_IN_PROGRESS")); } catch (final AmazonCloudFormationException e) { if (e.getStatusCode() == 400) { logger.trace("Got exception {}", e.getMessage(), e); return false; } throw e; } }
stackAttributes.put("outputs", stack.getOutputs().stream().collect(Collectors.toMap(Output::getOutputKey, Output::getOutputValue))); stackAttributes.put("stackName", stack.getStackName()); stackAttributes.put("region", region); stackAttributes.put("accountName", account.getName()); DescribeStackEventsRequest request = new DescribeStackEventsRequest().withStackName(stack.getStackName()); cloudformation.describeStackEvents(request).getStackEvents() .stream()
if (getStackId() != null) sb.append("StackId: ").append(getStackId()).append(","); if (getStackName() != null) sb.append("StackName: ").append(getStackName()).append(","); if (getChangeSetId() != null) sb.append("ChangeSetId: ").append(getChangeSetId()).append(",");
public CloudFormationOutput getStackOutputs(AmazonCloudFormation stackbuilder, String stackName) { DescribeStacksRequest wait = new DescribeStacksRequest(); wait.setStackName(stackName); List<Stack> stacks = getCloudFormationClient().describeStacks(wait).getStacks(); CloudFormationOutput cloudFormationOutput = new CloudFormationOutput(); for (Stack stack : stacks) { if (stack.getStackName().equals(stackName)) { stack.getOutputs().forEach(output -> { if (output.getOutputKey().equals(LAMBDA_EXECUTION_IAM_RESOURCE_NAME)) { cloudFormationOutput.setLambdaExecutionRole(output.getOutputValue()); } if (output.getOutputKey().equals(LAMBDA_EXECUTION_NAME)) { cloudFormationOutput.setLambdaFunctionArn(output.getOutputValue()); } }); return cloudFormationOutput; } } throw new RuntimeException("Unknown Cloudformation error. Try deploying."); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStackId() == null) ? 0 : getStackId().hashCode()); hashCode = prime * hashCode + ((getStackName() == null) ? 0 : getStackName().hashCode()); hashCode = prime * hashCode + ((getChangeSetId() == null) ? 0 : getChangeSetId().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode()); hashCode = prime * hashCode + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode()); hashCode = prime * hashCode + ((getDeletionTime() == null) ? 0 : getDeletionTime().hashCode()); hashCode = prime * hashCode + ((getLastUpdatedTime() == null) ? 0 : getLastUpdatedTime().hashCode()); hashCode = prime * hashCode + ((getRollbackConfiguration() == null) ? 0 : getRollbackConfiguration().hashCode()); hashCode = prime * hashCode + ((getStackStatus() == null) ? 0 : getStackStatus().hashCode()); hashCode = prime * hashCode + ((getStackStatusReason() == null) ? 0 : getStackStatusReason().hashCode()); hashCode = prime * hashCode + ((getDisableRollback() == null) ? 0 : getDisableRollback().hashCode()); hashCode = prime * hashCode + ((getNotificationARNs() == null) ? 0 : getNotificationARNs().hashCode()); hashCode = prime * hashCode + ((getTimeoutInMinutes() == null) ? 0 : getTimeoutInMinutes().hashCode()); hashCode = prime * hashCode + ((getCapabilities() == null) ? 0 : getCapabilities().hashCode()); hashCode = prime * hashCode + ((getOutputs() == null) ? 0 : getOutputs().hashCode()); hashCode = prime * hashCode + ((getRoleARN() == null) ? 0 : getRoleARN().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getEnableTerminationProtection() == null) ? 0 : getEnableTerminationProtection().hashCode()); hashCode = prime * hashCode + ((getParentId() == null) ? 0 : getParentId().hashCode()); hashCode = prime * hashCode + ((getRootId() == null) ? 0 : getRootId().hashCode()); hashCode = prime * hashCode + ((getDriftInformation() == null) ? 0 : getDriftInformation().hashCode()); return hashCode; }
results.put(Outputs.RETURN_RESULT, stack.getStackName() + "[" + stack.getStackStatus() + "]" ); results.put(Outputs.STACK_NAME_RESULT, stack.getStackName()); results.put(Outputs.STACK_ID_RESULT,stack.getStackId()); results.put(Outputs.STACK_STATUS_RESULT,stack.getStackStatus()); results.put(Outputs.STACK_OUTPUTS_RESULT,stack.getOutputs().toString()); stackResourceRequest.setStackName(stack.getStackName()); results.put(Outputs.STACK_RESOURCES_RESULT,stackBuilder.describeStackResources(stackResourceRequest).getStackResources().toString());
listOfStacksResult.append(stack.getStackName() + Constants.Miscellaneous.COMMA_DELIMITER);
if (other.getStackId() != null && other.getStackId().equals(this.getStackId()) == false) return false; if (other.getStackName() == null ^ this.getStackName() == null) return false; if (other.getStackName() != null && other.getStackName().equals(this.getStackName()) == false) return false; if (other.getChangeSetId() == null ^ this.getChangeSetId() == null)
results.put(STACK_NAME, getStack(stacks).getStackName()); results.put(STACK_ID, getStack(stacks).getStackId()); results.put(STACK_OUTPUTS, stackOutputs);