Files
cloud-services/pkg/ota_api/client/operations/get_issues_responses.go

503 lines
14 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"fiskerinc.com/modules/ota_api/models"
)
// GetIssuesReader is a Reader for the GetIssues structure.
type GetIssuesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetIssuesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetIssuesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewGetIssuesBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 401:
result := NewGetIssuesUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 503:
result := NewGetIssuesServiceUnavailable()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /issues] GetIssues", response, response.Code())
}
}
// NewGetIssuesOK creates a GetIssuesOK with default headers values
func NewGetIssuesOK() *GetIssuesOK {
return &GetIssuesOK{}
}
/*
GetIssuesOK describes a response with status code 200, with default header values.
OK
*/
type GetIssuesOK struct {
Payload *GetIssuesOKBody
}
// IsSuccess returns true when this get issues o k response has a 2xx status code
func (o *GetIssuesOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get issues o k response has a 3xx status code
func (o *GetIssuesOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get issues o k response has a 4xx status code
func (o *GetIssuesOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get issues o k response has a 5xx status code
func (o *GetIssuesOK) IsServerError() bool {
return false
}
// IsCode returns true when this get issues o k response a status code equal to that given
func (o *GetIssuesOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get issues o k response
func (o *GetIssuesOK) Code() int {
return 200
}
func (o *GetIssuesOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /issues][%d] getIssuesOK %s", 200, payload)
}
func (o *GetIssuesOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /issues][%d] getIssuesOK %s", 200, payload)
}
func (o *GetIssuesOK) GetPayload() *GetIssuesOKBody {
return o.Payload
}
func (o *GetIssuesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(GetIssuesOKBody)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetIssuesBadRequest creates a GetIssuesBadRequest with default headers values
func NewGetIssuesBadRequest() *GetIssuesBadRequest {
return &GetIssuesBadRequest{}
}
/*
GetIssuesBadRequest describes a response with status code 400, with default header values.
Bad request
*/
type GetIssuesBadRequest struct {
Payload *models.CommonJSONError
}
// IsSuccess returns true when this get issues bad request response has a 2xx status code
func (o *GetIssuesBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get issues bad request response has a 3xx status code
func (o *GetIssuesBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this get issues bad request response has a 4xx status code
func (o *GetIssuesBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this get issues bad request response has a 5xx status code
func (o *GetIssuesBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this get issues bad request response a status code equal to that given
func (o *GetIssuesBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the get issues bad request response
func (o *GetIssuesBadRequest) Code() int {
return 400
}
func (o *GetIssuesBadRequest) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /issues][%d] getIssuesBadRequest %s", 400, payload)
}
func (o *GetIssuesBadRequest) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /issues][%d] getIssuesBadRequest %s", 400, payload)
}
func (o *GetIssuesBadRequest) GetPayload() *models.CommonJSONError {
return o.Payload
}
func (o *GetIssuesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.CommonJSONError)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetIssuesUnauthorized creates a GetIssuesUnauthorized with default headers values
func NewGetIssuesUnauthorized() *GetIssuesUnauthorized {
return &GetIssuesUnauthorized{}
}
/*
GetIssuesUnauthorized describes a response with status code 401, with default header values.
Unauthorized
*/
type GetIssuesUnauthorized struct {
Payload *models.CommonJSONError
}
// IsSuccess returns true when this get issues unauthorized response has a 2xx status code
func (o *GetIssuesUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get issues unauthorized response has a 3xx status code
func (o *GetIssuesUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this get issues unauthorized response has a 4xx status code
func (o *GetIssuesUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this get issues unauthorized response has a 5xx status code
func (o *GetIssuesUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this get issues unauthorized response a status code equal to that given
func (o *GetIssuesUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the get issues unauthorized response
func (o *GetIssuesUnauthorized) Code() int {
return 401
}
func (o *GetIssuesUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /issues][%d] getIssuesUnauthorized %s", 401, payload)
}
func (o *GetIssuesUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /issues][%d] getIssuesUnauthorized %s", 401, payload)
}
func (o *GetIssuesUnauthorized) GetPayload() *models.CommonJSONError {
return o.Payload
}
func (o *GetIssuesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.CommonJSONError)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetIssuesServiceUnavailable creates a GetIssuesServiceUnavailable with default headers values
func NewGetIssuesServiceUnavailable() *GetIssuesServiceUnavailable {
return &GetIssuesServiceUnavailable{}
}
/*
GetIssuesServiceUnavailable describes a response with status code 503, with default header values.
Service unavailable
*/
type GetIssuesServiceUnavailable struct {
Payload *models.CommonJSONError
}
// IsSuccess returns true when this get issues service unavailable response has a 2xx status code
func (o *GetIssuesServiceUnavailable) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get issues service unavailable response has a 3xx status code
func (o *GetIssuesServiceUnavailable) IsRedirect() bool {
return false
}
// IsClientError returns true when this get issues service unavailable response has a 4xx status code
func (o *GetIssuesServiceUnavailable) IsClientError() bool {
return false
}
// IsServerError returns true when this get issues service unavailable response has a 5xx status code
func (o *GetIssuesServiceUnavailable) IsServerError() bool {
return true
}
// IsCode returns true when this get issues service unavailable response a status code equal to that given
func (o *GetIssuesServiceUnavailable) IsCode(code int) bool {
return code == 503
}
// Code gets the status code for the get issues service unavailable response
func (o *GetIssuesServiceUnavailable) Code() int {
return 503
}
func (o *GetIssuesServiceUnavailable) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /issues][%d] getIssuesServiceUnavailable %s", 503, payload)
}
func (o *GetIssuesServiceUnavailable) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /issues][%d] getIssuesServiceUnavailable %s", 503, payload)
}
func (o *GetIssuesServiceUnavailable) GetPayload() *models.CommonJSONError {
return o.Payload
}
func (o *GetIssuesServiceUnavailable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.CommonJSONError)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
GetIssuesOKBody get issues o k body
swagger:model GetIssuesOKBody
*/
type GetIssuesOKBody struct {
models.CommonJSONDBQueryResult
// data
Data []*models.CommonIssue `json:"data"`
}
// UnmarshalJSON unmarshals this object from a JSON structure
func (o *GetIssuesOKBody) UnmarshalJSON(raw []byte) error {
// GetIssuesOKBodyAO0
var getIssuesOKBodyAO0 models.CommonJSONDBQueryResult
if err := swag.ReadJSON(raw, &getIssuesOKBodyAO0); err != nil {
return err
}
o.CommonJSONDBQueryResult = getIssuesOKBodyAO0
// GetIssuesOKBodyAO1
var dataGetIssuesOKBodyAO1 struct {
Data []*models.CommonIssue `json:"data"`
}
if err := swag.ReadJSON(raw, &dataGetIssuesOKBodyAO1); err != nil {
return err
}
o.Data = dataGetIssuesOKBodyAO1.Data
return nil
}
// MarshalJSON marshals this object to a JSON structure
func (o GetIssuesOKBody) MarshalJSON() ([]byte, error) {
_parts := make([][]byte, 0, 2)
getIssuesOKBodyAO0, err := swag.WriteJSON(o.CommonJSONDBQueryResult)
if err != nil {
return nil, err
}
_parts = append(_parts, getIssuesOKBodyAO0)
var dataGetIssuesOKBodyAO1 struct {
Data []*models.CommonIssue `json:"data"`
}
dataGetIssuesOKBodyAO1.Data = o.Data
jsonDataGetIssuesOKBodyAO1, errGetIssuesOKBodyAO1 := swag.WriteJSON(dataGetIssuesOKBodyAO1)
if errGetIssuesOKBodyAO1 != nil {
return nil, errGetIssuesOKBodyAO1
}
_parts = append(_parts, jsonDataGetIssuesOKBodyAO1)
return swag.ConcatJSON(_parts...), nil
}
// Validate validates this get issues o k body
func (o *GetIssuesOKBody) Validate(formats strfmt.Registry) error {
var res []error
// validation for a type composition with models.CommonJSONDBQueryResult
if err := o.CommonJSONDBQueryResult.Validate(formats); err != nil {
res = append(res, err)
}
if err := o.validateData(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetIssuesOKBody) validateData(formats strfmt.Registry) error {
if swag.IsZero(o.Data) { // not required
return nil
}
for i := 0; i < len(o.Data); i++ {
if swag.IsZero(o.Data[i]) { // not required
continue
}
if o.Data[i] != nil {
if err := o.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("getIssuesOK" + "." + "data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("getIssuesOK" + "." + "data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this get issues o k body based on the context it is used
func (o *GetIssuesOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
// validation for a type composition with models.CommonJSONDBQueryResult
if err := o.CommonJSONDBQueryResult.ContextValidate(ctx, formats); err != nil {
res = append(res, err)
}
if err := o.contextValidateData(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetIssuesOKBody) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(o.Data); i++ {
if o.Data[i] != nil {
if swag.IsZero(o.Data[i]) { // not required
return nil
}
if err := o.Data[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("getIssuesOK" + "." + "data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("getIssuesOK" + "." + "data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (o *GetIssuesOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *GetIssuesOKBody) UnmarshalBinary(b []byte) error {
var res GetIssuesOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}