Updated on 2022-08-12 GMT+08:00

Restarting or Deleting Instances in Batches

Function

This API is used to restart or delete instances in batches.

When an instance is being restarted, message retrieval and creation requests of the client will be rejected.

Deleting an instance will delete the data in the instance without any backup. Exercise caution when performing this operation.

URI

POST /v1.0/{project_id}/instances/action

Table 1 describes the parameters.

Table 1 Parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Project ID.

Request

Request parameters

Table 2 describes the parameters.

Table 2 Request parameters

Parameter

Type

Mandatory

Description

action

String

Yes

Operation to be performed on instances. The value of this parameter can be restart or delete.

instances

Array

No

List of instance IDs.

allFailure

String

No

When set to kafka, indicates all Kafka instances that fail to be created are to be deleted.

Example request

Restarting instances in batches:

{ 
    "action" : "restart", 
    "instances" : ["54602a9d-5e22-4239-9123-77e350df4a34", "7166cdea-dbad-4d79-9610-7163e6f8b640"] 
}

Deleting instances in batches:

{ 
    "action" : "delete", 
    "instances" : ["54602a9d-5e22-4239-9123-77e350df4a34", "7166cdea-dbad-4d79-9610-7163e6f8b640"] 
}

Deleting all instances that fail to be created:

{ 
    "action" : "delete", 
    "allFailure" : "kafka"
}

Response

Response parameters

When action is set to delete, allFailure is set to kafka, and an empty response is returned, the instances are deleted successfully. Table 3 describes the parameters.

Table 3 Response parameters

Parameter

Type

Description

results

Array

Result of instance modification.

Table 4 results parameter description

Parameter

Type

Description

instance

String

Instance ID.

result

String

Instance modification result. Options: success and failed.

Example response

{ 
    "results": [ 
        { 
            "result": "success", 
            "instance": "afc90a2a-a02c-4cba-94d5-58dfa9ad1e0d" 
        }, 
        { 
            "result": "success", 
            "instance": "67fc5f8d-3986-4f02-bb75-4075a23112de" 
        } 
    ] 
}

Status Code

Table 5 describes the status code of successful operations. For details about other status codes, see Status Code.

Table 5 Status code

Status Code

Description

200

The instances are restarted or deleted successfully.

204

Successfully deleting an instance failed to be created.