/** * <p> * The app stack ID. If you use this parameter, <code>DescribeApps</code> returns a description of the apps in the * specified stack. * </p> * * @param stackId * The app stack ID. If you use this parameter, <code>DescribeApps</code> returns a description of the apps * in the specified stack. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeAppsRequest withStackId(String stackId) { setStackId(stackId); return this; }
/** * <p> * The app stack ID. If you use this parameter, <code>DescribeApps</code> returns a description of the apps in the * specified stack. * </p> * * @param stackId * The app stack ID. If you use this parameter, <code>DescribeApps</code> returns a description of the apps * in the specified stack. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeAppsRequest withStackId(String stackId) { setStackId(stackId); return this; }
AWSOpsWorksClient opsClient = new AWSOpsWorksClient(awsCredentials); //To get Layer Id DescribeLayersRequest layerRequest = new DescribeLayersRequest(); layerRequest.setStackId(stackId); //This will return the Layers, and then we can get id from the Layer. DescribeLayersResult layerResult = opsClient.describeLayers(layerRequest); //To get App Id DescribeAppsRequest appsRequest = new DescribeAppsRequest(); appsRequest.setStackId(stackId); //This will return the Apps from that we can get App id. DescribeAppsResult appsResult = opsClient.describeApps(appsRequest); //To get Instance ids DescribeInstancesRequest instanceRequest = new DescribeInstancesRequest(); instanceRequest.setStackId(stackId); instanceRequest.setLayerId(layer.getLayerId()); //This will return the List of Instance, from that we can get the instance id. DescribeInstancesResult instanceResult = opsClient.describeInstances(instanceRequest);