Search in sources :

Example 1 with ServerFlowConfig

use of com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig in project spring-boot-student by wyh-spring-ecosystem-student.

the class ClusterConfigService method modifyClusterServerConfig.

public CompletableFuture<Void> modifyClusterServerConfig(ClusterServerModifyRequest request) {
    ServerTransportConfig transportConfig = request.getTransportConfig();
    ServerFlowConfig flowConfig = request.getFlowConfig();
    Set<String> namespaceSet = request.getNamespaceSet();
    if (invalidTransportConfig(transportConfig)) {
        throw new IllegalArgumentException("Invalid transport config in request");
    }
    if (invalidFlowConfig(flowConfig)) {
        throw new IllegalArgumentException("Invalid flow config in request");
    }
    if (namespaceSet == null) {
        throw new IllegalArgumentException("namespace set cannot be null");
    }
    String app = request.getApp();
    String ip = request.getIp();
    int port = request.getPort();
    return sentinelApiClient.modifyClusterServerNamespaceSet(app, ip, port, namespaceSet).thenCompose(v -> sentinelApiClient.modifyClusterServerTransportConfig(app, ip, port, transportConfig)).thenCompose(v -> sentinelApiClient.modifyClusterServerFlowConfig(app, ip, port, flowConfig)).thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_SERVER));
}
Also used : AppManagement(com.alibaba.csp.sentinel.dashboard.discovery.AppManagement) ClusterServerModifyRequest(com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest) ClusterUniversalStateVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStateVO) ClusterGroupEntity(com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity) ClusterClientStateVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterClientStateVO) Set(java.util.Set) Autowired(org.springframework.beans.factory.annotation.Autowired) CompletableFuture(java.util.concurrent.CompletableFuture) Collectors(java.util.stream.Collectors) AppInfo(com.alibaba.csp.sentinel.dashboard.discovery.AppInfo) ArrayList(java.util.ArrayList) ClusterClientModifyRequest(com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest) AsyncUtils(com.alibaba.csp.sentinel.dashboard.util.AsyncUtils) StringUtil(com.alibaba.csp.sentinel.util.StringUtil) ServerFlowConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig) List(java.util.List) ServerTransportConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig) SentinelApiClient(com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient) Service(org.springframework.stereotype.Service) ClusterUniversalStatePairVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO) ClusterEntityUtils(com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils) ClusterClientConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig) ClusterStateManager(com.alibaba.csp.sentinel.cluster.ClusterStateManager) ServerFlowConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig) ServerTransportConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig)

Example 2 with ServerFlowConfig

use of com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig in project Sentinel by alibaba.

the class ClusterConfigService method modifyClusterServerConfig.

public CompletableFuture<Void> modifyClusterServerConfig(ClusterServerModifyRequest request) {
    ServerTransportConfig transportConfig = request.getTransportConfig();
    ServerFlowConfig flowConfig = request.getFlowConfig();
    Set<String> namespaceSet = request.getNamespaceSet();
    if (invalidTransportConfig(transportConfig)) {
        throw new IllegalArgumentException("Invalid transport config in request");
    }
    if (invalidFlowConfig(flowConfig)) {
        throw new IllegalArgumentException("Invalid flow config in request");
    }
    if (namespaceSet == null) {
        throw new IllegalArgumentException("namespace set cannot be null");
    }
    String app = request.getApp();
    String ip = request.getIp();
    int port = request.getPort();
    return sentinelApiClient.modifyClusterServerNamespaceSet(app, ip, port, namespaceSet).thenCompose(v -> sentinelApiClient.modifyClusterServerTransportConfig(app, ip, port, transportConfig)).thenCompose(v -> sentinelApiClient.modifyClusterServerFlowConfig(app, ip, port, flowConfig)).thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_SERVER));
}
Also used : AppManagement(com.alibaba.csp.sentinel.dashboard.discovery.AppManagement) ClusterServerModifyRequest(com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest) ClusterUniversalStateVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStateVO) ClusterGroupEntity(com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity) ClusterClientStateVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterClientStateVO) Set(java.util.Set) Autowired(org.springframework.beans.factory.annotation.Autowired) CompletableFuture(java.util.concurrent.CompletableFuture) Collectors(java.util.stream.Collectors) AppInfo(com.alibaba.csp.sentinel.dashboard.discovery.AppInfo) ArrayList(java.util.ArrayList) ClusterClientModifyRequest(com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest) AsyncUtils(com.alibaba.csp.sentinel.dashboard.util.AsyncUtils) StringUtil(com.alibaba.csp.sentinel.util.StringUtil) ServerFlowConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig) List(java.util.List) ServerTransportConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig) SentinelApiClient(com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient) Service(org.springframework.stereotype.Service) ClusterUniversalStatePairVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO) ClusterEntityUtils(com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils) ClusterClientConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig) ClusterStateManager(com.alibaba.csp.sentinel.cluster.ClusterStateManager) ServerFlowConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig) ServerTransportConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig)

Example 3 with ServerFlowConfig

use of com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig in project pig by pig-mesh.

the class ClusterConfigService method modifyClusterServerConfig.

public CompletableFuture<Void> modifyClusterServerConfig(ClusterServerModifyRequest request) {
    ServerTransportConfig transportConfig = request.getTransportConfig();
    ServerFlowConfig flowConfig = request.getFlowConfig();
    Set<String> namespaceSet = request.getNamespaceSet();
    if (invalidTransportConfig(transportConfig)) {
        throw new IllegalArgumentException("Invalid transport config in request");
    }
    if (invalidFlowConfig(flowConfig)) {
        throw new IllegalArgumentException("Invalid flow config in request");
    }
    if (namespaceSet == null) {
        throw new IllegalArgumentException("namespace set cannot be null");
    }
    String app = request.getApp();
    String ip = request.getIp();
    int port = request.getPort();
    return sentinelApiClient.modifyClusterServerNamespaceSet(app, ip, port, namespaceSet).thenCompose(v -> sentinelApiClient.modifyClusterServerTransportConfig(app, ip, port, transportConfig)).thenCompose(v -> sentinelApiClient.modifyClusterServerFlowConfig(app, ip, port, flowConfig)).thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_SERVER));
}
Also used : AppManagement(com.alibaba.csp.sentinel.dashboard.discovery.AppManagement) ClusterServerModifyRequest(com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest) ClusterUniversalStateVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStateVO) ClusterGroupEntity(com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity) ClusterClientStateVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterClientStateVO) Set(java.util.Set) Autowired(org.springframework.beans.factory.annotation.Autowired) CompletableFuture(java.util.concurrent.CompletableFuture) Collectors(java.util.stream.Collectors) AppInfo(com.alibaba.csp.sentinel.dashboard.discovery.AppInfo) ArrayList(java.util.ArrayList) ClusterClientModifyRequest(com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest) AsyncUtils(com.alibaba.csp.sentinel.dashboard.util.AsyncUtils) StringUtil(com.alibaba.csp.sentinel.util.StringUtil) ServerFlowConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig) List(java.util.List) ServerTransportConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig) SentinelApiClient(com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient) Service(org.springframework.stereotype.Service) ClusterUniversalStatePairVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO) ClusterEntityUtils(com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils) ClusterClientConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig) ClusterStateManager(com.alibaba.csp.sentinel.cluster.ClusterStateManager) ServerFlowConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig) ServerTransportConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig)

Example 4 with ServerFlowConfig

use of com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig in project XHuiCloud by sindaZeng.

the class ClusterConfigService method modifyClusterServerConfig.

public CompletableFuture<Void> modifyClusterServerConfig(ClusterServerModifyRequest request) {
    ServerTransportConfig transportConfig = request.getTransportConfig();
    ServerFlowConfig flowConfig = request.getFlowConfig();
    Set<String> namespaceSet = request.getNamespaceSet();
    if (invalidTransportConfig(transportConfig)) {
        throw new IllegalArgumentException("Invalid transport config in request");
    }
    if (invalidFlowConfig(flowConfig)) {
        throw new IllegalArgumentException("Invalid flow config in request");
    }
    if (namespaceSet == null) {
        throw new IllegalArgumentException("namespace set cannot be null");
    }
    String app = request.getApp();
    String ip = request.getIp();
    int port = request.getPort();
    return sentinelApiClient.modifyClusterServerNamespaceSet(app, ip, port, namespaceSet).thenCompose(v -> sentinelApiClient.modifyClusterServerTransportConfig(app, ip, port, transportConfig)).thenCompose(v -> sentinelApiClient.modifyClusterServerFlowConfig(app, ip, port, flowConfig)).thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_SERVER));
}
Also used : AppManagement(com.alibaba.csp.sentinel.dashboard.discovery.AppManagement) ClusterServerModifyRequest(com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest) ClusterUniversalStateVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStateVO) ClusterGroupEntity(com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity) ClusterClientStateVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterClientStateVO) Set(java.util.Set) Autowired(org.springframework.beans.factory.annotation.Autowired) CompletableFuture(java.util.concurrent.CompletableFuture) Collectors(java.util.stream.Collectors) AppInfo(com.alibaba.csp.sentinel.dashboard.discovery.AppInfo) ArrayList(java.util.ArrayList) ClusterClientModifyRequest(com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest) AsyncUtils(com.alibaba.csp.sentinel.dashboard.util.AsyncUtils) StringUtil(com.alibaba.csp.sentinel.util.StringUtil) ServerFlowConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig) List(java.util.List) ServerTransportConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig) SentinelApiClient(com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient) Service(org.springframework.stereotype.Service) ClusterUniversalStatePairVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO) ClusterEntityUtils(com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils) ClusterClientConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig) ClusterStateManager(com.alibaba.csp.sentinel.cluster.ClusterStateManager) ServerFlowConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig) ServerTransportConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig)

Example 5 with ServerFlowConfig

use of com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig in project RuoYi-Cloud-Plus by JavaLionLi.

the class ClusterConfigService method modifyClusterServerConfig.

public CompletableFuture<Void> modifyClusterServerConfig(ClusterServerModifyRequest request) {
    ServerTransportConfig transportConfig = request.getTransportConfig();
    ServerFlowConfig flowConfig = request.getFlowConfig();
    Set<String> namespaceSet = request.getNamespaceSet();
    if (invalidTransportConfig(transportConfig)) {
        throw new IllegalArgumentException("Invalid transport config in request");
    }
    if (invalidFlowConfig(flowConfig)) {
        throw new IllegalArgumentException("Invalid flow config in request");
    }
    if (namespaceSet == null) {
        throw new IllegalArgumentException("namespace set cannot be null");
    }
    String app = request.getApp();
    String ip = request.getIp();
    int port = request.getPort();
    return sentinelApiClient.modifyClusterServerNamespaceSet(app, ip, port, namespaceSet).thenCompose(v -> sentinelApiClient.modifyClusterServerTransportConfig(app, ip, port, transportConfig)).thenCompose(v -> sentinelApiClient.modifyClusterServerFlowConfig(app, ip, port, flowConfig)).thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_SERVER));
}
Also used : AppManagement(com.alibaba.csp.sentinel.dashboard.discovery.AppManagement) ClusterServerModifyRequest(com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest) ClusterUniversalStateVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStateVO) ClusterGroupEntity(com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity) ClusterClientStateVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterClientStateVO) Set(java.util.Set) Autowired(org.springframework.beans.factory.annotation.Autowired) CompletableFuture(java.util.concurrent.CompletableFuture) Collectors(java.util.stream.Collectors) AppInfo(com.alibaba.csp.sentinel.dashboard.discovery.AppInfo) ArrayList(java.util.ArrayList) ClusterClientModifyRequest(com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest) AsyncUtils(com.alibaba.csp.sentinel.dashboard.util.AsyncUtils) StringUtil(com.alibaba.csp.sentinel.util.StringUtil) ServerFlowConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig) List(java.util.List) ServerTransportConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig) SentinelApiClient(com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient) Service(org.springframework.stereotype.Service) ClusterUniversalStatePairVO(com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO) ClusterEntityUtils(com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils) ClusterClientConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig) ClusterStateManager(com.alibaba.csp.sentinel.cluster.ClusterStateManager) ServerFlowConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig) ServerTransportConfig(com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig)

Aggregations

ClusterStateManager (com.alibaba.csp.sentinel.cluster.ClusterStateManager)5 SentinelApiClient (com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient)5 AppInfo (com.alibaba.csp.sentinel.dashboard.discovery.AppInfo)5 AppManagement (com.alibaba.csp.sentinel.dashboard.discovery.AppManagement)5 ClusterGroupEntity (com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity)5 ClusterClientConfig (com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig)5 ServerFlowConfig (com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig)5 ServerTransportConfig (com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig)5 ClusterClientModifyRequest (com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest)5 ClusterServerModifyRequest (com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest)5 ClusterClientStateVO (com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterClientStateVO)5 ClusterUniversalStatePairVO (com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO)5 ClusterUniversalStateVO (com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStateVO)5 AsyncUtils (com.alibaba.csp.sentinel.dashboard.util.AsyncUtils)5 ClusterEntityUtils (com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils)5 StringUtil (com.alibaba.csp.sentinel.util.StringUtil)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 Set (java.util.Set)5 CompletableFuture (java.util.concurrent.CompletableFuture)5