tencent cloud

文档反馈

DescribePodChargeInfo

最后更新时间:2024-11-14 14:52:14

1. API Description

Domain name for API request: tke.tencentcloudapi.com.

This API is used to query the billing information of running Pods. You can query a specific Pod by Namespace and Name or batch query by Pod Uid.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DescribePodChargeInfo.
Version Yes String Common Params. The value used for this API: 2018-05-25.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
ClusterId Yes String Cluster ID
Namespace No String Namespace
Name No String Pod name
Uids.N No Array of String UID of the pod.

3. Output Parameters

Parameter Name Type Description
ChargeInfoSet Array of PodChargeInfo Pod billing information.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Specifying only Namespace

This example shows you how to simultaneously specify Namespace and Name.

Input Example

POST / HTTP/1.1
Host: tke.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribePodChargeInfo
<Common request parameters>

{
    "ClusterId": "cls-s180xq54",
    "Namespace": "default"
}

Output Example

{
    "Response": {
        "Error": {
            "Code": "InternalError.Param",
            "Message": "Namespace and Name must be set"
        },
        "RequestId": "e9de622d-82fc-4aa1-a32c-f2679bc51a9e"
    }
}

Example2 Not inputting required parameters

This example shows you how to simultaneously input Namespace and Name, or Uid.

Input Example

POST / HTTP/1.1
Host: tke.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribePodChargeInfo
<Common request parameters>

{
    "ClusterId": "cls-s180xq54"
}

Output Example

{
    "Response": {
        "Error": {
            "Code": "InternalError.Param",
            "Message": "Namespace,Name,Uid is empty"
        },
        "RequestId": "99a94acb-7566-410b-8dc8-b611ca160820"
    }
}

Example3 Querying through Namespace and Name

This example shows you how to simultaneously specify Namespace and Name.

Input Example

POST / HTTP/1.1
Host: tke.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribePodChargeInfo
<Common request parameters>

{
    "ClusterId": "cls-s180xq54",
    "Namespace": "default",
    "Name": "nginx-c4cd9685f-m58ts"
}

Output Example

{
    "Response": {
        "ChargeInfoSet": [
            {
                "ChargeType": "POSTPAID_BY_HOUR",
                "Cpu": 1,
                "Memory": 1,
                "Name": "nginx-c4cd9685f-m58ts",
                "Namespace": "default",
                "StartTime": "2024-03-26 00:10:38",
                "Type": "intel",
                "Uid": "4df5eb56-df50-4bd4-b84e-8c3f7fdf7ab8"
            }
        ],
        "RequestId": "9b400838-e679-486f-a7d3-854d5040a6e6"
    }
}

Example4 Querying billing information of multiple running Pods

This example shows you how to input multiple Uids for query.

Input Example

POST / HTTP/1.1
Host: tke.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribePodChargeInfo
<Common request parameters>

{
    "ClusterId": "cls-0x51a7qw",
    "Uids": [
        "6c4022b4-288c-449e-b50f-ae06d91dd48e",
        "a49edc4a-b316-45b0-8ce4-8f23f93a27c7"
    ]
}

Output Example

{
    "Response": {
        "ChargeInfoSet": [
            {
                "ChargeType": "POSTPAID_BY_HOUR",
                "Cpu": 2,
                "Memory": 4,
                "Name": "csi-cbs-controller-6678658c57-hhbvw",
                "Namespace": "kube-system",
                "StartTime": "2024-04-17 00:08:15",
                "Type": "intel",
                "Uid": "6c4022b4-288c-449e-b50f-ae06d91dd48e"
            },
            {
                "ChargeType": "NO_CHARGE",
                "Cpu": 0.25,
                "Memory": 0.5,
                "Name": "coredns-56555dd999-ntc6g",
                "Namespace": "kube-system",
                "StartTime": "2024-04-17 00:08:11",
                "Type": "intel",
                "Uid": "a49edc4a-b316-45b0-8ce4-8f23f93a27c7"
            }
        ],
        "RequestId": "9fe5a6b6-ad87-426d-b619-b600d0a18f23"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError.Param Parameter error.
InternalError.UnexpectedInternal Unknown internal error.