Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jans-config-api): agama deployment detail endpoint not including all flows IDs #4565

Merged
merged 2 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions docs/admin/developer/agama/gama-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ The following tables summarize the available endpoints. All URLs are relative to
|Status|200 (OK)|


|Endpoint -> |`/agama-deployment`|
|Endpoint -> |`/agama-deployment/{name}`|
|-|-|
|Purpose|Retrieve details of a single deployment by name|
|Method|GET|
|Query params|`name` - mandatory|
|Path params|`name`|
|Sample output|The structure of a deployment is explained below|
|Status|200 (deployment task is finished), 204 (task still in course), 404 (project unknown), 400 (a param is missing)|

Expand All @@ -152,39 +152,39 @@ The following tables summarize the available endpoints. All URLs are relative to
|flowsError|A mapping of the errors obtained per flow found in the archive. The keys correspond to qualified names. A `null` value indicates the flow was successfully added|`{ "co.acme.example": "Syntax error on line 4", "io.jans.test": null }`|


|Endpoint -> |`/agama-deployment`|
|Endpoint -> |`/agama-deployment/{name}`|
|-|-|
|Purpose|Add or replace an ADS project to the server|
|Method|POST|
|Query params|`name` (the project's name) - mandatory|
|Path params|`name` (the project's name)|
|Body|The binary contents of a `.gama` file; example [here](#sample-file). Ensure to use header `Content-Type: application/zip`|
|Output|Textual explanation, e.g. `A deployment task for project XXX has been queued. Use the GET endpoint to poll status`|
|Status|202 (the task was created and scheduled for deployment), 409 (there is a task already for this project and it hasn't finished yet), 400 (a param is missing)|


|Endpoint -> |`/agama-deployment/configs`|
|Endpoint -> |`/agama-deployment/configs/{name}`|
|-|-|
|Purpose|Retrieve the configurations associated to flows that belong to the project of interest. The project must have been already processed fully|
|Method|GET|
|Query params|`name` (the project's name) - mandatory|
|Path params|`name` (the project's name)|
|Output|A JSON object whose properties are flow names and values correspond to configuration properties defined (JSON objects too)|
|Status|200 (successful response), 204 (this project is still in course of deployment), 404 (unknown project), 400 (a param is missing)|


|Endpoint -> |`/agama-deployment/configs`|
|Endpoint -> |`/agama-deployment/configs/{name}`|
|-|-|
|Purpose|Set or replace the configurations associated to flows that belong to the project of interest. The project must have been already processed fully|
|Method|PUT|
|Query params|`name` (the project's name) - mandatory|
|Path params|`name` (the project's name)|
|Output|A JSON object whose properties are flow names and values correspond to a boolean indicating the success of the update for the given flow|
|Status|200 (successful response), 204 (this project is still in course of deployment), 404 (unknown project), 400 (a param is missing)|


|Endpoint -> |`/agama-deployment`|
|Endpoint -> |`/agama-deployment/{name}`|
|-|-|
|Purpose|Undeploy an ADS project from the server. Entails removing flows and assets initally supplied|
|Method|DELETE|
|Query params|`name` (the project's name) - mandatory|
|Path params|`name` (the project's name)|
|Status|204 (scheduled for removal), 409 (the project is being deployed currently), 404 (unknown project), 400 (a param is missing)|

### Endpoints access
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ private void deployProject(String dn, String prjId, String name) throws IOExcept
if (dd.getError() == null) {
projectsFlows.put(prjId, flowIds);

Set<String> libsPaths = transferJarFiles(plib);
ZipFile zip = compileAssetsArchive(p, pweb, plib, prjBasepath);
byte[] bytes = extractZipFileWithPurge(zip, ASSETS_DIR,
projectsBasePaths.get(prjId), projectsLibs.get(prjId));

Set<String> basePaths = Set.of(prjBasepath);
projectsBasePaths.put(prjId, basePaths);

Set<String> libsPaths = transferJarFiles(plib);
//Update this project's libs paths
libsPaths.addAll(computeSourcePaths(plib));
projectsLibs.put(prjId, libsPaths);
Expand Down
14 changes: 6 additions & 8 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7652,8 +7652,6 @@ components:
type: string
description:
type: string
version:
type: string
configs:
type: object
additionalProperties:
Expand Down Expand Up @@ -7881,20 +7879,20 @@ components:
$ref: '#/components/schemas/AttributeValidation'
tooltip:
type: string
adminCanView:
type: boolean
userCanAccess:
type: boolean
adminCanAccess:
type: boolean
adminCanView:
type: boolean
adminCanEdit:
type: boolean
userCanView:
userCanAccess:
type: boolean
userCanEdit:
userCanView:
type: boolean
whitePagesCanView:
type: boolean
userCanEdit:
type: boolean
baseDn:
type: string
clientAuthMapSchema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ public Response getDeployment(@Parameter(description = "Agama project name") @Pa
return Response.noContent().build();

d.getDetails().setFolders(null);
return Response.ok(d).build();
try {
//Use own mapper so flows with no errors are effectively serialized
return Response.ok(mapper.writeValueAsString(d)).build();
} catch (JsonProcessingException e) {
logger.error(e.getMessage(), e);
return Response.serverError().build();
}

}

Expand Down Expand Up @@ -171,7 +177,8 @@ public Response undeploy(@Parameter(description = "Agama project name") @PathPar
@GET
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_READ_ACCESS }, groupScopes = {ApiAccessConstants.AGAMA_WRITE_ACCESS }, superScopes = { ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })
@Path(ApiConstants.CONFIGS + ApiConstants.NAME_PARAM_PATH)
public Response getConfigs(@Parameter(description = "Agama project name") @PathParam(ApiConstants.NAME) @NotNull String projectName) throws JsonProcessingException {
public Response getConfigs(@Parameter(description = "Agama project name") @PathParam(ApiConstants.NAME) @NotNull String projectName)
throws JsonProcessingException {

Pair<Response, Set<String>> pair = projectFlows(projectName);
Response resp = pair.getFirst();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public PagedResult<Deployment> list(int start, int count, int maxCount) {

public Deployment getDeployment(String name) {

String[] attrs = new String[]{ "jansStartDate", "jansEndDate", "adsPrjDeplDetails" };
String[] attrs = new String[]{ "jansId", "jansStartDate", "jansEndDate", "adsPrjDeplDetails" };
logger.info("Looking up project named {}", name);

Deployment d = null;
Expand Down