use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.
the class GroupsApi method getSequencesByNodeIds.
@GET
@Path("/{group-id}/sequences")
@Produces({ "application/json" })
@Operation(summary = "Get sequences by node ids", description = "", tags = { "sequences" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of sequences deployed in provided nodes", content = @Content(schema = @Schema(implementation = Artifacts.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response getSequencesByNodeIds(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId, @NotNull @QueryParam("nodes") @Parameter(description = "ID/IDs of the nodes") List<String> nodes) {
SequencesDelegate sequencesDelegate = new SequencesDelegate();
Artifacts sequenceList = sequencesDelegate.getArtifactsList(groupId, nodes);
Response.ResponseBuilder responseBuilder = Response.ok().entity(sequenceList);
HttpUtils.setHeaders(responseBuilder);
return responseBuilder.build();
}
use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.
the class GroupsApi method getTemplatesByNodeIds.
@GET
@Path("/{group-id}/templates")
@Produces({ "application/json" })
@Operation(summary = "Get templates by node ids", description = "", tags = { "templates" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of templates deployed in provided nodes", content = @Content(schema = @Schema(implementation = Artifacts.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response getTemplatesByNodeIds(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId, @NotNull @QueryParam("nodes") @Parameter(description = "ID/IDs of the nodes") List<String> nodes) {
TemplatesDelegate templatesDelegate = new TemplatesDelegate();
Artifacts templateList = templatesDelegate.getArtifactsList(groupId, nodes);
Response.ResponseBuilder responseBuilder = Response.ok().entity(templateList);
HttpUtils.setHeaders(responseBuilder);
return responseBuilder.build();
}
use of org.wso2.ei.dashboard.core.rest.model.Artifacts 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;
}
use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.
the class GroupsApi method getInboundEpsByNodeIds.
@GET
@Path("/{group-id}/inbound-endpoints")
@Produces({ "application/json" })
@Operation(summary = "Get inbound endpoints by node ids", description = "", tags = { "inboundEndpoints" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of inbound endpoints deployed in provided nodes", content = @Content(schema = @Schema(implementation = Artifacts.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response getInboundEpsByNodeIds(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId, @NotNull @QueryParam("nodes") @Parameter(description = "ID/IDs of the nodes") List<String> nodes) {
InboundEndpointDelegate inboundEndpointDelegate = new InboundEndpointDelegate();
Artifacts inboundEndpointList = inboundEndpointDelegate.getArtifactsList(groupId, nodes);
Response.ResponseBuilder responseBuilder = Response.ok().entity(inboundEndpointList);
HttpUtils.setHeaders(responseBuilder);
return responseBuilder.build();
}
use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.
the class JDBCDatabaseManager method fetchArtifacts.
@Override
public Artifacts fetchArtifacts(String artifactType, String groupId, List<String> nodeList) {
Artifacts artifacts = new Artifacts();
String nodeSearch = "";
String nodeSearchTmp = nodeSearch;
nodeList.forEach(node -> nodeSearchTmp.concat("NODE_ID=? OR "));
nodeSearch = nodeSearchTmp;
for (int i = 0; i < nodeList.size(); i++) {
nodeSearch = nodeSearch.concat("NODE_ID=? OR ");
}
if (!nodeSearch.equals("")) {
nodeSearch = nodeSearch.substring(0, nodeSearch.length() - 4);
}
String tableName = getTableName(artifactType);
String getDistinctNamesQuery = "SELECT DISTINCT NAME FROM " + tableName + " WHERE GROUP_ID=? " + "AND (" + nodeSearch + ");";
String getDetailsQuery = "SELECT NODE_ID, DETAILS FROM " + tableName + " WHERE NAME=? AND GROUP_ID=? AND " + "(" + nodeSearch + ");";
try (Connection con = getConnection();
PreparedStatement statement = con.prepareStatement(getDistinctNamesQuery)) {
statement.setString(1, groupId);
for (int i = 0, j = 2; i < nodeList.size(); i++, j++) {
statement.setString(j, nodeList.get(i));
}
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
ArtifactsInner artifactsInner = new ArtifactsInner();
String artifactName = resultSet.getString("NAME");
artifactsInner.setName(artifactName);
List<ArtifactDetails> artifactDetails = getArtifactDetails(getDetailsQuery, artifactName, groupId, nodeList);
artifactsInner.setNodes(artifactDetails);
artifacts.add(artifactsInner);
}
return artifacts;
} catch (SQLException e) {
throw new DashboardServerException("Error occurred fetching " + artifactType, e);
}
}
Aggregations