Function scratchstack_arn::utils::validate_partition
source · Expand description
Verify that a partition name meets the naming requirements.
AWS does not publish a formal specification for partition names. In this validator, we require:
- The partition must be composed of Unicode alphabetic non-uppercase characters, ASCII numeric
characters, or
-
(codepoint\u{0x002d}
). - The partition must have between 1 and 32 characters.
- A
-
cannot appear in the first or last position, nor can it appear in two consecutive characters.
“Non-uppercase” is the same as “lowercase” for most Western scripts, but other scripts do not have a concept of uppercase and lowercase.
The value must be in NFKC normalized form for validation on accented characters to succeed. For example, ç
represented as the codepoint \u{0231}
(“Latin small letter c with cedilla”) is valid, but \u{0063}\u{0327}
(“Latin small letter c” followed by “combining cedilla”) is not.
Examples of valid partition names:
aws
local
1
intranet-1
aws-中国
việtnam
If partition
meets the requirements, Ok is returned. Otherwise, a ArnError::InvalidPartition error is returned.