From 6eb3479bde06f04329f0366d60a800792439326e Mon Sep 17 00:00:00 2001 From: Cody Bentley Date: Tue, 26 Nov 2024 08:28:40 -0700 Subject: [PATCH] Posture page api updates (#982) * feat: bed-4894 posture page - un-document api spec for now - added new invalid time range api error message * chore: generate new api spec --- cmd/api/src/api/error.go | 1 + packages/go/openapi/doc/openapi.json | 257 --------------------------- packages/go/openapi/src/openapi.yaml | 8 +- 3 files changed, 5 insertions(+), 261 deletions(-) diff --git a/cmd/api/src/api/error.go b/cmd/api/src/api/error.go index 15fb8365cb..867bd0b7e1 100644 --- a/cmd/api/src/api/error.go +++ b/cmd/api/src/api/error.go @@ -54,6 +54,7 @@ const ( ErrorResponseDetailsOTPInvalid = "one time password is invalid" ErrorResponseDetailsResourceNotFound = "resource not found" ErrorResponseDetailsToBeforeFrom = "to time cannot be before from time" + ErrorResponseDetailsTimeRangeInvalid = "time range provided is invalid" ErrorResponseDetailsToMalformed = "to parameter should be formatted as RFC3339 i.e 2021-04-21T07:20:50.52Z" ErrorResponseMultipleCollectionScopesProvided = "may only scope collection by exactly one of OU, Domain, or All Trusted Domains" ErrorResponsePayloadUnmarshalError = "error unmarshalling JSON payload" diff --git a/packages/go/openapi/doc/openapi.json b/packages/go/openapi/doc/openapi.json index c7ec56d2ec..1d87a80b68 100644 --- a/packages/go/openapi/doc/openapi.json +++ b/packages/go/openapi/doc/openapi.json @@ -12170,125 +12170,6 @@ } } }, - "/api/v2/domains/{environment_id}/finding-trends": { - "parameters": [ - { - "$ref": "#/components/parameters/header.prefer" - }, - { - "name": "environment_id", - "description": "Environment ID", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "get": { - "operationId": "FindingTrendsForEnvironment", - "summary": "List finding trends", - "description": "Lists findings and their changes in between two dates for an environment", - "tags": [ - "Attack Paths", - "Enterprise" - ], - "parameters": [ - { - "name": "start", - "description": "Beginning datetime of range (inclusive) in RFC-3339 format; Defaults to current datetime minus 30 days", - "in": "query", - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "end", - "description": "Ending datetime of range (exclusive) in RFC-3339 format; Defaults to current datetime", - "in": "query", - "schema": { - "type": "string", - "format": "date-time" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/api.response.time-window" - }, - { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "findings": { - "type": "array", - "items": { - "type": "object", - "properties": { - "environment_id": { - "type": "string" - }, - "finding": { - "type": "string" - }, - "composite_risk": { - "type": "number", - "format": "double" - }, - "finding_count_start": { - "type": "integer" - }, - "finding_count_end": { - "type": "integer" - } - } - } - }, - "total_finding_count_start": { - "type": "integer" - }, - "total_finding_count_end": { - "type": "integer" - } - } - } - } - } - ] - } - } - } - }, - "400": { - "$ref": "#/components/responses/bad-request" - }, - "401": { - "$ref": "#/components/responses/unauthorized" - }, - "403": { - "$ref": "#/components/responses/forbidden" - }, - "404": { - "$ref": "#/components/responses/not-found" - }, - "429": { - "$ref": "#/components/responses/too-many-requests" - }, - "500": { - "$ref": "#/components/responses/internal-server-error" - } - } - } - }, "/api/v2/attack-path-types": { "parameters": [ { @@ -13186,134 +13067,6 @@ } } }, - "/api/v2/domains/{environment_id}/posture-history/{data_type}": { - "parameters": [ - { - "$ref": "#/components/parameters/header.prefer" - }, - { - "name": "environment_id", - "description": "Environment ID", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "data_type", - "description": "The type of posture data to return", - "in": "path", - "required": true, - "schema": { - "$ref": "#/components/schemas/data_type" - } - } - ], - "get": { - "operationId": "PostureHistoryForEnvironment", - "summary": "Get Posture History", - "description": "Gets posture data count changes over a time period", - "tags": [ - "Risk Posture", - "Enterprise" - ], - "parameters": [ - { - "name": "start", - "description": "Beginning datetime of range (inclusive) in RFC-3339 format; Defaults to current datetime minus 30 days", - "in": "query", - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "end", - "description": "Ending datetime of range (exclusive) in RFC-3339 format; Defaults to current datetime", - "in": "query", - "schema": { - "type": "string", - "format": "date-time" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/api.response.time-window" - }, - { - "type": "object", - "properties": { - "data_type": { - "$ref": "#/components/schemas/data_type" - }, - "data": { - "type": "array", - "items": { - "type": "object", - "properties": { - "date": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "value": { - "type": "number", - "format": "double", - "readOnly": true - } - } - } - } - } - } - ] - } - } - } - }, - "400": { - "$ref": "#/components/responses/bad-request" - }, - "401": { - "$ref": "#/components/responses/unauthorized" - }, - "403": { - "$ref": "#/components/responses/forbidden" - }, - "404": { - "$ref": "#/components/responses/not-found" - }, - "429": { - "$ref": "#/components/responses/too-many-requests" - }, - "500": { - "$ref": "#/components/responses/internal-server-error" - } - } - }, - "components": { - "schemas": { - "data_type": { - "type": "string", - "enum": [ - "findings", - "exposure", - "assets", - "session_completeness", - "group_completeness" - ] - } - } - } - }, "/api/v2/meta/{object_id}": { "parameters": [ { @@ -16261,16 +16014,6 @@ } } ] - }, - "data_type": { - "type": "string", - "enum": [ - "findings", - "exposure", - "assets", - "session_completeness", - "group_completeness" - ] } }, "responses": { diff --git a/packages/go/openapi/src/openapi.yaml b/packages/go/openapi/src/openapi.yaml index e2914bdb9b..e2072fe2e5 100644 --- a/packages/go/openapi/src/openapi.yaml +++ b/packages/go/openapi/src/openapi.yaml @@ -642,8 +642,8 @@ paths: # attack paths /api/v2/domains/{domain_id}/attack-path-findings: $ref: './paths/attack-paths.domains.id.attack-path-findings.yaml' - /api/v2/domains/{environment_id}/finding-trends: - $ref: './paths/attack-paths.environment.id.finding-trends.yaml' +# /api/v2/domains/{environment_id}/finding-trends: +# $ref: './paths/attack-paths.environment.id.finding-trends.yaml' /api/v2/attack-path-types: $ref: './paths/attack-paths.attack-path-types.yaml' /api/v2/attack-paths: @@ -660,8 +660,8 @@ paths: # risk posture /api/v2/posture-stats: $ref: './paths/risk-posture.posture-stats.yaml' - /api/v2/domains/{environment_id}/posture-history/{data_type}: - $ref: './paths/risk-posture.environment.id.posture-history.type.yaml' +# /api/v2/domains/{environment_id}/posture-history/{data_type}: +# $ref: './paths/risk-posture.environment.id.posture-history.type.yaml' # meta entity /api/v2/meta/{object_id}: