| 925 | var GROUP_INSTANCE_ID_REGEXP = regexp.MustCompile(`^[0-9a-zA-Z\._\-]+$`) |
| 926 | |
| 927 | func validateGroupInstanceId(id string) error { |
| 928 | if id == "" { |
| 929 | return ConfigurationError("Group instance id must be non-empty string") |
| 930 | } |
| 931 | if id == "." || id == ".." { |
| 932 | return ConfigurationError(`Group instance id cannot be "." or ".."`) |
| 933 | } |
| 934 | if len(id) > MAX_GROUP_INSTANCE_ID_LENGTH { |
| 935 | return ConfigurationError(fmt.Sprintf(`Group instance id cannot be longer than %v, characters: %s`, MAX_GROUP_INSTANCE_ID_LENGTH, id)) |
| 936 | } |
| 937 | if !GROUP_INSTANCE_ID_REGEXP.MatchString(id) { |
| 938 | return ConfigurationError(fmt.Sprintf(`Group instance id %s is illegal, it contains a character other than, '.', '_' and '-'`, id)) |
| 939 | } |
| 940 | return nil |
| 941 | } |