use of org.wso2.ei.dashboard.core.rest.model.Ack 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;
}
use of org.wso2.ei.dashboard.core.rest.model.Ack in project product-mi-tooling by wso2.
the class GroupsApi method updateLogLevelByNodeId.
@PATCH
@Path("/{group-id}/log-configs/nodes/{node-id}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@Operation(summary = "Update log level by nodeId", description = "", tags = { "logConfigs" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Logger update status", content = @Content(schema = @Schema(implementation = SuccessStatus.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response updateLogLevelByNodeId(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId, @PathParam("node-id") @Parameter(description = "NodeId") String nodeId, @Valid LogConfigUpdateRequest request) throws ManagementApiException {
LogConfigDelegate logConfigDelegate = new LogConfigDelegate();
Ack ack = logConfigDelegate.updateLogLevelByNodeId(groupId, nodeId, request);
return Response.ok().entity(ack).build();
}
use of org.wso2.ei.dashboard.core.rest.model.Ack in project product-mi-tooling by wso2.
the class MessageProcessorsDelegate method updateArtifact.
@Override
public Ack updateArtifact(String groupId, ArtifactUpdateRequest request) throws ManagementApiException {
log.debug("Updating message processor " + request.getArtifactName() + " in node " + request.getNodeId() + " in group " + groupId);
Ack ack = new Ack(Constants.FAIL_STATUS);
boolean isSuccess = updateMessageProcessor(groupId, request);
if (isSuccess) {
ack.setStatus(Constants.SUCCESS_STATUS);
}
return ack;
}
use of org.wso2.ei.dashboard.core.rest.model.Ack in project product-mi-tooling by wso2.
the class UsersDelegate method addUser.
public Ack addUser(String groupId, AddUserRequest request) throws ManagementApiException {
log.debug("Adding user " + request.getUserId() + " in group " + groupId);
Ack ack = new Ack(Constants.FAIL_STATUS);
JsonObject payload = createAddUserPayload(request);
NodeList nodeList = databaseManager.fetchNodes(groupId);
// assumption - In a group, all nodes use a shared user-store
String nodeId = nodeList.get(0).getNodeId();
String mgtApiUrl = ManagementApiUtils.getMgtApiUrl(groupId, nodeId);
String accessToken = databaseManager.getAccessToken(groupId, nodeId);
String url = mgtApiUrl.concat("users");
Utils.doPost(groupId, nodeId, accessToken, url, payload);
ack.setStatus(Constants.SUCCESS_STATUS);
return ack;
}
use of org.wso2.ei.dashboard.core.rest.model.Ack in project product-mi-tooling by wso2.
the class GroupsApi method addLogger.
@POST
@Path("/{group-id}/log-configs")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@Operation(summary = "Add logger", description = "", tags = { "logConfigs" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Logger insert status", content = @Content(schema = @Schema(implementation = SuccessStatus.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response addLogger(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId, @Valid LogConfigAddRequest request) throws ManagementApiException {
LogConfigDelegate logConfigDelegate = new LogConfigDelegate();
Ack ack = logConfigDelegate.addLogger(groupId, request);
Response.ResponseBuilder responseBuilder = Response.ok().entity(ack);
HttpUtils.setHeaders(responseBuilder);
return responseBuilder.build();
}
Aggregations