diff --git a/clients/go/zms/model.go b/clients/go/zms/model.go index db5e76edc19..8f21d0adbb3 100644 --- a/clients/go/zms/model.go +++ b/clients/go/zms/model.go @@ -81,6 +81,9 @@ type AuthorityKeyword string // AuthorityKeywords - type AuthorityKeywords string +// TagKey - +type TagKey string + // TagValue - TagValue to contain generic string patterns type TagValue string @@ -257,7 +260,7 @@ type DomainMeta struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` // // associated business service with domain @@ -513,7 +516,7 @@ type Domain struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` // // associated business service with domain @@ -1264,7 +1267,7 @@ type RoleMeta struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` // // a description of the role @@ -1450,7 +1453,7 @@ type Role struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` // // a description of the role @@ -2588,7 +2591,7 @@ type Policy struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` } // NewPolicy - creates an initialized Policy instance, returns a pointer to it @@ -2872,7 +2875,7 @@ type ServiceIdentity struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` } // NewServiceIdentity - creates an initialized ServiceIdentity instance, returns a pointer to it @@ -3687,7 +3690,7 @@ type TopLevelDomain struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` // // associated business service with domain @@ -3967,7 +3970,7 @@ type SubDomain struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` // // associated business service with domain @@ -4261,7 +4264,7 @@ type UserDomain struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` // // associated business service with domain @@ -5449,7 +5452,7 @@ type GroupMeta struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` // // Flag indicates whether or not group updates should require GRC approval. If @@ -5577,7 +5580,7 @@ type Group struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` // // Flag indicates whether or not group updates should require GRC approval. If @@ -6771,7 +6774,7 @@ type DomainData struct { // // key-value pair tags, tag might contain multiple values // - Tags map[CompoundName]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` + Tags map[TagKey]*TagValueList `json:"tags,omitempty" rdl:"optional" yaml:",omitempty"` // // associated business service with domain diff --git a/clients/go/zms/zms_schema.go b/clients/go/zms/zms_schema.go index 28f2ea6f2ab..31783f511dc 100644 --- a/clients/go/zms/zms_schema.go +++ b/clients/go/zms/zms_schema.go @@ -105,6 +105,10 @@ func init() { tAuthorityKeywords.Pattern("([a-zA-Z0-9_][a-zA-Z0-9_-]*,)*[a-zA-Z0-9_][a-zA-Z0-9_-]*") sb.AddType(tAuthorityKeywords.Build()) + tTagKey := rdl.NewStringTypeBuilder("TagKey") + tTagKey.Pattern("([a-zA-Z0-9_][a-zA-Z0-9_-]*[:\\.])*[a-zA-Z0-9_][a-zA-Z0-9_-]*") + sb.AddType(tTagKey.Build()) + tTagValue := rdl.NewStringTypeBuilder("TagValue") tTagValue.Comment("TagValue to contain generic string patterns") tTagValue.Pattern("[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*") @@ -156,7 +160,7 @@ func init() { tDomainMeta.Field("azureSubscription", "String", true, nil, "associated azure subscription id (system attribute - uniqueness check - if enabled)") tDomainMeta.Field("gcpProject", "String", true, nil, "associated gcp project id (system attribute - uniqueness check - if enabled)") tDomainMeta.Field("gcpProjectNumber", "String", true, nil, "associated gcp project number (system attribute)") - tDomainMeta.MapField("tags", "CompoundName", "TagValueList", true, "key-value pair tags, tag might contain multiple values") + tDomainMeta.MapField("tags", "TagKey", "TagValueList", true, "key-value pair tags, tag might contain multiple values") tDomainMeta.Field("businessService", "String", true, nil, "associated business service with domain") tDomainMeta.Field("memberPurgeExpiryDays", "Int32", true, nil, "purge role/group members with expiry date configured days in the past") tDomainMeta.Field("productId", "String", true, nil, "associated product id (system attribute - uniqueness check - if enabled)") @@ -242,7 +246,7 @@ func init() { tRoleMeta.Field("userAuthorityExpiration", "String", true, nil, "expiration enforced by a user authority configured attribute") tRoleMeta.Field("groupExpiryDays", "Int32", true, nil, "all groups in the domain roles will have specified max expiry days") tRoleMeta.Field("groupReviewDays", "Int32", true, nil, "all groups in the domain roles will have specified max review days") - tRoleMeta.MapField("tags", "CompoundName", "TagValueList", true, "key-value pair tags, tag might contain multiple values") + tRoleMeta.MapField("tags", "TagKey", "TagValueList", true, "key-value pair tags, tag might contain multiple values") tRoleMeta.Field("description", "String", true, nil, "a description of the role") tRoleMeta.Field("auditEnabled", "Bool", true, false, "Flag indicates whether or not role updates should be approved by GRC. If true, the auditRef parameter must be supplied(not empty) for any API defining it.") tRoleMeta.Field("deleteProtection", "Bool", true, false, "If true, ask for delete confirmation in audit and review enabled roles.") @@ -365,7 +369,7 @@ func init() { tPolicy.Field("version", "SimpleName", true, nil, "optional version string, defaults to 0") tPolicy.Field("active", "Bool", true, nil, "if multi-version policy then indicates active version") tPolicy.Field("description", "String", true, nil, "a description of the policy") - tPolicy.MapField("tags", "CompoundName", "TagValueList", true, "key-value pair tags, tag might contain multiple values") + tPolicy.MapField("tags", "TagKey", "TagValueList", true, "key-value pair tags, tag might contain multiple values") sb.AddType(tPolicy.Build()) tPolicies := rdl.NewStructTypeBuilder("Struct", "Policies") @@ -396,7 +400,7 @@ func init() { tServiceIdentity.ArrayField("hosts", "String", true, "list of host names that this service can run on") tServiceIdentity.Field("user", "String", true, nil, "local (unix) user name this service can run as") tServiceIdentity.Field("group", "String", true, nil, "local (unix) group name this service can run as") - tServiceIdentity.MapField("tags", "CompoundName", "TagValueList", true, "key-value pair tags, tag might contain multiple values") + tServiceIdentity.MapField("tags", "TagKey", "TagValueList", true, "key-value pair tags, tag might contain multiple values") sb.AddType(tServiceIdentity.Build()) tServiceIdentities := rdl.NewStructTypeBuilder("Struct", "ServiceIdentities") @@ -588,7 +592,7 @@ func init() { tGroupMeta.Field("userAuthorityExpiration", "String", true, nil, "expiration enforced by a user authority configured attribute") tGroupMeta.Field("memberExpiryDays", "Int32", true, nil, "all user members in the group will have specified max expiry days") tGroupMeta.Field("serviceExpiryDays", "Int32", true, nil, "all services in the group will have specified max expiry days") - tGroupMeta.MapField("tags", "CompoundName", "TagValueList", true, "key-value pair tags, tag might contain multiple values") + tGroupMeta.MapField("tags", "TagKey", "TagValueList", true, "key-value pair tags, tag might contain multiple values") tGroupMeta.Field("auditEnabled", "Bool", true, false, "Flag indicates whether or not group updates should require GRC approval. If true, the auditRef parameter must be supplied(not empty) for any API defining it") tGroupMeta.Field("deleteProtection", "Bool", true, false, "If true, ask for delete confirmation in audit and review enabled groups.") tGroupMeta.Field("lastReviewedDate", "Timestamp", true, nil, "last review timestamp of the group") diff --git a/core/zms/src/main/java/com/yahoo/athenz/zms/ZMSSchema.java b/core/zms/src/main/java/com/yahoo/athenz/zms/ZMSSchema.java index acf1d066098..6b4dfecc0ba 100644 --- a/core/zms/src/main/java/com/yahoo/athenz/zms/ZMSSchema.java +++ b/core/zms/src/main/java/com/yahoo/athenz/zms/ZMSSchema.java @@ -89,6 +89,9 @@ private static Schema build() { sb.stringType("AuthorityKeywords") .pattern("([a-zA-Z0-9_][a-zA-Z0-9_-]*,)*[a-zA-Z0-9_][a-zA-Z0-9_-]*"); + sb.stringType("TagKey") + .pattern("([a-zA-Z0-9_][a-zA-Z0-9_-]*[:\\.])*[a-zA-Z0-9_][a-zA-Z0-9_-]*"); + sb.stringType("TagValue") .comment("TagValue to contain generic string patterns") .pattern("[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*"); @@ -133,7 +136,7 @@ private static Schema build() { .field("azureSubscription", "String", true, "associated azure subscription id (system attribute - uniqueness check - if enabled)") .field("gcpProject", "String", true, "associated gcp project id (system attribute - uniqueness check - if enabled)") .field("gcpProjectNumber", "String", true, "associated gcp project number (system attribute)") - .mapField("tags", "CompoundName", "TagValueList", true, "key-value pair tags, tag might contain multiple values") + .mapField("tags", "TagKey", "TagValueList", true, "key-value pair tags, tag might contain multiple values") .field("businessService", "String", true, "associated business service with domain") .field("memberPurgeExpiryDays", "Int32", true, "purge role/group members with expiry date configured days in the past") .field("productId", "String", true, "associated product id (system attribute - uniqueness check - if enabled)") @@ -210,7 +213,7 @@ private static Schema build() { .field("userAuthorityExpiration", "String", true, "expiration enforced by a user authority configured attribute") .field("groupExpiryDays", "Int32", true, "all groups in the domain roles will have specified max expiry days") .field("groupReviewDays", "Int32", true, "all groups in the domain roles will have specified max review days") - .mapField("tags", "CompoundName", "TagValueList", true, "key-value pair tags, tag might contain multiple values") + .mapField("tags", "TagKey", "TagValueList", true, "key-value pair tags, tag might contain multiple values") .field("description", "String", true, "a description of the role") .field("auditEnabled", "Bool", true, "Flag indicates whether or not role updates should be approved by GRC. If true, the auditRef parameter must be supplied(not empty) for any API defining it.", false) .field("deleteProtection", "Bool", true, "If true, ask for delete confirmation in audit and review enabled roles.", false) @@ -318,7 +321,7 @@ private static Schema build() { .field("version", "SimpleName", true, "optional version string, defaults to 0") .field("active", "Bool", true, "if multi-version policy then indicates active version") .field("description", "String", true, "a description of the policy") - .mapField("tags", "CompoundName", "TagValueList", true, "key-value pair tags, tag might contain multiple values"); + .mapField("tags", "TagKey", "TagValueList", true, "key-value pair tags, tag might contain multiple values"); sb.structType("Policies") .comment("The representation of list of policy objects") @@ -345,7 +348,7 @@ private static Schema build() { .arrayField("hosts", "String", true, "list of host names that this service can run on") .field("user", "String", true, "local (unix) user name this service can run as") .field("group", "String", true, "local (unix) group name this service can run as") - .mapField("tags", "CompoundName", "TagValueList", true, "key-value pair tags, tag might contain multiple values"); + .mapField("tags", "TagKey", "TagValueList", true, "key-value pair tags, tag might contain multiple values"); sb.structType("ServiceIdentities") .comment("The representation of list of services") @@ -510,7 +513,7 @@ private static Schema build() { .field("userAuthorityExpiration", "String", true, "expiration enforced by a user authority configured attribute") .field("memberExpiryDays", "Int32", true, "all user members in the group will have specified max expiry days") .field("serviceExpiryDays", "Int32", true, "all services in the group will have specified max expiry days") - .mapField("tags", "CompoundName", "TagValueList", true, "key-value pair tags, tag might contain multiple values") + .mapField("tags", "TagKey", "TagValueList", true, "key-value pair tags, tag might contain multiple values") .field("auditEnabled", "Bool", true, "Flag indicates whether or not group updates should require GRC approval. If true, the auditRef parameter must be supplied(not empty) for any API defining it", false) .field("deleteProtection", "Bool", true, "If true, ask for delete confirmation in audit and review enabled groups.", false) .field("lastReviewedDate", "Timestamp", true, "last review timestamp of the group") diff --git a/core/zms/src/main/rdl/Domain.tdl b/core/zms/src/main/rdl/Domain.tdl index abd17bbd53a..a937c0df0f8 100644 --- a/core/zms/src/main/rdl/Domain.tdl +++ b/core/zms/src/main/rdl/Domain.tdl @@ -25,7 +25,7 @@ type DomainMeta Struct { String azureSubscription (optional); //associated azure subscription id (system attribute - uniqueness check - if enabled) String gcpProject (optional); //associated gcp project id (system attribute - uniqueness check - if enabled) String gcpProjectNumber (optional); //associated gcp project number (system attribute) - Map tags (optional); //key-value pair tags, tag might contain multiple values + Map tags (optional); //key-value pair tags, tag might contain multiple values String businessService (optional, x_allowempty="true"); //associated business service with domain Int32 memberPurgeExpiryDays (optional); //purge role/group members with expiry date configured days in the past String productId (optional); //associated product id (system attribute - uniqueness check - if enabled) diff --git a/core/zms/src/main/rdl/Group.tdl b/core/zms/src/main/rdl/Group.tdl index 84cac569444..567ab36a0b9 100644 --- a/core/zms/src/main/rdl/Group.tdl +++ b/core/zms/src/main/rdl/Group.tdl @@ -52,7 +52,7 @@ type GroupMeta Struct { String userAuthorityExpiration (optional); //expiration enforced by a user authority configured attribute Int32 memberExpiryDays (optional); //all user members in the group will have specified max expiry days Int32 serviceExpiryDays (optional); //all services in the group will have specified max expiry days - Map tags (optional); //key-value pair tags, tag might contain multiple values + Map tags (optional); //key-value pair tags, tag might contain multiple values Bool auditEnabled (optional, default=false); //Flag indicates whether or not group updates should require GRC approval. If true, the auditRef parameter must be supplied(not empty) for any API defining it Bool deleteProtection (optional, default=false); //If true, ask for delete confirmation in audit and review enabled groups. Timestamp lastReviewedDate (optional); //last review timestamp of the group diff --git a/core/zms/src/main/rdl/Names.tdl b/core/zms/src/main/rdl/Names.tdl index a19efa77488..df12a1164f0 100644 --- a/core/zms/src/main/rdl/Names.tdl +++ b/core/zms/src/main/rdl/Names.tdl @@ -70,6 +70,8 @@ type MemberName String (pattern="\\*|{DomainName}\\.\\*|{ServiceName}(\\*)?|{Gro type AuthorityKeyword String (pattern="{SimpleName}"); type AuthorityKeywords String (pattern="({AuthorityKeyword},)*{AuthorityKeyword}"); +type TagKey String (pattern="({SimpleName}[:\\.])*{SimpleName}"); + //TagValue to contain generic string patterns type TagValue String (pattern="[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*"); diff --git a/core/zms/src/main/rdl/Policy.tdl b/core/zms/src/main/rdl/Policy.tdl index e2adaf82b35..88b7d8e44f3 100644 --- a/core/zms/src/main/rdl/Policy.tdl +++ b/core/zms/src/main/rdl/Policy.tdl @@ -48,7 +48,7 @@ type Policy Struct { SimpleName version (optional); // optional version string, defaults to 0 Bool active (optional); // if multi-version policy then indicates active version String description (optional); //a description of the policy - Map tags (optional); //key-value pair tags, tag might contain multiple values + Map tags (optional); //key-value pair tags, tag might contain multiple values } //The representation of list of policy objects diff --git a/core/zms/src/main/rdl/Role.tdl b/core/zms/src/main/rdl/Role.tdl index 8f2bd892d97..fee028d74b6 100644 --- a/core/zms/src/main/rdl/Role.tdl +++ b/core/zms/src/main/rdl/Role.tdl @@ -50,7 +50,7 @@ type RoleMeta Struct { String userAuthorityExpiration (optional); //expiration enforced by a user authority configured attribute Int32 groupExpiryDays (optional); //all groups in the domain roles will have specified max expiry days Int32 groupReviewDays (optional); //all groups in the domain roles will have specified max review days - Map tags (optional); //key-value pair tags, tag might contain multiple values + Map tags (optional); //key-value pair tags, tag might contain multiple values String description (optional); //a description of the role Bool auditEnabled (optional, default=false); //Flag indicates whether or not role updates should be approved by GRC. If true, the auditRef parameter must be supplied(not empty) for any API defining it. Bool deleteProtection (optional, default=false); //If true, ask for delete confirmation in audit and review enabled roles. diff --git a/core/zms/src/main/rdl/ServiceIdentity.tdl b/core/zms/src/main/rdl/ServiceIdentity.tdl index e90622bda23..f0d59ba001a 100644 --- a/core/zms/src/main/rdl/ServiceIdentity.tdl +++ b/core/zms/src/main/rdl/ServiceIdentity.tdl @@ -20,7 +20,7 @@ type ServiceIdentity Struct { Array hosts (optional); //list of host names that this service can run on String user (optional); //local (unix) user name this service can run as String group (optional); //local (unix) group name this service can run as - Map tags (optional); //key-value pair tags, tag might contain multiple values + Map tags (optional); //key-value pair tags, tag might contain multiple values } //The representation of list of services diff --git a/libs/go/zmscli/domain.go b/libs/go/zmscli/domain.go index a84e523eeab..a7e47c06310 100644 --- a/libs/go/zmscli/domain.go +++ b/libs/go/zmscli/domain.go @@ -1012,10 +1012,10 @@ func (cli Zms) AddDomainTags(dn string, tagKey string, tagValues []string) (*str tagValueArr := make([]zms.TagCompoundValue, 0) if meta.Tags == nil { - meta.Tags = map[zms.CompoundName]*zms.TagValueList{} + meta.Tags = map[zms.TagKey]*zms.TagValueList{} } else { // append current tags - currentTagValues := meta.Tags[zms.CompoundName(tagKey)] + currentTagValues := meta.Tags[zms.TagKey(tagKey)] if currentTagValues != nil { tagValueArr = append(tagValueArr, currentTagValues.List...) } @@ -1025,7 +1025,7 @@ func (cli Zms) AddDomainTags(dn string, tagKey string, tagValues []string) (*str tagValueArr = append(tagValueArr, zms.TagCompoundValue(tagValue)) } - meta.Tags[zms.CompoundName(tagKey)] = &zms.TagValueList{List: tagValueArr} + meta.Tags[zms.TagKey(tagKey)] = &zms.TagValueList{List: tagValueArr} err = cli.Zms.PutDomainMeta(zms.DomainName(dn), cli.AuditRef, &meta) if err != nil { @@ -1054,12 +1054,12 @@ func (cli Zms) DeleteDomainTags(dn string, tagKey string, tagValue string) (*str tagValueArr := make([]zms.TagCompoundValue, 0) if meta.Tags == nil { - meta.Tags = map[zms.CompoundName]*zms.TagValueList{} + meta.Tags = map[zms.TagKey]*zms.TagValueList{} } // except given tagValue, set the same tags map if tagValue != "" && meta.Tags != nil { - currentTagValues := meta.Tags[zms.CompoundName(tagKey)] + currentTagValues := meta.Tags[zms.TagKey(tagKey)] if currentTagValues != nil { for _, curTagValue := range currentTagValues.List { if tagValue != string(curTagValue) { @@ -1069,7 +1069,7 @@ func (cli Zms) DeleteDomainTags(dn string, tagKey string, tagValue string) (*str } } - meta.Tags[zms.CompoundName(tagKey)] = &zms.TagValueList{List: tagValueArr} + meta.Tags[zms.TagKey(tagKey)] = &zms.TagValueList{List: tagValueArr} err = cli.Zms.PutDomainMeta(zms.DomainName(dn), cli.AuditRef, &meta) if err != nil { diff --git a/libs/go/zmscli/dump.go b/libs/go/zmscli/dump.go index 4c1a604a589..e8e1934ff27 100644 --- a/libs/go/zmscli/dump.go +++ b/libs/go/zmscli/dump.go @@ -192,7 +192,7 @@ func (cli Zms) dumpRole(buf *bytes.Buffer, role zms.Role, auditLog bool, indent1 } } -func (cli Zms) dumpTags(buf *bytes.Buffer, indentFirst bool, indent1, indent2 string, tags map[zms.CompoundName]*zms.TagValueList) { +func (cli Zms) dumpTags(buf *bytes.Buffer, indentFirst bool, indent1, indent2 string, tags map[zms.TagKey]*zms.TagValueList) { if tags != nil { if indentFirst { buf.WriteString(indent2) diff --git a/libs/go/zmscli/group.go b/libs/go/zmscli/group.go index 1f40bfae0ce..b784d13ab59 100644 --- a/libs/go/zmscli/group.go +++ b/libs/go/zmscli/group.go @@ -561,10 +561,10 @@ func (cli Zms) AddGroupTags(dn string, gn, tagKey string, tagValues []string) (* tagValueArr := make([]zms.TagCompoundValue, 0) if meta.Tags == nil { - meta.Tags = map[zms.CompoundName]*zms.TagValueList{} + meta.Tags = map[zms.TagKey]*zms.TagValueList{} } else { // append current tags - currentTagValues := meta.Tags[zms.CompoundName(tagKey)] + currentTagValues := meta.Tags[zms.TagKey(tagKey)] if currentTagValues != nil { tagValueArr = append(tagValueArr, currentTagValues.List...) } @@ -574,7 +574,7 @@ func (cli Zms) AddGroupTags(dn string, gn, tagKey string, tagValues []string) (* tagValueArr = append(tagValueArr, zms.TagCompoundValue(tagValue)) } - meta.Tags[zms.CompoundName(tagKey)] = &zms.TagValueList{List: tagValueArr} + meta.Tags[zms.TagKey(tagKey)] = &zms.TagValueList{List: tagValueArr} err = cli.Zms.PutGroupMeta(zms.DomainName(dn), zms.EntityName(gn), cli.AuditRef, &meta) if err != nil { @@ -598,12 +598,12 @@ func (cli Zms) DeleteGroupTags(dn string, gn, tagKey string, tagValue string) (* tagValueArr := make([]zms.TagCompoundValue, 0) if meta.Tags == nil { - meta.Tags = map[zms.CompoundName]*zms.TagValueList{} + meta.Tags = map[zms.TagKey]*zms.TagValueList{} } // except given tagValue, set the same tags map if tagValue != "" && meta.Tags != nil { - currentTagValues := meta.Tags[zms.CompoundName(tagKey)] + currentTagValues := meta.Tags[zms.TagKey(tagKey)] if currentTagValues != nil { for _, curTagValue := range currentTagValues.List { if tagValue != string(curTagValue) { @@ -613,7 +613,7 @@ func (cli Zms) DeleteGroupTags(dn string, gn, tagKey string, tagValue string) (* } } - meta.Tags[zms.CompoundName(tagKey)] = &zms.TagValueList{List: tagValueArr} + meta.Tags[zms.TagKey(tagKey)] = &zms.TagValueList{List: tagValueArr} err = cli.Zms.PutGroupMeta(zms.DomainName(dn), zms.EntityName(gn), cli.AuditRef, &meta) if err != nil { diff --git a/libs/go/zmscli/policy.go b/libs/go/zmscli/policy.go index bb0ea89bdc8..0eda757b5ff 100644 --- a/libs/go/zmscli/policy.go +++ b/libs/go/zmscli/policy.go @@ -433,11 +433,11 @@ func (cli Zms) DeletePolicyTags(dn string, pn, tagKey string, tagValues []string } return cli.dumpByFormat(message, cli.buildYAMLOutput) } else { - tagValueArr = cli.GetTagsAfterDeletion(Policy.Tags[zms.CompoundName(tagKey)], tagValues) + tagValueArr = cli.GetTagsAfterDeletion(Policy.Tags[zms.TagKey(tagKey)], tagValues) if len(tagValueArr) == 0 { - delete(Policy.Tags, zms.CompoundName(tagKey)) + delete(Policy.Tags, zms.TagKey(tagKey)) } - Policy.Tags[zms.CompoundName(tagKey)] = &zms.TagValueList{List: tagValueArr} + Policy.Tags[zms.TagKey(tagKey)] = &zms.TagValueList{List: tagValueArr} } returnObj := false @@ -463,10 +463,10 @@ func (cli Zms) AddPolicyTags(dn string, pn, tagKey string, tagValues []string) ( tagValueArr := make([]zms.TagCompoundValue, 0) if Policy.Tags == nil { - Policy.Tags = map[zms.CompoundName]*zms.TagValueList{} + Policy.Tags = map[zms.TagKey]*zms.TagValueList{} } else { // append current tags - currentTagValues := Policy.Tags[zms.CompoundName(tagKey)] + currentTagValues := Policy.Tags[zms.TagKey(tagKey)] if currentTagValues != nil { tagValueArr = append(tagValueArr, currentTagValues.List...) } @@ -476,7 +476,7 @@ func (cli Zms) AddPolicyTags(dn string, pn, tagKey string, tagValues []string) ( tagValueArr = append(tagValueArr, zms.TagCompoundValue(tagValue)) } - Policy.Tags[zms.CompoundName(tagKey)] = &zms.TagValueList{List: tagValueArr} + Policy.Tags[zms.TagKey(tagKey)] = &zms.TagValueList{List: tagValueArr} returnObj := false _, err = cli.Zms.PutPolicy(zms.DomainName(dn), zms.EntityName(pn), cli.AuditRef, &returnObj, Policy) if err != nil { diff --git a/libs/go/zmscli/role.go b/libs/go/zmscli/role.go index 35ddd47b879..ae2d1045fbc 100644 --- a/libs/go/zmscli/role.go +++ b/libs/go/zmscli/role.go @@ -593,10 +593,10 @@ func (cli Zms) AddRoleTags(dn string, rn, tagKey string, tagValues []string) (*s tagValueArr := make([]zms.TagCompoundValue, 0) if meta.Tags == nil { - meta.Tags = map[zms.CompoundName]*zms.TagValueList{} + meta.Tags = map[zms.TagKey]*zms.TagValueList{} } else { // append current tags - currentTagValues := meta.Tags[zms.CompoundName(tagKey)] + currentTagValues := meta.Tags[zms.TagKey(tagKey)] if currentTagValues != nil { tagValueArr = append(tagValueArr, currentTagValues.List...) } @@ -606,7 +606,7 @@ func (cli Zms) AddRoleTags(dn string, rn, tagKey string, tagValues []string) (*s tagValueArr = append(tagValueArr, zms.TagCompoundValue(tagValue)) } - meta.Tags[zms.CompoundName(tagKey)] = &zms.TagValueList{List: tagValueArr} + meta.Tags[zms.TagKey(tagKey)] = &zms.TagValueList{List: tagValueArr} err = cli.Zms.PutRoleMeta(zms.DomainName(dn), zms.EntityName(rn), cli.AuditRef, &meta) if err != nil { @@ -631,12 +631,12 @@ func (cli Zms) DeleteRoleTags(dn string, rn, tagKey string, tagValue string) (*s tagValueArr := make([]zms.TagCompoundValue, 0) if meta.Tags == nil { - meta.Tags = map[zms.CompoundName]*zms.TagValueList{} + meta.Tags = map[zms.TagKey]*zms.TagValueList{} } // except given tagValue, set the same tags map if tagValue != "" && meta.Tags != nil { - currentTagValues := meta.Tags[zms.CompoundName(tagKey)] + currentTagValues := meta.Tags[zms.TagKey(tagKey)] if currentTagValues != nil { for _, curTagValue := range currentTagValues.List { if tagValue != string(curTagValue) { @@ -646,7 +646,7 @@ func (cli Zms) DeleteRoleTags(dn string, rn, tagKey string, tagValue string) (*s } } - meta.Tags[zms.CompoundName(tagKey)] = &zms.TagValueList{List: tagValueArr} + meta.Tags[zms.TagKey(tagKey)] = &zms.TagValueList{List: tagValueArr} err = cli.Zms.PutRoleMeta(zms.DomainName(dn), zms.EntityName(rn), cli.AuditRef, &meta) if err != nil { diff --git a/libs/go/zmscli/service.go b/libs/go/zmscli/service.go index 804f7e646e2..d57041afdd0 100644 --- a/libs/go/zmscli/service.go +++ b/libs/go/zmscli/service.go @@ -84,10 +84,10 @@ func (cli Zms) DeleteServiceTags(dn string, sn, tagKey string, tagValues []strin } return cli.dumpByFormat(message, cli.buildYAMLOutput) } else { - tagValueArr = cli.GetTagsAfterDeletion(service.Tags[zms.CompoundName(tagKey)], tagValues) + tagValueArr = cli.GetTagsAfterDeletion(service.Tags[zms.TagKey(tagKey)], tagValues) } - service.Tags[zms.CompoundName(tagKey)] = &zms.TagValueList{List: tagValueArr} + service.Tags[zms.TagKey(tagKey)] = &zms.TagValueList{List: tagValueArr} returnObj := false _, err = cli.Zms.PutServiceIdentity(zms.DomainName(dn), zms.SimpleName(sn), cli.AuditRef, &returnObj, service) @@ -112,10 +112,10 @@ func (cli Zms) AddServiceTags(dn string, sn, tagKey string, tagValues []string) tagValueArr := make([]zms.TagCompoundValue, 0) if service.Tags == nil { - service.Tags = map[zms.CompoundName]*zms.TagValueList{} + service.Tags = map[zms.TagKey]*zms.TagValueList{} } else { // append current tags - currentTagValues := service.Tags[zms.CompoundName(tagKey)] + currentTagValues := service.Tags[zms.TagKey(tagKey)] if currentTagValues != nil { tagValueArr = append(tagValueArr, currentTagValues.List...) } @@ -125,7 +125,7 @@ func (cli Zms) AddServiceTags(dn string, sn, tagKey string, tagValues []string) tagValueArr = append(tagValueArr, zms.TagCompoundValue(tagValue)) } - service.Tags[zms.CompoundName(tagKey)] = &zms.TagValueList{List: tagValueArr} + service.Tags[zms.TagKey(tagKey)] = &zms.TagValueList{List: tagValueArr} returnObj := false _, err = cli.Zms.PutServiceIdentity(zms.DomainName(dn), zms.SimpleName(sn), cli.AuditRef, &returnObj, service) if err != nil {