修改安全 IP 组

最近更新时间:2025-06-06 02:07:17

我的收藏

1. 接口描述

接口请求域名: teo.tencentcloudapi.com 。

修改安全 IP 组。

默认接口请求频率限制:20次/秒。

推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:ModifySecurityIPGroup。
Version String 公共参数,本接口取值:2022-09-01。
Region String 公共参数,此参数为可选参数。
ZoneId String 站点 Id。
IPGroup IPGroup IP 组配置。
Mode String 操作类型,取值有:
  • append: 向 IPGroup 中添加新的 IP 地址或设置定时过期时间;
  • remove: 从 IPGroup 中删除指定的 IP 地址或其定时过期时间;
  • update: 完全替换 IPGroup 中 Content 或 ExpireInfo 的内容,并且可以修改 IPGroup 的名称。
  • 使用 append 操作时注意:
  • 为 IP 或网段添加定时过期时间时,必须晚于当前时间。如果该 IP 或网段在组中不存在,必须同时在 Content 参数中添加该 IP 或网段。若该 IP 或网段已存在过期时间,则新时间将覆盖原有时间。
  • 使用 remove 操作时注意:
  • 删除 IP 或网段时,相关的未过期的定时过期时间也会被删除;
  • 删除定时过期时间时,仅能删除当前未过期的时间。
  • 使用 update 操作时注意:
  • 替换 Content 内容时,不在 Content 中的 IP 或网段的未过期时间会被删除;
  • 替换 IPExpireInfo 内容时,IPExpireInfo 中的 IP 或网段必须在 Content 中或在 IP 组中存在。
  • 3. 输出参数

    参数名称 类型 描述
    RequestId String 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。

    4. 示例

    示例1 向 IP 组中追加 IP 或网段

    若向已存在的 IP 组中追加以下 IP 或网段:1.1.1.1、2.2.2.0/24。

    输入示例

    POST / HTTP/1.1
    Host: teo.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifySecurityIPGroup
    <公共请求参数>
    
    {
        "IPGroup": {
            "GroupId": 67,
            "Name": "test3",
            "Content": [
                "1.1.1.1",
                "2.2.2.0/24"
            ]
        },
        "Mode": "append",
        "ZoneId": "zone-hduqwh"
    }

    输出示例

    {
        "Response": {
            "RequestId": "728cb059-8595-44c7-b6c6-b4a539ae823f"
        }
    }

    示例2 向安全 IP 组中追加 IP 或网段,并配置过期时间。

    需要向已存在安全 IP 组中追加以下 IP 或网段:1.1.1.1、2.2.2.0/24、3.3.3.3 和 4.4.4.4,并为 1.1.1.1、2.2.2.0/24 和 4.4.4.4 分别配置过期时间。

    输入示例

    POST / HTTP/1.1
    Host: teo.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifySecurityIPGroup
    <公共请求参数>
    
    {
        "IPGroup": {
            "GroupId": 67,
            "Name": "test3",
            "Content": [
                "1.1.1.1",
                "2.2.2.0/24",
                "3.3.3.3",
                "4.4.4.4"
            ],
            "IPExpireInfo": [
                {
                    "ExpireTime": "2022-01-01T00:00:00+08:00",
                    "IPList": [
                        "1.1.1.1",
                        "4.4.4.4"
                    ]
                },
                {
                    "ExpireTime": "2022-01-02T00:00:00+08:00",
                    "IPList": [
                        "2.2.2.0/24"
                    ]
                }
            ]
        },
        "Mode": "append",
        "ZoneId": "zone-hduqwh"
    }

    输出示例

    {
        "Response": {
            "RequestId": "728cb059-8595-44c7-b6c6-b4a539ae823f"
        }
    }

    示例3 修改 IP 组中 IP 或网段的过期时间

    IP 组中的 1.1.1.1 已配置过期时间,现在需要更改该 IP 的定时过期时间。

    输入示例

    POST / HTTP/1.1
    Host: teo.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifySecurityIPGroup
    <公共请求参数>
    
    {
        "IPGroup": {
            "GroupId": 67,
            "Name": "test3",
            "Content": [],
            "IPExpireInfo": [
                {
                    "ExpireTime": "2022-01-01T00:00:00+08:00",
                    "IPList": [
                        "1.1.1.1"
                    ]
                }
            ]
        },
        "Mode": "append",
        "ZoneId": "zone-hduqwh"
    }

    输出示例

    {
        "Response": {
            "RequestId": "728cb059-8595-44c7-b6c6-b4a539ae823f"
        }
    }

    示例4 删除 IP 组中的 IP 或网段

    IP 组中存在 1.1.1.1,现在需要删除该 IP。

    输入示例

    POST / HTTP/1.1
    Host: teo.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifySecurityIPGroup
    <公共请求参数>
    
    {
        "IPGroup": {
            "GroupId": 67,
            "Name": "test3",
            "Content": [
                "1.1.1.1"
            ]
        },
        "Mode": "remove",
        "ZoneId": "zone-hduqwh"
    }

    输出示例

    {
        "Response": {
            "RequestId": "5bdc699c-68df-4cb7-9d0a-1c174b0374ad"
        }
    }

    示例5 删除 IP 组中 IP 或网段的过期时间

    IP 组中存在 1.1.1.1,并已为该 IP 配置过期时间,现在需要删除该 IP 的过期时间。

    输入示例

    POST / HTTP/1.1
    Host: teo.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifySecurityIPGroup
    <公共请求参数>
    
    {
        "IPGroup": {
            "GroupId": 67,
            "Name": "test3",
            "Content": [],
            "IPExpireInfo": [
                {
                    "IPList": [
                        "1.1.1.1"
                    ]
                }
            ]
        },
        "Mode": "remove",
        "ZoneId": "zone-hduqwh"
    }

    输出示例

    {
        "Response": {
            "RequestId": "728cb059-8595-44c7-b6c6-b4a539ae823f"
        }
    }

    示例6 全量更新安全 IP 组中的 IP 或网段

    需要全量更新 IP 组内容,需更新的 IP 或网段为:1.1.1.1、2.2.2.0/24。

    输入示例

    POST / HTTP/1.1
    Host: teo.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifySecurityIPGroup
    <公共请求参数>
    
    {
        "IPGroup": {
            "GroupId": 67,
            "Name": "test3",
            "Content": [
                "1.1.1.1",
                "2.2.2.0/24"
            ]
        },
        "Mode": "update",
        "ZoneId": "zone-hduqwh"
    }

    输出示例

    {
        "Response": {
            "RequestId": "sh1u8a90-xxxx-49cd-swui-27cb34daa779"
        }
    }

    示例7 全量更新安全 IP 组中的 IP 或网段以及对应的过期时间

    需要全量更新 IP 组内容,新更新的 IP 或网段为:1.1.1.1、2.2.2.0/24、3.3.3.3,并为 1.1.1.1 配置过期时间。

    输入示例

    POST / HTTP/1.1
    Host: teo.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifySecurityIPGroup
    <公共请求参数>
    
    {
        "IPGroup": {
            "GroupId": 67,
            "Name": "test3",
            "Content": [
                "1.1.1.1",
                "2.2.2.0/24",
                "3.3.3.3"
            ],
            "IPExpireInfo": [
                {
                    "ExpireTime": "2022-01-01T00:00:00+08:00",
                    "IPList": [
                        "1.1.1.1"
                    ]
                }
            ]
        },
        "Mode": "update",
        "ZoneId": "zone-hduqwh"
    }

    输出示例

    {
        "Response": {
            "RequestId": "728cb059-8595-44c7-b6c6-b4a539ae823f"
        }
    }

    5. 开发者资源

    腾讯云 API 平台

    腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。

    API Inspector

    用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。

    SDK

    云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。

    命令行工具

    6. 错误码

    以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码

    错误码 描述
    InternalError.ProxyServer 后端服务器发生未知错误。
    InvalidParameter.Security 参数错误
    ResourceNotFound 资源不存在。
    UnauthorizedOperation.CamUnauthorized Cam 未授权。
    UnauthorizedOperation.Unknown 后端服务器发生未知错误。