
# 修改实例信息 - UpdateInstance
#### 功能介绍
修改设备接入实例信息。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-iothub/iot_06_v5_0004.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-iothub/iot_06_v5_0201.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
  
  | 授权项                   | 访问级别  | 资源类型（\*为必须） | 条件键                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | 别名 | 依赖的授权项 |
  |:---|:---|:---|:---|:---|:---|
  | iotda:instance:update | Write | instance \* | - g:EnterpriseProjectId   - g:ResourceTag/\<tag-key\>                                                                                                                                                                                                                                                                                                                           | -  | -      |
  | iotda:instance:update | Write | -           | - iotda:AllowPublicAccess   - iotda:AllowPublicForwarding   - iotda:DomainConfiguration    | -  | -      |
     
  
 
#### URI
PUT /v5/iot/{project_id}/iotda-instances/{instance_id}
表1路径参数 
| 参数          | 是否必选 | 参数类型   | 描述                                                                                                                                      |
|:---|:---|:---|:---|
| project_id  | 是    | String | **参数说明** ：项目ID。获取方法请参见 [获取项目ID](https://support.huaweicloud.com/api-iothub/iot_06_v5_1001.html)。                                        |
| instance_id | 是    | String | **参数说明**：实例ID。 **取值范围**：长度不超过36，由小写字母\[a-f\]、数字、连接符（-）的组成。 |
   
#### 请求参数
表2请求Body参数 
| 参数              | 是否必选 | 参数类型                                                                                                                    | 描述                                                                                                                                                 |
|:---|:---|:---|:---|
| name            | 否    | String                                                                                                                  | **参数说明**：实例名称。 **取值范围**：由中文字符，英文字母、数字及"_"、"-"组成，且长度为\[1-64\]个字符。      |
| description     | 否    | String                                                                                                                  | **参数说明**：设备接入实例的描述信息。 **取值范围**：长度不超过256，只允许中文、字母、数字、以及_，,.。、\&-等字符的组合 |
| operate_window  | 否    | [OperateWindow] object               | 实例维护时间窗，用户在变更实例规格时，可以指定在该时间窗内进行变更。                                                                                                                 |
| forwarding_info | 否    | [UpdateForwardingInfo] object | 企业版实例的SNAT配置，配置开启后，企业版实例可以在公共网络中进行外部通信。 约束：只有企业版实例支持修改流转配置。           |
| access_info     | 否    | [UpdateAccessInfo] object         | 设备接入实例的接入信息。用户可以使用该结构体中的信息将应用服务器和设备接入到物联网平台。 约束：只有企业版实例支持自定义接入信息。     |
   
 表3OperateWindow 
| 参数         | 是否必选 | 参数类型   | 描述                                   |
|:---|:---|:---|:---|
| start_time | 是    | String | **参数说明**：变更时间窗开始时间，UTC时间，格式为："HH:mm" |
| end_time   | 是    | String | **参数说明**：变更时间窗结束时间，UTC时间，格式为："HH:mm" |
   
 表4UpdateForwardingInfo 
| 参数          | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|:---|:---|:---|:---|
| enable_snat | 是    | Boolean | **参数说明**：是否启用SNAT配置。企业版实例开启SNAT配置后，可以在公共网络中进行外部通信。 约束：只有企业版实例支持配置SNAT配置，SNAT配置开启后将不支持关闭。 **取值范围**： - true: 启用SNAT配置    |
   
 表5UpdateAccessInfo 
| 参数                      | 是否必选 | 参数类型                                                                                                  | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|:---|:---|:---|:---|
| access_type             | 是    | String                                                                                                | **参数说明**：接入地址的类型，如应用接入的HTTPS协议的取值为：APP_HTTPS，设备接入的MQTT协议的取值为：DEVICE_MQTT。 **取值范围**： - APP_HTTPS：应用接入HTTPS协议   - APP_AMQP：应用接入AMQP协议   - APP_MQTT：应用接入MQTT协议   - DEVICE_COAP：设备接入COAP协议   - DEVICE_MQTT：设备接入MQTT协议   - DEVICE_HTTPS：设备接入HTTPS协议    |
| domain_name             | 否    | String                                                                                                | **参数说明**：接入域名，如果需要更新域名，则携带该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| public_addresses_enable | 否    | Boolean                                                                                               | **参数说明**：是否配置公网接入地址。约束：access_type为APP_HTTPS/APP_AMQP/APP_MQTT的公网地址会同时被解绑或绑定。access_type为DEVICE_MQTT/DEVICE_HTTPS的公网地址会同时被解绑或绑定。 **取值范围**： - true：配置公网接入地址，平台将自动分配公网接入地址。   - false: 解绑公网接入地址，解绑公网地址不会被删除，再次配置公网地址将绑定原来的公网地址。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ip_whitelist            | 否    | [IPWhiteList] object | IP白名单 约束：只有企业版实例的APP_HTTPS/APP_AMQP/APP_MQTT协议支持配置IP白名单。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
   
 表6IPWhiteList 
| 参数         | 是否必选 | 参数类型                                                                                                            | 描述                         |
|:---|:---|:---|:---|
| enable     | 是    | Boolean                                                                                                         | **参数说明**：启用Ip白名单访问控制。      |
| allow_list | 否    | Array of [IpAllowList] objects | **参数说明**：允许访问企业版实例的IP地址列表。 |
   
 表7IpAllowList 
| 参数          | 是否必选 | 参数类型   | 描述                |
|:---|:---|:---|:---|
| address     | 是    | String | **参数说明**：白名单ip地址。 |
| description | 否    | String | **参数说明**：描述。      |
   
#### 响应参数
**状态码：200**
表8响应Body参数 
| 参数                    | 参数类型                                                                                                                     | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|
| instance_type         | String                                                                                                                   | **参数说明**：实例类型。 **取值范围**： - standard：标准版实例   - enterprise：企业版实例                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| instance_id           | String                                                                                                                   | **参数说明**：实例ID。 **取值范围**：长度不超过36，由小写字母\[a-f\]、数字、连接符（-）的组成。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| charge_mode           | String                                                                                                                   | **参数说明**：实例的付费方式。 **取值范围**： - prePaid：包年/包月   - postPaid：按需计费                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| name                  | String                                                                                                                   | **参数说明**：实例名称。 **取值范围**：由中文字符，英文字母、数字及"_"、"-"组成，且长度为\[1-64\]个字符。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| flavor                | [Flavor] object                             | **参数说明**：设备接入实例的规格参数。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| status                | String                                                                                                                   | **参数说明**：实例状态。 **取值范围**： - CREATING：实例正在创建   - ACTIVE：实例正常   - FROZEN：实例冻结   - TRADING: 实例正在进行交易   - MODIFYING：实例正在变更规格   - MODIFY_FAILED: 实例变更失败   - FAILED：实例创建失败    |
| region_id             | String                                                                                                                   | **参数说明**：实例所属region。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| description           | String                                                                                                                   | **参数说明**：设备接入实例的描述信息。 **取值范围**：长度不超过256，只允许中文、字母、数字、以及_，,.。、\&-等字符的组合。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| access_infos          | Array of [AccessInfo] objects           | **参数说明**：设备接入实例的接入信息。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| create_time           | String                                                                                                                   | **参数说明**：实例的创建时间。时间格式例如：2023-01-28T06:57:52Z。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| update_time           | String                                                                                                                   | **参数说明**：实例的最近一次更新的时间。时间格式例如：2023-01-28T06:57:52Z。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| enterprise_project_id | String                                                                                                                   | **参数说明**：企业项目Id。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| tags                  | Array of [Tag] objects                         | **参数说明**: 设备接入实例的标签信息。如果实例有标签，则会有该字段，否则该字段为空。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| order_id              | String                                                                                                                   | **参数说明** ：订单号。创建包年包月实例时返回该参数。查看订单详情请参考[查询订单详情](https://support.huaweicloud.com/api-bpconsole/api_order_00014.html)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| operate_window        | [OperateWindow] object               | 实例维护时间窗，用户在变更实例规格时，可以指定在该时间窗内进行变更。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| additional_params     | [AdditionalParamsResp] object | 企业版附加参数信息。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
   
 表9Flavor 
| 参数   | 参数类型    | 描述                                                                                                                                                       |
|:---|:---|:---|
| type | String  | **参数说明** ：待创建设备接入实例的规格名称。详情请参见[产品规格说明](https://support.huaweicloud.com/productdesc-iothub/iot_04_0014.html)中的规格编码。                                       |
| size | Integer | **参数说明** ：待创建设备接入标准版实例的单元数量，企业版不支持该参数。详情请参见[产品规格说明](https://support.huaweicloud.com/productdesc-iothub/iot_04_0014.html)。当instance_type是standard时，该参数必填。 |
   
 表10AccessInfo 
| 参数                | 参数类型                                                                                                   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|:---|:---|:---|
| type              | String                                                                                                 | **参数说明**：接入地址的类型，如应用接入的HTTPS协议的取值为：APP_HTTPS，设备接入的MQTT协议的取值为：DEVICE_MQTT。 **取值范围**： - APP_HTTPS：应用接入HTTPS协议   - APP_AMQP：应用接入AMQP协议   - APP_MQTT：应用接入MQTT协议   - DEVICE_COAP：设备接入COAP协议   - DEVICE_MQTT：设备接入MQTT协议   - DEVICE_HTTPS：设备接入HTTPS协议    |
| port              | Integer                                                                                                | **参数说明**：实例的应用/设备的安全接入端口。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| non_tls_port      | Integer                                                                                                | **参数说明**：实例的应用/设备的非安全接入端口。返回null时表示该类型的接入地址不支持非安全端口接入。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| websocket_port    | Integer                                                                                                | **参数说明**：基于WebSocket的MQTT接入端口。返回null时表示该类型的接入地址不支持WebSocket端口接入。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| domain_name       | String                                                                                                 | **参数说明**：实例的接入域名。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| private_addresses | Array of strings                                                                                       | **参数说明**：实例的私网接入地址列表。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| public_address    | Array of strings                                                                                       | **参数说明**：实例的公网接入地址。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ipv6_address      | Array of strings                                                                                       | **参数说明**：实例的ipv6接入地址列表。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ip_whitelist      | [IPWhiteList] object | IP白名单 约束：只有企业版实例的APP_HTTPS/APP_AMQP/APP_MQTT协议支持配置IP白名单。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
   
 表11IPWhiteList 
| 参数         | 参数类型                                                                                                             | 描述                         |
|:---|:---|:---|
| enable     | Boolean                                                                                                          | **参数说明**：启用Ip白名单访问控制。      |
| allow_list | Array of [IpAllowList] objects | **参数说明**：允许访问企业版实例的IP地址列表。 |
   
 表12IpAllowList 
| 参数          | 参数类型   | 描述                |
|:---|:---|:---|
| address     | String | **参数说明**：白名单ip地址。 |
| description | String | **参数说明**：描述。      |
   
 表13Tag 
| 参数    | 参数类型   | 描述                                                                                     |
|:---|:---|:---|
| key   | String | **参数说明**：标签键，标签的键可用字母(包含中文)、数字、空格和以下字符：下划线(_)点(.)冒号(:)等号(=)加号(+)中划线(-)以及@，首尾不能有空格字符。   |
| value | String | **参数说明**：标签值，可为空字符串和null，标签的值可用字母(包含中文)、数字、空格和以下字符：下划线(_)点(.)冒号(:)等号(=)加号(+)中划线(-)以及@。 |
   
 表14OperateWindow 
| 参数         | 参数类型   | 描述                                   |
|:---|:---|:---|
| start_time | String | **参数说明**：变更时间窗开始时间，UTC时间，格式为："HH:mm" |
| end_time   | String | **参数说明**：变更时间窗结束时间，UTC时间，格式为："HH:mm" |
   
 表15AdditionalParamsResp 
| 参数                  | 参数类型                                                                                                         | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|
| vpc_id              | String                                                                                                       | **参数说明**：企业版实例的VPCID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| subnet_id           | String                                                                                                       | **参数说明**：企业版实例的子网ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| security_group_id   | String                                                                                                       | **参数说明**：企业版实例的安全组ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ciphering_algorithm | String                                                                                                       | **参数说明**：实例支持的加密算法。 **取值范围**： - COMMON_ALGORITHM: 通用加密算法（支持RSA，SHA256等国际通用的密码算法）   - SM_ALGORITHM: 支持SM系列商密算法（支持SM2，SM3，SM4等国密算法）    |
| forwarding_info     | [ForwardingInfo] object | 企业版实例的SNAT配置信息。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
   
 表16ForwardingInfo 
| 参数          | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
|:---|:---|:---|
| eip         | String  | **参数说明**：NAT网关绑定的EIP。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| enable_snat | Boolean | **参数说明**：是否启用SNAT配置。 **取值范围**： - true: SNAT配置已启用   - false: SNAT配置未启用    |
   
#### 请求示例
- 修改实例名称、描述和操作时间窗。
  ```
  PUT https://{endpoint}/v5/iot/{project_id}/iotda-instances/{instance_id}
  {
    "name" : "iotda_instance01",
    "description" : "IoTDA instance for test.",
    "operate_window" : {
      "start_time" : "18:00",
      "end_time" : "22:00"
    }
  }
  ```
  
- 企业版实例启用公网流转SNAT配置。
  ```
  PUT https://{endpoint}/v5/iot/{project_id}/iotda-instances/{instance_id}
  {
    "forwarding_info" : {
      "enable_snat" : "true"
    }
  }
  ```
  
- 企业版实例修改实例接入信息。
  ```
  PUT https://{endpoint}/v5/iot/{project_id}/iotda-instances/{instance_id}
  {
    "access_info" : {
      "access_type" : "APP_HTTPS",
      "domain_name" : "example.xxxx.com",
      "public_addresses_enable" : true
    }
  }
  ```
  
 
#### 响应示例
**状态码：200**
OK
```
{
  "instance_type" : "standard",
  "instance_id" : "8561675c-d8a3-4956-9884-9cf9cbdd3134",
  "charge_mode" : "prePaid",
  "name" : "iotda_instance",
  "flavor" : {
    "type" : "iotda.standard.s1",
    "size" : 1
  },
  "status" : "ACTIVE",
  "region_id" : "cn-north-4",
  "create_time" : "2023-01-28T06:57:52Z",
  "update_time" : "2023-01-28T06:58:52Z",
  "description" : "IoTDA instance for production.",
  "access_infos" : [ {
    "type" : "APP_AMQP",
    "port" : 5671,
    "non_tls_port" : null,
    "websocket_port" : null,
    "domain_name" : "example.xxxx.com",
    "public_address" : [ ],
    "ipv6_address" : [ ],
    "ip_whitelist" : null
  }, {
    "type" : "APP_HTTPS",
    "port" : 443,
    "non_tls_port" : null,
    "websocket_port" : null,
    "domain_name" : "example1.xxxx.com",
    "public_address" : [ ],
    "ipv6_address" : [ ],
    "ip_whitelist" : null
  }, {
    "type" : "DEVICE_MQTT",
    "port" : 8883,
    "non_tls_port" : 1883,
    "websocket_port" : 443,
    "domain_name" : "example2.xxxx.com",
    "public_address" : [ ],
    "ipv6_address" : [ ],
    "ip_whitelist" : null
  }, {
    "type" : "DEVICE_COAP",
    "port" : 5684,
    "non_tls_port" : 5683,
    "websocket_port" : null,
    "domain_name" : "example3.xxxx.com",
    "public_address" : [ ],
    "ipv6_address" : [ ],
    "ip_whitelist" : null
  } ],
  "enterprise_project_id" : "d22e47e9-cfad-4254-8a29-d2a56a07681d",
  "tags" : [ {
    "key" : "testTagName",
    "value" : "testTagValue"
  } ],
  "order_id" : "CS22121614500ABCD",
  "operate_window" : {
    "start_time" : "22:00",
    "end_time" : "24:00"
  },
  "additional_params" : null
}
```
#### SDK代码示例
SDK代码示例如下。
- [Java]
  - 修改实例名称、描述和操作时间窗。
    ```
    package com.huaweicloud.sdk.test;
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.iotdm.v5.region.IoTDMRegion;
    import com.huaweicloud.sdk.iotdm.v5.*;
    import com.huaweicloud.sdk.iotdm.v5.model.*;
    public class UpdateInstanceSolution {
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
            IoTDMClient client = IoTDMClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(IoTDMRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateInstanceRequest request = new UpdateInstanceRequest();
            request.withInstanceId("{instance_id}");
            UpdateInstance body = new UpdateInstance();
            OperateWindow operateWindowbody = new OperateWindow();
            operateWindowbody.withStartTime("18:00")
                .withEndTime("22:00");
            body.withOperateWindow(operateWindowbody);
            body.withDescription("IoTDA instance for test.");
            body.withName("iotda_instance01");
            request.withBody(body);
            try {
                UpdateInstanceResponse response = client.updateInstance(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    ```
    
  
  - 企业版实例启用公网流转SNAT配置。
    ```
    package com.huaweicloud.sdk.test;
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.iotdm.v5.region.IoTDMRegion;
    import com.huaweicloud.sdk.iotdm.v5.*;
    import com.huaweicloud.sdk.iotdm.v5.model.*;
    public class UpdateInstanceSolution {
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
            IoTDMClient client = IoTDMClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(IoTDMRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateInstanceRequest request = new UpdateInstanceRequest();
            request.withInstanceId("{instance_id}");
            UpdateInstance body = new UpdateInstance();
            UpdateForwardingInfo forwardingInfobody = new UpdateForwardingInfo();
            forwardingInfobody.withEnableSnat(true);
            body.withForwardingInfo(forwardingInfobody);
            request.withBody(body);
            try {
                UpdateInstanceResponse response = client.updateInstance(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    ```
    
  
  - 企业版实例修改实例接入信息。
    ```
    package com.huaweicloud.sdk.test;
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.iotdm.v5.region.IoTDMRegion;
    import com.huaweicloud.sdk.iotdm.v5.*;
    import com.huaweicloud.sdk.iotdm.v5.model.*;
    public class UpdateInstanceSolution {
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
            IoTDMClient client = IoTDMClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(IoTDMRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateInstanceRequest request = new UpdateInstanceRequest();
            request.withInstanceId("{instance_id}");
            UpdateInstance body = new UpdateInstance();
            UpdateAccessInfo accessInfobody = new UpdateAccessInfo();
            accessInfobody.withAccessType("APP_HTTPS")
                .withDomainName("example.xxxx.com")
                .withPublicAddressesEnable(true);
            body.withAccessInfo(accessInfobody);
            request.withBody(body);
            try {
                UpdateInstanceResponse response = client.updateInstance(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    ```
    
   
- [Python]
  - 修改实例名称、描述和操作时间窗。
    ```
    # coding: utf-8
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkiotdm.v5.region.iotdm_region import IoTDMRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkiotdm.v5 import *
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
        credentials = BasicCredentials(ak, sk, projectId)
        client = IoTDMClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(IoTDMRegion.value_of("<YOUR REGION>")) \
            .build()
        try:
            request = UpdateInstanceRequest()
            request.instance_id = "{instance_id}"
            operateWindowbody = OperateWindow(
                start_time="18:00",
                end_time="22:00"
            )
            request.body = UpdateInstance(
                operate_window=operateWindowbody,
                description="IoTDA instance for test.",
                name="iotda_instance01"
            )
            response = client.update_instance(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    ```
    
  
  - 企业版实例启用公网流转SNAT配置。
    ```
    # coding: utf-8
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkiotdm.v5.region.iotdm_region import IoTDMRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkiotdm.v5 import *
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
        credentials = BasicCredentials(ak, sk, projectId)
        client = IoTDMClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(IoTDMRegion.value_of("<YOUR REGION>")) \
            .build()
        try:
            request = UpdateInstanceRequest()
            request.instance_id = "{instance_id}"
            forwardingInfobody = UpdateForwardingInfo(
                enable_snat=True
            )
            request.body = UpdateInstance(
                forwarding_info=forwardingInfobody
            )
            response = client.update_instance(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    ```
    
  
  - 企业版实例修改实例接入信息。
    ```
    # coding: utf-8
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkiotdm.v5.region.iotdm_region import IoTDMRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkiotdm.v5 import *
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
        credentials = BasicCredentials(ak, sk, projectId)
        client = IoTDMClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(IoTDMRegion.value_of("<YOUR REGION>")) \
            .build()
        try:
            request = UpdateInstanceRequest()
            request.instance_id = "{instance_id}"
            accessInfobody = UpdateAccessInfo(
                access_type="APP_HTTPS",
                domain_name="example.xxxx.com",
                public_addresses_enable=True
            )
            request.body = UpdateInstance(
                access_info=accessInfobody
            )
            response = client.update_instance(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    ```
    
   
- [Go]
  - 修改实例名称、描述和操作时间窗。
    ```
    package main
    import (
    "fmt"
    "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        iotdm "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5"
    "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5/region"
    )
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
        auth, err := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            SafeBuild()
        if err != nil {
            fmt.Println(err)
            return
        }
        hcClient, err := iotdm.IoTDMClientBuilder().
             WithRegion(region.ValueOf("<YOUR REGION>")).
             WithCredential(auth).
             SafeBuild()
        if err != nil {
            fmt.Println(err)
            return
        }
        client := iotdm.NewIoTDMClient(hcClient)
        request := &model.UpdateInstanceRequest{}
    request.InstanceId = "{instance_id}"
    operateWindowbody := &model.OperateWindow{
    StartTime: "18:00",
    EndTime: "22:00",
    }
    descriptionUpdateInstance:= "IoTDA instance for test."
    nameUpdateInstance:= "iotda_instance01"
    request.Body = &model.UpdateInstance{
    OperateWindow: operateWindowbody,
    Description: &descriptionUpdateInstance,
    Name: &nameUpdateInstance,
    }
    response, err := client.UpdateInstance(request)
    if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    ```
    
  
  - 企业版实例启用公网流转SNAT配置。
    ```
    package main
    import (
    "fmt"
    "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        iotdm "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5"
    "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5/region"
    )
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
        auth, err := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            SafeBuild()
        if err != nil {
            fmt.Println(err)
            return
        }
        hcClient, err := iotdm.IoTDMClientBuilder().
             WithRegion(region.ValueOf("<YOUR REGION>")).
             WithCredential(auth).
             SafeBuild()
        if err != nil {
            fmt.Println(err)
            return
        }
        client := iotdm.NewIoTDMClient(hcClient)
        request := &model.UpdateInstanceRequest{}
    request.InstanceId = "{instance_id}"
    forwardingInfobody := &model.UpdateForwardingInfo{
    EnableSnat: true,
    }
    request.Body = &model.UpdateInstance{
    ForwardingInfo: forwardingInfobody,
    }
    response, err := client.UpdateInstance(request)
    if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    ```
    
  
  - 企业版实例修改实例接入信息。
    ```
    package main
    import (
    "fmt"
    "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        iotdm "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5"
    "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5/region"
    )
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
        auth, err := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            SafeBuild()
        if err != nil {
            fmt.Println(err)
            return
        }
        hcClient, err := iotdm.IoTDMClientBuilder().
             WithRegion(region.ValueOf("<YOUR REGION>")).
             WithCredential(auth).
             SafeBuild()
        if err != nil {
            fmt.Println(err)
            return
        }
        client := iotdm.NewIoTDMClient(hcClient)
        request := &model.UpdateInstanceRequest{}
    request.InstanceId = "{instance_id}"
    domainNameAccessInfo:= "example.xxxx.com"
    publicAddressesEnableAccessInfo:= true
    accessInfobody := &model.UpdateAccessInfo{
    AccessType: "APP_HTTPS",
    DomainName: &domainNameAccessInfo,
    PublicAddressesEnable: &publicAddressesEnableAccessInfo,
    }
    request.Body = &model.UpdateInstance{
    AccessInfo: accessInfobody,
    }
    response, err := client.UpdateInstance(request)
    if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    ```
    
   
- [更多]
  更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/IoTDM/sdk?api=UpdateInstance)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述           |
|:---|:---|
| 200 | OK           |
| 400 | Bad Request  |
| 401 | Unauthorized |
| 403 | Forbidden    |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-iothub/ErrorCode.html)。
