1 Star 0 Fork 0

nanjo_fan/goharbor-client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
get_registry_responses.go 6.57 KB
一键复制 编辑 原始数据 按行查看 历史
王帆 提交于 2023-02-13 09:15 . 修改依赖
// Code generated by go-swagger; DO NOT EDIT.
package registry
// 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"
"gitee.com/nanjo-fan/goharbor-client/model"
)
// GetRegistryReader is a Reader for the GetRegistry structure.
type GetRegistryReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetRegistryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetRegistryOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewGetRegistryUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewGetRegistryForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetRegistryNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetRegistryInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetRegistryOK creates a GetRegistryOK with default headers values
func NewGetRegistryOK() *GetRegistryOK {
return &GetRegistryOK{}
}
/*
GetRegistryOK handles this case with default header values.
Success
*/
type GetRegistryOK struct {
Payload *model.Registry
}
func (o *GetRegistryOK) Error() string {
return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryOK %+v", 200, o.Payload)
}
func (o *GetRegistryOK) GetPayload() *model.Registry {
return o.Payload
}
func (o *GetRegistryOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(model.Registry)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetRegistryUnauthorized creates a GetRegistryUnauthorized with default headers values
func NewGetRegistryUnauthorized() *GetRegistryUnauthorized {
return &GetRegistryUnauthorized{}
}
/*
GetRegistryUnauthorized handles this case with default header values.
Unauthorized
*/
type GetRegistryUnauthorized struct {
/*The ID of the corresponding request for the response
*/
XRequestID string
Payload *model.Errors
}
func (o *GetRegistryUnauthorized) Error() string {
return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryUnauthorized %+v", 401, o.Payload)
}
func (o *GetRegistryUnauthorized) GetPayload() *model.Errors {
return o.Payload
}
func (o *GetRegistryUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response header X-Request-Id
o.XRequestID = response.GetHeader("X-Request-Id")
o.Payload = new(model.Errors)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetRegistryForbidden creates a GetRegistryForbidden with default headers values
func NewGetRegistryForbidden() *GetRegistryForbidden {
return &GetRegistryForbidden{}
}
/*
GetRegistryForbidden handles this case with default header values.
Forbidden
*/
type GetRegistryForbidden struct {
/*The ID of the corresponding request for the response
*/
XRequestID string
Payload *model.Errors
}
func (o *GetRegistryForbidden) Error() string {
return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryForbidden %+v", 403, o.Payload)
}
func (o *GetRegistryForbidden) GetPayload() *model.Errors {
return o.Payload
}
func (o *GetRegistryForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response header X-Request-Id
o.XRequestID = response.GetHeader("X-Request-Id")
o.Payload = new(model.Errors)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetRegistryNotFound creates a GetRegistryNotFound with default headers values
func NewGetRegistryNotFound() *GetRegistryNotFound {
return &GetRegistryNotFound{}
}
/*
GetRegistryNotFound handles this case with default header values.
Not found
*/
type GetRegistryNotFound struct {
/*The ID of the corresponding request for the response
*/
XRequestID string
Payload *model.Errors
}
func (o *GetRegistryNotFound) Error() string {
return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryNotFound %+v", 404, o.Payload)
}
func (o *GetRegistryNotFound) GetPayload() *model.Errors {
return o.Payload
}
func (o *GetRegistryNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response header X-Request-Id
o.XRequestID = response.GetHeader("X-Request-Id")
o.Payload = new(model.Errors)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetRegistryInternalServerError creates a GetRegistryInternalServerError with default headers values
func NewGetRegistryInternalServerError() *GetRegistryInternalServerError {
return &GetRegistryInternalServerError{}
}
/*
GetRegistryInternalServerError handles this case with default header values.
Internal server error
*/
type GetRegistryInternalServerError struct {
/*The ID of the corresponding request for the response
*/
XRequestID string
Payload *model.Errors
}
func (o *GetRegistryInternalServerError) Error() string {
return fmt.Sprintf("[GET /registries/{id}][%d] getRegistryInternalServerError %+v", 500, o.Payload)
}
func (o *GetRegistryInternalServerError) GetPayload() *model.Errors {
return o.Payload
}
func (o *GetRegistryInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response header X-Request-Id
o.XRequestID = response.GetHeader("X-Request-Id")
o.Payload = new(model.Errors)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/nanjo-fan/goharbor-client.git
git@gitee.com:nanjo-fan/goharbor-client.git
nanjo-fan
goharbor-client
goharbor-client
v1.0.3

搜索帮助