mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 16:54:23 +01:00
/detail/service backend (#107)
This commit is contained in:
parent
d8b73e1748
commit
a125c4b40b
@ -39,6 +39,7 @@ func Run(inCfg *Config) error {
|
|||||||
api.EnvironmentEnableHandler = newEnableHandler()
|
api.EnvironmentEnableHandler = newEnableHandler()
|
||||||
api.EnvironmentDisableHandler = newDisableHandler()
|
api.EnvironmentDisableHandler = newDisableHandler()
|
||||||
api.MetadataGetEnvironmentDetailHandler = newEnvironmentDetailHandler()
|
api.MetadataGetEnvironmentDetailHandler = newEnvironmentDetailHandler()
|
||||||
|
api.MetadataGetServiceDetailHandler = newServiceDetailHandler()
|
||||||
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()
|
||||||
|
78
controller/serviceDetail.go
Normal file
78
controller/serviceDetail.go
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
package controller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-openapi/runtime/middleware"
|
||||||
|
"github.com/openziti-test-kitchen/zrok/controller/store"
|
||||||
|
"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 serviceDetailHandler struct{}
|
||||||
|
|
||||||
|
func newServiceDetailHandler() *serviceDetailHandler {
|
||||||
|
return &serviceDetailHandler{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *serviceDetailHandler) Handle(params metadata.GetServiceDetailParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
|
tx, err := str.Begin()
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("error starting transaction: %v", err)
|
||||||
|
return metadata.NewGetServiceDetailInternalServerError()
|
||||||
|
}
|
||||||
|
defer func() { _ = tx.Rollback() }()
|
||||||
|
svc, err := str.FindServiceWithToken(params.SvcToken, tx)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("error finding service '%v': %v", params.SvcToken, err)
|
||||||
|
return metadata.NewGetServiceDetailNotFound()
|
||||||
|
}
|
||||||
|
envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("error finding environments for account '%v': %v", principal.Email, err)
|
||||||
|
return metadata.NewGetServiceDetailInternalServerError()
|
||||||
|
}
|
||||||
|
found := false
|
||||||
|
for _, env := range envs {
|
||||||
|
if svc.EnvironmentId == env.Id {
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
logrus.Errorf("environment not matched for service '%v' for account '%v'", params.SvcToken, principal.Email)
|
||||||
|
return metadata.NewGetServiceDetailNotFound()
|
||||||
|
}
|
||||||
|
var sparkData map[string][]int64
|
||||||
|
if cfg.Influx != nil {
|
||||||
|
sparkData, err = sparkDataForServices([]*store.Service{svc})
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("error querying spark data for services: %v", err)
|
||||||
|
return metadata.NewGetEnvironmentDetailInternalServerError()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
feEndpoint := ""
|
||||||
|
if svc.FrontendEndpoint != nil {
|
||||||
|
feEndpoint = *svc.FrontendEndpoint
|
||||||
|
}
|
||||||
|
feSelection := ""
|
||||||
|
if svc.FrontendSelection != nil {
|
||||||
|
feSelection = *svc.FrontendSelection
|
||||||
|
}
|
||||||
|
beProxyEndpoint := ""
|
||||||
|
if svc.BackendProxyEndpoint != nil {
|
||||||
|
beProxyEndpoint = *svc.BackendProxyEndpoint
|
||||||
|
}
|
||||||
|
return metadata.NewGetServiceDetailOK().WithPayload(&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(),
|
||||||
|
})
|
||||||
|
}
|
148
rest_client_zrok/metadata/get_service_detail_parameters.go
Normal file
148
rest_client_zrok/metadata/get_service_detail_parameters.go
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetServiceDetailParams creates a new GetServiceDetailParams 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 NewGetServiceDetailParams() *GetServiceDetailParams {
|
||||||
|
return &GetServiceDetailParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailParamsWithTimeout creates a new GetServiceDetailParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetServiceDetailParamsWithTimeout(timeout time.Duration) *GetServiceDetailParams {
|
||||||
|
return &GetServiceDetailParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailParamsWithContext creates a new GetServiceDetailParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetServiceDetailParamsWithContext(ctx context.Context) *GetServiceDetailParams {
|
||||||
|
return &GetServiceDetailParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailParamsWithHTTPClient creates a new GetServiceDetailParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetServiceDetailParamsWithHTTPClient(client *http.Client) *GetServiceDetailParams {
|
||||||
|
return &GetServiceDetailParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetailParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the get service detail operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetServiceDetailParams struct {
|
||||||
|
|
||||||
|
// SvcToken.
|
||||||
|
SvcToken string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get service detail params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetServiceDetailParams) WithDefaults() *GetServiceDetailParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get service detail params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetServiceDetailParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get service detail params
|
||||||
|
func (o *GetServiceDetailParams) WithTimeout(timeout time.Duration) *GetServiceDetailParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get service detail params
|
||||||
|
func (o *GetServiceDetailParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get service detail params
|
||||||
|
func (o *GetServiceDetailParams) WithContext(ctx context.Context) *GetServiceDetailParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get service detail params
|
||||||
|
func (o *GetServiceDetailParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get service detail params
|
||||||
|
func (o *GetServiceDetailParams) WithHTTPClient(client *http.Client) *GetServiceDetailParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get service detail params
|
||||||
|
func (o *GetServiceDetailParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSvcToken adds the svcToken to the get service detail params
|
||||||
|
func (o *GetServiceDetailParams) WithSvcToken(svcToken string) *GetServiceDetailParams {
|
||||||
|
o.SetSvcToken(svcToken)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetSvcToken adds the svcToken to the get service detail params
|
||||||
|
func (o *GetServiceDetailParams) SetSvcToken(svcToken string) {
|
||||||
|
o.SvcToken = svcToken
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetServiceDetailParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
// path param svcToken
|
||||||
|
if err := r.SetPathParam("svcToken", o.SvcToken); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
269
rest_client_zrok/metadata/get_service_detail_responses.go
Normal file
269
rest_client_zrok/metadata/get_service_detail_responses.go
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetServiceDetailReader is a Reader for the GetServiceDetail structure.
|
||||||
|
type GetServiceDetailReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetServiceDetailReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetServiceDetailOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetServiceDetailUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetServiceDetailNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetServiceDetailInternalServerError()
|
||||||
|
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())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailOK creates a GetServiceDetailOK with default headers values
|
||||||
|
func NewGetServiceDetailOK() *GetServiceDetailOK {
|
||||||
|
return &GetServiceDetailOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetailOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
ok
|
||||||
|
*/
|
||||||
|
type GetServiceDetailOK struct {
|
||||||
|
Payload *rest_model_zrok.Service
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get service detail o k response has a 2xx status code
|
||||||
|
func (o *GetServiceDetailOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get service detail o k response has a 3xx status code
|
||||||
|
func (o *GetServiceDetailOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get service detail o k response has a 4xx status code
|
||||||
|
func (o *GetServiceDetailOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get service detail o k response has a 5xx status code
|
||||||
|
func (o *GetServiceDetailOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get service detail o k response a status code equal to that given
|
||||||
|
func (o *GetServiceDetailOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/service/{svcToken}][%d] getServiceDetailOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailOK) String() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/service/{svcToken}][%d] getServiceDetailOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailOK) GetPayload() *rest_model_zrok.Service {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(rest_model_zrok.Service)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailUnauthorized creates a GetServiceDetailUnauthorized with default headers values
|
||||||
|
func NewGetServiceDetailUnauthorized() *GetServiceDetailUnauthorized {
|
||||||
|
return &GetServiceDetailUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetailUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
unauthorized
|
||||||
|
*/
|
||||||
|
type GetServiceDetailUnauthorized struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get service detail unauthorized response has a 2xx status code
|
||||||
|
func (o *GetServiceDetailUnauthorized) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get service detail unauthorized response has a 3xx status code
|
||||||
|
func (o *GetServiceDetailUnauthorized) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get service detail unauthorized response has a 4xx status code
|
||||||
|
func (o *GetServiceDetailUnauthorized) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get service detail unauthorized response has a 5xx status code
|
||||||
|
func (o *GetServiceDetailUnauthorized) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get service detail unauthorized response a status code equal to that given
|
||||||
|
func (o *GetServiceDetailUnauthorized) IsCode(code int) bool {
|
||||||
|
return code == 401
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/service/{svcToken}][%d] getServiceDetailUnauthorized ", 401)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailUnauthorized) String() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/service/{svcToken}][%d] getServiceDetailUnauthorized ", 401)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailNotFound creates a GetServiceDetailNotFound with default headers values
|
||||||
|
func NewGetServiceDetailNotFound() *GetServiceDetailNotFound {
|
||||||
|
return &GetServiceDetailNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetailNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
not found
|
||||||
|
*/
|
||||||
|
type GetServiceDetailNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get service detail not found response has a 2xx status code
|
||||||
|
func (o *GetServiceDetailNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get service detail not found response has a 3xx status code
|
||||||
|
func (o *GetServiceDetailNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get service detail not found response has a 4xx status code
|
||||||
|
func (o *GetServiceDetailNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get service detail not found response has a 5xx status code
|
||||||
|
func (o *GetServiceDetailNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get service detail not found response a status code equal to that given
|
||||||
|
func (o *GetServiceDetailNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/service/{svcToken}][%d] getServiceDetailNotFound ", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/service/{svcToken}][%d] getServiceDetailNotFound ", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailInternalServerError creates a GetServiceDetailInternalServerError with default headers values
|
||||||
|
func NewGetServiceDetailInternalServerError() *GetServiceDetailInternalServerError {
|
||||||
|
return &GetServiceDetailInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetailInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
internal server error
|
||||||
|
*/
|
||||||
|
type GetServiceDetailInternalServerError struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get service detail internal server error response has a 2xx status code
|
||||||
|
func (o *GetServiceDetailInternalServerError) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get service detail internal server error response has a 3xx status code
|
||||||
|
func (o *GetServiceDetailInternalServerError) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get service detail internal server error response has a 4xx status code
|
||||||
|
func (o *GetServiceDetailInternalServerError) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get service detail internal server error response has a 5xx status code
|
||||||
|
func (o *GetServiceDetailInternalServerError) IsServerError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get service detail internal server error response a status code equal to that given
|
||||||
|
func (o *GetServiceDetailInternalServerError) IsCode(code int) bool {
|
||||||
|
return code == 500
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/service/{svcToken}][%d] getServiceDetailInternalServerError ", 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailInternalServerError) String() string {
|
||||||
|
return fmt.Sprintf("[GET /detail/service/{svcToken}][%d] getServiceDetailInternalServerError ", 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetailInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -32,6 +32,8 @@ type ClientOption func(*runtime.ClientOperation)
|
|||||||
type ClientService interface {
|
type ClientService interface {
|
||||||
GetEnvironmentDetail(params *GetEnvironmentDetailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnvironmentDetailOK, error)
|
GetEnvironmentDetail(params *GetEnvironmentDetailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnvironmentDetailOK, error)
|
||||||
|
|
||||||
|
GetServiceDetail(params *GetServiceDetailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServiceDetailOK, 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)
|
||||||
@ -78,6 +80,45 @@ func (a *Client) GetEnvironmentDetail(params *GetEnvironmentDetailParams, authIn
|
|||||||
panic(msg)
|
panic(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetail get service detail API
|
||||||
|
*/
|
||||||
|
func (a *Client) GetServiceDetail(params *GetServiceDetailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServiceDetailOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetServiceDetailParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getServiceDetail",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/detail/service/{svcToken}",
|
||||||
|
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetServiceDetailReader{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.(*GetServiceDetailOK)
|
||||||
|
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 getServiceDetail: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Overview overview API
|
Overview overview API
|
||||||
*/
|
*/
|
||||||
|
@ -112,6 +112,44 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/detail/service/{svcToken}": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"key": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"metadata"
|
||||||
|
],
|
||||||
|
"operationId": "getServiceDetail",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"name": "svcToken",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "ok",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/service"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "unauthorized"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "not found"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "internal server error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/disable": {
|
"/disable": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
@ -1242,6 +1280,44 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/detail/service/{svcToken}": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"key": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"metadata"
|
||||||
|
],
|
||||||
|
"operationId": "getServiceDetail",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"name": "svcToken",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "ok",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/service"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "unauthorized"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "not found"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "internal server error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/disable": {
|
"/disable": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
|
71
rest_server_zrok/operations/metadata/get_service_detail.go
Normal file
71
rest_server_zrok/operations/metadata/get_service_detail.go
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetServiceDetailHandlerFunc turns a function with the right signature into a get service detail handler
|
||||||
|
type GetServiceDetailHandlerFunc func(GetServiceDetailParams, *rest_model_zrok.Principal) middleware.Responder
|
||||||
|
|
||||||
|
// Handle executing the request and returning a response
|
||||||
|
func (fn GetServiceDetailHandlerFunc) Handle(params GetServiceDetailParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
|
return fn(params, principal)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServiceDetailHandler interface for that can handle valid get service detail params
|
||||||
|
type GetServiceDetailHandler interface {
|
||||||
|
Handle(GetServiceDetailParams, *rest_model_zrok.Principal) middleware.Responder
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetail creates a new http.Handler for the get service detail operation
|
||||||
|
func NewGetServiceDetail(ctx *middleware.Context, handler GetServiceDetailHandler) *GetServiceDetail {
|
||||||
|
return &GetServiceDetail{Context: ctx, Handler: handler}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetail swagger:route GET /detail/service/{svcToken} metadata getServiceDetail
|
||||||
|
|
||||||
|
GetServiceDetail get service detail API
|
||||||
|
*/
|
||||||
|
type GetServiceDetail struct {
|
||||||
|
Context *middleware.Context
|
||||||
|
Handler GetServiceDetailHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceDetail) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||||
|
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||||
|
if rCtx != nil {
|
||||||
|
*r = *rCtx
|
||||||
|
}
|
||||||
|
var Params = NewGetServiceDetailParams()
|
||||||
|
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)
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
// 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"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetServiceDetailParams creates a new GetServiceDetailParams object
|
||||||
|
//
|
||||||
|
// There are no default values defined in the spec.
|
||||||
|
func NewGetServiceDetailParams() GetServiceDetailParams {
|
||||||
|
|
||||||
|
return GetServiceDetailParams{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServiceDetailParams contains all the bound params for the get service detail operation
|
||||||
|
// typically these are obtained from a http.Request
|
||||||
|
//
|
||||||
|
// swagger:parameters getServiceDetail
|
||||||
|
type GetServiceDetailParams struct {
|
||||||
|
|
||||||
|
// HTTP Request Object
|
||||||
|
HTTPRequest *http.Request `json:"-"`
|
||||||
|
|
||||||
|
/*
|
||||||
|
Required: true
|
||||||
|
In: path
|
||||||
|
*/
|
||||||
|
SvcToken string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 NewGetServiceDetailParams() beforehand.
|
||||||
|
func (o *GetServiceDetailParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
o.HTTPRequest = r
|
||||||
|
|
||||||
|
rSvcToken, rhkSvcToken, _ := route.Params.GetOK("svcToken")
|
||||||
|
if err := o.bindSvcToken(rSvcToken, rhkSvcToken, route.Formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// bindSvcToken binds and validates parameter SvcToken from path.
|
||||||
|
func (o *GetServiceDetailParams) bindSvcToken(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||||
|
var raw string
|
||||||
|
if len(rawData) > 0 {
|
||||||
|
raw = rawData[len(rawData)-1]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required: true
|
||||||
|
// Parameter is provided by construction from the route
|
||||||
|
o.SvcToken = raw
|
||||||
|
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetServiceDetailOKCode is the HTTP code returned for type GetServiceDetailOK
|
||||||
|
const GetServiceDetailOKCode int = 200
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetailOK ok
|
||||||
|
|
||||||
|
swagger:response getServiceDetailOK
|
||||||
|
*/
|
||||||
|
type GetServiceDetailOK struct {
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: Body
|
||||||
|
*/
|
||||||
|
Payload *rest_model_zrok.Service `json:"body,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailOK creates GetServiceDetailOK with default headers values
|
||||||
|
func NewGetServiceDetailOK() *GetServiceDetailOK {
|
||||||
|
|
||||||
|
return &GetServiceDetailOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPayload adds the payload to the get service detail o k response
|
||||||
|
func (o *GetServiceDetailOK) WithPayload(payload *rest_model_zrok.Service) *GetServiceDetailOK {
|
||||||
|
o.Payload = payload
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPayload sets the payload to the get service detail o k response
|
||||||
|
func (o *GetServiceDetailOK) SetPayload(payload *rest_model_zrok.Service) {
|
||||||
|
o.Payload = payload
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetServiceDetailOK) 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServiceDetailUnauthorizedCode is the HTTP code returned for type GetServiceDetailUnauthorized
|
||||||
|
const GetServiceDetailUnauthorizedCode int = 401
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetailUnauthorized unauthorized
|
||||||
|
|
||||||
|
swagger:response getServiceDetailUnauthorized
|
||||||
|
*/
|
||||||
|
type GetServiceDetailUnauthorized struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailUnauthorized creates GetServiceDetailUnauthorized with default headers values
|
||||||
|
func NewGetServiceDetailUnauthorized() *GetServiceDetailUnauthorized {
|
||||||
|
|
||||||
|
return &GetServiceDetailUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetServiceDetailUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||||
|
|
||||||
|
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||||
|
|
||||||
|
rw.WriteHeader(401)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServiceDetailNotFoundCode is the HTTP code returned for type GetServiceDetailNotFound
|
||||||
|
const GetServiceDetailNotFoundCode int = 404
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetailNotFound not found
|
||||||
|
|
||||||
|
swagger:response getServiceDetailNotFound
|
||||||
|
*/
|
||||||
|
type GetServiceDetailNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailNotFound creates GetServiceDetailNotFound with default headers values
|
||||||
|
func NewGetServiceDetailNotFound() *GetServiceDetailNotFound {
|
||||||
|
|
||||||
|
return &GetServiceDetailNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetServiceDetailNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||||
|
|
||||||
|
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||||
|
|
||||||
|
rw.WriteHeader(404)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServiceDetailInternalServerErrorCode is the HTTP code returned for type GetServiceDetailInternalServerError
|
||||||
|
const GetServiceDetailInternalServerErrorCode int = 500
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceDetailInternalServerError internal server error
|
||||||
|
|
||||||
|
swagger:response getServiceDetailInternalServerError
|
||||||
|
*/
|
||||||
|
type GetServiceDetailInternalServerError struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceDetailInternalServerError creates GetServiceDetailInternalServerError with default headers values
|
||||||
|
func NewGetServiceDetailInternalServerError() *GetServiceDetailInternalServerError {
|
||||||
|
|
||||||
|
return &GetServiceDetailInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetServiceDetailInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||||
|
|
||||||
|
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||||
|
|
||||||
|
rw.WriteHeader(500)
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
// 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"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetServiceDetailURL generates an URL for the get service detail operation
|
||||||
|
type GetServiceDetailURL struct {
|
||||||
|
SvcToken string
|
||||||
|
|
||||||
|
_basePath string
|
||||||
|
// avoid unkeyed usage
|
||||||
|
_ struct{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 *GetServiceDetailURL) WithBasePath(bp string) *GetServiceDetailURL {
|
||||||
|
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 *GetServiceDetailURL) SetBasePath(bp string) {
|
||||||
|
o._basePath = bp
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build a url path and query string
|
||||||
|
func (o *GetServiceDetailURL) Build() (*url.URL, error) {
|
||||||
|
var _result url.URL
|
||||||
|
|
||||||
|
var _path = "/detail/service/{svcToken}"
|
||||||
|
|
||||||
|
svcToken := o.SvcToken
|
||||||
|
if svcToken != "" {
|
||||||
|
_path = strings.Replace(_path, "{svcToken}", svcToken, -1)
|
||||||
|
} else {
|
||||||
|
return nil, errors.New("svcToken is required on GetServiceDetailURL")
|
||||||
|
}
|
||||||
|
|
||||||
|
_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 *GetServiceDetailURL) 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 *GetServiceDetailURL) String() string {
|
||||||
|
return o.Must(o.Build()).String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildFull builds a full url with scheme, host, path and query string
|
||||||
|
func (o *GetServiceDetailURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||||
|
if scheme == "" {
|
||||||
|
return nil, errors.New("scheme is required for a full url on GetServiceDetailURL")
|
||||||
|
}
|
||||||
|
if host == "" {
|
||||||
|
return nil, errors.New("host is required for a full url on GetServiceDetailURL")
|
||||||
|
}
|
||||||
|
|
||||||
|
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 *GetServiceDetailURL) StringFull(scheme, host string) string {
|
||||||
|
return o.Must(o.BuildFull(scheme, host)).String()
|
||||||
|
}
|
@ -73,6 +73,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
|||||||
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")
|
||||||
}),
|
}),
|
||||||
|
MetadataGetServiceDetailHandler: metadata.GetServiceDetailHandlerFunc(func(params metadata.GetServiceDetailParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
|
return middleware.NotImplemented("operation metadata.GetServiceDetail has not yet been implemented")
|
||||||
|
}),
|
||||||
AccountInviteHandler: account.InviteHandlerFunc(func(params account.InviteParams) middleware.Responder {
|
AccountInviteHandler: account.InviteHandlerFunc(func(params account.InviteParams) middleware.Responder {
|
||||||
return middleware.NotImplemented("operation account.Invite has not yet been implemented")
|
return middleware.NotImplemented("operation account.Invite has not yet been implemented")
|
||||||
}),
|
}),
|
||||||
@ -175,6 +178,8 @@ type ZrokAPI struct {
|
|||||||
MetadataGetEnvironmentDetailHandler metadata.GetEnvironmentDetailHandler
|
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
|
||||||
|
// MetadataGetServiceDetailHandler sets the operation handler for the get service detail operation
|
||||||
|
MetadataGetServiceDetailHandler metadata.GetServiceDetailHandler
|
||||||
// AccountInviteHandler sets the operation handler for the invite operation
|
// AccountInviteHandler sets the operation handler for the invite operation
|
||||||
AccountInviteHandler account.InviteHandler
|
AccountInviteHandler account.InviteHandler
|
||||||
// AdminListFrontendsHandler sets the operation handler for the list frontends operation
|
// AdminListFrontendsHandler sets the operation handler for the list frontends operation
|
||||||
@ -304,6 +309,9 @@ func (o *ZrokAPI) Validate() error {
|
|||||||
if o.ServiceGetServiceHandler == nil {
|
if o.ServiceGetServiceHandler == nil {
|
||||||
unregistered = append(unregistered, "service.GetServiceHandler")
|
unregistered = append(unregistered, "service.GetServiceHandler")
|
||||||
}
|
}
|
||||||
|
if o.MetadataGetServiceDetailHandler == nil {
|
||||||
|
unregistered = append(unregistered, "metadata.GetServiceDetailHandler")
|
||||||
|
}
|
||||||
if o.AccountInviteHandler == nil {
|
if o.AccountInviteHandler == nil {
|
||||||
unregistered = append(unregistered, "account.InviteHandler")
|
unregistered = append(unregistered, "account.InviteHandler")
|
||||||
}
|
}
|
||||||
@ -471,6 +479,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
|||||||
o.handlers["GET"] = make(map[string]http.Handler)
|
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["GET"] == nil {
|
||||||
|
o.handlers["GET"] = make(map[string]http.Handler)
|
||||||
|
}
|
||||||
|
o.handlers["GET"]["/detail/service/{svcToken}"] = metadata.NewGetServiceDetail(o.context, o.MetadataGetServiceDetailHandler)
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
@ -276,6 +276,30 @@ paths:
|
|||||||
500:
|
500:
|
||||||
description: internal server error
|
description: internal server error
|
||||||
|
|
||||||
|
/detail/service/{svcToken}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- metadata
|
||||||
|
security:
|
||||||
|
- key: []
|
||||||
|
operationId: getServiceDetail
|
||||||
|
parameters:
|
||||||
|
- name: svcToken
|
||||||
|
in: path
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: ok
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/service"
|
||||||
|
401:
|
||||||
|
description: unauthorized
|
||||||
|
404:
|
||||||
|
description: not found
|
||||||
|
500:
|
||||||
|
description: internal server error
|
||||||
|
|
||||||
/overview:
|
/overview:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -15,6 +15,19 @@ export function getEnvironmentDetail(envZId) {
|
|||||||
return gateway.request(getEnvironmentDetailOperation, parameters)
|
return gateway.request(getEnvironmentDetailOperation, parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} svcToken
|
||||||
|
* @return {Promise<module:types.service>} ok
|
||||||
|
*/
|
||||||
|
export function getServiceDetail(svcToken) {
|
||||||
|
const parameters = {
|
||||||
|
path: {
|
||||||
|
svcToken
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gateway.request(getServiceDetailOperation, parameters)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function overview() {
|
export function overview() {
|
||||||
@ -37,6 +50,16 @@ const getEnvironmentDetailOperation = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getServiceDetailOperation = {
|
||||||
|
path: '/detail/service/{svcToken}',
|
||||||
|
method: 'get',
|
||||||
|
security: [
|
||||||
|
{
|
||||||
|
id: 'key'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
const overviewOperation = {
|
const overviewOperation = {
|
||||||
path: '/overview',
|
path: '/overview',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
Loading…
Reference in New Issue
Block a user