Search in sources :

Example 1 with NamespaceAllInfo

use of com.alibaba.nacos.model.NamespaceAllInfo in project XHuiCloud by sindaZeng.

the class NamespaceController method getNamespace.

/**
 * get namespace all info by namespace id.
 * @param request request
 * @param response response
 * @param namespaceId namespaceId
 * @return namespace all info
 */
@GetMapping(params = "show=all")
public NamespaceAllInfo getNamespace(HttpServletRequest request, HttpServletResponse response, @RequestParam("namespaceId") String namespaceId) {
    // TODO 获取用kp
    if (StringUtils.isBlank(namespaceId)) {
        return new NamespaceAllInfo(namespaceId, DEFAULT_NAMESPACE_SHOW_NAME, DEFAULT_QUOTA, persistService.configInfoCount(DEFAULT_TENANT), NamespaceTypeEnum.GLOBAL.getType(), DEFAULT_NAMESPACE_DESCRIPTION);
    } else {
        TenantInfo tenantInfo = persistService.findTenantByKp(DEFAULT_KP, namespaceId);
        int configCount = persistService.configInfoCount(namespaceId);
        return new NamespaceAllInfo(namespaceId, tenantInfo.getTenantName(), DEFAULT_QUOTA, configCount, NamespaceTypeEnum.CUSTOM.getType(), tenantInfo.getTenantDesc());
    }
}
Also used : NamespaceAllInfo(com.alibaba.nacos.model.NamespaceAllInfo) TenantInfo(com.alibaba.nacos.config.server.model.TenantInfo)

Aggregations

TenantInfo (com.alibaba.nacos.config.server.model.TenantInfo)1 NamespaceAllInfo (com.alibaba.nacos.model.NamespaceAllInfo)1