Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
computator committed Nov 15, 2024
1 parent 8e2352e commit fecfe36
Show file tree
Hide file tree
Showing 7 changed files with 433 additions and 0 deletions.
337 changes: 337 additions & 0 deletions packages/go/openapi/doc/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -12172,6 +12172,125 @@
}
}
},
"/api/v2/domains/{domain_id}/finding-trends": {
"parameters": [
{
"$ref": "#/components/parameters/header.prefer"
},
{
"name": "domain_id",
"description": "Domain ID",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"get": {
"operationId": "FindingTrendsForDomain",
"summary": "List finding trends",
"description": "Lists findings and their changes in between two dates for a domain",
"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": {
"domain_sid": {
"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 @@ -13081,6 +13200,152 @@
}
}
},
"/api/v2/domains/{domain_id}/posture-history/{data_type}": {
"parameters": [
{
"$ref": "#/components/parameters/header.prefer"
},
{
"name": "domain_id",
"description": "Domain 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": "PostureHistoryForDomain",
"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"
}
},
{
"$ref": "#/components/parameters/query.partition-by"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/api.response.time-window"
},
{
"$ref": "#/components/schemas/api.response.partition"
},
{
"type": "object",
"properties": {
"data_type": {
"$ref": "#/components/schemas/data_type"
}
}
},
{
"oneOf": [
{
"type": "object",
"title": "Unpartitioned data",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"date": {
"type": "string",
"format": "date-time",
"readOnly": true
},
"value": {
"type": "integer",
"readOnly": true
}
}
}
}
}
},
{
"$ref": "#/components/schemas/model.components.aggregation"
}
]
}
]
}
}
}
},
"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 @@ -13412,6 +13677,14 @@
"schema": {
"$ref": "#/components/schemas/api.params.predicate.filter.time"
}
},
"query.partition-by": {
"name": "partition_by",
"description": "This query parameter is used to quantize time-series data by aggregating datapoints into one datapoint per time period.",
"in": "query",
"schema": {
"$ref": "#/components/schemas/api.params.query.partition-by"
}
}
},
"schemas": {
Expand Down Expand Up @@ -16036,6 +16309,70 @@
}
}
]
},
"data_type": {
"type": "string",
"enum": [
"findings",
"exposure",
"assets",
"session_completeness",
"group_completeness"
]
},
"api.params.query.partition-by": {
"type": "string",
"description": "Time period used for quantizing datapoints in time-series data.",
"enum": [
"day",
"week",
"month"
]
},
"api.response.partition": {
"type": "object",
"properties": {
"partition_by": {
"$ref": "#/components/schemas/api.params.query.partition-by"
}
}
},
"model.components.aggregation": {
"type": "object",
"title": "Partitioned data",
"properties": {
"aggregation_data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"min": {
"type": "integer",
"readOnly": true
},
"max": {
"type": "integer",
"readOnly": true
},
"average": {
"type": "integer",
"readOnly": true
},
"count": {
"type": "integer",
"readOnly": true
},
"date": {
"type": "string",
"format": "date-time",
"readOnly": true
}
},
"readOnly": true
},
"readOnly": true
}
}
}
},
"responses": {
Expand Down
16 changes: 16 additions & 0 deletions packages/go/openapi/src/parameters/query.partition-by.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Copyright 2024 Specter Ops, Inc.
#
# Licensed under the Apache License, Version 2.0
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

name: partition_by
description: This query parameter is used to quantize time-series data by aggregating datapoints into one datapoint per time period.
in: query
Expand Down
Loading

0 comments on commit fecfe36

Please sign in to comment.