All Products
Search
Document Center

Batch Compute:getClusterInstance

Last Updated:May 11, 2018

Method description

Obtains information about a cluster instance.

Parameter description

Parameter Type Description
clusterId String Cluster ID
groupName String Name of an instance group
id String Cluster instance ID

Response description

  • If the call succeeds, a GetClusterInstanceResponse instance is returned. You can use the getClusterInstance() method of this instance to obtain the ClusterInstance object.

  • If a failure occurs, a ClientException is thrown.

Sample code

  1. try{
  2. String clusterId = "cls-6vilcufsfd31i010";
  3. String groupName = "group1";
  4. String id = "ins-xxxxxxxx";
  5. GetClusterInstanceResponse response = client.getClusterInstance(clusterId,groupName,id);
  6. //Succeeded
  7. ClusterInstance clusterInstance = response.getClusterInstance();
  8. String state = clusterInstance.getState();
  9. //assertEquals('Pending', state); //Pending, Starting, Running, Deleting, Deleted
  10. }catch(ClientException e){
  11. e.printStackTrace();
  12. // Failed
  13. }