/** * Updates an existing stack by name. * * @param stackId Stack ID. * @param parameters Input parameters. * @param templatePath Path to the JSON template of the stack. */ public void updateStack(final String stackId, final Map<String, String> parameters, final String templatePath, final boolean iamCapabilities) { final UpdateStackRequest request = new UpdateStackRequest() .withStackName(stackId) .withParameters(convertParameters(parameters)); if (StringUtils.isNotBlank(templatePath)) { request.withTemplateBody(getTemplateText(templatePath)); } else { request.withUsePreviousTemplate(true); } if (iamCapabilities) { request.getCapabilities().add("CAPABILITY_IAM"); } cloudFormationClient.updateStack(request); }
public void execute() { checkParams(); AmazonCloudFormationClient client = getOrCreateClient(AmazonCloudFormationClient.class); UpdateStackRequest request = new UpdateStackRequest() .withStackName(stackName).withStackPolicyBody(stackPolicyBody) .withStackPolicyURL(stackPolicyURL) .withTemplateBody(templateBody).withTemplateURL(templateURL) .withStackPolicyDuringUpdateBody(stackPolicyDuringUpdateBody) .withStackPolicyDuringUpdateURL(stackPolicyDuringUpdateURL) .withUsePreviousTemplate(usePreviousTemplate); if (capabilities.size() > 0) { request.setCapabilities(capabilities); } if (parameters.size() > 0) { request.setParameters(parameters); } if (notificationArns.size() > 0) { request.setNotificationARNs(notificationArns); } try { client.updateStack(request); System.out.println("Update stack " + stackName + " request submitted."); } catch (Exception e) { throw new BuildException("Could not update stack: " + e.getMessage(), e); } }
@Override public void addMonitoringTo(UpdateStackRequest updateStackRequest) throws NotReadyException { // does nothing in this implementation }
@Override public void addMonitoringTo(UpdateStackRequest updateStackRequest) throws NotReadyException { Collection<String> arns = getArns(); updateStackRequest.setNotificationARNs(arns); }
public Stack stackUpdate() throws Exception { final UpdateStackRequest request = new UpdateStackRequest(); request.withStackName(name); request.withParameters(paramList); request.withTemplateBody(template); amazonClient.updateStack(request); final Stack stack = waitForStackUpdate(); return stack; }
void addMonitoringTo(UpdateStackRequest updateStackRequest) throws NotReadyException;