Start or Terminate a Cluster on Google Cloud Platform¶
-
PUT
/api/v2/clusters/<cluster-id/cluster-label>/state
¶
Use this API to start or terminate a cluster.
Required Role¶
The following users can make this API call:
- Users who belong to the system-admin or system-user group.
- Users who belong to a group associated with a role that allows start/stop operations on a cluster. See Managing Groups and Managing Roles for more information.
Parameters¶
Note
Parameters marked in bold below are mandatory. Others are optional and have default values.
Parameter | Description |
---|---|
state | It is used to state the action to perform. Its valid values are start to start
a cluster and terminate to terminate it. Starting a running cluster or stopping a
terminated cluster will have no effect. |
Request API Syntax¶
Here is the request API syntax to start/terminate a cluster.
curl -X PUT -H "X-AUTH-TOKEN:$X_AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"state":"<start/terminate>"}' \ "https://gcp.qubole.com/api/v2/clusters/<cluster ID/cluster label>/state"
Sample API Requests¶
Here are sample requests to start and terminate a cluster with 200 as its ID.
Start a Cluster¶
curl -X PUT -H "X-AUTH-TOKEN:$X_AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"state":"start"}' \ "https://gcp.qubole.com/api/v2/clusters/200/state"
Terminate a Running Cluster¶
curl -X PUT -H "X-AUTH-TOKEN:$X_AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"state":"terminate"}' \ "https://gcp.qubole.com/api/v2/clusters/200/state"