mirror of
https://github.com/openziti/zrok.git
synced 2025-06-19 17:27:54 +02: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
|
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
|
iIsAdmin := false
|
||||||
name := createToken()
|
name := createToken()
|
||||||
identityType := rest_model_edge.IdentityTypeUser
|
identityType := rest_model_edge.IdentityTypeUser
|
||||||
@ -101,7 +101,7 @@ func (_ *enableHandler) createIdentity(email string, client *rest_management_api
|
|||||||
Name: &name,
|
Name: &name,
|
||||||
RoleAttributes: nil,
|
RoleAttributes: nil,
|
||||||
ServiceHostingCosts: nil,
|
ServiceHostingCosts: nil,
|
||||||
Tags: nil,
|
Tags: self.zrokTags(),
|
||||||
Type: &identityType,
|
Type: &identityType,
|
||||||
}
|
}
|
||||||
req := identity_edge.NewCreateIdentityParams()
|
req := identity_edge.NewCreateIdentityParams()
|
||||||
@ -138,7 +138,7 @@ func (_ *enableHandler) enrollIdentity(id string, client *rest_management_api_cl
|
|||||||
return conf, nil
|
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"}
|
edgeRouterRoles := []string{"#all"}
|
||||||
identityRoles := []string{fmt.Sprintf("@%v", id)}
|
identityRoles := []string{fmt.Sprintf("@%v", id)}
|
||||||
name := fmt.Sprintf("zrok-%v", id)
|
name := fmt.Sprintf("zrok-%v", id)
|
||||||
@ -148,6 +148,7 @@ func (_ *enableHandler) createEdgeRouterPolicy(id string, edge *rest_management_
|
|||||||
IdentityRoles: identityRoles,
|
IdentityRoles: identityRoles,
|
||||||
Name: &name,
|
Name: &name,
|
||||||
Semantic: &semantic,
|
Semantic: &semantic,
|
||||||
|
Tags: self.zrokTags(),
|
||||||
}
|
}
|
||||||
req := &edge_router_policy.CreateEdgeRouterPolicyParams{
|
req := &edge_router_policy.CreateEdgeRouterPolicyParams{
|
||||||
Policy: erp,
|
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)
|
logrus.Infof("created edge router policy '%v'", resp.Payload.Data.ID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *enableHandler) zrokTags() *rest_model_edge.Tags {
|
||||||
|
return &rest_model_edge.Tags{
|
||||||
|
SubTags: map[string]interface{}{
|
||||||
|
"zrok": version,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user