Batch Deleting Pods
Function
This API is used to batch delete multiple pods of the same instance. It is used when pod resources that are no longer used need to be cleared or released. Before calling this API, ensure that you have the required deletion permission and provide a valid list of pod IDs. After the pod is deleted, the pod is completely removed and does not take effect for any service request. If the provided pod ID is invalid, the pod has been deleted, or the permission is insufficient, an error message is returned, prompting you to check the validity and permission of the input data.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
modelarts:service:deleteDeploymentPod
Write
service *
-
-
-
URI
POST /v2/{project_id}/services/{service_id}/deployments/{deployment_name}/instances/{instance_name}/pods/batch-delete
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID and Name. Constraints N/A Range Project ID. Default Value N/A |
| service_id | Yes | String | Definition Service ID, which can be obtained from the response body during service creation or by obtaining services owned by the current user. The id field is the service ID. Constraints N/A Range Service ID. Default Value N/A |
| deployment_name | Yes | String | Definition infer + deployment ID, which can be obtained from the response body during deployment creation. You can also obtain the deployments owned by the current user by obtaining service deployments. The id field indicates the deployment ID. Constraints N/A Range N/A Default Value N/A |
| instance_name | Yes | String | Definition Service instance name. The value can be all. In this case, all service instances are displayed. Constraints N/A Range Service instance name. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. It can be obtained by calling the IAM API for obtaining the user token. The value of X-Subject-Token in the response header is the user token. For details, see Obtaining a User Token Through Password Authentication. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| pod_ids | Yes | Array of strings | Definition IDs of pods to be batch deleted. Constraints 0 < Number of IDs ≤ 50 Range N/A Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| total | Integer | Definition Total number of deleted pods. Range [1, 50] |
| success_count | Integer | Definition Number of deleted pods. Range [0, 50] |
| failure_count | Integer | Definition Number of pods that fail to be deleted. Range [0, 50] |
| success_items | Array of BatchDeletePodSuccessItem objects | Definition IDs of the deleted pods. Range N/A |
| failure_items | Array of BatchDeletePodFailureItem objects | Definition IDs of the pods that fail to be deleted. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| pod_id | String | Definition IDs of deleted pods. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| pod_id | String | Definition ID of the pod that fails to be deleted. Range N/A |
| error_code | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error message. Range N/A |
Status code: 207
| Parameter | Type | Description |
|---|---|---|
| total | Integer | Definition Total number of deleted pods. Range [1, 50] |
| success_count | Integer | Definition Number of deleted pods. Range [0, 50] |
| failure_count | Integer | Definition Number of pods that fail to be deleted. Range [0, 50] |
| success_items | Array of BatchDeletePodSuccessItem objects | Definition IDs of the deleted pods. Range N/A |
| failure_items | Array of BatchDeletePodFailureItem objects | Definition IDs of the pods that fail to be deleted. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| pod_id | String | Definition IDs of deleted pods. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| pod_id | String | Definition ID of the pod that fails to be deleted. Range N/A |
| error_code | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error message. Range N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Range: N/A. |
| error_msg | String | Definition: Error message. Range: N/A. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Range: N/A. |
| error_msg | String | Definition: Error message. Range: N/A. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Range: N/A. |
| error_msg | String | Definition: Error message. Range: N/A. |
Status code: 404
Example Requests
Delete two pods under a specified instance.
POST https://{endpoint}/v2/{project_id}/services/{service_id}/deployments/{deployment_name}/instances/{instance_name}/pods/batch-delete
{
"pod_ids" : [ "dc07b311-68c6-42a3-93e4-e2277a22f9b3", "b20cb724-7ac0-4e99-b32f-6a43f0e59887" ]
} Example Responses
Status code: 200
{
"failure_count" : 0,
"failure_items" : [ ],
"success_count" : 2,
"success_items" : [ {
"pod_id" : "dc07b311-68c6-42a3-93e4-e2277a22f9b3"
}, {
"pod_id" : "b20cb724-7ac0-4e99-b32f-6a43f0e59887"
} ],
"total" : 2
} Status code: 207
{
"failure_count" : 2,
"failure_items" : [ {
"error_code" : "ModelArts.8240",
"error_msg" : "Failed to delete the pod. The pod has already been deleted.",
"pod_id" : "354566e3-4e50-4d14-8682-3c0354788c17"
}, {
"error_code" : "ModelArts.8240",
"error_msg" : "Failed to delete the pod. Pod not found.",
"pod_id" : "100bfe1a-59f9-4d52-b6ac-de5ee00ac2201"
} ],
"success_count" : 1,
"success_items" : [ {
"pod_id" : "dc07b311-68c6-42a3-93e4-e2277a22f9b3"
} ],
"total" : 3
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Successful deletion response. |
| 207 | Partial deletion failure response. |
| 400 | Invalid request parameters. |
| 401 | Authentication failed. |
| 403 | Insufficient permissions. |
| 404 | Resource not found. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot