Skip to content

Commit a2253e0

Browse files
author
Chris Vermeulen
authored
Accept intervals as query parameters to evidence status over time endpoints (#242)
1 parent 92f27f4 commit a2253e0

File tree

6 files changed

+176
-102
lines changed

6 files changed

+176
-102
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,8 @@ When using Podman instead of Docker, some changes are necessary for testcontaine
9090

9191
```shell
9292
# This is a workaround currently, and is currently being worked on by the testcontainers folks.
93-
# Ensure Podman is running rootfully
94-
podman machine stop; podman machine set --rootful; podman machine start;
95-
export DOCKER_HOST=unix://$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')
9693
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
9794
export TESTCONTAINERS_RYUK_DISABLED=true;
98-
export TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED=true;
9995
```
10096

10197
## License

docs/docs.go

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ const docTemplate = `{
453453
},
454454
"/evidence/status-over-time": {
455455
"post": {
456-
"description": "Retrieves counts of evidence statuses at various intervals.",
456+
"description": "Retrieves counts of evidence statuses at various time intervals based on a label filter.",
457457
"consumes": [
458458
"application/json"
459459
],
@@ -463,7 +463,7 @@ const docTemplate = `{
463463
"tags": [
464464
"Evidence"
465465
],
466-
"summary": "Evidence status metrics",
466+
"summary": "Evidence status metrics over intervals",
467467
"parameters": [
468468
{
469469
"description": "Label filter",
@@ -473,13 +473,25 @@ const docTemplate = `{
473473
"schema": {
474474
"$ref": "#/definitions/labelfilter.Filter"
475475
}
476+
},
477+
{
478+
"type": "string",
479+
"description": "Comma-separated list of duration intervals (e.g., '10m,1h,24h')",
480+
"name": "intervals",
481+
"in": "query"
476482
}
477483
],
478484
"responses": {
479485
"200": {
480486
"description": "OK",
481487
"schema": {
482-
"$ref": "#/definitions/handler.GenericDataListResponse-handler_StatusOverTime_StatusInterval"
488+
"$ref": "#/definitions/handler.GenericDataListResponse-handler_StatusInterval"
489+
}
490+
},
491+
"400": {
492+
"description": "Bad Request",
493+
"schema": {
494+
"$ref": "#/definitions/api.Error"
483495
}
484496
},
485497
"422": {
@@ -498,34 +510,41 @@ const docTemplate = `{
498510
}
499511
},
500512
"/evidence/status-over-time/{id}": {
501-
"post": {
502-
"description": "Retrieves counts of evidence statuses at various intervals.",
503-
"consumes": [
504-
"application/json"
505-
],
513+
"get": {
514+
"description": "Retrieves counts of evidence statuses at various time intervals for a specific evidence stream identified by UUID.",
506515
"produces": [
507516
"application/json"
508517
],
509518
"tags": [
510519
"Evidence"
511520
],
512-
"summary": "Evidence status metrics",
521+
"summary": "Evidence status metrics over intervals by UUID",
513522
"parameters": [
514523
{
515-
"description": "Label filter",
516-
"name": "filter",
517-
"in": "body",
518-
"required": true,
519-
"schema": {
520-
"$ref": "#/definitions/labelfilter.Filter"
521-
}
524+
"type": "string",
525+
"description": "Evidence UUID",
526+
"name": "id",
527+
"in": "path",
528+
"required": true
529+
},
530+
{
531+
"type": "string",
532+
"description": "Comma-separated list of duration intervals (e.g., '10m,1h,24h')",
533+
"name": "intervals",
534+
"in": "query"
522535
}
523536
],
524537
"responses": {
525538
"200": {
526539
"description": "OK",
527540
"schema": {
528-
"$ref": "#/definitions/handler.GenericDataListResponse-handler_StatusOverTime_StatusInterval"
541+
"$ref": "#/definitions/handler.GenericDataListResponse-handler_StatusInterval"
542+
}
543+
},
544+
"400": {
545+
"description": "Bad Request",
546+
"schema": {
547+
"$ref": "#/definitions/api.Error"
529548
}
530549
},
531550
"422": {
@@ -11429,14 +11448,14 @@ const docTemplate = `{
1142911448
}
1143011449
}
1143111450
},
11432-
"handler.GenericDataListResponse-handler_StatusOverTime_StatusInterval": {
11451+
"handler.GenericDataListResponse-handler_StatusInterval": {
1143311452
"type": "object",
1143411453
"properties": {
1143511454
"data": {
1143611455
"description": "Items from the list response",
1143711456
"type": "array",
1143811457
"items": {
11439-
"$ref": "#/definitions/handler.StatusOverTime.StatusInterval"
11458+
"$ref": "#/definitions/handler.StatusInterval"
1144011459
}
1144111460
}
1144211461
}
@@ -12635,7 +12654,7 @@ const docTemplate = `{
1263512654
}
1263612655
}
1263712656
},
12638-
"handler.StatusOverTime.StatusCount": {
12657+
"handler.StatusCount": {
1263912658
"type": "object",
1264012659
"properties": {
1264112660
"count": {
@@ -12646,7 +12665,7 @@ const docTemplate = `{
1264612665
}
1264712666
}
1264812667
},
12649-
"handler.StatusOverTime.StatusInterval": {
12668+
"handler.StatusInterval": {
1265012669
"type": "object",
1265112670
"properties": {
1265212671
"interval": {
@@ -12655,7 +12674,7 @@ const docTemplate = `{
1265512674
"statuses": {
1265612675
"type": "array",
1265712676
"items": {
12658-
"$ref": "#/definitions/handler.StatusOverTime.StatusCount"
12677+
"$ref": "#/definitions/handler.StatusCount"
1265912678
}
1266012679
}
1266112680
}

docs/swagger.json

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@
447447
},
448448
"/evidence/status-over-time": {
449449
"post": {
450-
"description": "Retrieves counts of evidence statuses at various intervals.",
450+
"description": "Retrieves counts of evidence statuses at various time intervals based on a label filter.",
451451
"consumes": [
452452
"application/json"
453453
],
@@ -457,7 +457,7 @@
457457
"tags": [
458458
"Evidence"
459459
],
460-
"summary": "Evidence status metrics",
460+
"summary": "Evidence status metrics over intervals",
461461
"parameters": [
462462
{
463463
"description": "Label filter",
@@ -467,13 +467,25 @@
467467
"schema": {
468468
"$ref": "#/definitions/labelfilter.Filter"
469469
}
470+
},
471+
{
472+
"type": "string",
473+
"description": "Comma-separated list of duration intervals (e.g., '10m,1h,24h')",
474+
"name": "intervals",
475+
"in": "query"
470476
}
471477
],
472478
"responses": {
473479
"200": {
474480
"description": "OK",
475481
"schema": {
476-
"$ref": "#/definitions/handler.GenericDataListResponse-handler_StatusOverTime_StatusInterval"
482+
"$ref": "#/definitions/handler.GenericDataListResponse-handler_StatusInterval"
483+
}
484+
},
485+
"400": {
486+
"description": "Bad Request",
487+
"schema": {
488+
"$ref": "#/definitions/api.Error"
477489
}
478490
},
479491
"422": {
@@ -492,34 +504,41 @@
492504
}
493505
},
494506
"/evidence/status-over-time/{id}": {
495-
"post": {
496-
"description": "Retrieves counts of evidence statuses at various intervals.",
497-
"consumes": [
498-
"application/json"
499-
],
507+
"get": {
508+
"description": "Retrieves counts of evidence statuses at various time intervals for a specific evidence stream identified by UUID.",
500509
"produces": [
501510
"application/json"
502511
],
503512
"tags": [
504513
"Evidence"
505514
],
506-
"summary": "Evidence status metrics",
515+
"summary": "Evidence status metrics over intervals by UUID",
507516
"parameters": [
508517
{
509-
"description": "Label filter",
510-
"name": "filter",
511-
"in": "body",
512-
"required": true,
513-
"schema": {
514-
"$ref": "#/definitions/labelfilter.Filter"
515-
}
518+
"type": "string",
519+
"description": "Evidence UUID",
520+
"name": "id",
521+
"in": "path",
522+
"required": true
523+
},
524+
{
525+
"type": "string",
526+
"description": "Comma-separated list of duration intervals (e.g., '10m,1h,24h')",
527+
"name": "intervals",
528+
"in": "query"
516529
}
517530
],
518531
"responses": {
519532
"200": {
520533
"description": "OK",
521534
"schema": {
522-
"$ref": "#/definitions/handler.GenericDataListResponse-handler_StatusOverTime_StatusInterval"
535+
"$ref": "#/definitions/handler.GenericDataListResponse-handler_StatusInterval"
536+
}
537+
},
538+
"400": {
539+
"description": "Bad Request",
540+
"schema": {
541+
"$ref": "#/definitions/api.Error"
523542
}
524543
},
525544
"422": {
@@ -11423,14 +11442,14 @@
1142311442
}
1142411443
}
1142511444
},
11426-
"handler.GenericDataListResponse-handler_StatusOverTime_StatusInterval": {
11445+
"handler.GenericDataListResponse-handler_StatusInterval": {
1142711446
"type": "object",
1142811447
"properties": {
1142911448
"data": {
1143011449
"description": "Items from the list response",
1143111450
"type": "array",
1143211451
"items": {
11433-
"$ref": "#/definitions/handler.StatusOverTime.StatusInterval"
11452+
"$ref": "#/definitions/handler.StatusInterval"
1143411453
}
1143511454
}
1143611455
}
@@ -12629,7 +12648,7 @@
1262912648
}
1263012649
}
1263112650
},
12632-
"handler.StatusOverTime.StatusCount": {
12651+
"handler.StatusCount": {
1263312652
"type": "object",
1263412653
"properties": {
1263512654
"count": {
@@ -12640,7 +12659,7 @@
1264012659
}
1264112660
}
1264212661
},
12643-
"handler.StatusOverTime.StatusInterval": {
12662+
"handler.StatusInterval": {
1264412663
"type": "object",
1264512664
"properties": {
1264612665
"interval": {
@@ -12649,7 +12668,7 @@
1264912668
"statuses": {
1265012669
"type": "array",
1265112670
"items": {
12652-
"$ref": "#/definitions/handler.StatusOverTime.StatusCount"
12671+
"$ref": "#/definitions/handler.StatusCount"
1265312672
}
1265412673
}
1265512674
}

0 commit comments

Comments
 (0)