This change adds the ability to manage garm-agent tools downloads. Users can: * Set an upstream releases page (github releases api) * Enable sync from upstream. In this case, GARM will automatically download garm-agent tools from the releases page and save them in the internal object store * Manually upload tools. Manually uploaded tools for an OS/arch combination will never be overwritten by auto-sync. Usrs will need to delete manually uploaded tools to enable sync for that os/arch release. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
253 lines
7.6 KiB
Go
253 lines
7.6 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package controller
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"encoding/json"
|
|
"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"
|
|
)
|
|
|
|
// ForceToolsSyncReader is a Reader for the ForceToolsSync structure.
|
|
type ForceToolsSyncReader struct {
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ReadResponse reads a server response into the received o.
|
|
func (o *ForceToolsSyncReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
|
switch response.Code() {
|
|
case 200:
|
|
result := NewForceToolsSyncOK()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return result, nil
|
|
case 400:
|
|
result := NewForceToolsSyncBadRequest()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 401:
|
|
result := NewForceToolsSyncUnauthorized()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
default:
|
|
return nil, runtime.NewAPIError("[POST /controller/tools/sync] ForceToolsSync", response, response.Code())
|
|
}
|
|
}
|
|
|
|
// NewForceToolsSyncOK creates a ForceToolsSyncOK with default headers values
|
|
func NewForceToolsSyncOK() *ForceToolsSyncOK {
|
|
return &ForceToolsSyncOK{}
|
|
}
|
|
|
|
/*
|
|
ForceToolsSyncOK describes a response with status code 200, with default header values.
|
|
|
|
ControllerInfo
|
|
*/
|
|
type ForceToolsSyncOK struct {
|
|
Payload garm_params.ControllerInfo
|
|
}
|
|
|
|
// IsSuccess returns true when this force tools sync o k response has a 2xx status code
|
|
func (o *ForceToolsSyncOK) IsSuccess() bool {
|
|
return true
|
|
}
|
|
|
|
// IsRedirect returns true when this force tools sync o k response has a 3xx status code
|
|
func (o *ForceToolsSyncOK) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this force tools sync o k response has a 4xx status code
|
|
func (o *ForceToolsSyncOK) IsClientError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsServerError returns true when this force tools sync o k response has a 5xx status code
|
|
func (o *ForceToolsSyncOK) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this force tools sync o k response a status code equal to that given
|
|
func (o *ForceToolsSyncOK) IsCode(code int) bool {
|
|
return code == 200
|
|
}
|
|
|
|
// Code gets the status code for the force tools sync o k response
|
|
func (o *ForceToolsSyncOK) Code() int {
|
|
return 200
|
|
}
|
|
|
|
func (o *ForceToolsSyncOK) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /controller/tools/sync][%d] forceToolsSyncOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *ForceToolsSyncOK) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /controller/tools/sync][%d] forceToolsSyncOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *ForceToolsSyncOK) GetPayload() garm_params.ControllerInfo {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *ForceToolsSyncOK) 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
|
|
}
|
|
|
|
// NewForceToolsSyncBadRequest creates a ForceToolsSyncBadRequest with default headers values
|
|
func NewForceToolsSyncBadRequest() *ForceToolsSyncBadRequest {
|
|
return &ForceToolsSyncBadRequest{}
|
|
}
|
|
|
|
/*
|
|
ForceToolsSyncBadRequest describes a response with status code 400, with default header values.
|
|
|
|
APIErrorResponse
|
|
*/
|
|
type ForceToolsSyncBadRequest struct {
|
|
Payload apiserver_params.APIErrorResponse
|
|
}
|
|
|
|
// IsSuccess returns true when this force tools sync bad request response has a 2xx status code
|
|
func (o *ForceToolsSyncBadRequest) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this force tools sync bad request response has a 3xx status code
|
|
func (o *ForceToolsSyncBadRequest) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this force tools sync bad request response has a 4xx status code
|
|
func (o *ForceToolsSyncBadRequest) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this force tools sync bad request response has a 5xx status code
|
|
func (o *ForceToolsSyncBadRequest) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this force tools sync bad request response a status code equal to that given
|
|
func (o *ForceToolsSyncBadRequest) IsCode(code int) bool {
|
|
return code == 400
|
|
}
|
|
|
|
// Code gets the status code for the force tools sync bad request response
|
|
func (o *ForceToolsSyncBadRequest) Code() int {
|
|
return 400
|
|
}
|
|
|
|
func (o *ForceToolsSyncBadRequest) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /controller/tools/sync][%d] forceToolsSyncBadRequest %s", 400, payload)
|
|
}
|
|
|
|
func (o *ForceToolsSyncBadRequest) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /controller/tools/sync][%d] forceToolsSyncBadRequest %s", 400, payload)
|
|
}
|
|
|
|
func (o *ForceToolsSyncBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *ForceToolsSyncBadRequest) 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
|
|
}
|
|
|
|
// NewForceToolsSyncUnauthorized creates a ForceToolsSyncUnauthorized with default headers values
|
|
func NewForceToolsSyncUnauthorized() *ForceToolsSyncUnauthorized {
|
|
return &ForceToolsSyncUnauthorized{}
|
|
}
|
|
|
|
/*
|
|
ForceToolsSyncUnauthorized describes a response with status code 401, with default header values.
|
|
|
|
APIErrorResponse
|
|
*/
|
|
type ForceToolsSyncUnauthorized struct {
|
|
Payload apiserver_params.APIErrorResponse
|
|
}
|
|
|
|
// IsSuccess returns true when this force tools sync unauthorized response has a 2xx status code
|
|
func (o *ForceToolsSyncUnauthorized) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this force tools sync unauthorized response has a 3xx status code
|
|
func (o *ForceToolsSyncUnauthorized) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this force tools sync unauthorized response has a 4xx status code
|
|
func (o *ForceToolsSyncUnauthorized) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this force tools sync unauthorized response has a 5xx status code
|
|
func (o *ForceToolsSyncUnauthorized) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this force tools sync unauthorized response a status code equal to that given
|
|
func (o *ForceToolsSyncUnauthorized) IsCode(code int) bool {
|
|
return code == 401
|
|
}
|
|
|
|
// Code gets the status code for the force tools sync unauthorized response
|
|
func (o *ForceToolsSyncUnauthorized) Code() int {
|
|
return 401
|
|
}
|
|
|
|
func (o *ForceToolsSyncUnauthorized) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /controller/tools/sync][%d] forceToolsSyncUnauthorized %s", 401, payload)
|
|
}
|
|
|
|
func (o *ForceToolsSyncUnauthorized) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /controller/tools/sync][%d] forceToolsSyncUnauthorized %s", 401, payload)
|
|
}
|
|
|
|
func (o *ForceToolsSyncUnauthorized) GetPayload() apiserver_params.APIErrorResponse {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *ForceToolsSyncUnauthorized) 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
|
|
}
|