Skip to content

Commit

Permalink
add resource bundle api.
Browse files Browse the repository at this point in the history
Signed-off-by: morvencao <[email protected]>
  • Loading branch information
morvencao committed May 31, 2024
1 parent 253a300 commit bad3965
Show file tree
Hide file tree
Showing 26 changed files with 3,323 additions and 103 deletions.
8 changes: 7 additions & 1 deletion cmd/maestro/server/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@ func (s *apiServer) routes() *mux.Router {
apiV1ResourceRouter.HandleFunc("/{id}", resourceHandler.Patch).Methods(http.MethodPatch)
apiV1ResourceRouter.HandleFunc("/{id}", resourceHandler.Delete).Methods(http.MethodDelete)
apiV1ResourceRouter.Use(authMiddleware.AuthenticateAccountJWT)

apiV1ResourceRouter.Use(authzMiddleware.AuthorizeApi)

// /api/maestro/v1/resource-bundles
apiV1ResourceBundleRouter := apiV1Router.PathPrefix("/resource-bundles").Subrouter()
apiV1ResourceBundleRouter.HandleFunc("", resourceHandler.ListBundle).Methods(http.MethodGet)
apiV1ResourceBundleRouter.HandleFunc("/{id}", resourceHandler.GetBundle).Methods(http.MethodGet)
apiV1ResourceBundleRouter.Use(authMiddleware.AuthenticateAccountJWT)
apiV1ResourceBundleRouter.Use(authzMiddleware.AuthorizeApi)

// /api/maestro/v1/consumers
apiV1ConsumersRouter := apiV1Router.PathPrefix("/consumers").Subrouter()
apiV1ConsumersRouter.HandleFunc("", consumerHandler.List).Methods(http.MethodGet)
Expand Down
4 changes: 2 additions & 2 deletions data/generated/openapi/openapi.go

Large diffs are not rendered by default.

112 changes: 112 additions & 0 deletions openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,80 @@ paths:
$ref: '#/components/schemas/Error'
parameters:
- $ref: '#/components/parameters/id'
/api/maestro/v1/resource-bundles:
get:
summary: Returns a list of resource bundles
security:
- Bearer: []
responses:
'200':
description: A JSON array of resource bundle objects
content:
application/json:
schema:
$ref: '#/components/schemas/ResourceBundleList'
'401':
description: Auth token is invalid
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Unauthorized to perform operation
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Unexpected error occurred
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
parameters:
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/size'
- $ref: '#/components/parameters/search'
- $ref: '#/components/parameters/orderBy'
- $ref: '#/components/parameters/fields'
/api/maestro/v1/resource-bundles/{id}:
get:
summary: Get an resource bundle by id
security:
- Bearer: []
responses:
'200':
description: Resource bundle found by id
content:
application/json:
schema:
$ref: '#/components/schemas/ResourceBundle'
'401':
description: Auth token is invalid
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Unauthorized to perform operation
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: No resource bundle with specified id exists
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Unexpected error occurred
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
parameters:
- $ref: '#/components/parameters/id'
/api/maestro/v1/consumers:
get:
summary: Returns a list of consumers
Expand Down Expand Up @@ -535,6 +609,44 @@ components:
type: object
update_strategy:
type: object
ResourceBundleList:
allOf:
- $ref: '#/components/schemas/List'
- type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/ResourceBundle'
ResourceBundle:
allOf:
- $ref: '#/components/schemas/ObjectReference'
- type: object
properties:
name:
type: string
consumer_name:
type: string
version:
type: integer
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
manifests:
type: array
items:
type: object
delete_option:
type: object
manifest_configs:
type: array
items:
type: object
status:
type: object
Consumer:
allOf:
- $ref: '#/components/schemas/ObjectReference'
Expand Down
8 changes: 8 additions & 0 deletions pkg/api/openapi/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ docs/List.md
docs/ObjectReference.md
docs/Resource.md
docs/ResourceAllOf.md
docs/ResourceBundle.md
docs/ResourceBundleAllOf.md
docs/ResourceBundleList.md
docs/ResourceBundleListAllOf.md
docs/ResourceList.md
docs/ResourceListAllOf.md
docs/ResourcePatchRequest.md
Expand All @@ -39,6 +43,10 @@ model_list.go
model_object_reference.go
model_resource.go
model_resource_all_of.go
model_resource_bundle.go
model_resource_bundle_all_of.go
model_resource_bundle_list.go
model_resource_bundle_list_all_of.go
model_resource_list.go
model_resource_list_all_of.go
model_resource_patch_request.go
Expand Down
6 changes: 6 additions & 0 deletions pkg/api/openapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**ApiMaestroV1ConsumersIdGet**](docs/DefaultApi.md#apimaestrov1consumersidget) | **Get** /api/maestro/v1/consumers/{id} | Get an consumer by id
*DefaultApi* | [**ApiMaestroV1ConsumersIdPatch**](docs/DefaultApi.md#apimaestrov1consumersidpatch) | **Patch** /api/maestro/v1/consumers/{id} | Update an consumer
*DefaultApi* | [**ApiMaestroV1ConsumersPost**](docs/DefaultApi.md#apimaestrov1consumerspost) | **Post** /api/maestro/v1/consumers | Create a new consumer
*DefaultApi* | [**ApiMaestroV1ResourceBundlesGet**](docs/DefaultApi.md#apimaestrov1resourcebundlesget) | **Get** /api/maestro/v1/resource-bundles | Returns a list of resource bundles
*DefaultApi* | [**ApiMaestroV1ResourceBundlesIdGet**](docs/DefaultApi.md#apimaestrov1resourcebundlesidget) | **Get** /api/maestro/v1/resource-bundles/{id} | Get an resource bundle by id
*DefaultApi* | [**ApiMaestroV1ResourcesGet**](docs/DefaultApi.md#apimaestrov1resourcesget) | **Get** /api/maestro/v1/resources | Returns a list of resources
*DefaultApi* | [**ApiMaestroV1ResourcesIdDelete**](docs/DefaultApi.md#apimaestrov1resourcesiddelete) | **Delete** /api/maestro/v1/resources/{id} | Delete a resource
*DefaultApi* | [**ApiMaestroV1ResourcesIdGet**](docs/DefaultApi.md#apimaestrov1resourcesidget) | **Get** /api/maestro/v1/resources/{id} | Get an resource by id
Expand All @@ -104,6 +106,10 @@ Class | Method | HTTP request | Description
- [ObjectReference](docs/ObjectReference.md)
- [Resource](docs/Resource.md)
- [ResourceAllOf](docs/ResourceAllOf.md)
- [ResourceBundle](docs/ResourceBundle.md)
- [ResourceBundleAllOf](docs/ResourceBundleAllOf.md)
- [ResourceBundleList](docs/ResourceBundleList.md)
- [ResourceBundleListAllOf](docs/ResourceBundleListAllOf.md)
- [ResourceList](docs/ResourceList.md)
- [ResourceListAllOf](docs/ResourceListAllOf.md)
- [ResourcePatchRequest](docs/ResourcePatchRequest.md)
Expand Down
Loading

0 comments on commit bad3965

Please sign in to comment.