mirror of
https://github.com/openziti/zrok.git
synced 2025-08-22 21:20:42 +02:00
386 lines
9.8 KiB
Go
386 lines
9.8 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package agent
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the generate command
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/runtime/middleware"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
|
|
"github.com/openziti/zrok/rest_model_zrok"
|
|
)
|
|
|
|
// RemoteStatusHandlerFunc turns a function with the right signature into a remote status handler
|
|
type RemoteStatusHandlerFunc func(RemoteStatusParams, *rest_model_zrok.Principal) middleware.Responder
|
|
|
|
// Handle executing the request and returning a response
|
|
func (fn RemoteStatusHandlerFunc) Handle(params RemoteStatusParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
|
return fn(params, principal)
|
|
}
|
|
|
|
// RemoteStatusHandler interface for that can handle valid remote status params
|
|
type RemoteStatusHandler interface {
|
|
Handle(RemoteStatusParams, *rest_model_zrok.Principal) middleware.Responder
|
|
}
|
|
|
|
// NewRemoteStatus creates a new http.Handler for the remote status operation
|
|
func NewRemoteStatus(ctx *middleware.Context, handler RemoteStatusHandler) *RemoteStatus {
|
|
return &RemoteStatus{Context: ctx, Handler: handler}
|
|
}
|
|
|
|
/*
|
|
RemoteStatus swagger:route POST /agent/status agent remoteStatus
|
|
|
|
RemoteStatus remote status API
|
|
*/
|
|
type RemoteStatus struct {
|
|
Context *middleware.Context
|
|
Handler RemoteStatusHandler
|
|
}
|
|
|
|
func (o *RemoteStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|
route, rCtx, _ := o.Context.RouteInfo(r)
|
|
if rCtx != nil {
|
|
*r = *rCtx
|
|
}
|
|
var Params = NewRemoteStatusParams()
|
|
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
|
if err != nil {
|
|
o.Context.Respond(rw, r, route.Produces, route, err)
|
|
return
|
|
}
|
|
if aCtx != nil {
|
|
*r = *aCtx
|
|
}
|
|
var principal *rest_model_zrok.Principal
|
|
if uprinc != nil {
|
|
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
|
}
|
|
|
|
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
|
o.Context.Respond(rw, r, route.Produces, route, err)
|
|
return
|
|
}
|
|
|
|
res := o.Handler.Handle(Params, principal) // actually handle the request
|
|
o.Context.Respond(rw, r, route.Produces, route, res)
|
|
|
|
}
|
|
|
|
// RemoteStatusBody remote status body
|
|
//
|
|
// swagger:model RemoteStatusBody
|
|
type RemoteStatusBody struct {
|
|
|
|
// env z Id
|
|
EnvZID string `json:"envZId,omitempty"`
|
|
}
|
|
|
|
// Validate validates this remote status body
|
|
func (o *RemoteStatusBody) Validate(formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validates this remote status body based on context it is used
|
|
func (o *RemoteStatusBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *RemoteStatusBody) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *RemoteStatusBody) UnmarshalBinary(b []byte) error {
|
|
var res RemoteStatusBody
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|
|
|
|
// RemoteStatusOKBody remote status o k body
|
|
//
|
|
// swagger:model RemoteStatusOKBody
|
|
type RemoteStatusOKBody struct {
|
|
|
|
// accesses
|
|
Accesses []*RemoteStatusOKBodyAccessesItems0 `json:"accesses"`
|
|
|
|
// shares
|
|
Shares []*RemoteStatusOKBodySharesItems0 `json:"shares"`
|
|
}
|
|
|
|
// Validate validates this remote status o k body
|
|
func (o *RemoteStatusOKBody) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := o.validateAccesses(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := o.validateShares(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (o *RemoteStatusOKBody) validateAccesses(formats strfmt.Registry) error {
|
|
if swag.IsZero(o.Accesses) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(o.Accesses); i++ {
|
|
if swag.IsZero(o.Accesses[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if o.Accesses[i] != nil {
|
|
if err := o.Accesses[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("remoteStatusOK" + "." + "accesses" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("remoteStatusOK" + "." + "accesses" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (o *RemoteStatusOKBody) validateShares(formats strfmt.Registry) error {
|
|
if swag.IsZero(o.Shares) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(o.Shares); i++ {
|
|
if swag.IsZero(o.Shares[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if o.Shares[i] != nil {
|
|
if err := o.Shares[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("remoteStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("remoteStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this remote status o k body based on the context it is used
|
|
func (o *RemoteStatusOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := o.contextValidateAccesses(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := o.contextValidateShares(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (o *RemoteStatusOKBody) contextValidateAccesses(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(o.Accesses); i++ {
|
|
|
|
if o.Accesses[i] != nil {
|
|
|
|
if swag.IsZero(o.Accesses[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := o.Accesses[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("remoteStatusOK" + "." + "accesses" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("remoteStatusOK" + "." + "accesses" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (o *RemoteStatusOKBody) contextValidateShares(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(o.Shares); i++ {
|
|
|
|
if o.Shares[i] != nil {
|
|
|
|
if swag.IsZero(o.Shares[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := o.Shares[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("remoteStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("remoteStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *RemoteStatusOKBody) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *RemoteStatusOKBody) UnmarshalBinary(b []byte) error {
|
|
var res RemoteStatusOKBody
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|
|
|
|
// RemoteStatusOKBodyAccessesItems0 remote status o k body accesses items0
|
|
//
|
|
// swagger:model RemoteStatusOKBodyAccessesItems0
|
|
type RemoteStatusOKBodyAccessesItems0 struct {
|
|
|
|
// bind address
|
|
BindAddress string `json:"bindAddress,omitempty"`
|
|
|
|
// frontend token
|
|
FrontendToken string `json:"frontendToken,omitempty"`
|
|
|
|
// response headers
|
|
ResponseHeaders []string `json:"responseHeaders"`
|
|
|
|
// token
|
|
Token string `json:"token,omitempty"`
|
|
}
|
|
|
|
// Validate validates this remote status o k body accesses items0
|
|
func (o *RemoteStatusOKBodyAccessesItems0) Validate(formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validates this remote status o k body accesses items0 based on context it is used
|
|
func (o *RemoteStatusOKBodyAccessesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *RemoteStatusOKBodyAccessesItems0) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *RemoteStatusOKBodyAccessesItems0) UnmarshalBinary(b []byte) error {
|
|
var res RemoteStatusOKBodyAccessesItems0
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|
|
|
|
// RemoteStatusOKBodySharesItems0 remote status o k body shares items0
|
|
//
|
|
// swagger:model RemoteStatusOKBodySharesItems0
|
|
type RemoteStatusOKBodySharesItems0 struct {
|
|
|
|
// backend endpoint
|
|
BackendEndpoint string `json:"backendEndpoint,omitempty"`
|
|
|
|
// backend mode
|
|
BackendMode string `json:"backendMode,omitempty"`
|
|
|
|
// frontend endpoints
|
|
FrontendEndpoints []string `json:"frontendEndpoints"`
|
|
|
|
// open
|
|
Open bool `json:"open,omitempty"`
|
|
|
|
// reserved
|
|
Reserved bool `json:"reserved,omitempty"`
|
|
|
|
// share mode
|
|
ShareMode string `json:"shareMode,omitempty"`
|
|
|
|
// status
|
|
Status string `json:"status,omitempty"`
|
|
|
|
// token
|
|
Token string `json:"token,omitempty"`
|
|
}
|
|
|
|
// Validate validates this remote status o k body shares items0
|
|
func (o *RemoteStatusOKBodySharesItems0) Validate(formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validates this remote status o k body shares items0 based on context it is used
|
|
func (o *RemoteStatusOKBodySharesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *RemoteStatusOKBodySharesItems0) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *RemoteStatusOKBodySharesItems0) UnmarshalBinary(b []byte) error {
|
|
var res RemoteStatusOKBodySharesItems0
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|