Example usage for com.amazonaws.services.cloudformation.model GetTemplateRequest setStackName

List of usage examples for com.amazonaws.services.cloudformation.model GetTemplateRequest setStackName

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudformation.model GetTemplateRequest setStackName.

Prototype


public void setStackName(String stackName) 

Source Link

Document

The name or the unique stack ID that is associated with the stack, which are not always interchangeable:

  • Running stacks: You can specify either the stack's name or its unique stack ID.

    Usage

    From source file:com.cleanenergyexperts.aws.cf.CloudFormationMojo.java

    License:Apache License

    protected String getTemplateBody(AmazonCloudFormationClient cfClient, String stackName)
            throws MojoExecutionException {
        String templateBody = null;/*from   www  . ja  v a 2 s  . co  m*/
        try {
            GetTemplateRequest getTemplateRequest = new GetTemplateRequest();
            getTemplateRequest.setStackName(stackName);
            getLog().info("Getting Cloud Formation Stack Template...");
            GetTemplateResult getTemplateResult = cfClient.getTemplate(getTemplateRequest);
            if (getTemplateResult == null) {
                throw new MojoExecutionException("[NULL] Could Not Get Cloud Formation Stack Template");
            }
            templateBody = getTemplateResult.getTemplateBody();
        } catch (AmazonServiceException e) {
            throw new MojoExecutionException("[SERVICE] Could Not Get Cloud Formation Stack Template", e);
        } catch (AmazonClientException e) {
            throw new MojoExecutionException("[CLIENT] Could Not Get Cloud Formation Stack Template", e);
        }
        return templateBody;
    }