naming cleanups in api

This commit is contained in:
Michael Quigley 2022-10-19 12:35:29 -04:00
parent 887db1d2b6
commit 40252f7a10
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
14 changed files with 79 additions and 79 deletions

View File

@ -91,9 +91,9 @@ func (self *httpBackendCommand) run(_ *cobra.Command, args []string) {
auth := httptransport.APIKeyAuth("X-TOKEN", "header", env.Token) auth := httptransport.APIKeyAuth("X-TOKEN", "header", env.Token)
req := tunnel.NewTunnelParams() req := tunnel.NewTunnelParams()
req.Body = &rest_model_zrok.TunnelRequest{ req.Body = &rest_model_zrok.TunnelRequest{
ZitiIdentityID: env.ZId, ZID: env.ZId,
Endpoint: cfg.EndpointAddress, Endpoint: cfg.EndpointAddress,
AuthScheme: string(model.None), AuthScheme: string(model.None),
} }
if len(self.basicAuth) > 0 { if len(self.basicAuth) > 0 {
logrus.Infof("configuring basic auth") logrus.Infof("configuring basic auth")
@ -115,7 +115,7 @@ func (self *httpBackendCommand) run(_ *cobra.Command, args []string) {
} }
panic(err) panic(err)
} }
cfg.Service = resp.Payload.Service cfg.Service = resp.Payload.SvcName
c := make(chan os.Signal) c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM) 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) logrus.Debugf("shutting down '%v'", cfg.Service)
req := tunnel.NewUntunnelParams() req := tunnel.NewUntunnelParams()
req.Body = &rest_model_zrok.UntunnelRequest{ req.Body = &rest_model_zrok.UntunnelRequest{
ZitiIdentityID: id, ZID: id,
Service: cfg.Service, SvcName: cfg.Service,
} }
if _, err := zrok.Tunnel.Untunnel(req, auth); err == nil { if _, err := zrok.Tunnel.Untunnel(req, auth); err == nil {
logrus.Debugf("shutdown complete") logrus.Debugf("shutdown complete")

View File

@ -166,15 +166,15 @@ func (l *looper) startup() {
l.auth = httptransport.APIKeyAuth("x-token", "header", l.env.Token) l.auth = httptransport.APIKeyAuth("x-token", "header", l.env.Token)
tunnelReq := tunnel.NewTunnelParams() tunnelReq := tunnel.NewTunnelParams()
tunnelReq.Body = &rest_model_zrok.TunnelRequest{ tunnelReq.Body = &rest_model_zrok.TunnelRequest{
ZitiIdentityID: 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),
} }
tunnelResp, err := l.zrok.Tunnel.Tunnel(tunnelReq, l.auth) tunnelResp, err := l.zrok.Tunnel.Tunnel(tunnelReq, l.auth)
if err != nil { if err != nil {
panic(err) panic(err)
} }
l.service = tunnelResp.Payload.Service l.service = tunnelResp.Payload.SvcName
l.proxyEndpoint = tunnelResp.Payload.ProxyEndpoint l.proxyEndpoint = tunnelResp.Payload.ProxyEndpoint
} }
@ -233,8 +233,8 @@ func (l *looper) shutdown() {
untunnelReq := tunnel.NewUntunnelParams() untunnelReq := tunnel.NewUntunnelParams()
untunnelReq.Body = &rest_model_zrok.UntunnelRequest{ untunnelReq.Body = &rest_model_zrok.UntunnelRequest{
ZitiIdentityID: l.env.ZId, ZID: l.env.ZId,
Service: l.service, SvcName: l.service,
} }
if _, err := l.zrok.Tunnel.Untunnel(untunnelReq, l.auth); err != nil { if _, err := l.zrok.Tunnel.Untunnel(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

@ -28,24 +28,24 @@ func overviewHandler(_ metadata.OverviewParams, principal *rest_model_zrok.Princ
} }
es := &rest_model_zrok.EnvironmentServices{ es := &rest_model_zrok.EnvironmentServices{
Environment: &rest_model_zrok.Environment{ Environment: &rest_model_zrok.Environment{
Active: env.Active, Active: env.Active,
Address: env.Address, Address: env.Address,
CreatedAt: env.CreatedAt.String(), CreatedAt: env.CreatedAt.String(),
Description: env.Description, Description: env.Description,
Host: env.Host, Host: env.Host,
UpdatedAt: env.UpdatedAt.String(), UpdatedAt: env.UpdatedAt.String(),
ZitiIdentityID: env.ZId, ZID: env.ZId,
}, },
} }
for _, svc := range svcs { for _, svc := range svcs {
es.Services = append(es.Services, &rest_model_zrok.Service{ es.Services = append(es.Services, &rest_model_zrok.Service{
Active: svc.Active, Active: svc.Active,
CreatedAt: svc.CreatedAt.String(), CreatedAt: svc.CreatedAt.String(),
Frontend: svc.Frontend, Frontend: svc.Frontend,
Backend: svc.Backend, Backend: svc.Backend,
UpdatedAt: svc.UpdatedAt.String(), UpdatedAt: svc.UpdatedAt.String(),
ZitiServiceID: svc.ZId, ZID: svc.ZId,
ZrokServiceID: svc.Name, Name: svc.Name,
}) })
} }
out = append(out, es) out = append(out, es)

View File

@ -37,7 +37,7 @@ func (self *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_mo
} }
defer func() { _ = tx.Rollback() }() defer func() { _ = tx.Rollback() }()
envId := params.Body.ZitiIdentityID envId := params.Body.ZID
envIdDb := 0 envIdDb := 0
if envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx); err == nil { if envs, err := str.FindEnvironmentsForAccount(int(principal.ID), tx); err == nil {
found := false found := false
@ -113,7 +113,7 @@ func (self *tunnelHandler) Handle(params tunnel.TunnelParams, principal *rest_mo
return tunnel.NewTunnelCreated().WithPayload(&rest_model_zrok.TunnelResponse{ return tunnel.NewTunnelCreated().WithPayload(&rest_model_zrok.TunnelResponse{
ProxyEndpoint: frontendUrl, ProxyEndpoint: frontendUrl,
Service: svcName, SvcName: svcName,
}) })
} }

View File

@ -37,7 +37,7 @@ func (self *untunnelHandler) Handle(params tunnel.UntunnelParams, principal *res
logrus.Error(err) logrus.Error(err)
return tunnel.NewUntunnelInternalServerError() return tunnel.NewUntunnelInternalServerError()
} }
svcName := params.Body.Service svcName := params.Body.SvcName
svcZId, err := self.findServiceZId(svcName, edge) svcZId, err := self.findServiceZId(svcName, edge)
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
@ -46,13 +46,13 @@ func (self *untunnelHandler) Handle(params tunnel.UntunnelParams, principal *res
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 {
for _, env := range envs { for _, env := range envs {
if env.ZId == params.Body.ZitiIdentityID { if env.ZId == params.Body.ZID {
senv = env senv = env
break break
} }
} }
if senv == nil { 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) logrus.Error(err)
return tunnel.NewUntunnelNotFound() return tunnel.NewUntunnelNotFound()
} }

View File

@ -35,8 +35,8 @@ type Environment struct {
// updated at // updated at
UpdatedAt string `json:"updatedAt,omitempty"` UpdatedAt string `json:"updatedAt,omitempty"`
// ziti identity Id // z Id
ZitiIdentityID string `json:"zitiIdentityId,omitempty"` ZID string `json:"zId,omitempty"`
} }
// Validate validates this environment // Validate validates this environment

View File

@ -29,14 +29,14 @@ type Service struct {
// frontend // frontend
Frontend string `json:"frontend,omitempty"` Frontend string `json:"frontend,omitempty"`
// name
Name string `json:"name,omitempty"`
// updated at // updated at
UpdatedAt string `json:"updatedAt,omitempty"` UpdatedAt string `json:"updatedAt,omitempty"`
// ziti service Id // z Id
ZitiServiceID string `json:"zitiServiceId,omitempty"` ZID string `json:"zId,omitempty"`
// zrok service Id
ZrokServiceID string `json:"zrokServiceId,omitempty"`
} }
// Validate validates this service // Validate validates this service

View File

@ -28,8 +28,8 @@ type TunnelRequest struct {
// endpoint // endpoint
Endpoint string `json:"endpoint,omitempty"` Endpoint string `json:"endpoint,omitempty"`
// ziti identity Id // z Id
ZitiIdentityID string `json:"zitiIdentityId,omitempty"` ZID string `json:"zId,omitempty"`
} }
// Validate validates this tunnel request // Validate validates this tunnel request

View File

@ -20,8 +20,8 @@ type TunnelResponse struct {
// proxy endpoint // proxy endpoint
ProxyEndpoint string `json:"proxyEndpoint,omitempty"` ProxyEndpoint string `json:"proxyEndpoint,omitempty"`
// service // svc name
Service string `json:"service,omitempty"` SvcName string `json:"svcName,omitempty"`
} }
// Validate validates this tunnel response // Validate validates this tunnel response

View File

@ -17,11 +17,11 @@ import (
// swagger:model untunnelRequest // swagger:model untunnelRequest
type UntunnelRequest struct { type UntunnelRequest struct {
// service // svc name
Service string `json:"service,omitempty"` SvcName string `json:"svcName,omitempty"`
// ziti identity Id // z Id
ZitiIdentityID string `json:"zitiIdentityId,omitempty"` ZID string `json:"zId,omitempty"`
} }
// Validate validates this untunnel request // Validate validates this untunnel request

View File

@ -439,7 +439,7 @@ func init() {
"updatedAt": { "updatedAt": {
"type": "string" "type": "string"
}, },
"zitiIdentityId": { "zId": {
"type": "string" "type": "string"
} }
} }
@ -532,13 +532,13 @@ func init() {
"frontend": { "frontend": {
"type": "string" "type": "string"
}, },
"name": {
"type": "string"
},
"updatedAt": { "updatedAt": {
"type": "string" "type": "string"
}, },
"zitiServiceId": { "zId": {
"type": "string"
},
"zrokServiceId": {
"type": "string" "type": "string"
} }
} }
@ -564,7 +564,7 @@ func init() {
"endpoint": { "endpoint": {
"type": "string" "type": "string"
}, },
"zitiIdentityId": { "zId": {
"type": "string" "type": "string"
} }
} }
@ -575,7 +575,7 @@ func init() {
"proxyEndpoint": { "proxyEndpoint": {
"type": "string" "type": "string"
}, },
"service": { "svcName": {
"type": "string" "type": "string"
} }
} }
@ -583,10 +583,10 @@ func init() {
"untunnelRequest": { "untunnelRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
"service": { "svcName": {
"type": "string" "type": "string"
}, },
"zitiIdentityId": { "zId": {
"type": "string" "type": "string"
} }
} }
@ -1041,7 +1041,7 @@ func init() {
"updatedAt": { "updatedAt": {
"type": "string" "type": "string"
}, },
"zitiIdentityId": { "zId": {
"type": "string" "type": "string"
} }
} }
@ -1134,13 +1134,13 @@ func init() {
"frontend": { "frontend": {
"type": "string" "type": "string"
}, },
"name": {
"type": "string"
},
"updatedAt": { "updatedAt": {
"type": "string" "type": "string"
}, },
"zitiServiceId": { "zId": {
"type": "string"
},
"zrokServiceId": {
"type": "string" "type": "string"
} }
} }
@ -1166,7 +1166,7 @@ func init() {
"endpoint": { "endpoint": {
"type": "string" "type": "string"
}, },
"zitiIdentityId": { "zId": {
"type": "string" "type": "string"
} }
} }
@ -1177,7 +1177,7 @@ func init() {
"proxyEndpoint": { "proxyEndpoint": {
"type": "string" "type": "string"
}, },
"service": { "svcName": {
"type": "string" "type": "string"
} }
} }
@ -1185,10 +1185,10 @@ func init() {
"untunnelRequest": { "untunnelRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
"service": { "svcName": {
"type": "string" "type": "string"
}, },
"zitiIdentityId": { "zId": {
"type": "string" "type": "string"
} }
} }

View File

@ -277,7 +277,7 @@ definitions:
type: string type: string
address: address:
type: string type: string
zitiIdentityId: zId:
type: string type: string
active: active:
type: boolean type: boolean
@ -341,9 +341,9 @@ definitions:
service: service:
type: object type: object
properties: properties:
zitiServiceId: zId:
type: string type: string
zrokServiceId: name:
type: string type: string
frontend: frontend:
type: string type: string
@ -359,7 +359,7 @@ definitions:
tunnelRequest: tunnelRequest:
type: object type: object
properties: properties:
zitiIdentityId: zId:
type: string type: string
endpoint: endpoint:
type: string type: string
@ -374,15 +374,15 @@ definitions:
properties: properties:
proxyEndpoint: proxyEndpoint:
type: string type: string
service: svcName:
type: string type: string
untunnelRequest: untunnelRequest:
type: object type: object
properties: properties:
zitiIdentityId: zId:
type: string type: string
service: svcName:
type: string type: string
verifyRequest: verifyRequest:

View File

@ -20,7 +20,7 @@ const Environments = (props) => {
}, },
{ {
name: 'Identity', name: 'Identity',
selector: row => row.environment.zitiIdentityId, selector: row => row.environment.zId,
sortable: true, sortable: true,
}, },
{ {

View File

@ -46,7 +46,7 @@
* @property {string} description * @property {string} description
* @property {string} host * @property {string} host
* @property {string} address * @property {string} address
* @property {string} zitiIdentityId * @property {string} zId
* @property {boolean} active * @property {boolean} active
* @property {string} createdAt * @property {string} createdAt
* @property {string} updatedAt * @property {string} updatedAt
@ -96,8 +96,8 @@
* @typedef service * @typedef service
* @memberof module:types * @memberof module:types
* *
* @property {string} zitiServiceId * @property {string} zId
* @property {string} zrokServiceId * @property {string} name
* @property {string} frontend * @property {string} frontend
* @property {string} backend * @property {string} backend
* @property {boolean} active * @property {boolean} active
@ -109,7 +109,7 @@
* @typedef tunnelRequest * @typedef tunnelRequest
* @memberof module:types * @memberof module:types
* *
* @property {string} zitiIdentityId * @property {string} zId
* @property {string} endpoint * @property {string} endpoint
* @property {string} authScheme * @property {string} authScheme
* @property {module:types.authUser[]} authUsers * @property {module:types.authUser[]} authUsers
@ -120,15 +120,15 @@
* @memberof module:types * @memberof module:types
* *
* @property {string} proxyEndpoint * @property {string} proxyEndpoint
* @property {string} service * @property {string} svcName
*/ */
/** /**
* @typedef untunnelRequest * @typedef untunnelRequest
* @memberof module:types * @memberof module:types
* *
* @property {string} zitiIdentityId * @property {string} zId
* @property {string} service * @property {string} svcName
*/ */
/** /**