use of org.wso2.ei.dashboard.core.rest.model.LocalEntryValue in project product-mi-tooling by wso2.
the class GroupsApi method getLocalEntryValue.
@GET
@Path("/{group-id}/nodes/{node-id}/local-entries/{local-entry}/value")
@Produces({ "application/json" })
@Operation(summary = "Get value of local entry", description = "", tags = { "localEntries" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Value of the local entry", content = @Content(schema = @Schema(implementation = LocalEntryValue.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response getLocalEntryValue(@PathParam("group-id") @Parameter(description = "Group id of the node") String groupId, @PathParam("node-id") @Parameter(description = "Node id") String nodeId, @PathParam("local-entry") @Parameter(description = "Local entry name") String localEntry) throws ManagementApiException {
LocalEntriesDelegate localEntriesDelegate = new LocalEntriesDelegate();
LocalEntryValue localEntryValue = localEntriesDelegate.getValue(groupId, nodeId, localEntry);
Response.ResponseBuilder responseBuilder = Response.ok().entity(localEntryValue);
HttpUtils.setHeaders(responseBuilder);
return responseBuilder.build();
}
use of org.wso2.ei.dashboard.core.rest.model.LocalEntryValue in project product-mi-tooling by wso2.
the class LocalEntriesDelegate method getValue.
public LocalEntryValue getValue(String groupId, String nodeId, String localEntry) throws ManagementApiException {
log.debug("Fetching value of local entry " + localEntry + " in node " + nodeId + " of group " + groupId);
String mgtApiUrl = ManagementApiUtils.getMgtApiUrl(groupId, nodeId);
String accessToken = databaseManager.getAccessToken(groupId, nodeId);
String url = mgtApiUrl.concat("local-entries?name=").concat(localEntry);
CloseableHttpResponse httpResponse = Utils.doGet(groupId, nodeId, accessToken, url);
JsonObject jsonResponse = HttpUtils.getJsonResponse(httpResponse);
String value = jsonResponse.get("value").getAsString();
LocalEntryValue localEntryValue = new LocalEntryValue();
localEntryValue.setValue(value);
return localEntryValue;
}
Aggregations