跳转到主要内容
资源中心/网络服务/网络服务相关接口/安全组相关接口
PUTSecurity Group Operations起始版本 4.7.21同步需要认证

修改安全组规则

修改安全组规则

调试可用性

在线调试

使用当前认证信息和示例参数提交 Mock 请求。

路径参数

请求参数

路径参数

  • uuidString必填

    安全组规则的UUID,唯一标示该资源

请求体字段

  • paramsObject必填

    请求体parameter对象。

    • descriptionString

      资源的详细描述。

    • remoteSecurityGroupUuidString

      可选远程安全组UUID。

    • actionString

      动作名称。

    • stateString

      当前状态。

    • priorityInteger

      优先级。

    • protocolString

      认证协议。

    • srcIpRangeString

      暂无描述。

    • dstIpRangeString

      暂无描述。

    • dstPortRangeString

      暂无描述。

  • systemTagsList

    系统标签

  • userTagsList

    用户标签

响应状态

200 OK

该 API 成功时返回以下响应结构。

  • successboolean必填

    操作是否成功。

  • errorErrorCode必填

    错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error

    • codeString必填

      错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001

    • descriptionString必填

      错误的概要描述

    • detailsString必填

      错误的详细信息

    • elaborationString必填

      保留字段,默认为null

    • opaqueLinkedHashMap必填

      保留字段,默认为null

    • causeErrorCode必填

      根错误,引发当前错误的源错误,若无原错误,该字段为null

  • inventorySecurityGroupInventory必填

    详情参考inventory

    • uuidString必填

      资源的UUID,唯一标示该资源

    • securityGroupUuidString必填

      安全组UUID

    • typeString必填

      流量类型

    • ipVersionInteger必填

      ip协议号

    • protocolString必填

      流量协议类型

    • stateString必填

      规则的可用状态

    • priorityInteger必填

      规则优先级

    • descriptionString必填

      规则描述

    • srcIpRangeString必填

      源IP范围

    • dstIpRangeString必填

      目的IP范围

    • srcPortRangeString必填

      源端口范围,当前版本未实现

    • dstPortRangeString必填

      目的端口范围

    • actionString必填

      规则的默认动作

    • remoteSecurityGroupUuidString必填

      远程安全组UUID。

    • allowedCidrString必填

      允许的CIDR,根据流量类型的不同, 允许的CIDR有不同的含义 如果流量类型是Ingress,允许的CIDR是允许访问虚拟机网卡的源CIDR 如果流量类型是Egress,允许的CIDR是允许从虚拟机网卡离开并到达的目的地CIDR

    • startPortInteger必填

      如果协议是TCP/UDP,它是端口范围(port range)的起始端口号 如果协议是ICMP,它是ICMP类型(type)

    • endPortInteger必填

      如果协议是TCP/UDP, 它是端口范围(port range)的起始端口号 如果协议是ICMP, 它是ICMP类型(type)

    • createDateTimestamp必填

      创建时间

    • lastOpDateTimestamp必填

      最后一次修改时间

请求地址

PUT/zstack/v1/security-groups/rules/{uuid}/actions

/zstack/v1/security-groups/rules/{uuid}/actions

操作 ID

ChangeSecurityGroupRule

永久链接

请求示例

curl -X PUT 'http://{host}/zstack/v1/security-groups/rules/{uuid}/actions' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"description":"<description>","remoteSecurityGroupUuid":"<remoteSecurityGroupUuid>","action":"<action>","state":"<state>","priority":1,"protocol":"<protocol>","srcIpRange":"<srcIpRange>","dstIpRange":"<dstIpRange>","dstPortRange":"<dstPortRange>"},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

响应示例

200
{ "inventory": { "uuid": "68e4f4b48b51369c8c2ada5cb6c2c3c3", "securityGroupUuid": "c80ad90499213d3b9989afdbfe498390", "type": "ingress", "protocol": "tcp", "state": "enable", "srcIpRange": "10.10.10.1-10.10.10.10", "dstPortRange": "2001-2023", "action": "RETURN", "createDate": "Sep 15, 2023 9:57:59 AM", "lastOpDate": "Sep 15, 2023 9:57:59 AM" } }

变更历史

此 API 暂无变更历史记录。

查看全部变更历史