Skip to content

Commit

Permalink
Removed nullable attributes from run status in swagger spec (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
rexwhite authored Apr 10, 2023
1 parent 977b147 commit 287c2cc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 77 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"test": "NODE_ENV=test npm run db:ims && jest -i",
"test:ci": "NODE_ENV=test npm run db:ims && LOG_LEVEL=fatal jest -i",
"test:unit": "NODE_ENV=test jest -i --testMatch='**/?(*.)+(unit).js'",
"test:dc": "docker-compose -f build/docker-compose-unit_test.yml up --build --exit-code-from remediations",
"test:dc-down": "docker-compose -f build/docker-compose-unit_test.yml down",
"test:contract": "NODE_ENV=test jest -i --testMatch='**/?(*.)+(contract).js'",
"verify": "npm-run-all lint coverage"
},
Expand Down
5 changes: 0 additions & 5 deletions src/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1117,19 +1117,14 @@ components:
properties:
pending:
type: integer
nullable: true
running:
type: integer
nullable: true
success:
type: integer
nullable: true
failure:
type: integer
nullable: true
canceled:
type: integer
nullable: true

PlaybookRunSystemList:
type: object
Expand Down
116 changes: 44 additions & 72 deletions src/remediations/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,50 @@ const rbacWrite = rbac('remediations:remediation:write');
const rbacExecute = rbac('remediations:remediation:execute');

module.exports = function (router) {
router.get('/remediations', openapi('getRemediations'), rbacRead, read.list);
router.post('/remediations', openapi('createRemediation'), rbacWrite, write.create);
router.delete('/remediations', openapi('deleteRemediations'), rbacWrite, write.bulkRemove);
router.route('/remediations')
.get(openapi('getRemediations'), rbacRead, read.list)
.post(openapi('createRemediation'), rbacWrite, write.create)
.delete(openapi('deleteRemediations'), rbacWrite, write.bulkRemove);

router.get('/remediations/download', openapi('downloadPlaybooks'), rbacRead, read.downloadPlaybooks);

router.get('/remediations/:id', openapi('getRemediation'), rbacRead, read.get);
router.patch('/remediations/:id', openapi('updateRemediation'), rbacWrite, write.patch);
router.delete('/remediations/:id', openapi('deleteRemediation'), rbacWrite, write.remove);

router.get('/remediations/:id/status', rbacRead, status.status); // TODO: openapi mw

router.patch(
'/remediations/:id/issues/:issue',
openapi('updateRemediationIssue'),
rbacWrite,
write.patchIssue);

router.delete(
'/remediations/:id/issues/:issue',
openapi('deleteRemediationIssue'),
rbacWrite,
write.removeIssue);

router.get(
'/remediations/:id/issues/:issue/systems',
openapi('getRemediationIssueSystems'),
rbacRead,
read.getIssueSystems);

router.delete(
'/remediations/:id/issues/:issue/systems/:system',
openapi('deleteRemediationIssueSystem'),
rbacWrite,
write.removeIssueSystem);

router.get('/remediations/:id/executable',
openapi('checkExecutable'),
rbacRead,
fifi.checkExecutable);

router.get('/remediations/:id/connection_status',
openapi('getRemediationConnectionStatus'),
rbacExecute,
fifi.connection_status);

router.get('/remediations/:id/playbook_runs',
openapi('listPlaybookRuns'),
rbacRead,
fifi.listPlaybookRuns);

router.post('/remediations/:id/playbook_runs',
openapi('runRemediation'),
rbacExecute,
fifi.executePlaybookRuns);

router.get('/remediations/:id/playbook_runs/:playbook_run_id',
openapi('getPlaybookRunDetails'),
rbacRead,
fifi.getRunDetails);

router.post('/remediations/:id/playbook_runs/:playbook_run_id/cancel',
openapi('cancelPlaybookRuns'),
rbacExecute,
fifi.cancelPlaybookRuns);

router.get('/remediations/:id/playbook_runs/:playbook_run_id/systems',
openapi('getPlaybookRunSystems'),
rbacRead,
fifi.getSystems);

router.get('/remediations/:id/playbook_runs/:playbook_run_id/systems/:system',
openapi('getPlaybookRunSystemDetails'),
rbacRead,
fifi.getSystemDetails);
router.route('/remediations/:id')
.get(openapi('getRemediation'), rbacRead, read.get)
.patch(openapi('updateRemediation'), rbacWrite, write.patch)
.delete(openapi('deleteRemediation'), rbacWrite, write.remove);

router.route('/remediations/:id/status')
.get(rbacRead, status.status); // TODO: openapi mw

router.route('/remediations/:id/issues/:issue')
.patch(openapi('updateRemediationIssue'), rbacWrite, write.patchIssue)
.delete(openapi('deleteRemediationIssue'), rbacWrite, write.removeIssue);

router.route('/remediations/:id/issues/:issue/systems')
.get(openapi('getRemediationIssueSystems'), rbacRead, read.getIssueSystems);

router.route('/remediations/:id/issues/:issue/systems/:system')
.delete(openapi('deleteRemediationIssueSystem'), rbacWrite, write.removeIssueSystem);

router.route('/remediations/:id/executable')
.get(openapi('checkExecutable'), rbacRead, fifi.checkExecutable);

router.route('/remediations/:id/connection_status')
.get(openapi('getRemediationConnectionStatus'), rbacExecute, fifi.connection_status);

router.route('/remediations/:id/playbook_runs')
.get(openapi('listPlaybookRuns'), rbacRead, fifi.listPlaybookRuns)
.post(openapi('runRemediation'), rbacExecute, fifi.executePlaybookRuns);

router.route('/remediations/:id/playbook_runs/:playbook_run_id')
.get(openapi('getPlaybookRunDetails'), rbacRead, fifi.getRunDetails);

router.route('/remediations/:id/playbook_runs/:playbook_run_id/cancel')
.post(openapi('cancelPlaybookRuns'), rbacExecute, fifi.cancelPlaybookRuns);

router.route('/remediations/:id/playbook_runs/:playbook_run_id/systems')
.get(openapi('getPlaybookRunSystems'), rbacRead, fifi.getSystems);

router.route('/remediations/:id/playbook_runs/:playbook_run_id/systems/:system')
.get(openapi('getPlaybookRunSystemDetails'), rbacRead, fifi.getSystemDetails);
};

0 comments on commit 287c2cc

Please sign in to comment.