mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01:00
naming cleanups in api
This commit is contained in:
parent
887db1d2b6
commit
40252f7a10
@ -91,9 +91,9 @@ func (self *httpBackendCommand) run(_ *cobra.Command, args []string) {
|
||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", env.Token)
|
||||
req := tunnel.NewTunnelParams()
|
||||
req.Body = &rest_model_zrok.TunnelRequest{
|
||||
ZitiIdentityID: env.ZId,
|
||||
Endpoint: cfg.EndpointAddress,
|
||||
AuthScheme: string(model.None),
|
||||
ZID: env.ZId,
|
||||
Endpoint: cfg.EndpointAddress,
|
||||
AuthScheme: string(model.None),
|
||||
}
|
||||
if len(self.basicAuth) > 0 {
|
||||
logrus.Infof("configuring basic auth")
|
||||
@ -115,7 +115,7 @@ func (self *httpBackendCommand) run(_ *cobra.Command, args []string) {
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
cfg.Service = resp.Payload.Service
|
||||
cfg.Service = resp.Payload.SvcName
|
||||
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
@ -215,8 +215,8 @@ func (self *httpBackendCommand) destroy(id string, cfg *backend.Config, zrok *re
|
||||
logrus.Debugf("shutting down '%v'", cfg.Service)
|
||||
req := tunnel.NewUntunnelParams()
|
||||
req.Body = &rest_model_zrok.UntunnelRequest{
|
||||
ZitiIdentityID: id,
|
||||
Service: cfg.Service,
|
||||
ZID: id,
|
||||
SvcName: cfg.Service,
|
||||
}
|
||||
if _, err := zrok.Tunnel.Untunnel(req, auth); err == nil {
|
||||
logrus.Debugf("shutdown complete")
|
||||
|
@ -166,15 +166,15 @@ func (l *looper) startup() {
|
||||
l.auth = httptransport.APIKeyAuth("x-token", "header", l.env.Token)
|
||||
tunnelReq := tunnel.NewTunnelParams()
|
||||
tunnelReq.Body = &rest_model_zrok.TunnelRequest{
|
||||
ZitiIdentityID: l.env.ZId,
|
||||
Endpoint: fmt.Sprintf("looper#%d", l.id),
|
||||
AuthScheme: string(model.None),
|
||||
ZID: l.env.ZId,
|
||||
Endpoint: fmt.Sprintf("looper#%d", l.id),
|
||||
AuthScheme: string(model.None),
|
||||
}
|
||||
tunnelResp, err := l.zrok.Tunnel.Tunnel(tunnelReq, l.auth)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
l.service = tunnelResp.Payload.Service
|
||||
l.service = tunnelResp.Payload.SvcName
|
||||
l.proxyEndpoint = tunnelResp.Payload.ProxyEndpoint
|
||||
}
|
||||
|
||||
@ -233,8 +233,8 @@ func (l *looper) shutdown() {
|
||||
|
||||
untunnelReq := tunnel.NewUntunnelParams()
|
||||
untunnelReq.Body = &rest_model_zrok.UntunnelRequest{
|
||||
ZitiIdentityID: l.env.ZId,
|
||||
Service: l.service,
|
||||
ZID: l.env.ZId,
|
||||
SvcName: l.service,
|
||||
}
|
||||
if _, err := l.zrok.Tunnel.Untunnel(untunnelReq, l.auth); err != nil {
|
||||
logrus.Errorf("error shutting down looper #%d: %v", l.id, err)
|
||||
|
@ -28,24 +28,24 @@ func overviewHandler(_ metadata.OverviewParams, principal *rest_model_zrok.Princ
|
||||
}
|
||||
es := &rest_model_zrok.EnvironmentServices{
|
||||
Environment: &rest_model_zrok.Environment{
|
||||
Active: env.Active,
|
||||
Address: env.Address,
|
||||
CreatedAt: env.CreatedAt.String(),
|
||||
Description: env.Description,
|
||||
Host: env.Host,
|
||||
UpdatedAt: env.UpdatedAt.String(),
|
||||
ZitiIdentityID: env.ZId,
|
||||
Active: env.Active,
|
||||
Address: env.Address,
|
||||
CreatedAt: env.CreatedAt.String(),
|
||||
Description: env.Description,
|
||||
Host: env.Host,
|
||||
UpdatedAt: env.UpdatedAt.String(),
|
||||
ZID: env.ZId,
|
||||
},
|
||||
}
|
||||
for _, svc := range svcs {
|
||||
es.Services = append(es.Services, &rest_model_zrok.Service{
|
||||
Active: svc.Active,
|
||||
CreatedAt: svc.CreatedAt.String(),
|
||||
Frontend: svc.Frontend,
|
||||
Backend: svc.Backend,
|
||||
UpdatedAt: svc.UpdatedAt.String(),
|
||||
ZitiServiceID: svc.ZId,
|
||||
ZrokServiceID: svc.Name,
|
||||
Active: svc.Active,
|
||||
CreatedAt: svc.CreatedAt.String(),
|
||||
Frontend: svc.Frontend,
|
||||
Backend: svc.Backend,
|
||||
UpdatedAt: svc.UpdatedAt.String(),
|
||||
ZID: svc.ZId,
|
||||
Name: svc.Name,
|
||||
})
|
||||
}
|
||||
out = append(out, es)
|
||||
|
@ -37,7 +37,7 @@ func (self *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_mo
|
||||
}
|
||||
defer func() { _ = tx.Rollback() }()
|
||||
|
||||
envId := params.Body.ZitiIdentityID
|
||||
envId := params.Body.ZID
|
||||
envIdDb := 0
|
||||
if envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx); err == nil {
|
||||
found := false
|
||||
@ -113,7 +113,7 @@ func (self *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_mo
|
||||
|
||||
return tunnel.NewTunnelCreated().WithPayload(&rest_model_zrok.TunnelResponse{
|
||||
ProxyEndpoint: frontendUrl,
|
||||
Service: svcName,
|
||||
SvcName: svcName,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ func (self *untunnelHandler) Handle(params tunnel.UntunnelParams, principal *res
|
||||
logrus.Error(err)
|
||||
return tunnel.NewUntunnelInternalServerError()
|
||||
}
|
||||
svcName := params.Body.Service
|
||||
svcName := params.Body.SvcName
|
||||
svcZId, err := self.findServiceZId(svcName, edge)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
@ -46,13 +46,13 @@ func (self *untunnelHandler) Handle(params tunnel.UntunnelParams, principal *res
|
||||
var senv *store.Environment
|
||||
if envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx); err == nil {
|
||||
for _, env := range envs {
|
||||
if env.ZId == params.Body.ZitiIdentityID {
|
||||
if env.ZId == params.Body.ZID {
|
||||
senv = env
|
||||
break
|
||||
}
|
||||
}
|
||||
if senv == nil {
|
||||
err := errors.Errorf("environment with id '%v' not found for '%v", params.Body.ZitiIdentityID, principal.Email)
|
||||
err := errors.Errorf("environment with id '%v' not found for '%v", params.Body.ZID, principal.Email)
|
||||
logrus.Error(err)
|
||||
return tunnel.NewUntunnelNotFound()
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ type Environment struct {
|
||||
// updated at
|
||||
UpdatedAt string `json:"updatedAt,omitempty"`
|
||||
|
||||
// ziti identity Id
|
||||
ZitiIdentityID string `json:"zitiIdentityId,omitempty"`
|
||||
// z Id
|
||||
ZID string `json:"zId,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this environment
|
||||
|
@ -29,14 +29,14 @@ type Service struct {
|
||||
// frontend
|
||||
Frontend string `json:"frontend,omitempty"`
|
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// updated at
|
||||
UpdatedAt string `json:"updatedAt,omitempty"`
|
||||
|
||||
// ziti service Id
|
||||
ZitiServiceID string `json:"zitiServiceId,omitempty"`
|
||||
|
||||
// zrok service Id
|
||||
ZrokServiceID string `json:"zrokServiceId,omitempty"`
|
||||
// z Id
|
||||
ZID string `json:"zId,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this service
|
||||
|
@ -28,8 +28,8 @@ type TunnelRequest struct {
|
||||
// endpoint
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
|
||||
// ziti identity Id
|
||||
ZitiIdentityID string `json:"zitiIdentityId,omitempty"`
|
||||
// z Id
|
||||
ZID string `json:"zId,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this tunnel request
|
||||
|
@ -20,8 +20,8 @@ type TunnelResponse struct {
|
||||
// proxy endpoint
|
||||
ProxyEndpoint string `json:"proxyEndpoint,omitempty"`
|
||||
|
||||
// service
|
||||
Service string `json:"service,omitempty"`
|
||||
// svc name
|
||||
SvcName string `json:"svcName,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this tunnel response
|
||||
|
@ -17,11 +17,11 @@ import (
|
||||
// swagger:model untunnelRequest
|
||||
type UntunnelRequest struct {
|
||||
|
||||
// service
|
||||
Service string `json:"service,omitempty"`
|
||||
// svc name
|
||||
SvcName string `json:"svcName,omitempty"`
|
||||
|
||||
// ziti identity Id
|
||||
ZitiIdentityID string `json:"zitiIdentityId,omitempty"`
|
||||
// z Id
|
||||
ZID string `json:"zId,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this untunnel request
|
||||
|
@ -439,7 +439,7 @@ func init() {
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"zitiIdentityId": {
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@ -532,13 +532,13 @@ func init() {
|
||||
"frontend": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"zitiServiceId": {
|
||||
"type": "string"
|
||||
},
|
||||
"zrokServiceId": {
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@ -564,7 +564,7 @@ func init() {
|
||||
"endpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"zitiIdentityId": {
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@ -575,7 +575,7 @@ func init() {
|
||||
"proxyEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"service": {
|
||||
"svcName": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@ -583,10 +583,10 @@ func init() {
|
||||
"untunnelRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"service": {
|
||||
"svcName": {
|
||||
"type": "string"
|
||||
},
|
||||
"zitiIdentityId": {
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@ -1041,7 +1041,7 @@ func init() {
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"zitiIdentityId": {
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@ -1134,13 +1134,13 @@ func init() {
|
||||
"frontend": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"zitiServiceId": {
|
||||
"type": "string"
|
||||
},
|
||||
"zrokServiceId": {
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@ -1166,7 +1166,7 @@ func init() {
|
||||
"endpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"zitiIdentityId": {
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@ -1177,7 +1177,7 @@ func init() {
|
||||
"proxyEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"service": {
|
||||
"svcName": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@ -1185,10 +1185,10 @@ func init() {
|
||||
"untunnelRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"service": {
|
||||
"svcName": {
|
||||
"type": "string"
|
||||
},
|
||||
"zitiIdentityId": {
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ definitions:
|
||||
type: string
|
||||
address:
|
||||
type: string
|
||||
zitiIdentityId:
|
||||
zId:
|
||||
type: string
|
||||
active:
|
||||
type: boolean
|
||||
@ -341,9 +341,9 @@ definitions:
|
||||
service:
|
||||
type: object
|
||||
properties:
|
||||
zitiServiceId:
|
||||
zId:
|
||||
type: string
|
||||
zrokServiceId:
|
||||
name:
|
||||
type: string
|
||||
frontend:
|
||||
type: string
|
||||
@ -359,7 +359,7 @@ definitions:
|
||||
tunnelRequest:
|
||||
type: object
|
||||
properties:
|
||||
zitiIdentityId:
|
||||
zId:
|
||||
type: string
|
||||
endpoint:
|
||||
type: string
|
||||
@ -374,15 +374,15 @@ definitions:
|
||||
properties:
|
||||
proxyEndpoint:
|
||||
type: string
|
||||
service:
|
||||
svcName:
|
||||
type: string
|
||||
|
||||
untunnelRequest:
|
||||
type: object
|
||||
properties:
|
||||
zitiIdentityId:
|
||||
zId:
|
||||
type: string
|
||||
service:
|
||||
svcName:
|
||||
type: string
|
||||
|
||||
verifyRequest:
|
||||
|
@ -20,7 +20,7 @@ const Environments = (props) => {
|
||||
},
|
||||
{
|
||||
name: 'Identity',
|
||||
selector: row => row.environment.zitiIdentityId,
|
||||
selector: row => row.environment.zId,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
|
@ -46,7 +46,7 @@
|
||||
* @property {string} description
|
||||
* @property {string} host
|
||||
* @property {string} address
|
||||
* @property {string} zitiIdentityId
|
||||
* @property {string} zId
|
||||
* @property {boolean} active
|
||||
* @property {string} createdAt
|
||||
* @property {string} updatedAt
|
||||
@ -96,8 +96,8 @@
|
||||
* @typedef service
|
||||
* @memberof module:types
|
||||
*
|
||||
* @property {string} zitiServiceId
|
||||
* @property {string} zrokServiceId
|
||||
* @property {string} zId
|
||||
* @property {string} name
|
||||
* @property {string} frontend
|
||||
* @property {string} backend
|
||||
* @property {boolean} active
|
||||
@ -109,7 +109,7 @@
|
||||
* @typedef tunnelRequest
|
||||
* @memberof module:types
|
||||
*
|
||||
* @property {string} zitiIdentityId
|
||||
* @property {string} zId
|
||||
* @property {string} endpoint
|
||||
* @property {string} authScheme
|
||||
* @property {module:types.authUser[]} authUsers
|
||||
@ -120,15 +120,15 @@
|
||||
* @memberof module:types
|
||||
*
|
||||
* @property {string} proxyEndpoint
|
||||
* @property {string} service
|
||||
* @property {string} svcName
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef untunnelRequest
|
||||
* @memberof module:types
|
||||
*
|
||||
* @property {string} zitiIdentityId
|
||||
* @property {string} service
|
||||
* @property {string} zId
|
||||
* @property {string} svcName
|
||||
*/
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user