mirror of
https://github.com/openziti/zrok.git
synced 2025-02-22 05:01:01 +01:00
remove /listEnvironments endpoint
This commit is contained in:
parent
36b08f1e00
commit
2c36a461eb
@ -25,7 +25,6 @@ func Run(cfg *Config) error {
|
||||
api.IdentityCreateAccountHandler = identity.CreateAccountHandlerFunc(createAccountHandler)
|
||||
api.IdentityEnableHandler = identity.EnableHandlerFunc(enableHandler)
|
||||
api.IdentityLoginHandler = identity.LoginHandlerFunc(loginHandler)
|
||||
api.MetadataListEnvironmentsHandler = metadata.ListEnvironmentsHandlerFunc(listEnvironmentsHandler)
|
||||
api.MetadataOverviewHandler = metadata.OverviewHandlerFunc(overviewHandler)
|
||||
api.MetadataVersionHandler = metadata.VersionHandlerFunc(versionHandler)
|
||||
api.TunnelTunnelHandler = tunnel.TunnelHandlerFunc(tunnelHandler)
|
||||
|
@ -1,35 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/metadata"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func listEnvironmentsHandler(_ metadata.ListEnvironmentsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
tx, err := str.Begin()
|
||||
if err != nil {
|
||||
logrus.Errorf("error starting transaction: %v", err)
|
||||
return metadata.NewListEnvironmentsInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
||||
}
|
||||
defer func() { _ = tx.Rollback() }()
|
||||
envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx)
|
||||
if err != nil {
|
||||
logrus.Errorf("error finding environments for '%v': %v", principal.Username, err)
|
||||
return metadata.NewListEnvironmentsInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
||||
}
|
||||
var out rest_model_zrok.Environments
|
||||
for _, env := range envs {
|
||||
out = append(out, &rest_model_zrok.Environment{
|
||||
Description: env.Description,
|
||||
Host: env.Host,
|
||||
Address: env.Address,
|
||||
Active: env.Active,
|
||||
CreatedAt: env.CreatedAt.String(),
|
||||
UpdatedAt: env.UpdatedAt.String(),
|
||||
ZitiIdentityID: env.ZitiIdentityId,
|
||||
})
|
||||
}
|
||||
return metadata.NewListEnvironmentsOK().WithPayload(out)
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metadata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListEnvironmentsParams creates a new ListEnvironmentsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListEnvironmentsParams() *ListEnvironmentsParams {
|
||||
return &ListEnvironmentsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnvironmentsParamsWithTimeout creates a new ListEnvironmentsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListEnvironmentsParamsWithTimeout(timeout time.Duration) *ListEnvironmentsParams {
|
||||
return &ListEnvironmentsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnvironmentsParamsWithContext creates a new ListEnvironmentsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListEnvironmentsParamsWithContext(ctx context.Context) *ListEnvironmentsParams {
|
||||
return &ListEnvironmentsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnvironmentsParamsWithHTTPClient creates a new ListEnvironmentsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListEnvironmentsParamsWithHTTPClient(client *http.Client) *ListEnvironmentsParams {
|
||||
return &ListEnvironmentsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/* ListEnvironmentsParams contains all the parameters to send to the API endpoint
|
||||
for the list environments operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListEnvironmentsParams struct {
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list environments params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListEnvironmentsParams) WithDefaults() *ListEnvironmentsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list environments params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListEnvironmentsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list environments params
|
||||
func (o *ListEnvironmentsParams) WithTimeout(timeout time.Duration) *ListEnvironmentsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list environments params
|
||||
func (o *ListEnvironmentsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list environments params
|
||||
func (o *ListEnvironmentsParams) WithContext(ctx context.Context) *ListEnvironmentsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list environments params
|
||||
func (o *ListEnvironmentsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list environments params
|
||||
func (o *ListEnvironmentsParams) WithHTTPClient(client *http.Client) *ListEnvironmentsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list environments params
|
||||
func (o *ListEnvironmentsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListEnvironmentsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metadata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// ListEnvironmentsReader is a Reader for the ListEnvironments structure.
|
||||
type ListEnvironmentsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListEnvironmentsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListEnvironmentsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 500:
|
||||
result := NewListEnvironmentsInternalServerError()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewListEnvironmentsOK creates a ListEnvironmentsOK with default headers values
|
||||
func NewListEnvironmentsOK() *ListEnvironmentsOK {
|
||||
return &ListEnvironmentsOK{}
|
||||
}
|
||||
|
||||
/* ListEnvironmentsOK describes a response with status code 200, with default header values.
|
||||
|
||||
success
|
||||
*/
|
||||
type ListEnvironmentsOK struct {
|
||||
Payload rest_model_zrok.Environments
|
||||
}
|
||||
|
||||
func (o *ListEnvironmentsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /listEnvironments][%d] listEnvironmentsOK %+v", 200, o.Payload)
|
||||
}
|
||||
func (o *ListEnvironmentsOK) GetPayload() rest_model_zrok.Environments {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListEnvironmentsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListEnvironmentsInternalServerError creates a ListEnvironmentsInternalServerError with default headers values
|
||||
func NewListEnvironmentsInternalServerError() *ListEnvironmentsInternalServerError {
|
||||
return &ListEnvironmentsInternalServerError{}
|
||||
}
|
||||
|
||||
/* ListEnvironmentsInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
internal server error
|
||||
*/
|
||||
type ListEnvironmentsInternalServerError struct {
|
||||
Payload rest_model_zrok.ErrorMessage
|
||||
}
|
||||
|
||||
func (o *ListEnvironmentsInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[GET /listEnvironments][%d] listEnvironmentsInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
func (o *ListEnvironmentsInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListEnvironmentsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -30,8 +30,6 @@ type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
ListEnvironments(params *ListEnvironmentsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnvironmentsOK, error)
|
||||
|
||||
Overview(params *OverviewParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OverviewOK, error)
|
||||
|
||||
Version(params *VersionParams, opts ...ClientOption) (*VersionOK, error)
|
||||
@ -39,45 +37,6 @@ type ClientService interface {
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
ListEnvironments list environments API
|
||||
*/
|
||||
func (a *Client) ListEnvironments(params *ListEnvironmentsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnvironmentsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListEnvironmentsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "listEnvironments",
|
||||
Method: "GET",
|
||||
PathPattern: "/listEnvironments",
|
||||
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListEnvironmentsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListEnvironmentsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for listEnvironments: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
Overview overview API
|
||||
*/
|
||||
|
@ -114,33 +114,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/listEnvironments": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"metadata"
|
||||
],
|
||||
"operationId": "listEnvironments",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "success",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/environments"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/errorMessage"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/login": {
|
||||
"post": {
|
||||
"tags": [
|
||||
@ -581,33 +554,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/listEnvironments": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"metadata"
|
||||
],
|
||||
"operationId": "listEnvironments",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "success",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/environments"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/errorMessage"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/login": {
|
||||
"post": {
|
||||
"tags": [
|
||||
|
@ -1,71 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metadata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// ListEnvironmentsHandlerFunc turns a function with the right signature into a list environments handler
|
||||
type ListEnvironmentsHandlerFunc func(ListEnvironmentsParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn ListEnvironmentsHandlerFunc) Handle(params ListEnvironmentsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// ListEnvironmentsHandler interface for that can handle valid list environments params
|
||||
type ListEnvironmentsHandler interface {
|
||||
Handle(ListEnvironmentsParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewListEnvironments creates a new http.Handler for the list environments operation
|
||||
func NewListEnvironments(ctx *middleware.Context, handler ListEnvironmentsHandler) *ListEnvironments {
|
||||
return &ListEnvironments{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* ListEnvironments swagger:route GET /listEnvironments metadata listEnvironments
|
||||
|
||||
ListEnvironments list environments API
|
||||
|
||||
*/
|
||||
type ListEnvironments struct {
|
||||
Context *middleware.Context
|
||||
Handler ListEnvironmentsHandler
|
||||
}
|
||||
|
||||
func (o *ListEnvironments) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewListEnvironmentsParams()
|
||||
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)
|
||||
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metadata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// NewListEnvironmentsParams creates a new ListEnvironmentsParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewListEnvironmentsParams() ListEnvironmentsParams {
|
||||
|
||||
return ListEnvironmentsParams{}
|
||||
}
|
||||
|
||||
// ListEnvironmentsParams contains all the bound params for the list environments operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listEnvironments
|
||||
type ListEnvironmentsParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
}
|
||||
|
||||
// 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 NewListEnvironmentsParams() beforehand.
|
||||
func (o *ListEnvironmentsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metadata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// ListEnvironmentsOKCode is the HTTP code returned for type ListEnvironmentsOK
|
||||
const ListEnvironmentsOKCode int = 200
|
||||
|
||||
/*ListEnvironmentsOK success
|
||||
|
||||
swagger:response listEnvironmentsOK
|
||||
*/
|
||||
type ListEnvironmentsOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload rest_model_zrok.Environments `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewListEnvironmentsOK creates ListEnvironmentsOK with default headers values
|
||||
func NewListEnvironmentsOK() *ListEnvironmentsOK {
|
||||
|
||||
return &ListEnvironmentsOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the list environments o k response
|
||||
func (o *ListEnvironmentsOK) WithPayload(payload rest_model_zrok.Environments) *ListEnvironmentsOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the list environments o k response
|
||||
func (o *ListEnvironmentsOK) SetPayload(payload rest_model_zrok.Environments) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListEnvironmentsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if payload == nil {
|
||||
// return empty array
|
||||
payload = rest_model_zrok.Environments{}
|
||||
}
|
||||
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
|
||||
// ListEnvironmentsInternalServerErrorCode is the HTTP code returned for type ListEnvironmentsInternalServerError
|
||||
const ListEnvironmentsInternalServerErrorCode int = 500
|
||||
|
||||
/*ListEnvironmentsInternalServerError internal server error
|
||||
|
||||
swagger:response listEnvironmentsInternalServerError
|
||||
*/
|
||||
type ListEnvironmentsInternalServerError struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewListEnvironmentsInternalServerError creates ListEnvironmentsInternalServerError with default headers values
|
||||
func NewListEnvironmentsInternalServerError() *ListEnvironmentsInternalServerError {
|
||||
|
||||
return &ListEnvironmentsInternalServerError{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the list environments internal server error response
|
||||
func (o *ListEnvironmentsInternalServerError) WithPayload(payload rest_model_zrok.ErrorMessage) *ListEnvironmentsInternalServerError {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the list environments internal server error response
|
||||
func (o *ListEnvironmentsInternalServerError) SetPayload(payload rest_model_zrok.ErrorMessage) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListEnvironmentsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(500)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package metadata
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// ListEnvironmentsURL generates an URL for the list environments operation
|
||||
type ListEnvironmentsURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *ListEnvironmentsURL) WithBasePath(bp string) *ListEnvironmentsURL {
|
||||
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 *ListEnvironmentsURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *ListEnvironmentsURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/listEnvironments"
|
||||
|
||||
_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 *ListEnvironmentsURL) 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 *ListEnvironmentsURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *ListEnvironmentsURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on ListEnvironmentsURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on ListEnvironmentsURL")
|
||||
}
|
||||
|
||||
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 *ListEnvironmentsURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
@ -53,9 +53,6 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
IdentityEnableHandler: identity.EnableHandlerFunc(func(params identity.EnableParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation identity.Enable has not yet been implemented")
|
||||
}),
|
||||
MetadataListEnvironmentsHandler: metadata.ListEnvironmentsHandlerFunc(func(params metadata.ListEnvironmentsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation metadata.ListEnvironments has not yet been implemented")
|
||||
}),
|
||||
IdentityLoginHandler: identity.LoginHandlerFunc(func(params identity.LoginParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation identity.Login has not yet been implemented")
|
||||
}),
|
||||
@ -125,8 +122,6 @@ type ZrokAPI struct {
|
||||
IdentityCreateAccountHandler identity.CreateAccountHandler
|
||||
// IdentityEnableHandler sets the operation handler for the enable operation
|
||||
IdentityEnableHandler identity.EnableHandler
|
||||
// MetadataListEnvironmentsHandler sets the operation handler for the list environments operation
|
||||
MetadataListEnvironmentsHandler metadata.ListEnvironmentsHandler
|
||||
// IdentityLoginHandler sets the operation handler for the login operation
|
||||
IdentityLoginHandler identity.LoginHandler
|
||||
// MetadataOverviewHandler sets the operation handler for the overview operation
|
||||
@ -224,9 +219,6 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.IdentityEnableHandler == nil {
|
||||
unregistered = append(unregistered, "identity.EnableHandler")
|
||||
}
|
||||
if o.MetadataListEnvironmentsHandler == nil {
|
||||
unregistered = append(unregistered, "metadata.ListEnvironmentsHandler")
|
||||
}
|
||||
if o.IdentityLoginHandler == nil {
|
||||
unregistered = append(unregistered, "identity.LoginHandler")
|
||||
}
|
||||
@ -349,10 +341,6 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/enable"] = identity.NewEnable(o.context, o.IdentityEnableHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/listEnvironments"] = metadata.NewListEnvironments(o.context, o.MetadataListEnvironmentsHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
|
@ -62,23 +62,6 @@ paths:
|
||||
schema:
|
||||
$ref: "#/definitions/errorMessage"
|
||||
|
||||
/listEnvironments:
|
||||
get:
|
||||
tags:
|
||||
- metadata
|
||||
security:
|
||||
- key: []
|
||||
operationId: listEnvironments
|
||||
responses:
|
||||
200:
|
||||
description: success
|
||||
schema:
|
||||
$ref: "#/definitions/environments"
|
||||
500:
|
||||
description: internal server error
|
||||
schema:
|
||||
$ref: "#/definitions/errorMessage"
|
||||
|
||||
/login:
|
||||
post:
|
||||
tags:
|
||||
|
@ -2,12 +2,6 @@
|
||||
// Auto-generated, edits will be overwritten
|
||||
import * as gateway from './gateway'
|
||||
|
||||
/**
|
||||
*/
|
||||
export function listEnvironments() {
|
||||
return gateway.request(listEnvironmentsOperation)
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
export function overview() {
|
||||
@ -20,16 +14,6 @@ export function version() {
|
||||
return gateway.request(versionOperation)
|
||||
}
|
||||
|
||||
const listEnvironmentsOperation = {
|
||||
path: '/listEnvironments',
|
||||
method: 'get',
|
||||
security: [
|
||||
{
|
||||
id: 'key'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const overviewOperation = {
|
||||
path: '/overview',
|
||||
method: 'get',
|
||||
|
Loading…
Reference in New Issue
Block a user