This change adds the API endpoints, the CLI commands and the web UI elements needed to manage objects in GARMs internal storage. This storage system is meant to be used to distribute the garm-agent and as a single source of truth for provider binaries, when we will add the ability for GARM to scale out. Potentially, we can also use this in air gapped systems to distribute the runner binaries for forges that don't have their own internal storage system (like GHES). Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
179 lines
5.2 KiB
Go
179 lines
5.2 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package objects
|
|
|
|
// 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"
|
|
)
|
|
|
|
// GetFileObjectReader is a Reader for the GetFileObject structure.
|
|
type GetFileObjectReader struct {
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ReadResponse reads a server response into the received o.
|
|
func (o *GetFileObjectReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
|
switch response.Code() {
|
|
case 200:
|
|
result := NewGetFileObjectOK()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return result, nil
|
|
case 400:
|
|
result := NewGetFileObjectBadRequest()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
default:
|
|
return nil, runtime.NewAPIError("[GET /objects/{objectID}] GetFileObject", response, response.Code())
|
|
}
|
|
}
|
|
|
|
// NewGetFileObjectOK creates a GetFileObjectOK with default headers values
|
|
func NewGetFileObjectOK() *GetFileObjectOK {
|
|
return &GetFileObjectOK{}
|
|
}
|
|
|
|
/*
|
|
GetFileObjectOK describes a response with status code 200, with default header values.
|
|
|
|
FileObject
|
|
*/
|
|
type GetFileObjectOK struct {
|
|
Payload garm_params.FileObject
|
|
}
|
|
|
|
// IsSuccess returns true when this get file object o k response has a 2xx status code
|
|
func (o *GetFileObjectOK) IsSuccess() bool {
|
|
return true
|
|
}
|
|
|
|
// IsRedirect returns true when this get file object o k response has a 3xx status code
|
|
func (o *GetFileObjectOK) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this get file object o k response has a 4xx status code
|
|
func (o *GetFileObjectOK) IsClientError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsServerError returns true when this get file object o k response has a 5xx status code
|
|
func (o *GetFileObjectOK) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this get file object o k response a status code equal to that given
|
|
func (o *GetFileObjectOK) IsCode(code int) bool {
|
|
return code == 200
|
|
}
|
|
|
|
// Code gets the status code for the get file object o k response
|
|
func (o *GetFileObjectOK) Code() int {
|
|
return 200
|
|
}
|
|
|
|
func (o *GetFileObjectOK) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /objects/{objectID}][%d] getFileObjectOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *GetFileObjectOK) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /objects/{objectID}][%d] getFileObjectOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *GetFileObjectOK) GetPayload() garm_params.FileObject {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *GetFileObjectOK) 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
|
|
}
|
|
|
|
// NewGetFileObjectBadRequest creates a GetFileObjectBadRequest with default headers values
|
|
func NewGetFileObjectBadRequest() *GetFileObjectBadRequest {
|
|
return &GetFileObjectBadRequest{}
|
|
}
|
|
|
|
/*
|
|
GetFileObjectBadRequest describes a response with status code 400, with default header values.
|
|
|
|
APIErrorResponse
|
|
*/
|
|
type GetFileObjectBadRequest struct {
|
|
Payload apiserver_params.APIErrorResponse
|
|
}
|
|
|
|
// IsSuccess returns true when this get file object bad request response has a 2xx status code
|
|
func (o *GetFileObjectBadRequest) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this get file object bad request response has a 3xx status code
|
|
func (o *GetFileObjectBadRequest) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this get file object bad request response has a 4xx status code
|
|
func (o *GetFileObjectBadRequest) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this get file object bad request response has a 5xx status code
|
|
func (o *GetFileObjectBadRequest) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this get file object bad request response a status code equal to that given
|
|
func (o *GetFileObjectBadRequest) IsCode(code int) bool {
|
|
return code == 400
|
|
}
|
|
|
|
// Code gets the status code for the get file object bad request response
|
|
func (o *GetFileObjectBadRequest) Code() int {
|
|
return 400
|
|
}
|
|
|
|
func (o *GetFileObjectBadRequest) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /objects/{objectID}][%d] getFileObjectBadRequest %s", 400, payload)
|
|
}
|
|
|
|
func (o *GetFileObjectBadRequest) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /objects/{objectID}][%d] getFileObjectBadRequest %s", 400, payload)
|
|
}
|
|
|
|
func (o *GetFileObjectBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *GetFileObjectBadRequest) 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
|
|
}
|