TemplateVersionNameValid returns whether the input string is a valid template version name.
(str string)
| 61 | |
| 62 | // TemplateVersionNameValid returns whether the input string is a valid template version name. |
| 63 | func TemplateVersionNameValid(str string) error { |
| 64 | if len(str) > 64 { |
| 65 | return xerrors.New("must be <= 64 characters") |
| 66 | } |
| 67 | matched := templateVersionName.MatchString(str) |
| 68 | if !matched { |
| 69 | return xerrors.New("must be alphanumeric with underscores and dots") |
| 70 | } |
| 71 | return nil |
| 72 | } |
| 73 | |
| 74 | // DisplayNameValid returns whether the input string is a valid template display name. |
| 75 | func DisplayNameValid(str string) error { |