feat: 修改主机额外配置.

This commit is contained in:
lijiahang
2023-12-25 19:03:24 +08:00
parent b2a697f6ba
commit f7cbd7b507
34 changed files with 321 additions and 59 deletions

View File

@@ -58,7 +58,7 @@ public class HostExtraController {
return hostExtraService.getHostExtraList(request);
}
@GetMapping("/update")
@PutMapping("/update")
@Operation(summary = "修改主机拓展信息")
public Integer updateHostExtra(@Validated @RequestBody HostExtraUpdateRequest request) {
return hostExtraService.updateHostExtra(request);

View File

@@ -15,14 +15,14 @@ public enum HostExtraSshAuthTypeEnum {
DEFAULT,
/**
* 秘钥验证
* 自定义秘钥验证
*/
KEY,
CUSTOM_KEY,
/**
* 身份验证
* 自定义身份验证
*/
IDENTITY,
CUSTOM_IDENTITY,
;

View File

@@ -55,9 +55,9 @@ public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel>
Long keyId = model.getKeyId();
Long identityId = model.getIdentityId();
// 必填验证
if (HostExtraSshAuthTypeEnum.KEY.equals(authType)) {
if (HostExtraSshAuthTypeEnum.CUSTOM_KEY.equals(authType)) {
Valid.notNull(keyId);
} else if (HostExtraSshAuthTypeEnum.IDENTITY.equals(authType)) {
} else if (HostExtraSshAuthTypeEnum.CUSTOM_IDENTITY.equals(authType)) {
Valid.notNull(identityId);
}
// 验证主机秘钥是否存在

View File

@@ -243,7 +243,6 @@ public class AssetAuthorizedDataServiceImpl implements AssetAuthorizedDataServic
List<Long> authorizedGroupIdList) {
// 查询主机列表
List<HostVO> hosts = hostService.getHostListByCache();
// 全部数据直接返回
if (allData) {
return hosts;
@@ -258,6 +257,7 @@ public class AssetAuthorizedDataServiceImpl implements AssetAuthorizedDataServic
.map(dataGroupRel::get)
.filter(Lists::isNoneEmpty)
.flatMap(Collection::stream)
.distinct()
.map(hostMap::get)
.filter(Objects::nonNull)
.collect(Collectors.toList());