// 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" ) // GetManifestsReader is a Reader for the GetManifests structure. type GetManifestsReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *GetManifestsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewGetManifestsOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 400: result := NewGetManifestsBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 401: result := NewGetManifestsUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 503: result := NewGetManifestsServiceUnavailable() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("[GET /manifests] GetManifests", response, response.Code()) } } // NewGetManifestsOK creates a GetManifestsOK with default headers values func NewGetManifestsOK() *GetManifestsOK { return &GetManifestsOK{} } /* GetManifestsOK describes a response with status code 200, with default header values. OK */ type GetManifestsOK struct { Payload *GetManifestsOKBody } // IsSuccess returns true when this get manifests o k response has a 2xx status code func (o *GetManifestsOK) IsSuccess() bool { return true } // IsRedirect returns true when this get manifests o k response has a 3xx status code func (o *GetManifestsOK) IsRedirect() bool { return false } // IsClientError returns true when this get manifests o k response has a 4xx status code func (o *GetManifestsOK) IsClientError() bool { return false } // IsServerError returns true when this get manifests o k response has a 5xx status code func (o *GetManifestsOK) IsServerError() bool { return false } // IsCode returns true when this get manifests o k response a status code equal to that given func (o *GetManifestsOK) IsCode(code int) bool { return code == 200 } // Code gets the status code for the get manifests o k response func (o *GetManifestsOK) Code() int { return 200 } func (o *GetManifestsOK) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /manifests][%d] getManifestsOK %s", 200, payload) } func (o *GetManifestsOK) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /manifests][%d] getManifestsOK %s", 200, payload) } func (o *GetManifestsOK) GetPayload() *GetManifestsOKBody { return o.Payload } func (o *GetManifestsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(GetManifestsOKBody) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewGetManifestsBadRequest creates a GetManifestsBadRequest with default headers values func NewGetManifestsBadRequest() *GetManifestsBadRequest { return &GetManifestsBadRequest{} } /* GetManifestsBadRequest describes a response with status code 400, with default header values. Bad request */ type GetManifestsBadRequest struct { Payload *models.CommonJSONError } // IsSuccess returns true when this get manifests bad request response has a 2xx status code func (o *GetManifestsBadRequest) IsSuccess() bool { return false } // IsRedirect returns true when this get manifests bad request response has a 3xx status code func (o *GetManifestsBadRequest) IsRedirect() bool { return false } // IsClientError returns true when this get manifests bad request response has a 4xx status code func (o *GetManifestsBadRequest) IsClientError() bool { return true } // IsServerError returns true when this get manifests bad request response has a 5xx status code func (o *GetManifestsBadRequest) IsServerError() bool { return false } // IsCode returns true when this get manifests bad request response a status code equal to that given func (o *GetManifestsBadRequest) IsCode(code int) bool { return code == 400 } // Code gets the status code for the get manifests bad request response func (o *GetManifestsBadRequest) Code() int { return 400 } func (o *GetManifestsBadRequest) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /manifests][%d] getManifestsBadRequest %s", 400, payload) } func (o *GetManifestsBadRequest) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /manifests][%d] getManifestsBadRequest %s", 400, payload) } func (o *GetManifestsBadRequest) GetPayload() *models.CommonJSONError { return o.Payload } func (o *GetManifestsBadRequest) 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 } // NewGetManifestsUnauthorized creates a GetManifestsUnauthorized with default headers values func NewGetManifestsUnauthorized() *GetManifestsUnauthorized { return &GetManifestsUnauthorized{} } /* GetManifestsUnauthorized describes a response with status code 401, with default header values. Unauthorized */ type GetManifestsUnauthorized struct { Payload *models.CommonJSONError } // IsSuccess returns true when this get manifests unauthorized response has a 2xx status code func (o *GetManifestsUnauthorized) IsSuccess() bool { return false } // IsRedirect returns true when this get manifests unauthorized response has a 3xx status code func (o *GetManifestsUnauthorized) IsRedirect() bool { return false } // IsClientError returns true when this get manifests unauthorized response has a 4xx status code func (o *GetManifestsUnauthorized) IsClientError() bool { return true } // IsServerError returns true when this get manifests unauthorized response has a 5xx status code func (o *GetManifestsUnauthorized) IsServerError() bool { return false } // IsCode returns true when this get manifests unauthorized response a status code equal to that given func (o *GetManifestsUnauthorized) IsCode(code int) bool { return code == 401 } // Code gets the status code for the get manifests unauthorized response func (o *GetManifestsUnauthorized) Code() int { return 401 } func (o *GetManifestsUnauthorized) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /manifests][%d] getManifestsUnauthorized %s", 401, payload) } func (o *GetManifestsUnauthorized) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /manifests][%d] getManifestsUnauthorized %s", 401, payload) } func (o *GetManifestsUnauthorized) GetPayload() *models.CommonJSONError { return o.Payload } func (o *GetManifestsUnauthorized) 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 } // NewGetManifestsServiceUnavailable creates a GetManifestsServiceUnavailable with default headers values func NewGetManifestsServiceUnavailable() *GetManifestsServiceUnavailable { return &GetManifestsServiceUnavailable{} } /* GetManifestsServiceUnavailable describes a response with status code 503, with default header values. Service unavailable */ type GetManifestsServiceUnavailable struct { Payload *models.CommonJSONError } // IsSuccess returns true when this get manifests service unavailable response has a 2xx status code func (o *GetManifestsServiceUnavailable) IsSuccess() bool { return false } // IsRedirect returns true when this get manifests service unavailable response has a 3xx status code func (o *GetManifestsServiceUnavailable) IsRedirect() bool { return false } // IsClientError returns true when this get manifests service unavailable response has a 4xx status code func (o *GetManifestsServiceUnavailable) IsClientError() bool { return false } // IsServerError returns true when this get manifests service unavailable response has a 5xx status code func (o *GetManifestsServiceUnavailable) IsServerError() bool { return true } // IsCode returns true when this get manifests service unavailable response a status code equal to that given func (o *GetManifestsServiceUnavailable) IsCode(code int) bool { return code == 503 } // Code gets the status code for the get manifests service unavailable response func (o *GetManifestsServiceUnavailable) Code() int { return 503 } func (o *GetManifestsServiceUnavailable) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /manifests][%d] getManifestsServiceUnavailable %s", 503, payload) } func (o *GetManifestsServiceUnavailable) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /manifests][%d] getManifestsServiceUnavailable %s", 503, payload) } func (o *GetManifestsServiceUnavailable) GetPayload() *models.CommonJSONError { return o.Payload } func (o *GetManifestsServiceUnavailable) 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 } /* GetManifestsOKBody get manifests o k body swagger:model GetManifestsOKBody */ type GetManifestsOKBody struct { models.CommonJSONDBQueryResult // data Data []*models.CommonUpdateManifest `json:"data"` } // UnmarshalJSON unmarshals this object from a JSON structure func (o *GetManifestsOKBody) UnmarshalJSON(raw []byte) error { // GetManifestsOKBodyAO0 var getManifestsOKBodyAO0 models.CommonJSONDBQueryResult if err := swag.ReadJSON(raw, &getManifestsOKBodyAO0); err != nil { return err } o.CommonJSONDBQueryResult = getManifestsOKBodyAO0 // GetManifestsOKBodyAO1 var dataGetManifestsOKBodyAO1 struct { Data []*models.CommonUpdateManifest `json:"data"` } if err := swag.ReadJSON(raw, &dataGetManifestsOKBodyAO1); err != nil { return err } o.Data = dataGetManifestsOKBodyAO1.Data return nil } // MarshalJSON marshals this object to a JSON structure func (o GetManifestsOKBody) MarshalJSON() ([]byte, error) { _parts := make([][]byte, 0, 2) getManifestsOKBodyAO0, err := swag.WriteJSON(o.CommonJSONDBQueryResult) if err != nil { return nil, err } _parts = append(_parts, getManifestsOKBodyAO0) var dataGetManifestsOKBodyAO1 struct { Data []*models.CommonUpdateManifest `json:"data"` } dataGetManifestsOKBodyAO1.Data = o.Data jsonDataGetManifestsOKBodyAO1, errGetManifestsOKBodyAO1 := swag.WriteJSON(dataGetManifestsOKBodyAO1) if errGetManifestsOKBodyAO1 != nil { return nil, errGetManifestsOKBodyAO1 } _parts = append(_parts, jsonDataGetManifestsOKBodyAO1) return swag.ConcatJSON(_parts...), nil } // Validate validates this get manifests o k body func (o *GetManifestsOKBody) 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 *GetManifestsOKBody) 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("getManifestsOK" + "." + "data" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("getManifestsOK" + "." + "data" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this get manifests o k body based on the context it is used func (o *GetManifestsOKBody) 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 *GetManifestsOKBody) 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("getManifestsOK" + "." + "data" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("getManifestsOK" + "." + "data" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (o *GetManifestsOKBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetManifestsOKBody) UnmarshalBinary(b []byte) error { var res GetManifestsOKBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil }