All Products
Search
Document Center

getCluster

Last Updated: May 11, 2018

Method description

Obtains information about a cluster by a specified cluster ID.

Parameter description

Parameter Type Description
clusterId String Cluster ID

Response description

  • If the call succeeds, a GetClusterResponse instance is returned. You can use the getCluster() information of this instance to obtain the Cluster object.

  • If a failure occurs, a ClientException is thrown.

Sample code

  1. try{
  2. GetClusterResponse response = client.getCluster("cls-6vilcufsfd31i010");
  3. //Succeeded
  4. Cluster cluster = response.getCluster();
  5. String state = cluster.getState();
  6. //assertEquals('Active', state); //Cluster stateOptional values include Active and Deleting.
  7. }catch(ClientException e){
  8. e.printStackTrace();
  9. // Failed
  10. }