isValidAttributeKey checks if an attribute key contains only alphanumeric characters and underscores
(key string)
| 4099 | |
| 4100 | // isValidAttributeKey checks if an attribute key contains only alphanumeric characters and underscores |
| 4101 | func isValidAttributeKey(key string) bool { |
| 4102 | if key == "" { |
| 4103 | return false |
| 4104 | } |
| 4105 | for _, r := range key { |
| 4106 | if !((r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '_') { |
| 4107 | return false |
| 4108 | } |
| 4109 | } |
| 4110 | return true |
| 4111 | } |
| 4112 | |
| 4113 | func marshalResourceNames(resources []database.ResourceName) ([]byte, error) { |
| 4114 | resources = dedupeAndSortResourceNames(resources) |