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 ApplicationAutoscalingServiceMetadata implements ServiceMetadata {
32     private static final String ENDPOINT_PREFIX = "application-autoscaling";
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().build();
37
38     private static final List<Region> REGIONS = Collections.unmodifiableList(Arrays.asList(Region.of("af-south-1"),
39             Region.of("ap-east-1"), Region.of("ap-northeast-1"), Region.of("ap-northeast-2"), Region.of("ap-south-1"),
40             Region.of("ap-southeast-1"), Region.of("ap-southeast-2"), Region.of("ca-central-1"), Region.of("eu-central-1"),
41             Region.of("eu-north-1"), Region.of("eu-south-1"), Region.of("eu-west-1"), Region.of("eu-west-2"),
42             Region.of("eu-west-3"), Region.of("me-south-1"), Region.of("sa-east-1"), Region.of("us-east-1"),
43             Region.of("us-east-2"), Region.of("us-west-1"), Region.of("us-west-2"), Region.of("cn-north-1"),
44             Region.of("cn-northwest-1"), Region.of("us-gov-east-1"), Region.of("us-gov-west-1"), Region.of("us-iso-east-1"),
45             Region.of("us-isob-east-1")));
46
47     private static final Map<String, String> SIGNING_REGION_OVERRIDES = ImmutableMap.<String, String> builder().build();
48
49     private static final List<ServicePartitionMetadata> PARTITIONS = Collections.unmodifiableList(Arrays.asList(
50             new DefaultServicePartitionMetadata("aws"null), new DefaultServicePartitionMetadata("aws-cn"null),
51             new DefaultServicePartitionMetadata("aws-us-gov"null), new DefaultServicePartitionMetadata("aws-iso"null),
52             new DefaultServicePartitionMetadata("aws-iso-b"null)));
53
54     @Override
55     public List<Region> regions() {
56         return REGIONS;
57     }
58
59     @Override
60     public URI endpointFor(Region region) {
61         return URI.create(REGION_OVERRIDDEN_ENDPOINTS.containsKey(region.id()) ? REGION_OVERRIDDEN_ENDPOINTS.get(region.id())
62                 : computeEndpoint(ENDPOINT_PREFIX, PARTITION_OVERRIDDEN_ENDPOINTS, region));
63     }
64
65     @Override
66     public Region signingRegion(Region region) {
67         return Region.of(SIGNING_REGION_OVERRIDES.getOrDefault(region.id(), region.id()));
68     }
69
70     @Override
71     public List<ServicePartitionMetadata> servicePartitions() {
72         return PARTITIONS;
73     }
74 }
75