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

15 package com.amazonaws.internal.config;
16
17 import com.amazonaws.annotation.Immutable;
18
19 /**
20  * AWS HttpClient configuration.
21  */

22 @Immutable
23 public class HttpClientConfig {
24     // This class is not strictly necessary for the existing use cases,
25     // but allows future expansion of additional configurations to be made
26     // with ease.
27     private final String serviceName;
28     private final String regionMetadataServiceName;
29
30     /**
31      * @param serviceName
32      *            The service name used for request signing. It's also used as
33      *            the service identifier when looking up the region metadata if
34      *            regionMetadataServiceName is not set.
35      * @param regionMetadataServiceName
36      *            Override value for the service name identifier when looking up
37      *            the region metadata. This config is normally needed in
38      *            scenarios when a common sigv4 service name is shared by
39      *            multiple services that have different region metadata (for
40      *            example, AmazonDynamoDBClient and AmazonDynamoDBStreamsClient
41      *            share the same service name 'dynamodb' but not the same
42      *            endpoint prefix).
43      */

44     HttpClientConfig(String serviceName, String regionMetadataServiceName) {
45         this.serviceName = serviceName;
46         this.regionMetadataServiceName = regionMetadataServiceName;
47     }
48
49     @Override public String toString() {
50         return "serviceName: " + serviceName + ", regionMetadataServiceName: "
51                 + regionMetadataServiceName;
52     }
53
54     public String getServiceName() {
55         return serviceName;
56     }
57
58     public String getRegionMetadataServiceName() {
59         return regionMetadataServiceName;
60     }
61
62 }