diff --git a/apiserver/controllers/controllers.go b/apiserver/controllers/controllers.go index 37da8f1a..a089db54 100644 --- a/apiserver/controllers/controllers.go +++ b/apiserver/controllers/controllers.go @@ -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) diff --git a/apiserver/swagger-models.yaml b/apiserver/swagger-models.yaml index d64ce0c7..c3cddd1d 100644 --- a/apiserver/swagger-models.yaml +++ b/apiserver/swagger-models.yaml @@ -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: diff --git a/apiserver/swagger.yaml b/apiserver/swagger.yaml index dfb55a71..b557a716 100644 --- a/apiserver/swagger.yaml +++ b/apiserver/swagger.yaml @@ -69,6 +69,22 @@ definitions: alias: garm_params package: github.com/cloudbase/garm/params type: JWTResponse + Job: + type: object + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: Job + Jobs: + items: + $ref: '#/definitions/Job' + type: array + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: Jobs NewUserParams: type: object x-go-type: @@ -291,6 +307,36 @@ paths: summary: Get runner instance by name. tags: - instances + /jobs: + get: + operationId: ListJobs + responses: + "200": + description: Jobs + schema: + $ref: '#/definitions/Jobs' + "400": + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: List all jobs. + tags: + - jobs + /metrics-token: + get: + operationId: MetricsToken + responses: + "200": + description: JWTResponse + schema: + $ref: '#/definitions/JWTResponse' + "401": + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Returns a JWT token that can be used to access the metrics endpoint. + tags: + - metrics-token /organizations: get: operationId: ListOrgs diff --git a/client/garm_api_client.go b/client/garm_api_client.go index d4780de0..28d192fc 100644 --- a/client/garm_api_client.go +++ b/client/garm_api_client.go @@ -13,7 +13,9 @@ import ( "github.com/cloudbase/garm/client/credentials" "github.com/cloudbase/garm/client/first_run" "github.com/cloudbase/garm/client/instances" + "github.com/cloudbase/garm/client/jobs" "github.com/cloudbase/garm/client/login" + "github.com/cloudbase/garm/client/metrics_token" "github.com/cloudbase/garm/client/organizations" "github.com/cloudbase/garm/client/pools" "github.com/cloudbase/garm/client/providers" @@ -65,7 +67,9 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *GarmAPI { cli.Credentials = credentials.New(transport, formats) cli.FirstRun = first_run.New(transport, formats) cli.Instances = instances.New(transport, formats) + cli.Jobs = jobs.New(transport, formats) cli.Login = login.New(transport, formats) + cli.MetricsToken = metrics_token.New(transport, formats) cli.Organizations = organizations.New(transport, formats) cli.Pools = pools.New(transport, formats) cli.Providers = providers.New(transport, formats) @@ -120,8 +124,12 @@ type GarmAPI struct { Instances instances.ClientService + Jobs jobs.ClientService + Login login.ClientService + MetricsToken metrics_token.ClientService + Organizations organizations.ClientService Pools pools.ClientService @@ -139,7 +147,9 @@ func (c *GarmAPI) SetTransport(transport runtime.ClientTransport) { c.Credentials.SetTransport(transport) c.FirstRun.SetTransport(transport) c.Instances.SetTransport(transport) + c.Jobs.SetTransport(transport) c.Login.SetTransport(transport) + c.MetricsToken.SetTransport(transport) c.Organizations.SetTransport(transport) c.Pools.SetTransport(transport) c.Providers.SetTransport(transport) diff --git a/client/jobs/jobs_client.go b/client/jobs/jobs_client.go new file mode 100644 index 00000000..1058c5c7 --- /dev/null +++ b/client/jobs/jobs_client.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package jobs + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new jobs API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for jobs API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ListJobs(params *ListJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListJobsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +ListJobs lists all jobs +*/ +func (a *Client) ListJobs(params *ListJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListJobsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListJobsParams() + } + op := &runtime.ClientOperation{ + ID: "ListJobs", + Method: "GET", + PathPattern: "/jobs", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListJobsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListJobsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for ListJobs: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/jobs/list_jobs_parameters.go b/client/jobs/list_jobs_parameters.go new file mode 100644 index 00000000..9f605015 --- /dev/null +++ b/client/jobs/list_jobs_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package jobs + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewListJobsParams creates a new ListJobsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListJobsParams() *ListJobsParams { + return &ListJobsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListJobsParamsWithTimeout creates a new ListJobsParams object +// with the ability to set a timeout on a request. +func NewListJobsParamsWithTimeout(timeout time.Duration) *ListJobsParams { + return &ListJobsParams{ + timeout: timeout, + } +} + +// NewListJobsParamsWithContext creates a new ListJobsParams object +// with the ability to set a context for a request. +func NewListJobsParamsWithContext(ctx context.Context) *ListJobsParams { + return &ListJobsParams{ + Context: ctx, + } +} + +// NewListJobsParamsWithHTTPClient creates a new ListJobsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListJobsParamsWithHTTPClient(client *http.Client) *ListJobsParams { + return &ListJobsParams{ + HTTPClient: client, + } +} + +/* +ListJobsParams contains all the parameters to send to the API endpoint + + for the list jobs operation. + + Typically these are written to a http.Request. +*/ +type ListJobsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListJobsParams) WithDefaults() *ListJobsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListJobsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list jobs params +func (o *ListJobsParams) WithTimeout(timeout time.Duration) *ListJobsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list jobs params +func (o *ListJobsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list jobs params +func (o *ListJobsParams) WithContext(ctx context.Context) *ListJobsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list jobs params +func (o *ListJobsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list jobs params +func (o *ListJobsParams) WithHTTPClient(client *http.Client) *ListJobsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list jobs params +func (o *ListJobsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListJobsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/jobs/list_jobs_responses.go b/client/jobs/list_jobs_responses.go new file mode 100644 index 00000000..63282dd4 --- /dev/null +++ b/client/jobs/list_jobs_responses.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package jobs + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// ListJobsReader is a Reader for the ListJobs structure. +type ListJobsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListJobsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListJobsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListJobsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /jobs] ListJobs", response, response.Code()) + } +} + +// NewListJobsOK creates a ListJobsOK with default headers values +func NewListJobsOK() *ListJobsOK { + return &ListJobsOK{} +} + +/* +ListJobsOK describes a response with status code 200, with default header values. + +Jobs +*/ +type ListJobsOK struct { + Payload garm_params.Jobs +} + +// IsSuccess returns true when this list jobs o k response has a 2xx status code +func (o *ListJobsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list jobs o k response has a 3xx status code +func (o *ListJobsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list jobs o k response has a 4xx status code +func (o *ListJobsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list jobs o k response has a 5xx status code +func (o *ListJobsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list jobs o k response a status code equal to that given +func (o *ListJobsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list jobs o k response +func (o *ListJobsOK) Code() int { + return 200 +} + +func (o *ListJobsOK) Error() string { + return fmt.Sprintf("[GET /jobs][%d] listJobsOK %+v", 200, o.Payload) +} + +func (o *ListJobsOK) String() string { + return fmt.Sprintf("[GET /jobs][%d] listJobsOK %+v", 200, o.Payload) +} + +func (o *ListJobsOK) GetPayload() garm_params.Jobs { + return o.Payload +} + +func (o *ListJobsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListJobsBadRequest creates a ListJobsBadRequest with default headers values +func NewListJobsBadRequest() *ListJobsBadRequest { + return &ListJobsBadRequest{} +} + +/* +ListJobsBadRequest describes a response with status code 400, with default header values. + +APIErrorResponse +*/ +type ListJobsBadRequest struct { + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this list jobs bad request response has a 2xx status code +func (o *ListJobsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list jobs bad request response has a 3xx status code +func (o *ListJobsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list jobs bad request response has a 4xx status code +func (o *ListJobsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list jobs bad request response has a 5xx status code +func (o *ListJobsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list jobs bad request response a status code equal to that given +func (o *ListJobsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list jobs bad request response +func (o *ListJobsBadRequest) Code() int { + return 400 +} + +func (o *ListJobsBadRequest) Error() string { + return fmt.Sprintf("[GET /jobs][%d] listJobsBadRequest %+v", 400, o.Payload) +} + +func (o *ListJobsBadRequest) String() string { + return fmt.Sprintf("[GET /jobs][%d] listJobsBadRequest %+v", 400, o.Payload) +} + +func (o *ListJobsBadRequest) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *ListJobsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/metrics_token/metrics_token_client.go b/client/metrics_token/metrics_token_client.go new file mode 100644 index 00000000..8f7b6fd3 --- /dev/null +++ b/client/metrics_token/metrics_token_client.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package metrics_token + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new metrics token API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for metrics token API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + MetricsToken(params *MetricsTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MetricsTokenOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +MetricsToken returns a j w t token that can be used to access the metrics endpoint +*/ +func (a *Client) MetricsToken(params *MetricsTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MetricsTokenOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMetricsTokenParams() + } + op := &runtime.ClientOperation{ + ID: "MetricsToken", + Method: "GET", + PathPattern: "/metrics-token", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &MetricsTokenReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MetricsTokenOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for MetricsToken: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/metrics_token/metrics_token_parameters.go b/client/metrics_token/metrics_token_parameters.go new file mode 100644 index 00000000..dd92d05e --- /dev/null +++ b/client/metrics_token/metrics_token_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package metrics_token + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMetricsTokenParams creates a new MetricsTokenParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMetricsTokenParams() *MetricsTokenParams { + return &MetricsTokenParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMetricsTokenParamsWithTimeout creates a new MetricsTokenParams object +// with the ability to set a timeout on a request. +func NewMetricsTokenParamsWithTimeout(timeout time.Duration) *MetricsTokenParams { + return &MetricsTokenParams{ + timeout: timeout, + } +} + +// NewMetricsTokenParamsWithContext creates a new MetricsTokenParams object +// with the ability to set a context for a request. +func NewMetricsTokenParamsWithContext(ctx context.Context) *MetricsTokenParams { + return &MetricsTokenParams{ + Context: ctx, + } +} + +// NewMetricsTokenParamsWithHTTPClient creates a new MetricsTokenParams object +// with the ability to set a custom HTTPClient for a request. +func NewMetricsTokenParamsWithHTTPClient(client *http.Client) *MetricsTokenParams { + return &MetricsTokenParams{ + HTTPClient: client, + } +} + +/* +MetricsTokenParams contains all the parameters to send to the API endpoint + + for the metrics token operation. + + Typically these are written to a http.Request. +*/ +type MetricsTokenParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the metrics token params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MetricsTokenParams) WithDefaults() *MetricsTokenParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the metrics token params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MetricsTokenParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the metrics token params +func (o *MetricsTokenParams) WithTimeout(timeout time.Duration) *MetricsTokenParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the metrics token params +func (o *MetricsTokenParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the metrics token params +func (o *MetricsTokenParams) WithContext(ctx context.Context) *MetricsTokenParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the metrics token params +func (o *MetricsTokenParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the metrics token params +func (o *MetricsTokenParams) WithHTTPClient(client *http.Client) *MetricsTokenParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the metrics token params +func (o *MetricsTokenParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *MetricsTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/metrics_token/metrics_token_responses.go b/client/metrics_token/metrics_token_responses.go new file mode 100644 index 00000000..90e3aa5a --- /dev/null +++ b/client/metrics_token/metrics_token_responses.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package metrics_token + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// MetricsTokenReader is a Reader for the MetricsToken structure. +type MetricsTokenReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MetricsTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMetricsTokenOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewMetricsTokenUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /metrics-token] MetricsToken", response, response.Code()) + } +} + +// NewMetricsTokenOK creates a MetricsTokenOK with default headers values +func NewMetricsTokenOK() *MetricsTokenOK { + return &MetricsTokenOK{} +} + +/* +MetricsTokenOK describes a response with status code 200, with default header values. + +JWTResponse +*/ +type MetricsTokenOK struct { + Payload garm_params.JWTResponse +} + +// IsSuccess returns true when this metrics token o k response has a 2xx status code +func (o *MetricsTokenOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this metrics token o k response has a 3xx status code +func (o *MetricsTokenOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this metrics token o k response has a 4xx status code +func (o *MetricsTokenOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this metrics token o k response has a 5xx status code +func (o *MetricsTokenOK) IsServerError() bool { + return false +} + +// IsCode returns true when this metrics token o k response a status code equal to that given +func (o *MetricsTokenOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the metrics token o k response +func (o *MetricsTokenOK) Code() int { + return 200 +} + +func (o *MetricsTokenOK) Error() string { + return fmt.Sprintf("[GET /metrics-token][%d] metricsTokenOK %+v", 200, o.Payload) +} + +func (o *MetricsTokenOK) String() string { + return fmt.Sprintf("[GET /metrics-token][%d] metricsTokenOK %+v", 200, o.Payload) +} + +func (o *MetricsTokenOK) GetPayload() garm_params.JWTResponse { + return o.Payload +} + +func (o *MetricsTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMetricsTokenUnauthorized creates a MetricsTokenUnauthorized with default headers values +func NewMetricsTokenUnauthorized() *MetricsTokenUnauthorized { + return &MetricsTokenUnauthorized{} +} + +/* +MetricsTokenUnauthorized describes a response with status code 401, with default header values. + +APIErrorResponse +*/ +type MetricsTokenUnauthorized struct { + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this metrics token unauthorized response has a 2xx status code +func (o *MetricsTokenUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this metrics token unauthorized response has a 3xx status code +func (o *MetricsTokenUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this metrics token unauthorized response has a 4xx status code +func (o *MetricsTokenUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this metrics token unauthorized response has a 5xx status code +func (o *MetricsTokenUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this metrics token unauthorized response a status code equal to that given +func (o *MetricsTokenUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the metrics token unauthorized response +func (o *MetricsTokenUnauthorized) Code() int { + return 401 +} + +func (o *MetricsTokenUnauthorized) Error() string { + return fmt.Sprintf("[GET /metrics-token][%d] metricsTokenUnauthorized %+v", 401, o.Payload) +} + +func (o *MetricsTokenUnauthorized) String() string { + return fmt.Sprintf("[GET /metrics-token][%d] metricsTokenUnauthorized %+v", 401, o.Payload) +} + +func (o *MetricsTokenUnauthorized) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *MetricsTokenUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/params/params.go b/params/params.go index 4749c0a2..c6797fbd 100644 --- a/params/params.go +++ b/params/params.go @@ -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