software.amazon.awssdk.regions.servicemetadata.CeServiceMetadata Maven / Gradle / Ivy
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.regions.servicemetadata;
import java.net.URI;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.regions.PartitionEndpointKey;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.regions.ServiceEndpointKey;
import software.amazon.awssdk.regions.ServiceMetadata;
import software.amazon.awssdk.regions.ServicePartitionMetadata;
import software.amazon.awssdk.regions.internal.DefaultServicePartitionMetadata;
import software.amazon.awssdk.regions.internal.util.ServiceMetadataUtils;
import software.amazon.awssdk.utils.ImmutableMap;
import software.amazon.awssdk.utils.Pair;
@Generated("software.amazon.awssdk:codegen")
@SdkPublicApi
public final class CeServiceMetadata implements ServiceMetadata {
private static final String ENDPOINT_PREFIX = "ce";
private static final List REGIONS = Collections.unmodifiableList(Arrays.asList(Region.of("aws-global"),
Region.of("aws-cn-global")));
private static final List PARTITIONS = Collections.unmodifiableList(Arrays.asList(
new DefaultServicePartitionMetadata("aws", Region.of("aws-global")), new DefaultServicePartitionMetadata("aws-cn",
Region.of("aws-cn-global"))));
private static final Map SIGNING_REGIONS_BY_REGION = ImmutableMap
. builder()
.put(ServiceEndpointKey.builder().region(Region.of("aws-global")).build(), "us-east-1")
.put(ServiceEndpointKey.builder().region(Region.of("aws-cn-global")).build(), "cn-northwest-1").build();
private static final Map, String> SIGNING_REGIONS_BY_PARTITION = ImmutableMap
., String> builder().build();
private static final Map DNS_SUFFIXES_BY_REGION = ImmutableMap
. builder().build();
private static final Map, String> DNS_SUFFIXES_BY_PARTITION = ImmutableMap
., String> builder().build();
private static final Map HOSTNAMES_BY_REGION = ImmutableMap
. builder()
.put(ServiceEndpointKey.builder().region(Region.of("aws-global")).build(), "ce.us-east-1.amazonaws.com")
.put(ServiceEndpointKey.builder().region(Region.of("aws-cn-global")).build(), "ce.cn-northwest-1.amazonaws.com.cn")
.build();
private static final Map, String> HOSTNAMES_BY_PARTITION = ImmutableMap
., String> builder().build();
@Override
public List regions() {
return REGIONS;
}
@Override
public List servicePartitions() {
return PARTITIONS;
}
@Override
public URI endpointFor(ServiceEndpointKey key) {
return ServiceMetadataUtils.endpointFor(ServiceMetadataUtils.hostname(key, HOSTNAMES_BY_REGION, HOSTNAMES_BY_PARTITION),
ENDPOINT_PREFIX, key.region().id(),
ServiceMetadataUtils.dnsSuffix(key, DNS_SUFFIXES_BY_REGION, DNS_SUFFIXES_BY_PARTITION));
}
@Override
public Region signingRegion(ServiceEndpointKey key) {
return ServiceMetadataUtils.signingRegion(key, SIGNING_REGIONS_BY_REGION, SIGNING_REGIONS_BY_PARTITION);
}
}