use of com.alibaba.nacos.config.server.model.ConfigInfo in project nacos by alibaba.
the class ConfigController method deleteConfigs.
/**
* Execute delete config operation.
*
* @return java.lang.Boolean
* @author klw
* @Description: delete configuration based on multiple config ids
* @Date 2019/7/5 10:26
* @Param [request, response, dataId, group, tenant, tag]
*/
@DeleteMapping(params = "delType=ids")
@Secured(action = ActionTypes.WRITE, parser = ConfigResourceParser.class)
public RestResult<Boolean> deleteConfigs(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "ids") List<Long> ids) {
String clientIp = RequestUtil.getRemoteIp(request);
final Timestamp time = TimeUtils.getCurrentTime();
List<ConfigInfo> configInfoList = persistService.removeConfigInfoByIds(ids, clientIp, null);
if (CollectionUtils.isEmpty(configInfoList)) {
return RestResultUtils.success(true);
}
for (ConfigInfo configInfo : configInfoList) {
ConfigChangePublisher.notifyConfigChange(new ConfigDataChangeEvent(false, configInfo.getDataId(), configInfo.getGroup(), configInfo.getTenant(), time.getTime()));
ConfigTraceService.logPersistenceEvent(configInfo.getDataId(), configInfo.getGroup(), configInfo.getTenant(), null, time.getTime(), clientIp, ConfigTraceService.PERSISTENCE_EVENT_REMOVE, null);
}
return RestResultUtils.success(true);
}
Aggregations