Add more functionality to swagger client library

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
This commit is contained in:
Mihaela Balutoiu 2023-07-18 15:19:53 +03:00
parent 8089244c9c
commit f13d19b4ec
3 changed files with 33 additions and 0 deletions

View file

@ -202,6 +202,13 @@ func (a *APIController) NotFoundHandler(w http.ResponseWriter, r *http.Request)
}
}
// swagger:route GET /metrics-token metrics-token MetricsToken
//
// Returns a JWT token that can be used to access the metrics endpoint.
//
// Responses:
// 200: JWTResponse
// 401: APIErrorResponse
func (a *APIController) MetricsTokenHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
@ -350,6 +357,13 @@ func (a *APIController) ListProviders(w http.ResponseWriter, r *http.Request) {
}
}
// swagger:route GET /jobs jobs ListJobs
//
// List all jobs.
//
// Responses:
// 200: Jobs
// 400: APIErrorResponse
func (a *APIController) ListAllJobs(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
jobs, err := a.r.ListAllJobs(ctx)

View file

@ -29,6 +29,22 @@ definitions:
import:
package: github.com/cloudbase/garm/params
alias: garm_params
Jobs:
type: array
x-go-type:
type: Jobs
import:
package: github.com/cloudbase/garm/params
alias: garm_params
items:
$ref: '#/definitions/Job'
Job:
type: object
x-go-type:
type: Job
import:
package: github.com/cloudbase/garm/params
alias: garm_params
Credentials:
type: array
x-go-type:

View file

@ -491,3 +491,6 @@ type Job struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// used by swagger client generated code
type Jobs []Job