tencent cloud

文档反馈

DescribeTargetGroups

最后更新时间:2023-10-24 11:16:01

    1. API Description

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

    This API is used to query the target group information.

    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: DescribeTargetGroups.
    Version Yes String Common Params. The value used for this API: 2018-03-17.
    Region No String Common Params. This parameter is not required for this API.
    TargetGroupIds.N No Array of String Target group ID, which is exclusive of Filters.
    Limit No Integer Limit of the number of displayed results. Default value: 20.
    Offset No Integer Starting display offset
    Filters.N No Array of Filter Filter array, which is exclusive of TargetGroupIds. Valid values: TargetGroupVpcId and TargetGroupName.

    3. Output Parameters

    Parameter Name Type Description
    TotalCount Integer Number of displayed results
    TargetGroupSet Array of TargetGroupInfo Information set of displayed target groups
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Querying target groups by IDs

    This example shows you how to query target groups by IDs

    Input Example

    POST / HTTP/1.1
    Host: clb.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeTargetGroups
    <Common request parameters>
    
    {
        "TargetGroupIds": [
            "lbtg-5xunivs0"
        ]
    }
    

    Output Example

    {
        "Response": {
            "TotalCount": 1,
            "RequestId": "6a932437-5ce7-4c30-a4ce-7076ef654dcd",
            "TargetGroupSet": [
                {
                    "UpdatedTime": "2020-09-22 00:00:00",
                    "TargetGroupId": "lbtg-xxxxxxxx",
                    "VpcId": "vpc-xxxxxxxx",
                    "CreatedTime": "2020-09-22 00:00:00",
                    "AssociatedRule": [
                        {
                            "Domain": "www.xxxx.com",
                            "Protocol": "TCP",
                            "Url": "/xxxx",
                            "LoadBalancerName": "test_xxx",
                            "ListenerId": "lbl-xxxxxxxx",
                            "LocationId": "loc-xxxxxxxx",
                            "ListenerName": "test_xxx",
                            "LoadBalancerId": "lb-xxxxxxxx",
                            "Port": 80
                        },
                        {
                            "Domain": "www.xxxx.com",
                            "Protocol": "TCP",
                            "Url": "/xxxx",
                            "LoadBalancerName": "test_xxx",
                            "ListenerId": "lbl-xxxxxxxx",
                            "LocationId": "loc-xxxxxxxx",
                            "ListenerName": "test_xxx",
                            "LoadBalancerId": "lb-xxxxxxxx",
                            "Port": 801
                        }
                    ],
                    "Port": 1,
                    "TargetGroupName": "test_xxxx"
                }
            ]
        }
    }
    

    Example2 Querying target group information by filter

    This example shows you how to query target groups.

    Input Example

    POST / HTTP/1.1
    Host: clb.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeTargetGroups
    <Common request parameters>
    
    {
        "Filters": [
            {
                "Values": [
                    "vpc-i1cnjuhx"
                ],
                "Name": "TargetGroupVpcId"
            }
        ]
    }
    

    Output Example

    {
        "Response": {
            "TotalCount": 3,
            "TargetGroupSet": [
                {
                    "TargetGroupId": "lbtg-5xunivs0",
                    "VpcId": "vpc-i1cnjuhx",
                    "TargetGroupName": "tg111_for_l4",
                    "Port": 111,
                    "CreatedTime": "2019-07-14 16:18:43",
                    "UpdatedTime": "2019-07-14 16:18:43",
                    "AssociatedRule": [
                        {
                            "LocationId": "loc-jjqr0ric",
                            "Domain": "aaaa.com",
                            "Url": "/",
                            "ListenerId": "lbl-m2q6sp9m",
                            "Port": 80,
                            "Protocol": "http",
                            "LoadBalancerId": "lb-phbx2420",
                            "LoadBalancerName": "lb-12f60e5",
                            "ListenerName": "aaa"
                        },
                        {
                            "LocationId": null,
                            "Domain": null,
                            "Url": null,
                            "ListenerId": "lbl-ow27ut6y",
                            "Port": 777,
                            "Protocol": "tcp",
                            "LoadBalancerId": "lb-phbx2420",
                            "LoadBalancerName": "lb-12f60e5",
                            "ListenerName": "asdfsdf"
                        }
                    ]
                },
                {
                    "TargetGroupId": "lbtg-dxnp10nc",
                    "VpcId": "vpc-i1cnjuhx",
                    "TargetGroupName": "tg111_for_l41563508267",
                    "Port": 111,
                    "CreatedTime": "2019-07-19 11:51:08",
                    "UpdatedTime": "2019-07-19 11:51:07",
                    "AssociatedRule": []
                },
                {
                    "TargetGroupId": "lbtg-bjfi6nt6",
                    "VpcId": "vpc-i1cnjuhx",
                    "TargetGroupName": "tg111_for_l41563508507",
                    "Port": 111,
                    "CreatedTime": "2019-07-19 11:55:08",
                    "UpdatedTime": "2019-07-19 11:55:08",
                    "AssociatedRule": []
                }
            ],
            "RequestId": "412c7de5-47f6-4153-bf1b-77ef37e15244"
        }
    }
    

    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
    FailedOperation Operation failed.
    InternalError Internal error.
    InvalidParameter Parameter error.
    InvalidParameterValue Incorrect parameter value.
    UnauthorizedOperation Unauthorized operation.