tencent cloud

文档反馈

CloneSecurityGroup

最后更新时间:2023-08-23 14:11:18

1. API Description

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

This API is used to create a security group with the same rule configurations as an existing security group. The cloning only copies the security group and its rules, but not the security group tags.

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: CloneSecurityGroup.
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.
SecurityGroupId Yes String Security group instance ID, such as esg-33ocnj9n, which can be obtained through the DescribeSecurityGroups API.
GroupName No String The name of security group clone. You can enter any name within 60 characters. If this parameter is left empty, the security group clone will use the name of the source security group.
GroupDescription No String Description of the security group clone. You can enter up to 100 characters. If this parameter is left empty, the security group clone will use the description of the source security group.
ProjectId No String Project ID. Default value: 0. You can query it on the project management page of the Tencent Cloud console.
RemoteRegion No String The region of the source security group for a cross-region clone. For example, to clone the security group in Guangzhou to Shanghai, set it to ap-guangzhou.

3. Output Parameters

Parameter Name Type Description
SecurityGroup SecurityGroup Security group object
Note: this field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Cloning a security group

This example shows you how to clone a security group.

Input Example

https://vpc.tencentcloudapi.com/?Action=CloneSecurityGroup
&SecurityGroupId=sg-12345678
&<Common request parameters>

Output Example

{
    "Response": {
        "RequestId": "354f4ac3-8546-4516-8c8a-69e3ab73aa8a",
        "SecurityGroup": {
            "SecurityGroupId": "sg-12341234",
            "SecurityGroupName": "TestGroup",
            "SecurityGroupDesc": "test-group-desc",
            "ProjectId": "0",
            "CreatedTime": "2018-01-13 19:26:33"
        }
    }
}

Example2 This example shows you how to clone a security group and specify the name and description of the newly created one.

This example shows you how to clone a security group and specify the name and description of the newly created one.

Input Example

https://vpc.tencentcloudapi.com/?Action=CloneSecurityGroup
&SecurityGroupId=sg-12345678
&GroupName=test
&GroupDescription=test
&<Common request parameters>

Output Example

{
    "Response": {
        "RequestId": "354f4ac3-8546-4516-8c8a-69e3ab73aa8a",
        "SecurityGroup": {
            "SecurityGroupId": "sg-12341256",
            "SecurityGroupName": "test",
            "SecurityGroupDesc": "test",
            "ProjectId": "0",
            "CreatedTime": "2018-01-13 19:26:33"
        }
    }
}

Example3 Cloning a security group and specify the project ID

This example shows you how to clone a security group and specify the project ID.

Input Example

https://vpc.tencentcloudapi.com/?Action=CloneSecurityGroup
&SecurityGroupId=sg-12345678
&ProjectId=1001
&<Common request parameters>

Output Example

{
    "Response": {
        "RequestId": "354f4ac3-8546-4516-8c8a-69e3ab73aa8a",
        "SecurityGroup": {
            "SecurityGroupId": "sg-12341278",
            "SecurityGroupName": "TestGroup",
            "SecurityGroupDesc": "test-group-desc",
            "ProjectId": "1001",
            "CreatedTime": "2018-01-13 19:26:33"
        }
    }
}

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
InvalidParameterValue Incorrect parameter value.
InvalidParameterValue.Malformed Invalid input parameter format.
InvalidParameterValue.TooLong Invalid parameter value. The parameter value is too long.
LimitExceeded Quota limit is reached.
ResourceNotFound The resource does not exist.
联系我们

联系我们,为您的业务提供专属服务。

技术支持

如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

7x24 电话支持