Example usage for com.amazonaws.services.cloudformation.model StackResource setLogicalResourceId

List of usage examples for com.amazonaws.services.cloudformation.model StackResource setLogicalResourceId

Introduction

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

Prototype


public void setLogicalResourceId(String logicalResourceId) 

Source Link

Document

The logical name of the resource specified in the template.

Usage

From source file:com.deploymentio.cfnstacker.CloudFormationClient.java

License:Apache License

protected List<StackResource> getStackResources(String name, String nextToken) {

    ArrayList<StackResource> resources = new ArrayList<StackResource>();

    ListStackResourcesResult result = client
            .listStackResources(new ListStackResourcesRequest().withStackName(name).withNextToken(nextToken));
    for (StackResourceSummary summary : result.getStackResourceSummaries()) {
        StackResource resource = new StackResource();
        resource.setLogicalResourceId(summary.getLogicalResourceId());
        resource.setPhysicalResourceId(summary.getPhysicalResourceId());
        resource.setResourceType(summary.getResourceType());
        resource.setResourceStatus(summary.getResourceStatus());
        resource.setResourceStatusReason(summary.getResourceStatusReason());

        if ("AWS::CloudFormation::Stack".equals(resource.getResourceType())) {
            resources.add(resource);//w w w  . ja  v a 2 s.  c om
        }
    }

    // get more if results were truncated
    if (!StringUtils.isEmpty(result.getNextToken()))
        resources.addAll(getStackResources(name, result.getNextToken()));

    return resources;
}