Updated on 2024-04-29 GMT+08:00

Stopping a Cluster (To Be Taken Offline)

Function

This API is used to stop a cluster.

Calling Method

For details, see Calling APIs.

URI

POST /v1.1/{project_id}/clusters/{cluster_id}/action

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Project ID and Account ID.

cluster_id

Yes

String

Cluster ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

stop

Yes

stop object

Cluster stop operation. For details, see the descriptions of stop parameters.

Table 4 stop

Parameter

Mandatory

Type

Description

stopMode

Yes

String

Stop mode.

  • IMMEDIATELY: immediate stop

  • GRACEFULLY: graceful stop

Enumeration values:

  • IMMEDIATELY

  • GRACEFULLY

delayTime

No

Integer

Shutdown delay, in seconds. This parameter is valid only when stopMode is set to GRACEFULLY. If the value is -1, the system waits until all jobs are complete and stops accepting new jobs. If the value is greater than 0, the system stops the cluster after the specified delay and stops accepting new jobs.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

jobId

Array of strings

Job ID

Example Requests

Stopping a Cluster

POST /v1.1/1551c7f6c808414d8e9f3c514a170f2e/clusters/bae65496-643e-47ca-84af-948672de7eeb/action

{
  "stop" : {
    "stopMode" : "GRACEFULLY",
    "delayTime" : -1
  }
}

Example Responses

Status code: 200

ok

{
  "jobId" : [ "ff8080815e59d92d015e5b27ccb0004d" ]
}

Status Codes

Status Code

Description

200

ok

400

Request error.

401

Authentication failed.

403

You do not have required permissions to perform this operation.

404

The requested resource was not found.

500

An internal service error occurred. For details, see error codes.

503

Service unavailable.

Error Codes

See Error Codes.