Example usage for com.amazonaws.services.opsworks.model Deployment getStackId

List of usage examples for com.amazonaws.services.opsworks.model Deployment getStackId

Introduction

In this page you can find the example usage for com.amazonaws.services.opsworks.model Deployment getStackId.

Prototype


public String getStackId() 

Source Link

Document

The stack ID.

Usage

From source file:com.tispr.aws.OpsWorksClient.java

License:Apache License

private Deployment getDeployment(String appId, String stackId, String deploymentId) {
    DescribeDeploymentsRequest describeReq = new DescribeDeploymentsRequest();
    describeReq.setDeploymentIds(Arrays.asList(deploymentId));

    DescribeDeploymentsResult describeRes = opsWorksClient.describeDeployments(describeReq);

    for (Deployment d : describeRes.getDeployments()) {
        if (d.getAppId().equals(appId) && d.getStackId().equals(stackId)) {
            return d;
        }/*from w  ww  .jav a2 s .c  om*/
    }

    throw new IllegalStateException(String.format(
            "Deployment [appId=%s], [stackId=%s], [deploymentId=%s] not found.", appId, stackId, deploymentId));
}