Java Examples for com.amazonaws.services.cloudformation.model.UpdateStackRequest

The following java examples will help you to understand the usage of com.amazonaws.services.cloudformation.model.UpdateStackRequest. These source code samples are taken from different open source projects.

Example 1
Project: xmlsh-master  File: cfnUpdateStack.java View source code
private int updateStack(List<XValue> args, Options opts) throws IOException, XMLStreamException, SaxonApiException, CoreException {
    OutputPort stdout = getStdout();
    mWriter = new SafeXMLStreamWriter(stdout.asXMLStreamWriter(getSerializeOpts()));
    startDocument();
    startElement(getName());
    UpdateStackRequest request = new UpdateStackRequest();
    if (opts.hasOpt("capability"))
        request.setCapabilities(Util.toStringList(opts.getOptValues("capability")));
    request.setStackName(opts.getOptStringRequired("name"));
    if (opts.hasOpt("template-file"))
        request.setTemplateBody(Util.readString(mShell.getFile(opts.getOptValue("template-file")), getSerializeOpts().getInput_text_encoding()));
    else
        request.setTemplateURL(opts.getOptStringRequired("template-url"));
    request.setParameters(getParameters(args));
    traceCall("updateStack");
    UpdateStackResult result = getAWSClient().updateStack(request);
    writeStackResult(result);
    endElement();
    endDocument();
    closeWriter();
    stdout.writeSequenceTerminator(getSerializeOpts());
    return 0;
}
Example 2
Project: beanstalker-master  File: PushStackMojo.java View source code
private UpdateStackResult updateStack() throws Exception {
    UpdateStackRequest req = new UpdateStackRequest().withStackName(stackName).withCapabilities(Capability.CAPABILITY_IAM);
    if (null != this.destinationS3Uri) {
        req.withTemplateURL(generateExternalUrl(this.destinationS3Uri));
    } else {
        req.withTemplateBody(templateBody);
    }
    req.withNotificationARNs(notificationArns);
    req.withParameters(parameters);
    req.withResourceTypes(resourceTypes);
    req.withTags(tags);
    try {
        return getService().updateStack(req);
    } catch (AmazonServiceException exc) {
        if ("No updates are to be performed.".equals(exc.getErrorMessage())) {
            return null;
        }
        throw exc;
    }
}
Example 3
Project: aws-toolkit-eclipse-master  File: CreateStackWizard.java View source code
private UpdateStackRequest createUpdateStackRequest(CreateStackRequest createStackRequest) {
    UpdateStackRequest rq = new UpdateStackRequest();
    rq.setStackName(createStackRequest.getStackName());
    rq.setCapabilities(createStackRequest.getCapabilities());
    rq.setParameters(createStackRequest.getParameters());
    rq.setTemplateBody(createStackRequest.getTemplateBody());
    rq.setTemplateURL(createStackRequest.getTemplateURL());
    return rq;
}
Example 4
Project: gradle-aws-plugin-master  File: AmazonCloudFormationMigrateStackTask.java View source code
private void updateStack(AmazonCloudFormation cfn) throws IOException {
    // to enable conventionMappings feature
    String stackName = getStackName();
    String cfnTemplateUrl = getCfnTemplateUrl();
    File cfnTemplateFile = getCfnTemplateFile();
    List<Parameter> cfnStackParams = getCfnStackParams();
    List<Tag> cfnStackTags = getCfnStackTags();
    String cfnStackPolicyUrl = getCfnStackPolicyUrl();
    File cfnStackPolicyFile = getCfnStackPolicyFile();
    getLogger().info("Update stack: {}", stackName);
    UpdateStackRequest req = new UpdateStackRequest().withStackName(stackName).withParameters(cfnStackParams).withTags(cfnStackTags);
    // If template URL is specified, then use it
    if (Strings.isNullOrEmpty(cfnTemplateUrl) == false) {
        req.setTemplateURL(cfnTemplateUrl);
        getLogger().info("Using template url: {}", cfnTemplateUrl);
    // Else, use the template file body
    } else {
        req.setTemplateBody(FileUtils.readFileToString(cfnTemplateFile));
        getLogger().info("Using template file: {}", "$cfnTemplateFile.canonicalPath");
    }
    if (isCapabilityIam()) {
        Capability selectedCapability = (getUseCapabilityIam() == null) ? Capability.CAPABILITY_IAM : getUseCapabilityIam();
        getLogger().info("Using IAM capability: " + selectedCapability);
        req.setCapabilities(Arrays.asList(selectedCapability.toString()));
    }
    // If stack policy is specified, then use it
    if (Strings.isNullOrEmpty(cfnStackPolicyUrl) == false) {
        req.setStackPolicyURL(cfnStackPolicyUrl);
    // Else, use the stack policy file body if present
    } else if (cfnStackPolicyFile != null) {
        req.setStackPolicyBody(FileUtils.readFileToString(cfnStackPolicyFile));
    }
    UpdateStackResult updateStackResult = cfn.updateStack(req);
    getLogger().info("Update requested: {}", updateStackResult.getStackId());
}
Example 5
Project: xmlsh1_3-master  File: cfnUpdateStack.java View source code
private int updateStack(List<XValue> args, Options opts) throws IOException, XMLStreamException, SaxonApiException, CoreException {
    OutputPort stdout = getStdout();
    mWriter = new SafeXMLStreamWriter(stdout.asXMLStreamWriter(getSerializeOpts()));
    startDocument();
    startElement(getName());
    UpdateStackRequest request = new UpdateStackRequest();
    if (opts.hasOpt("capability"))
        request.setCapabilities(Util.toStringList(opts.getOptValues("capability")));
    request.setStackName(opts.getOptStringRequired("name"));
    if (opts.hasOpt("template-file"))
        request.setTemplateBody(Util.readString(mShell.getFile(opts.getOptValue("template-file")), getSerializeOpts().getInput_text_encoding()));
    else
        request.setTemplateURL(opts.getOptStringRequired("template-url"));
    request.setParameters(getParameters(args));
    traceCall("updateStack");
    UpdateStackResult result = mAmazon.updateStack(request);
    writeStackResult(result);
    endElement();
    endDocument();
    closeWriter();
    stdout.writeSequenceTerminator(getSerializeOpts());
    stdout.release();
    return 0;
}
Example 6
Project: cfnassist-master  File: PollingStackMonitor.java View source code
@Override
public void addMonitoringTo(UpdateStackRequest updateStackRequest) throws NotReadyException {
// does nothing in this implementation	
}