tencent cloud

Feedback

ModifyDBInstanceSecurityGroups

Last updated: 2024-06-17 14:25:50

    1. API Description

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

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

    A maximum of 100 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: ModifyDBInstanceSecurityGroups.
    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.
    SecurityGroupIdSet.N Yes Array of String The list of security groups to be associated with the instance or RO groups.
    Information of security groups can be obtained from the sgld field in the returned value of the DescribeSecurityGroups 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 modify the security groups associated with the RO groups, only pass in ReadOnlyGroupId.

    3. Output Parameters

    Parameter Name Type Description
    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 Modifying a security group

    This example shows you how to modify a security group.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifyDBInstanceSecurityGroups
    <Common request parameters>
    
    {
        "DBInstanceId": "postgres-i2q4utnp",
        "SecurityGroupIdSet": [
            "sg-91jbmkp1"
        ]
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "5fad142d-9597-408f-84b8-41a27a1486ce"
        }
    }
    

    Example2 Modifying the security groups of an RO group

    This example shows you how to modify the security groups of an RO group.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifyDBInstanceSecurityGroups
    <Common request parameters>
    
    {
        "ReadOnlyGroupId": "pgrogrp-nqwpkjb",
        "SecurityGroupIdSet": [
            "sg-91jbmkp1"
        ]
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "f81495e4-bca8-4946-b5b0-0aedc512413d"
        }
    }
    

    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.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support