mirror of
https://github.com/openziti/zrok.git
synced 2025-08-16 19:01:16 +02:00
identities -> 'environments'
This commit is contained in:
@ -4,27 +4,92 @@ package rest_server_zrok
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"github.com/openziti-test-kitchen/zrok/ui"
|
||||
"github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/identity"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/metadata"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/tunnel"
|
||||
)
|
||||
|
||||
//go:generate swagger generate server --target ../../zrok --name Zrok --spec ../specs/zrok.yml --model-package rest_model_zrok --server-package rest_server_zrok --principal interface{} --exclude-main
|
||||
//go:generate swagger generate server --target ../../zrok --name Zrok --spec ../specs/zrok.yml --model-package rest_model_zrok --server-package rest_server_zrok --principal rest_model_zrok.Principal --exclude-main
|
||||
|
||||
func configureFlags(api *operations.ZrokAPI) {
|
||||
// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }
|
||||
}
|
||||
|
||||
func configureAPI(api *operations.ZrokAPI) http.Handler {
|
||||
// configure the api here
|
||||
api.ServeError = errors.ServeError
|
||||
api.Logger = logrus.Printf
|
||||
|
||||
// Set your custom logger if needed. Default one is log.Printf
|
||||
// Expected interface func(string, ...interface{})
|
||||
//
|
||||
// Example:
|
||||
// api.Logger = log.Printf
|
||||
|
||||
api.UseSwaggerUI()
|
||||
// To continue using redoc as your UI, uncomment the following line
|
||||
// api.UseRedoc()
|
||||
|
||||
api.JSONConsumer = runtime.JSONConsumer()
|
||||
|
||||
api.JSONProducer = runtime.JSONProducer()
|
||||
|
||||
// Applies when the "x-token" header is set
|
||||
if api.KeyAuth == nil {
|
||||
api.KeyAuth = func(token string) (*rest_model_zrok.Principal, error) {
|
||||
return nil, errors.NotImplemented("api key auth (key) x-token from header param [x-token] has not yet been implemented")
|
||||
}
|
||||
}
|
||||
|
||||
// Set your custom authorizer if needed. Default one is security.Authorized()
|
||||
// Expected interface runtime.Authorizer
|
||||
//
|
||||
// Example:
|
||||
// api.APIAuthorizer = security.Authorized()
|
||||
|
||||
if api.IdentityCreateAccountHandler == nil {
|
||||
api.IdentityCreateAccountHandler = identity.CreateAccountHandlerFunc(func(params identity.CreateAccountParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation identity.CreateAccount has not yet been implemented")
|
||||
})
|
||||
}
|
||||
if api.IdentityEnableHandler == nil {
|
||||
api.IdentityEnableHandler = identity.EnableHandlerFunc(func(params identity.EnableParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation identity.Enable has not yet been implemented")
|
||||
})
|
||||
}
|
||||
if api.MetadataListEnvironmentsHandler == nil {
|
||||
api.MetadataListEnvironmentsHandler = metadata.ListEnvironmentsHandlerFunc(func(params metadata.ListEnvironmentsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation metadata.ListEnvironments has not yet been implemented")
|
||||
})
|
||||
}
|
||||
if api.IdentityLoginHandler == nil {
|
||||
api.IdentityLoginHandler = identity.LoginHandlerFunc(func(params identity.LoginParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation identity.Login has not yet been implemented")
|
||||
})
|
||||
}
|
||||
if api.TunnelTunnelHandler == nil {
|
||||
api.TunnelTunnelHandler = tunnel.TunnelHandlerFunc(func(params tunnel.TunnelParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation tunnel.Tunnel has not yet been implemented")
|
||||
})
|
||||
}
|
||||
if api.TunnelUntunnelHandler == nil {
|
||||
api.TunnelUntunnelHandler = tunnel.UntunnelHandlerFunc(func(params tunnel.UntunnelParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation tunnel.Untunnel has not yet been implemented")
|
||||
})
|
||||
}
|
||||
if api.MetadataVersionHandler == nil {
|
||||
api.MetadataVersionHandler = metadata.VersionHandlerFunc(func(params metadata.VersionParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation metadata.Version has not yet been implemented")
|
||||
})
|
||||
}
|
||||
|
||||
api.PreServerShutdown = func() {}
|
||||
|
||||
api.ServerShutdown = func() {}
|
||||
@ -53,6 +118,5 @@ func setupMiddlewares(handler http.Handler) http.Handler {
|
||||
// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document.
|
||||
// So this is a good place to plug in a panic handling middleware, logging and metrics.
|
||||
func setupGlobalMiddleware(handler http.Handler) http.Handler {
|
||||
logrus.Infof("configuring")
|
||||
return ui.StaticBuilder(handler)
|
||||
return handler
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/listIdentities": {
|
||||
"/listEnvironments": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
@ -115,12 +115,12 @@ func init() {
|
||||
"tags": [
|
||||
"metadata"
|
||||
],
|
||||
"operationId": "listIdentities",
|
||||
"operationId": "listEnvironments",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "success",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/identities"
|
||||
"$ref": "#/definitions/environments"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
@ -289,16 +289,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"errorMessage": {
|
||||
"type": "string"
|
||||
},
|
||||
"identities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/identity"
|
||||
}
|
||||
},
|
||||
"identity": {
|
||||
"environment": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"active": {
|
||||
@ -315,6 +306,15 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"environments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/environment"
|
||||
}
|
||||
},
|
||||
"errorMessage": {
|
||||
"type": "string"
|
||||
},
|
||||
"loginRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -470,7 +470,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/listIdentities": {
|
||||
"/listEnvironments": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
@ -480,12 +480,12 @@ func init() {
|
||||
"tags": [
|
||||
"metadata"
|
||||
],
|
||||
"operationId": "listIdentities",
|
||||
"operationId": "listEnvironments",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "success",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/identities"
|
||||
"$ref": "#/definitions/environments"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
@ -654,16 +654,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"errorMessage": {
|
||||
"type": "string"
|
||||
},
|
||||
"identities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/identity"
|
||||
}
|
||||
},
|
||||
"identity": {
|
||||
"environment": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"active": {
|
||||
@ -680,6 +671,15 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"environments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/environment"
|
||||
}
|
||||
},
|
||||
"errorMessage": {
|
||||
"type": "string"
|
||||
},
|
||||
"loginRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -13,40 +13,40 @@ import (
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// ListIdentitiesHandlerFunc turns a function with the right signature into a list identities handler
|
||||
type ListIdentitiesHandlerFunc func(ListIdentitiesParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
// ListEnvironmentsHandlerFunc turns a function with the right signature into a list environments handler
|
||||
type ListEnvironmentsHandlerFunc func(ListEnvironmentsParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn ListIdentitiesHandlerFunc) Handle(params ListIdentitiesParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
func (fn ListEnvironmentsHandlerFunc) Handle(params ListEnvironmentsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// ListIdentitiesHandler interface for that can handle valid list identities params
|
||||
type ListIdentitiesHandler interface {
|
||||
Handle(ListIdentitiesParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
// ListEnvironmentsHandler interface for that can handle valid list environments params
|
||||
type ListEnvironmentsHandler interface {
|
||||
Handle(ListEnvironmentsParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewListIdentities creates a new http.Handler for the list identities operation
|
||||
func NewListIdentities(ctx *middleware.Context, handler ListIdentitiesHandler) *ListIdentities {
|
||||
return &ListIdentities{Context: ctx, Handler: handler}
|
||||
// NewListEnvironments creates a new http.Handler for the list environments operation
|
||||
func NewListEnvironments(ctx *middleware.Context, handler ListEnvironmentsHandler) *ListEnvironments {
|
||||
return &ListEnvironments{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* ListIdentities swagger:route GET /listIdentities metadata listIdentities
|
||||
/* ListEnvironments swagger:route GET /listEnvironments metadata listEnvironments
|
||||
|
||||
ListIdentities list identities API
|
||||
ListEnvironments list environments API
|
||||
|
||||
*/
|
||||
type ListIdentities struct {
|
||||
type ListEnvironments struct {
|
||||
Context *middleware.Context
|
||||
Handler ListIdentitiesHandler
|
||||
Handler ListEnvironmentsHandler
|
||||
}
|
||||
|
||||
func (o *ListIdentities) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
func (o *ListEnvironments) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewListIdentitiesParams()
|
||||
var Params = NewListEnvironmentsParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
@ -12,19 +12,19 @@ import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// NewListIdentitiesParams creates a new ListIdentitiesParams object
|
||||
// NewListEnvironmentsParams creates a new ListEnvironmentsParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewListIdentitiesParams() ListIdentitiesParams {
|
||||
func NewListEnvironmentsParams() ListEnvironmentsParams {
|
||||
|
||||
return ListIdentitiesParams{}
|
||||
return ListEnvironmentsParams{}
|
||||
}
|
||||
|
||||
// ListIdentitiesParams contains all the bound params for the list identities operation
|
||||
// ListEnvironmentsParams contains all the bound params for the list environments operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listIdentities
|
||||
type ListIdentitiesParams struct {
|
||||
// swagger:parameters listEnvironments
|
||||
type ListEnvironmentsParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
@ -33,8 +33,8 @@ type ListIdentitiesParams struct {
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewListIdentitiesParams() beforehand.
|
||||
func (o *ListIdentitiesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
// To ensure default values, the struct must have been initialized with NewListEnvironmentsParams() beforehand.
|
||||
func (o *ListEnvironmentsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
@ -0,0 +1,103 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metadata
|
||||
|
||||
// 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/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// ListEnvironmentsOKCode is the HTTP code returned for type ListEnvironmentsOK
|
||||
const ListEnvironmentsOKCode int = 200
|
||||
|
||||
/*ListEnvironmentsOK success
|
||||
|
||||
swagger:response listEnvironmentsOK
|
||||
*/
|
||||
type ListEnvironmentsOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload rest_model_zrok.Environments `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewListEnvironmentsOK creates ListEnvironmentsOK with default headers values
|
||||
func NewListEnvironmentsOK() *ListEnvironmentsOK {
|
||||
|
||||
return &ListEnvironmentsOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the list environments o k response
|
||||
func (o *ListEnvironmentsOK) WithPayload(payload rest_model_zrok.Environments) *ListEnvironmentsOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the list environments o k response
|
||||
func (o *ListEnvironmentsOK) SetPayload(payload rest_model_zrok.Environments) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListEnvironmentsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if payload == nil {
|
||||
// return empty array
|
||||
payload = rest_model_zrok.Environments{}
|
||||
}
|
||||
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
|
||||
// ListEnvironmentsInternalServerErrorCode is the HTTP code returned for type ListEnvironmentsInternalServerError
|
||||
const ListEnvironmentsInternalServerErrorCode int = 500
|
||||
|
||||
/*ListEnvironmentsInternalServerError internal server error
|
||||
|
||||
swagger:response listEnvironmentsInternalServerError
|
||||
*/
|
||||
type ListEnvironmentsInternalServerError struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewListEnvironmentsInternalServerError creates ListEnvironmentsInternalServerError with default headers values
|
||||
func NewListEnvironmentsInternalServerError() *ListEnvironmentsInternalServerError {
|
||||
|
||||
return &ListEnvironmentsInternalServerError{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the list environments internal server error response
|
||||
func (o *ListEnvironmentsInternalServerError) WithPayload(payload rest_model_zrok.ErrorMessage) *ListEnvironmentsInternalServerError {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the list environments internal server error response
|
||||
func (o *ListEnvironmentsInternalServerError) SetPayload(payload rest_model_zrok.ErrorMessage) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListEnvironmentsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(500)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
@ -11,15 +11,15 @@ import (
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// ListIdentitiesURL generates an URL for the list identities operation
|
||||
type ListIdentitiesURL struct {
|
||||
// ListEnvironmentsURL generates an URL for the list environments operation
|
||||
type ListEnvironmentsURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *ListIdentitiesURL) WithBasePath(bp string) *ListIdentitiesURL {
|
||||
func (o *ListEnvironmentsURL) WithBasePath(bp string) *ListEnvironmentsURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
@ -27,15 +27,15 @@ func (o *ListIdentitiesURL) WithBasePath(bp string) *ListIdentitiesURL {
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *ListIdentitiesURL) SetBasePath(bp string) {
|
||||
func (o *ListEnvironmentsURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *ListIdentitiesURL) Build() (*url.URL, error) {
|
||||
func (o *ListEnvironmentsURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/listIdentities"
|
||||
var _path = "/listEnvironments"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@ -47,7 +47,7 @@ func (o *ListIdentitiesURL) Build() (*url.URL, error) {
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *ListIdentitiesURL) Must(u *url.URL, err error) *url.URL {
|
||||
func (o *ListEnvironmentsURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -58,17 +58,17 @@ func (o *ListIdentitiesURL) Must(u *url.URL, err error) *url.URL {
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *ListIdentitiesURL) String() string {
|
||||
func (o *ListEnvironmentsURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *ListIdentitiesURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
func (o *ListEnvironmentsURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on ListIdentitiesURL")
|
||||
return nil, errors.New("scheme is required for a full url on ListEnvironmentsURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on ListIdentitiesURL")
|
||||
return nil, errors.New("host is required for a full url on ListEnvironmentsURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
@ -82,6 +82,6 @@ func (o *ListIdentitiesURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *ListIdentitiesURL) StringFull(scheme, host string) string {
|
||||
func (o *ListEnvironmentsURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metadata
|
||||
|
||||
// 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/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// ListIdentitiesOKCode is the HTTP code returned for type ListIdentitiesOK
|
||||
const ListIdentitiesOKCode int = 200
|
||||
|
||||
/*ListIdentitiesOK success
|
||||
|
||||
swagger:response listIdentitiesOK
|
||||
*/
|
||||
type ListIdentitiesOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload rest_model_zrok.Identities `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewListIdentitiesOK creates ListIdentitiesOK with default headers values
|
||||
func NewListIdentitiesOK() *ListIdentitiesOK {
|
||||
|
||||
return &ListIdentitiesOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the list identities o k response
|
||||
func (o *ListIdentitiesOK) WithPayload(payload rest_model_zrok.Identities) *ListIdentitiesOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the list identities o k response
|
||||
func (o *ListIdentitiesOK) SetPayload(payload rest_model_zrok.Identities) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListIdentitiesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if payload == nil {
|
||||
// return empty array
|
||||
payload = rest_model_zrok.Identities{}
|
||||
}
|
||||
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
|
||||
// ListIdentitiesInternalServerErrorCode is the HTTP code returned for type ListIdentitiesInternalServerError
|
||||
const ListIdentitiesInternalServerErrorCode int = 500
|
||||
|
||||
/*ListIdentitiesInternalServerError internal server error
|
||||
|
||||
swagger:response listIdentitiesInternalServerError
|
||||
*/
|
||||
type ListIdentitiesInternalServerError struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewListIdentitiesInternalServerError creates ListIdentitiesInternalServerError with default headers values
|
||||
func NewListIdentitiesInternalServerError() *ListIdentitiesInternalServerError {
|
||||
|
||||
return &ListIdentitiesInternalServerError{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the list identities internal server error response
|
||||
func (o *ListIdentitiesInternalServerError) WithPayload(payload rest_model_zrok.ErrorMessage) *ListIdentitiesInternalServerError {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the list identities internal server error response
|
||||
func (o *ListIdentitiesInternalServerError) SetPayload(payload rest_model_zrok.ErrorMessage) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListIdentitiesInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(500)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
@ -53,8 +53,8 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
IdentityEnableHandler: identity.EnableHandlerFunc(func(params identity.EnableParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation identity.Enable has not yet been implemented")
|
||||
}),
|
||||
MetadataListIdentitiesHandler: metadata.ListIdentitiesHandlerFunc(func(params metadata.ListIdentitiesParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation metadata.ListIdentities has not yet been implemented")
|
||||
MetadataListEnvironmentsHandler: metadata.ListEnvironmentsHandlerFunc(func(params metadata.ListEnvironmentsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation metadata.ListEnvironments has not yet been implemented")
|
||||
}),
|
||||
IdentityLoginHandler: identity.LoginHandlerFunc(func(params identity.LoginParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation identity.Login has not yet been implemented")
|
||||
@ -122,8 +122,8 @@ type ZrokAPI struct {
|
||||
IdentityCreateAccountHandler identity.CreateAccountHandler
|
||||
// IdentityEnableHandler sets the operation handler for the enable operation
|
||||
IdentityEnableHandler identity.EnableHandler
|
||||
// MetadataListIdentitiesHandler sets the operation handler for the list identities operation
|
||||
MetadataListIdentitiesHandler metadata.ListIdentitiesHandler
|
||||
// MetadataListEnvironmentsHandler sets the operation handler for the list environments operation
|
||||
MetadataListEnvironmentsHandler metadata.ListEnvironmentsHandler
|
||||
// IdentityLoginHandler sets the operation handler for the login operation
|
||||
IdentityLoginHandler identity.LoginHandler
|
||||
// TunnelTunnelHandler sets the operation handler for the tunnel operation
|
||||
@ -219,8 +219,8 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.IdentityEnableHandler == nil {
|
||||
unregistered = append(unregistered, "identity.EnableHandler")
|
||||
}
|
||||
if o.MetadataListIdentitiesHandler == nil {
|
||||
unregistered = append(unregistered, "metadata.ListIdentitiesHandler")
|
||||
if o.MetadataListEnvironmentsHandler == nil {
|
||||
unregistered = append(unregistered, "metadata.ListEnvironmentsHandler")
|
||||
}
|
||||
if o.IdentityLoginHandler == nil {
|
||||
unregistered = append(unregistered, "identity.LoginHandler")
|
||||
@ -344,7 +344,7 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/listIdentities"] = metadata.NewListIdentities(o.context, o.MetadataListIdentitiesHandler)
|
||||
o.handlers["GET"]["/listEnvironments"] = metadata.NewListEnvironments(o.context, o.MetadataListEnvironmentsHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
|
Reference in New Issue
Block a user