tunnel -> service; tunnel.Tunnel -> service.Share; tunnel.Untunnel -> service.Unshare (#102)

This commit is contained in:
Michael Quigley 2022-11-18 15:36:55 -05:00
parent 70c99b9791
commit 11068394b8
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
33 changed files with 1338 additions and 1320 deletions

View File

@ -10,7 +10,7 @@ import (
"github.com/openziti-test-kitchen/zrok/endpoints/backend" "github.com/openziti-test-kitchen/zrok/endpoints/backend"
"github.com/openziti-test-kitchen/zrok/model" "github.com/openziti-test-kitchen/zrok/model"
"github.com/openziti-test-kitchen/zrok/rest_client_zrok" "github.com/openziti-test-kitchen/zrok/rest_client_zrok"
"github.com/openziti-test-kitchen/zrok/rest_client_zrok/tunnel" "github.com/openziti-test-kitchen/zrok/rest_client_zrok/service"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti-test-kitchen/zrok/rest_model_zrok"
"github.com/openziti-test-kitchen/zrok/zrokdir" "github.com/openziti-test-kitchen/zrok/zrokdir"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -101,8 +101,8 @@ func (self *httpBackendCommand) run(_ *cobra.Command, args []string) {
panic(err) panic(err)
} }
auth := httptransport.APIKeyAuth("X-TOKEN", "header", env.Token) auth := httptransport.APIKeyAuth("X-TOKEN", "header", env.Token)
req := tunnel.NewTunnelParams() req := service.NewShareParams()
req.Body = &rest_model_zrok.TunnelRequest{ req.Body = &rest_model_zrok.ShareRequest{
ZID: env.ZId, ZID: env.ZId,
Endpoint: cfg.EndpointAddress, Endpoint: cfg.EndpointAddress,
AuthScheme: string(model.None), AuthScheme: string(model.None),
@ -119,7 +119,7 @@ func (self *httpBackendCommand) run(_ *cobra.Command, args []string) {
} }
} }
} }
resp, err := zrok.Tunnel.Tunnel(req, auth) resp, err := zrok.Service.Share(req, auth)
if err != nil { if err != nil {
ui.Close() ui.Close()
if !panicInstead { if !panicInstead {
@ -225,12 +225,12 @@ func (self *httpBackendCommand) run(_ *cobra.Command, args []string) {
func (self *httpBackendCommand) destroy(id string, cfg *backend.Config, zrok *rest_client_zrok.Zrok, auth runtime.ClientAuthInfoWriter) { func (self *httpBackendCommand) destroy(id string, cfg *backend.Config, zrok *rest_client_zrok.Zrok, auth runtime.ClientAuthInfoWriter) {
logrus.Debugf("shutting down '%v'", cfg.Service) logrus.Debugf("shutting down '%v'", cfg.Service)
req := tunnel.NewUntunnelParams() req := service.NewUnshareParams()
req.Body = &rest_model_zrok.UntunnelRequest{ req.Body = &rest_model_zrok.UnshareRequest{
ZID: id, ZID: id,
SvcName: cfg.Service, SvcName: cfg.Service,
} }
if _, err := zrok.Tunnel.Untunnel(req, auth); err == nil { if _, err := zrok.Service.Unshare(req, auth); err == nil {
logrus.Debugf("shutdown complete") logrus.Debugf("shutdown complete")
} else { } else {
logrus.Errorf("error shutting down: %v", err) logrus.Errorf("error shutting down: %v", err)

View File

@ -8,7 +8,7 @@ import (
httptransport "github.com/go-openapi/runtime/client" httptransport "github.com/go-openapi/runtime/client"
"github.com/openziti-test-kitchen/zrok/model" "github.com/openziti-test-kitchen/zrok/model"
"github.com/openziti-test-kitchen/zrok/rest_client_zrok" "github.com/openziti-test-kitchen/zrok/rest_client_zrok"
"github.com/openziti-test-kitchen/zrok/rest_client_zrok/tunnel" "github.com/openziti-test-kitchen/zrok/rest_client_zrok/service"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti-test-kitchen/zrok/rest_model_zrok"
"github.com/openziti-test-kitchen/zrok/util" "github.com/openziti-test-kitchen/zrok/util"
"github.com/openziti-test-kitchen/zrok/zrokdir" "github.com/openziti-test-kitchen/zrok/zrokdir"
@ -182,14 +182,14 @@ func (l *looper) startup() {
panic(err) panic(err)
} }
l.auth = httptransport.APIKeyAuth("x-token", "header", l.env.Token) l.auth = httptransport.APIKeyAuth("x-token", "header", l.env.Token)
tunnelReq := tunnel.NewTunnelParams() tunnelReq := service.NewShareParams()
tunnelReq.Body = &rest_model_zrok.TunnelRequest{ tunnelReq.Body = &rest_model_zrok.ShareRequest{
ZID: l.env.ZId, ZID: l.env.ZId,
Endpoint: fmt.Sprintf("looper#%d", l.id), Endpoint: fmt.Sprintf("looper#%d", l.id),
AuthScheme: string(model.None), AuthScheme: string(model.None),
} }
tunnelReq.SetTimeout(60 * time.Second) tunnelReq.SetTimeout(60 * time.Second)
tunnelResp, err := l.zrok.Tunnel.Tunnel(tunnelReq, l.auth) tunnelResp, err := l.zrok.Service.Share(tunnelReq, l.auth)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -255,12 +255,12 @@ func (l *looper) shutdown() {
} }
} }
untunnelReq := tunnel.NewUntunnelParams() untunnelReq := service.NewUnshareParams()
untunnelReq.Body = &rest_model_zrok.UntunnelRequest{ untunnelReq.Body = &rest_model_zrok.UnshareRequest{
ZID: l.env.ZId, ZID: l.env.ZId,
SvcName: l.service, SvcName: l.service,
} }
if _, err := l.zrok.Tunnel.Untunnel(untunnelReq, l.auth); err != nil { if _, err := l.zrok.Service.Unshare(untunnelReq, l.auth); err != nil {
logrus.Errorf("error shutting down looper #%d: %v", l.id, err) logrus.Errorf("error shutting down looper #%d: %v", l.id, err)
} }
} }

View File

@ -34,8 +34,8 @@ func Run(inCfg *Config) error {
api.IdentityVerifyHandler = newVerifyHandler() api.IdentityVerifyHandler = newVerifyHandler()
api.MetadataOverviewHandler = metadata.OverviewHandlerFunc(overviewHandler) api.MetadataOverviewHandler = metadata.OverviewHandlerFunc(overviewHandler)
api.MetadataVersionHandler = metadata.VersionHandlerFunc(versionHandler) api.MetadataVersionHandler = metadata.VersionHandlerFunc(versionHandler)
api.TunnelTunnelHandler = newTunnelHandler() api.ServiceShareHandler = newShareHandler()
api.TunnelUntunnelHandler = newUntunnelHandler() api.ServiceUnshareHandler = newUnshareHandler()
if err := controllerStartup(); err != nil { if err := controllerStartup(); err != nil {
return err return err

View File

@ -8,10 +8,10 @@ import (
"github.com/openziti-test-kitchen/zrok/controller/store" "github.com/openziti-test-kitchen/zrok/controller/store"
"github.com/openziti-test-kitchen/zrok/model" "github.com/openziti-test-kitchen/zrok/model"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti-test-kitchen/zrok/rest_model_zrok"
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/tunnel" "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/service"
"github.com/openziti/edge/rest_management_api_client" "github.com/openziti/edge/rest_management_api_client"
"github.com/openziti/edge/rest_management_api_client/config" "github.com/openziti/edge/rest_management_api_client/config"
"github.com/openziti/edge/rest_management_api_client/service" edge_service "github.com/openziti/edge/rest_management_api_client/service"
"github.com/openziti/edge/rest_management_api_client/service_edge_router_policy" "github.com/openziti/edge/rest_management_api_client/service_edge_router_policy"
"github.com/openziti/edge/rest_management_api_client/service_policy" "github.com/openziti/edge/rest_management_api_client/service_policy"
"github.com/openziti/edge/rest_model" "github.com/openziti/edge/rest_model"
@ -20,18 +20,18 @@ import (
"time" "time"
) )
type tunnelHandler struct { type shareHandler struct {
} }
func newTunnelHandler() *tunnelHandler { func newShareHandler() *shareHandler {
return &tunnelHandler{} return &shareHandler{}
} }
func (h *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_model_zrok.Principal) middleware.Responder { func (h *shareHandler) Handle(params service.ShareParams, principal *rest_model_zrok.Principal) middleware.Responder {
tx, err := str.Begin() tx, err := str.Begin()
if err != nil { if err != nil {
logrus.Errorf("error starting transaction: %v", err) logrus.Errorf("error starting transaction: %v", err)
return tunnel.NewTunnelInternalServerError() return service.NewShareInternalServerError()
} }
defer func() { _ = tx.Rollback() }() defer func() { _ = tx.Rollback() }()
@ -49,44 +49,44 @@ func (h *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_model
} }
if !found { if !found {
logrus.Errorf("environment '%v' not found for user '%v'", envZId, principal.Email) logrus.Errorf("environment '%v' not found for user '%v'", envZId, principal.Email)
return tunnel.NewTunnelUnauthorized().WithPayload("bad environment identity") return service.NewShareUnauthorized()
} }
} else { } else {
logrus.Errorf("error finding environments for account '%v'", principal.Email) logrus.Errorf("error finding environments for account '%v'", principal.Email)
return tunnel.NewTunnelInternalServerError() return service.NewShareInternalServerError()
} }
edge, err := edgeClient() edge, err := edgeClient()
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewTunnelInternalServerError() return service.NewShareInternalServerError()
} }
svcName, err := createServiceName() svcName, err := createServiceName()
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewTunnelInternalServerError() return service.NewShareInternalServerError()
} }
cfgId, err := h.createConfig(envZId, svcName, params, edge) cfgId, err := h.createConfig(envZId, svcName, params, edge)
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewTunnelInternalServerError() return service.NewShareInternalServerError()
} }
svcZId, err := h.createService(envZId, svcName, cfgId, edge) svcZId, err := h.createService(envZId, svcName, cfgId, edge)
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewTunnelInternalServerError() return service.NewShareInternalServerError()
} }
if err := h.createServicePolicyBind(envZId, svcName, svcZId, envZId, edge); err != nil { if err := h.createServicePolicyBind(envZId, svcName, svcZId, envZId, edge); err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewTunnelInternalServerError() return service.NewShareInternalServerError()
} }
if err := h.createServicePolicyDial(envZId, svcName, svcZId, edge); err != nil { if err := h.createServicePolicyDial(envZId, svcName, svcZId, edge); err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewTunnelInternalServerError() return service.NewShareInternalServerError()
} }
if err := h.createServiceEdgeRouterPolicy(envZId, svcName, svcZId, edge); err != nil { if err := h.createServiceEdgeRouterPolicy(envZId, svcName, svcZId, edge); err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewTunnelInternalServerError() return service.NewShareInternalServerError()
} }
logrus.Debugf("allocated service '%v'", svcName) logrus.Debugf("allocated service '%v'", svcName)
@ -101,21 +101,21 @@ func (h *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_model
if err != nil { if err != nil {
logrus.Errorf("error creating service record: %v", err) logrus.Errorf("error creating service record: %v", err)
_ = tx.Rollback() _ = tx.Rollback()
return tunnel.NewUntunnelInternalServerError() return service.NewShareInternalServerError()
} }
if err := tx.Commit(); err != nil { if err := tx.Commit(); err != nil {
logrus.Errorf("error committing service record: %v", err) logrus.Errorf("error committing service record: %v", err)
return tunnel.NewTunnelInternalServerError() return service.NewShareInternalServerError()
} }
logrus.Infof("recorded service '%v' with id '%v' for '%v'", svcName, sid, principal.Email) logrus.Infof("recorded service '%v' with id '%v' for '%v'", svcName, sid, principal.Email)
return tunnel.NewTunnelCreated().WithPayload(&rest_model_zrok.TunnelResponse{ return service.NewShareCreated().WithPayload(&rest_model_zrok.ShareResponse{
ProxyEndpoint: frontendUrl, ProxyEndpoint: frontendUrl,
SvcName: svcName, SvcName: svcName,
}) })
} }
func (h *tunnelHandler) createConfig(envZId, svcName string, params tunnel.TunnelParams, edge *rest_management_api_client.ZitiEdgeManagement) (cfgID string, err error) { func (h *shareHandler) createConfig(envZId, svcName string, params service.ShareParams, edge *rest_management_api_client.ZitiEdgeManagement) (cfgID string, err error) {
authScheme, err := model.ParseAuthScheme(params.Body.AuthScheme) authScheme, err := model.ParseAuthScheme(params.Body.AuthScheme)
if err != nil { if err != nil {
return "", err return "", err
@ -148,7 +148,7 @@ func (h *tunnelHandler) createConfig(envZId, svcName string, params tunnel.Tunne
return cfgResp.Payload.Data.ID, nil return cfgResp.Payload.Data.ID, nil
} }
func (h *tunnelHandler) createService(envZId, svcName, cfgId string, edge *rest_management_api_client.ZitiEdgeManagement) (serviceId string, err error) { func (h *shareHandler) createService(envZId, svcName, cfgId string, edge *rest_management_api_client.ZitiEdgeManagement) (serviceId string, err error) {
configs := []string{cfgId} configs := []string{cfgId}
encryptionRequired := true encryptionRequired := true
svc := &rest_model.ServiceCreate{ svc := &rest_model.ServiceCreate{
@ -157,7 +157,7 @@ func (h *tunnelHandler) createService(envZId, svcName, cfgId string, edge *rest_
Name: &svcName, Name: &svcName,
Tags: h.zrokTags(svcName), Tags: h.zrokTags(svcName),
} }
req := &service.CreateServiceParams{ req := &edge_service.CreateServiceParams{
Service: svc, Service: svc,
Context: context.Background(), Context: context.Background(),
} }
@ -170,7 +170,7 @@ func (h *tunnelHandler) createService(envZId, svcName, cfgId string, edge *rest_
return resp.Payload.Data.ID, nil return resp.Payload.Data.ID, nil
} }
func (h *tunnelHandler) createServicePolicyBind(envZId, svcName, svcZId, envId string, edge *rest_management_api_client.ZitiEdgeManagement) error { func (h *shareHandler) createServicePolicyBind(envZId, svcName, svcZId, envId string, edge *rest_management_api_client.ZitiEdgeManagement) error {
semantic := rest_model.SemanticAllOf semantic := rest_model.SemanticAllOf
identityRoles := []string{fmt.Sprintf("@%v", envId)} identityRoles := []string{fmt.Sprintf("@%v", envId)}
name := fmt.Sprintf("%v-backend", svcName) name := fmt.Sprintf("%v-backend", svcName)
@ -199,7 +199,7 @@ func (h *tunnelHandler) createServicePolicyBind(envZId, svcName, svcZId, envId s
return nil return nil
} }
func (h *tunnelHandler) createServicePolicyDial(envZId, svcName, svcZId string, edge *rest_management_api_client.ZitiEdgeManagement) error { func (h *shareHandler) createServicePolicyDial(envZId, svcName, svcZId string, edge *rest_management_api_client.ZitiEdgeManagement) error {
var identityRoles []string var identityRoles []string
for _, proxyIdentity := range cfg.Proxy.Identities { for _, proxyIdentity := range cfg.Proxy.Identities {
identityRoles = append(identityRoles, "@"+proxyIdentity) identityRoles = append(identityRoles, "@"+proxyIdentity)
@ -232,7 +232,7 @@ func (h *tunnelHandler) createServicePolicyDial(envZId, svcName, svcZId string,
return nil return nil
} }
func (h *tunnelHandler) createServiceEdgeRouterPolicy(envZId, svcName, svcZId string, edge *rest_management_api_client.ZitiEdgeManagement) error { func (h *shareHandler) createServiceEdgeRouterPolicy(envZId, svcName, svcZId string, edge *rest_management_api_client.ZitiEdgeManagement) error {
edgeRouterRoles := []string{"#all"} edgeRouterRoles := []string{"#all"}
semantic := rest_model.SemanticAllOf semantic := rest_model.SemanticAllOf
serviceRoles := []string{fmt.Sprintf("@%v", svcZId)} serviceRoles := []string{fmt.Sprintf("@%v", svcZId)}
@ -256,11 +256,11 @@ func (h *tunnelHandler) createServiceEdgeRouterPolicy(envZId, svcName, svcZId st
return nil return nil
} }
func (h *tunnelHandler) proxyUrl(svcName string) string { func (h *shareHandler) proxyUrl(svcName string) string {
return strings.Replace(cfg.Proxy.UrlTemplate, "{svcName}", svcName, -1) return strings.Replace(cfg.Proxy.UrlTemplate, "{svcName}", svcName, -1)
} }
func (h *tunnelHandler) zrokTags(svcName string) *rest_model.Tags { func (h *shareHandler) zrokTags(svcName string) *rest_model.Tags {
return &rest_model.Tags{ return &rest_model.Tags{
SubTags: map[string]interface{}{ SubTags: map[string]interface{}{
"zrok": build.String(), "zrok": build.String(),

View File

@ -6,39 +6,39 @@ import (
"github.com/go-openapi/runtime/middleware" "github.com/go-openapi/runtime/middleware"
"github.com/openziti-test-kitchen/zrok/controller/store" "github.com/openziti-test-kitchen/zrok/controller/store"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti-test-kitchen/zrok/rest_model_zrok"
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/tunnel" "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/service"
"github.com/openziti/edge/rest_management_api_client" "github.com/openziti/edge/rest_management_api_client"
"github.com/openziti/edge/rest_management_api_client/service" edge_service "github.com/openziti/edge/rest_management_api_client/service"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"time" "time"
) )
type untunnelHandler struct { type unshareHandler struct {
} }
func newUntunnelHandler() *untunnelHandler { func newUnshareHandler() *unshareHandler {
return &untunnelHandler{} return &unshareHandler{}
} }
func (h *untunnelHandler) Handle(params tunnel.UntunnelParams, principal *rest_model_zrok.Principal) middleware.Responder { func (h *unshareHandler) Handle(params service.UnshareParams, principal *rest_model_zrok.Principal) middleware.Responder {
tx, err := str.Begin() tx, err := str.Begin()
if err != nil { if err != nil {
logrus.Errorf("error starting transaction: %v", err) logrus.Errorf("error starting transaction: %v", err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
defer func() { _ = tx.Rollback() }() defer func() { _ = tx.Rollback() }()
edge, err := edgeClient() edge, err := edgeClient()
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
svcName := params.Body.SvcName svcName := params.Body.SvcName
svcZId, err := h.findServiceZId(svcName, edge) svcZId, err := h.findServiceZId(svcName, edge)
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
var senv *store.Environment var senv *store.Environment
if envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx); err == nil { if envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx); err == nil {
@ -51,11 +51,11 @@ func (h *untunnelHandler) Handle(params tunnel.UntunnelParams, principal *rest_m
if senv == nil { if senv == nil {
err := errors.Errorf("environment with id '%v' not found for '%v", params.Body.ZID, principal.Email) err := errors.Errorf("environment with id '%v' not found for '%v", params.Body.ZID, principal.Email)
logrus.Error(err) logrus.Error(err)
return tunnel.NewUntunnelNotFound() return service.NewUnshareNotFound()
} }
} else { } else {
logrus.Errorf("error finding environments for account '%v': %v", principal.Email, err) logrus.Errorf("error finding environments for account '%v': %v", principal.Email, err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
var ssvc *store.Service var ssvc *store.Service
@ -69,53 +69,53 @@ func (h *untunnelHandler) Handle(params tunnel.UntunnelParams, principal *rest_m
if ssvc == nil { if ssvc == nil {
err := errors.Errorf("service with id '%v' not found for '%v'", svcZId, principal.Email) err := errors.Errorf("service with id '%v' not found for '%v'", svcZId, principal.Email)
logrus.Error(err) logrus.Error(err)
return tunnel.NewUntunnelNotFound() return service.NewUnshareNotFound()
} }
} else { } else {
logrus.Errorf("error finding services for account '%v': %v", principal.Email, err) logrus.Errorf("error finding services for account '%v': %v", principal.Email, err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
if err := deleteServiceEdgeRouterPolicy(senv.ZId, svcName, edge); err != nil { if err := deleteServiceEdgeRouterPolicy(senv.ZId, svcName, edge); err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
if err := deleteServicePolicyDial(senv.ZId, svcName, edge); err != nil { if err := deleteServicePolicyDial(senv.ZId, svcName, edge); err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
if err := deleteServicePolicyBind(senv.ZId, svcName, edge); err != nil { if err := deleteServicePolicyBind(senv.ZId, svcName, edge); err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
if err := deleteConfig(senv.ZId, svcName, edge); err != nil { if err := deleteConfig(senv.ZId, svcName, edge); err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewTunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
if err := deleteService(senv.ZId, svcZId, edge); err != nil { if err := deleteService(senv.ZId, svcZId, edge); err != nil {
logrus.Error(err) logrus.Error(err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
logrus.Debugf("deallocated service '%v'", svcName) logrus.Debugf("deallocated service '%v'", svcName)
if err := str.DeleteService(ssvc.Id, tx); err != nil { if err := str.DeleteService(ssvc.Id, tx); err != nil {
logrus.Errorf("error deactivating service '%v': %v", svcZId, err) logrus.Errorf("error deactivating service '%v': %v", svcZId, err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
if err := tx.Commit(); err != nil { if err := tx.Commit(); err != nil {
logrus.Errorf("error committing: %v", err) logrus.Errorf("error committing: %v", err)
return tunnel.NewUntunnelInternalServerError() return service.NewUnshareInternalServerError()
} }
return tunnel.NewUntunnelOK() return service.NewUnshareOK()
} }
func (h *untunnelHandler) findServiceZId(svcName string, edge *rest_management_api_client.ZitiEdgeManagement) (string, error) { func (h *unshareHandler) findServiceZId(svcName string, edge *rest_management_api_client.ZitiEdgeManagement) (string, error) {
filter := fmt.Sprintf("name=\"%v\"", svcName) filter := fmt.Sprintf("name=\"%v\"", svcName)
limit := int64(1) limit := int64(1)
offset := int64(0) offset := int64(0)
listReq := &service.ListServicesParams{ listReq := &edge_service.ListServicesParams{
Filter: &filter, Filter: &filter,
Limit: &limit, Limit: &limit,
Offset: &offset, Offset: &offset,

View File

@ -1,6 +1,6 @@
// Code generated by go-swagger; DO NOT EDIT. // Code generated by go-swagger; DO NOT EDIT.
package tunnel package service
// This file was generated by the swagger tool. // This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command // Editing this file might prove futile when you re-run the swagger generate command
@ -12,13 +12,13 @@ import (
"github.com/go-openapi/strfmt" "github.com/go-openapi/strfmt"
) )
// New creates a new tunnel API client. // New creates a new service API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats} return &Client{transport: transport, formats: formats}
} }
/* /*
Client for tunnel API Client for service API
*/ */
type Client struct { type Client struct {
transport runtime.ClientTransport transport runtime.ClientTransport
@ -30,30 +30,30 @@ type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods // ClientService is the interface for Client methods
type ClientService interface { type ClientService interface {
Tunnel(params *TunnelParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TunnelCreated, error) Share(params *ShareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ShareCreated, error)
Untunnel(params *UntunnelParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UntunnelOK, error) Unshare(params *UnshareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnshareOK, error)
SetTransport(transport runtime.ClientTransport) SetTransport(transport runtime.ClientTransport)
} }
/* /*
Tunnel tunnel API Share share API
*/ */
func (a *Client) Tunnel(params *TunnelParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TunnelCreated, error) { func (a *Client) Share(params *ShareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ShareCreated, error) {
// TODO: Validate the params before sending // TODO: Validate the params before sending
if params == nil { if params == nil {
params = NewTunnelParams() params = NewShareParams()
} }
op := &runtime.ClientOperation{ op := &runtime.ClientOperation{
ID: "tunnel", ID: "share",
Method: "POST", Method: "POST",
PathPattern: "/tunnel", PathPattern: "/share",
ProducesMediaTypes: []string{"application/zrok.v1+json"}, ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"}, ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"}, Schemes: []string{"http"},
Params: params, Params: params,
Reader: &TunnelReader{formats: a.formats}, Reader: &ShareReader{formats: a.formats},
AuthInfo: authInfo, AuthInfo: authInfo,
Context: params.Context, Context: params.Context,
Client: params.HTTPClient, Client: params.HTTPClient,
@ -66,33 +66,33 @@ func (a *Client) Tunnel(params *TunnelParams, authInfo runtime.ClientAuthInfoWri
if err != nil { if err != nil {
return nil, err return nil, err
} }
success, ok := result.(*TunnelCreated) success, ok := result.(*ShareCreated)
if ok { if ok {
return success, nil return success, nil
} }
// unexpected success response // unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue // 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 tunnel: API contract not enforced by server. Client expected to get an error, but got: %T", result) msg := fmt.Sprintf("unexpected success response for share: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg) panic(msg)
} }
/* /*
Untunnel untunnel API Unshare unshare API
*/ */
func (a *Client) Untunnel(params *UntunnelParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UntunnelOK, error) { func (a *Client) Unshare(params *UnshareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnshareOK, error) {
// TODO: Validate the params before sending // TODO: Validate the params before sending
if params == nil { if params == nil {
params = NewUntunnelParams() params = NewUnshareParams()
} }
op := &runtime.ClientOperation{ op := &runtime.ClientOperation{
ID: "untunnel", ID: "unshare",
Method: "DELETE", Method: "DELETE",
PathPattern: "/untunnel", PathPattern: "/unshare",
ProducesMediaTypes: []string{"application/zrok.v1+json"}, ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"}, ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"}, Schemes: []string{"http"},
Params: params, Params: params,
Reader: &UntunnelReader{formats: a.formats}, Reader: &UnshareReader{formats: a.formats},
AuthInfo: authInfo, AuthInfo: authInfo,
Context: params.Context, Context: params.Context,
Client: params.HTTPClient, Client: params.HTTPClient,
@ -105,13 +105,13 @@ func (a *Client) Untunnel(params *UntunnelParams, authInfo runtime.ClientAuthInf
if err != nil { if err != nil {
return nil, err return nil, err
} }
success, ok := result.(*UntunnelOK) success, ok := result.(*UnshareOK)
if ok { if ok {
return success, nil return success, nil
} }
// unexpected success response // unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue // 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 untunnel: API contract not enforced by server. Client expected to get an error, but got: %T", result) msg := fmt.Sprintf("unexpected success response for unshare: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg) panic(msg)
} }

View 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"
)
// NewShareParams creates a new ShareParams 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 NewShareParams() *ShareParams {
return &ShareParams{
timeout: cr.DefaultTimeout,
}
}
// NewShareParamsWithTimeout creates a new ShareParams object
// with the ability to set a timeout on a request.
func NewShareParamsWithTimeout(timeout time.Duration) *ShareParams {
return &ShareParams{
timeout: timeout,
}
}
// NewShareParamsWithContext creates a new ShareParams object
// with the ability to set a context for a request.
func NewShareParamsWithContext(ctx context.Context) *ShareParams {
return &ShareParams{
Context: ctx,
}
}
// NewShareParamsWithHTTPClient creates a new ShareParams object
// with the ability to set a custom HTTPClient for a request.
func NewShareParamsWithHTTPClient(client *http.Client) *ShareParams {
return &ShareParams{
HTTPClient: client,
}
}
/*
ShareParams contains all the parameters to send to the API endpoint
for the share operation.
Typically these are written to a http.Request.
*/
type ShareParams struct {
// Body.
Body *rest_model_zrok.ShareRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the share params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ShareParams) WithDefaults() *ShareParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the share params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ShareParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the share params
func (o *ShareParams) WithTimeout(timeout time.Duration) *ShareParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the share params
func (o *ShareParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the share params
func (o *ShareParams) WithContext(ctx context.Context) *ShareParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the share params
func (o *ShareParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the share params
func (o *ShareParams) WithHTTPClient(client *http.Client) *ShareParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the share params
func (o *ShareParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the share params
func (o *ShareParams) WithBody(body *rest_model_zrok.ShareRequest) *ShareParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the share params
func (o *ShareParams) SetBody(body *rest_model_zrok.ShareRequest) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *ShareParams) 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
}

View File

@ -0,0 +1,222 @@
// 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"
)
// ShareReader is a Reader for the Share structure.
type ShareReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ShareReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewShareCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewShareUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewShareInternalServerError()
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())
}
}
// NewShareCreated creates a ShareCreated with default headers values
func NewShareCreated() *ShareCreated {
return &ShareCreated{}
}
/*
ShareCreated describes a response with status code 201, with default header values.
service created
*/
type ShareCreated struct {
Payload *rest_model_zrok.ShareResponse
}
// IsSuccess returns true when this share created response has a 2xx status code
func (o *ShareCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this share created response has a 3xx status code
func (o *ShareCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this share created response has a 4xx status code
func (o *ShareCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this share created response has a 5xx status code
func (o *ShareCreated) IsServerError() bool {
return false
}
// IsCode returns true when this share created response a status code equal to that given
func (o *ShareCreated) IsCode(code int) bool {
return code == 201
}
func (o *ShareCreated) Error() string {
return fmt.Sprintf("[POST /share][%d] shareCreated %+v", 201, o.Payload)
}
func (o *ShareCreated) String() string {
return fmt.Sprintf("[POST /share][%d] shareCreated %+v", 201, o.Payload)
}
func (o *ShareCreated) GetPayload() *rest_model_zrok.ShareResponse {
return o.Payload
}
func (o *ShareCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(rest_model_zrok.ShareResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewShareUnauthorized creates a ShareUnauthorized with default headers values
func NewShareUnauthorized() *ShareUnauthorized {
return &ShareUnauthorized{}
}
/*
ShareUnauthorized describes a response with status code 401, with default header values.
unauthorized
*/
type ShareUnauthorized struct {
}
// IsSuccess returns true when this share unauthorized response has a 2xx status code
func (o *ShareUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this share unauthorized response has a 3xx status code
func (o *ShareUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this share unauthorized response has a 4xx status code
func (o *ShareUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this share unauthorized response has a 5xx status code
func (o *ShareUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this share unauthorized response a status code equal to that given
func (o *ShareUnauthorized) IsCode(code int) bool {
return code == 401
}
func (o *ShareUnauthorized) Error() string {
return fmt.Sprintf("[POST /share][%d] shareUnauthorized ", 401)
}
func (o *ShareUnauthorized) String() string {
return fmt.Sprintf("[POST /share][%d] shareUnauthorized ", 401)
}
func (o *ShareUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewShareInternalServerError creates a ShareInternalServerError with default headers values
func NewShareInternalServerError() *ShareInternalServerError {
return &ShareInternalServerError{}
}
/*
ShareInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type ShareInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this share internal server error response has a 2xx status code
func (o *ShareInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this share internal server error response has a 3xx status code
func (o *ShareInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this share internal server error response has a 4xx status code
func (o *ShareInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this share internal server error response has a 5xx status code
func (o *ShareInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this share internal server error response a status code equal to that given
func (o *ShareInternalServerError) IsCode(code int) bool {
return code == 500
}
func (o *ShareInternalServerError) Error() string {
return fmt.Sprintf("[POST /share][%d] shareInternalServerError %+v", 500, o.Payload)
}
func (o *ShareInternalServerError) String() string {
return fmt.Sprintf("[POST /share][%d] shareInternalServerError %+v", 500, o.Payload)
}
func (o *ShareInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
func (o *ShareInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View 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"
)
// NewUnshareParams creates a new UnshareParams 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 NewUnshareParams() *UnshareParams {
return &UnshareParams{
timeout: cr.DefaultTimeout,
}
}
// NewUnshareParamsWithTimeout creates a new UnshareParams object
// with the ability to set a timeout on a request.
func NewUnshareParamsWithTimeout(timeout time.Duration) *UnshareParams {
return &UnshareParams{
timeout: timeout,
}
}
// NewUnshareParamsWithContext creates a new UnshareParams object
// with the ability to set a context for a request.
func NewUnshareParamsWithContext(ctx context.Context) *UnshareParams {
return &UnshareParams{
Context: ctx,
}
}
// NewUnshareParamsWithHTTPClient creates a new UnshareParams object
// with the ability to set a custom HTTPClient for a request.
func NewUnshareParamsWithHTTPClient(client *http.Client) *UnshareParams {
return &UnshareParams{
HTTPClient: client,
}
}
/*
UnshareParams contains all the parameters to send to the API endpoint
for the unshare operation.
Typically these are written to a http.Request.
*/
type UnshareParams struct {
// Body.
Body *rest_model_zrok.UnshareRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the unshare params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UnshareParams) WithDefaults() *UnshareParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the unshare params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UnshareParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the unshare params
func (o *UnshareParams) WithTimeout(timeout time.Duration) *UnshareParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the unshare params
func (o *UnshareParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the unshare params
func (o *UnshareParams) WithContext(ctx context.Context) *UnshareParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the unshare params
func (o *UnshareParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the unshare params
func (o *UnshareParams) WithHTTPClient(client *http.Client) *UnshareParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the unshare params
func (o *UnshareParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the unshare params
func (o *UnshareParams) WithBody(body *rest_model_zrok.UnshareRequest) *UnshareParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the unshare params
func (o *UnshareParams) SetBody(body *rest_model_zrok.UnshareRequest) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *UnshareParams) 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
}

View File

@ -0,0 +1,267 @@
// 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"
)
// UnshareReader is a Reader for the Unshare structure.
type UnshareReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *UnshareReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewUnshareOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewUnshareUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewUnshareNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewUnshareInternalServerError()
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())
}
}
// NewUnshareOK creates a UnshareOK with default headers values
func NewUnshareOK() *UnshareOK {
return &UnshareOK{}
}
/*
UnshareOK describes a response with status code 200, with default header values.
service removed
*/
type UnshareOK struct {
}
// IsSuccess returns true when this unshare o k response has a 2xx status code
func (o *UnshareOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this unshare o k response has a 3xx status code
func (o *UnshareOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this unshare o k response has a 4xx status code
func (o *UnshareOK) IsClientError() bool {
return false
}
// IsServerError returns true when this unshare o k response has a 5xx status code
func (o *UnshareOK) IsServerError() bool {
return false
}
// IsCode returns true when this unshare o k response a status code equal to that given
func (o *UnshareOK) IsCode(code int) bool {
return code == 200
}
func (o *UnshareOK) Error() string {
return fmt.Sprintf("[DELETE /unshare][%d] unshareOK ", 200)
}
func (o *UnshareOK) String() string {
return fmt.Sprintf("[DELETE /unshare][%d] unshareOK ", 200)
}
func (o *UnshareOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewUnshareUnauthorized creates a UnshareUnauthorized with default headers values
func NewUnshareUnauthorized() *UnshareUnauthorized {
return &UnshareUnauthorized{}
}
/*
UnshareUnauthorized describes a response with status code 401, with default header values.
unauthorized
*/
type UnshareUnauthorized struct {
}
// IsSuccess returns true when this unshare unauthorized response has a 2xx status code
func (o *UnshareUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this unshare unauthorized response has a 3xx status code
func (o *UnshareUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this unshare unauthorized response has a 4xx status code
func (o *UnshareUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this unshare unauthorized response has a 5xx status code
func (o *UnshareUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this unshare unauthorized response a status code equal to that given
func (o *UnshareUnauthorized) IsCode(code int) bool {
return code == 401
}
func (o *UnshareUnauthorized) Error() string {
return fmt.Sprintf("[DELETE /unshare][%d] unshareUnauthorized ", 401)
}
func (o *UnshareUnauthorized) String() string {
return fmt.Sprintf("[DELETE /unshare][%d] unshareUnauthorized ", 401)
}
func (o *UnshareUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewUnshareNotFound creates a UnshareNotFound with default headers values
func NewUnshareNotFound() *UnshareNotFound {
return &UnshareNotFound{}
}
/*
UnshareNotFound describes a response with status code 404, with default header values.
not found
*/
type UnshareNotFound struct {
}
// IsSuccess returns true when this unshare not found response has a 2xx status code
func (o *UnshareNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this unshare not found response has a 3xx status code
func (o *UnshareNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this unshare not found response has a 4xx status code
func (o *UnshareNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this unshare not found response has a 5xx status code
func (o *UnshareNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this unshare not found response a status code equal to that given
func (o *UnshareNotFound) IsCode(code int) bool {
return code == 404
}
func (o *UnshareNotFound) Error() string {
return fmt.Sprintf("[DELETE /unshare][%d] unshareNotFound ", 404)
}
func (o *UnshareNotFound) String() string {
return fmt.Sprintf("[DELETE /unshare][%d] unshareNotFound ", 404)
}
func (o *UnshareNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewUnshareInternalServerError creates a UnshareInternalServerError with default headers values
func NewUnshareInternalServerError() *UnshareInternalServerError {
return &UnshareInternalServerError{}
}
/*
UnshareInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type UnshareInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this unshare internal server error response has a 2xx status code
func (o *UnshareInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this unshare internal server error response has a 3xx status code
func (o *UnshareInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this unshare internal server error response has a 4xx status code
func (o *UnshareInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this unshare internal server error response has a 5xx status code
func (o *UnshareInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this unshare internal server error response a status code equal to that given
func (o *UnshareInternalServerError) IsCode(code int) bool {
return code == 500
}
func (o *UnshareInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /unshare][%d] unshareInternalServerError %+v", 500, o.Payload)
}
func (o *UnshareInternalServerError) String() string {
return fmt.Sprintf("[DELETE /unshare][%d] unshareInternalServerError %+v", 500, o.Payload)
}
func (o *UnshareInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
func (o *UnshareInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -1,150 +0,0 @@
// Code generated by go-swagger; DO NOT EDIT.
package tunnel
// 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"
)
// NewTunnelParams creates a new TunnelParams 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 NewTunnelParams() *TunnelParams {
return &TunnelParams{
timeout: cr.DefaultTimeout,
}
}
// NewTunnelParamsWithTimeout creates a new TunnelParams object
// with the ability to set a timeout on a request.
func NewTunnelParamsWithTimeout(timeout time.Duration) *TunnelParams {
return &TunnelParams{
timeout: timeout,
}
}
// NewTunnelParamsWithContext creates a new TunnelParams object
// with the ability to set a context for a request.
func NewTunnelParamsWithContext(ctx context.Context) *TunnelParams {
return &TunnelParams{
Context: ctx,
}
}
// NewTunnelParamsWithHTTPClient creates a new TunnelParams object
// with the ability to set a custom HTTPClient for a request.
func NewTunnelParamsWithHTTPClient(client *http.Client) *TunnelParams {
return &TunnelParams{
HTTPClient: client,
}
}
/*
TunnelParams contains all the parameters to send to the API endpoint
for the tunnel operation.
Typically these are written to a http.Request.
*/
type TunnelParams struct {
// Body.
Body *rest_model_zrok.TunnelRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the tunnel params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *TunnelParams) WithDefaults() *TunnelParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the tunnel params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *TunnelParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the tunnel params
func (o *TunnelParams) WithTimeout(timeout time.Duration) *TunnelParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the tunnel params
func (o *TunnelParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the tunnel params
func (o *TunnelParams) WithContext(ctx context.Context) *TunnelParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the tunnel params
func (o *TunnelParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the tunnel params
func (o *TunnelParams) WithHTTPClient(client *http.Client) *TunnelParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the tunnel params
func (o *TunnelParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the tunnel params
func (o *TunnelParams) WithBody(body *rest_model_zrok.TunnelRequest) *TunnelParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the tunnel params
func (o *TunnelParams) SetBody(body *rest_model_zrok.TunnelRequest) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *TunnelParams) 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
}

View File

@ -1,232 +0,0 @@
// Code generated by go-swagger; DO NOT EDIT.
package tunnel
// 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"
)
// TunnelReader is a Reader for the Tunnel structure.
type TunnelReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *TunnelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewTunnelCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewTunnelUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewTunnelInternalServerError()
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())
}
}
// NewTunnelCreated creates a TunnelCreated with default headers values
func NewTunnelCreated() *TunnelCreated {
return &TunnelCreated{}
}
/*
TunnelCreated describes a response with status code 201, with default header values.
tunnel created
*/
type TunnelCreated struct {
Payload *rest_model_zrok.TunnelResponse
}
// IsSuccess returns true when this tunnel created response has a 2xx status code
func (o *TunnelCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this tunnel created response has a 3xx status code
func (o *TunnelCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this tunnel created response has a 4xx status code
func (o *TunnelCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this tunnel created response has a 5xx status code
func (o *TunnelCreated) IsServerError() bool {
return false
}
// IsCode returns true when this tunnel created response a status code equal to that given
func (o *TunnelCreated) IsCode(code int) bool {
return code == 201
}
func (o *TunnelCreated) Error() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelCreated %+v", 201, o.Payload)
}
func (o *TunnelCreated) String() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelCreated %+v", 201, o.Payload)
}
func (o *TunnelCreated) GetPayload() *rest_model_zrok.TunnelResponse {
return o.Payload
}
func (o *TunnelCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(rest_model_zrok.TunnelResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewTunnelUnauthorized creates a TunnelUnauthorized with default headers values
func NewTunnelUnauthorized() *TunnelUnauthorized {
return &TunnelUnauthorized{}
}
/*
TunnelUnauthorized describes a response with status code 401, with default header values.
invalid environment identity
*/
type TunnelUnauthorized struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this tunnel unauthorized response has a 2xx status code
func (o *TunnelUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this tunnel unauthorized response has a 3xx status code
func (o *TunnelUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this tunnel unauthorized response has a 4xx status code
func (o *TunnelUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this tunnel unauthorized response has a 5xx status code
func (o *TunnelUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this tunnel unauthorized response a status code equal to that given
func (o *TunnelUnauthorized) IsCode(code int) bool {
return code == 401
}
func (o *TunnelUnauthorized) Error() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelUnauthorized %+v", 401, o.Payload)
}
func (o *TunnelUnauthorized) String() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelUnauthorized %+v", 401, o.Payload)
}
func (o *TunnelUnauthorized) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
func (o *TunnelUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewTunnelInternalServerError creates a TunnelInternalServerError with default headers values
func NewTunnelInternalServerError() *TunnelInternalServerError {
return &TunnelInternalServerError{}
}
/*
TunnelInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type TunnelInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this tunnel internal server error response has a 2xx status code
func (o *TunnelInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this tunnel internal server error response has a 3xx status code
func (o *TunnelInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this tunnel internal server error response has a 4xx status code
func (o *TunnelInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this tunnel internal server error response has a 5xx status code
func (o *TunnelInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this tunnel internal server error response a status code equal to that given
func (o *TunnelInternalServerError) IsCode(code int) bool {
return code == 500
}
func (o *TunnelInternalServerError) Error() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelInternalServerError %+v", 500, o.Payload)
}
func (o *TunnelInternalServerError) String() string {
return fmt.Sprintf("[POST /tunnel][%d] tunnelInternalServerError %+v", 500, o.Payload)
}
func (o *TunnelInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
func (o *TunnelInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -1,150 +0,0 @@
// Code generated by go-swagger; DO NOT EDIT.
package tunnel
// 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"
)
// NewUntunnelParams creates a new UntunnelParams 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 NewUntunnelParams() *UntunnelParams {
return &UntunnelParams{
timeout: cr.DefaultTimeout,
}
}
// NewUntunnelParamsWithTimeout creates a new UntunnelParams object
// with the ability to set a timeout on a request.
func NewUntunnelParamsWithTimeout(timeout time.Duration) *UntunnelParams {
return &UntunnelParams{
timeout: timeout,
}
}
// NewUntunnelParamsWithContext creates a new UntunnelParams object
// with the ability to set a context for a request.
func NewUntunnelParamsWithContext(ctx context.Context) *UntunnelParams {
return &UntunnelParams{
Context: ctx,
}
}
// NewUntunnelParamsWithHTTPClient creates a new UntunnelParams object
// with the ability to set a custom HTTPClient for a request.
func NewUntunnelParamsWithHTTPClient(client *http.Client) *UntunnelParams {
return &UntunnelParams{
HTTPClient: client,
}
}
/*
UntunnelParams contains all the parameters to send to the API endpoint
for the untunnel operation.
Typically these are written to a http.Request.
*/
type UntunnelParams struct {
// Body.
Body *rest_model_zrok.UntunnelRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the untunnel params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UntunnelParams) WithDefaults() *UntunnelParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the untunnel params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UntunnelParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the untunnel params
func (o *UntunnelParams) WithTimeout(timeout time.Duration) *UntunnelParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the untunnel params
func (o *UntunnelParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the untunnel params
func (o *UntunnelParams) WithContext(ctx context.Context) *UntunnelParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the untunnel params
func (o *UntunnelParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the untunnel params
func (o *UntunnelParams) WithHTTPClient(client *http.Client) *UntunnelParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the untunnel params
func (o *UntunnelParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the untunnel params
func (o *UntunnelParams) WithBody(body *rest_model_zrok.UntunnelRequest) *UntunnelParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the untunnel params
func (o *UntunnelParams) SetBody(body *rest_model_zrok.UntunnelRequest) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *UntunnelParams) 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
}

View File

@ -1,220 +0,0 @@
// Code generated by go-swagger; DO NOT EDIT.
package tunnel
// 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"
)
// UntunnelReader is a Reader for the Untunnel structure.
type UntunnelReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *UntunnelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewUntunnelOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewUntunnelNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewUntunnelInternalServerError()
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())
}
}
// NewUntunnelOK creates a UntunnelOK with default headers values
func NewUntunnelOK() *UntunnelOK {
return &UntunnelOK{}
}
/*
UntunnelOK describes a response with status code 200, with default header values.
tunnel removed
*/
type UntunnelOK struct {
}
// IsSuccess returns true when this untunnel o k response has a 2xx status code
func (o *UntunnelOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this untunnel o k response has a 3xx status code
func (o *UntunnelOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this untunnel o k response has a 4xx status code
func (o *UntunnelOK) IsClientError() bool {
return false
}
// IsServerError returns true when this untunnel o k response has a 5xx status code
func (o *UntunnelOK) IsServerError() bool {
return false
}
// IsCode returns true when this untunnel o k response a status code equal to that given
func (o *UntunnelOK) IsCode(code int) bool {
return code == 200
}
func (o *UntunnelOK) Error() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelOK ", 200)
}
func (o *UntunnelOK) String() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelOK ", 200)
}
func (o *UntunnelOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewUntunnelNotFound creates a UntunnelNotFound with default headers values
func NewUntunnelNotFound() *UntunnelNotFound {
return &UntunnelNotFound{}
}
/*
UntunnelNotFound describes a response with status code 404, with default header values.
not found
*/
type UntunnelNotFound struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this untunnel not found response has a 2xx status code
func (o *UntunnelNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this untunnel not found response has a 3xx status code
func (o *UntunnelNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this untunnel not found response has a 4xx status code
func (o *UntunnelNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this untunnel not found response has a 5xx status code
func (o *UntunnelNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this untunnel not found response a status code equal to that given
func (o *UntunnelNotFound) IsCode(code int) bool {
return code == 404
}
func (o *UntunnelNotFound) Error() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelNotFound %+v", 404, o.Payload)
}
func (o *UntunnelNotFound) String() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelNotFound %+v", 404, o.Payload)
}
func (o *UntunnelNotFound) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
func (o *UntunnelNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewUntunnelInternalServerError creates a UntunnelInternalServerError with default headers values
func NewUntunnelInternalServerError() *UntunnelInternalServerError {
return &UntunnelInternalServerError{}
}
/*
UntunnelInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type UntunnelInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
// IsSuccess returns true when this untunnel internal server error response has a 2xx status code
func (o *UntunnelInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this untunnel internal server error response has a 3xx status code
func (o *UntunnelInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this untunnel internal server error response has a 4xx status code
func (o *UntunnelInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this untunnel internal server error response has a 5xx status code
func (o *UntunnelInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this untunnel internal server error response a status code equal to that given
func (o *UntunnelInternalServerError) IsCode(code int) bool {
return code == 500
}
func (o *UntunnelInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelInternalServerError %+v", 500, o.Payload)
}
func (o *UntunnelInternalServerError) String() string {
return fmt.Sprintf("[DELETE /untunnel][%d] untunnelInternalServerError %+v", 500, o.Payload)
}
func (o *UntunnelInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
func (o *UntunnelInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -12,7 +12,7 @@ import (
"github.com/openziti-test-kitchen/zrok/rest_client_zrok/identity" "github.com/openziti-test-kitchen/zrok/rest_client_zrok/identity"
"github.com/openziti-test-kitchen/zrok/rest_client_zrok/metadata" "github.com/openziti-test-kitchen/zrok/rest_client_zrok/metadata"
"github.com/openziti-test-kitchen/zrok/rest_client_zrok/tunnel" "github.com/openziti-test-kitchen/zrok/rest_client_zrok/service"
) )
// Default zrok HTTP client. // Default zrok HTTP client.
@ -59,7 +59,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Zrok {
cli.Transport = transport cli.Transport = transport
cli.Identity = identity.New(transport, formats) cli.Identity = identity.New(transport, formats)
cli.Metadata = metadata.New(transport, formats) cli.Metadata = metadata.New(transport, formats)
cli.Tunnel = tunnel.New(transport, formats) cli.Service = service.New(transport, formats)
return cli return cli
} }
@ -108,7 +108,7 @@ type Zrok struct {
Metadata metadata.ClientService Metadata metadata.ClientService
Tunnel tunnel.ClientService Service service.ClientService
Transport runtime.ClientTransport Transport runtime.ClientTransport
} }
@ -118,5 +118,5 @@ func (c *Zrok) SetTransport(transport runtime.ClientTransport) {
c.Transport = transport c.Transport = transport
c.Identity.SetTransport(transport) c.Identity.SetTransport(transport)
c.Metadata.SetTransport(transport) c.Metadata.SetTransport(transport)
c.Tunnel.SetTransport(transport) c.Service.SetTransport(transport)
} }

View File

@ -14,10 +14,10 @@ import (
"github.com/go-openapi/swag" "github.com/go-openapi/swag"
) )
// TunnelRequest tunnel request // ShareRequest share request
// //
// swagger:model tunnelRequest // swagger:model shareRequest
type TunnelRequest struct { type ShareRequest struct {
// auth scheme // auth scheme
AuthScheme string `json:"authScheme,omitempty"` AuthScheme string `json:"authScheme,omitempty"`
@ -32,8 +32,8 @@ type TunnelRequest struct {
ZID string `json:"zId,omitempty"` ZID string `json:"zId,omitempty"`
} }
// Validate validates this tunnel request // Validate validates this share request
func (m *TunnelRequest) Validate(formats strfmt.Registry) error { func (m *ShareRequest) Validate(formats strfmt.Registry) error {
var res []error var res []error
if err := m.validateAuthUsers(formats); err != nil { if err := m.validateAuthUsers(formats); err != nil {
@ -46,7 +46,7 @@ func (m *TunnelRequest) Validate(formats strfmt.Registry) error {
return nil return nil
} }
func (m *TunnelRequest) validateAuthUsers(formats strfmt.Registry) error { func (m *ShareRequest) validateAuthUsers(formats strfmt.Registry) error {
if swag.IsZero(m.AuthUsers) { // not required if swag.IsZero(m.AuthUsers) { // not required
return nil return nil
} }
@ -72,8 +72,8 @@ func (m *TunnelRequest) validateAuthUsers(formats strfmt.Registry) error {
return nil return nil
} }
// ContextValidate validate this tunnel request based on the context it is used // ContextValidate validate this share request based on the context it is used
func (m *TunnelRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { func (m *ShareRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error var res []error
if err := m.contextValidateAuthUsers(ctx, formats); err != nil { if err := m.contextValidateAuthUsers(ctx, formats); err != nil {
@ -86,7 +86,7 @@ func (m *TunnelRequest) ContextValidate(ctx context.Context, formats strfmt.Regi
return nil return nil
} }
func (m *TunnelRequest) contextValidateAuthUsers(ctx context.Context, formats strfmt.Registry) error { func (m *ShareRequest) contextValidateAuthUsers(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.AuthUsers); i++ { for i := 0; i < len(m.AuthUsers); i++ {
@ -107,7 +107,7 @@ func (m *TunnelRequest) contextValidateAuthUsers(ctx context.Context, formats st
} }
// MarshalBinary interface implementation // MarshalBinary interface implementation
func (m *TunnelRequest) MarshalBinary() ([]byte, error) { func (m *ShareRequest) MarshalBinary() ([]byte, error) {
if m == nil { if m == nil {
return nil, nil return nil, nil
} }
@ -115,8 +115,8 @@ func (m *TunnelRequest) MarshalBinary() ([]byte, error) {
} }
// UnmarshalBinary interface implementation // UnmarshalBinary interface implementation
func (m *TunnelRequest) UnmarshalBinary(b []byte) error { func (m *ShareRequest) UnmarshalBinary(b []byte) error {
var res TunnelRequest var res ShareRequest
if err := swag.ReadJSON(b, &res); err != nil { if err := swag.ReadJSON(b, &res); err != nil {
return err return err
} }

View File

@ -12,10 +12,10 @@ import (
"github.com/go-openapi/swag" "github.com/go-openapi/swag"
) )
// TunnelResponse tunnel response // ShareResponse share response
// //
// swagger:model tunnelResponse // swagger:model shareResponse
type TunnelResponse struct { type ShareResponse struct {
// proxy endpoint // proxy endpoint
ProxyEndpoint string `json:"proxyEndpoint,omitempty"` ProxyEndpoint string `json:"proxyEndpoint,omitempty"`
@ -24,18 +24,18 @@ type TunnelResponse struct {
SvcName string `json:"svcName,omitempty"` SvcName string `json:"svcName,omitempty"`
} }
// Validate validates this tunnel response // Validate validates this share response
func (m *TunnelResponse) Validate(formats strfmt.Registry) error { func (m *ShareResponse) Validate(formats strfmt.Registry) error {
return nil return nil
} }
// ContextValidate validates this tunnel response based on context it is used // ContextValidate validates this share response based on context it is used
func (m *TunnelResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { func (m *ShareResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil return nil
} }
// MarshalBinary interface implementation // MarshalBinary interface implementation
func (m *TunnelResponse) MarshalBinary() ([]byte, error) { func (m *ShareResponse) MarshalBinary() ([]byte, error) {
if m == nil { if m == nil {
return nil, nil return nil, nil
} }
@ -43,8 +43,8 @@ func (m *TunnelResponse) MarshalBinary() ([]byte, error) {
} }
// UnmarshalBinary interface implementation // UnmarshalBinary interface implementation
func (m *TunnelResponse) UnmarshalBinary(b []byte) error { func (m *ShareResponse) UnmarshalBinary(b []byte) error {
var res TunnelResponse var res ShareResponse
if err := swag.ReadJSON(b, &res); err != nil { if err := swag.ReadJSON(b, &res); err != nil {
return err return err
} }

View File

@ -12,10 +12,10 @@ import (
"github.com/go-openapi/swag" "github.com/go-openapi/swag"
) )
// UntunnelRequest untunnel request // UnshareRequest unshare request
// //
// swagger:model untunnelRequest // swagger:model unshareRequest
type UntunnelRequest struct { type UnshareRequest struct {
// svc name // svc name
SvcName string `json:"svcName,omitempty"` SvcName string `json:"svcName,omitempty"`
@ -24,18 +24,18 @@ type UntunnelRequest struct {
ZID string `json:"zId,omitempty"` ZID string `json:"zId,omitempty"`
} }
// Validate validates this untunnel request // Validate validates this unshare request
func (m *UntunnelRequest) Validate(formats strfmt.Registry) error { func (m *UnshareRequest) Validate(formats strfmt.Registry) error {
return nil return nil
} }
// ContextValidate validates this untunnel request based on context it is used // ContextValidate validates this unshare request based on context it is used
func (m *UntunnelRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { func (m *UnshareRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil return nil
} }
// MarshalBinary interface implementation // MarshalBinary interface implementation
func (m *UntunnelRequest) MarshalBinary() ([]byte, error) { func (m *UnshareRequest) MarshalBinary() ([]byte, error) {
if m == nil { if m == nil {
return nil, nil return nil, nil
} }
@ -43,8 +43,8 @@ func (m *UntunnelRequest) MarshalBinary() ([]byte, error) {
} }
// UnmarshalBinary interface implementation // UnmarshalBinary interface implementation
func (m *UntunnelRequest) UnmarshalBinary(b []byte) error { func (m *UnshareRequest) UnmarshalBinary(b []byte) error {
var res UntunnelRequest var res UnshareRequest
if err := swag.ReadJSON(b, &res); err != nil { if err := swag.ReadJSON(b, &res); err != nil {
return err return err
} }

View File

@ -236,7 +236,7 @@ func init() {
} }
} }
}, },
"/tunnel": { "/share": {
"post": { "post": {
"security": [ "security": [
{ {
@ -244,30 +244,27 @@ func init() {
} }
], ],
"tags": [ "tags": [
"tunnel" "service"
], ],
"operationId": "tunnel", "operationId": "share",
"parameters": [ "parameters": [
{ {
"name": "body", "name": "body",
"in": "body", "in": "body",
"schema": { "schema": {
"$ref": "#/definitions/tunnelRequest" "$ref": "#/definitions/shareRequest"
} }
} }
], ],
"responses": { "responses": {
"201": { "201": {
"description": "tunnel created", "description": "service created",
"schema": { "schema": {
"$ref": "#/definitions/tunnelResponse" "$ref": "#/definitions/shareResponse"
} }
}, },
"401": { "401": {
"description": "invalid environment identity", "description": "unauthorized"
"schema": {
"$ref": "#/definitions/errorMessage"
}
}, },
"500": { "500": {
"description": "internal server error", "description": "internal server error",
@ -278,7 +275,7 @@ func init() {
} }
} }
}, },
"/untunnel": { "/unshare": {
"delete": { "delete": {
"security": [ "security": [
{ {
@ -286,27 +283,27 @@ func init() {
} }
], ],
"tags": [ "tags": [
"tunnel" "service"
], ],
"operationId": "untunnel", "operationId": "unshare",
"parameters": [ "parameters": [
{ {
"name": "body", "name": "body",
"in": "body", "in": "body",
"schema": { "schema": {
"$ref": "#/definitions/untunnelRequest" "$ref": "#/definitions/unshareRequest"
} }
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "tunnel removed" "description": "service removed"
},
"401": {
"description": "unauthorized"
}, },
"404": { "404": {
"description": "not found", "description": "not found"
"schema": {
"$ref": "#/definitions/errorMessage"
}
}, },
"500": { "500": {
"description": "internal server error", "description": "internal server error",
@ -555,7 +552,7 @@ func init() {
"$ref": "#/definitions/service" "$ref": "#/definitions/service"
} }
}, },
"tunnelRequest": { "shareRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
"authScheme": { "authScheme": {
@ -575,7 +572,7 @@ func init() {
} }
} }
}, },
"tunnelResponse": { "shareResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"proxyEndpoint": { "proxyEndpoint": {
@ -586,7 +583,7 @@ func init() {
} }
} }
}, },
"untunnelRequest": { "unshareRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
"svcName": { "svcName": {
@ -844,7 +841,7 @@ func init() {
} }
} }
}, },
"/tunnel": { "/share": {
"post": { "post": {
"security": [ "security": [
{ {
@ -852,30 +849,27 @@ func init() {
} }
], ],
"tags": [ "tags": [
"tunnel" "service"
], ],
"operationId": "tunnel", "operationId": "share",
"parameters": [ "parameters": [
{ {
"name": "body", "name": "body",
"in": "body", "in": "body",
"schema": { "schema": {
"$ref": "#/definitions/tunnelRequest" "$ref": "#/definitions/shareRequest"
} }
} }
], ],
"responses": { "responses": {
"201": { "201": {
"description": "tunnel created", "description": "service created",
"schema": { "schema": {
"$ref": "#/definitions/tunnelResponse" "$ref": "#/definitions/shareResponse"
} }
}, },
"401": { "401": {
"description": "invalid environment identity", "description": "unauthorized"
"schema": {
"$ref": "#/definitions/errorMessage"
}
}, },
"500": { "500": {
"description": "internal server error", "description": "internal server error",
@ -886,7 +880,7 @@ func init() {
} }
} }
}, },
"/untunnel": { "/unshare": {
"delete": { "delete": {
"security": [ "security": [
{ {
@ -894,27 +888,27 @@ func init() {
} }
], ],
"tags": [ "tags": [
"tunnel" "service"
], ],
"operationId": "untunnel", "operationId": "unshare",
"parameters": [ "parameters": [
{ {
"name": "body", "name": "body",
"in": "body", "in": "body",
"schema": { "schema": {
"$ref": "#/definitions/untunnelRequest" "$ref": "#/definitions/unshareRequest"
} }
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "tunnel removed" "description": "service removed"
},
"401": {
"description": "unauthorized"
}, },
"404": { "404": {
"description": "not found", "description": "not found"
"schema": {
"$ref": "#/definitions/errorMessage"
}
}, },
"500": { "500": {
"description": "internal server error", "description": "internal server error",
@ -1163,7 +1157,7 @@ func init() {
"$ref": "#/definitions/service" "$ref": "#/definitions/service"
} }
}, },
"tunnelRequest": { "shareRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
"authScheme": { "authScheme": {
@ -1183,7 +1177,7 @@ func init() {
} }
} }
}, },
"tunnelResponse": { "shareResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"proxyEndpoint": { "proxyEndpoint": {
@ -1194,7 +1188,7 @@ func init() {
} }
} }
}, },
"untunnelRequest": { "unshareRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
"svcName": { "svcName": {

View File

@ -1,6 +1,6 @@
// Code generated by go-swagger; DO NOT EDIT. // Code generated by go-swagger; DO NOT EDIT.
package tunnel package service
// This file was generated by the swagger tool. // This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command // Editing this file might prove futile when you re-run the generate command
@ -13,40 +13,40 @@ import (
"github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti-test-kitchen/zrok/rest_model_zrok"
) )
// TunnelHandlerFunc turns a function with the right signature into a tunnel handler // ShareHandlerFunc turns a function with the right signature into a share handler
type TunnelHandlerFunc func(TunnelParams, *rest_model_zrok.Principal) middleware.Responder type ShareHandlerFunc func(ShareParams, *rest_model_zrok.Principal) middleware.Responder
// Handle executing the request and returning a response // Handle executing the request and returning a response
func (fn TunnelHandlerFunc) Handle(params TunnelParams, principal *rest_model_zrok.Principal) middleware.Responder { func (fn ShareHandlerFunc) Handle(params ShareParams, principal *rest_model_zrok.Principal) middleware.Responder {
return fn(params, principal) return fn(params, principal)
} }
// TunnelHandler interface for that can handle valid tunnel params // ShareHandler interface for that can handle valid share params
type TunnelHandler interface { type ShareHandler interface {
Handle(TunnelParams, *rest_model_zrok.Principal) middleware.Responder Handle(ShareParams, *rest_model_zrok.Principal) middleware.Responder
} }
// NewTunnel creates a new http.Handler for the tunnel operation // NewShare creates a new http.Handler for the share operation
func NewTunnel(ctx *middleware.Context, handler TunnelHandler) *Tunnel { func NewShare(ctx *middleware.Context, handler ShareHandler) *Share {
return &Tunnel{Context: ctx, Handler: handler} return &Share{Context: ctx, Handler: handler}
} }
/* /*
Tunnel swagger:route POST /tunnel tunnel tunnel Share swagger:route POST /share service share
Tunnel tunnel API Share share API
*/ */
type Tunnel struct { type Share struct {
Context *middleware.Context Context *middleware.Context
Handler TunnelHandler Handler ShareHandler
} }
func (o *Tunnel) ServeHTTP(rw http.ResponseWriter, r *http.Request) { func (o *Share) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r) route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil { if rCtx != nil {
*r = *rCtx *r = *rCtx
} }
var Params = NewTunnelParams() var Params = NewShareParams()
uprinc, aCtx, err := o.Context.Authorize(r, route) uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil { if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err) o.Context.Respond(rw, r, route.Produces, route, err)

View File

@ -1,6 +1,6 @@
// Code generated by go-swagger; DO NOT EDIT. // Code generated by go-swagger; DO NOT EDIT.
package tunnel package service
// This file was generated by the swagger tool. // This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command // Editing this file might prove futile when you re-run the swagger generate command
@ -16,19 +16,19 @@ import (
"github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti-test-kitchen/zrok/rest_model_zrok"
) )
// NewTunnelParams creates a new TunnelParams object // NewShareParams creates a new ShareParams object
// //
// There are no default values defined in the spec. // There are no default values defined in the spec.
func NewTunnelParams() TunnelParams { func NewShareParams() ShareParams {
return TunnelParams{} return ShareParams{}
} }
// TunnelParams contains all the bound params for the tunnel operation // ShareParams contains all the bound params for the share operation
// typically these are obtained from a http.Request // typically these are obtained from a http.Request
// //
// swagger:parameters tunnel // swagger:parameters share
type TunnelParams struct { type ShareParams struct {
// HTTP Request Object // HTTP Request Object
HTTPRequest *http.Request `json:"-"` HTTPRequest *http.Request `json:"-"`
@ -36,21 +36,21 @@ type TunnelParams struct {
/* /*
In: body In: body
*/ */
Body *rest_model_zrok.TunnelRequest Body *rest_model_zrok.ShareRequest
} }
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface // 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. // for simple values it will use straight method calls.
// //
// To ensure default values, the struct must have been initialized with NewTunnelParams() beforehand. // To ensure default values, the struct must have been initialized with NewShareParams() beforehand.
func (o *TunnelParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { func (o *ShareParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error var res []error
o.HTTPRequest = r o.HTTPRequest = r
if runtime.HasBody(r) { if runtime.HasBody(r) {
defer r.Body.Close() defer r.Body.Close()
var body rest_model_zrok.TunnelRequest var body rest_model_zrok.ShareRequest
if err := route.Consumer.Consume(r.Body, &body); err != nil { if err := route.Consumer.Consume(r.Body, &body); err != nil {
res = append(res, errors.NewParseError("body", "body", "", err)) res = append(res, errors.NewParseError("body", "body", "", err))
} else { } else {

View File

@ -0,0 +1,127 @@
// 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"
)
// ShareCreatedCode is the HTTP code returned for type ShareCreated
const ShareCreatedCode int = 201
/*
ShareCreated service created
swagger:response shareCreated
*/
type ShareCreated struct {
/*
In: Body
*/
Payload *rest_model_zrok.ShareResponse `json:"body,omitempty"`
}
// NewShareCreated creates ShareCreated with default headers values
func NewShareCreated() *ShareCreated {
return &ShareCreated{}
}
// WithPayload adds the payload to the share created response
func (o *ShareCreated) WithPayload(payload *rest_model_zrok.ShareResponse) *ShareCreated {
o.Payload = payload
return o
}
// SetPayload sets the payload to the share created response
func (o *ShareCreated) SetPayload(payload *rest_model_zrok.ShareResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ShareCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(201)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// ShareUnauthorizedCode is the HTTP code returned for type ShareUnauthorized
const ShareUnauthorizedCode int = 401
/*
ShareUnauthorized unauthorized
swagger:response shareUnauthorized
*/
type ShareUnauthorized struct {
}
// NewShareUnauthorized creates ShareUnauthorized with default headers values
func NewShareUnauthorized() *ShareUnauthorized {
return &ShareUnauthorized{}
}
// WriteResponse to the client
func (o *ShareUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(401)
}
// ShareInternalServerErrorCode is the HTTP code returned for type ShareInternalServerError
const ShareInternalServerErrorCode int = 500
/*
ShareInternalServerError internal server error
swagger:response shareInternalServerError
*/
type ShareInternalServerError struct {
/*
In: Body
*/
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
}
// NewShareInternalServerError creates ShareInternalServerError with default headers values
func NewShareInternalServerError() *ShareInternalServerError {
return &ShareInternalServerError{}
}
// WithPayload adds the payload to the share internal server error response
func (o *ShareInternalServerError) WithPayload(payload rest_model_zrok.ErrorMessage) *ShareInternalServerError {
o.Payload = payload
return o
}
// SetPayload sets the payload to the share internal server error response
func (o *ShareInternalServerError) SetPayload(payload rest_model_zrok.ErrorMessage) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ShareInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(500)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -1,6 +1,6 @@
// Code generated by go-swagger; DO NOT EDIT. // Code generated by go-swagger; DO NOT EDIT.
package tunnel package service
// This file was generated by the swagger tool. // This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command // Editing this file might prove futile when you re-run the generate command
@ -11,15 +11,15 @@ import (
golangswaggerpaths "path" golangswaggerpaths "path"
) )
// TunnelURL generates an URL for the tunnel operation // ShareURL generates an URL for the share operation
type TunnelURL struct { type ShareURL struct {
_basePath string _basePath string
} }
// WithBasePath sets the base path for this url builder, only required when it's different from the // WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec. // base path specified in the swagger spec.
// When the value of the base path is an empty string // When the value of the base path is an empty string
func (o *TunnelURL) WithBasePath(bp string) *TunnelURL { func (o *ShareURL) WithBasePath(bp string) *ShareURL {
o.SetBasePath(bp) o.SetBasePath(bp)
return o return o
} }
@ -27,15 +27,15 @@ func (o *TunnelURL) WithBasePath(bp string) *TunnelURL {
// SetBasePath sets the base path for this url builder, only required when it's different from the // SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec. // base path specified in the swagger spec.
// When the value of the base path is an empty string // When the value of the base path is an empty string
func (o *TunnelURL) SetBasePath(bp string) { func (o *ShareURL) SetBasePath(bp string) {
o._basePath = bp o._basePath = bp
} }
// Build a url path and query string // Build a url path and query string
func (o *TunnelURL) Build() (*url.URL, error) { func (o *ShareURL) Build() (*url.URL, error) {
var _result url.URL var _result url.URL
var _path = "/tunnel" var _path = "/share"
_basePath := o._basePath _basePath := o._basePath
if _basePath == "" { if _basePath == "" {
@ -47,7 +47,7 @@ func (o *TunnelURL) Build() (*url.URL, error) {
} }
// Must is a helper function to panic when the url builder returns an error // Must is a helper function to panic when the url builder returns an error
func (o *TunnelURL) Must(u *url.URL, err error) *url.URL { func (o *ShareURL) Must(u *url.URL, err error) *url.URL {
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -58,17 +58,17 @@ func (o *TunnelURL) Must(u *url.URL, err error) *url.URL {
} }
// String returns the string representation of the path with query string // String returns the string representation of the path with query string
func (o *TunnelURL) String() string { func (o *ShareURL) String() string {
return o.Must(o.Build()).String() return o.Must(o.Build()).String()
} }
// BuildFull builds a full url with scheme, host, path and query string // BuildFull builds a full url with scheme, host, path and query string
func (o *TunnelURL) BuildFull(scheme, host string) (*url.URL, error) { func (o *ShareURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" { if scheme == "" {
return nil, errors.New("scheme is required for a full url on TunnelURL") return nil, errors.New("scheme is required for a full url on ShareURL")
} }
if host == "" { if host == "" {
return nil, errors.New("host is required for a full url on TunnelURL") return nil, errors.New("host is required for a full url on ShareURL")
} }
base, err := o.Build() base, err := o.Build()
@ -82,6 +82,6 @@ func (o *TunnelURL) BuildFull(scheme, host string) (*url.URL, error) {
} }
// StringFull returns the string representation of a complete url // StringFull returns the string representation of a complete url
func (o *TunnelURL) StringFull(scheme, host string) string { func (o *ShareURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String() return o.Must(o.BuildFull(scheme, host)).String()
} }

View File

@ -1,6 +1,6 @@
// Code generated by go-swagger; DO NOT EDIT. // Code generated by go-swagger; DO NOT EDIT.
package tunnel package service
// This file was generated by the swagger tool. // This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command // Editing this file might prove futile when you re-run the generate command
@ -13,40 +13,40 @@ import (
"github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti-test-kitchen/zrok/rest_model_zrok"
) )
// UntunnelHandlerFunc turns a function with the right signature into a untunnel handler // UnshareHandlerFunc turns a function with the right signature into a unshare handler
type UntunnelHandlerFunc func(UntunnelParams, *rest_model_zrok.Principal) middleware.Responder type UnshareHandlerFunc func(UnshareParams, *rest_model_zrok.Principal) middleware.Responder
// Handle executing the request and returning a response // Handle executing the request and returning a response
func (fn UntunnelHandlerFunc) Handle(params UntunnelParams, principal *rest_model_zrok.Principal) middleware.Responder { func (fn UnshareHandlerFunc) Handle(params UnshareParams, principal *rest_model_zrok.Principal) middleware.Responder {
return fn(params, principal) return fn(params, principal)
} }
// UntunnelHandler interface for that can handle valid untunnel params // UnshareHandler interface for that can handle valid unshare params
type UntunnelHandler interface { type UnshareHandler interface {
Handle(UntunnelParams, *rest_model_zrok.Principal) middleware.Responder Handle(UnshareParams, *rest_model_zrok.Principal) middleware.Responder
} }
// NewUntunnel creates a new http.Handler for the untunnel operation // NewUnshare creates a new http.Handler for the unshare operation
func NewUntunnel(ctx *middleware.Context, handler UntunnelHandler) *Untunnel { func NewUnshare(ctx *middleware.Context, handler UnshareHandler) *Unshare {
return &Untunnel{Context: ctx, Handler: handler} return &Unshare{Context: ctx, Handler: handler}
} }
/* /*
Untunnel swagger:route DELETE /untunnel tunnel untunnel Unshare swagger:route DELETE /unshare service unshare
Untunnel untunnel API Unshare unshare API
*/ */
type Untunnel struct { type Unshare struct {
Context *middleware.Context Context *middleware.Context
Handler UntunnelHandler Handler UnshareHandler
} }
func (o *Untunnel) ServeHTTP(rw http.ResponseWriter, r *http.Request) { func (o *Unshare) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r) route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil { if rCtx != nil {
*r = *rCtx *r = *rCtx
} }
var Params = NewUntunnelParams() var Params = NewUnshareParams()
uprinc, aCtx, err := o.Context.Authorize(r, route) uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil { if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err) o.Context.Respond(rw, r, route.Produces, route, err)

View File

@ -1,6 +1,6 @@
// Code generated by go-swagger; DO NOT EDIT. // Code generated by go-swagger; DO NOT EDIT.
package tunnel package service
// This file was generated by the swagger tool. // This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command // Editing this file might prove futile when you re-run the swagger generate command
@ -16,19 +16,19 @@ import (
"github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti-test-kitchen/zrok/rest_model_zrok"
) )
// NewUntunnelParams creates a new UntunnelParams object // NewUnshareParams creates a new UnshareParams object
// //
// There are no default values defined in the spec. // There are no default values defined in the spec.
func NewUntunnelParams() UntunnelParams { func NewUnshareParams() UnshareParams {
return UntunnelParams{} return UnshareParams{}
} }
// UntunnelParams contains all the bound params for the untunnel operation // UnshareParams contains all the bound params for the unshare operation
// typically these are obtained from a http.Request // typically these are obtained from a http.Request
// //
// swagger:parameters untunnel // swagger:parameters unshare
type UntunnelParams struct { type UnshareParams struct {
// HTTP Request Object // HTTP Request Object
HTTPRequest *http.Request `json:"-"` HTTPRequest *http.Request `json:"-"`
@ -36,21 +36,21 @@ type UntunnelParams struct {
/* /*
In: body In: body
*/ */
Body *rest_model_zrok.UntunnelRequest Body *rest_model_zrok.UnshareRequest
} }
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface // 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. // for simple values it will use straight method calls.
// //
// To ensure default values, the struct must have been initialized with NewUntunnelParams() beforehand. // To ensure default values, the struct must have been initialized with NewUnshareParams() beforehand.
func (o *UntunnelParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { func (o *UnshareParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error var res []error
o.HTTPRequest = r o.HTTPRequest = r
if runtime.HasBody(r) { if runtime.HasBody(r) {
defer r.Body.Close() defer r.Body.Close()
var body rest_model_zrok.UntunnelRequest var body rest_model_zrok.UnshareRequest
if err := route.Consumer.Consume(r.Body, &body); err != nil { if err := route.Consumer.Consume(r.Body, &body); err != nil {
res = append(res, errors.NewParseError("body", "body", "", err)) res = append(res, errors.NewParseError("body", "body", "", err))
} else { } else {

View File

@ -0,0 +1,132 @@
// 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"
)
// UnshareOKCode is the HTTP code returned for type UnshareOK
const UnshareOKCode int = 200
/*
UnshareOK service removed
swagger:response unshareOK
*/
type UnshareOK struct {
}
// NewUnshareOK creates UnshareOK with default headers values
func NewUnshareOK() *UnshareOK {
return &UnshareOK{}
}
// WriteResponse to the client
func (o *UnshareOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(200)
}
// UnshareUnauthorizedCode is the HTTP code returned for type UnshareUnauthorized
const UnshareUnauthorizedCode int = 401
/*
UnshareUnauthorized unauthorized
swagger:response unshareUnauthorized
*/
type UnshareUnauthorized struct {
}
// NewUnshareUnauthorized creates UnshareUnauthorized with default headers values
func NewUnshareUnauthorized() *UnshareUnauthorized {
return &UnshareUnauthorized{}
}
// WriteResponse to the client
func (o *UnshareUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(401)
}
// UnshareNotFoundCode is the HTTP code returned for type UnshareNotFound
const UnshareNotFoundCode int = 404
/*
UnshareNotFound not found
swagger:response unshareNotFound
*/
type UnshareNotFound struct {
}
// NewUnshareNotFound creates UnshareNotFound with default headers values
func NewUnshareNotFound() *UnshareNotFound {
return &UnshareNotFound{}
}
// WriteResponse to the client
func (o *UnshareNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(404)
}
// UnshareInternalServerErrorCode is the HTTP code returned for type UnshareInternalServerError
const UnshareInternalServerErrorCode int = 500
/*
UnshareInternalServerError internal server error
swagger:response unshareInternalServerError
*/
type UnshareInternalServerError struct {
/*
In: Body
*/
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
}
// NewUnshareInternalServerError creates UnshareInternalServerError with default headers values
func NewUnshareInternalServerError() *UnshareInternalServerError {
return &UnshareInternalServerError{}
}
// WithPayload adds the payload to the unshare internal server error response
func (o *UnshareInternalServerError) WithPayload(payload rest_model_zrok.ErrorMessage) *UnshareInternalServerError {
o.Payload = payload
return o
}
// SetPayload sets the payload to the unshare internal server error response
func (o *UnshareInternalServerError) SetPayload(payload rest_model_zrok.ErrorMessage) {
o.Payload = payload
}
// WriteResponse to the client
func (o *UnshareInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(500)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -1,6 +1,6 @@
// Code generated by go-swagger; DO NOT EDIT. // Code generated by go-swagger; DO NOT EDIT.
package tunnel package service
// This file was generated by the swagger tool. // This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command // Editing this file might prove futile when you re-run the generate command
@ -11,15 +11,15 @@ import (
golangswaggerpaths "path" golangswaggerpaths "path"
) )
// UntunnelURL generates an URL for the untunnel operation // UnshareURL generates an URL for the unshare operation
type UntunnelURL struct { type UnshareURL struct {
_basePath string _basePath string
} }
// WithBasePath sets the base path for this url builder, only required when it's different from the // WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec. // base path specified in the swagger spec.
// When the value of the base path is an empty string // When the value of the base path is an empty string
func (o *UntunnelURL) WithBasePath(bp string) *UntunnelURL { func (o *UnshareURL) WithBasePath(bp string) *UnshareURL {
o.SetBasePath(bp) o.SetBasePath(bp)
return o return o
} }
@ -27,15 +27,15 @@ func (o *UntunnelURL) WithBasePath(bp string) *UntunnelURL {
// SetBasePath sets the base path for this url builder, only required when it's different from the // SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec. // base path specified in the swagger spec.
// When the value of the base path is an empty string // When the value of the base path is an empty string
func (o *UntunnelURL) SetBasePath(bp string) { func (o *UnshareURL) SetBasePath(bp string) {
o._basePath = bp o._basePath = bp
} }
// Build a url path and query string // Build a url path and query string
func (o *UntunnelURL) Build() (*url.URL, error) { func (o *UnshareURL) Build() (*url.URL, error) {
var _result url.URL var _result url.URL
var _path = "/untunnel" var _path = "/unshare"
_basePath := o._basePath _basePath := o._basePath
if _basePath == "" { if _basePath == "" {
@ -47,7 +47,7 @@ func (o *UntunnelURL) Build() (*url.URL, error) {
} }
// Must is a helper function to panic when the url builder returns an error // Must is a helper function to panic when the url builder returns an error
func (o *UntunnelURL) Must(u *url.URL, err error) *url.URL { func (o *UnshareURL) Must(u *url.URL, err error) *url.URL {
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -58,17 +58,17 @@ func (o *UntunnelURL) Must(u *url.URL, err error) *url.URL {
} }
// String returns the string representation of the path with query string // String returns the string representation of the path with query string
func (o *UntunnelURL) String() string { func (o *UnshareURL) String() string {
return o.Must(o.Build()).String() return o.Must(o.Build()).String()
} }
// BuildFull builds a full url with scheme, host, path and query string // BuildFull builds a full url with scheme, host, path and query string
func (o *UntunnelURL) BuildFull(scheme, host string) (*url.URL, error) { func (o *UnshareURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" { if scheme == "" {
return nil, errors.New("scheme is required for a full url on UntunnelURL") return nil, errors.New("scheme is required for a full url on UnshareURL")
} }
if host == "" { if host == "" {
return nil, errors.New("host is required for a full url on UntunnelURL") return nil, errors.New("host is required for a full url on UnshareURL")
} }
base, err := o.Build() base, err := o.Build()
@ -82,6 +82,6 @@ func (o *UntunnelURL) BuildFull(scheme, host string) (*url.URL, error) {
} }
// StringFull returns the string representation of a complete url // StringFull returns the string representation of a complete url
func (o *UntunnelURL) StringFull(scheme, host string) string { func (o *UnshareURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String() return o.Must(o.BuildFull(scheme, host)).String()
} }

View File

@ -1,145 +0,0 @@
// Code generated by go-swagger; DO NOT EDIT.
package tunnel
// 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"
)
// TunnelCreatedCode is the HTTP code returned for type TunnelCreated
const TunnelCreatedCode int = 201
/*
TunnelCreated tunnel created
swagger:response tunnelCreated
*/
type TunnelCreated struct {
/*
In: Body
*/
Payload *rest_model_zrok.TunnelResponse `json:"body,omitempty"`
}
// NewTunnelCreated creates TunnelCreated with default headers values
func NewTunnelCreated() *TunnelCreated {
return &TunnelCreated{}
}
// WithPayload adds the payload to the tunnel created response
func (o *TunnelCreated) WithPayload(payload *rest_model_zrok.TunnelResponse) *TunnelCreated {
o.Payload = payload
return o
}
// SetPayload sets the payload to the tunnel created response
func (o *TunnelCreated) SetPayload(payload *rest_model_zrok.TunnelResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TunnelCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(201)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// TunnelUnauthorizedCode is the HTTP code returned for type TunnelUnauthorized
const TunnelUnauthorizedCode int = 401
/*
TunnelUnauthorized invalid environment identity
swagger:response tunnelUnauthorized
*/
type TunnelUnauthorized struct {
/*
In: Body
*/
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
}
// NewTunnelUnauthorized creates TunnelUnauthorized with default headers values
func NewTunnelUnauthorized() *TunnelUnauthorized {
return &TunnelUnauthorized{}
}
// WithPayload adds the payload to the tunnel unauthorized response
func (o *TunnelUnauthorized) WithPayload(payload rest_model_zrok.ErrorMessage) *TunnelUnauthorized {
o.Payload = payload
return o
}
// SetPayload sets the payload to the tunnel unauthorized response
func (o *TunnelUnauthorized) SetPayload(payload rest_model_zrok.ErrorMessage) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TunnelUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(401)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
// TunnelInternalServerErrorCode is the HTTP code returned for type TunnelInternalServerError
const TunnelInternalServerErrorCode int = 500
/*
TunnelInternalServerError internal server error
swagger:response tunnelInternalServerError
*/
type TunnelInternalServerError struct {
/*
In: Body
*/
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
}
// NewTunnelInternalServerError creates TunnelInternalServerError with default headers values
func NewTunnelInternalServerError() *TunnelInternalServerError {
return &TunnelInternalServerError{}
}
// WithPayload adds the payload to the tunnel internal server error response
func (o *TunnelInternalServerError) WithPayload(payload rest_model_zrok.ErrorMessage) *TunnelInternalServerError {
o.Payload = payload
return o
}
// SetPayload sets the payload to the tunnel internal server error response
func (o *TunnelInternalServerError) SetPayload(payload rest_model_zrok.ErrorMessage) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TunnelInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(500)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -1,125 +0,0 @@
// Code generated by go-swagger; DO NOT EDIT.
package tunnel
// 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"
)
// UntunnelOKCode is the HTTP code returned for type UntunnelOK
const UntunnelOKCode int = 200
/*
UntunnelOK tunnel removed
swagger:response untunnelOK
*/
type UntunnelOK struct {
}
// NewUntunnelOK creates UntunnelOK with default headers values
func NewUntunnelOK() *UntunnelOK {
return &UntunnelOK{}
}
// WriteResponse to the client
func (o *UntunnelOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(200)
}
// UntunnelNotFoundCode is the HTTP code returned for type UntunnelNotFound
const UntunnelNotFoundCode int = 404
/*
UntunnelNotFound not found
swagger:response untunnelNotFound
*/
type UntunnelNotFound struct {
/*
In: Body
*/
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
}
// NewUntunnelNotFound creates UntunnelNotFound with default headers values
func NewUntunnelNotFound() *UntunnelNotFound {
return &UntunnelNotFound{}
}
// WithPayload adds the payload to the untunnel not found response
func (o *UntunnelNotFound) WithPayload(payload rest_model_zrok.ErrorMessage) *UntunnelNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the untunnel not found response
func (o *UntunnelNotFound) SetPayload(payload rest_model_zrok.ErrorMessage) {
o.Payload = payload
}
// WriteResponse to the client
func (o *UntunnelNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
// UntunnelInternalServerErrorCode is the HTTP code returned for type UntunnelInternalServerError
const UntunnelInternalServerErrorCode int = 500
/*
UntunnelInternalServerError internal server error
swagger:response untunnelInternalServerError
*/
type UntunnelInternalServerError struct {
/*
In: Body
*/
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
}
// NewUntunnelInternalServerError creates UntunnelInternalServerError with default headers values
func NewUntunnelInternalServerError() *UntunnelInternalServerError {
return &UntunnelInternalServerError{}
}
// WithPayload adds the payload to the untunnel internal server error response
func (o *UntunnelInternalServerError) WithPayload(payload rest_model_zrok.ErrorMessage) *UntunnelInternalServerError {
o.Payload = payload
return o
}
// SetPayload sets the payload to the untunnel internal server error response
func (o *UntunnelInternalServerError) SetPayload(payload rest_model_zrok.ErrorMessage) {
o.Payload = payload
}
// WriteResponse to the client
func (o *UntunnelInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(500)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -22,7 +22,7 @@ import (
"github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti-test-kitchen/zrok/rest_model_zrok"
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/identity" "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/identity"
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/metadata" "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/metadata"
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/tunnel" "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/service"
) )
// NewZrokAPI creates a new Zrok instance // NewZrokAPI creates a new Zrok instance
@ -65,11 +65,11 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
IdentityRegisterHandler: identity.RegisterHandlerFunc(func(params identity.RegisterParams) middleware.Responder { IdentityRegisterHandler: identity.RegisterHandlerFunc(func(params identity.RegisterParams) middleware.Responder {
return middleware.NotImplemented("operation identity.Register has not yet been implemented") return middleware.NotImplemented("operation identity.Register has not yet been implemented")
}), }),
TunnelTunnelHandler: tunnel.TunnelHandlerFunc(func(params tunnel.TunnelParams, principal *rest_model_zrok.Principal) middleware.Responder { ServiceShareHandler: service.ShareHandlerFunc(func(params service.ShareParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation tunnel.Tunnel has not yet been implemented") return middleware.NotImplemented("operation service.Share has not yet been implemented")
}), }),
TunnelUntunnelHandler: tunnel.UntunnelHandlerFunc(func(params tunnel.UntunnelParams, principal *rest_model_zrok.Principal) middleware.Responder { ServiceUnshareHandler: service.UnshareHandlerFunc(func(params service.UnshareParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation tunnel.Untunnel has not yet been implemented") return middleware.NotImplemented("operation service.Unshare has not yet been implemented")
}), }),
IdentityVerifyHandler: identity.VerifyHandlerFunc(func(params identity.VerifyParams) middleware.Responder { IdentityVerifyHandler: identity.VerifyHandlerFunc(func(params identity.VerifyParams) middleware.Responder {
return middleware.NotImplemented("operation identity.Verify has not yet been implemented") return middleware.NotImplemented("operation identity.Verify has not yet been implemented")
@ -139,10 +139,10 @@ type ZrokAPI struct {
MetadataOverviewHandler metadata.OverviewHandler MetadataOverviewHandler metadata.OverviewHandler
// IdentityRegisterHandler sets the operation handler for the register operation // IdentityRegisterHandler sets the operation handler for the register operation
IdentityRegisterHandler identity.RegisterHandler IdentityRegisterHandler identity.RegisterHandler
// TunnelTunnelHandler sets the operation handler for the tunnel operation // ServiceShareHandler sets the operation handler for the share operation
TunnelTunnelHandler tunnel.TunnelHandler ServiceShareHandler service.ShareHandler
// TunnelUntunnelHandler sets the operation handler for the untunnel operation // ServiceUnshareHandler sets the operation handler for the unshare operation
TunnelUntunnelHandler tunnel.UntunnelHandler ServiceUnshareHandler service.UnshareHandler
// IdentityVerifyHandler sets the operation handler for the verify operation // IdentityVerifyHandler sets the operation handler for the verify operation
IdentityVerifyHandler identity.VerifyHandler IdentityVerifyHandler identity.VerifyHandler
// MetadataVersionHandler sets the operation handler for the version operation // MetadataVersionHandler sets the operation handler for the version operation
@ -246,11 +246,11 @@ func (o *ZrokAPI) Validate() error {
if o.IdentityRegisterHandler == nil { if o.IdentityRegisterHandler == nil {
unregistered = append(unregistered, "identity.RegisterHandler") unregistered = append(unregistered, "identity.RegisterHandler")
} }
if o.TunnelTunnelHandler == nil { if o.ServiceShareHandler == nil {
unregistered = append(unregistered, "tunnel.TunnelHandler") unregistered = append(unregistered, "service.ShareHandler")
} }
if o.TunnelUntunnelHandler == nil { if o.ServiceUnshareHandler == nil {
unregistered = append(unregistered, "tunnel.UntunnelHandler") unregistered = append(unregistered, "service.UnshareHandler")
} }
if o.IdentityVerifyHandler == nil { if o.IdentityVerifyHandler == nil {
unregistered = append(unregistered, "identity.VerifyHandler") unregistered = append(unregistered, "identity.VerifyHandler")
@ -384,11 +384,11 @@ func (o *ZrokAPI) initHandlerCache() {
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)
} }
o.handlers["POST"]["/tunnel"] = tunnel.NewTunnel(o.context, o.TunnelTunnelHandler) o.handlers["POST"]["/share"] = service.NewShare(o.context, o.ServiceShareHandler)
if o.handlers["DELETE"] == nil { if o.handlers["DELETE"] == nil {
o.handlers["DELETE"] = make(map[string]http.Handler) o.handlers["DELETE"] = make(map[string]http.Handler)
} }
o.handlers["DELETE"]["/untunnel"] = tunnel.NewUntunnel(o.context, o.TunnelUntunnelHandler) o.handlers["DELETE"]["/unshare"] = service.NewUnshare(o.context, o.ServiceUnshareHandler)
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)
} }

View File

@ -177,52 +177,50 @@ paths:
schema: schema:
$ref: "#/definitions/version" $ref: "#/definitions/version"
# #
# tunnel # service
# #
/tunnel: /share:
post: post:
tags: tags:
- tunnel - service
security: security:
- key: [] - key: []
operationId: tunnel operationId: share
parameters: parameters:
- name: body - name: body
in: body in: body
schema: schema:
$ref: "#/definitions/tunnelRequest" $ref: "#/definitions/shareRequest"
responses: responses:
201: 201:
description: tunnel created description: service created
schema: schema:
$ref: "#/definitions/tunnelResponse" $ref: "#/definitions/shareResponse"
401: 401:
description: invalid environment identity description: unauthorized
schema:
$ref: "#/definitions/errorMessage"
500: 500:
description: internal server error description: internal server error
schema: schema:
$ref: "#/definitions/errorMessage" $ref: "#/definitions/errorMessage"
/untunnel: /unshare:
delete: delete:
tags: tags:
- tunnel - service
security: security:
- key: [] - key: []
operationId: untunnel operationId: unshare
parameters: parameters:
- name: body - name: body
in: body in: body
schema: schema:
$ref: "#/definitions/untunnelRequest" $ref: "#/definitions/unshareRequest"
responses: responses:
200: 200:
description: tunnel removed description: service removed
401:
description: unauthorized
404: 404:
description: not found description: not found
schema:
$ref: "#/definitions/errorMessage"
500: 500:
description: internal server error description: internal server error
schema: schema:
@ -361,7 +359,7 @@ definitions:
items: items:
type: integer type: integer
tunnelRequest: shareRequest:
type: object type: object
properties: properties:
zId: zId:
@ -374,7 +372,7 @@ definitions:
type: array type: array
items: items:
$ref: "#/definitions/authUser" $ref: "#/definitions/authUser"
tunnelResponse: shareResponse:
type: object type: object
properties: properties:
proxyEndpoint: proxyEndpoint:
@ -382,7 +380,7 @@ definitions:
svcName: svcName:
type: string type: string
untunnelRequest: unshareRequest:
type: object type: object
properties: properties:
zId: zId:

View File

@ -1,39 +1,39 @@
/** @module tunnel */ /** @module service */
// Auto-generated, edits will be overwritten // Auto-generated, edits will be overwritten
import * as gateway from './gateway' import * as gateway from './gateway'
/** /**
* @param {object} options Optional options * @param {object} options Optional options
* @param {module:types.tunnelRequest} [options.body] * @param {module:types.shareRequest} [options.body]
* @return {Promise<module:types.tunnelResponse>} tunnel created * @return {Promise<module:types.shareResponse>} service created
*/ */
export function tunnel(options) { export function share(options) {
if (!options) options = {} if (!options) options = {}
const parameters = { const parameters = {
body: { body: {
body: options.body body: options.body
} }
} }
return gateway.request(tunnelOperation, parameters) return gateway.request(shareOperation, parameters)
} }
/** /**
* @param {object} options Optional options * @param {object} options Optional options
* @param {module:types.untunnelRequest} [options.body] * @param {module:types.unshareRequest} [options.body]
* @return {Promise<object>} tunnel removed * @return {Promise<object>} service removed
*/ */
export function untunnel(options) { export function unshare(options) {
if (!options) options = {} if (!options) options = {}
const parameters = { const parameters = {
body: { body: {
body: options.body body: options.body
} }
} }
return gateway.request(untunnelOperation, parameters) return gateway.request(unshareOperation, parameters)
} }
const tunnelOperation = { const shareOperation = {
path: '/tunnel', path: '/share',
contentTypes: ['application/zrok.v1+json'], contentTypes: ['application/zrok.v1+json'],
method: 'post', method: 'post',
security: [ security: [
@ -43,8 +43,8 @@ const tunnelOperation = {
] ]
} }
const untunnelOperation = { const unshareOperation = {
path: '/untunnel', path: '/unshare',
contentTypes: ['application/zrok.v1+json'], contentTypes: ['application/zrok.v1+json'],
method: 'delete', method: 'delete',
security: [ security: [

View File

@ -106,7 +106,7 @@
*/ */
/** /**
* @typedef tunnelRequest * @typedef shareRequest
* @memberof module:types * @memberof module:types
* *
* @property {string} zId * @property {string} zId
@ -116,7 +116,7 @@
*/ */
/** /**
* @typedef tunnelResponse * @typedef shareResponse
* @memberof module:types * @memberof module:types
* *
* @property {string} proxyEndpoint * @property {string} proxyEndpoint
@ -124,7 +124,7 @@
*/ */
/** /**
* @typedef untunnelRequest * @typedef unshareRequest
* @memberof module:types * @memberof module:types
* *
* @property {string} zId * @property {string} zId