mirror of
https://github.com/openziti/ziti.git
synced 2026-10-12 15:28:05 +00:00
8c0bf8b885
- ers do not support having multiple enrollments, detail returns 1 - re-enrolling now clears existing enrollments - adds test to re-enroll twice - encapsulates all er re-enrollment logic as a single atomic command
91 lines
1.9 KiB
Go
91 lines
1.9 KiB
Go
package edge_cmd_pb
|
|
|
|
func (x *CreateEdgeTerminatorCommand) GetCommandType() int32 {
|
|
return int32(CommandType_CreateEdgeTerminatorType)
|
|
}
|
|
|
|
func (x *ReplaceEnrollmentWithAuthenticatorCmd) GetCommandType() int32 {
|
|
return int32(CommandType_ReplaceEnrollmentWithAuthenticatorType)
|
|
}
|
|
|
|
func (x *CreateEdgeRouterCmd) GetCommandType() int32 {
|
|
return int32(CommandType_CreateEdgeRouterType)
|
|
}
|
|
|
|
func (x *CreateTransitRouterCmd) GetCommandType() int32 {
|
|
return int32(CommandType_CreateTransitRouterType)
|
|
}
|
|
|
|
func (x *CreateIdentityWithEnrollmentsCmd) GetCommandType() int32 {
|
|
return int32(CommandType_CreateIdentityWithEnrollmentsType)
|
|
}
|
|
|
|
func (x *ReEnrollEdgeRouterCmd) GetCommandType() int32 {
|
|
return int32(CommandType_ReEnrollEdgeRouterType)
|
|
}
|
|
|
|
func (x *UpdateServiceConfigsCmd) GetCommandType() int32 {
|
|
return int32(CommandType_UpdateServiceConfigsType)
|
|
}
|
|
|
|
func EncodeTags(tags map[string]interface{}) (map[string]*TagValue, error) {
|
|
if len(tags) == 0 {
|
|
return nil, nil
|
|
}
|
|
result := map[string]*TagValue{}
|
|
|
|
for k, v := range tags {
|
|
if v == nil {
|
|
result[k] = &TagValue{
|
|
Value: &TagValue_NilValue{
|
|
NilValue: true,
|
|
},
|
|
}
|
|
} else {
|
|
switch val := v.(type) {
|
|
case string:
|
|
result[k] = &TagValue{
|
|
Value: &TagValue_StringValue{
|
|
StringValue: val,
|
|
},
|
|
}
|
|
case bool:
|
|
result[k] = &TagValue{
|
|
Value: &TagValue_BoolValue{
|
|
BoolValue: val,
|
|
},
|
|
}
|
|
case float64:
|
|
result[k] = &TagValue{
|
|
Value: &TagValue_FpValue{
|
|
FpValue: val,
|
|
},
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return result, nil
|
|
}
|
|
|
|
func DecodeTags(tags map[string]*TagValue) map[string]interface{} {
|
|
if len(tags) == 0 {
|
|
return nil
|
|
}
|
|
result := map[string]interface{}{}
|
|
|
|
for k, v := range tags {
|
|
switch v.Value.(type) {
|
|
case *TagValue_NilValue:
|
|
result[k] = nil
|
|
case *TagValue_BoolValue:
|
|
result[k] = v.GetBoolValue()
|
|
case *TagValue_StringValue:
|
|
result[k] = v.GetStringValue()
|
|
case *TagValue_FpValue:
|
|
result[k] = v.GetFpValue()
|
|
}
|
|
}
|
|
|
|
return result
|
|
}
|