Skip to content

Commit

Permalink
management-service: Cleanup reports controller, update collection wit…
Browse files Browse the repository at this point in the history
…h endpoints.
  • Loading branch information
Woojciech committed Nov 16, 2024
1 parent 8ba48f7 commit 827e8c0
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 4 deletions.
142 changes: 142 additions & 0 deletions management-service/postman/Magpie Monitor.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,27 @@
},
"response": []
},
{
"name": "/api/v1/reports/{reportId}/node-incidents",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base-url}}/api/v1/reports/{reportId}/node-incidents",
"host": [
"{{base-url}}"
],
"path": [
"api",
"v1",
"reports",
"{reportId}",
"node-incidents"
]
}
},
"response": []
},
{
"name": "/api/v1/reports/node-incidents/{incidentId}",
"request": {
Expand All @@ -377,6 +398,49 @@
},
"response": []
},
{
"name": "/api/v1/reports/node-incidents/{incidentId}/sources",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base-url}}/api/v1/reports/node-incidents/1/sources",
"host": [
"{{base-url}}"
],
"path": [
"api",
"v1",
"reports",
"node-incidents",
"1",
"sources"
]
}
},
"response": []
},
{
"name": "/api/v1/reports/{reportId}/application-incidents",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base-url}}/api/v1/reports/{reportId}/application-incidents",
"host": [
"{{base-url}}"
],
"path": [
"api",
"v1",
"reports",
"{reportId}",
"application-incidents"
]
}
},
"response": []
},
{
"name": "/api/v1/reports/application-incidents/{incidentId}",
"request": {
Expand All @@ -398,6 +462,28 @@
},
"response": []
},
{
"name": "/api/v1/reports/application-incidents/{incidentId}/sources",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base-url}}/api/v1/reports/application-incidents/1/sources",
"host": [
"{{base-url}}"
],
"path": [
"api",
"v1",
"reports",
"application-incidents",
"1",
"sources"
]
}
},
"response": []
},
{
"name": "/api/v1/reports/{id}/incidents",
"request": {
Expand All @@ -418,6 +504,34 @@
}
},
"response": []
},
{
"name": "/api/v1/reports",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"clusterId\": \"testcluster-1\",\n \"accuracy\": \"LOW\",\n \"sinceMs\": 0,\n \"toMs\": 1731749958918,\n \"slackReceiverIds\": [],\n \"discordReceiverIds\": [],\n \"emailReceiverIds\": [],\n \"applicationConfigurations\": [\n {\n \"applicationName\": \"app-2\",\n \"customPrompt\": \"test\",\n \"enabled\": true,\n \"accuracy\": \"LOW\"\n }\n ],\n \"nodeConfigurations\": [\n {\n \"nodeName\": \"tools\",\n \"customPrompt\": \"impersonate Donald Trump in your response\",\n \"accuracy\": \"LOW\"\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{base-url}}/api/v1/reports",
"host": [
"{{base-url}}"
],
"path": [
"api",
"v1",
"reports"
]
}
},
"response": []
}
]
},
Expand Down Expand Up @@ -480,6 +594,34 @@
}
},
"response": []
},
{
"name": "/api/v1/clusters",
"request": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": \"test\",\n \"accuracy\": \"LOW\",\n \"isEnabled\": false,\n \"sinceMs\": 0,\n \"toMs\": 15,\n \"generatedEveryMillis\": 3,\n \"slackReceiverIds\": [],\n \"discordReceiverIds\": [],\n \"emailReceiverIds\": [],\n \"applicationConfigurations\": [\n {\n \"name\": \"test\",\n \"kind\": \"test2\",\n \"accuracy\": \"LOW\",\n \"customPrompt\": \"test\"\n }\n ],\n \"nodeConfigurations\": [\n {\n \"name\": \"test\",\n \"accuracy\": \"LOW\",\n \"customPrompt\": \"test\" \n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{base-url}}/api/v1/clusters",
"host": [
"{{base-url}}"
],
"path": [
"api",
"v1",
"clusters"
]
}
},
"response": []
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package pl.pwr.zpi.reports.api;

import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -29,7 +28,7 @@ public class ReportsController {
private final ReportGenerationService reportGenerationService;

@PostMapping
public ResponseEntity<Void> createReport(@Valid @RequestBody CreateReportRequest reportRequest) {
public ResponseEntity<Void> createReport(@RequestBody CreateReportRequest reportRequest) {
reportGenerationService.createReport(reportRequest);
return ResponseEntity.ok().build();
}
Expand Down Expand Up @@ -75,8 +74,7 @@ public ResponseEntity<ReportPaginatedIncidentsDTO<NodeIncidentDTO>> getNodeIncid
}

@GetMapping("/application-incidents/{id}")
public ResponseEntity<ApplicationIncidentDTO> getApplicationIncidentById(
@PathVariable String id) {
public ResponseEntity<ApplicationIncidentDTO> getApplicationIncidentById(@PathVariable String id) {
return ResponseEntity.of(reportsService.getApplicationIncidentById(id));
}

Expand Down

0 comments on commit 827e8c0

Please sign in to comment.