use of org.wso2.ei.dashboard.core.rest.model.CAppArtifactsInner in project product-mi-tooling by wso2.
the class CarbonAppsDelegate method getCAppArtifactList.
public CAppArtifacts getCAppArtifactList(String groupId, String nodeId, String cAppName) throws ManagementApiException {
log.debug("Fetching artifacts in carbon applications from management console");
String mgtApiUrl = ManagementApiUtils.getMgtApiUrl(groupId, nodeId);
String url = mgtApiUrl.concat("applications").concat("?").concat("carbonAppName").concat("=").concat(cAppName);
String accessToken = databaseManager.getAccessToken(groupId, nodeId);
CloseableHttpResponse httpResponse = Utils.doGet(groupId, nodeId, accessToken, url);
JsonObject jsonResponse = HttpUtils.getJsonResponse(httpResponse);
JsonArray artifacts = jsonResponse.getAsJsonArray("artifacts");
CAppArtifacts cAppArtifacts = new CAppArtifacts();
for (JsonElement artifact : artifacts) {
JsonObject jsonObject = artifact.getAsJsonObject();
CAppArtifactsInner cAppArtifact = new CAppArtifactsInner();
cAppArtifact.setName(jsonObject.get("name").getAsString());
cAppArtifact.setType(jsonObject.get("type").getAsString());
cAppArtifacts.add(cAppArtifact);
}
return cAppArtifacts;
}
Aggregations