use of org.wso2.ei.dashboard.core.exception.ManagementApiException in project product-mi-tooling by wso2.
the class EndpointsDelegate method updateArtifact.
@Override
public Ack updateArtifact(String groupId, ArtifactUpdateRequest request) throws ManagementApiException {
logger.debug("Updating Endpoint " + request.getArtifactName() + " in node " + request.getNodeId() + " in group " + groupId);
Ack ack = new Ack(Constants.FAIL_STATUS);
boolean isSuccess = updateEndpoint(groupId, request);
if (isSuccess) {
ack.setStatus(Constants.SUCCESS_STATUS);
}
return ack;
}
use of org.wso2.ei.dashboard.core.exception.ManagementApiException in project product-mi-tooling by wso2.
the class InboundEndpointDelegate method updateArtifact.
@Override
public Ack updateArtifact(String groupId, ArtifactUpdateRequest request) throws ManagementApiException {
logger.debug("Updating inbound endpoint " + request.getArtifactName() + " in node " + request.getNodeId() + " in group " + groupId);
Ack ack = new Ack(Constants.FAIL_STATUS);
boolean isSuccess = updateInboundEndpoint(groupId, request);
if (isSuccess) {
ack.setStatus(Constants.SUCCESS_STATUS);
}
return ack;
}
use of org.wso2.ei.dashboard.core.exception.ManagementApiException in project product-mi-tooling by wso2.
the class LogConfigDelegate method addLogger.
public Ack addLogger(String groupId, LogConfigAddRequest request) throws ManagementApiException {
logger.debug("Adding new Logger " + request.getName() + " for all nodes in group " + groupId);
Ack ack = new Ack(Constants.FAIL_STATUS);
JsonObject payload = createAddLoggerPayload(request);
NodeList nodeList = databaseManager.fetchNodes(groupId);
for (NodeListInner node : nodeList) {
String nodeId = node.getNodeId();
String mgtApiUrl = ManagementApiUtils.getMgtApiUrl(groupId, nodeId);
String accessToken = databaseManager.getAccessToken(groupId, nodeId);
String addLoggerUrl = mgtApiUrl.concat("logging");
logger.debug("Adding new logger on node " + nodeId);
CloseableHttpResponse httpResponse = Utils.doPatch(groupId, nodeId, accessToken, addLoggerUrl, payload);
if (httpResponse.getStatusLine().getStatusCode() != 200) {
logger.error("Error occurred while adding logger on node " + nodeId + " in group " + groupId);
String message = HttpUtils.getJsonResponse(httpResponse).get("Error").getAsString();
ack.setMessage(message);
return ack;
}
}
ack.setStatus(Constants.SUCCESS_STATUS);
return ack;
}
use of org.wso2.ei.dashboard.core.exception.ManagementApiException in project product-mi-tooling by wso2.
the class LogConfigDelegate method updateLogLevel.
public Ack updateLogLevel(String groupId, LogConfigUpdateRequest request) throws ManagementApiException {
logger.debug("Updating logger " + request.getName() + " for all nodes in group " + groupId);
Ack ack = new Ack(Constants.FAIL_STATUS);
JsonObject payload = createUpdateLoggerPayload(request);
NodeList nodeList = databaseManager.fetchNodes(groupId);
for (NodeListInner node : nodeList) {
String nodeId = node.getNodeId();
CloseableHttpResponse httpResponse = updateLogLevelByNodeId(groupId, nodeId, payload);
if (httpResponse.getStatusLine().getStatusCode() != 200) {
logger.error("Error occurred while updating logger on node " + nodeId + " in group " + groupId);
String message = HttpUtils.getJsonResponse(httpResponse).get("Error").getAsString();
ack.setMessage(message);
return ack;
}
}
ack.setStatus(Constants.SUCCESS_STATUS);
return ack;
}
use of org.wso2.ei.dashboard.core.exception.ManagementApiException in project product-mi-tooling by wso2.
the class LogConfigDelegate method updateLogLevelByNodeId.
public Ack updateLogLevelByNodeId(String groupId, String nodeId, LogConfigUpdateRequest request) throws ManagementApiException {
logger.debug("Updating logger " + request.getName() + " in node " + nodeId + " in group " + groupId);
Ack ack = new Ack(Constants.FAIL_STATUS);
JsonObject payload = createUpdateLoggerPayload(request);
CloseableHttpResponse httpResponse = updateLogLevelByNodeId(groupId, nodeId, payload);
if (httpResponse.getStatusLine().getStatusCode() != 200) {
logger.error("Error occurred while updating logger on node " + nodeId + " in group " + groupId);
String message = HttpUtils.getJsonResponse(httpResponse).get("Error").getAsString();
ack.setMessage(message);
} else {
ack.setStatus(Constants.SUCCESS_STATUS);
}
return ack;
}
Aggregations