-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 提供账号查询、创建、删除的APIGW接口 #2472 #2495
feat: 提供账号查询、创建、删除的APIGW接口 #2472 #2495
Conversation
7d64856
to
089672a
Compare
089672a
to
e5b0a5e
Compare
| alias | string | 账号别名 | | ||
| category | int | 账号用途(1:系统账号) | | ||
| type | int | 账号类型(1:Linux,2:Windows)| | ||
| db_system_account_id | long | 账号用途为数据库账号时该字段生效,表示数据库账号对应的系统账号ID | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个先去掉,这个 API 暂时还不支持 DB 账号的话
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已去除
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -62,3 +62,10 @@ validation.constraints.InvalidFileUploadSettingAmount.message=文件大小只能 | |||
validation.constraints.InvalidPort.message=端口号只能为1-65535之间的整数 | |||
validation.constraints.NotContainSpecialChar.message=不可包含 \\|/:*<>"? 特殊字符 | |||
validation.constraints.NotBlankField.message=不能为空 | |||
validation.constraints.AccountId_empty.message=账号ID不能为空 | |||
validation.constraints.AccountName_empty.message=账号名称[account]不能为空 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不建议在错误提示里边加入字段信息。
- 这个报错是给用户看的
- 关于字段校验报错的提示优化,后续在 API 整改的时候会按照蓝鲸新版规范,放到 details 里边,给开发看
{
"error": {
"code": "AuthFailure",
"message": "The provided credentials could not be validated. Please check your signature is correct.",
"system": "bkiam",
"details": [{
"code": "SignatureFailure",
"message": "",
# 其他字段, 不强制,可自由扩展(有助于定位问题/解决问题就行)
"module": "auth",
"links": "",
"doc": ""
}],
"data": {}
}
}
- 会导致报错信息不通用。比如 web/esb 的 API 可能用的是不同的字段名,但是在校验字段的时候却需要共享同一个报错信息
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, | ||
@RequestParam(value = "bk_scope_type", required = false) String scopeType, | ||
@RequestParam(value = "bk_scope_id", required = false) String scopeId, | ||
@RequestParam(value = "id") Long id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete + query param 的设计比较奇怪。要不直接就使用标准的 DELETE /account/{accountID}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -65,4 +68,39 @@ EsbResp<EsbPageDataV3<EsbAccountV3DTO>> getAccountList( | |||
@RequestParam(value = "start", required = false) Integer start, | |||
@RequestParam(value = "length", required = false) Integer length); | |||
|
|||
@GetMapping("/search_account") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是直接扩展 get_account_list 就可以了?get_account_list 也是分页检索账号功能
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
/** | ||
* 账号用途:1-系统账号,2-数据库账号 | ||
*/ | ||
@NotNull(message = "{validation.constraints.AccountCategory_empty.message}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有对类型的值进行校验。可以使用 @CheckEnum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
* 账号类型:1-Linux,2-Windows,9-Mysql,10-Oracle,11-DB2 | ||
*/ | ||
@NotNull(message = "{validation.constraints.AccountType_empty.message}") | ||
private Integer type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有对类型的值进行校验。可以使用 @CheckEnum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
* 帐号名称 | ||
*/ | ||
@NotEmpty(message = "{validation.constraints.AccountName_empty.message}") | ||
private String account; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
账号长度是否有限制?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
具体规则在业务逻辑中根据账号命名规则校验。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
/** | ||
* 是否有权限使用 | ||
*/ | ||
@JsonProperty("can_use") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can_use 这个字段比较局限;建议改成 allow_action_ids = [use_account] 这种,后续其他的资源也可以统一。而且把预鉴权放到资源对象里边设计上也有点奇怪,看下是否有更好的方案
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已去除。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
e909183
to
a50d4b1
Compare
a50d4b1
to
f62e4d3
Compare
增加接口文档