1 /*
2  * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5  * the License. A copy of the License is located at
6  * 
7  * http://aws.amazon.com/apache2.0
8  * 
9  * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10  * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11  * and limitations under the License.
12  */

13
14 package software.amazon.awssdk.regions.servicemetadata;
15
16 import java.net.URI;
17 import java.util.Arrays;
18 import java.util.Collections;
19 import java.util.List;
20 import java.util.Map;
21 import software.amazon.awssdk.annotations.Generated;
22 import software.amazon.awssdk.annotations.SdkPublicApi;
23 import software.amazon.awssdk.regions.Region;
24 import software.amazon.awssdk.regions.ServiceMetadata;
25 import software.amazon.awssdk.regions.ServicePartitionMetadata;
26 import software.amazon.awssdk.regions.internal.DefaultServicePartitionMetadata;
27 import software.amazon.awssdk.utils.ImmutableMap;
28
29 @Generated("software.amazon.awssdk:codegen")
30 @SdkPublicApi
31 public final class ElasticfilesystemServiceMetadata implements ServiceMetadata {
32     private static final String ENDPOINT_PREFIX = "elasticfilesystem";
33
34     private static final Map<String, String> PARTITION_OVERRIDDEN_ENDPOINTS = ImmutableMap.<String, String> builder().build();
35
36     private static final Map<String, String> REGION_OVERRIDDEN_ENDPOINTS = ImmutableMap.<String, String> builder()
37             .put("fips-af-south-1""elasticfilesystem-fips.af-south-1.amazonaws.com")
38             .put("fips-ap-east-1""elasticfilesystem-fips.ap-east-1.amazonaws.com")
39             .put("fips-ap-northeast-1""elasticfilesystem-fips.ap-northeast-1.amazonaws.com")
40             .put("fips-ap-northeast-2""elasticfilesystem-fips.ap-northeast-2.amazonaws.com")
41             .put("fips-ap-south-1""elasticfilesystem-fips.ap-south-1.amazonaws.com")
42             .put("fips-ap-southeast-1""elasticfilesystem-fips.ap-southeast-1.amazonaws.com")
43             .put("fips-ap-southeast-2""elasticfilesystem-fips.ap-southeast-2.amazonaws.com")
44             .put("fips-ca-central-1""elasticfilesystem-fips.ca-central-1.amazonaws.com")
45             .put("fips-eu-central-1""elasticfilesystem-fips.eu-central-1.amazonaws.com")
46             .put("fips-eu-north-1""elasticfilesystem-fips.eu-north-1.amazonaws.com")
47             .put("fips-eu-south-1""elasticfilesystem-fips.eu-south-1.amazonaws.com")
48             .put("fips-eu-west-1""elasticfilesystem-fips.eu-west-1.amazonaws.com")
49             .put("fips-eu-west-2""elasticfilesystem-fips.eu-west-2.amazonaws.com")
50             .put("fips-eu-west-3""elasticfilesystem-fips.eu-west-3.amazonaws.com")
51             .put("fips-me-south-1""elasticfilesystem-fips.me-south-1.amazonaws.com")
52             .put("fips-sa-east-1""elasticfilesystem-fips.sa-east-1.amazonaws.com")
53             .put("fips-us-east-1""elasticfilesystem-fips.us-east-1.amazonaws.com")
54             .put("fips-us-east-2""elasticfilesystem-fips.us-east-2.amazonaws.com")
55             .put("fips-us-west-1""elasticfilesystem-fips.us-west-1.amazonaws.com")
56             .put("fips-us-west-2""elasticfilesystem-fips.us-west-2.amazonaws.com")
57             .put("fips-cn-north-1""elasticfilesystem-fips.cn-north-1.amazonaws.com.cn")
58             .put("fips-cn-northwest-1""elasticfilesystem-fips.cn-northwest-1.amazonaws.com.cn")
59             .put("fips-us-gov-east-1""elasticfilesystem-fips.us-gov-east-1.amazonaws.com")
60             .put("fips-us-gov-west-1""elasticfilesystem-fips.us-gov-west-1.amazonaws.com").build();
61
62     private static final List<Region> REGIONS = Collections.unmodifiableList(Arrays.asList(Region.of("af-south-1"),
63             Region.of("ap-east-1"), Region.of("ap-northeast-1"), Region.of("ap-northeast-2"), Region.of("ap-south-1"),
64             Region.of("ap-southeast-1"), Region.of("ap-southeast-2"), Region.of("ca-central-1"), Region.of("eu-central-1"),
65             Region.of("eu-north-1"), Region.of("eu-south-1"), Region.of("eu-west-1"), Region.of("eu-west-2"),
66             Region.of("eu-west-3"), Region.of("fips-af-south-1"), Region.of("fips-ap-east-1"), Region.of("fips-ap-northeast-1"),
67             Region.of("fips-ap-northeast-2"), Region.of("fips-ap-south-1"), Region.of("fips-ap-southeast-1"),
68             Region.of("fips-ap-southeast-2"), Region.of("fips-ca-central-1"), Region.of("fips-eu-central-1"),
69             Region.of("fips-eu-north-1"), Region.of("fips-eu-south-1"), Region.of("fips-eu-west-1"), Region.of("fips-eu-west-2"),
70             Region.of("fips-eu-west-3"), Region.of("fips-me-south-1"), Region.of("fips-sa-east-1"), Region.of("fips-us-east-1"),
71             Region.of("fips-us-east-2"), Region.of("fips-us-west-1"), Region.of("fips-us-west-2"), Region.of("me-south-1"),
72             Region.of("sa-east-1"), Region.of("us-east-1"), Region.of("us-east-2"), Region.of("us-west-1"),
73             Region.of("us-west-2"), Region.of("cn-north-1"), Region.of("cn-northwest-1"), Region.of("fips-cn-north-1"),
74             Region.of("fips-cn-northwest-1"), Region.of("fips-us-gov-east-1"), Region.of("fips-us-gov-west-1"),
75             Region.of("us-gov-east-1"), Region.of("us-gov-west-1")));
76
77     private static final Map<String, String> SIGNING_REGION_OVERRIDES = ImmutableMap.<String, String> builder()
78             .put("fips-af-south-1""af-south-1").put("fips-ap-east-1""ap-east-1").put("fips-ap-northeast-1""ap-northeast-1")
79             .put("fips-ap-northeast-2""ap-northeast-2").put("fips-ap-south-1""ap-south-1")
80             .put("fips-ap-southeast-1""ap-southeast-1").put("fips-ap-southeast-2""ap-southeast-2")
81             .put("fips-ca-central-1""ca-central-1").put("fips-eu-central-1""eu-central-1")
82             .put("fips-eu-north-1""eu-north-1").put("fips-eu-south-1""eu-south-1").put("fips-eu-west-1""eu-west-1")
83             .put("fips-eu-west-2""eu-west-2").put("fips-eu-west-3""eu-west-3").put("fips-me-south-1""me-south-1")
84             .put("fips-sa-east-1""sa-east-1").put("fips-us-east-1""us-east-1").put("fips-us-east-2""us-east-2")
85             .put("fips-us-west-1""us-west-1").put("fips-us-west-2""us-west-2").put("fips-cn-north-1""cn-north-1")
86             .put("fips-cn-northwest-1""cn-northwest-1").put("fips-us-gov-east-1""us-gov-east-1")
87             .put("fips-us-gov-west-1""us-gov-west-1").build();
88
89     private static final List<ServicePartitionMetadata> PARTITIONS = Collections.unmodifiableList(Arrays.asList(
90             new DefaultServicePartitionMetadata("aws"null), new DefaultServicePartitionMetadata("aws-cn"null),
91             new DefaultServicePartitionMetadata("aws-us-gov"null)));
92
93     @Override
94     public List<Region> regions() {
95         return REGIONS;
96     }
97
98     @Override
99     public URI endpointFor(Region region) {
100         return URI.create(REGION_OVERRIDDEN_ENDPOINTS.containsKey(region.id()) ? REGION_OVERRIDDEN_ENDPOINTS.get(region.id())
101                 : computeEndpoint(ENDPOINT_PREFIX, PARTITION_OVERRIDDEN_ENDPOINTS, region));
102     }
103
104     @Override
105     public Region signingRegion(Region region) {
106         return Region.of(SIGNING_REGION_OVERRIDES.getOrDefault(region.id(), region.id()));
107     }
108
109     @Override
110     public List<ServicePartitionMetadata> servicePartitions() {
111         return PARTITIONS;
112     }
113 }
114