diff --git a/src/components/IOC/DeployIOC/DeployIOC.js b/src/components/IOC/DeployIOC/DeployIOC.js index 613ff501907e91ec52a952bc6eed41be94e29eea..9b937282af48ccf5b9b32eed6006c8be1df1e641 100644 --- a/src/components/IOC/DeployIOC/DeployIOC.js +++ b/src/components/IOC/DeployIOC/DeployIOC.js @@ -22,7 +22,7 @@ export function DeployIOC({ wrapper: action, error: deployError } = useAPIMethod({ - fcn: client.apis.IOCs.updateAndDeployIoc, + fcn: client.apis.IOCs.startOperation, call: false }); @@ -56,7 +56,7 @@ export function DeployIOC({ submitCallback(); // This works but throws a warning because I am changing state in the parent while the child is rerendering. Not sure yet how to fix. return ( <Navigate - to={`/jobs/${deployment.operationId}`} + to={`/jobs/${deployment.id}`} push /> ); diff --git a/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js b/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js index bd7516c67955ac32cea33baf50bfe8dc3c7d05e8..33ad2485cb6f586876dd5988bfbb2ac683dfb772 100644 --- a/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js +++ b/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js @@ -107,7 +107,8 @@ export function IOCDeployDialog({ requestBody: { sourceUrl: git, sourceVersion: revision.reference, - hostId: host.hostId + hostId: host.hostId, + type: "DEPLOY" } } ); diff --git a/src/components/IOC/IOCService/IOCService.js b/src/components/IOC/IOCService/IOCService.js index a25c331f6ad82c52ebe08d2b1c97318e4decdd6b..1b7a46095ff8545540c0cc5da7d3bd3eaae057fb 100644 --- a/src/components/IOC/IOCService/IOCService.js +++ b/src/components/IOC/IOCService/IOCService.js @@ -5,13 +5,7 @@ import { Typography, Tooltip } from "@mui/material"; -import React, { - useState, - useEffect, - useContext, - useCallback, - useMemo -} from "react"; +import React, { useState, useEffect, useContext, useCallback } from "react"; import { ConfirmationDialog, useAPIMethod } from "@ess-ics/ce-ui-common"; import Alert from "@mui/material/Alert"; import { initRequestParams } from "../../common/Helper"; @@ -36,21 +30,13 @@ export function IOCService({ const client = useContext(apiContext); - const params = useMemo( - () => ({ - ioc_id: ioc?.id - }), - [ioc?.id] - ); - const { value: startJob, wrapper: startIOC, error: startJobError } = useAPIMethod({ - fcn: client.apis.IOCs.startIoc, - call: false, - params + fcn: client.apis.IOCs.startOperation, + call: false }); const { @@ -58,9 +44,8 @@ export function IOCService({ wrapper: stopIOC, error: stopJobError } = useAPIMethod({ - fcn: client.apis.IOCs.stopIoc, - call: false, - params + fcn: client.apis.IOCs.startOperation, + call: false }); useEffect(() => { @@ -93,7 +78,16 @@ export function IOCService({ setInProgress(true); setButtonDisabled(true); - startIOC(); + startIOC( + { + ioc_id: ioc.id + }, + { + requestBody: { + type: "START" + } + } + ); let requestParams = initRequestParams(jobLazyParams); @@ -113,7 +107,16 @@ export function IOCService({ setInProgress(true); setButtonDisabled(true); - stopIOC(); + stopIOC( + { + ioc_id: ioc.id + }, + { + requestBody: { + type: "STOP" + } + } + ); let requestParams = initRequestParams(jobLazyParams); diff --git a/src/components/IOC/IOCUndeployDialog/IOCUndeployDialog.js b/src/components/IOC/IOCUndeployDialog/IOCUndeployDialog.js index 5f0856b1b64674214d42dc3e99220064614ab898..4b36b80a17872b5fb5ad646f4ba10e1bfe2cbb04 100644 --- a/src/components/IOC/IOCUndeployDialog/IOCUndeployDialog.js +++ b/src/components/IOC/IOCUndeployDialog/IOCUndeployDialog.js @@ -25,9 +25,16 @@ export function IOCUndeployDialog({ }; const onConfirm = () => { - submitCallback({ - ioc_id: ioc.id - }); + submitCallback( + { + ioc_id: ioc.id + }, + { + requestBody: { + type: "UNDEPLOY" + } + } + ); }; return ( diff --git a/src/components/IOC/UndeployIOC/UndeployIOC.js b/src/components/IOC/UndeployIOC/UndeployIOC.js index c09423dd1d40cea4f212c1d97cf5d976ddd1e7b9..def21dcf853770425bd91b16babb957c5adeb9d5 100644 --- a/src/components/IOC/UndeployIOC/UndeployIOC.js +++ b/src/components/IOC/UndeployIOC/UndeployIOC.js @@ -20,7 +20,7 @@ export function UndeployIOC({ wrapper: action, error: deploymentError } = useAPIMethod({ - fcn: client.apis.IOCs.createUndeployment, + fcn: client.apis.IOCs.startOperation, call: false }); @@ -47,7 +47,7 @@ export function UndeployIOC({ submitCallback(); // This works but throws a warning because I am changing state in the parent while the child is rerendering. Not sure yet how to fix. return ( <Navigate - to={`/jobs/${deployment.operationId}`} + to={`/jobs/${deployment.id}`} push /> ); diff --git a/src/components/Job/JobDetails.js b/src/components/Job/JobDetails.js index fb486a9581533e04c6e30da32b677492157953f0..bad9a60e408e12e7ee74e7082d2d5f41030a78c1 100644 --- a/src/components/Job/JobDetails.js +++ b/src/components/Job/JobDetails.js @@ -103,7 +103,8 @@ export const JobDetails = ({ operation, job }) => { ); useEffect(() => { - setAlerts([createAlert(jobOperation, job), ...operation.alerts]); + const operationAlerts = operation.alerts ? operation.alerts : []; + setAlerts([createAlert(jobOperation, job), ...operationAlerts]); }, [operation, job, jobOperation]); return ( diff --git a/src/mocks/fixtures/ccce-api.json b/src/mocks/fixtures/ccce-api.json index 632c2fdaaee7fb41509e50a47fb08ba928e6853f..abeb4893a0f6a6d355ae34a51a76556bcca1175f 100644 --- a/src/mocks/fixtures/ccce-api.json +++ b/src/mocks/fixtures/ccce-api.json @@ -44,216 +44,6 @@ } ], "paths": { - "/api/v1/iocs/{ioc_id}/undeploy_in_db": { - "put": { - "tags": ["IOCs"], - "summary": "Undeploy in database", - "description": "Marks an IOC in database as undeployed - will not call AWX", - "operationId": "unDeployInDb", - "parameters": [ - { - "name": "ioc_id", - "in": "path", - "description": "The id of the IOC to undeploy", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "200": { - "description": "Undeployment created", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Deployment" - } - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "403": { - "description": "Forbidden: user doesn't have the necessary permissions to undeploy", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "404": { - "description": "Not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "409": { - "description": "Ongoing deployment, or undeployment for IOC", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "422": { - "description": "IOC is not deployed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "500": { - "description": "Service exception", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - } - }, - "security": [ - { - "bearerAuth": [] - } - ] - } - }, - "/api/v1/iocs/{ioc_id}/active_deployment/host": { - "put": { - "tags": ["IOCs"], - "summary": "Modify deployment host in database", - "description": "Modifies host of IOC's active deployment in database - will not call AWX", - "operationId": "updateActiveDeploymentHost", - "parameters": [ - { - "name": "ioc_id", - "in": "path", - "description": "The ID of the IOC", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateHostRequest" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful host update", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Ioc" - } - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "403": { - "description": "Forbidden: user doesn't have the necessary permissions to modify", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "404": { - "description": "Not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "409": { - "description": "Ongoing operation for IOC", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "422": { - "description": "IOC is not deployed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "500": { - "description": "Service exception", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - } - }, - "security": [ - { - "bearerAuth": [] - } - ] - } - }, "/api/v1/migrate": { "post": { "tags": ["NetBox"], @@ -458,350 +248,29 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateIoc" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "IOC created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Ioc" - } - } - } - }, - "400": { - "description": "Incomplete, or bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions in Gitlab", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "409": { - "description": "IOC already created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "422": { - "description": "Unprocessable request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "424": { - "description": "Metadata file not found, or not processable", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "500": { - "description": "Service exception", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "503": { - "description": "Remote service exception", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - } - }, - "security": [ - { - "bearerAuth": [] - } - ] - } - }, - "/api/v1/iocs/{ioc_id}/undeployment_job": { - "post": { - "tags": ["IOCs"], - "summary": "Create undeployment job", - "operationId": "createUndeployment", - "parameters": [ - { - "name": "ioc_id", - "in": "path", - "description": "The id of the IOC to undeploy", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "201": { - "description": "Undeployment created", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Deployment" - } - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "403": { - "description": "Forbidden: user doesn't have the necessary permissions in Gitlab", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "404": { - "description": "Not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "409": { - "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "422": { - "description": "IOC is not deployed correctly", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "500": { - "description": "Service exception", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "503": { - "description": "Remote service exception", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - } - }, - "security": [ - { - "bearerAuth": [] - } - ] - } - }, - "/api/v1/iocs/{ioc_id}/stop_job": { - "post": { - "tags": ["IOCs"], - "summary": "Create stop job for an existing IOC", - "operationId": "stopIoc", - "parameters": [ - { - "name": "ioc_id", - "in": "path", - "description": "The id of the IOC to stop", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "201": { - "description": "IOC stop initiated", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Operation" - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions in Gitlab", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "404": { - "description": "IOC not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "409": { - "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "422": { - "description": "IOC has no active deployment", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, - "500": { - "description": "Service exception", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } + "$ref": "#/components/schemas/CreateIoc" } } }, - "503": { - "description": "Remote service exception", + "required": true + }, + "responses": { + "201": { + "description": "IOC created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/Ioc" } } } - } - }, - "security": [ - { - "bearerAuth": [] - } - ] - } - }, - "/api/v1/iocs/{ioc_id}/start_job": { - "post": { - "tags": ["IOCs"], - "summary": "Create start job for an existing IOC", - "operationId": "startIoc", - "parameters": [ - { - "name": "ioc_id", - "in": "path", - "description": "The id of the IOC to start", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "201": { - "description": "IOC start initiated", + }, + "400": { + "description": "Incomplete, or bad request", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Operation" + "$ref": "#/components/schemas/GeneralException" } } } @@ -826,8 +295,8 @@ } } }, - "404": { - "description": "IOC not found", + "409": { + "description": "IOC already created", "content": { "application/json": { "schema": { @@ -836,8 +305,8 @@ } } }, - "409": { - "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", + "422": { + "description": "Unprocessable request", "content": { "application/json": { "schema": { @@ -846,8 +315,8 @@ } } }, - "422": { - "description": "IOC has no active deployment", + "424": { + "description": "Metadata file not found, or not processable", "content": { "application/json": { "schema": { @@ -884,16 +353,16 @@ ] } }, - "/api/v1/iocs/{ioc_id}/deployment_job": { + "/api/v1/iocs/{ioc_id}/operation": { "post": { "tags": ["IOCs"], - "summary": "Create a deployment job for an existing IOC", - "operationId": "updateAndDeployIoc", + "summary": "Starts an IOC operation (START/STOP/DEPLOY/UNDEPLOY)", + "operationId": "startOperation", "parameters": [ { "name": "ioc_id", "in": "path", - "description": "The id of the IOC to deploy", + "description": "The ID of the IOC to start an operation on", "required": true, "schema": { "type": "integer", @@ -905,7 +374,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateAndDeployIoc" + "$ref": "#/components/schemas/CreateJobRequest" } } }, @@ -913,11 +382,11 @@ }, "responses": { "201": { - "description": "Deployment created", + "description": "IOC operation initiated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Deployment" + "$ref": "#/components/schemas/Operation" } } } @@ -973,7 +442,7 @@ } }, "422": { - "description": "NetBox host not found", + "description": "IOC has no active / NetBox host not found / IOC is not deployed correctly", "content": { "application/json": { "schema": { @@ -1281,13 +750,224 @@ }, "delete": { "tags": ["IOCs"], - "summary": "Deletes a single IOC with its history based on the ID supplied", - "operationId": "deleteIoc", + "summary": "Deletes a single IOC based on the ID supplied", + "operationId": "deleteIoc", + "parameters": [ + { + "name": "ioc_id", + "in": "path", + "description": "Id of IOC to delete", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "IOC deleted", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "404": { + "description": "IOC not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "409": { + "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "500": { + "description": "Service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "503": { + "description": "Remote service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + }, + "patch": { + "tags": ["IOCs"], + "summary": "Updating an IOC by ID", + "operationId": "updateIoc", + "parameters": [ + { + "name": "ioc_id", + "in": "path", + "description": "Unique ID of IOC", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IOCUpdateRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "IOC updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Ioc" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "404": { + "description": "Ioc not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "409": { + "description": "IOC already created or concurrent deployment, undeployment, start or stop for IOC is ongoing", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "422": { + "description": "Unprocessable request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "500": { + "description": "Service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "503": { + "description": "Remote service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/api/v1/iocs/{ioc_id}/undeploy_in_db": { + "patch": { + "tags": ["IOCs"], + "summary": "Undeploy in database", + "description": "Marks an IOC in database as undeployed - will not call AWX", + "operationId": "unDeployInDb", "parameters": [ { "name": "ioc_id", "in": "path", - "description": "Id of IOC to delete", + "description": "The id of the IOC to undeploy", "required": true, "schema": { "type": "integer", @@ -1296,12 +976,15 @@ } ], "responses": { - "204": { - "description": "IOC deleted with its history", + "200": { + "description": "Undeployment created", "content": { "application/json": { "schema": { - "type": "string" + "type": "array", + "items": { + "$ref": "#/components/schemas/Deployment" + } } } } @@ -1317,7 +1000,7 @@ } }, "403": { - "description": "Forbidden: User doesn't have the necessary permissions", + "description": "Forbidden: user doesn't have the necessary permissions to undeploy", "content": { "application/json": { "schema": { @@ -1327,7 +1010,7 @@ } }, "404": { - "description": "IOC not found", + "description": "Not found", "content": { "application/json": { "schema": { @@ -1337,7 +1020,7 @@ } }, "409": { - "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", + "description": "Ongoing deployment, or undeployment for IOC", "content": { "application/json": { "schema": { @@ -1346,8 +1029,8 @@ } } }, - "500": { - "description": "Service exception", + "422": { + "description": "IOC is not deployed", "content": { "application/json": { "schema": { @@ -1356,8 +1039,8 @@ } } }, - "503": { - "description": "Remote service exception", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1372,16 +1055,19 @@ "bearerAuth": [] } ] - }, + } + }, + "/api/v1/iocs/{ioc_id}/active_deployment/host": { "patch": { "tags": ["IOCs"], - "summary": "Updating an IOC by ID", - "operationId": "updateIoc", + "summary": "Modify deployment host in database", + "description": "Modifies host of IOC's active deployment in database - will not call AWX", + "operationId": "updateActiveDeploymentHost", "parameters": [ { "name": "ioc_id", "in": "path", - "description": "Unique ID of IOC", + "description": "The ID of the IOC", "required": true, "schema": { "type": "integer", @@ -1393,7 +1079,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IOCUpdateRequest" + "$ref": "#/components/schemas/UpdateHostRequest" } } }, @@ -1401,11 +1087,14 @@ }, "responses": { "200": { - "description": "IOC updated", + "description": "Successful host update", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Ioc" + "type": "array", + "items": { + "$ref": "#/components/schemas/Ioc" + } } } } @@ -1421,7 +1110,7 @@ } }, "403": { - "description": "Forbidden: User doesn't have the necessary permissions", + "description": "Forbidden: user doesn't have the necessary permissions to modify", "content": { "application/json": { "schema": { @@ -1431,7 +1120,7 @@ } }, "404": { - "description": "Ioc not found", + "description": "Not found", "content": { "application/json": { "schema": { @@ -1441,7 +1130,7 @@ } }, "409": { - "description": "IOC already created or concurrent deployment, undeployment, start or stop for IOC is ongoing", + "description": "Ongoing operation for IOC", "content": { "application/json": { "schema": { @@ -1451,7 +1140,7 @@ } }, "422": { - "description": "Unprocessable request", + "description": "IOC is not deployed", "content": { "application/json": { "schema": { @@ -1469,16 +1158,6 @@ } } } - }, - "503": { - "description": "Remote service exception", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } } }, "security": [ @@ -3705,6 +3384,56 @@ }, "components": { "schemas": { + "HostMigrationResult": { + "type": "object", + "properties": { + "csentryID": { + "type": "integer", + "format": "int64" + }, + "lastKnownHostName": { + "type": "string" + }, + "netBoxId": { + "type": "integer", + "format": "int64" + }, + "log": { + "type": "string" + } + } + }, + "NetBoxMigrationResponse": { + "type": "object", + "properties": { + "hostsRegisteredInDatabase": { + "type": "integer", + "format": "int64" + }, + "hostsFoundInCSEntry": { + "type": "integer", + "format": "int64" + }, + "hostsFoundInNetBox": { + "type": "integer", + "format": "int64" + }, + "failedDueToServiceErrorInCSEntry": { + "type": "integer", + "format": "int64" + }, + "failedDueToServiceErrorInNetBox": { + "type": "integer", + "format": "int64" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostMigrationResult" + } + } + } + }, "GeneralException": { "type": "object", "properties": { @@ -3716,6 +3445,37 @@ } } }, + "CreateIoc": { + "type": "object", + "properties": { + "namingUuid": { + "type": "string" + }, + "gitProjectId": { + "type": "integer", + "format": "int64" + }, + "repository_name": { + "type": "string" + } + }, + "description": "IOC to create" + }, + "Alert": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["ERROR", "WARNING", "INFO"] + }, + "message": { + "type": "string" + }, + "link": { + "type": "string" + } + } + }, "Deployment": { "type": "object", "properties": { @@ -3797,30 +3557,6 @@ } } }, - "UpdateHostRequest": { - "type": "object", - "properties": { - "hostId": { - "type": "string" - } - }, - "description": "IOC to update" - }, - "Alert": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": ["ERROR", "WARNING", "INFO"] - }, - "message": { - "type": "string" - }, - "link": { - "type": "string" - } - } - }, "Ioc": { "type": "object", "properties": { @@ -3864,72 +3600,21 @@ } } }, - "HostMigrationResult": { + "CreateJobRequest": { "type": "object", "properties": { - "csentryID": { - "type": "integer", - "format": "int64" + "type": { + "type": "string", + "enum": ["DEPLOY", "UNDEPLOY", "START", "STOP"] }, - "lastKnownHostName": { + "sourceVersion": { "type": "string" }, - "netBoxId": { - "type": "integer", - "format": "int64" - }, - "log": { + "hostId": { "type": "string" } } }, - "NetBoxMigrationResponse": { - "type": "object", - "properties": { - "hostsRegisteredInDatabase": { - "type": "integer", - "format": "int64" - }, - "hostsFoundInCSEntry": { - "type": "integer", - "format": "int64" - }, - "hostsFoundInNetBox": { - "type": "integer", - "format": "int64" - }, - "failedDueToServiceErrorInCSEntry": { - "type": "integer", - "format": "int64" - }, - "failedDueToServiceErrorInNetBox": { - "type": "integer", - "format": "int64" - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostMigrationResult" - } - } - } - }, - "CreateIoc": { - "type": "object", - "properties": { - "namingUuid": { - "type": "string" - }, - "gitProjectId": { - "type": "integer", - "format": "int64" - }, - "repository_name": { - "type": "string" - } - }, - "description": "IOC to create" - }, "DeploymentHostInfo": { "type": "object", "properties": { @@ -4000,18 +3685,6 @@ } } }, - "UpdateAndDeployIoc": { - "type": "object", - "properties": { - "sourceVersion": { - "type": "string" - }, - "hostId": { - "type": "string" - } - }, - "description": "IOC to update" - }, "AwxJobMeta": { "type": "object", "properties": { @@ -4077,6 +3750,15 @@ } } }, + "UpdateHostRequest": { + "type": "object", + "properties": { + "hostId": { + "type": "string" + } + }, + "description": "IOC to update" + }, "LokiMessage": { "type": "object", "properties": {