mirror of
https://github.com/openziti/zrok.git
synced 2024-11-21 23:53:19 +01:00
add zrok tags to identities and edge router policies (#60)
This commit is contained in:
parent
0ceda88b4c
commit
549c3ca456
@ -91,7 +91,7 @@ func (self *enableHandler) Handle(params identity.EnableParams, principal *rest_
|
||||
return resp
|
||||
}
|
||||
|
||||
func (_ *enableHandler) createIdentity(email string, client *rest_management_api_client.ZitiEdgeManagement) (*identity_edge.CreateIdentityCreated, error) {
|
||||
func (self *enableHandler) createIdentity(email string, client *rest_management_api_client.ZitiEdgeManagement) (*identity_edge.CreateIdentityCreated, error) {
|
||||
iIsAdmin := false
|
||||
name := createToken()
|
||||
identityType := rest_model_edge.IdentityTypeUser
|
||||
@ -101,7 +101,7 @@ func (_ *enableHandler) createIdentity(email string, client *rest_management_api
|
||||
Name: &name,
|
||||
RoleAttributes: nil,
|
||||
ServiceHostingCosts: nil,
|
||||
Tags: nil,
|
||||
Tags: self.zrokTags(),
|
||||
Type: &identityType,
|
||||
}
|
||||
req := identity_edge.NewCreateIdentityParams()
|
||||
@ -138,7 +138,7 @@ func (_ *enableHandler) enrollIdentity(id string, client *rest_management_api_cl
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
func (_ *enableHandler) createEdgeRouterPolicy(id string, edge *rest_management_api_client.ZitiEdgeManagement) error {
|
||||
func (self *enableHandler) createEdgeRouterPolicy(id string, edge *rest_management_api_client.ZitiEdgeManagement) error {
|
||||
edgeRouterRoles := []string{"#all"}
|
||||
identityRoles := []string{fmt.Sprintf("@%v", id)}
|
||||
name := fmt.Sprintf("zrok-%v", id)
|
||||
@ -148,6 +148,7 @@ func (_ *enableHandler) createEdgeRouterPolicy(id string, edge *rest_management_
|
||||
IdentityRoles: identityRoles,
|
||||
Name: &name,
|
||||
Semantic: &semantic,
|
||||
Tags: self.zrokTags(),
|
||||
}
|
||||
req := &edge_router_policy.CreateEdgeRouterPolicyParams{
|
||||
Policy: erp,
|
||||
@ -161,3 +162,11 @@ func (_ *enableHandler) createEdgeRouterPolicy(id string, edge *rest_management_
|
||||
logrus.Infof("created edge router policy '%v'", resp.Payload.Data.ID)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *enableHandler) zrokTags() *rest_model_edge.Tags {
|
||||
return &rest_model_edge.Tags{
|
||||
SubTags: map[string]interface{}{
|
||||
"zrok": version,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user