# 更新带宽分组规则 - UpdateBandwidthRule
#### 功能介绍
更新带宽分组规则对象。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/EIP/doc?api=UpdateBandwidthRule&version=v3)中调试该接口，支持自动认证鉴权。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-eip/eip_apipermission_0000.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
  
  | 授权项                       | 访问级别  | 资源类型（\*为必须）      | 条件键                                                                                                                                                                                                                                                                                                                                                                                                                | 别名                    | 依赖的授权项 |
  |:---|:---|:---|:---|:---|:---|
  | eip:bandwidthRules:update | Write | bandwidth \*     | - g:EnterpriseProjectId   - g:ResourceTag/\<tag-key\>    | vpc:bandwidths:update | -      |
  | eip:bandwidthRules:update | Write | bandwidthRule \* | -                                                                                                                                                                                                                                                                                                                                                                                                                  | vpc:bandwidths:update | -      |
     
  
 
#### URI
PUT /v3/{project_id}/eip/bandwidths/{bandwidth_id}/bandwidth-rule/{bandwidth_rules_id}
表1路径参数 
| 参数                 | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|:---|:---|:---|:---|
| project_id         | 是    | String | - 参数解释：项目ID。[请参见获取项目ID](https://support.huaweicloud.com/api-eip/eip_api06_0004.html) - 取值范围：不涉及       最大长度：**32** |
| bandwidth_id       | 是    | String | 带宽唯一标识。通过弹性公网IP详情获取，且此弹性公网IP是包年包月                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| bandwidth_rules_id | 是    | String | 带宽规则唯一标识                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
   
#### 请求参数
表2请求Body参数 
| 参数             | 是否必选 | 参数类型                                                                                    | 描述       |
|:---|:---|:---|:---|
| bandwidth_rule | 否    | [UpdateBandwidthRuleDict] object | 带宽分组规则对象 |
   
 表3UpdateBandwidthRuleDict 
| 参数                    | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| name                  | 否    | String  | - 功能说明：带宽规则名称   - 取值范围：1-64，支持数字、字母、中文、_(下划线)、-（中划线），为空表示不修改名称    最小长度：**1** 最大长度：**64** |
| description           | 否    | String  | - 功能说明：带宽分组规则说明    最小长度：**1** 最大长度：**255**                                                                                                                                                                                                                             |
| admin_state_up        | 否    | Boolean | - 功能说明：是否启用带宽分组规则                                                                                                                                                                                                                                                                                                                                    |
| egress_size           | 否    | Integer | - 功能说明：出网带宽大小，Mbit/s                                                                                                                                                                                                                                                                                                                                 |
| egress_guarented_size | 否    | Integer | - 功能说明：出网保底带宽大小，Mbit/S                                                                                                                                                                                                                                                                                                                               |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数             | 参数类型                                                                         | 描述      |
|:---|:---|:---|
| request_id     | String                                                                       | 本次请求的编号 |
| bandwidth_rule | [BandwidthRuleDict] object | 带宽组规则对象 |
   
 表5BandwidthRuleDict 
| 参数                    | 参数类型                                                                                 | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|:---|:---|:---|
| id                    | String                                                                               | - 功能说明：带宽组规则唯一标识                                                                                                                                                                                                                                                                                                                                   |
| name                  | String                                                                               | - 功能说明：带宽规则名称   - 取值范围：1-64个字符，支持数字、字母、中文、_(下划线)、-（中划线）、.（点）    最小长度：**1** 最大长度：**64** |
| description           | String                                                                               | - 功能说明：带宽规则说明   - 取值范围：1-255个字符，支持数字、字母、中文、_(下划线)、-（中划线）、.（点）                                                                                                        |
| bandwidth_id          | String                                                                               | - 功能说明：带宽唯一标识                                                                                                                                                                                                                                                                                                                                      |
| admin_state_up        | Boolean                                                                              | - 功能说明：配置状态，为False时配置不生效。    缺省值：**true**                                                                                                                                                                                                                                                                   |
| egress_size           | Integer                                                                              | - 功能说明：出网带宽最大值，单位M bps   - 取值范围\[0,n\]，其中n为所属带宽的带宽大小（size字段）。0表示设置为最大带宽。                                                                                             |
| egress_guarented_size | Integer                                                                              | - 功能说明：出网保底带宽大小,单位M bps。   - 取值范围\[0,x\]，其中x为所属带宽剩余的保障额。    最小值：**0** 缺省值：**0**        |
| publicip_info         | Array of [PublicipInfoDict] objects | - 功能说明：带宽对应的弹性公网IP信息   - 约束与限制：WHOLE类型的带宽支持多个弹性公网IP，PER类型的带宽只能对应一个弹性公网IP                                                                                             |
   
 表6PublicipInfoDict 
| 参数                 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|:---|:---|:---|
| publicip_address   | String  | - 功能说明：弹性公网IP或者IPv6端口的地址                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| publicip_id        | String  | - 功能说明：带宽对应的弹性公网IP或者IPv6端口的唯一标识                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| publicip_type      | String  | **参数解释：** 弹性公网IP的类型。 **约束与限制：** 必须是系统具体支持的类型。publicip_id为IPv4端口，所以"type"字段未给定时，默认为5_bgp。 **取值范围：**     5_bgp (全动态BGP)，5_sbgp (静态BGP)，5_bgp-premium(精品BGP) -  华南-广州：5_bgp、5_sbgp   -  华东-上海一：5_bgp、5_sbgp   -  华东-上海二：5_bgp、5_sbgp   -  华北-北京一：5_bgp、5_sbgp   -  中国-香港：5_bgp、5_bgp-premium   -  亚太-曼谷：5_bgp   -  亚太-新加坡：5_bgp   -  非洲-约翰内斯堡：5_bgp   -  西南-贵阳一：5_sbgp   -  华北-北京四：5_bgp、5_sbgp   -  拉美-圣地亚哥：5_bgp   -  拉美-圣保罗一：5_bgp   -  拉美-墨西哥城一：5_bgp   -  拉美-布宜诺斯艾利斯一：5_bgp   -  拉美-利马一：5_bgp   -  拉美-圣地亚哥二： 5_bgp    最大长度：**36** |
| publicipv6_address | String  | - 功能说明：IPv4时无此字段，IPv6时为申请到的弹性公网IP地址                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ip_version         | Integer | - IP版本信息   - 取值范围： - 4：IPv4   - 6：IPv6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
   
#### 请求示例
```
{
  "bandwidth_rule" : {
    "name" : "bandwidth_rule_2",
    "egress_size" : 10,
    "egress_guarented_size" : 5
  }
}
```
#### 响应示例
**状态码：200**
```
{
  "bandwidth_rule" : {
    "id" : "c7cf9045-bd79-4195-99ea-7194a20c2e48",
    "name" : "bandwidth_rule_2",
    "bandwidth_id" : "c7cf9045-bd79-4195-99ea-7194a20c2e48",
    "admin_state_up" : true,
    "egress_size" : "10,",
    "egress_guarented_size" : "5,",
    "publicip_info" : [ {
      "publicip_id" : "6285e7be-fd9f-497c-bc2d-dd0bdea6efe0",
      "publicip_address" : "161.x.x.9",
      "publicip_type" : "5_bgp",
      "ip_version" : 4
    } ]
  },
  "request_id" : "4a06c169-cc67-4d94-a786-2d70ef09b100"
}
```
#### 状态码
| 状态码 | 描述            |
|:---|:---|
| 200 | GET和PUT操作正常返回 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-eip/ErrorCode.html)。
