mirror of
https://github.com/openziti/zrok.git
synced 2025-08-20 04:28:40 +02:00
initial cut at admin api operations (#537)
This commit is contained in:
@@ -831,6 +831,210 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/organization": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "createOrganization",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "organization created",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "deleteOrganization",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "organization deleted"
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/organization/add": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "addOrganizationMember",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "member added"
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/organization/members": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "listOrganizationMembers",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "list organization members",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"members": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/organization/remove": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "removeOrganizationMember",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "member removed"
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/overview": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -2681,6 +2885,206 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/organization": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "createOrganization",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "organization created",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "deleteOrganization",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "organization deleted"
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/organization/add": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "addOrganizationMember",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "member added"
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/organization/members": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "listOrganizationMembers",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "list organization members",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"members": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/MembersItems0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/organization/remove": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "removeOrganizationMember",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "member removed"
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/overview": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -3064,6 +3468,13 @@ func init() {
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"MembersItems0": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"accessRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
111
rest_server_zrok/operations/admin/add_organization_member.go
Normal file
111
rest_server_zrok/operations/admin/add_organization_member.go
Normal file
@@ -0,0 +1,111 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// AddOrganizationMemberHandlerFunc turns a function with the right signature into a add organization member handler
|
||||
type AddOrganizationMemberHandlerFunc func(AddOrganizationMemberParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn AddOrganizationMemberHandlerFunc) Handle(params AddOrganizationMemberParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// AddOrganizationMemberHandler interface for that can handle valid add organization member params
|
||||
type AddOrganizationMemberHandler interface {
|
||||
Handle(AddOrganizationMemberParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewAddOrganizationMember creates a new http.Handler for the add organization member operation
|
||||
func NewAddOrganizationMember(ctx *middleware.Context, handler AddOrganizationMemberHandler) *AddOrganizationMember {
|
||||
return &AddOrganizationMember{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
AddOrganizationMember swagger:route POST /organization/add admin addOrganizationMember
|
||||
|
||||
AddOrganizationMember add organization member API
|
||||
*/
|
||||
type AddOrganizationMember struct {
|
||||
Context *middleware.Context
|
||||
Handler AddOrganizationMemberHandler
|
||||
}
|
||||
|
||||
func (o *AddOrganizationMember) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewAddOrganizationMemberParams()
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
// AddOrganizationMemberBody add organization member body
|
||||
//
|
||||
// swagger:model AddOrganizationMemberBody
|
||||
type AddOrganizationMemberBody struct {
|
||||
|
||||
// email
|
||||
Email string `json:"email,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this add organization member body
|
||||
func (o *AddOrganizationMemberBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this add organization member body based on context it is used
|
||||
func (o *AddOrganizationMemberBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *AddOrganizationMemberBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *AddOrganizationMemberBody) UnmarshalBinary(b []byte) error {
|
||||
var res AddOrganizationMemberBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewAddOrganizationMemberParams creates a new AddOrganizationMemberParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewAddOrganizationMemberParams() AddOrganizationMemberParams {
|
||||
|
||||
return AddOrganizationMemberParams{}
|
||||
}
|
||||
|
||||
// AddOrganizationMemberParams contains all the bound params for the add organization member operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters addOrganizationMember
|
||||
type AddOrganizationMemberParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body AddOrganizationMemberBody
|
||||
}
|
||||
|
||||
// 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 NewAddOrganizationMemberParams() beforehand.
|
||||
func (o *AddOrganizationMemberParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body AddOrganizationMemberBody
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(r.Context())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AddOrganizationMemberCreatedCode is the HTTP code returned for type AddOrganizationMemberCreated
|
||||
const AddOrganizationMemberCreatedCode int = 201
|
||||
|
||||
/*
|
||||
AddOrganizationMemberCreated member added
|
||||
|
||||
swagger:response addOrganizationMemberCreated
|
||||
*/
|
||||
type AddOrganizationMemberCreated struct {
|
||||
}
|
||||
|
||||
// NewAddOrganizationMemberCreated creates AddOrganizationMemberCreated with default headers values
|
||||
func NewAddOrganizationMemberCreated() *AddOrganizationMemberCreated {
|
||||
|
||||
return &AddOrganizationMemberCreated{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *AddOrganizationMemberCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(201)
|
||||
}
|
||||
|
||||
// AddOrganizationMemberUnauthorizedCode is the HTTP code returned for type AddOrganizationMemberUnauthorized
|
||||
const AddOrganizationMemberUnauthorizedCode int = 401
|
||||
|
||||
/*
|
||||
AddOrganizationMemberUnauthorized unauthorized
|
||||
|
||||
swagger:response addOrganizationMemberUnauthorized
|
||||
*/
|
||||
type AddOrganizationMemberUnauthorized struct {
|
||||
}
|
||||
|
||||
// NewAddOrganizationMemberUnauthorized creates AddOrganizationMemberUnauthorized with default headers values
|
||||
func NewAddOrganizationMemberUnauthorized() *AddOrganizationMemberUnauthorized {
|
||||
|
||||
return &AddOrganizationMemberUnauthorized{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *AddOrganizationMemberUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(401)
|
||||
}
|
||||
|
||||
// AddOrganizationMemberInternalServerErrorCode is the HTTP code returned for type AddOrganizationMemberInternalServerError
|
||||
const AddOrganizationMemberInternalServerErrorCode int = 500
|
||||
|
||||
/*
|
||||
AddOrganizationMemberInternalServerError internal server error
|
||||
|
||||
swagger:response addOrganizationMemberInternalServerError
|
||||
*/
|
||||
type AddOrganizationMemberInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewAddOrganizationMemberInternalServerError creates AddOrganizationMemberInternalServerError with default headers values
|
||||
func NewAddOrganizationMemberInternalServerError() *AddOrganizationMemberInternalServerError {
|
||||
|
||||
return &AddOrganizationMemberInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *AddOrganizationMemberInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(500)
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// AddOrganizationMemberURL generates an URL for the add organization member operation
|
||||
type AddOrganizationMemberURL 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 *AddOrganizationMemberURL) WithBasePath(bp string) *AddOrganizationMemberURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// 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 *AddOrganizationMemberURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *AddOrganizationMemberURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/organization/add"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *AddOrganizationMemberURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *AddOrganizationMemberURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *AddOrganizationMemberURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on AddOrganizationMemberURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on AddOrganizationMemberURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *AddOrganizationMemberURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
148
rest_server_zrok/operations/admin/create_organization.go
Normal file
148
rest_server_zrok/operations/admin/create_organization.go
Normal file
@@ -0,0 +1,148 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// CreateOrganizationHandlerFunc turns a function with the right signature into a create organization handler
|
||||
type CreateOrganizationHandlerFunc func(CreateOrganizationParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn CreateOrganizationHandlerFunc) Handle(params CreateOrganizationParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// CreateOrganizationHandler interface for that can handle valid create organization params
|
||||
type CreateOrganizationHandler interface {
|
||||
Handle(CreateOrganizationParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewCreateOrganization creates a new http.Handler for the create organization operation
|
||||
func NewCreateOrganization(ctx *middleware.Context, handler CreateOrganizationHandler) *CreateOrganization {
|
||||
return &CreateOrganization{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateOrganization swagger:route POST /organization admin createOrganization
|
||||
|
||||
CreateOrganization create organization API
|
||||
*/
|
||||
type CreateOrganization struct {
|
||||
Context *middleware.Context
|
||||
Handler CreateOrganizationHandler
|
||||
}
|
||||
|
||||
func (o *CreateOrganization) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewCreateOrganizationParams()
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
// CreateOrganizationBody create organization body
|
||||
//
|
||||
// swagger:model CreateOrganizationBody
|
||||
type CreateOrganizationBody struct {
|
||||
|
||||
// description
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this create organization body
|
||||
func (o *CreateOrganizationBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this create organization body based on context it is used
|
||||
func (o *CreateOrganizationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *CreateOrganizationBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *CreateOrganizationBody) UnmarshalBinary(b []byte) error {
|
||||
var res CreateOrganizationBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateOrganizationCreatedBody create organization created body
|
||||
//
|
||||
// swagger:model CreateOrganizationCreatedBody
|
||||
type CreateOrganizationCreatedBody struct {
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this create organization created body
|
||||
func (o *CreateOrganizationCreatedBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this create organization created body based on context it is used
|
||||
func (o *CreateOrganizationCreatedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *CreateOrganizationCreatedBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *CreateOrganizationCreatedBody) UnmarshalBinary(b []byte) error {
|
||||
var res CreateOrganizationCreatedBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewCreateOrganizationParams creates a new CreateOrganizationParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewCreateOrganizationParams() CreateOrganizationParams {
|
||||
|
||||
return CreateOrganizationParams{}
|
||||
}
|
||||
|
||||
// CreateOrganizationParams contains all the bound params for the create organization operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters createOrganization
|
||||
type CreateOrganizationParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body CreateOrganizationBody
|
||||
}
|
||||
|
||||
// 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 NewCreateOrganizationParams() beforehand.
|
||||
func (o *CreateOrganizationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body CreateOrganizationBody
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(r.Context())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// CreateOrganizationCreatedCode is the HTTP code returned for type CreateOrganizationCreated
|
||||
const CreateOrganizationCreatedCode int = 201
|
||||
|
||||
/*
|
||||
CreateOrganizationCreated organization created
|
||||
|
||||
swagger:response createOrganizationCreated
|
||||
*/
|
||||
type CreateOrganizationCreated struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *CreateOrganizationCreatedBody `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewCreateOrganizationCreated creates CreateOrganizationCreated with default headers values
|
||||
func NewCreateOrganizationCreated() *CreateOrganizationCreated {
|
||||
|
||||
return &CreateOrganizationCreated{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the create organization created response
|
||||
func (o *CreateOrganizationCreated) WithPayload(payload *CreateOrganizationCreatedBody) *CreateOrganizationCreated {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the create organization created response
|
||||
func (o *CreateOrganizationCreated) SetPayload(payload *CreateOrganizationCreatedBody) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *CreateOrganizationCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(201)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CreateOrganizationUnauthorizedCode is the HTTP code returned for type CreateOrganizationUnauthorized
|
||||
const CreateOrganizationUnauthorizedCode int = 401
|
||||
|
||||
/*
|
||||
CreateOrganizationUnauthorized unauthorized
|
||||
|
||||
swagger:response createOrganizationUnauthorized
|
||||
*/
|
||||
type CreateOrganizationUnauthorized struct {
|
||||
}
|
||||
|
||||
// NewCreateOrganizationUnauthorized creates CreateOrganizationUnauthorized with default headers values
|
||||
func NewCreateOrganizationUnauthorized() *CreateOrganizationUnauthorized {
|
||||
|
||||
return &CreateOrganizationUnauthorized{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *CreateOrganizationUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(401)
|
||||
}
|
||||
|
||||
// CreateOrganizationInternalServerErrorCode is the HTTP code returned for type CreateOrganizationInternalServerError
|
||||
const CreateOrganizationInternalServerErrorCode int = 500
|
||||
|
||||
/*
|
||||
CreateOrganizationInternalServerError internal server error
|
||||
|
||||
swagger:response createOrganizationInternalServerError
|
||||
*/
|
||||
type CreateOrganizationInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewCreateOrganizationInternalServerError creates CreateOrganizationInternalServerError with default headers values
|
||||
func NewCreateOrganizationInternalServerError() *CreateOrganizationInternalServerError {
|
||||
|
||||
return &CreateOrganizationInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *CreateOrganizationInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(500)
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// CreateOrganizationURL generates an URL for the create organization operation
|
||||
type CreateOrganizationURL 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 *CreateOrganizationURL) WithBasePath(bp string) *CreateOrganizationURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// 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 *CreateOrganizationURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *CreateOrganizationURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/organization"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *CreateOrganizationURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *CreateOrganizationURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *CreateOrganizationURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on CreateOrganizationURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on CreateOrganizationURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *CreateOrganizationURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
111
rest_server_zrok/operations/admin/delete_organization.go
Normal file
111
rest_server_zrok/operations/admin/delete_organization.go
Normal file
@@ -0,0 +1,111 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// DeleteOrganizationHandlerFunc turns a function with the right signature into a delete organization handler
|
||||
type DeleteOrganizationHandlerFunc func(DeleteOrganizationParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn DeleteOrganizationHandlerFunc) Handle(params DeleteOrganizationParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// DeleteOrganizationHandler interface for that can handle valid delete organization params
|
||||
type DeleteOrganizationHandler interface {
|
||||
Handle(DeleteOrganizationParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewDeleteOrganization creates a new http.Handler for the delete organization operation
|
||||
func NewDeleteOrganization(ctx *middleware.Context, handler DeleteOrganizationHandler) *DeleteOrganization {
|
||||
return &DeleteOrganization{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteOrganization swagger:route DELETE /organization admin deleteOrganization
|
||||
|
||||
DeleteOrganization delete organization API
|
||||
*/
|
||||
type DeleteOrganization struct {
|
||||
Context *middleware.Context
|
||||
Handler DeleteOrganizationHandler
|
||||
}
|
||||
|
||||
func (o *DeleteOrganization) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewDeleteOrganizationParams()
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
// DeleteOrganizationBody delete organization body
|
||||
//
|
||||
// swagger:model DeleteOrganizationBody
|
||||
type DeleteOrganizationBody struct {
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this delete organization body
|
||||
func (o *DeleteOrganizationBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this delete organization body based on context it is used
|
||||
func (o *DeleteOrganizationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *DeleteOrganizationBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *DeleteOrganizationBody) UnmarshalBinary(b []byte) error {
|
||||
var res DeleteOrganizationBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewDeleteOrganizationParams creates a new DeleteOrganizationParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewDeleteOrganizationParams() DeleteOrganizationParams {
|
||||
|
||||
return DeleteOrganizationParams{}
|
||||
}
|
||||
|
||||
// DeleteOrganizationParams contains all the bound params for the delete organization operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters deleteOrganization
|
||||
type DeleteOrganizationParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body DeleteOrganizationBody
|
||||
}
|
||||
|
||||
// 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 NewDeleteOrganizationParams() beforehand.
|
||||
func (o *DeleteOrganizationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body DeleteOrganizationBody
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(r.Context())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DeleteOrganizationOKCode is the HTTP code returned for type DeleteOrganizationOK
|
||||
const DeleteOrganizationOKCode int = 200
|
||||
|
||||
/*
|
||||
DeleteOrganizationOK organization deleted
|
||||
|
||||
swagger:response deleteOrganizationOK
|
||||
*/
|
||||
type DeleteOrganizationOK struct {
|
||||
}
|
||||
|
||||
// NewDeleteOrganizationOK creates DeleteOrganizationOK with default headers values
|
||||
func NewDeleteOrganizationOK() *DeleteOrganizationOK {
|
||||
|
||||
return &DeleteOrganizationOK{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteOrganizationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(200)
|
||||
}
|
||||
|
||||
// DeleteOrganizationUnauthorizedCode is the HTTP code returned for type DeleteOrganizationUnauthorized
|
||||
const DeleteOrganizationUnauthorizedCode int = 401
|
||||
|
||||
/*
|
||||
DeleteOrganizationUnauthorized unauthorized
|
||||
|
||||
swagger:response deleteOrganizationUnauthorized
|
||||
*/
|
||||
type DeleteOrganizationUnauthorized struct {
|
||||
}
|
||||
|
||||
// NewDeleteOrganizationUnauthorized creates DeleteOrganizationUnauthorized with default headers values
|
||||
func NewDeleteOrganizationUnauthorized() *DeleteOrganizationUnauthorized {
|
||||
|
||||
return &DeleteOrganizationUnauthorized{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteOrganizationUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(401)
|
||||
}
|
||||
|
||||
// DeleteOrganizationInternalServerErrorCode is the HTTP code returned for type DeleteOrganizationInternalServerError
|
||||
const DeleteOrganizationInternalServerErrorCode int = 500
|
||||
|
||||
/*
|
||||
DeleteOrganizationInternalServerError internal server error
|
||||
|
||||
swagger:response deleteOrganizationInternalServerError
|
||||
*/
|
||||
type DeleteOrganizationInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewDeleteOrganizationInternalServerError creates DeleteOrganizationInternalServerError with default headers values
|
||||
func NewDeleteOrganizationInternalServerError() *DeleteOrganizationInternalServerError {
|
||||
|
||||
return &DeleteOrganizationInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteOrganizationInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(500)
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// DeleteOrganizationURL generates an URL for the delete organization operation
|
||||
type DeleteOrganizationURL 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 *DeleteOrganizationURL) WithBasePath(bp string) *DeleteOrganizationURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// 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 *DeleteOrganizationURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *DeleteOrganizationURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/organization"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *DeleteOrganizationURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *DeleteOrganizationURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *DeleteOrganizationURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on DeleteOrganizationURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on DeleteOrganizationURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *DeleteOrganizationURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
256
rest_server_zrok/operations/admin/list_organization_members.go
Normal file
256
rest_server_zrok/operations/admin/list_organization_members.go
Normal file
@@ -0,0 +1,256 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// ListOrganizationMembersHandlerFunc turns a function with the right signature into a list organization members handler
|
||||
type ListOrganizationMembersHandlerFunc func(ListOrganizationMembersParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn ListOrganizationMembersHandlerFunc) Handle(params ListOrganizationMembersParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// ListOrganizationMembersHandler interface for that can handle valid list organization members params
|
||||
type ListOrganizationMembersHandler interface {
|
||||
Handle(ListOrganizationMembersParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewListOrganizationMembers creates a new http.Handler for the list organization members operation
|
||||
func NewListOrganizationMembers(ctx *middleware.Context, handler ListOrganizationMembersHandler) *ListOrganizationMembers {
|
||||
return &ListOrganizationMembers{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrganizationMembers swagger:route POST /organization/members admin listOrganizationMembers
|
||||
|
||||
ListOrganizationMembers list organization members API
|
||||
*/
|
||||
type ListOrganizationMembers struct {
|
||||
Context *middleware.Context
|
||||
Handler ListOrganizationMembersHandler
|
||||
}
|
||||
|
||||
func (o *ListOrganizationMembers) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewListOrganizationMembersParams()
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
// ListOrganizationMembersBody list organization members body
|
||||
//
|
||||
// swagger:model ListOrganizationMembersBody
|
||||
type ListOrganizationMembersBody struct {
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this list organization members body
|
||||
func (o *ListOrganizationMembersBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this list organization members body based on context it is used
|
||||
func (o *ListOrganizationMembersBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *ListOrganizationMembersBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *ListOrganizationMembersBody) UnmarshalBinary(b []byte) error {
|
||||
var res ListOrganizationMembersBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListOrganizationMembersOKBody list organization members o k body
|
||||
//
|
||||
// swagger:model ListOrganizationMembersOKBody
|
||||
type ListOrganizationMembersOKBody struct {
|
||||
|
||||
// members
|
||||
Members []*ListOrganizationMembersOKBodyMembersItems0 `json:"members"`
|
||||
}
|
||||
|
||||
// Validate validates this list organization members o k body
|
||||
func (o *ListOrganizationMembersOKBody) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := o.validateMembers(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *ListOrganizationMembersOKBody) validateMembers(formats strfmt.Registry) error {
|
||||
if swag.IsZero(o.Members) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(o.Members); i++ {
|
||||
if swag.IsZero(o.Members[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if o.Members[i] != nil {
|
||||
if err := o.Members[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("listOrganizationMembersOK" + "." + "members" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("listOrganizationMembersOK" + "." + "members" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this list organization members o k body based on the context it is used
|
||||
func (o *ListOrganizationMembersOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := o.contextValidateMembers(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *ListOrganizationMembersOKBody) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(o.Members); i++ {
|
||||
|
||||
if o.Members[i] != nil {
|
||||
|
||||
if swag.IsZero(o.Members[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := o.Members[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("listOrganizationMembersOK" + "." + "members" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("listOrganizationMembersOK" + "." + "members" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *ListOrganizationMembersOKBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *ListOrganizationMembersOKBody) UnmarshalBinary(b []byte) error {
|
||||
var res ListOrganizationMembersOKBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListOrganizationMembersOKBodyMembersItems0 list organization members o k body members items0
|
||||
//
|
||||
// swagger:model ListOrganizationMembersOKBodyMembersItems0
|
||||
type ListOrganizationMembersOKBodyMembersItems0 struct {
|
||||
|
||||
// email
|
||||
Email string `json:"email,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this list organization members o k body members items0
|
||||
func (o *ListOrganizationMembersOKBodyMembersItems0) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this list organization members o k body members items0 based on context it is used
|
||||
func (o *ListOrganizationMembersOKBodyMembersItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *ListOrganizationMembersOKBodyMembersItems0) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *ListOrganizationMembersOKBodyMembersItems0) UnmarshalBinary(b []byte) error {
|
||||
var res ListOrganizationMembersOKBodyMembersItems0
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewListOrganizationMembersParams creates a new ListOrganizationMembersParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewListOrganizationMembersParams() ListOrganizationMembersParams {
|
||||
|
||||
return ListOrganizationMembersParams{}
|
||||
}
|
||||
|
||||
// ListOrganizationMembersParams contains all the bound params for the list organization members operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listOrganizationMembers
|
||||
type ListOrganizationMembersParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body ListOrganizationMembersBody
|
||||
}
|
||||
|
||||
// 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 NewListOrganizationMembersParams() beforehand.
|
||||
func (o *ListOrganizationMembersParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body ListOrganizationMembersBody
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(r.Context())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// ListOrganizationMembersOKCode is the HTTP code returned for type ListOrganizationMembersOK
|
||||
const ListOrganizationMembersOKCode int = 200
|
||||
|
||||
/*
|
||||
ListOrganizationMembersOK list organization members
|
||||
|
||||
swagger:response listOrganizationMembersOK
|
||||
*/
|
||||
type ListOrganizationMembersOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *ListOrganizationMembersOKBody `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewListOrganizationMembersOK creates ListOrganizationMembersOK with default headers values
|
||||
func NewListOrganizationMembersOK() *ListOrganizationMembersOK {
|
||||
|
||||
return &ListOrganizationMembersOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the list organization members o k response
|
||||
func (o *ListOrganizationMembersOK) WithPayload(payload *ListOrganizationMembersOKBody) *ListOrganizationMembersOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the list organization members o k response
|
||||
func (o *ListOrganizationMembersOK) SetPayload(payload *ListOrganizationMembersOKBody) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListOrganizationMembersOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ListOrganizationMembersUnauthorizedCode is the HTTP code returned for type ListOrganizationMembersUnauthorized
|
||||
const ListOrganizationMembersUnauthorizedCode int = 401
|
||||
|
||||
/*
|
||||
ListOrganizationMembersUnauthorized unauthorized
|
||||
|
||||
swagger:response listOrganizationMembersUnauthorized
|
||||
*/
|
||||
type ListOrganizationMembersUnauthorized struct {
|
||||
}
|
||||
|
||||
// NewListOrganizationMembersUnauthorized creates ListOrganizationMembersUnauthorized with default headers values
|
||||
func NewListOrganizationMembersUnauthorized() *ListOrganizationMembersUnauthorized {
|
||||
|
||||
return &ListOrganizationMembersUnauthorized{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListOrganizationMembersUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(401)
|
||||
}
|
||||
|
||||
// ListOrganizationMembersInternalServerErrorCode is the HTTP code returned for type ListOrganizationMembersInternalServerError
|
||||
const ListOrganizationMembersInternalServerErrorCode int = 500
|
||||
|
||||
/*
|
||||
ListOrganizationMembersInternalServerError internal server error
|
||||
|
||||
swagger:response listOrganizationMembersInternalServerError
|
||||
*/
|
||||
type ListOrganizationMembersInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewListOrganizationMembersInternalServerError creates ListOrganizationMembersInternalServerError with default headers values
|
||||
func NewListOrganizationMembersInternalServerError() *ListOrganizationMembersInternalServerError {
|
||||
|
||||
return &ListOrganizationMembersInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListOrganizationMembersInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(500)
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// ListOrganizationMembersURL generates an URL for the list organization members operation
|
||||
type ListOrganizationMembersURL 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 *ListOrganizationMembersURL) WithBasePath(bp string) *ListOrganizationMembersURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// 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 *ListOrganizationMembersURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *ListOrganizationMembersURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/organization/members"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *ListOrganizationMembersURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *ListOrganizationMembersURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *ListOrganizationMembersURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on ListOrganizationMembersURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on ListOrganizationMembersURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *ListOrganizationMembersURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
111
rest_server_zrok/operations/admin/remove_organization_member.go
Normal file
111
rest_server_zrok/operations/admin/remove_organization_member.go
Normal file
@@ -0,0 +1,111 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// RemoveOrganizationMemberHandlerFunc turns a function with the right signature into a remove organization member handler
|
||||
type RemoveOrganizationMemberHandlerFunc func(RemoveOrganizationMemberParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn RemoveOrganizationMemberHandlerFunc) Handle(params RemoveOrganizationMemberParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// RemoveOrganizationMemberHandler interface for that can handle valid remove organization member params
|
||||
type RemoveOrganizationMemberHandler interface {
|
||||
Handle(RemoveOrganizationMemberParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewRemoveOrganizationMember creates a new http.Handler for the remove organization member operation
|
||||
func NewRemoveOrganizationMember(ctx *middleware.Context, handler RemoveOrganizationMemberHandler) *RemoveOrganizationMember {
|
||||
return &RemoveOrganizationMember{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
RemoveOrganizationMember swagger:route POST /organization/remove admin removeOrganizationMember
|
||||
|
||||
RemoveOrganizationMember remove organization member API
|
||||
*/
|
||||
type RemoveOrganizationMember struct {
|
||||
Context *middleware.Context
|
||||
Handler RemoveOrganizationMemberHandler
|
||||
}
|
||||
|
||||
func (o *RemoveOrganizationMember) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewRemoveOrganizationMemberParams()
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
// RemoveOrganizationMemberBody remove organization member body
|
||||
//
|
||||
// swagger:model RemoveOrganizationMemberBody
|
||||
type RemoveOrganizationMemberBody struct {
|
||||
|
||||
// email
|
||||
Email string `json:"email,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this remove organization member body
|
||||
func (o *RemoveOrganizationMemberBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this remove organization member body based on context it is used
|
||||
func (o *RemoveOrganizationMemberBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *RemoveOrganizationMemberBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *RemoveOrganizationMemberBody) UnmarshalBinary(b []byte) error {
|
||||
var res RemoveOrganizationMemberBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewRemoveOrganizationMemberParams creates a new RemoveOrganizationMemberParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewRemoveOrganizationMemberParams() RemoveOrganizationMemberParams {
|
||||
|
||||
return RemoveOrganizationMemberParams{}
|
||||
}
|
||||
|
||||
// RemoveOrganizationMemberParams contains all the bound params for the remove organization member operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters removeOrganizationMember
|
||||
type RemoveOrganizationMemberParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body RemoveOrganizationMemberBody
|
||||
}
|
||||
|
||||
// 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 NewRemoveOrganizationMemberParams() beforehand.
|
||||
func (o *RemoveOrganizationMemberParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body RemoveOrganizationMemberBody
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(r.Context())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// RemoveOrganizationMemberOKCode is the HTTP code returned for type RemoveOrganizationMemberOK
|
||||
const RemoveOrganizationMemberOKCode int = 200
|
||||
|
||||
/*
|
||||
RemoveOrganizationMemberOK member removed
|
||||
|
||||
swagger:response removeOrganizationMemberOK
|
||||
*/
|
||||
type RemoveOrganizationMemberOK struct {
|
||||
}
|
||||
|
||||
// NewRemoveOrganizationMemberOK creates RemoveOrganizationMemberOK with default headers values
|
||||
func NewRemoveOrganizationMemberOK() *RemoveOrganizationMemberOK {
|
||||
|
||||
return &RemoveOrganizationMemberOK{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *RemoveOrganizationMemberOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(200)
|
||||
}
|
||||
|
||||
// RemoveOrganizationMemberUnauthorizedCode is the HTTP code returned for type RemoveOrganizationMemberUnauthorized
|
||||
const RemoveOrganizationMemberUnauthorizedCode int = 401
|
||||
|
||||
/*
|
||||
RemoveOrganizationMemberUnauthorized unauthorized
|
||||
|
||||
swagger:response removeOrganizationMemberUnauthorized
|
||||
*/
|
||||
type RemoveOrganizationMemberUnauthorized struct {
|
||||
}
|
||||
|
||||
// NewRemoveOrganizationMemberUnauthorized creates RemoveOrganizationMemberUnauthorized with default headers values
|
||||
func NewRemoveOrganizationMemberUnauthorized() *RemoveOrganizationMemberUnauthorized {
|
||||
|
||||
return &RemoveOrganizationMemberUnauthorized{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *RemoveOrganizationMemberUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(401)
|
||||
}
|
||||
|
||||
// RemoveOrganizationMemberInternalServerErrorCode is the HTTP code returned for type RemoveOrganizationMemberInternalServerError
|
||||
const RemoveOrganizationMemberInternalServerErrorCode int = 500
|
||||
|
||||
/*
|
||||
RemoveOrganizationMemberInternalServerError internal server error
|
||||
|
||||
swagger:response removeOrganizationMemberInternalServerError
|
||||
*/
|
||||
type RemoveOrganizationMemberInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewRemoveOrganizationMemberInternalServerError creates RemoveOrganizationMemberInternalServerError with default headers values
|
||||
func NewRemoveOrganizationMemberInternalServerError() *RemoveOrganizationMemberInternalServerError {
|
||||
|
||||
return &RemoveOrganizationMemberInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *RemoveOrganizationMemberInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(500)
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// RemoveOrganizationMemberURL generates an URL for the remove organization member operation
|
||||
type RemoveOrganizationMemberURL 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 *RemoveOrganizationMemberURL) WithBasePath(bp string) *RemoveOrganizationMemberURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// 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 *RemoveOrganizationMemberURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *RemoveOrganizationMemberURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/organization/remove"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *RemoveOrganizationMemberURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *RemoveOrganizationMemberURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *RemoveOrganizationMemberURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on RemoveOrganizationMemberURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on RemoveOrganizationMemberURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *RemoveOrganizationMemberURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
@@ -52,6 +52,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
ShareAccessHandler: share.AccessHandlerFunc(func(params share.AccessParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation share.Access has not yet been implemented")
|
||||
}),
|
||||
AdminAddOrganizationMemberHandler: admin.AddOrganizationMemberHandlerFunc(func(params admin.AddOrganizationMemberParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin.AddOrganizationMember has not yet been implemented")
|
||||
}),
|
||||
AccountChangePasswordHandler: account.ChangePasswordHandlerFunc(func(params account.ChangePasswordParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.ChangePassword has not yet been implemented")
|
||||
}),
|
||||
@@ -67,9 +70,15 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
AdminCreateIdentityHandler: admin.CreateIdentityHandlerFunc(func(params admin.CreateIdentityParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin.CreateIdentity has not yet been implemented")
|
||||
}),
|
||||
AdminCreateOrganizationHandler: admin.CreateOrganizationHandlerFunc(func(params admin.CreateOrganizationParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin.CreateOrganization has not yet been implemented")
|
||||
}),
|
||||
AdminDeleteFrontendHandler: admin.DeleteFrontendHandlerFunc(func(params admin.DeleteFrontendParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin.DeleteFrontend has not yet been implemented")
|
||||
}),
|
||||
AdminDeleteOrganizationHandler: admin.DeleteOrganizationHandlerFunc(func(params admin.DeleteOrganizationParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin.DeleteOrganization has not yet been implemented")
|
||||
}),
|
||||
EnvironmentDisableHandler: environment.DisableHandlerFunc(func(params environment.DisableParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation environment.Disable has not yet been implemented")
|
||||
}),
|
||||
@@ -109,6 +118,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
AdminListFrontendsHandler: admin.ListFrontendsHandlerFunc(func(params admin.ListFrontendsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin.ListFrontends has not yet been implemented")
|
||||
}),
|
||||
AdminListOrganizationMembersHandler: admin.ListOrganizationMembersHandlerFunc(func(params admin.ListOrganizationMembersParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin.ListOrganizationMembers has not yet been implemented")
|
||||
}),
|
||||
AccountLoginHandler: account.LoginHandlerFunc(func(params account.LoginParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.Login has not yet been implemented")
|
||||
}),
|
||||
@@ -121,6 +133,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
AccountRegisterHandler: account.RegisterHandlerFunc(func(params account.RegisterParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.Register has not yet been implemented")
|
||||
}),
|
||||
AdminRemoveOrganizationMemberHandler: admin.RemoveOrganizationMemberHandlerFunc(func(params admin.RemoveOrganizationMemberParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin.RemoveOrganizationMember has not yet been implemented")
|
||||
}),
|
||||
AccountResetPasswordHandler: account.ResetPasswordHandlerFunc(func(params account.ResetPasswordParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.ResetPassword has not yet been implemented")
|
||||
}),
|
||||
@@ -200,6 +215,8 @@ type ZrokAPI struct {
|
||||
|
||||
// ShareAccessHandler sets the operation handler for the access operation
|
||||
ShareAccessHandler share.AccessHandler
|
||||
// AdminAddOrganizationMemberHandler sets the operation handler for the add organization member operation
|
||||
AdminAddOrganizationMemberHandler admin.AddOrganizationMemberHandler
|
||||
// AccountChangePasswordHandler sets the operation handler for the change password operation
|
||||
AccountChangePasswordHandler account.ChangePasswordHandler
|
||||
// MetadataConfigurationHandler sets the operation handler for the configuration operation
|
||||
@@ -210,8 +227,12 @@ type ZrokAPI struct {
|
||||
AdminCreateFrontendHandler admin.CreateFrontendHandler
|
||||
// AdminCreateIdentityHandler sets the operation handler for the create identity operation
|
||||
AdminCreateIdentityHandler admin.CreateIdentityHandler
|
||||
// AdminCreateOrganizationHandler sets the operation handler for the create organization operation
|
||||
AdminCreateOrganizationHandler admin.CreateOrganizationHandler
|
||||
// AdminDeleteFrontendHandler sets the operation handler for the delete frontend operation
|
||||
AdminDeleteFrontendHandler admin.DeleteFrontendHandler
|
||||
// AdminDeleteOrganizationHandler sets the operation handler for the delete organization operation
|
||||
AdminDeleteOrganizationHandler admin.DeleteOrganizationHandler
|
||||
// EnvironmentDisableHandler sets the operation handler for the disable operation
|
||||
EnvironmentDisableHandler environment.DisableHandler
|
||||
// EnvironmentEnableHandler sets the operation handler for the enable operation
|
||||
@@ -238,6 +259,8 @@ type ZrokAPI struct {
|
||||
AdminInviteTokenGenerateHandler admin.InviteTokenGenerateHandler
|
||||
// AdminListFrontendsHandler sets the operation handler for the list frontends operation
|
||||
AdminListFrontendsHandler admin.ListFrontendsHandler
|
||||
// AdminListOrganizationMembersHandler sets the operation handler for the list organization members operation
|
||||
AdminListOrganizationMembersHandler admin.ListOrganizationMembersHandler
|
||||
// AccountLoginHandler sets the operation handler for the login operation
|
||||
AccountLoginHandler account.LoginHandler
|
||||
// MetadataOverviewHandler sets the operation handler for the overview operation
|
||||
@@ -246,6 +269,8 @@ type ZrokAPI struct {
|
||||
AccountRegenerateTokenHandler account.RegenerateTokenHandler
|
||||
// AccountRegisterHandler sets the operation handler for the register operation
|
||||
AccountRegisterHandler account.RegisterHandler
|
||||
// AdminRemoveOrganizationMemberHandler sets the operation handler for the remove organization member operation
|
||||
AdminRemoveOrganizationMemberHandler admin.RemoveOrganizationMemberHandler
|
||||
// AccountResetPasswordHandler sets the operation handler for the reset password operation
|
||||
AccountResetPasswordHandler account.ResetPasswordHandler
|
||||
// AccountResetPasswordRequestHandler sets the operation handler for the reset password request operation
|
||||
@@ -348,6 +373,9 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.ShareAccessHandler == nil {
|
||||
unregistered = append(unregistered, "share.AccessHandler")
|
||||
}
|
||||
if o.AdminAddOrganizationMemberHandler == nil {
|
||||
unregistered = append(unregistered, "admin.AddOrganizationMemberHandler")
|
||||
}
|
||||
if o.AccountChangePasswordHandler == nil {
|
||||
unregistered = append(unregistered, "account.ChangePasswordHandler")
|
||||
}
|
||||
@@ -363,9 +391,15 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.AdminCreateIdentityHandler == nil {
|
||||
unregistered = append(unregistered, "admin.CreateIdentityHandler")
|
||||
}
|
||||
if o.AdminCreateOrganizationHandler == nil {
|
||||
unregistered = append(unregistered, "admin.CreateOrganizationHandler")
|
||||
}
|
||||
if o.AdminDeleteFrontendHandler == nil {
|
||||
unregistered = append(unregistered, "admin.DeleteFrontendHandler")
|
||||
}
|
||||
if o.AdminDeleteOrganizationHandler == nil {
|
||||
unregistered = append(unregistered, "admin.DeleteOrganizationHandler")
|
||||
}
|
||||
if o.EnvironmentDisableHandler == nil {
|
||||
unregistered = append(unregistered, "environment.DisableHandler")
|
||||
}
|
||||
@@ -405,6 +439,9 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.AdminListFrontendsHandler == nil {
|
||||
unregistered = append(unregistered, "admin.ListFrontendsHandler")
|
||||
}
|
||||
if o.AdminListOrganizationMembersHandler == nil {
|
||||
unregistered = append(unregistered, "admin.ListOrganizationMembersHandler")
|
||||
}
|
||||
if o.AccountLoginHandler == nil {
|
||||
unregistered = append(unregistered, "account.LoginHandler")
|
||||
}
|
||||
@@ -417,6 +454,9 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.AccountRegisterHandler == nil {
|
||||
unregistered = append(unregistered, "account.RegisterHandler")
|
||||
}
|
||||
if o.AdminRemoveOrganizationMemberHandler == nil {
|
||||
unregistered = append(unregistered, "admin.RemoveOrganizationMemberHandler")
|
||||
}
|
||||
if o.AccountResetPasswordHandler == nil {
|
||||
unregistered = append(unregistered, "account.ResetPasswordHandler")
|
||||
}
|
||||
@@ -550,6 +590,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/organization/add"] = admin.NewAddOrganizationMember(o.context, o.AdminAddOrganizationMemberHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/changePassword"] = account.NewChangePassword(o.context, o.AccountChangePasswordHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
@@ -567,10 +611,18 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/identity"] = admin.NewCreateIdentity(o.context, o.AdminCreateIdentityHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/organization"] = admin.NewCreateOrganization(o.context, o.AdminCreateOrganizationHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/frontend"] = admin.NewDeleteFrontend(o.context, o.AdminDeleteFrontendHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/organization"] = admin.NewDeleteOrganization(o.context, o.AdminDeleteOrganizationHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -626,6 +678,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/organization/members"] = admin.NewListOrganizationMembers(o.context, o.AdminListOrganizationMembersHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/login"] = account.NewLogin(o.context, o.AccountLoginHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
@@ -642,6 +698,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/organization/remove"] = admin.NewRemoveOrganizationMember(o.context, o.AdminRemoveOrganizationMemberHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/resetPassword"] = account.NewResetPassword(o.context, o.AccountResetPasswordHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
|
Reference in New Issue
Block a user