1 /* 2 * Copyright 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 16 package software.amazon.awssdk.core.client.config; 17 18 import java.util.Collections; 19 import java.util.Set; 20 import java.util.concurrent.ConcurrentHashMap; 21 import software.amazon.awssdk.annotations.SdkPublicApi; 22 import software.amazon.awssdk.core.signer.Signer; 23 24 25 /** 26 * A collection of advanced options that can be configured on an AWS client via 27 * {@link ClientOverrideConfiguration.Builder#putAdvancedOption(SdkAdvancedClientOption, Object)}. 28 * 29 * <p>These options are usually not required outside of testing or advanced libraries, so most users should not need to configure 30 * them.</p> 31 * 32 * @param <T> The type of value associated with the option. 33 */ 34 @SdkPublicApi 35 public class SdkAdvancedClientOption<T> extends ClientOption<T> { 36 private static final Set<SdkAdvancedClientOption<?>> OPTIONS = ConcurrentHashMap.newKeySet(); 37 38 /** 39 * Set the prefix of the user agent that is sent with each request to AWS. 40 */ 41 public static final SdkAdvancedClientOption<String> USER_AGENT_PREFIX = new SdkAdvancedClientOption<>(String.class); 42 43 /** 44 * Set the suffix of the user agent that is sent with each request to AWS. 45 */ 46 public static final SdkAdvancedClientOption<String> USER_AGENT_SUFFIX = new SdkAdvancedClientOption<>(String.class); 47 48 /** 49 * Define the signer that should be used when authenticating with AWS. 50 */ 51 public static final SdkAdvancedClientOption<Signer> SIGNER = new SdkAdvancedClientOption<>(Signer.class); 52 53 /** 54 * Define the signer that should be used for token-based authentication with AWS. 55 */ 56 public static final SdkAdvancedClientOption<Signer> TOKEN_SIGNER = new SdkAdvancedClientOption<>(Signer.class); 57 58 /** 59 * SDK uses endpoint trait and hostPrefix trait specified in service model to modify 60 * the endpoint host that the API request is sent to. 61 * 62 * Customers can set this value to True to disable the behavior. 63 */ 64 public static final SdkAdvancedClientOption<Boolean> DISABLE_HOST_PREFIX_INJECTION = 65 new SdkAdvancedClientOption<>(Boolean.class); 66 SdkAdvancedClientOption(Class<T> valueClass)67 protected SdkAdvancedClientOption(Class<T> valueClass) { 68 super(valueClass); 69 OPTIONS.add(this); 70 } 71 72 /** 73 * Retrieve all of the advanced client options loaded so far. 74 */ options()75 static Set<SdkAdvancedClientOption<?>> options() { 76 return Collections.unmodifiableSet(OPTIONS); 77 } 78 } 79