撤销普通安全组规则
更新时间:2024-12-27
描述
该接口用于撤销普通安全组中的规则。
- 同一安全组中的规则以remark、protocol、direction、portRange、sourceIp|destIp、sourceGroupId|destGroupId六元组作为唯一性索引,若安全组中不存在对应的规则将报404错误;
 
请求结构
                Plain Text
                
            
            1PUT /v{version}/securityGroup/{securityGroupId}?{action}&clientToken={clientToken}&sgVersion={sgVersion} HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4
5{
6	"rule": 
7		{
8			"remark": {remark},
9			"protocol": {protocol},
10			"portRange": {portRange},
11			"direction": {direction},
12			"sourceIp": {sourceIp}
13		}
14}
            请求头域
除公共头域外,无其它特殊头域。
请求参数
| 参数名称 | 类型 | 是否必选 | 参数位置 | 描述 | 
|---|---|---|---|---|
| version | String | 是 | URL参数 | API版本号,当前取值为2 | 
| clientToken | String | 否 | Query参数 | 幂等性Token,是一个长度不超过64位的ASCII字符串,详见ClientToken幂等性。 | 
| sgVersion | Long | 否 | Query参数 | 安全组版本号,可从安全组列表获取 | 
| action | String | 是 | Query参数 | 对安全组执行的动作,当前取值revokeRule | 
| securityGroupId | String | 是 | URL参数 | 待撤销安全组规则的安全组ID | 
| rule | SecurityGroupRuleModel | 是 | RequestBody参数 | 待撤销的安全组规则 | 
返回头域
除公共头域,无其它特殊头域。
返回参数
无特殊返回参数。
错误码
| 错误码 | 错误描述 | HTTP状态码 | 中文解释 | 
|---|---|---|---|
| SecurityGroup.RulePortOrderInvalid | The order of security group rule port is incorrect. | 400 | 安全组规则端口顺序不正确 | 
| SecurityGroup.RulePortRangeInvalid | The value of security group rule port is exceeded. | 400 | 安全组规则的端口数字超出允许范围 | 
| SecurityGroup.RulePortInvalid | The value of security group rule port must be number. | 400 | 安全组规则端口非数字 | 
| NoSuchObject | The specified object is not found or resource do not exist. | 404 | 目标安全组不存在 | 
| SecurityGroup.RuleNotExist | The Security group rule is not exist. | 404 | 撤销的安全组规则不存在 | 
| VersionMismatch | The sgVersion is mismatch. | 400 | 指定安全组规则版本号和当前最新版本不一致。若请求中没有携带sgVersion参数,则不会返回该错误码。 | 
请求示例
                Plain Text
                
            
            1PUT /v2/securityGroup/g-nky7qeom?revokeRule&clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
2Host: bcc.bj.baidubce.com
3Content-Type: application/json;charset=UTF-8
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
5
6{
7	"rule": 
8		{
9			"remark": "备注",
10			"protocol": "tcp",
11			"portRange": "1-65535",
12			"direction": "ingress",
13			"sourceIp": "10.101.151.0/29"
14		}
15}
            返回示例
                Plain Text
                
            
            1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: Wed, 03 Dec 2014 06:42:19 GMT
4Content-Type: application/json;charset=UTF-8
5Server: BWS	
            