mirror of
https://github.com/openziti/zrok.git
synced 2025-08-17 03:11:17 +02:00
identities -> 'environments'
This commit is contained in:
@ -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