
# 校验DB账号 - AccountVerify
#### 功能介绍
此接口用于校验DB账号
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-testman/cloudtest_03_2000.html)。
#### URI
POST /v4/passwd/legality
#### 请求参数
表1请求Body参数 
| 参数                 | 是否必选 | 参数类型                                                                              | 描述       |
|:---|:---|:---|:---|
| accountDescription | 否    | String                                                                            | 账号描述     |
| accountName        | 否    | String                                                                            | 账号名称     |
| accountStatus      | 否    | Integer                                                                           | 账号状态     |
| accountType        | 否    | Integer                                                                           | 账号类型     |
| osAccountSshConfig | 否    | Array of [osAccountSshConfig] objects | SSH配置对象  |
| complexityId       | 否    | String                                                                            | 复杂度ID    |
| componentId        | 否    | String                                                                            | 组件ID     |
| componentName      | 否    | String                                                                            | 组件名称     |
| deviceId           | 否    | String                                                                            | 设备ID     |
| groups             | 否    | Array of strings                                                                  | 用户组列表    |
| id                 | 否    | String                                                                            | 账号ID     |
| ip                 | 否    | String                                                                            | IP地址     |
| lastPasswdChange   | 否    | Long                                                                              | 上次密码变更时间 |
| operationType      | 否    | Long                                                                              | 操作类型     |
| passwdExpires      | 否    | Long                                                                              | 密码过期时间   |
| passwdNew          | 否    | String                                                                            | 新密码      |
| region             | 否    | String                                                                            | 区域       |
| registerStatus     | 否    | Long                                                                              | 注册状态     |
| relativeAccount    | 否    | Array of Map\<String,\> objects                                                   | 关联账号列表   |
| status             | 否    | Integer                                                                           | 状态       |
| subComponentName   | 否    | String                                                                            | 子组件名称    |
| urlValid           | 否    | String                                                                            | URL有效性   |
| usedScene          | 否    | String                                                                            | 使用场景     |
| visible            | 否    | Integer                                                                           | 可见性      |
   
 表2osAccountSshConfig 
| 参数                | 是否必选 | 参数类型    | 描述        |
|:---|:---|:---|:---|
| isSupportSshLogin | 否    | Boolean | 是否支持SSH登录 |
| switchFrom        | 否    | String  | 切换来源      |
| switchCommand     | 否    | String  | 切换命令      |
   
#### 响应参数
**状态码：200**
表3响应Body参数 
| 参数         | 参数类型   | 描述                              |
|:---|:---|:---|
| resultCode | String | 结果码，00000000 表示成功，00000001 表示失败 |
| errMsg     | String | 结果信息，SUCCESS 表示成功，FAILED 表示失败   |
   
**状态码：400**
表4响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                  |
|:---|:---|:---|
| error_code | String | **参数解释** 接口调用失败错误码 **取值范围** 不涉及  |
| error_msg  | String | **参数解释** 接口调用失败错误信息 **取值范围** 不涉及 |
   
**状态码：500**
表5响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                  |
|:---|:---|:---|
| error_code | String | **参数解释** 接口调用失败错误码 **取值范围** 不涉及  |
| error_msg  | String | **参数解释** 接口调用失败错误信息 **取值范围** 不涉及 |
   
#### 请求示例
校验DB账号
```
POST https://{endpoint}/v4/passwd/legality
{
  "accountDescription" : "测试账号",
  "accountName" : "test_user",
  "accountStatus" : 1,
  "accountType" : 1,
  "osAccountSshConfig" : {
    "isSupportSshLogin" : true,
    "switchFrom" : "root",
    "switchCommand" : "su - test_user"
  },
  "complexityId" : "complex_001",
  "componentId" : "comp_001",
  "componentName" : "组件A",
  "deviceId" : "dev_001",
  "groups" : [ "group1", "group2" ],
  "id" : "001",
  "ip" : "192.168.1.100",
  "lastPasswdChange" : 1719100000000,
  "operationType" : 1,
  "passwdExpires" : 1721700000000,
  "passwdNew" : "Passw0rd!@#",
  "region" : "cn-north-1",
  "registerStatus" : 1,
  "relativeAccount" : [ {
    "accountName" : "rel_user",
    "accountStatus" : 1,
    "passwdNew" : "RelPass0rd!@#",
    "id" : "002"
  } ],
  "status" : 1,
  "subComponentName" : "子组件A",
  "urlValid" : "true",
  "usedScene" : "production",
  "visible" : 1
}
```
#### 响应示例
**状态码：200**
OK
```
{
  "resultCode" : "00000000",
  "errMsg" : "SUCCESS"
}
```
**状态码：400**
Bad Request
```
{
  "error_code" : "CLOUDTEST.00000001",
  "error_msg" : "返回的错误信息"
}
```
**状态码：500**
Internal Server Error
```
{
  "error_code" : "CLOUDTEST.00000001",
  "error_msg" : "返回的错误信息"
}
```
#### 状态码
| 状态码 | 描述                    |
|:---|:---|
| 200 | OK                    |
| 400 | Bad Request           |
| 500 | Internal Server Error |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-testman/ErrorCode.html)。
