Function scratchstack_aws_principal::validate_region [−][src]
pub fn validate_region<S: Into<String>>(
region: S
) -> Result<String, PrincipalError>
Verify that a region name meets the naming requirements.
AWS does not publish a formal specification for region names. In this validator, we specify:
- The region must be composed of ASCII alphabetic characters or
-
. followed by a-
and one or more digits, or the name"local"
. - The region can have a local region appended to it: a
-
, one or more ASCII alphabetic characters or-
. followed by a-
and one or more digits. - A
-
cannot appear in the first or last position, nor can it appear in two consecutive characters.
If region
meets the requirements, it is returned. Otherwise, a PrincipalError::InvalidRegion error is
returned.