diff --git a/apps/workflows/tests/test_endpoints.py b/apps/workflows/tests/test_endpoints.py index b6964eed3..45264d310 100644 --- a/apps/workflows/tests/test_endpoints.py +++ b/apps/workflows/tests/test_endpoints.py @@ -12,7 +12,7 @@ class TestEndpoints(object): - # osim/ + # workflows/ def test_index_auth(self, auth_client, test_scheme_host): """test authenticated index API endpoint""" response = auth_client.get(f"{test_scheme_host}/") @@ -25,16 +25,16 @@ def test_index_no_auth(self, client, test_scheme_host): response = client.get(f"{test_scheme_host}/") assert response.status_code == 401 - # osim/healthy + # workflows/healthy def test_health(self, client, test_scheme_host): """test health API endpoint""" response = client.get(f"{test_scheme_host}/healthy") assert response.status_code == 200 - # osim/workflows + # workflows def test_workflows_auth(self, auth_client, test_api_uri): """test authenticated workflows API endpoint""" - response = auth_client.get(f"{test_api_uri}/workflows") + response = auth_client.get(f"{test_api_uri}") assert response.status_code == 200 body = response.json() workflows = WorkflowSerializer(WorkflowFramework().workflows, many=True).data @@ -42,24 +42,24 @@ def test_workflows_auth(self, auth_client, test_api_uri): def test_workflows_no_auth(self, client, test_api_uri): """test authenticated workflows API endpoint without authenticating""" - response = client.get(f"{test_api_uri}/workflows") + response = client.get(f"{test_api_uri}") assert response.status_code == 401 def test_workflows_cve(self, auth_client, test_api_uri): """test authenticated workflow classification API endpoint""" flaw = FlawFactory() - response = auth_client.get(f"{test_api_uri}/workflows/{flaw.cve_id}") + response = auth_client.get(f"{test_api_uri}/{flaw.cve_id}") assert response.status_code == 200 body = response.json() assert body["flaw"] == str(flaw.uuid) assert "classification" in body assert "workflows" not in body - # osim/workflows/{flaw} + # workflows/{flaw} def test_workflows_uuid(self, auth_client, test_api_uri): """test authenticated workflow classification API endpoint""" flaw = FlawFactory() - response = auth_client.get(f"{test_api_uri}/workflows/{flaw.uuid}") + response = auth_client.get(f"{test_api_uri}/{flaw.uuid}") assert response.status_code == 200 body = response.json() assert body["flaw"] == str(flaw.uuid) @@ -69,7 +69,7 @@ def test_workflows_uuid(self, auth_client, test_api_uri): def test_workflows_uuid_verbose(self, auth_client, test_api_uri): """test authenticated workflow classification API endpoint with verbose parameter""" flaw = FlawFactory() - response = auth_client.get(f"{test_api_uri}/workflows/{flaw.uuid}?verbose=true") + response = auth_client.get(f"{test_api_uri}/{flaw.uuid}?verbose=true") assert response.status_code == 200 body = response.json() assert body["flaw"] == str(flaw.uuid) @@ -79,17 +79,17 @@ def test_workflows_uuid_verbose(self, auth_client, test_api_uri): def test_workflows_uuid_non_existing(self, auth_client, test_api_uri): """test authenticated workflow classification API endpoint with non-exising flaw""" response = auth_client.get( - f"{test_api_uri}/workflows/35d1ad45-0dba-41a3-bad6-5dd36d624ead" + f"{test_api_uri}/35d1ad45-0dba-41a3-bad6-5dd36d624ead" ) assert response.status_code == 404 def test_workflows_uuid_no_auth(self, client, test_api_uri): """test authenticated workflow classification API endpoint without authenticating""" flaw = FlawFactory() - response = client.get(f"{test_api_uri}/workflows/{flaw.uuid}") + response = client.get(f"{test_api_uri}/{flaw.uuid}") assert response.status_code == 401 - # osim/workflows/{flaw}/adjust + # workflows/{flaw}/adjust def test_workflows_uuid_adjusting(self, auth_client, test_api_uri): """test flaw classification adjustion after metadata change""" workflow_framework = WorkflowFramework() @@ -155,7 +155,7 @@ def test_workflows_uuid_adjusting(self, auth_client, test_api_uri): flaw.major_incident_state = Flaw.FlawMajorIncident.NOVALUE flaw.save() - response = auth_client.post(f"{test_api_uri}/workflows/{flaw.uuid}/adjust") + response = auth_client.post(f"{test_api_uri}/{flaw.uuid}/adjust") assert response.status_code == 200 body = response.json() assert body["flaw"] == str(flaw.uuid) @@ -177,7 +177,7 @@ def test_workflows_uuid_adjusting_no_modification(self, auth_client, test_api_ur test authenticated workflow classification adjusting API endpoint with no flaw modification """ flaw = FlawFactory() - response = auth_client.post(f"{test_api_uri}/workflows/{flaw.uuid}/adjust") + response = auth_client.post(f"{test_api_uri}/{flaw.uuid}/adjust") assert response.status_code == 200 body = response.json() assert body["flaw"] == str(flaw.uuid) @@ -189,7 +189,7 @@ def test_workflows_uuid_adjust_non_existing(self, auth_client, test_api_uri): test authenticated workflow classification adjusting API endpoint with non-exising flaw """ response = auth_client.post( - f"{test_api_uri}/workflows/35d1ad45-0dba-41a3-bad6-5dd36d624ead/adjust" + f"{test_api_uri}/35d1ad45-0dba-41a3-bad6-5dd36d624ead/adjust" ) assert response.status_code == 404 @@ -198,7 +198,7 @@ def test_workflows_uuid_adjust_no_auth(self, client, test_api_uri): test authenticated workflow classification adjusting API endpoint without authenticating """ flaw = FlawFactory() - response = client.post(f"{test_api_uri}/workflows/{flaw.uuid}/adjust") + response = client.post(f"{test_api_uri}/{flaw.uuid}/adjust") assert response.status_code == 401 def test_promote_endpoint(self, auth_client, test_api_uri_osidb, user_token): diff --git a/apps/workflows/urls.py b/apps/workflows/urls.py index 0713f75dd..66fc65cf8 100644 --- a/apps/workflows/urls.py +++ b/apps/workflows/urls.py @@ -16,9 +16,9 @@ urlpatterns = [ path("", index.as_view()), path("healthy", healthy.as_view()), - path(f"api/{WORKFLOWS_API_VERSION}/workflows", workflows.as_view()), - path(f"api/{WORKFLOWS_API_VERSION}/workflows/", classification.as_view()), - path(f"api/{WORKFLOWS_API_VERSION}/workflows//adjust", adjust.as_view()), + path(f"api/{WORKFLOWS_API_VERSION}", workflows.as_view()), + path(f"api/{WORKFLOWS_API_VERSION}/", classification.as_view()), + path(f"api/{WORKFLOWS_API_VERSION}//adjust", adjust.as_view()), path(f"api/{WORKFLOWS_API_VERSION}/graph/workflows", graph_workflows.as_view()), path( f"api/{WORKFLOWS_API_VERSION}/graph/workflows/", diff --git a/config/urls.py b/config/urls.py index 505067b3c..f80cd112d 100644 --- a/config/urls.py +++ b/config/urls.py @@ -26,7 +26,7 @@ # Exploits path("exploits/", include("apps.exploits.urls")), # Workflows - path("osim/", include("apps.workflows.urls")), + path("workflows/", include("apps.workflows.urls")), # Task Manager path("taskman/", include("apps.taskman.urls")), # collectors diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 11d06e7a1..ef19974e5 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 /collectors/api/v1/status endpoint - fix schema to reflect Erratum shipped_dt to be nullable +### Changed +- Renamed OSIM module to Workflows (OSIDB-1395) + ### Removed - Remove daily monitoring email for failed tasks / collectors (OSIDB-1215) diff --git a/openapi.yml b/openapi.yml index a07cc3557..6fc9e1f71 100644 --- a/openapi.yml +++ b/openapi.yml @@ -6617,165 +6617,6 @@ paths: version: type: string description: '' - /osim/: - get: - operationId: osim_retrieve - description: index API endpoint listing available API endpoints - tags: - - osim - security: - - OsidbTokenAuthentication: [] - responses: - '200': - content: - application/json: - schema: - type: object - properties: - dt: - type: string - format: date-time - env: - type: string - revision: - type: string - version: - type: string - description: '' - /osim/api/v1/workflows: - get: - operationId: osim_api_v1_workflows_retrieve - description: workflow info API endpoint - tags: - - osim - security: - - OsidbTokenAuthentication: [] - responses: - '200': - content: - application/json: - schema: - type: object - properties: - dt: - type: string - format: date-time - env: - type: string - revision: - type: string - version: - type: string - description: '' - /osim/api/v1/workflows/{id}: - get: - operationId: osim_api_v1_workflows_retrieve_2 - description: |- - workflow classification API endpoint - - for flaw identified by UUID or CVE returns its workflow:state classification - - params: - - verbose - return also workflows with flaw classification - which represents the reasoning of the result - parameters: - - in: path - name: id - schema: - type: string - required: true - - in: query - name: verbose - schema: - type: boolean - description: Return also workflows with flaw classification which represents - the reasoning of the result. - tags: - - osim - security: - - OsidbTokenAuthentication: [] - responses: - '200': - content: - application/json: - schema: - type: object - properties: - dt: - type: string - format: date-time - env: - type: string - revision: - type: string - version: - type: string - description: '' - /osim/api/v1/workflows/{id}/adjust: - post: - operationId: osim_api_v1_workflows_adjust_create - description: |- - workflow adjustion API endpoint - - adjust workflow classification of flaw identified by UUID or CVE - and return its workflow:state classification (new if changed and old otherwise) - - adjust operation is idempotent so when the classification - is already adjusted running it results in no operation - parameters: - - in: path - name: id - schema: - type: string - required: true - tags: - - osim - security: - - OsidbTokenAuthentication: [] - responses: - '200': - content: - application/json: - schema: - type: object - properties: - dt: - type: string - format: date-time - env: - type: string - revision: - type: string - version: - type: string - description: '' - /osim/healthy: - get: - operationId: osim_healthy_retrieve - description: unauthenticated health check API endpoint - tags: - - osim - security: - - OsidbTokenAuthentication: [] - - {} - responses: - '200': - content: - application/json: - schema: - type: object - properties: - dt: - type: string - format: date-time - env: - type: string - revision: - type: string - version: - type: string - description: '' /taskman/api/v1/group: post: operationId: taskman_api_v1_group_create @@ -7395,6 +7236,165 @@ paths: version: type: string description: '' + /workflows/: + get: + operationId: workflows_retrieve + description: index API endpoint listing available API endpoints + tags: + - workflows + security: + - OsidbTokenAuthentication: [] + responses: + '200': + content: + application/json: + schema: + type: object + properties: + dt: + type: string + format: date-time + env: + type: string + revision: + type: string + version: + type: string + description: '' + /workflows/api/v1: + get: + operationId: workflows_api_v1_retrieve + description: workflow info API endpoint + tags: + - workflows + security: + - OsidbTokenAuthentication: [] + responses: + '200': + content: + application/json: + schema: + type: object + properties: + dt: + type: string + format: date-time + env: + type: string + revision: + type: string + version: + type: string + description: '' + /workflows/api/v1/{id}: + get: + operationId: workflows_api_v1_retrieve_2 + description: |- + workflow classification API endpoint + + for flaw identified by UUID or CVE returns its workflow:state classification + + params: + + verbose - return also workflows with flaw classification + which represents the reasoning of the result + parameters: + - in: path + name: id + schema: + type: string + required: true + - in: query + name: verbose + schema: + type: boolean + description: Return also workflows with flaw classification which represents + the reasoning of the result. + tags: + - workflows + security: + - OsidbTokenAuthentication: [] + responses: + '200': + content: + application/json: + schema: + type: object + properties: + dt: + type: string + format: date-time + env: + type: string + revision: + type: string + version: + type: string + description: '' + /workflows/api/v1/{id}/adjust: + post: + operationId: workflows_api_v1_adjust_create + description: |- + workflow adjustion API endpoint + + adjust workflow classification of flaw identified by UUID or CVE + and return its workflow:state classification (new if changed and old otherwise) + + adjust operation is idempotent so when the classification + is already adjusted running it results in no operation + parameters: + - in: path + name: id + schema: + type: string + required: true + tags: + - workflows + security: + - OsidbTokenAuthentication: [] + responses: + '200': + content: + application/json: + schema: + type: object + properties: + dt: + type: string + format: date-time + env: + type: string + revision: + type: string + version: + type: string + description: '' + /workflows/healthy: + get: + operationId: workflows_healthy_retrieve + description: unauthenticated health check API endpoint + tags: + - workflows + security: + - OsidbTokenAuthentication: [] + - {} + responses: + '200': + content: + application/json: + schema: + type: object + properties: + dt: + type: string + format: date-time + env: + type: string + revision: + type: string + version: + type: string + description: '' components: schemas: Affect: diff --git a/osidb/templates/index.html b/osidb/templates/index.html index b13a3f337..fa31af1b9 100644 --- a/osidb/templates/index.html +++ b/osidb/templates/index.html @@ -20,7 +20,7 @@

OSIDB: API | health | status

-

Workflows: API | health

+

Workflows: API | health

Taskman: health


Docs: OSIDB REST API tutorial |