mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01:00
service details operation (#41)
This commit is contained in:
parent
6379223be2
commit
64c3bdd3c1
@ -27,7 +27,6 @@ func init() {
|
|||||||
|
|
||||||
type sharePrivateCommand struct {
|
type sharePrivateCommand struct {
|
||||||
basicAuth []string
|
basicAuth []string
|
||||||
reserve bool
|
|
||||||
cmd *cobra.Command
|
cmd *cobra.Command
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +38,6 @@ func newSharePrivateCommand() *sharePrivateCommand {
|
|||||||
}
|
}
|
||||||
command := &sharePrivateCommand{cmd: cmd}
|
command := &sharePrivateCommand{cmd: cmd}
|
||||||
cmd.Flags().StringArrayVar(&command.basicAuth, "basic-auth", []string{}, "Basic authentication users (<username:password>,...")
|
cmd.Flags().StringArrayVar(&command.basicAuth, "basic-auth", []string{}, "Basic authentication users (<username:password>,...")
|
||||||
cmd.Flags().BoolVar(&command.reserve, "reserve", false, "Reserve the service (don't free after exit)")
|
|
||||||
cmd.Run = command.run
|
cmd.Run = command.run
|
||||||
return command
|
return command
|
||||||
}
|
}
|
||||||
@ -91,7 +89,6 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) {
|
|||||||
BackendMode: "proxy",
|
BackendMode: "proxy",
|
||||||
BackendProxyEndpoint: cfg.EndpointAddress,
|
BackendProxyEndpoint: cfg.EndpointAddress,
|
||||||
AuthScheme: string(model.None),
|
AuthScheme: string(model.None),
|
||||||
Reserve: cmd.reserve,
|
|
||||||
}
|
}
|
||||||
if len(cmd.basicAuth) > 0 {
|
if len(cmd.basicAuth) > 0 {
|
||||||
logrus.Infof("configuring basic auth")
|
logrus.Infof("configuring basic auth")
|
||||||
|
@ -78,10 +78,6 @@ func (h *shareHandler) Handle(params service.ShareParams, principal *rest_model_
|
|||||||
|
|
||||||
logrus.Debugf("allocated service '%v'", svcToken)
|
logrus.Debugf("allocated service '%v'", svcToken)
|
||||||
|
|
||||||
reserved := false
|
|
||||||
if params.Body.Reserve {
|
|
||||||
reserved = true
|
|
||||||
}
|
|
||||||
sid, err := str.CreateService(envId, &store.Service{
|
sid, err := str.CreateService(envId, &store.Service{
|
||||||
ZId: svcZId,
|
ZId: svcZId,
|
||||||
Name: svcToken,
|
Name: svcToken,
|
||||||
@ -89,7 +85,7 @@ func (h *shareHandler) Handle(params service.ShareParams, principal *rest_model_
|
|||||||
BackendMode: params.Body.BackendMode,
|
BackendMode: params.Body.BackendMode,
|
||||||
FrontendEndpoint: &frontendEndpoints[0],
|
FrontendEndpoint: &frontendEndpoints[0],
|
||||||
BackendProxyEndpoint: ¶ms.Body.BackendProxyEndpoint,
|
BackendProxyEndpoint: ¶ms.Body.BackendProxyEndpoint,
|
||||||
Reserved: reserved,
|
Reserved: false,
|
||||||
}, tx)
|
}, tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("error creating service record: %v", err)
|
logrus.Errorf("error creating service record: %v", err)
|
||||||
|
150
rest_client_zrok/service/get_service_parameters.go
Normal file
150
rest_client_zrok/service/get_service_parameters.go
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package service
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
|
||||||
|
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetServiceParams creates a new GetServiceParams 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 NewGetServiceParams() *GetServiceParams {
|
||||||
|
return &GetServiceParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceParamsWithTimeout creates a new GetServiceParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetServiceParamsWithTimeout(timeout time.Duration) *GetServiceParams {
|
||||||
|
return &GetServiceParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceParamsWithContext creates a new GetServiceParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetServiceParamsWithContext(ctx context.Context) *GetServiceParams {
|
||||||
|
return &GetServiceParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceParamsWithHTTPClient creates a new GetServiceParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetServiceParamsWithHTTPClient(client *http.Client) *GetServiceParams {
|
||||||
|
return &GetServiceParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the get service operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetServiceParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *rest_model_zrok.ServiceRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get service params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetServiceParams) WithDefaults() *GetServiceParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get service params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetServiceParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get service params
|
||||||
|
func (o *GetServiceParams) WithTimeout(timeout time.Duration) *GetServiceParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get service params
|
||||||
|
func (o *GetServiceParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get service params
|
||||||
|
func (o *GetServiceParams) WithContext(ctx context.Context) *GetServiceParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get service params
|
||||||
|
func (o *GetServiceParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get service params
|
||||||
|
func (o *GetServiceParams) WithHTTPClient(client *http.Client) *GetServiceParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get service params
|
||||||
|
func (o *GetServiceParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the get service params
|
||||||
|
func (o *GetServiceParams) WithBody(body *rest_model_zrok.ServiceRequest) *GetServiceParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the get service params
|
||||||
|
func (o *GetServiceParams) SetBody(body *rest_model_zrok.ServiceRequest) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetServiceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.Body != nil {
|
||||||
|
if err := r.SetBodyParam(o.Body); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
269
rest_client_zrok/service/get_service_responses.go
Normal file
269
rest_client_zrok/service/get_service_responses.go
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package service
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetServiceReader is a Reader for the GetService structure.
|
||||||
|
type GetServiceReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetServiceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetServiceOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetServiceUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetServiceNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetServiceInternalServerError()
|
||||||
|
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())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceOK creates a GetServiceOK with default headers values
|
||||||
|
func NewGetServiceOK() *GetServiceOK {
|
||||||
|
return &GetServiceOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
ok
|
||||||
|
*/
|
||||||
|
type GetServiceOK struct {
|
||||||
|
Payload *rest_model_zrok.Service
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get service o k response has a 2xx status code
|
||||||
|
func (o *GetServiceOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get service o k response has a 3xx status code
|
||||||
|
func (o *GetServiceOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get service o k response has a 4xx status code
|
||||||
|
func (o *GetServiceOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get service o k response has a 5xx status code
|
||||||
|
func (o *GetServiceOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get service o k response a status code equal to that given
|
||||||
|
func (o *GetServiceOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /service][%d] getServiceOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceOK) String() string {
|
||||||
|
return fmt.Sprintf("[GET /service][%d] getServiceOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceOK) GetPayload() *rest_model_zrok.Service {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceOK) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceUnauthorized creates a GetServiceUnauthorized with default headers values
|
||||||
|
func NewGetServiceUnauthorized() *GetServiceUnauthorized {
|
||||||
|
return &GetServiceUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
unauthorized
|
||||||
|
*/
|
||||||
|
type GetServiceUnauthorized struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get service unauthorized response has a 2xx status code
|
||||||
|
func (o *GetServiceUnauthorized) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get service unauthorized response has a 3xx status code
|
||||||
|
func (o *GetServiceUnauthorized) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get service unauthorized response has a 4xx status code
|
||||||
|
func (o *GetServiceUnauthorized) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get service unauthorized response has a 5xx status code
|
||||||
|
func (o *GetServiceUnauthorized) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get service unauthorized response a status code equal to that given
|
||||||
|
func (o *GetServiceUnauthorized) IsCode(code int) bool {
|
||||||
|
return code == 401
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /service][%d] getServiceUnauthorized ", 401)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceUnauthorized) String() string {
|
||||||
|
return fmt.Sprintf("[GET /service][%d] getServiceUnauthorized ", 401)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceNotFound creates a GetServiceNotFound with default headers values
|
||||||
|
func NewGetServiceNotFound() *GetServiceNotFound {
|
||||||
|
return &GetServiceNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
not found
|
||||||
|
*/
|
||||||
|
type GetServiceNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get service not found response has a 2xx status code
|
||||||
|
func (o *GetServiceNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get service not found response has a 3xx status code
|
||||||
|
func (o *GetServiceNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get service not found response has a 4xx status code
|
||||||
|
func (o *GetServiceNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get service not found response has a 5xx status code
|
||||||
|
func (o *GetServiceNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get service not found response a status code equal to that given
|
||||||
|
func (o *GetServiceNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /service][%d] getServiceNotFound ", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[GET /service][%d] getServiceNotFound ", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceInternalServerError creates a GetServiceInternalServerError with default headers values
|
||||||
|
func NewGetServiceInternalServerError() *GetServiceInternalServerError {
|
||||||
|
return &GetServiceInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
internal server error
|
||||||
|
*/
|
||||||
|
type GetServiceInternalServerError struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this get service internal server error response has a 2xx status code
|
||||||
|
func (o *GetServiceInternalServerError) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this get service internal server error response has a 3xx status code
|
||||||
|
func (o *GetServiceInternalServerError) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this get service internal server error response has a 4xx status code
|
||||||
|
func (o *GetServiceInternalServerError) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this get service internal server error response has a 5xx status code
|
||||||
|
func (o *GetServiceInternalServerError) IsServerError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this get service internal server error response a status code equal to that given
|
||||||
|
func (o *GetServiceInternalServerError) IsCode(code int) bool {
|
||||||
|
return code == 500
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /service][%d] getServiceInternalServerError ", 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceInternalServerError) String() string {
|
||||||
|
return fmt.Sprintf("[GET /service][%d] getServiceInternalServerError ", 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetServiceInternalServerError) 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 {
|
||||||
Access(params *AccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccessCreated, error)
|
Access(params *AccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccessCreated, error)
|
||||||
|
|
||||||
|
GetService(params *GetServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServiceOK, error)
|
||||||
|
|
||||||
Share(params *ShareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ShareCreated, error)
|
Share(params *ShareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ShareCreated, error)
|
||||||
|
|
||||||
Unaccess(params *UnaccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnaccessOK, error)
|
Unaccess(params *UnaccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnaccessOK, error)
|
||||||
@ -80,6 +82,45 @@ func (a *Client) Access(params *AccessParams, authInfo runtime.ClientAuthInfoWri
|
|||||||
panic(msg)
|
panic(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetService get service API
|
||||||
|
*/
|
||||||
|
func (a *Client) GetService(params *GetServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServiceOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetServiceParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getService",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/service",
|
||||||
|
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetServiceReader{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.(*GetServiceOK)
|
||||||
|
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 getService: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Share share API
|
Share share API
|
||||||
*/
|
*/
|
||||||
|
71
rest_model_zrok/service03.go
Normal file
71
rest_model_zrok/service03.go
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package rest_model_zrok
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Service03 service03
|
||||||
|
//
|
||||||
|
// swagger:model service03
|
||||||
|
type Service03 struct {
|
||||||
|
|
||||||
|
// backend mode
|
||||||
|
BackendMode string `json:"backendMode,omitempty"`
|
||||||
|
|
||||||
|
// backend proxy endpoint
|
||||||
|
BackendProxyEndpoint string `json:"backendProxyEndpoint,omitempty"`
|
||||||
|
|
||||||
|
// frontend endpoint
|
||||||
|
FrontendEndpoint string `json:"frontendEndpoint,omitempty"`
|
||||||
|
|
||||||
|
// frontend selection
|
||||||
|
FrontendSelection string `json:"frontendSelection,omitempty"`
|
||||||
|
|
||||||
|
// reserved
|
||||||
|
Reserved bool `json:"reserved,omitempty"`
|
||||||
|
|
||||||
|
// share mode
|
||||||
|
ShareMode string `json:"shareMode,omitempty"`
|
||||||
|
|
||||||
|
// token
|
||||||
|
Token string `json:"token,omitempty"`
|
||||||
|
|
||||||
|
// z Id
|
||||||
|
ZID string `json:"zId,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this service03
|
||||||
|
func (m *Service03) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this service03 based on context it is used
|
||||||
|
func (m *Service03) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *Service03) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *Service03) UnmarshalBinary(b []byte) error {
|
||||||
|
var res Service03
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
50
rest_model_zrok/service_request.go
Normal file
50
rest_model_zrok/service_request.go
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package rest_model_zrok
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ServiceRequest service request
|
||||||
|
//
|
||||||
|
// swagger:model serviceRequest
|
||||||
|
type ServiceRequest struct {
|
||||||
|
|
||||||
|
// svc token
|
||||||
|
SvcToken string `json:"svcToken,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this service request
|
||||||
|
func (m *ServiceRequest) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this service request based on context it is used
|
||||||
|
func (m *ServiceRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *ServiceRequest) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *ServiceRequest) UnmarshalBinary(b []byte) error {
|
||||||
|
var res ServiceRequest
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
@ -40,9 +40,6 @@ type ShareRequest struct {
|
|||||||
// frontend selection
|
// frontend selection
|
||||||
FrontendSelection []string `json:"frontendSelection"`
|
FrontendSelection []string `json:"frontendSelection"`
|
||||||
|
|
||||||
// reserve
|
|
||||||
Reserve bool `json:"reserve,omitempty"`
|
|
||||||
|
|
||||||
// share mode
|
// share mode
|
||||||
// Enum: [public private]
|
// Enum: [public private]
|
||||||
ShareMode string `json:"shareMode,omitempty"`
|
ShareMode string `json:"shareMode,omitempty"`
|
||||||
|
@ -275,6 +275,45 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/service": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"key": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"service"
|
||||||
|
],
|
||||||
|
"operationId": "getService",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/serviceRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "ok",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/service"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "unauthorized"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "not found"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "internal server error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/share": {
|
"/share": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
@ -634,12 +673,49 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"service03": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"backendMode": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"backendProxyEndpoint": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"frontendEndpoint": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"frontendSelection": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"reserved": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"shareMode": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"zId": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"serviceMetrics": {
|
"serviceMetrics": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"serviceRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"svcToken": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@ -678,9 +754,6 @@ func init() {
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"reserve": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"shareMode": {
|
"shareMode": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
@ -1012,6 +1085,45 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/service": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"key": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"service"
|
||||||
|
],
|
||||||
|
"operationId": "getService",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/serviceRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "ok",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/service"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "unauthorized"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "not found"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "internal server error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/share": {
|
"/share": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
@ -1371,12 +1483,49 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"service03": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"backendMode": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"backendProxyEndpoint": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"frontendEndpoint": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"frontendSelection": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"reserved": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"shareMode": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"zId": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"serviceMetrics": {
|
"serviceMetrics": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"serviceRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"svcToken": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@ -1415,9 +1564,6 @@ func init() {
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"reserve": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"shareMode": {
|
"shareMode": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
|
71
rest_server_zrok/operations/service/get_service.go
Normal file
71
rest_server_zrok/operations/service/get_service.go
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package service
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetServiceHandlerFunc turns a function with the right signature into a get service handler
|
||||||
|
type GetServiceHandlerFunc func(GetServiceParams, *rest_model_zrok.Principal) middleware.Responder
|
||||||
|
|
||||||
|
// Handle executing the request and returning a response
|
||||||
|
func (fn GetServiceHandlerFunc) Handle(params GetServiceParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
|
return fn(params, principal)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServiceHandler interface for that can handle valid get service params
|
||||||
|
type GetServiceHandler interface {
|
||||||
|
Handle(GetServiceParams, *rest_model_zrok.Principal) middleware.Responder
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetService creates a new http.Handler for the get service operation
|
||||||
|
func NewGetService(ctx *middleware.Context, handler GetServiceHandler) *GetService {
|
||||||
|
return &GetService{Context: ctx, Handler: handler}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetService swagger:route GET /service service getService
|
||||||
|
|
||||||
|
GetService get service API
|
||||||
|
*/
|
||||||
|
type GetService struct {
|
||||||
|
Context *middleware.Context
|
||||||
|
Handler GetServiceHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetService) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||||
|
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||||
|
if rCtx != nil {
|
||||||
|
*r = *rCtx
|
||||||
|
}
|
||||||
|
var Params = NewGetServiceParams()
|
||||||
|
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,76 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package service
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
|
||||||
|
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetServiceParams creates a new GetServiceParams object
|
||||||
|
//
|
||||||
|
// There are no default values defined in the spec.
|
||||||
|
func NewGetServiceParams() GetServiceParams {
|
||||||
|
|
||||||
|
return GetServiceParams{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServiceParams contains all the bound params for the get service operation
|
||||||
|
// typically these are obtained from a http.Request
|
||||||
|
//
|
||||||
|
// swagger:parameters getService
|
||||||
|
type GetServiceParams struct {
|
||||||
|
|
||||||
|
// HTTP Request Object
|
||||||
|
HTTPRequest *http.Request `json:"-"`
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: body
|
||||||
|
*/
|
||||||
|
Body *rest_model_zrok.ServiceRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 NewGetServiceParams() beforehand.
|
||||||
|
func (o *GetServiceParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
o.HTTPRequest = r
|
||||||
|
|
||||||
|
if runtime.HasBody(r) {
|
||||||
|
defer r.Body.Close()
|
||||||
|
var body rest_model_zrok.ServiceRequest
|
||||||
|
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
|
||||||
|
}
|
134
rest_server_zrok/operations/service/get_service_responses.go
Normal file
134
rest_server_zrok/operations/service/get_service_responses.go
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package service
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetServiceOKCode is the HTTP code returned for type GetServiceOK
|
||||||
|
const GetServiceOKCode int = 200
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceOK ok
|
||||||
|
|
||||||
|
swagger:response getServiceOK
|
||||||
|
*/
|
||||||
|
type GetServiceOK struct {
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: Body
|
||||||
|
*/
|
||||||
|
Payload *rest_model_zrok.Service `json:"body,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceOK creates GetServiceOK with default headers values
|
||||||
|
func NewGetServiceOK() *GetServiceOK {
|
||||||
|
|
||||||
|
return &GetServiceOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPayload adds the payload to the get service o k response
|
||||||
|
func (o *GetServiceOK) WithPayload(payload *rest_model_zrok.Service) *GetServiceOK {
|
||||||
|
o.Payload = payload
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPayload sets the payload to the get service o k response
|
||||||
|
func (o *GetServiceOK) SetPayload(payload *rest_model_zrok.Service) {
|
||||||
|
o.Payload = payload
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetServiceOK) 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServiceUnauthorizedCode is the HTTP code returned for type GetServiceUnauthorized
|
||||||
|
const GetServiceUnauthorizedCode int = 401
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceUnauthorized unauthorized
|
||||||
|
|
||||||
|
swagger:response getServiceUnauthorized
|
||||||
|
*/
|
||||||
|
type GetServiceUnauthorized struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceUnauthorized creates GetServiceUnauthorized with default headers values
|
||||||
|
func NewGetServiceUnauthorized() *GetServiceUnauthorized {
|
||||||
|
|
||||||
|
return &GetServiceUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetServiceUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||||
|
|
||||||
|
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||||
|
|
||||||
|
rw.WriteHeader(401)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServiceNotFoundCode is the HTTP code returned for type GetServiceNotFound
|
||||||
|
const GetServiceNotFoundCode int = 404
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceNotFound not found
|
||||||
|
|
||||||
|
swagger:response getServiceNotFound
|
||||||
|
*/
|
||||||
|
type GetServiceNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceNotFound creates GetServiceNotFound with default headers values
|
||||||
|
func NewGetServiceNotFound() *GetServiceNotFound {
|
||||||
|
|
||||||
|
return &GetServiceNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetServiceNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||||
|
|
||||||
|
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||||
|
|
||||||
|
rw.WriteHeader(404)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServiceInternalServerErrorCode is the HTTP code returned for type GetServiceInternalServerError
|
||||||
|
const GetServiceInternalServerErrorCode int = 500
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetServiceInternalServerError internal server error
|
||||||
|
|
||||||
|
swagger:response getServiceInternalServerError
|
||||||
|
*/
|
||||||
|
type GetServiceInternalServerError struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetServiceInternalServerError creates GetServiceInternalServerError with default headers values
|
||||||
|
func NewGetServiceInternalServerError() *GetServiceInternalServerError {
|
||||||
|
|
||||||
|
return &GetServiceInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteResponse to the client
|
||||||
|
func (o *GetServiceInternalServerError) 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 service
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetServiceURL generates an URL for the get service operation
|
||||||
|
type GetServiceURL 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 *GetServiceURL) WithBasePath(bp string) *GetServiceURL {
|
||||||
|
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 *GetServiceURL) SetBasePath(bp string) {
|
||||||
|
o._basePath = bp
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build a url path and query string
|
||||||
|
func (o *GetServiceURL) Build() (*url.URL, error) {
|
||||||
|
var _result url.URL
|
||||||
|
|
||||||
|
var _path = "/service"
|
||||||
|
|
||||||
|
_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 *GetServiceURL) 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 *GetServiceURL) String() string {
|
||||||
|
return o.Must(o.Build()).String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildFull builds a full url with scheme, host, path and query string
|
||||||
|
func (o *GetServiceURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||||
|
if scheme == "" {
|
||||||
|
return nil, errors.New("scheme is required for a full url on GetServiceURL")
|
||||||
|
}
|
||||||
|
if host == "" {
|
||||||
|
return nil, errors.New("host is required for a full url on GetServiceURL")
|
||||||
|
}
|
||||||
|
|
||||||
|
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 *GetServiceURL) StringFull(scheme, host string) string {
|
||||||
|
return o.Must(o.BuildFull(scheme, host)).String()
|
||||||
|
}
|
@ -59,6 +59,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
|||||||
IdentityEnableHandler: identity.EnableHandlerFunc(func(params identity.EnableParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
IdentityEnableHandler: identity.EnableHandlerFunc(func(params identity.EnableParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
return middleware.NotImplemented("operation identity.Enable has not yet been implemented")
|
return middleware.NotImplemented("operation identity.Enable has not yet been implemented")
|
||||||
}),
|
}),
|
||||||
|
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")
|
||||||
|
}),
|
||||||
IdentityLoginHandler: identity.LoginHandlerFunc(func(params identity.LoginParams) middleware.Responder {
|
IdentityLoginHandler: identity.LoginHandlerFunc(func(params identity.LoginParams) middleware.Responder {
|
||||||
return middleware.NotImplemented("operation identity.Login has not yet been implemented")
|
return middleware.NotImplemented("operation identity.Login has not yet been implemented")
|
||||||
}),
|
}),
|
||||||
@ -141,6 +144,8 @@ type ZrokAPI struct {
|
|||||||
IdentityDisableHandler identity.DisableHandler
|
IdentityDisableHandler identity.DisableHandler
|
||||||
// IdentityEnableHandler sets the operation handler for the enable operation
|
// IdentityEnableHandler sets the operation handler for the enable operation
|
||||||
IdentityEnableHandler identity.EnableHandler
|
IdentityEnableHandler identity.EnableHandler
|
||||||
|
// ServiceGetServiceHandler sets the operation handler for the get service operation
|
||||||
|
ServiceGetServiceHandler service.GetServiceHandler
|
||||||
// IdentityLoginHandler sets the operation handler for the login operation
|
// IdentityLoginHandler sets the operation handler for the login operation
|
||||||
IdentityLoginHandler identity.LoginHandler
|
IdentityLoginHandler identity.LoginHandler
|
||||||
// MetadataOverviewHandler sets the operation handler for the overview operation
|
// MetadataOverviewHandler sets the operation handler for the overview operation
|
||||||
@ -250,6 +255,9 @@ func (o *ZrokAPI) Validate() error {
|
|||||||
if o.IdentityEnableHandler == nil {
|
if o.IdentityEnableHandler == nil {
|
||||||
unregistered = append(unregistered, "identity.EnableHandler")
|
unregistered = append(unregistered, "identity.EnableHandler")
|
||||||
}
|
}
|
||||||
|
if o.ServiceGetServiceHandler == nil {
|
||||||
|
unregistered = append(unregistered, "service.GetServiceHandler")
|
||||||
|
}
|
||||||
if o.IdentityLoginHandler == nil {
|
if o.IdentityLoginHandler == nil {
|
||||||
unregistered = append(unregistered, "identity.LoginHandler")
|
unregistered = append(unregistered, "identity.LoginHandler")
|
||||||
}
|
}
|
||||||
@ -389,6 +397,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
|||||||
o.handlers["POST"] = make(map[string]http.Handler)
|
o.handlers["POST"] = make(map[string]http.Handler)
|
||||||
}
|
}
|
||||||
o.handlers["POST"]["/enable"] = identity.NewEnable(o.context, o.IdentityEnableHandler)
|
o.handlers["POST"]["/enable"] = identity.NewEnable(o.context, o.IdentityEnableHandler)
|
||||||
|
if o.handlers["GET"] == nil {
|
||||||
|
o.handlers["GET"] = make(map[string]http.Handler)
|
||||||
|
}
|
||||||
|
o.handlers["GET"]["/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)
|
||||||
}
|
}
|
||||||
|
@ -203,21 +203,23 @@ paths:
|
|||||||
500:
|
500:
|
||||||
description: internal server error
|
description: internal server error
|
||||||
|
|
||||||
/unaccess:
|
/service:
|
||||||
delete:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- service
|
- service
|
||||||
security:
|
security:
|
||||||
- key: []
|
- key: []
|
||||||
operationId: unaccess
|
operationId: getService
|
||||||
parameters:
|
parameters:
|
||||||
- name: body
|
- name: body
|
||||||
in: body
|
in: body
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/unaccessRequest"
|
$ref: "#/definitions/serviceRequest"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: access removed
|
description: ok
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/service"
|
||||||
401:
|
401:
|
||||||
description: unauthorized
|
description: unauthorized
|
||||||
404:
|
404:
|
||||||
@ -249,6 +251,28 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/errorMessage"
|
$ref: "#/definitions/errorMessage"
|
||||||
|
|
||||||
|
/unaccess:
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- service
|
||||||
|
security:
|
||||||
|
- key: []
|
||||||
|
operationId: unaccess
|
||||||
|
parameters:
|
||||||
|
- name: body
|
||||||
|
in: body
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/unaccessRequest"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: access removed
|
||||||
|
401:
|
||||||
|
description: unauthorized
|
||||||
|
404:
|
||||||
|
description: not found
|
||||||
|
500:
|
||||||
|
description: internal server error
|
||||||
|
|
||||||
/unshare:
|
/unshare:
|
||||||
delete:
|
delete:
|
||||||
tags:
|
tags:
|
||||||
@ -397,6 +421,26 @@ definitions:
|
|||||||
token:
|
token:
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
service03:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
token:
|
||||||
|
type: string
|
||||||
|
zId:
|
||||||
|
type: string
|
||||||
|
shareMode:
|
||||||
|
type: string
|
||||||
|
backendMode:
|
||||||
|
type: string
|
||||||
|
frontendSelection:
|
||||||
|
type: string
|
||||||
|
frontendEndpoint:
|
||||||
|
type: string
|
||||||
|
backendProxyEndpoint:
|
||||||
|
type: string
|
||||||
|
reserved:
|
||||||
|
type: boolean
|
||||||
|
|
||||||
service:
|
service:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@ -425,6 +469,12 @@ definitions:
|
|||||||
items:
|
items:
|
||||||
type: integer
|
type: integer
|
||||||
|
|
||||||
|
serviceRequest:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
svcToken:
|
||||||
|
type: string
|
||||||
|
|
||||||
shareRequest:
|
shareRequest:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@ -448,8 +498,6 @@ definitions:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/authUser"
|
$ref: "#/definitions/authUser"
|
||||||
reserve:
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
shareResponse:
|
shareResponse:
|
||||||
type: object
|
type: object
|
||||||
|
@ -19,17 +19,17 @@ export function access(options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {object} options Optional options
|
* @param {object} options Optional options
|
||||||
* @param {module:types.unaccessRequest} [options.body]
|
* @param {module:types.serviceRequest} [options.body]
|
||||||
* @return {Promise<object>} access removed
|
* @return {Promise<module:types.service>} ok
|
||||||
*/
|
*/
|
||||||
export function unaccess(options) {
|
export function getService(options) {
|
||||||
if (!options) options = {}
|
if (!options) options = {}
|
||||||
const parameters = {
|
const parameters = {
|
||||||
body: {
|
body: {
|
||||||
body: options.body
|
body: options.body
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gateway.request(unaccessOperation, parameters)
|
return gateway.request(getServiceOperation, parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,6 +47,21 @@ export function share(options) {
|
|||||||
return gateway.request(shareOperation, parameters)
|
return gateway.request(shareOperation, parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {object} options Optional options
|
||||||
|
* @param {module:types.unaccessRequest} [options.body]
|
||||||
|
* @return {Promise<object>} access removed
|
||||||
|
*/
|
||||||
|
export function unaccess(options) {
|
||||||
|
if (!options) options = {}
|
||||||
|
const parameters = {
|
||||||
|
body: {
|
||||||
|
body: options.body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gateway.request(unaccessOperation, parameters)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {object} options Optional options
|
* @param {object} options Optional options
|
||||||
* @param {module:types.unshareRequest} [options.body]
|
* @param {module:types.unshareRequest} [options.body]
|
||||||
@ -73,10 +88,10 @@ const accessOperation = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
const unaccessOperation = {
|
const getServiceOperation = {
|
||||||
path: '/unaccess',
|
path: '/service',
|
||||||
contentTypes: ['application/zrok.v1+json'],
|
contentTypes: ['application/zrok.v1+json'],
|
||||||
method: 'delete',
|
method: 'get',
|
||||||
security: [
|
security: [
|
||||||
{
|
{
|
||||||
id: 'key'
|
id: 'key'
|
||||||
@ -95,6 +110,17 @@ const shareOperation = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const unaccessOperation = {
|
||||||
|
path: '/unaccess',
|
||||||
|
contentTypes: ['application/zrok.v1+json'],
|
||||||
|
method: 'delete',
|
||||||
|
security: [
|
||||||
|
{
|
||||||
|
id: 'key'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
const unshareOperation = {
|
const unshareOperation = {
|
||||||
path: '/unshare',
|
path: '/unshare',
|
||||||
contentTypes: ['application/zrok.v1+json'],
|
contentTypes: ['application/zrok.v1+json'],
|
||||||
|
@ -107,6 +107,20 @@
|
|||||||
* @property {string} token
|
* @property {string} token
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef service03
|
||||||
|
* @memberof module:types
|
||||||
|
*
|
||||||
|
* @property {string} token
|
||||||
|
* @property {string} zId
|
||||||
|
* @property {string} shareMode
|
||||||
|
* @property {string} backendMode
|
||||||
|
* @property {string} frontendSelection
|
||||||
|
* @property {string} frontendEndpoint
|
||||||
|
* @property {string} backendProxyEndpoint
|
||||||
|
* @property {boolean} reserved
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef service
|
* @typedef service
|
||||||
* @memberof module:types
|
* @memberof module:types
|
||||||
@ -120,6 +134,13 @@
|
|||||||
* @property {number} updatedAt
|
* @property {number} updatedAt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef serviceRequest
|
||||||
|
* @memberof module:types
|
||||||
|
*
|
||||||
|
* @property {string} svcToken
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef shareRequest
|
* @typedef shareRequest
|
||||||
* @memberof module:types
|
* @memberof module:types
|
||||||
@ -131,7 +152,6 @@
|
|||||||
* @property {string} backendProxyEndpoint
|
* @property {string} backendProxyEndpoint
|
||||||
* @property {string} authScheme
|
* @property {string} authScheme
|
||||||
* @property {module:types.authUser[]} authUsers
|
* @property {module:types.authUser[]} authUsers
|
||||||
* @property {boolean} reserve
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user