Function scratchstack_aws_principal::validate_partition
source ยท pub fn validate_partition<S: Into<String>>(
partition: S,
) -> Result<String, PrincipalError>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 specify:
- The partition must be composed of ASCII alphanumeric characters or
-. - 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.
If partition meets the requirements, it is returned. Otherwise, a PrincipalError::InvalidPartition error is
returned.