diff --git a/src/components/Job/JobDetails.tsx b/src/components/Job/JobDetails.tsx index 9aaa67f317bfdf3eccfe50664252562b9be36e27..efcfdad0a94405e8a37b825fbea88c52ef2635b6 100644 --- a/src/components/Job/JobDetails.tsx +++ b/src/components/Job/JobDetails.tsx @@ -14,7 +14,7 @@ import { STEPPER_STATES, AccessControl } from "@ess-ics/ce-ui-common"; -import { JobTypeIconText } from "./JobIcons"; +import { ActionTypeIconText } from "./JobIcons"; import { DeploymentJobOutput } from "../deployments/DeploymentJobOutput"; import { AWXJobDetails, Status } from "../../api/DataTypes"; import { JobDetailsTable } from "./JobDetailsTable"; @@ -82,7 +82,7 @@ export const JobsDetails = ({ jobDetail: operation }: JobDetailsProps) => { : StepperComponents[STEPPER_STATES.unknown]; const awxJob = useMemo( - () => new AWXJobDetails(operation, operation.type), + () => new AWXJobDetails(operation, operation.action), [operation] ); @@ -98,7 +98,7 @@ export const JobsDetails = ({ jobDetail: operation }: JobDetailsProps) => { <Stack spacing={2}> <Stack>{<AlertBannerList alerts={alerts} />}</Stack> <Box sx={{ paddingLeft: "46px" }}> - <JobTypeIconText type={operation.type} /> + <ActionTypeIconText action={operation.action} /> </Box> <JobDetailsTable operation={operation} /> <KeyValueTable diff --git a/src/components/Job/JobIcons.tsx b/src/components/Job/JobIcons.tsx index dde65dc3ae4eac9608d6007d047d48a1b92227af..7fcf29c4e8d84a9ac3a5088aceef0830310982f1 100644 --- a/src/components/Job/JobIcons.tsx +++ b/src/components/Job/JobIcons.tsx @@ -30,7 +30,7 @@ export const BatchUndeployIcon = ({ ...props }) => ( /> ); -export const JOB_TYPES = { +export const ACTION_TYPES = { DEPLOY: "DEPLOY", UNDEPLOY: "UNDEPLOY", BATCH_DEPLOY: "BATCH_DEPLOY", @@ -39,7 +39,7 @@ export const JOB_TYPES = { STOP: "STOP" }; -export const JobTypesComponent = { +export const ActionTypesComponent = { DEPLOY: { label: "Deployment", icon: DeployIcon @@ -66,11 +66,11 @@ export const JobTypesComponent = { } }; -interface JobTypeIconTextProps { - type: string | undefined; +interface ActionTypeIconTextProps { + action: string | undefined; } -export interface JobType { +export interface ActionType { DEPLOY: string; UNDEPLOY: string; BATCH_DEPLOY: string; @@ -79,8 +79,8 @@ export interface JobType { STOP: string; } -export const JobTypeIconText = ({ type }: JobTypeIconTextProps) => { - const Icon = JobTypesComponent[type as keyof JobType].icon; +export const ActionTypeIconText = ({ action }: ActionTypeIconTextProps) => { + const Icon = ActionTypesComponent[action as keyof ActionType].icon; return ( <Stack @@ -93,7 +93,9 @@ export const JobTypeIconText = ({ type }: JobTypeIconTextProps) => { width="24px" height="24px" /> - <Typography>{JobTypesComponent[type as keyof JobType].label}</Typography> + <Typography> + {ActionTypesComponent[action as keyof ActionType].label} + </Typography> </Stack> ); }; diff --git a/src/components/Job/JobTable/JobDetailsColumn.js b/src/components/Job/JobTable/JobDetailsColumn.js index e49f68ad1e9a68e801cb1ef7aa6a1a0ddd4704a6..ea41471f1684eeefc2a82690612bff9b76ab2415 100644 --- a/src/components/Job/JobTable/JobDetailsColumn.js +++ b/src/components/Job/JobTable/JobDetailsColumn.js @@ -1,12 +1,12 @@ import { getNoOfIOCs, isBatchJob } from "../JobUtils"; import { Stack, Typography } from "@mui/material"; import { InternalLink } from "@ess-ics/ce-ui-common"; -import { JobTypeIconText, JOB_TYPES } from "../JobIcons"; +import { ActionTypeIconText, ACTION_TYPES } from "../JobIcons"; import { JobRevisionChip } from "../JobRevisionChip"; export const JobDetailsColumn = ({ job }) => ( <Stack> - <JobTypeIconText type={job.type} /> + <ActionTypeIconText action={job.action} /> {!isBatchJob(job.type) ? ( <Stack> <Stack @@ -21,7 +21,7 @@ export const JobDetailsColumn = ({ job }) => ( > {job.iocName} </InternalLink> - {job.type === JOB_TYPES.DEPLOY && ( + {job.type === ACTION_TYPES.DEPLOY && ( <JobRevisionChip gitReference={job.gitReference} gitProjectId={job.gitProjectId} diff --git a/src/components/Job/JobUtils.js b/src/components/Job/JobUtils.js index 82e289c650c9fd79a15e2be3d2213fbe9cf8832c..1d510d2b0dc4ad9cfb9cddb2545deb30fa270bdd 100644 --- a/src/components/Job/JobUtils.js +++ b/src/components/Job/JobUtils.js @@ -1,7 +1,7 @@ -import { JOB_TYPES } from "./JobIcons"; +import { ACTION_TYPES } from "./JobIcons"; export const isBatchJob = (type) => - type === JOB_TYPES.BATCH_DEPLOY || type === JOB_TYPES.BATCH_UNDEPLOY; + type === ACTION_TYPES.BATCH_DEPLOY || type === ACTION_TYPES.BATCH_UNDEPLOY; export const getNoOfIOCs = (jobs) => { let count = 0; diff --git a/src/mocks/AppHarness.js b/src/mocks/AppHarness.js index 8efcc0d8932726566b545b925423ade414cf0dc9..6c1af8576b18bbdea84193482e6989f56960a315 100644 --- a/src/mocks/AppHarness.js +++ b/src/mocks/AppHarness.js @@ -7,6 +7,7 @@ import NavigationMenu from "../components/navigation/NavigationMenu"; import { MemoryRouter } from "react-router-dom"; import { DeployAPIProvider } from "../api/DeployApi"; import { TestUserProvider, UserImpersonator } from "./UserImpersonator"; +import { ReduxProvider } from "../store/ReduxProvider"; export function RouterHarness({ children, initialHistory = ["/"] }) { return ( @@ -36,17 +37,19 @@ export function AppHarness({ : UserProvider; return ( - <SnackbarProvider - preventDuplicate - maxSnack="5" - > - <RouterHarness initialHistory={initialHistory}> - <SelectedUserProvider> - <NavigationMenu> - <Container>{children}</Container> - </NavigationMenu> - </SelectedUserProvider> - </RouterHarness> - </SnackbarProvider> + <ReduxProvider> + <SnackbarProvider + preventDuplicate + maxSnack="5" + > + <RouterHarness initialHistory={initialHistory}> + <SelectedUserProvider> + <NavigationMenu> + <Container>{children}</Container> + </NavigationMenu> + </SelectedUserProvider> + </RouterHarness> + </SnackbarProvider> + </ReduxProvider> ); } diff --git a/src/mocks/fixtures/Jobs.json b/src/mocks/fixtures/Jobs.json index 460c039454d07a8d6621b288776fbbd021d81df0..d73e0c37519cd4e9d9ca0987384bbd07ac2a8f32 100644 --- a/src/mocks/fixtures/Jobs.json +++ b/src/mocks/fixtures/Jobs.json @@ -10,7 +10,7 @@ "startTime": "2024-09-23T10:35:18.888+0200", "createdAt": "2024-09-23T10:34:43.512+0200", "finishedAt": "2024-09-23T10:37:21.050+0200", - "type": "DEPLOY", + "action": "DEPLOY", "iocName": "MOCK:TEST-1", "iocId": 56, "deploymentId": 550, @@ -61,7 +61,7 @@ "startTime": "2024-09-23T10:30:54.378+0200", "createdAt": "2024-09-23T10:30:18.279+0200", "finishedAt": "2024-09-23T10:32:22.117+0200", - "type": "DEPLOY", + "action": "DEPLOY", "iocName": "MOCK:TEST-2", "iocId": 14, "deploymentId": 549, @@ -111,7 +111,7 @@ "createdBy": "testuser", "startTime": "2024-09-18T14:31:20.396+0200", "createdAt": "2024-09-18T14:30:46.458+0200", - "type": "UNDEPLOY", + "action": "UNDEPLOY", "iocName": "MOCK:TEST-3", "iocId": 14, "deploymentId": 548, @@ -162,7 +162,7 @@ "startTime": "2024-09-06T10:33:11.755+0200", "createdAt": "2024-09-06T10:32:38.428+0200", "finishedAt": "2024-09-06T10:35:12.947+0200", - "type": "BATCH_DEPLOY", + "action": "BATCH_DEPLOY", "iocName": "MOCK:TEST-4", "iocId": 56, "deploymentId": 538, @@ -232,7 +232,7 @@ "startTime": "2024-09-06T14:31:51.145+0200", "createdAt": "2024-09-06T14:31:17.365+0200", "finishedAt": "2024-09-06T14:33:40.559+0200", - "type": "BATCH_UNDEPLOY", + "action": "BATCH_UNDEPLOY", "iocName": "MOCK:TEST-5", "iocId": 56, "deploymentId": 543, @@ -324,7 +324,7 @@ "startTime": "2024-09-16T15:34:29.160+0200", "createdAt": "2024-09-16T15:33:55.669+0200", "finishedAt": "2024-09-16T15:36:37.864+0200", - "type": "DEPLOY", + "action": "DEPLOY", "iocName": "MOCK:TEST-6", "iocId": 14, "deploymentId": 547, @@ -375,7 +375,7 @@ "startTime": "2024-09-16T15:20:10.295+0200", "createdAt": "2024-09-16T15:20:09.768+0200", "finishedAt": "2024-09-16T15:20:21.245+0200", - "type": "STOP", + "action": "STOP", "iocName": "MOCK:TEST-7", "iocId": 18, "deploymentId": 533, @@ -426,7 +426,7 @@ "startTime": "2024-09-16T13:48:49.337+0200", "createdAt": "2024-09-16T13:48:15.458+0200", "finishedAt": "2024-09-16T13:50:22.662+0200", - "type": "DEPLOY", + "action": "DEPLOY", "iocName": "MOCK:TEST-8", "iocId": 15, "deploymentId": 546, @@ -477,7 +477,7 @@ "startTime": "2024-09-16T13:47:21.154+0200", "createdAt": "2024-09-16T13:47:20.615+0200", "finishedAt": "2024-09-16T13:47:32.327+0200", - "type": "STOP", + "action": "STOP", "iocName": "MOCK:TEST-9", "iocId": 55, "deploymentId": 503, @@ -528,7 +528,7 @@ "startTime": "2024-09-09T09:35:18.593+0200", "createdAt": "2024-09-09T09:35:17.895+0200", "finishedAt": "2024-09-09T09:35:29.554+0200", - "type": "START", + "action": "START", "iocName": "MOCK:TEST-10", "iocId": 55, "deploymentId": 503, @@ -579,7 +579,7 @@ "startTime": "2024-09-06T14:47:35.225+0200", "createdAt": "2024-09-06T14:47:01.679+0200", "finishedAt": "2024-09-06T14:49:09.593+0200", - "type": "DEPLOY", + "action": "DEPLOY", "iocName": "MOCK:TEST-11", "iocId": 15, "deploymentId": 545, @@ -630,7 +630,7 @@ "startTime": "2024-09-06T14:42:54.617+0200", "createdAt": "2024-09-06T14:42:20.991+0200", "finishedAt": "2024-09-06T14:44:59.093+0200", - "type": "DEPLOY", + "action": "DEPLOY", "iocName": "MOCK:TEST-12", "iocId": 56, "deploymentId": 544, @@ -681,7 +681,7 @@ "startTime": "2024-09-06T13:11:11.574+0200", "createdAt": "2024-09-06T13:10:38.519+0200", "finishedAt": "2024-09-06T13:13:14.222+0200", - "type": "DEPLOY", + "action": "DEPLOY", "iocName": "MOCK:TEST-13", "iocId": 56, "deploymentId": 542, @@ -732,7 +732,7 @@ "startTime": "2024-09-06T11:12:11.060+0200", "createdAt": "2024-09-06T11:11:37.892+0200", "finishedAt": "2024-09-06T11:13:59.842+0200", - "type": "UNDEPLOY", + "action": "UNDEPLOY", "iocName": "MOCK:TEST-14", "iocId": 56, "deploymentId": 541, @@ -773,7 +773,7 @@ "startTime": "2024-09-06T10:56:39.406+0200", "createdAt": "2024-09-06T10:56:03.985+0200", "finishedAt": "2024-09-06T10:58:43.884+0200", - "type": "DEPLOY", + "action": "DEPLOY", "iocName": "MOCK:TEST-15", "iocId": 56, "deploymentId": 540, @@ -818,7 +818,7 @@ "startTime": "2024-09-06T10:44:20.263+0200", "createdAt": "2024-09-06T10:43:46.916+0200", "finishedAt": "2024-09-06T10:46:15.226+0200", - "type": "UNDEPLOY", + "action": "UNDEPLOY", "iocName": "MOCK:TEST-16", "iocId": 56, "deploymentId": 539, @@ -853,7 +853,7 @@ "startTime": "2024-09-05T13:48:05.214+0200", "createdAt": "2024-09-05T13:47:30.630+0200", "finishedAt": "2024-09-05T13:50:15.985+0200", - "type": "DEPLOY", + "action": "DEPLOY", "iocName": "MOCK:TEST-17", "iocId": 56, "deploymentId": 537, @@ -898,7 +898,7 @@ "startTime": "2024-09-05T13:45:07.896+0200", "createdAt": "2024-09-05T13:44:33.728+0200", "finishedAt": "2024-09-05T13:46:58.327+0200", - "type": "UNDEPLOY", + "action": "UNDEPLOY", "iocName": "MOCK:TEST-18", "iocId": 56, "deploymentId": 536, @@ -933,7 +933,7 @@ "startTime": "2024-09-02T14:22:25.067+0200", "createdAt": "2024-09-02T14:22:24.551+0200", "finishedAt": "2024-09-02T14:22:35.514+0200", - "type": "STOP", + "action": "STOP", "iocName": "MOCK:TEST-19", "iocId": 56, "deploymentId": 535, @@ -968,7 +968,7 @@ "startTime": "2024-08-30T16:20:11.154+0200", "createdAt": "2024-08-30T16:19:38.070+0200", "finishedAt": "2024-08-30T16:22:15.652+0200", - "type": "DEPLOY", + "action": "DEPLOY", "iocName": "MOCK:TEST-20", "iocId": 56, "deploymentId": 535, diff --git a/src/mocks/fixtures/ccce-api.json b/src/mocks/fixtures/ccce-api.json index 71f86e6cbad649b6d79a06fd1a8a1b884ce8fc24..90f87924d60acacf81d0e4ee8594054917ceda17 100644 --- a/src/mocks/fixtures/ccce-api.json +++ b/src/mocks/fixtures/ccce-api.json @@ -60,8 +60,8 @@ "required": true }, "responses": { - "500": { - "description": "Service exception", + "400": { + "description": "Incomplete request", "content": { "application/json": { "schema": { @@ -70,8 +70,8 @@ } } }, - "422": { - "description": "Unprocessable request", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -80,8 +80,8 @@ } } }, - "400": { - "description": "Incomplete request", + "422": { + "description": "Unprocessable request", "content": { "application/json": { "schema": { @@ -90,18 +90,18 @@ } } }, - "201": { - "description": "Maintenance Mode Changed", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MaintenanceMode" + "$ref": "#/components/schemas/GeneralException" } } } }, - "503": { - "description": "Remote service exception", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", "content": { "application/json": { "schema": { @@ -110,8 +110,8 @@ } } }, - "409": { - "description": "Maintenance Mode already set to that value", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { @@ -120,8 +120,8 @@ } } }, - "401": { - "description": "Unauthorized", + "409": { + "description": "Maintenance Mode already set to that value", "content": { "application/json": { "schema": { @@ -130,12 +130,12 @@ } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions", + "201": { + "description": "Maintenance Mode Changed", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/MaintenanceMode" } } } @@ -176,8 +176,18 @@ "required": true }, "responses": { - "424": { - "description": "Metadata file not found, or not processable", + "201": { + "description": "IOC job initiated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Job" + } + } + } + }, + "400": { + "description": "Incomplete request", "content": { "application/json": { "schema": { @@ -216,8 +226,28 @@ } } }, - "400": { - "description": "Incomplete request", + "424": { + "description": "Metadata file not found, or not processable", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { @@ -236,6 +266,90 @@ } } }, + "409": { + "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/api/v1/jobs/batch/undeploy": { + "post": { + "tags": ["Jobs"], + "summary": "Starts multiple IOC undeployments", + "operationId": "startBatchUndeployment", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BatchUndeploymentRequest" + } + } + }, + "required": true + }, + "responses": { + "400": { + "description": "Incomplete request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "500": { + "description": "Service exception", + "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" + } + } + } + }, + "424": { + "description": "Metadata file not found, or not processable", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, "503": { "description": "Remote service exception", "content": { @@ -246,6 +360,16 @@ } } }, + "422": { + "description": "IOC has no active / NetBox host not found / IOC is not deployed correctly", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, "409": { "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", "content": { @@ -257,11 +381,75 @@ } }, "201": { - "description": "IOC job initiated", + "description": "IOC undeployment initiated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Job" + "$ref": "#/components/schemas/BatchJob" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/api/v1/jobs/batch/deploy": { + "post": { + "tags": ["Jobs"], + "summary": "Starts multiple IOC deployments", + "operationId": "startBatchDeployment", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BatchDeploymentRequest" + } + } + }, + "required": true + }, + "responses": { + "400": { + "description": "Incomplete request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "500": { + "description": "Service exception", + "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" + } + } + } + }, + "424": { + "description": "Metadata file not found, or not processable", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" } } } @@ -275,6 +463,46 @@ } } } + }, + "503": { + "description": "Remote service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "201": { + "description": "IOC job initiated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BatchJob" + } + } + } + }, + "422": { + "description": "IOC has no active / NetBox host not found / IOC is not deployed correctly", + "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" + } + } + } } }, "security": [ @@ -417,22 +645,22 @@ } } }, - "200": { - "description": "A paged array of IOCs", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PagedIocResponse" + "$ref": "#/components/schemas/GeneralException" } } } }, - "401": { - "description": "Unauthorized", + "200": { + "description": "A paged array of IOCs", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/PagedIocResponse" } } } @@ -454,8 +682,8 @@ "required": true }, "responses": { - "424": { - "description": "Metadata file not found, or not processable", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -464,8 +692,8 @@ } } }, - "500": { - "description": "Service exception", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions in Gitlab", "content": { "application/json": { "schema": { @@ -474,18 +702,18 @@ } } }, - "201": { - "description": "IOC created", + "422": { + "description": "Unprocessable request", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Ioc" + "$ref": "#/components/schemas/GeneralException" } } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions in Gitlab", + "424": { + "description": "Metadata file not found, or not processable", "content": { "application/json": { "schema": { @@ -494,8 +722,8 @@ } } }, - "422": { - "description": "Unprocessable request", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -504,8 +732,8 @@ } } }, - "503": { - "description": "Remote service exception", + "400": { + "description": "Incomplete, or bad request", "content": { "application/json": { "schema": { @@ -524,8 +752,8 @@ } } }, - "400": { - "description": "Incomplete, or bad request", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { @@ -534,12 +762,12 @@ } } }, - "401": { - "description": "Unauthorized", + "201": { + "description": "IOC created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/Ioc" } } } @@ -578,8 +806,8 @@ } } }, - "404": { - "description": "Job not found", + "200": { + "description": "Job updated", "content": { "application/json": { "schema": { @@ -588,8 +816,8 @@ } } }, - "200": { - "description": "Job updated", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -598,8 +826,8 @@ } } }, - "401": { - "description": "Unauthorized", + "404": { + "description": "Job not found", "content": { "application/json": { "schema": { @@ -643,8 +871,8 @@ } } }, - "403": { - "description": "Permission denied", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -653,8 +881,8 @@ } } }, - "503": { - "description": "Login server unavailable", + "403": { + "description": "Permission denied", "content": { "application/json": { "schema": { @@ -663,8 +891,8 @@ } } }, - "401": { - "description": "Unauthorized", + "503": { + "description": "Login server unavailable", "content": { "application/json": { "schema": { @@ -728,8 +956,8 @@ } } }, - "403": { - "description": "User doesn't have permission to log in", + "503": { + "description": "Login server unavailable", "content": { "application/json": { "schema": { @@ -738,8 +966,8 @@ } } }, - "503": { - "description": "Login server unavailable", + "403": { + "description": "User doesn't have permission to log in", "content": { "application/json": { "schema": { @@ -769,8 +997,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "404": { + "description": "Ioc not found", "content": { "application/json": { "schema": { @@ -779,22 +1007,22 @@ } } }, - "200": { - "description": "Found IOC", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IocDetails" + "$ref": "#/components/schemas/GeneralException" } } } }, - "404": { - "description": "Ioc not found", + "200": { + "description": "Found IOC", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/IocDetails" } } } @@ -828,8 +1056,8 @@ } ], "responses": { - "503": { - "description": "Git repository can not be deleted", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -838,8 +1066,8 @@ } } }, - "500": { - "description": "Service exception", + "503": { + "description": "Git repository can not be deleted", "content": { "application/json": { "schema": { @@ -858,8 +1086,8 @@ } } }, - "409": { - "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -868,28 +1096,28 @@ } } }, - "204": { - "description": "IOC deleted", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", "content": { "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/GeneralException" } } } }, - "401": { - "description": "Unauthorized", + "204": { + "description": "IOC deleted", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "string" } } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions", + "409": { + "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", "content": { "application/json": { "schema": { @@ -932,8 +1160,8 @@ "required": true }, "responses": { - "500": { - "description": "Service exception", + "404": { + "description": "Ioc not found", "content": { "application/json": { "schema": { @@ -942,12 +1170,12 @@ } } }, - "200": { - "description": "IOC updated", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Ioc" + "$ref": "#/components/schemas/GeneralException" } } } @@ -962,8 +1190,8 @@ } } }, - "404": { - "description": "Ioc not found", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -972,8 +1200,8 @@ } } }, - "409": { - "description": "IOC already created or concurrent deployment, undeployment, start or stop for IOC is ongoing", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", "content": { "application/json": { "schema": { @@ -992,8 +1220,8 @@ } } }, - "401": { - "description": "Unauthorized", + "409": { + "description": "IOC already created or concurrent deployment, undeployment, start or stop for IOC is ongoing", "content": { "application/json": { "schema": { @@ -1002,12 +1230,12 @@ } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions", + "200": { + "description": "IOC updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/Ioc" } } } @@ -1059,8 +1287,8 @@ } } }, - "403": { - "description": "Forbidden: user doesn't have the necessary permissions to undeploy", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -1069,18 +1297,21 @@ } } }, - "404": { - "description": "Not found", + "200": { + "description": "Undeployment created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/Deployment" + } } } } }, - "422": { - "description": "IOC is not deployed", + "403": { + "description": "Forbidden: user doesn't have the necessary permissions to undeploy", "content": { "application/json": { "schema": { @@ -1089,8 +1320,8 @@ } } }, - "401": { - "description": "Unauthorized", + "422": { + "description": "IOC is not deployed", "content": { "application/json": { "schema": { @@ -1099,15 +1330,12 @@ } } }, - "200": { - "description": "Undeployment created", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Deployment" - } + "$ref": "#/components/schemas/GeneralException" } } } @@ -1149,18 +1377,21 @@ "required": true }, "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Successful host update", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/Ioc" + } } } } }, - "404": { - "description": "Not found", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1169,8 +1400,8 @@ } } }, - "422": { - "description": "IOC is not deployed", + "403": { + "description": "Forbidden: user doesn't have the necessary permissions to modify", "content": { "application/json": { "schema": { @@ -1179,8 +1410,8 @@ } } }, - "401": { - "description": "Unauthorized", + "409": { + "description": "Ongoing operation for IOC", "content": { "application/json": { "schema": { @@ -1189,21 +1420,18 @@ } } }, - "200": { - "description": "Successful host update", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Ioc" - } + "$ref": "#/components/schemas/GeneralException" } } } }, - "403": { - "description": "Forbidden: user doesn't have the necessary permissions to modify", + "422": { + "description": "IOC is not deployed", "content": { "application/json": { "schema": { @@ -1212,8 +1440,8 @@ } } }, - "409": { - "description": "Ongoing operation for IOC", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { @@ -1304,18 +1532,18 @@ } ], "responses": { - "503": { - "description": "Remote server exception", + "200": { + "description": "A paged array of Channel Finder records", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/PagedRecordResponse" } } } }, - "500": { - "description": "Service exception", + "503": { + "description": "Remote server exception", "content": { "application/json": { "schema": { @@ -1324,12 +1552,12 @@ } } }, - "200": { - "description": "A paged array of Channel Finder records", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PagedRecordResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -1364,22 +1592,22 @@ } } }, - "404": { - "description": "Record not found", + "200": { + "description": "Found record", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/RecordDetails" } } } }, - "200": { - "description": "Found record", + "404": { + "description": "Record not found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RecordDetails" + "$ref": "#/components/schemas/GeneralException" } } } @@ -1404,21 +1632,18 @@ } ], "responses": { - "200": { - "description": "Naming names, and UUIDs from the Names service", + "503": { + "description": "Remote service unreachable", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/NameResponse" - } + "$ref": "#/components/schemas/GeneralException" } } } }, - "503": { - "description": "Remote service unreachable", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1427,12 +1652,15 @@ } } }, - "500": { - "description": "Service exception", + "200": { + "description": "Naming names, and UUIDs from the Names service", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/NameResponse" + } } } } @@ -1512,22 +1740,22 @@ "summary": "Get Current Maintenance Mode", "operationId": "getCurrentMode", "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Found Mode", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/MaintenanceMode" } } } }, - "200": { - "description": "Found Mode", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MaintenanceMode" + "$ref": "#/components/schemas/GeneralException" } } } @@ -1549,8 +1777,8 @@ "summary": "End Current Maintenance Mode", "operationId": "endCurrentMaintenanceMode", "responses": { - "500": { - "description": "Service exception", + "400": { + "description": "Incomplete request", "content": { "application/json": { "schema": { @@ -1559,11 +1787,8 @@ } } }, - "204": { - "description": "Maintenance Mode ended" - }, - "422": { - "description": "Unprocessable request", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1572,8 +1797,11 @@ } } }, - "400": { - "description": "Incomplete request", + "204": { + "description": "Maintenance Mode ended" + }, + "422": { + "description": "Unprocessable request", "content": { "application/json": { "schema": { @@ -1582,8 +1810,8 @@ } } }, - "503": { - "description": "Remote service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -1592,8 +1820,8 @@ } } }, - "401": { - "description": "Unauthorized", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", "content": { "application/json": { "schema": { @@ -1602,8 +1830,8 @@ } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { @@ -1770,22 +1998,22 @@ } } }, - "200": { - "description": "A paged array of deployments", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PagedJobResponse" + "$ref": "#/components/schemas/GeneralException" } } } }, - "401": { - "description": "Unauthorized", + "200": { + "description": "A paged array of deployments", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/PagedJobResponse" } } } @@ -1821,12 +2049,12 @@ } } }, - "404": { - "description": "Not found", + "200": { + "description": "Job details", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/JobDetails" } } } @@ -1841,12 +2069,12 @@ } } }, - "200": { - "description": "Job details", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/JobDetails" + "$ref": "#/components/schemas/GeneralException" } } } @@ -1882,8 +2110,8 @@ } } }, - "404": { - "description": "Job not found", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -1892,8 +2120,8 @@ } } }, - "503": { - "description": "Remote service exception", + "404": { + "description": "Job not found", "content": { "application/json": { "schema": { @@ -1902,22 +2130,22 @@ } } }, - "200": { - "description": "Job details", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AwxJobDetails" + "$ref": "#/components/schemas/GeneralException" } } } }, - "401": { - "description": "Unauthorized", + "200": { + "description": "Job details", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/AwxJobDetails" } } } @@ -1953,22 +2181,22 @@ } } }, - "200": { - "description": "Job log", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AwxJobLog" + "$ref": "#/components/schemas/GeneralException" } } } }, - "404": { - "description": "Deployment not found", + "200": { + "description": "Job log", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/AwxJobLog" } } } @@ -1983,8 +2211,8 @@ } } }, - "401": { - "description": "Unauthorized", + "404": { + "description": "Deployment not found", "content": { "application/json": { "schema": { @@ -2019,8 +2247,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "404": { + "description": "Ioc not found", "content": { "application/json": { "schema": { @@ -2029,18 +2257,18 @@ } } }, - "401": { - "description": "Unauthorized", + "200": { + "description": "Log lines", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/IocStatusResponse" } } } }, - "404": { - "description": "Ioc not found", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -2049,12 +2277,12 @@ } } }, - "200": { - "description": "Log lines", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IocStatusResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2080,8 +2308,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "404": { + "description": "Ioc not found", "content": { "application/json": { "schema": { @@ -2090,22 +2318,22 @@ } } }, - "200": { - "description": "Found IOC description", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IocDescriptionResponse" + "$ref": "#/components/schemas/GeneralException" } } } }, - "404": { - "description": "Ioc not found", + "200": { + "description": "Found IOC description", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/IocDescriptionResponse" } } } @@ -2131,8 +2359,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "404": { + "description": "Ioc not found", "content": { "application/json": { "schema": { @@ -2141,22 +2369,22 @@ } } }, - "404": { - "description": "Ioc not found", + "200": { + "description": "Alerts of the IOC", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/IocAlertResponse" } } } }, - "200": { - "description": "Alerts of the IOC", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IocAlertResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2200,8 +2428,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "503": { + "description": "Logging server unavailable", "content": { "application/json": { "schema": { @@ -2210,28 +2438,28 @@ } } }, - "401": { - "description": "Unauthorized", + "200": { + "description": "Log lines", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/LokiResponse" } } } }, - "200": { - "description": "Log lines", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LokiResponse" + "$ref": "#/components/schemas/GeneralException" } } } }, - "503": { - "description": "Logging server unavailable", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -2385,18 +2613,18 @@ } } }, - "200": { - "description": "A paged array of hosts", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PagedNetBoxHostResponse" + "$ref": "#/components/schemas/GeneralException" } } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -2405,12 +2633,12 @@ } } }, - "401": { - "description": "Unauthorized", + "200": { + "description": "A paged array of hosts", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/PagedNetBoxHostResponse" } } } @@ -2445,8 +2673,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "503": { + "description": "Logging server unavailable", "content": { "application/json": { "schema": { @@ -2455,28 +2683,28 @@ } } }, - "401": { - "description": "Unauthorized", + "200": { + "description": "Log lines", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/LokiResponse" } } } }, - "200": { - "description": "Log lines", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LokiResponse" + "$ref": "#/components/schemas/GeneralException" } } } }, - "503": { - "description": "Logging server unavailable", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -2530,22 +2758,22 @@ } } }, - "404": { - "description": "Not found", + "200": { + "description": "Host status", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/HostStatusResponse" } } } }, - "200": { - "description": "Host status", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HostStatusResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2680,8 +2908,8 @@ } } }, - "404": { - "description": "Not found", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -2690,22 +2918,22 @@ } } }, - "200": { - "description": "Found Host", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HostInfoWithId" + "$ref": "#/components/schemas/GeneralException" } } } }, - "401": { - "description": "Unauthorized", + "200": { + "description": "Found Host", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/HostInfoWithId" } } } @@ -2800,8 +3028,8 @@ } } }, - "404": { - "description": "Not found", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -2810,22 +3038,22 @@ } } }, - "200": { - "description": "Found Host", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HostInfoWithId" + "$ref": "#/components/schemas/GeneralException" } } } }, - "401": { - "description": "Unauthorized", + "200": { + "description": "Found Host", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/HostInfoWithId" } } } @@ -2870,8 +3098,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "503": { + "description": "Git exception", "content": { "application/json": { "schema": { @@ -2880,18 +3108,21 @@ } } }, - "503": { - "description": "Git exception", + "200": { + "description": "List of Tags and CommitIds for a specific GitLab repo", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/GitReference" + } } } } }, - "401": { - "description": "Unauthorized", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -2900,15 +3131,12 @@ } } }, - "200": { - "description": "List of Tags and CommitIds for a specific GitLab repo", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GitReference" - } + "$ref": "#/components/schemas/GeneralException" } } } @@ -2943,8 +3171,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "503": { + "description": "Git exception", "content": { "application/json": { "schema": { @@ -2953,22 +3181,22 @@ } } }, - "503": { - "description": "Git exception", + "200": { + "description": "Git reference type", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/ReferenceTypeResponse" } } } }, - "200": { - "description": "Git reference type", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ReferenceTypeResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2993,8 +3221,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "503": { + "description": "Git exception", "content": { "application/json": { "schema": { @@ -3003,8 +3231,8 @@ } } }, - "503": { - "description": "Git exception", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -3013,8 +3241,8 @@ } } }, - "404": { - "description": "Not found", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -3023,25 +3251,25 @@ } } }, - "401": { - "description": "Unauthorized", + "200": { + "description": "Information about the current user", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/UserInfoResponse" + } } } } }, - "200": { - "description": "Information about the current user", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserInfoResponse" - } + "$ref": "#/components/schemas/GeneralException" } } } @@ -3071,8 +3299,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "503": { + "description": "Git exception", "content": { "application/json": { "schema": { @@ -3081,18 +3309,21 @@ } } }, - "503": { - "description": "Git exception", + "200": { + "description": "List of Gitlab projects of allowed groups", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/GitProject" + } } } } }, - "401": { - "description": "Unauthorized", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -3101,15 +3332,12 @@ } } }, - "200": { - "description": "List of Gitlab projects of allowed groups", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GitProject" - } + "$ref": "#/components/schemas/GeneralException" } } } @@ -3140,8 +3368,8 @@ } ], "responses": { - "500": { - "description": "Service exception", + "503": { + "description": "Git exception", "content": { "application/json": { "schema": { @@ -3150,8 +3378,8 @@ } } }, - "503": { - "description": "Git exception", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -3201,18 +3429,21 @@ } ], "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Ok", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "type": "string" + } } } } }, - "404": { - "description": "Role not found by authorization service", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -3221,15 +3452,12 @@ } } }, - "200": { - "description": "Ok", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "type": "string" - } + "$ref": "#/components/schemas/GeneralException" } } } @@ -3244,8 +3472,8 @@ } } }, - "401": { - "description": "Unauthorized", + "404": { + "description": "Role not found by authorization service", "content": { "application/json": { "schema": { @@ -3269,18 +3497,21 @@ "description": "Get user roles from authorization service", "operationId": "getUserRoles", "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Ok", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "type": "string" + } } } } }, - "403": { - "description": "Permission denied", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -3289,21 +3520,18 @@ } } }, - "200": { - "description": "Ok", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "type": "string" - } + "$ref": "#/components/schemas/GeneralException" } } } }, - "503": { - "description": "Login server unavailable", + "403": { + "description": "Permission denied", "content": { "application/json": { "schema": { @@ -3312,8 +3540,8 @@ } } }, - "401": { - "description": "Unauthorized", + "503": { + "description": "Login server unavailable", "content": { "application/json": { "schema": { @@ -3337,8 +3565,8 @@ "description": "Logging out the user", "operationId": "logout", "responses": { - "500": { - "description": "Service exception", + "503": { + "description": "Login server unavailable or remote error", "content": { "application/json": { "schema": { @@ -3347,8 +3575,8 @@ } } }, - "503": { - "description": "Login server unavailable or remote error", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -3427,7 +3655,14 @@ "properties": { "type": { "type": "string", - "enum": ["DEPLOY", "UNDEPLOY", "START", "STOP"] + "enum": [ + "DEPLOY", + "UNDEPLOY", + "START", + "STOP", + "BATCH_DEPLOY", + "BATCH_UNDEPLOY" + ] }, "sourceVersion": { "type": "string" @@ -3479,10 +3714,115 @@ "type": "string", "format": "date-time" }, - "type": { + "action": { + "type": "string", + "enum": [ + "DEPLOY", + "UNDEPLOY", + "START", + "STOP", + "BATCH_DEPLOY", + "BATCH_UNDEPLOY" + ] + }, + "status": { + "type": "string", + "enum": ["UNKNOWN", "QUEUED", "RUNNING", "FAILED", "SUCCESSFUL"] + }, + "iocName": { + "type": "string" + }, + "iocId": { + "type": "integer", + "format": "int64" + }, + "deploymentId": { + "type": "integer", + "format": "int64" + }, + "gitProjectId": { + "type": "integer", + "format": "int64" + }, + "gitReference": { + "type": "string" + }, + "host": { + "$ref": "#/components/schemas/DeploymentHostInfo" + } + } + }, + "BatchUndeploymentRequest": { + "type": "object", + "properties": { + "undeployments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UndeploymentRequest" + } + } + } + }, + "UndeploymentRequest": { + "type": "object", + "properties": { + "iocId": { + "type": "integer", + "format": "int64" + }, + "hostId": { + "type": "string" + } + } + }, + "BatchJob": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "createdBy": { + "type": "string" + }, + "startTime": { + "type": "string", + "format": "date-time" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "finishedAt": { + "type": "string", + "format": "date-time" + }, + "action": { + "type": "string", + "enum": [ + "DEPLOY", + "UNDEPLOY", + "START", + "STOP", + "BATCH_DEPLOY", + "BATCH_UNDEPLOY" + ] + }, + "status": { "type": "string", - "enum": ["DEPLOY", "UNDEPLOY", "START", "STOP"] + "enum": ["UNKNOWN", "QUEUED", "RUNNING", "FAILED", "SUCCESSFUL"] }, + "jobs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/JobEntry" + } + } + } + }, + "JobEntry": { + "type": "object", + "properties": { "iocName": { "type": "string" }, @@ -3510,6 +3850,32 @@ } } }, + "BatchDeploymentRequest": { + "type": "object", + "properties": { + "deployments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DeploymentRequest" + } + } + } + }, + "DeploymentRequest": { + "type": "object", + "properties": { + "iocId": { + "type": "integer", + "format": "int64" + }, + "sourceVersion": { + "type": "string" + }, + "hostId": { + "type": "string" + } + } + }, "CreateIoc": { "type": "object", "properties": { @@ -3842,6 +4208,45 @@ } } }, + "BaseJob": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "createdBy": { + "type": "string" + }, + "startTime": { + "type": "string", + "format": "date-time" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "finishedAt": { + "type": "string", + "format": "date-time" + }, + "action": { + "type": "string", + "enum": [ + "DEPLOY", + "UNDEPLOY", + "START", + "STOP", + "BATCH_DEPLOY", + "BATCH_UNDEPLOY" + ] + }, + "status": { + "type": "string", + "enum": ["UNKNOWN", "QUEUED", "RUNNING", "FAILED", "SUCCESSFUL"] + } + } + }, "PagedJobResponse": { "type": "object", "properties": { @@ -3864,7 +4269,7 @@ "jobs": { "type": "array", "items": { - "$ref": "#/components/schemas/Job" + "$ref": "#/components/schemas/BaseJob" } } } @@ -3920,9 +4325,20 @@ "type": "string", "format": "date-time" }, - "type": { + "action": { + "type": "string", + "enum": [ + "DEPLOY", + "UNDEPLOY", + "START", + "STOP", + "BATCH_DEPLOY", + "BATCH_UNDEPLOY" + ] + }, + "status": { "type": "string", - "enum": ["DEPLOY", "UNDEPLOY", "START", "STOP"] + "enum": ["UNKNOWN", "QUEUED", "RUNNING", "FAILED", "SUCCESSFUL"] }, "iocName": { "type": "string" @@ -3942,10 +4358,6 @@ "gitReference": { "type": "string" }, - "status": { - "type": "string", - "enum": ["UNKNOWN", "QUEUED", "RUNNING", "FAILED", "SUCCESSFUL"] - }, "gitProjectUrl": { "type": "string" }, diff --git a/src/store/deployApi.ts b/src/store/deployApi.ts index 62ee2e8325fca18dfb0dd9692cf23bb7a608b07f..5321ec51cd6b51fd4b89271b0c2d40af92ad8710 100644 --- a/src/store/deployApi.ts +++ b/src/store/deployApi.ts @@ -18,6 +18,26 @@ const injectedRtkApi = api.injectEndpoints({ body: queryArg.createJobRequest }) }), + startBatchUndeployment: build.mutation< + StartBatchUndeploymentApiResponse, + StartBatchUndeploymentApiArg + >({ + query: (queryArg) => ({ + url: `/api/v1/jobs/batch/undeploy`, + method: "POST", + body: queryArg.batchUndeploymentRequest + }) + }), + startBatchDeployment: build.mutation< + StartBatchDeploymentApiResponse, + StartBatchDeploymentApiArg + >({ + query: (queryArg) => ({ + url: `/api/v1/jobs/batch/deploy`, + method: "POST", + body: queryArg.batchDeploymentRequest + }) + }), listIocs: build.query<ListIocsApiResponse, ListIocsApiArg>({ query: (queryArg) => ({ url: `/api/v1/iocs`, @@ -365,6 +385,16 @@ export type StartJobApiArg = { iocId: number; createJobRequest: CreateJobRequest; }; +export type StartBatchUndeploymentApiResponse = + /** status 201 IOC undeployment initiated */ BatchJob; +export type StartBatchUndeploymentApiArg = { + batchUndeploymentRequest: BatchUndeploymentRequest; +}; +export type StartBatchDeploymentApiResponse = + /** status 201 IOC job initiated */ BatchJob; +export type StartBatchDeploymentApiArg = { + batchDeploymentRequest: BatchDeploymentRequest; +}; export type ListIocsApiResponse = /** status 200 A paged array of IOCs */ PagedIocResponse; export type ListIocsApiArg = { @@ -698,20 +728,72 @@ export type Job = { startTime?: string; createdAt?: string; finishedAt?: string; - type?: "DEPLOY" | "UNDEPLOY" | "START" | "STOP"; + action?: + | "DEPLOY" + | "UNDEPLOY" + | "START" + | "STOP" + | "BATCH_DEPLOY" + | "BATCH_UNDEPLOY"; + status?: "UNKNOWN" | "QUEUED" | "RUNNING" | "FAILED" | "SUCCESSFUL"; iocName?: string; iocId?: number; deploymentId?: number; gitProjectId?: number; gitReference?: string; - status?: "UNKNOWN" | "QUEUED" | "RUNNING" | "FAILED" | "SUCCESSFUL"; host?: DeploymentHostInfo; }; export type CreateJobRequest = { - type?: "DEPLOY" | "UNDEPLOY" | "START" | "STOP"; + type?: + | "DEPLOY" + | "UNDEPLOY" + | "START" + | "STOP" + | "BATCH_DEPLOY" + | "BATCH_UNDEPLOY"; sourceVersion?: string; hostId?: string; }; +export type JobEntry = { + iocName?: string; + iocId?: number; + deploymentId?: number; + gitProjectId?: number; + gitReference?: string; + status?: "UNKNOWN" | "QUEUED" | "RUNNING" | "FAILED" | "SUCCESSFUL"; + host?: DeploymentHostInfo; +}; +export type BatchJob = { + id?: number; + createdBy?: string; + startTime?: string; + createdAt?: string; + finishedAt?: string; + action?: + | "DEPLOY" + | "UNDEPLOY" + | "START" + | "STOP" + | "BATCH_DEPLOY" + | "BATCH_UNDEPLOY"; + status?: "UNKNOWN" | "QUEUED" | "RUNNING" | "FAILED" | "SUCCESSFUL"; + jobs?: JobEntry[]; +}; +export type UndeploymentRequest = { + iocId?: number; + hostId?: string; +}; +export type BatchUndeploymentRequest = { + undeployments?: UndeploymentRequest[]; +}; +export type DeploymentRequest = { + iocId?: number; + sourceVersion?: string; + hostId?: string; +}; +export type BatchDeploymentRequest = { + deployments?: DeploymentRequest[]; +}; export type ActiveDeployment = { host?: DeploymentHostInfo; sourceVersion?: string; @@ -857,12 +939,27 @@ export type NameResponse = { export type IdUsedByIoc = { iocId?: number; }; +export type BaseJob = { + id?: number; + createdBy?: string; + startTime?: string; + createdAt?: string; + finishedAt?: string; + action?: + | "DEPLOY" + | "UNDEPLOY" + | "START" + | "STOP" + | "BATCH_DEPLOY" + | "BATCH_UNDEPLOY"; + status?: "UNKNOWN" | "QUEUED" | "RUNNING" | "FAILED" | "SUCCESSFUL"; +}; export type PagedJobResponse = { totalCount?: number; listSize?: number; pageNumber?: number; limit?: number; - jobs?: Job[]; + jobs?: BaseJob[]; }; export type HostWithFqdn = { hostId?: string; @@ -880,13 +977,19 @@ export type JobDetails = { startTime?: string; createdAt?: string; finishedAt?: string; - type?: "DEPLOY" | "UNDEPLOY" | "START" | "STOP"; + action?: + | "DEPLOY" + | "UNDEPLOY" + | "START" + | "STOP" + | "BATCH_DEPLOY" + | "BATCH_UNDEPLOY"; + status?: "UNKNOWN" | "QUEUED" | "RUNNING" | "FAILED" | "SUCCESSFUL"; iocName?: string; iocId?: number; deploymentId?: number; gitProjectId?: number; gitReference?: string; - status?: "UNKNOWN" | "QUEUED" | "RUNNING" | "FAILED" | "SUCCESSFUL"; gitProjectUrl?: string; gitShortReference?: string; host?: HostWithFqdn; @@ -1011,6 +1114,8 @@ export type GitProjectDto = { export const { useSetMaintenanceModeMutation, useStartJobMutation, + useStartBatchUndeploymentMutation, + useStartBatchDeploymentMutation, useListIocsQuery, useLazyListIocsQuery, useCreateIocMutation, diff --git a/src/stories/views/Job/JobDetailsView.stories.js b/src/stories/views/Job/JobDetailsView.stories.js index b700a39c112b0c8edf88025cc00d232aa831471d..27e6f28173304a8079a1a70dcf6f4a0f51eb7e54 100644 --- a/src/stories/views/Job/JobDetailsView.stories.js +++ b/src/stories/views/Job/JobDetailsView.stories.js @@ -3,7 +3,7 @@ import { AppHarness } from "../../../mocks/AppHarness"; import jobs from "../../../mocks/fixtures/Jobs.json"; const STATUS_OPTIONS = ["SUCCESSFUL", "FAILED", "QUEUED", "RUNNING", "UNKNOWN"]; -const JOB_TYPE_OPTIONS = [ +const JOB_ACTION_OPTIONS = [ "DEPLOY", "UNDEPLOY", "BATCH_DEPLOY", @@ -15,8 +15,8 @@ const JOB_TYPE_OPTIONS = [ export default { title: "Views/Job/JobDetailsView", argTypes: { - jobType: { - options: JOB_TYPE_OPTIONS, + actionType: { + options: JOB_ACTION_OPTIONS, control: { type: "radio" } }, status: { @@ -27,12 +27,12 @@ export default { }; const Template = (args) => { - const currentJob = jobs.jobs.find((job) => job.type === args.jobType); + const currentJob = jobs.jobs.find((job) => job.action === args.actionType); return ( <AppHarness> <JobsDetails jobDetail={Object.assign({}, currentJob, { - type: args.jobType, + action: args.actionType, status: args.status })} awxJob={args.operation} @@ -44,6 +44,6 @@ const Template = (args) => { export const Default = (args) => <Template {...args} />; Default.args = { - jobType: JOB_TYPE_OPTIONS[0], + actionType: JOB_ACTION_OPTIONS[0], status: STATUS_OPTIONS[0] };