3 3 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 4 | * SPDX-License-Identifier: Apache-2.0
|
5 5 | */
|
6 6 |
|
7 7 | //! Partition function to determine a partition for a given region
|
8 8 | //!
|
9 9 | //! This function supports adding regions dynamically, parsing a JSON file, and builder construction.
|
10 10 | //!
|
11 11 | //! If, at a future point, this interface stabilizes it is a good candidate for extraction into a
|
12 12 | //! shared crate.
|
13 13 | use crate::endpoint_lib::diagnostic::DiagnosticCollector;
|
14 14 | use crate::endpoint_lib::partition::deser::deserialize_partitions;
|
15 15 | use aws_smithy_json::deserialize::error::DeserializeError;
|
16 16 | use regex_lite::Regex;
|
17 17 | use std::borrow::Cow;
|
18 18 | use std::collections::HashMap;
|
19 19 |
|
20 20 | /// Determine the AWS partition metadata for a given region
|
21 21 | #[derive(Clone, Debug, Default)]
|
22 22 | pub(crate) struct PartitionResolver {
|
23 23 | partitions: Vec<PartitionMetadata>,
|
24 24 | }
|
25 25 |
|
26 26 | impl PartitionResolver {
|
27 27 | pub(crate) fn from_partitions(partitions: Vec<PartitionMetadata>) -> Self {
|
28 28 | Self { partitions }
|
29 29 | }
|
30 30 | }
|
31 31 |
|
32 32 | /// Partition result returned from partition resolver
|
33 + | #[derive(Debug, Default, Clone)]
|
33 34 | pub(crate) struct Partition<'a> {
|
34 35 | name: &'a str,
|
35 36 | dns_suffix: &'a str,
|
36 37 | dual_stack_dns_suffix: &'a str,
|
37 38 | supports_fips: bool,
|
38 39 | supports_dual_stack: bool,
|
39 40 | implicit_global_region: &'a str,
|
40 41 | }
|
41 42 |
|
42 43 | #[allow(unused)]
|