Skip to content

Commit 96448bc

Browse files
committed
feat: temporary watch ports
1 parent 02a124b commit 96448bc

12 files changed

Lines changed: 858 additions & 69 deletions

File tree

api/openapi.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,40 @@ components:
6767
default: false
6868
description: Whether to run synchronously (wait for completion)
6969

70+
AddPortRequest:
71+
type: object
72+
required:
73+
- port
74+
- protocol
75+
- name
76+
properties:
77+
port:
78+
type: integer
79+
description: Port number (1-65535)
80+
minimum: 1
81+
maximum: 65535
82+
example: 8080
83+
protocol:
84+
type: string
85+
description: Network protocol (tcp or udp)
86+
enum: [tcp, udp]
87+
example: "tcp"
88+
name:
89+
type: string
90+
description: Port name/identifier
91+
example: "my-service"
92+
mandatory:
93+
type: boolean
94+
default: false
95+
description: Whether this port must be open for health check
96+
check_activity:
97+
type: boolean
98+
default: false
99+
description: Whether to monitor port activity
100+
description:
101+
type: string
102+
description: Optional port description
103+
70104
StartProcedureRequest:
71105
type: object
72106
required:
@@ -835,6 +869,59 @@ paths:
835869
type: array
836870
items:
837871
$ref: '#/components/schemas/AugmentedPort'
872+
post:
873+
operationId: addPort
874+
summary: Add a port to watch
875+
description: Add a new port to be monitored by the port service (in-memory only)
876+
tags: [port, daemon]
877+
security:
878+
- bearerAuth: []
879+
requestBody:
880+
required: true
881+
content:
882+
application/json:
883+
schema:
884+
$ref: '#/components/schemas/AddPortRequest'
885+
responses:
886+
'201':
887+
description: Port added successfully
888+
content:
889+
application/json:
890+
schema:
891+
$ref: '#/components/schemas/AugmentedPort'
892+
'400':
893+
description: Invalid port configuration
894+
content:
895+
application/json:
896+
schema:
897+
$ref: '#/components/schemas/ErrorResponse'
898+
899+
/api/v1/ports/{port}:
900+
delete:
901+
operationId: deletePort
902+
summary: Remove a watched port
903+
description: Stop watching a port (in-memory only)
904+
tags: [port, daemon]
905+
security:
906+
- bearerAuth: []
907+
parameters:
908+
- name: port
909+
in: path
910+
required: true
911+
description: The port number to remove
912+
schema:
913+
type: integer
914+
minimum: 1
915+
maximum: 65535
916+
responses:
917+
'204':
918+
description: Port removed successfully
919+
'404':
920+
description: Port not found
921+
content:
922+
application/json:
923+
schema:
924+
$ref: '#/components/schemas/ErrorResponse'
838925

839926
# Health Endpoint (authenticated)
840927
/api/v1/health:

internal/api/generated.go

Lines changed: 139 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/core/ports/handler_ports.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ type QueueHandlerInterface interface {
4343

4444
type PortHandlerInterface interface {
4545
GetPorts(c *fiber.Ctx) error
46+
AddPort(c *fiber.Ctx) error
47+
DeletePort(c *fiber.Ctx, port int) error
4648
}
4749
type HealthHandlerInterface interface {
4850
GetHealthAuth(c *fiber.Ctx) error

internal/core/ports/services_ports.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ type PortServiceInterface interface {
118118
CheckOpen(prot int) bool
119119
GetPorts() []*domain.AugmentedPort
120120
MandatoryPortsOpen() bool
121+
AddPort(port domain.Port) (*domain.AugmentedPort, error)
122+
RemovePort(port int) error
121123
}
122124

123125
type ColdStarterHandlerInterface interface {

0 commit comments

Comments
 (0)