2022-04-11 09:35:06 +00:00
|
|
|
// 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 (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/go-openapi/runtime"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-rest-gw/gen/models"
|
|
|
|
)
|
|
|
|
|
|
|
|
// AuthOKCode is the HTTP code returned for type AuthOK
|
|
|
|
const AuthOKCode int = 200
|
|
|
|
|
2022-08-18 14:35:53 +00:00
|
|
|
/*AuthOK Base64 encoded stable binary marshaled bearer token bodies.
|
2022-04-11 09:35:06 +00:00
|
|
|
|
|
|
|
swagger:response authOK
|
|
|
|
*/
|
|
|
|
type AuthOK struct {
|
2022-08-05 19:09:19 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
*/
|
|
|
|
AccessControlAllowOrigin string `json:"Access-Control-Allow-Origin"`
|
2022-04-11 09:35:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
In: Body
|
|
|
|
*/
|
2022-07-07 09:02:05 +00:00
|
|
|
Payload []*models.TokenResponse `json:"body,omitempty"`
|
2022-04-11 09:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewAuthOK creates AuthOK with default headers values
|
|
|
|
func NewAuthOK() *AuthOK {
|
|
|
|
|
|
|
|
return &AuthOK{}
|
|
|
|
}
|
|
|
|
|
2022-08-05 19:09:19 +00:00
|
|
|
// WithAccessControlAllowOrigin adds the accessControlAllowOrigin to the auth o k response
|
|
|
|
func (o *AuthOK) WithAccessControlAllowOrigin(accessControlAllowOrigin string) *AuthOK {
|
|
|
|
o.AccessControlAllowOrigin = accessControlAllowOrigin
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetAccessControlAllowOrigin sets the accessControlAllowOrigin to the auth o k response
|
|
|
|
func (o *AuthOK) SetAccessControlAllowOrigin(accessControlAllowOrigin string) {
|
|
|
|
o.AccessControlAllowOrigin = accessControlAllowOrigin
|
|
|
|
}
|
|
|
|
|
2022-04-11 09:35:06 +00:00
|
|
|
// WithPayload adds the payload to the auth o k response
|
2022-07-07 09:02:05 +00:00
|
|
|
func (o *AuthOK) WithPayload(payload []*models.TokenResponse) *AuthOK {
|
2022-04-11 09:35:06 +00:00
|
|
|
o.Payload = payload
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetPayload sets the payload to the auth o k response
|
2022-07-07 09:02:05 +00:00
|
|
|
func (o *AuthOK) SetPayload(payload []*models.TokenResponse) {
|
2022-04-11 09:35:06 +00:00
|
|
|
o.Payload = payload
|
|
|
|
}
|
|
|
|
|
|
|
|
// WriteResponse to the client
|
|
|
|
func (o *AuthOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
|
|
|
|
2022-08-05 19:09:19 +00:00
|
|
|
// response header Access-Control-Allow-Origin
|
|
|
|
|
|
|
|
accessControlAllowOrigin := o.AccessControlAllowOrigin
|
|
|
|
if accessControlAllowOrigin != "" {
|
|
|
|
rw.Header().Set("Access-Control-Allow-Origin", accessControlAllowOrigin)
|
|
|
|
}
|
|
|
|
|
2022-04-11 09:35:06 +00:00
|
|
|
rw.WriteHeader(200)
|
2022-07-07 09:02:05 +00:00
|
|
|
payload := o.Payload
|
|
|
|
if payload == nil {
|
|
|
|
// return empty array
|
|
|
|
payload = make([]*models.TokenResponse, 0, 50)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := producer.Produce(rw, payload); err != nil {
|
|
|
|
panic(err) // let the recovery middleware deal with this
|
2022-04-11 09:35:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// AuthBadRequestCode is the HTTP code returned for type AuthBadRequest
|
|
|
|
const AuthBadRequestCode int = 400
|
|
|
|
|
|
|
|
/*AuthBadRequest Bad request
|
|
|
|
|
|
|
|
swagger:response authBadRequest
|
|
|
|
*/
|
|
|
|
type AuthBadRequest struct {
|
|
|
|
|
|
|
|
/*
|
|
|
|
In: Body
|
|
|
|
*/
|
2022-07-07 12:59:38 +00:00
|
|
|
Payload *models.ErrorResponse `json:"body,omitempty"`
|
2022-04-11 09:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewAuthBadRequest creates AuthBadRequest with default headers values
|
|
|
|
func NewAuthBadRequest() *AuthBadRequest {
|
|
|
|
|
|
|
|
return &AuthBadRequest{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithPayload adds the payload to the auth bad request response
|
2022-07-07 12:59:38 +00:00
|
|
|
func (o *AuthBadRequest) WithPayload(payload *models.ErrorResponse) *AuthBadRequest {
|
2022-04-11 09:35:06 +00:00
|
|
|
o.Payload = payload
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetPayload sets the payload to the auth bad request response
|
2022-07-07 12:59:38 +00:00
|
|
|
func (o *AuthBadRequest) SetPayload(payload *models.ErrorResponse) {
|
2022-04-11 09:35:06 +00:00
|
|
|
o.Payload = payload
|
|
|
|
}
|
|
|
|
|
|
|
|
// WriteResponse to the client
|
|
|
|
func (o *AuthBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
|
|
|
|
|
|
|
rw.WriteHeader(400)
|
2022-07-07 12:59:38 +00:00
|
|
|
if o.Payload != nil {
|
|
|
|
payload := o.Payload
|
|
|
|
if err := producer.Produce(rw, payload); err != nil {
|
|
|
|
panic(err) // let the recovery middleware deal with this
|
|
|
|
}
|
2022-04-11 09:35:06 +00:00
|
|
|
}
|
|
|
|
}
|