Skip to content

Commit

Permalink
Posture page api updates (#982)
Browse files Browse the repository at this point in the history
* feat: bed-4894 posture page
- un-document api spec for now
- added new invalid time range api error message

* chore: generate new api spec
  • Loading branch information
sircodemane authored Nov 26, 2024
1 parent 6f7f4ca commit 6eb3479
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 261 deletions.
1 change: 1 addition & 0 deletions cmd/api/src/api/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
257 changes: 0 additions & 257 deletions packages/go/openapi/doc/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down Expand Up @@ -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": [
{
Expand Down Expand Up @@ -16261,16 +16014,6 @@
}
}
]
},
"data_type": {
"type": "string",
"enum": [
"findings",
"exposure",
"assets",
"session_completeness",
"group_completeness"
]
}
},
"responses": {
Expand Down
8 changes: 4 additions & 4 deletions packages/go/openapi/src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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}:
Expand Down

0 comments on commit 6eb3479

Please sign in to comment.