mirror of
https://github.com/openziti/zrok.git
synced 2025-06-20 17:58:50 +02:00
/detail/environmment; environment detail api backend (#107)
This commit is contained in:
parent
988ef9bec3
commit
a0fd3a9c63
@ -38,6 +38,7 @@ func Run(inCfg *Config) error {
|
|||||||
api.AdminUpdateFrontendHandler = newUpdateFrontendHandler()
|
api.AdminUpdateFrontendHandler = newUpdateFrontendHandler()
|
||||||
api.EnvironmentEnableHandler = newEnableHandler()
|
api.EnvironmentEnableHandler = newEnableHandler()
|
||||||
api.EnvironmentDisableHandler = newDisableHandler()
|
api.EnvironmentDisableHandler = newDisableHandler()
|
||||||
|
api.MetadataGetEnvironmentDetailHandler = newEnvironmentDetailHandler()
|
||||||
api.MetadataOverviewHandler = metadata.OverviewHandlerFunc(overviewHandler)
|
api.MetadataOverviewHandler = metadata.OverviewHandlerFunc(overviewHandler)
|
||||||
api.MetadataVersionHandler = metadata.VersionHandlerFunc(versionHandler)
|
api.MetadataVersionHandler = metadata.VersionHandlerFunc(versionHandler)
|
||||||
api.ServiceAccessHandler = newAccessHandler()
|
api.ServiceAccessHandler = newAccessHandler()
|
||||||
|
@ -11,8 +11,7 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type enableHandler struct {
|
type enableHandler struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func newEnableHandler() *enableHandler {
|
func newEnableHandler() *enableHandler {
|
||||||
return &enableHandler{}
|
return &enableHandler{}
|
||||||
|
79
controller/environmentDetail.go
Normal file
79
controller/environmentDetail.go
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
type environmentDetailHandler struct{}
|
||||||
|
|
||||||
|
func newEnvironmentDetailHandler() *environmentDetailHandler {
|
||||||
|
return &environmentDetailHandler{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *environmentDetailHandler) Handle(params metadata.GetEnvironmentDetailParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
|
tx, err := str.Begin()
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("error starting transaction: %v", err)
|
||||||
|
return metadata.NewGetEnvironmentDetailInternalServerError()
|
||||||
|
}
|
||||||
|
defer func() { _ = tx.Rollback() }()
|
||||||
|
senv, err := str.FindEnvironmentForAccount(params.Body.EnvZID, int(principal.ID), tx)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("environment '%v' not found for account '%v': %v", params.Body.EnvZID, principal.Email, err)
|
||||||
|
return metadata.NewGetEnvironmentDetailNotFound()
|
||||||
|
}
|
||||||
|
es := &rest_model_zrok.EnvironmentServices{
|
||||||
|
Environment: &rest_model_zrok.Environment{
|
||||||
|
Address: senv.Address,
|
||||||
|
CreatedAt: senv.CreatedAt.UnixMilli(),
|
||||||
|
Description: senv.Description,
|
||||||
|
Host: senv.Host,
|
||||||
|
UpdatedAt: senv.UpdatedAt.UnixMilli(),
|
||||||
|
ZID: senv.ZId,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
svcs, err := str.FindServicesForEnvironment(senv.Id, tx)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("error finding services for environment '%v': %v", senv.ZId, err)
|
||||||
|
return metadata.NewGetEnvironmentDetailInternalServerError()
|
||||||
|
}
|
||||||
|
var sparkData map[string][]int64
|
||||||
|
if cfg.Influx != nil {
|
||||||
|
sparkData, err = sparkDataForServices(svcs)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("error querying spark data for services: %v", err)
|
||||||
|
return metadata.NewGetEnvironmentDetailInternalServerError()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, svc := range svcs {
|
||||||
|
feEndpoint := ""
|
||||||
|
if svc.FrontendEndpoint != nil {
|
||||||
|
feEndpoint = *svc.FrontendEndpoint
|
||||||
|
}
|
||||||
|
feSelection := ""
|
||||||
|
if svc.FrontendSelection != nil {
|
||||||
|
feSelection = *svc.FrontendSelection
|
||||||
|
}
|
||||||
|
beProxyEndpoint := ""
|
||||||
|
if svc.BackendProxyEndpoint != nil {
|
||||||
|
beProxyEndpoint = *svc.BackendProxyEndpoint
|
||||||
|
}
|
||||||
|
es.Services = append(es.Services, &rest_model_zrok.Service{
|
||||||
|
Token: svc.Token,
|
||||||
|
ZID: svc.ZId,
|
||||||
|
ShareMode: svc.ShareMode,
|
||||||
|
BackendMode: svc.BackendMode,
|
||||||
|
FrontendSelection: feSelection,
|
||||||
|
FrontendEndpoint: feEndpoint,
|
||||||
|
BackendProxyEndpoint: beProxyEndpoint,
|
||||||
|
Reserved: svc.Reserved,
|
||||||
|
Metrics: sparkData[svc.Token],
|
||||||
|
CreatedAt: svc.CreatedAt.UnixMilli(),
|
||||||
|
UpdatedAt: svc.UpdatedAt.UnixMilli(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return metadata.NewGetEnvironmentDetailOK().WithPayload(es)
|
||||||
|
}
|
@ -62,6 +62,14 @@ func (self *Store) FindEnvironmentsForAccount(accountId int, tx *sqlx.Tx) ([]*En
|
|||||||
return is, nil
|
return is, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Store) FindEnvironmentForAccount(envZId string, accountId int, tx *sqlx.Tx) (*Environment, error) {
|
||||||
|
env := &Environment{}
|
||||||
|
if err := tx.QueryRowx("select environments.* from environments where z_id = $1 and account_id = $1", envZId, accountId).StructScan(env); err != nil {
|
||||||
|
return nil, errors.Wrap(err, "error finding environment by z_id and account_id")
|
||||||
|
}
|
||||||
|
return env, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (self *Store) DeleteEnvironment(id int, tx *sqlx.Tx) error {
|
func (self *Store) DeleteEnvironment(id int, tx *sqlx.Tx) error {
|
||||||
stmt, err := tx.Prepare("delete from environments where id = $1")
|
stmt, err := tx.Prepare("delete from environments where id = $1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
146
rest_client_zrok/metadata/get_environment_detail_parameters.go
Normal file
146
rest_client_zrok/metadata/get_environment_detail_parameters.go
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailParams creates a new GetEnvironmentDetailParams 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 NewGetEnvironmentDetailParams() *GetEnvironmentDetailParams {
|
||||||
|
return &GetEnvironmentDetailParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailParamsWithTimeout creates a new GetEnvironmentDetailParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetEnvironmentDetailParamsWithTimeout(timeout time.Duration) *GetEnvironmentDetailParams {
|
||||||
|
return &GetEnvironmentDetailParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailParamsWithContext creates a new GetEnvironmentDetailParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetEnvironmentDetailParamsWithContext(ctx context.Context) *GetEnvironmentDetailParams {
|
||||||
|
return &GetEnvironmentDetailParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailParamsWithHTTPClient creates a new GetEnvironmentDetailParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetEnvironmentDetailParamsWithHTTPClient(client *http.Client) *GetEnvironmentDetailParams {
|
||||||
|
return &GetEnvironmentDetailParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetailParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the get environment detail operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetailParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body GetEnvironmentDetailBody
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get environment detail params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetEnvironmentDetailParams) WithDefaults() *GetEnvironmentDetailParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get environment detail params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetEnvironmentDetailParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get environment detail params
|
||||||
|
func (o *GetEnvironmentDetailParams) WithTimeout(timeout time.Duration) *GetEnvironmentDetailParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get environment detail params
|
||||||
|
func (o *GetEnvironmentDetailParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get environment detail params
|
||||||
|
func (o *GetEnvironmentDetailParams) WithContext(ctx context.Context) *GetEnvironmentDetailParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get environment detail params
|
||||||
|
func (o *GetEnvironmentDetailParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get environment detail params
|
||||||
|
func (o *GetEnvironmentDetailParams) WithHTTPClient(client *http.Client) *GetEnvironmentDetailParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get environment detail params
|
||||||
|
func (o *GetEnvironmentDetailParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the get environment detail params
|
||||||
|
func (o *GetEnvironmentDetailParams) WithBody(body GetEnvironmentDetailBody) *GetEnvironmentDetailParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the get environment detail params
|
||||||
|
func (o *GetEnvironmentDetailParams) SetBody(body GetEnvironmentDetailBody) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetEnvironmentDetailParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if err := r.SetBodyParam(o.Body); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
309
rest_client_zrok/metadata/get_environment_detail_responses.go
Normal file
309
rest_client_zrok/metadata/get_environment_detail_responses.go
Normal file
@ -0,0 +1,309 @@
|
|||||||
|
// 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"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
|
||||||
|
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetEnvironmentDetailReader is a Reader for the GetEnvironmentDetail structure.
|
||||||
|
type GetEnvironmentDetailReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetEnvironmentDetailReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetEnvironmentDetailOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetEnvironmentDetailUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetEnvironmentDetailNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetEnvironmentDetailInternalServerError()
|
||||||
|
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())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailOK creates a GetEnvironmentDetailOK with default headers values
|
||||||
|
func NewGetEnvironmentDetailOK() *GetEnvironmentDetailOK {
|
||||||
|
return &GetEnvironmentDetailOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetailOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
ok
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetailOK struct {
|
||||||
|
Payload *rest_model_zrok.EnvironmentServices
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get environment detail o k response has a 2xx status code
|
||||||
|
func (o *GetEnvironmentDetailOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get environment detail o k response has a 3xx status code
|
||||||
|
func (o *GetEnvironmentDetailOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get environment detail o k response has a 4xx status code
|
||||||
|
func (o *GetEnvironmentDetailOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get environment detail o k response has a 5xx status code
|
||||||
|
func (o *GetEnvironmentDetailOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get environment detail o k response a status code equal to that given
|
||||||
|
func (o *GetEnvironmentDetailOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/environment][%d] getEnvironmentDetailOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailOK) String() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/environment][%d] getEnvironmentDetailOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailOK) GetPayload() *rest_model_zrok.EnvironmentServices {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(rest_model_zrok.EnvironmentServices)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailUnauthorized creates a GetEnvironmentDetailUnauthorized with default headers values
|
||||||
|
func NewGetEnvironmentDetailUnauthorized() *GetEnvironmentDetailUnauthorized {
|
||||||
|
return &GetEnvironmentDetailUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetailUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
unauthorized
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetailUnauthorized struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get environment detail unauthorized response has a 2xx status code
|
||||||
|
func (o *GetEnvironmentDetailUnauthorized) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get environment detail unauthorized response has a 3xx status code
|
||||||
|
func (o *GetEnvironmentDetailUnauthorized) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get environment detail unauthorized response has a 4xx status code
|
||||||
|
func (o *GetEnvironmentDetailUnauthorized) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get environment detail unauthorized response has a 5xx status code
|
||||||
|
func (o *GetEnvironmentDetailUnauthorized) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get environment detail unauthorized response a status code equal to that given
|
||||||
|
func (o *GetEnvironmentDetailUnauthorized) IsCode(code int) bool {
|
||||||
|
return code == 401
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/environment][%d] getEnvironmentDetailUnauthorized ", 401)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailUnauthorized) String() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/environment][%d] getEnvironmentDetailUnauthorized ", 401)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailNotFound creates a GetEnvironmentDetailNotFound with default headers values
|
||||||
|
func NewGetEnvironmentDetailNotFound() *GetEnvironmentDetailNotFound {
|
||||||
|
return &GetEnvironmentDetailNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetailNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
not found
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetailNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get environment detail not found response has a 2xx status code
|
||||||
|
func (o *GetEnvironmentDetailNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get environment detail not found response has a 3xx status code
|
||||||
|
func (o *GetEnvironmentDetailNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get environment detail not found response has a 4xx status code
|
||||||
|
func (o *GetEnvironmentDetailNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get environment detail not found response has a 5xx status code
|
||||||
|
func (o *GetEnvironmentDetailNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get environment detail not found response a status code equal to that given
|
||||||
|
func (o *GetEnvironmentDetailNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/environment][%d] getEnvironmentDetailNotFound ", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/environment][%d] getEnvironmentDetailNotFound ", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailInternalServerError creates a GetEnvironmentDetailInternalServerError with default headers values
|
||||||
|
func NewGetEnvironmentDetailInternalServerError() *GetEnvironmentDetailInternalServerError {
|
||||||
|
return &GetEnvironmentDetailInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetailInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
internal server error
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetailInternalServerError struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get environment detail internal server error response has a 2xx status code
|
||||||
|
func (o *GetEnvironmentDetailInternalServerError) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get environment detail internal server error response has a 3xx status code
|
||||||
|
func (o *GetEnvironmentDetailInternalServerError) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get environment detail internal server error response has a 4xx status code
|
||||||
|
func (o *GetEnvironmentDetailInternalServerError) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get environment detail internal server error response has a 5xx status code
|
||||||
|
func (o *GetEnvironmentDetailInternalServerError) IsServerError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get environment detail internal server error response a status code equal to that given
|
||||||
|
func (o *GetEnvironmentDetailInternalServerError) IsCode(code int) bool {
|
||||||
|
return code == 500
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/environment][%d] getEnvironmentDetailInternalServerError ", 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailInternalServerError) String() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/environment][%d] getEnvironmentDetailInternalServerError ", 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetailInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetailBody get environment detail body
|
||||||
|
swagger:model GetEnvironmentDetailBody
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetailBody struct {
|
||||||
|
|
||||||
|
// env z Id
|
||||||
|
EnvZID string `json:"envZId,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this get environment detail body
|
||||||
|
func (o *GetEnvironmentDetailBody) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this get environment detail body based on context it is used
|
||||||
|
func (o *GetEnvironmentDetailBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (o *GetEnvironmentDetailBody) MarshalBinary() ([]byte, error) {
|
||||||
|
if o == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (o *GetEnvironmentDetailBody) UnmarshalBinary(b []byte) error {
|
||||||
|
var res GetEnvironmentDetailBody
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*o = res
|
||||||
|
return nil
|
||||||
|
}
|
@ -30,6 +30,8 @@ type ClientOption func(*runtime.ClientOperation)
|
|||||||
|
|
||||||
// ClientService is the interface for Client methods
|
// ClientService is the interface for Client methods
|
||||||
type ClientService interface {
|
type ClientService interface {
|
||||||
|
GetEnvironmentDetail(params *GetEnvironmentDetailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnvironmentDetailOK, error)
|
||||||
|
|
||||||
Overview(params *OverviewParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OverviewOK, error)
|
Overview(params *OverviewParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OverviewOK, error)
|
||||||
|
|
||||||
Version(params *VersionParams, opts ...ClientOption) (*VersionOK, error)
|
Version(params *VersionParams, opts ...ClientOption) (*VersionOK, error)
|
||||||
@ -37,6 +39,45 @@ type ClientService interface {
|
|||||||
SetTransport(transport runtime.ClientTransport)
|
SetTransport(transport runtime.ClientTransport)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetail get environment detail API
|
||||||
|
*/
|
||||||
|
func (a *Client) GetEnvironmentDetail(params *GetEnvironmentDetailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnvironmentDetailOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetEnvironmentDetailParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getEnvironmentDetail",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/detail/environment",
|
||||||
|
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetEnvironmentDetailReader{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.(*GetEnvironmentDetailOK)
|
||||||
|
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 getEnvironmentDetail: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Overview overview API
|
Overview overview API
|
||||||
*/
|
*/
|
||||||
|
@ -74,6 +74,49 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/detail/environment": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"key": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"metadata"
|
||||||
|
],
|
||||||
|
"operationId": "getEnvironmentDetail",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"properties": {
|
||||||
|
"envZId": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "ok",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/environmentServices"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "unauthorized"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "not found"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "internal server error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/disable": {
|
"/disable": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
@ -1166,6 +1209,49 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/detail/environment": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"key": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"metadata"
|
||||||
|
],
|
||||||
|
"operationId": "getEnvironmentDetail",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"properties": {
|
||||||
|
"envZId": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "ok",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/environmentServices"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "unauthorized"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "not found"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "internal server error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/disable": {
|
"/disable": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
|
111
rest_server_zrok/operations/metadata/get_environment_detail.go
Normal file
111
rest_server_zrok/operations/metadata/get_environment_detail.go
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
// 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 (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime/middleware"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
|
||||||
|
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetEnvironmentDetailHandlerFunc turns a function with the right signature into a get environment detail handler
|
||||||
|
type GetEnvironmentDetailHandlerFunc func(GetEnvironmentDetailParams, *rest_model_zrok.Principal) middleware.Responder
|
||||||
|
|
||||||
|
// Handle executing the request and returning a response
|
||||||
|
func (fn GetEnvironmentDetailHandlerFunc) Handle(params GetEnvironmentDetailParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
|
return fn(params, principal)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEnvironmentDetailHandler interface for that can handle valid get environment detail params
|
||||||
|
type GetEnvironmentDetailHandler interface {
|
||||||
|
Handle(GetEnvironmentDetailParams, *rest_model_zrok.Principal) middleware.Responder
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetail creates a new http.Handler for the get environment detail operation
|
||||||
|
func NewGetEnvironmentDetail(ctx *middleware.Context, handler GetEnvironmentDetailHandler) *GetEnvironmentDetail {
|
||||||
|
return &GetEnvironmentDetail{Context: ctx, Handler: handler}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetail swagger:route GET /detail/environment metadata getEnvironmentDetail
|
||||||
|
|
||||||
|
GetEnvironmentDetail get environment detail API
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetail struct {
|
||||||
|
Context *middleware.Context
|
||||||
|
Handler GetEnvironmentDetailHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetEnvironmentDetail) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||||
|
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||||
|
if rCtx != nil {
|
||||||
|
*r = *rCtx
|
||||||
|
}
|
||||||
|
var Params = NewGetEnvironmentDetailParams()
|
||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEnvironmentDetailBody get environment detail body
|
||||||
|
//
|
||||||
|
// swagger:model GetEnvironmentDetailBody
|
||||||
|
type GetEnvironmentDetailBody struct {
|
||||||
|
|
||||||
|
// env z Id
|
||||||
|
EnvZID string `json:"envZId,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this get environment detail body
|
||||||
|
func (o *GetEnvironmentDetailBody) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this get environment detail body based on context it is used
|
||||||
|
func (o *GetEnvironmentDetailBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (o *GetEnvironmentDetailBody) MarshalBinary() ([]byte, error) {
|
||||||
|
if o == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (o *GetEnvironmentDetailBody) UnmarshalBinary(b []byte) error {
|
||||||
|
var res GetEnvironmentDetailBody
|
||||||
|
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 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"
|
||||||
|
"github.com/go-openapi/runtime/middleware"
|
||||||
|
"github.com/go-openapi/validate"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailParams creates a new GetEnvironmentDetailParams object
|
||||||
|
//
|
||||||
|
// There are no default values defined in the spec.
|
||||||
|
func NewGetEnvironmentDetailParams() GetEnvironmentDetailParams {
|
||||||
|
|
||||||
|
return GetEnvironmentDetailParams{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEnvironmentDetailParams contains all the bound params for the get environment detail operation
|
||||||
|
// typically these are obtained from a http.Request
|
||||||
|
//
|
||||||
|
// swagger:parameters getEnvironmentDetail
|
||||||
|
type GetEnvironmentDetailParams struct {
|
||||||
|
|
||||||
|
// HTTP Request Object
|
||||||
|
HTTPRequest *http.Request `json:"-"`
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: body
|
||||||
|
*/
|
||||||
|
Body GetEnvironmentDetailBody
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 NewGetEnvironmentDetailParams() beforehand.
|
||||||
|
func (o *GetEnvironmentDetailParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
o.HTTPRequest = r
|
||||||
|
|
||||||
|
if runtime.HasBody(r) {
|
||||||
|
defer r.Body.Close()
|
||||||
|
var body GetEnvironmentDetailBody
|
||||||
|
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,134 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetEnvironmentDetailOKCode is the HTTP code returned for type GetEnvironmentDetailOK
|
||||||
|
const GetEnvironmentDetailOKCode int = 200
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetailOK ok
|
||||||
|
|
||||||
|
swagger:response getEnvironmentDetailOK
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetailOK struct {
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: Body
|
||||||
|
*/
|
||||||
|
Payload *rest_model_zrok.EnvironmentServices `json:"body,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailOK creates GetEnvironmentDetailOK with default headers values
|
||||||
|
func NewGetEnvironmentDetailOK() *GetEnvironmentDetailOK {
|
||||||
|
|
||||||
|
return &GetEnvironmentDetailOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPayload adds the payload to the get environment detail o k response
|
||||||
|
func (o *GetEnvironmentDetailOK) WithPayload(payload *rest_model_zrok.EnvironmentServices) *GetEnvironmentDetailOK {
|
||||||
|
o.Payload = payload
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPayload sets the payload to the get environment detail o k response
|
||||||
|
func (o *GetEnvironmentDetailOK) SetPayload(payload *rest_model_zrok.EnvironmentServices) {
|
||||||
|
o.Payload = payload
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetEnvironmentDetailOK) 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEnvironmentDetailUnauthorizedCode is the HTTP code returned for type GetEnvironmentDetailUnauthorized
|
||||||
|
const GetEnvironmentDetailUnauthorizedCode int = 401
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetailUnauthorized unauthorized
|
||||||
|
|
||||||
|
swagger:response getEnvironmentDetailUnauthorized
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetailUnauthorized struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailUnauthorized creates GetEnvironmentDetailUnauthorized with default headers values
|
||||||
|
func NewGetEnvironmentDetailUnauthorized() *GetEnvironmentDetailUnauthorized {
|
||||||
|
|
||||||
|
return &GetEnvironmentDetailUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetEnvironmentDetailUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||||
|
|
||||||
|
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||||
|
|
||||||
|
rw.WriteHeader(401)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEnvironmentDetailNotFoundCode is the HTTP code returned for type GetEnvironmentDetailNotFound
|
||||||
|
const GetEnvironmentDetailNotFoundCode int = 404
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetailNotFound not found
|
||||||
|
|
||||||
|
swagger:response getEnvironmentDetailNotFound
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetailNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailNotFound creates GetEnvironmentDetailNotFound with default headers values
|
||||||
|
func NewGetEnvironmentDetailNotFound() *GetEnvironmentDetailNotFound {
|
||||||
|
|
||||||
|
return &GetEnvironmentDetailNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetEnvironmentDetailNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||||
|
|
||||||
|
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||||
|
|
||||||
|
rw.WriteHeader(404)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEnvironmentDetailInternalServerErrorCode is the HTTP code returned for type GetEnvironmentDetailInternalServerError
|
||||||
|
const GetEnvironmentDetailInternalServerErrorCode int = 500
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetEnvironmentDetailInternalServerError internal server error
|
||||||
|
|
||||||
|
swagger:response getEnvironmentDetailInternalServerError
|
||||||
|
*/
|
||||||
|
type GetEnvironmentDetailInternalServerError struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetEnvironmentDetailInternalServerError creates GetEnvironmentDetailInternalServerError with default headers values
|
||||||
|
func NewGetEnvironmentDetailInternalServerError() *GetEnvironmentDetailInternalServerError {
|
||||||
|
|
||||||
|
return &GetEnvironmentDetailInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetEnvironmentDetailInternalServerError) 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 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetEnvironmentDetailURL generates an URL for the get environment detail operation
|
||||||
|
type GetEnvironmentDetailURL 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 *GetEnvironmentDetailURL) WithBasePath(bp string) *GetEnvironmentDetailURL {
|
||||||
|
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 *GetEnvironmentDetailURL) SetBasePath(bp string) {
|
||||||
|
o._basePath = bp
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build a url path and query string
|
||||||
|
func (o *GetEnvironmentDetailURL) Build() (*url.URL, error) {
|
||||||
|
var _result url.URL
|
||||||
|
|
||||||
|
var _path = "/detail/environment"
|
||||||
|
|
||||||
|
_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 *GetEnvironmentDetailURL) 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 *GetEnvironmentDetailURL) String() string {
|
||||||
|
return o.Must(o.Build()).String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildFull builds a full url with scheme, host, path and query string
|
||||||
|
func (o *GetEnvironmentDetailURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||||
|
if scheme == "" {
|
||||||
|
return nil, errors.New("scheme is required for a full url on GetEnvironmentDetailURL")
|
||||||
|
}
|
||||||
|
if host == "" {
|
||||||
|
return nil, errors.New("host is required for a full url on GetEnvironmentDetailURL")
|
||||||
|
}
|
||||||
|
|
||||||
|
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 *GetEnvironmentDetailURL) StringFull(scheme, host string) string {
|
||||||
|
return o.Must(o.BuildFull(scheme, host)).String()
|
||||||
|
}
|
@ -67,6 +67,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
|||||||
EnvironmentEnableHandler: environment.EnableHandlerFunc(func(params environment.EnableParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
EnvironmentEnableHandler: environment.EnableHandlerFunc(func(params environment.EnableParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
return middleware.NotImplemented("operation environment.Enable has not yet been implemented")
|
return middleware.NotImplemented("operation environment.Enable has not yet been implemented")
|
||||||
}),
|
}),
|
||||||
|
MetadataGetEnvironmentDetailHandler: metadata.GetEnvironmentDetailHandlerFunc(func(params metadata.GetEnvironmentDetailParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
|
return middleware.NotImplemented("operation metadata.GetEnvironmentDetail has not yet been implemented")
|
||||||
|
}),
|
||||||
ServiceGetServiceHandler: service.GetServiceHandlerFunc(func(params service.GetServiceParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
ServiceGetServiceHandler: service.GetServiceHandlerFunc(func(params service.GetServiceParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
return middleware.NotImplemented("operation service.GetService has not yet been implemented")
|
return middleware.NotImplemented("operation service.GetService has not yet been implemented")
|
||||||
}),
|
}),
|
||||||
@ -168,6 +171,8 @@ type ZrokAPI struct {
|
|||||||
EnvironmentDisableHandler environment.DisableHandler
|
EnvironmentDisableHandler environment.DisableHandler
|
||||||
// EnvironmentEnableHandler sets the operation handler for the enable operation
|
// EnvironmentEnableHandler sets the operation handler for the enable operation
|
||||||
EnvironmentEnableHandler environment.EnableHandler
|
EnvironmentEnableHandler environment.EnableHandler
|
||||||
|
// MetadataGetEnvironmentDetailHandler sets the operation handler for the get environment detail operation
|
||||||
|
MetadataGetEnvironmentDetailHandler metadata.GetEnvironmentDetailHandler
|
||||||
// ServiceGetServiceHandler sets the operation handler for the get service operation
|
// ServiceGetServiceHandler sets the operation handler for the get service operation
|
||||||
ServiceGetServiceHandler service.GetServiceHandler
|
ServiceGetServiceHandler service.GetServiceHandler
|
||||||
// AccountInviteHandler sets the operation handler for the invite operation
|
// AccountInviteHandler sets the operation handler for the invite operation
|
||||||
@ -293,6 +298,9 @@ func (o *ZrokAPI) Validate() error {
|
|||||||
if o.EnvironmentEnableHandler == nil {
|
if o.EnvironmentEnableHandler == nil {
|
||||||
unregistered = append(unregistered, "environment.EnableHandler")
|
unregistered = append(unregistered, "environment.EnableHandler")
|
||||||
}
|
}
|
||||||
|
if o.MetadataGetEnvironmentDetailHandler == nil {
|
||||||
|
unregistered = append(unregistered, "metadata.GetEnvironmentDetailHandler")
|
||||||
|
}
|
||||||
if o.ServiceGetServiceHandler == nil {
|
if o.ServiceGetServiceHandler == nil {
|
||||||
unregistered = append(unregistered, "service.GetServiceHandler")
|
unregistered = append(unregistered, "service.GetServiceHandler")
|
||||||
}
|
}
|
||||||
@ -458,6 +466,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
|||||||
if o.handlers["GET"] == nil {
|
if o.handlers["GET"] == nil {
|
||||||
o.handlers["GET"] = make(map[string]http.Handler)
|
o.handlers["GET"] = make(map[string]http.Handler)
|
||||||
}
|
}
|
||||||
|
o.handlers["GET"]["/detail/environment"] = metadata.NewGetEnvironmentDetail(o.context, o.MetadataGetEnvironmentDetailHandler)
|
||||||
|
if o.handlers["GET"] == nil {
|
||||||
|
o.handlers["GET"] = make(map[string]http.Handler)
|
||||||
|
}
|
||||||
o.handlers["GET"]["/service"] = service.NewGetService(o.context, o.ServiceGetServiceHandler)
|
o.handlers["GET"]["/service"] = service.NewGetService(o.context, o.ServiceGetServiceHandler)
|
||||||
if o.handlers["POST"] == nil {
|
if o.handlers["POST"] == nil {
|
||||||
o.handlers["POST"] = make(map[string]http.Handler)
|
o.handlers["POST"] = make(map[string]http.Handler)
|
||||||
|
@ -252,6 +252,32 @@ paths:
|
|||||||
#
|
#
|
||||||
# metadata
|
# metadata
|
||||||
#
|
#
|
||||||
|
/detail/environment:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- metadata
|
||||||
|
security:
|
||||||
|
- key: []
|
||||||
|
operationId: getEnvironmentDetail
|
||||||
|
parameters:
|
||||||
|
- name: body
|
||||||
|
in: body
|
||||||
|
schema:
|
||||||
|
properties:
|
||||||
|
envZId:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: ok
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/environmentServices"
|
||||||
|
401:
|
||||||
|
description: unauthorized
|
||||||
|
404:
|
||||||
|
description: not found
|
||||||
|
500:
|
||||||
|
description: internal server error
|
||||||
|
|
||||||
/overview:
|
/overview:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -2,6 +2,21 @@
|
|||||||
// Auto-generated, edits will be overwritten
|
// Auto-generated, edits will be overwritten
|
||||||
import * as gateway from './gateway'
|
import * as gateway from './gateway'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {object} options Optional options
|
||||||
|
* @param {object} [options.body]
|
||||||
|
* @return {Promise<module:types.environmentServices>} ok
|
||||||
|
*/
|
||||||
|
export function getEnvironmentDetail(options) {
|
||||||
|
if (!options) options = {}
|
||||||
|
const parameters = {
|
||||||
|
body: {
|
||||||
|
body: options.body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gateway.request(getEnvironmentDetailOperation, parameters)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function overview() {
|
export function overview() {
|
||||||
@ -14,6 +29,17 @@ export function version() {
|
|||||||
return gateway.request(versionOperation)
|
return gateway.request(versionOperation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getEnvironmentDetailOperation = {
|
||||||
|
path: '/detail/environment',
|
||||||
|
contentTypes: ['application/zrok.v1+json'],
|
||||||
|
method: 'get',
|
||||||
|
security: [
|
||||||
|
{
|
||||||
|
id: 'key'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
const overviewOperation = {
|
const overviewOperation = {
|
||||||
path: '/overview',
|
path: '/overview',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user