Skip to content

Commit 6990f17

Browse files
committed
HYPERFLEET-978 - feat: Include routes for PUT status updates (1/2)
1 parent f31a6c9 commit 6990f17

4 files changed

Lines changed: 123 additions & 49 deletions

File tree

cmd/hyperfleet-api/server/api_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func NewAPIServer(tracingEnabled bool) Server {
8080
http.MethodGet,
8181
http.MethodPatch,
8282
http.MethodPost,
83+
http.MethodPut,
8384
}),
8485
gorillahandlers.AllowedHeaders([]string{
8586
"Authorization",

openapi/openapi.yaml

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: 3.0.0
22
info:
33
title: HyperFleet API
4-
version: 1.0.8
4+
version: 1.0.9
55
contact:
66
name: HyperFleet Team
77
license:
@@ -494,6 +494,7 @@ paths:
494494
- name: nodepool_id
495495
in: path
496496
required: true
497+
description: Nodepool ID
497498
schema:
498499
type: string
499500
responses:
@@ -515,6 +516,45 @@ paths:
515516
application/json:
516517
schema:
517518
$ref: '#/components/schemas/AdapterStatusCreateRequest'
519+
security:
520+
- BearerAuth: []
521+
put:
522+
operationId: putNodePoolStatuses
523+
summary: Adapter creates or updates resource nodepool status
524+
parameters:
525+
- name: cluster_id
526+
in: path
527+
required: true
528+
description: Cluster ID
529+
schema:
530+
type: string
531+
- name: nodepool_id
532+
in: path
533+
required: true
534+
description: Nodepool ID
535+
schema:
536+
type: string
537+
responses:
538+
'201':
539+
description: The request has succeeded and a new resource has been created as a result.
540+
content:
541+
application/json:
542+
schema:
543+
$ref: '#/components/schemas/AdapterStatus'
544+
'400':
545+
description: The server could not understand the request due to invalid syntax.
546+
'404':
547+
description: The server cannot find the requested resource.
548+
'409':
549+
description: The request conflicts with the current state of the server.
550+
requestBody:
551+
required: true
552+
content:
553+
application/json:
554+
schema:
555+
$ref: '#/components/schemas/AdapterStatusCreateRequest'
556+
security:
557+
- BearerAuth: []
518558
get:
519559
operationId: getNodePoolsStatuses
520560
summary: List all adapter statuses for nodepools
@@ -589,6 +629,37 @@ paths:
589629
$ref: '#/components/schemas/AdapterStatusCreateRequest'
590630
security:
591631
- BearerAuth: []
632+
put:
633+
operationId: putClusterStatuses
634+
summary: Adapter creates or updates resource cluster status
635+
parameters:
636+
- name: cluster_id
637+
in: path
638+
required: true
639+
description: Cluster ID
640+
schema:
641+
type: string
642+
responses:
643+
'201':
644+
description: The request has succeeded and a new resource has been created as a result.
645+
content:
646+
application/json:
647+
schema:
648+
$ref: '#/components/schemas/AdapterStatus'
649+
'400':
650+
description: The server could not understand the request due to invalid syntax.
651+
'404':
652+
description: The server cannot find the requested resource.
653+
'409':
654+
description: The request conflicts with the current state of the server.
655+
requestBody:
656+
required: true
657+
content:
658+
application/json:
659+
schema:
660+
$ref: '#/components/schemas/AdapterStatusCreateRequest'
661+
security:
662+
- BearerAuth: []
592663
get:
593664
operationId: getClusterStatuses
594665
summary: List all adapter statuses for cluster

plugins/clusters/plugin.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func init() {
6666
clusterStatusHandler := handlers.NewClusterStatusHandler(adapterStatus.Service(envServices), Service(envServices))
6767
clustersRouter.HandleFunc("/{id}/statuses", clusterStatusHandler.List).Methods(http.MethodGet)
6868
clustersRouter.HandleFunc("/{id}/statuses", clusterStatusHandler.Create).Methods(http.MethodPost)
69+
clustersRouter.HandleFunc("/{id}/statuses", clusterStatusHandler.Create).Methods(http.MethodPut)
6970

7071
// Nested resource: cluster nodepools
7172
clusterNodePoolsHandler := handlers.NewClusterNodePoolsHandler(
@@ -83,6 +84,7 @@ func init() {
8384
nodepoolStatusHandler := handlers.NewNodePoolStatusHandler(adapterStatus.Service(envServices), nodePools.Service(envServices))
8485
clustersRouter.HandleFunc("/{id}/nodepools/{nodepool_id}/statuses", nodepoolStatusHandler.List).Methods(http.MethodGet)
8586
clustersRouter.HandleFunc("/{id}/nodepools/{nodepool_id}/statuses", nodepoolStatusHandler.Create).Methods(http.MethodPost)
87+
clustersRouter.HandleFunc("/{id}/nodepools/{nodepool_id}/statuses", nodepoolStatusHandler.Create).Methods(http.MethodPut)
8688

8789
clustersRouter.Use(authMiddleware.AuthenticateAccountJWT)
8890
clustersRouter.Use(authzMiddleware.AuthorizeAPI)

0 commit comments

Comments
 (0)