com.nepxion.discovery.console.rest.SentinelClearRestInvoker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of discovery-console Show documentation
Show all versions of discovery-console Show documentation
Nepxion Discovery is an enhancement for Spring Cloud Discovery
package com.nepxion.discovery.console.rest;
/**
* Title: Nepxion Discovery
* Description: Nepxion Discovery
* Copyright: Copyright (c) 2017-2050
* Company: Nepxion
* @author Haojun Ren
* @version 1.0
*/
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.web.client.RestTemplate;
public class SentinelClearRestInvoker extends AbstractRestInvoker {
private String type;
public SentinelClearRestInvoker(List serviceInstances, RestTemplate restTemplate, String type) {
super(serviceInstances, restTemplate);
this.type = type.trim();
}
@Override
protected String getInfo() {
return "Sentinel rules cleared";
}
@Override
protected String getSuffixPath() {
return getPrefixPath(type) + "/clear-" + type + "-rules";
}
@Override
protected String doRest(String url) {
return restTemplate.postForEntity(url, null, String.class).getBody();
}
@Override
protected void checkPermission(ServiceInstance serviceInstance) throws Exception {
checkConfigRestControlPermission(serviceInstance);
}
private String getPrefixPath(String type) {
return StringUtils.equals(type, "param-flow") ? "sentinel-param" : "sentinel-core";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy