Querying the Resource List Associated with the Current Task
Function
This API is used to query the resource list associated with the current task.
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, no identity policy-based permission required for calling this API.
URI
POST /v5/{project_id}/common/tasks/{task_id}/resources/batch-query
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID, which is used to specify the project that an asset belongs to. After the project ID is configured, you can query assets in the project using the project ID. For details about how to obtain it, see Obtaining a Project ID. Constraints N/A Range The value can contain 1 to 256 characters. Default Value N/A |
| task_id | Yes | String | Task ID. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| enterprise_project_id | No | String | Definition Enterprise project ID, which is used to filter assets in different enterprise projects. For details, see Obtaining an Enterprise Project ID. To query assets in all enterprise projects, set this parameter to all_granted_eps. Constraints You need to set this parameter only after the enterprise project function is enabled. Range The value can contain 1 to 256 characters. Default Value 0: default enterprise project. |
| offset | No | Integer | Definition Offset, which specifies the start position of the record to be returned. Constraints N/A Range The value range is 0 to 2,000,000. Default Value The default value is 0. |
| limit | No | Integer | Definition Number of records displayed on each page. Constraints N/A Range Value range: 10-200 Default Value 10 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token, which contains user identity and permissions. The token can be used for identity authentication when an API is called. For details about how to obtain the token, see Obtaining a User Token. Constraints N/A Range The value can contain 1 to 32,768 characters. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| task_type | Yes | String | Task type. The options are as follows: |
| cluster_scan_info | No | cluster_scan_info object | Search criteria specific to cluster scan tasks. This parameter is available only when the task type is cluster_scan. |
| iac_scan_info | No | iac_scan_info object | Query criteria specific to IAC security scanning tasks. These criteria are available only when the task type is iac_scan. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| total_num | Integer | Number of resources associated with a task. |
| cluster_scan_data_list | Array of cluster_scan_data_list objects | List of cluster scan details associated with the task. The query result is the list when the task type is cluster_scan. |
| iac_scan_data_list | Array of iac_scan_data_list objects | List of file scan details associated with the task. The list is displayed when the task type is iac_scan. |
| Parameter | Type | Description |
|---|---|---|
| cluster_name | String | Cluster name |
| cluster_id | String | Cluster ID |
| cluster_type | String | Cluster type. The options are as follows: |
| cluster_version | String | Version |
| scan_status | String | Cluster scanning status. The options are as follows: |
| start_time | Long | Time when the cluster scan started. |
| end_time | Long | Time when the cluster scan ended. |
| scan_detail_list | Array of scan_detail_list objects | Scan details of the current cluster |
| Parameter | Type | Description |
|---|---|---|
| scan_type | String | Scan item type. The options are as follows: |
| status | String | Scanning status. The options are as follows: |
| failed_reason | String | Cause of the scanning failure. |
| Parameter | Type | Description |
|---|---|---|
| file_name | String | File name |
| file_type | String | File type. The options are as follows: |
| chart_name | String | Chart Package Name |
| file_id | String | File ID, which is the unique ID of the file generated by the service. |
| file_size | Integer | File size |
| scan_status | String | Server scan status. The options are as follows: |
| failed_reason | String | Cause of the scanning failure. |
| start_time | Long | Scan start time |
| end_time | Long | Scan end time |
Example Requests
Query the resource list of the cluster scan task whose project_id is 2b31ed520xxxxxxebedb6e57xxxxxxxx and task_id is 9d4fxxxxxx034d1199xxxxc61b1bxxxx.
POST https://{endpoint}/v5/2b31ed520xxxxxxebedb6e57xxxxxxxx/common/tasks/9d4fxxxxxx034d1199xxxxc61b1bxxxx/resources/batch-query?enterprise_project_id=all_granted_eps
{
"task_type" : "cluster_scan"
} Example Responses
Status code: 200
Request succeeded.
{
"total_num" : 1,
"cluster_scan_data_list" : [ {
"cluster_id" : "4axxxxf3-6xxc-4xxc-9xx3-099xxxxxx4c2",
"cluster_name" : "my-cluster",
"cluster_type" : "cce",
"cluster_version" : "v1.28.2",
"scan_status" : "failed",
"start_time" : 1745311451000,
"end_time" : 1745311451000,
"scan_detail_list" : [ {
"scan_type" : "cluster_vul",
"status" : "failed",
"failed_reason" : "some error message."
} ]
} ]
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Request succeeded. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank 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