tencent cloud

文档反馈

DescribeDBInstanceSecurityGroups

最后更新时间:2024-06-17 14:25:51

    1. API Description

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

    This API is used to query the security group of an instance.

    A maximum of 1000 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: DescribeDBInstanceSecurityGroups.
    Version Yes String Common Params. The value used for this API: 2017-03-12.
    Region No String Common Params. This parameter is not required for this API.
    DBInstanceId No String Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
    ReadOnlyGroupId No String RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.

    3. Output Parameters

    Parameter Name Type Description
    SecurityGroupSet Array of SecurityGroup Information of security groups in array
    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 Querying the security group of an instance

    This example shows you how to query the security group of an instance.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeDBInstanceSecurityGroups
    <Common request parameters>
    
    {
        "DBInstanceId": "postgres-i2q4utnp"
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "770234c2-8a51-4d06-b3f7-4454664848b1",
            "SecurityGroupSet": [
                {
                    "CreateTime": "2022-10-20 21:38:20",
                    "Inbound": [
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Allow Ping service",
                            "IpProtocol": "icmp",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "::/0",
                            "Description": "Allow Ping service",
                            "IpProtocol": "icmpv6",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Allow Linux SSH login",
                            "IpProtocol": "tcp",
                            "PortRange": "22"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "::/0",
                            "Description": "Allow Linux SSH login",
                            "IpProtocol": "tcp",
                            "PortRange": "22"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Allow remote Windows login",
                            "IpProtocol": "tcp",
                            "PortRange": "3389"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "::/0",
                            "Description": "Allow remote Windows login",
                            "IpProtocol": "tcp",
                            "PortRange": "3389"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "10.0.0.0/8",
                            "Description": "Enable the private network (VPC)",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "172.16.0.0/12",
                            "Description": "Enable the private network (VPC)",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "192.168.0.0/16",
                            "Description": "Enable the private network (VPC)",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Open ports for Web service",
                            "IpProtocol": "tcp",
                            "PortRange": "80"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "::/0",
                            "Description": "Open ports for Web service",
                            "IpProtocol": "tcp",
                            "PortRange": "80"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Open ports for Web service",
                            "IpProtocol": "tcp",
                            "PortRange": "443"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "::/0",
                            "Description": "Open ports for Web service",
                            "IpProtocol": "tcp",
                            "PortRange": "443"
                        }
                    ],
                    "Outbound": [
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "",
                            "Description": "",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        }
                    ],
                    "ProjectId": 0,
                    "SecurityGroupDescription": "Custom template",
                    "SecurityGroupId": "sg-91jbmkp1",
                    "SecurityGroupName": "Custom template-20221020213819279"
                }
            ]
        }
    }
    

    Example2 Querying the security group of an RO group

    u200cThis example shows you how to query the security group of an RO group.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeDBInstanceSecurityGroups
    <Common request parameters>
    
    {
        "ReadOnlyGroupId": "pgrogrp-nqwpkjb"
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "47e3764e-bce4-477a-a293-49ffa1bfb447",
            "SecurityGroupSet": [
                {
                    "CreateTime": "2022-08-30 21:36:58",
                    "Inbound": [],
                    "Outbound": [],
                    "ProjectId": 0,
                    "SecurityGroupDescription": "Custom222",
                    "SecurityGroupId": "sg-116auwb1",
                    "SecurityGroupName": "Custom222-202208302136517989"
                },
                {
                    "CreateTime": "2022-10-20 21:38:20",
                    "Inbound": [
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Allow Ping service",
                            "IpProtocol": "icmp",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "::/0",
                            "Description": "Allow Ping service",
                            "IpProtocol": "icmpv6",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Allow Linux SSH login",
                            "IpProtocol": "tcp",
                            "PortRange": "22"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "::/0",
                            "Description": "Allow Linux SSH login",
                            "IpProtocol": "tcp",
                            "PortRange": "22"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Allow remote Windows login",
                            "IpProtocol": "tcp",
                            "PortRange": "3389"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "::/0",
                            "Description": "Allow remote Windows login",
                            "IpProtocol": "tcp",
                            "PortRange": "3389"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "10.0.0.0/8",
                            "Description": "Enable the private network (VPC)",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "172.16.0.0/12",
                            "Description": "Enable the private network (VPC)",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "192.168.0.0/16",
                            "Description": "Enable the private network (VPC)",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Open ports for Web service",
                            "IpProtocol": "tcp",
                            "PortRange": "80"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "::/0",
                            "Description": "Open ports for Web service",
                            "IpProtocol": "tcp",
                            "PortRange": "80"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Open ports for Web service",
                            "IpProtocol": "tcp",
                            "PortRange": "443"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "::/0",
                            "Description": "Open ports for Web service",
                            "IpProtocol": "tcp",
                            "PortRange": "443"
                        }
                    ],
                    "Outbound": [
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "",
                            "Description": "",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        }
                    ],
                    "ProjectId": 0,
                    "SecurityGroupDescription": "Custom template",
                    "SecurityGroupId": "sg-91jbmkp1",
                    "SecurityGroupName": "Custom template-20221020213819279"
                },
                {
                    "CreateTime": "2022-08-22 17:34:08",
                    "Inbound": [
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Open all inbound rules",
                            "IpProtocol": "tcp",
                            "PortRange": "22,3389,80,443,20,21"
                        },
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "Open all inbound rules",
                            "IpProtocol": "icmp",
                            "PortRange": "ALL"
                        }
                    ],
                    "Outbound": [
                        {
                            "Action": "ACCEPT",
                            "CidrIp": "0.0.0.0/0",
                            "Description": "u200cOpen all inbound rules",
                            "IpProtocol": "ALL",
                            "PortRange": "ALL"
                        }
                    ],
                    "ProjectId": 0,
                    "SecurityGroupDescription": "Deny all rules",
                    "SecurityGroupId": "sg-mpkb1net",
                    "SecurityGroupName": "Custom-2022082217335427078"
                }
            ]
        }
    }
    

    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.FailedOperationError Operation failed. Please try again later.
    FailedOperation.ROGroupNotFoundError The RO group does not exist.
    InvalidParameter.ParameterCheckError Failed to check the parameter.
    OperationDenied.CamDeniedError This operation cannot be performed.
    OperationDenied.InstanceAccessDeniedError You do not have the permission to operate this resource.
    OperationDenied.InstanceStatusLimitOpError This operation cannot be performed on an instance in this status.
    OperationDenied.ROGroupStatusError This operation cannot be performed on an RO group in this status.
    ResourceNotFound.InstanceNotFoundError The instance does not exist.