mirror of
https://github.com/hanzozt/edge-api.git
synced 2026-10-30 14:44:05 +00:00
Global rebrand of all OpenZiti references to Hanzo ZT: - Go module paths: github.com/openziti/* → github.com/hanzozt/* - Docker images: openziti/* → hanzozt/* - Java packages: org.openziti.* → org.hanzozt.* - Brand: OpenZiti → Hanzo ZT - URLs: openziti.io → hanzozt.dev
517 lines
16 KiB
Go
517 lines
16 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
//
|
|
// Copyright NetFoundry Inc.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
//
|
|
// __ __ _
|
|
// \ \ / / (_)
|
|
// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _
|
|
// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` |
|
|
// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it.
|
|
// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, |
|
|
// __/ |
|
|
// |___/
|
|
|
|
package authentication
|
|
|
|
// 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"
|
|
stderrors "errors"
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/go-openapi/runtime"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
|
|
"github.com/hanzozt/edge-api/rest_model"
|
|
)
|
|
|
|
// AuthenticateReader is a Reader for the Authenticate structure.
|
|
type AuthenticateReader struct {
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ReadResponse reads a server response into the received o.
|
|
func (o *AuthenticateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
|
|
switch response.Code() {
|
|
case 200:
|
|
result := NewAuthenticateOK()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return result, nil
|
|
case 400:
|
|
result := NewAuthenticateBadRequest()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 401:
|
|
result := NewAuthenticateUnauthorized()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 429:
|
|
result := NewAuthenticateTooManyRequests()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
default:
|
|
return nil, runtime.NewAPIError("[POST /authenticate] authenticate", response, response.Code())
|
|
}
|
|
}
|
|
|
|
// NewAuthenticateOK creates a AuthenticateOK with default headers values
|
|
func NewAuthenticateOK() *AuthenticateOK {
|
|
return &AuthenticateOK{}
|
|
}
|
|
|
|
/*
|
|
AuthenticateOK describes a response with status code 200, with default header values.
|
|
|
|
The API session associated with the session used to issue the request
|
|
*/
|
|
type AuthenticateOK struct {
|
|
|
|
/* Denotes different type of security token related information
|
|
*/
|
|
WWWAuthenticate []string
|
|
|
|
Payload *rest_model.CurrentAPISessionDetailEnvelope
|
|
}
|
|
|
|
// IsSuccess returns true when this authenticate o k response has a 2xx status code
|
|
func (o *AuthenticateOK) IsSuccess() bool {
|
|
return true
|
|
}
|
|
|
|
// IsRedirect returns true when this authenticate o k response has a 3xx status code
|
|
func (o *AuthenticateOK) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this authenticate o k response has a 4xx status code
|
|
func (o *AuthenticateOK) IsClientError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsServerError returns true when this authenticate o k response has a 5xx status code
|
|
func (o *AuthenticateOK) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this authenticate o k response a status code equal to that given
|
|
func (o *AuthenticateOK) IsCode(code int) bool {
|
|
return code == 200
|
|
}
|
|
|
|
// Code gets the status code for the authenticate o k response
|
|
func (o *AuthenticateOK) Code() int {
|
|
return 200
|
|
}
|
|
|
|
func (o *AuthenticateOK) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /authenticate][%d] authenticateOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *AuthenticateOK) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /authenticate][%d] authenticateOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *AuthenticateOK) GetPayload() *rest_model.CurrentAPISessionDetailEnvelope {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *AuthenticateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// hydrates response header WWW-Authenticate
|
|
hdrWWWAuthenticate := response.GetHeader("WWW-Authenticate")
|
|
|
|
if hdrWWWAuthenticate != "" {
|
|
|
|
// binding header items for WWW-Authenticate
|
|
valWWWAuthenticate, err := o.bindHeaderWWWAuthenticate(hdrWWWAuthenticate, formats)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
o.WWWAuthenticate = valWWWAuthenticate
|
|
}
|
|
|
|
o.Payload = new(rest_model.CurrentAPISessionDetailEnvelope)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// bindHeaderAuthenticateOK binds the response header WWW-Authenticate
|
|
func (o *AuthenticateOK) bindHeaderWWWAuthenticate(hdr string, formats strfmt.Registry) ([]string, error) {
|
|
wWWAuthenticateIV := hdr
|
|
|
|
var (
|
|
wWWAuthenticateIC []string
|
|
)
|
|
// items.CollectionFormat: ""
|
|
wWWAuthenticateIR := swag.SplitByFormat(wWWAuthenticateIV, "")
|
|
|
|
for _, wWWAuthenticateIIV := range wWWAuthenticateIR {
|
|
|
|
// convert split string to string
|
|
wWWAuthenticateIIC := wWWAuthenticateIIV // string as string
|
|
wWWAuthenticateIC = append(wWWAuthenticateIC, wWWAuthenticateIIC) // roll-up string into []string
|
|
}
|
|
|
|
return wWWAuthenticateIC, nil
|
|
}
|
|
|
|
// NewAuthenticateBadRequest creates a AuthenticateBadRequest with default headers values
|
|
func NewAuthenticateBadRequest() *AuthenticateBadRequest {
|
|
return &AuthenticateBadRequest{}
|
|
}
|
|
|
|
/*
|
|
AuthenticateBadRequest describes a response with status code 400, with default header values.
|
|
|
|
The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information
|
|
*/
|
|
type AuthenticateBadRequest struct {
|
|
|
|
/* Denotes different type of security token related information
|
|
*/
|
|
WWWAuthenticate []string
|
|
|
|
Payload *rest_model.APIErrorEnvelope
|
|
}
|
|
|
|
// IsSuccess returns true when this authenticate bad request response has a 2xx status code
|
|
func (o *AuthenticateBadRequest) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this authenticate bad request response has a 3xx status code
|
|
func (o *AuthenticateBadRequest) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this authenticate bad request response has a 4xx status code
|
|
func (o *AuthenticateBadRequest) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this authenticate bad request response has a 5xx status code
|
|
func (o *AuthenticateBadRequest) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this authenticate bad request response a status code equal to that given
|
|
func (o *AuthenticateBadRequest) IsCode(code int) bool {
|
|
return code == 400
|
|
}
|
|
|
|
// Code gets the status code for the authenticate bad request response
|
|
func (o *AuthenticateBadRequest) Code() int {
|
|
return 400
|
|
}
|
|
|
|
func (o *AuthenticateBadRequest) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /authenticate][%d] authenticateBadRequest %s", 400, payload)
|
|
}
|
|
|
|
func (o *AuthenticateBadRequest) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /authenticate][%d] authenticateBadRequest %s", 400, payload)
|
|
}
|
|
|
|
func (o *AuthenticateBadRequest) GetPayload() *rest_model.APIErrorEnvelope {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *AuthenticateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// hydrates response header WWW-Authenticate
|
|
hdrWWWAuthenticate := response.GetHeader("WWW-Authenticate")
|
|
|
|
if hdrWWWAuthenticate != "" {
|
|
|
|
// binding header items for WWW-Authenticate
|
|
valWWWAuthenticate, err := o.bindHeaderWWWAuthenticate(hdrWWWAuthenticate, formats)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
o.WWWAuthenticate = valWWWAuthenticate
|
|
}
|
|
|
|
o.Payload = new(rest_model.APIErrorEnvelope)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// bindHeaderAuthenticateBadRequest binds the response header WWW-Authenticate
|
|
func (o *AuthenticateBadRequest) bindHeaderWWWAuthenticate(hdr string, formats strfmt.Registry) ([]string, error) {
|
|
wWWAuthenticateIV := hdr
|
|
|
|
var (
|
|
wWWAuthenticateIC []string
|
|
)
|
|
// items.CollectionFormat: ""
|
|
wWWAuthenticateIR := swag.SplitByFormat(wWWAuthenticateIV, "")
|
|
|
|
for _, wWWAuthenticateIIV := range wWWAuthenticateIR {
|
|
|
|
// convert split string to string
|
|
wWWAuthenticateIIC := wWWAuthenticateIIV // string as string
|
|
wWWAuthenticateIC = append(wWWAuthenticateIC, wWWAuthenticateIIC) // roll-up string into []string
|
|
}
|
|
|
|
return wWWAuthenticateIC, nil
|
|
}
|
|
|
|
// NewAuthenticateUnauthorized creates a AuthenticateUnauthorized with default headers values
|
|
func NewAuthenticateUnauthorized() *AuthenticateUnauthorized {
|
|
return &AuthenticateUnauthorized{}
|
|
}
|
|
|
|
/*
|
|
AuthenticateUnauthorized describes a response with status code 401, with default header values.
|
|
|
|
The authentication request could not be processed as the credentials are invalid
|
|
*/
|
|
type AuthenticateUnauthorized struct {
|
|
|
|
/* Denotes different type of security token related information
|
|
*/
|
|
WWWAuthenticate []string
|
|
|
|
Payload *rest_model.APIErrorEnvelope
|
|
}
|
|
|
|
// IsSuccess returns true when this authenticate unauthorized response has a 2xx status code
|
|
func (o *AuthenticateUnauthorized) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this authenticate unauthorized response has a 3xx status code
|
|
func (o *AuthenticateUnauthorized) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this authenticate unauthorized response has a 4xx status code
|
|
func (o *AuthenticateUnauthorized) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this authenticate unauthorized response has a 5xx status code
|
|
func (o *AuthenticateUnauthorized) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this authenticate unauthorized response a status code equal to that given
|
|
func (o *AuthenticateUnauthorized) IsCode(code int) bool {
|
|
return code == 401
|
|
}
|
|
|
|
// Code gets the status code for the authenticate unauthorized response
|
|
func (o *AuthenticateUnauthorized) Code() int {
|
|
return 401
|
|
}
|
|
|
|
func (o *AuthenticateUnauthorized) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /authenticate][%d] authenticateUnauthorized %s", 401, payload)
|
|
}
|
|
|
|
func (o *AuthenticateUnauthorized) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /authenticate][%d] authenticateUnauthorized %s", 401, payload)
|
|
}
|
|
|
|
func (o *AuthenticateUnauthorized) GetPayload() *rest_model.APIErrorEnvelope {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *AuthenticateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// hydrates response header WWW-Authenticate
|
|
hdrWWWAuthenticate := response.GetHeader("WWW-Authenticate")
|
|
|
|
if hdrWWWAuthenticate != "" {
|
|
|
|
// binding header items for WWW-Authenticate
|
|
valWWWAuthenticate, err := o.bindHeaderWWWAuthenticate(hdrWWWAuthenticate, formats)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
o.WWWAuthenticate = valWWWAuthenticate
|
|
}
|
|
|
|
o.Payload = new(rest_model.APIErrorEnvelope)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// bindHeaderAuthenticateUnauthorized binds the response header WWW-Authenticate
|
|
func (o *AuthenticateUnauthorized) bindHeaderWWWAuthenticate(hdr string, formats strfmt.Registry) ([]string, error) {
|
|
wWWAuthenticateIV := hdr
|
|
|
|
var (
|
|
wWWAuthenticateIC []string
|
|
)
|
|
// items.CollectionFormat: ""
|
|
wWWAuthenticateIR := swag.SplitByFormat(wWWAuthenticateIV, "")
|
|
|
|
for _, wWWAuthenticateIIV := range wWWAuthenticateIR {
|
|
|
|
// convert split string to string
|
|
wWWAuthenticateIIC := wWWAuthenticateIIV // string as string
|
|
wWWAuthenticateIC = append(wWWAuthenticateIC, wWWAuthenticateIIC) // roll-up string into []string
|
|
}
|
|
|
|
return wWWAuthenticateIC, nil
|
|
}
|
|
|
|
// NewAuthenticateTooManyRequests creates a AuthenticateTooManyRequests with default headers values
|
|
func NewAuthenticateTooManyRequests() *AuthenticateTooManyRequests {
|
|
return &AuthenticateTooManyRequests{}
|
|
}
|
|
|
|
/*
|
|
AuthenticateTooManyRequests describes a response with status code 429, with default header values.
|
|
|
|
The resource requested is rate limited and the rate limit has been exceeded
|
|
*/
|
|
type AuthenticateTooManyRequests struct {
|
|
|
|
/* Denotes different type of security token related information
|
|
*/
|
|
WWWAuthenticate []string
|
|
|
|
Payload *rest_model.APIErrorEnvelope
|
|
}
|
|
|
|
// IsSuccess returns true when this authenticate too many requests response has a 2xx status code
|
|
func (o *AuthenticateTooManyRequests) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this authenticate too many requests response has a 3xx status code
|
|
func (o *AuthenticateTooManyRequests) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this authenticate too many requests response has a 4xx status code
|
|
func (o *AuthenticateTooManyRequests) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this authenticate too many requests response has a 5xx status code
|
|
func (o *AuthenticateTooManyRequests) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this authenticate too many requests response a status code equal to that given
|
|
func (o *AuthenticateTooManyRequests) IsCode(code int) bool {
|
|
return code == 429
|
|
}
|
|
|
|
// Code gets the status code for the authenticate too many requests response
|
|
func (o *AuthenticateTooManyRequests) Code() int {
|
|
return 429
|
|
}
|
|
|
|
func (o *AuthenticateTooManyRequests) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /authenticate][%d] authenticateTooManyRequests %s", 429, payload)
|
|
}
|
|
|
|
func (o *AuthenticateTooManyRequests) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[POST /authenticate][%d] authenticateTooManyRequests %s", 429, payload)
|
|
}
|
|
|
|
func (o *AuthenticateTooManyRequests) GetPayload() *rest_model.APIErrorEnvelope {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *AuthenticateTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// hydrates response header WWW-Authenticate
|
|
hdrWWWAuthenticate := response.GetHeader("WWW-Authenticate")
|
|
|
|
if hdrWWWAuthenticate != "" {
|
|
|
|
// binding header items for WWW-Authenticate
|
|
valWWWAuthenticate, err := o.bindHeaderWWWAuthenticate(hdrWWWAuthenticate, formats)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
o.WWWAuthenticate = valWWWAuthenticate
|
|
}
|
|
|
|
o.Payload = new(rest_model.APIErrorEnvelope)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// bindHeaderAuthenticateTooManyRequests binds the response header WWW-Authenticate
|
|
func (o *AuthenticateTooManyRequests) bindHeaderWWWAuthenticate(hdr string, formats strfmt.Registry) ([]string, error) {
|
|
wWWAuthenticateIV := hdr
|
|
|
|
var (
|
|
wWWAuthenticateIC []string
|
|
)
|
|
// items.CollectionFormat: ""
|
|
wWWAuthenticateIR := swag.SplitByFormat(wWWAuthenticateIV, "")
|
|
|
|
for _, wWWAuthenticateIIV := range wWWAuthenticateIR {
|
|
|
|
// convert split string to string
|
|
wWWAuthenticateIIC := wWWAuthenticateIIV // string as string
|
|
wWWAuthenticateIC = append(wWWAuthenticateIC, wWWAuthenticateIIC) // roll-up string into []string
|
|
}
|
|
|
|
return wWWAuthenticateIC, nil
|
|
}
|