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.auth.credentials; 17 18 import software.amazon.awssdk.annotations.SdkPublicApi; 19 import software.amazon.awssdk.utils.SdkAutoCloseable; 20 21 /** 22 * A base for many credential providers within the SDK that rely on calling a remote HTTP endpoint to refresh credentials. 23 * 24 * @see InstanceProfileCredentialsProvider 25 * @see ContainerCredentialsProvider 26 */ 27 @SdkPublicApi 28 public interface HttpCredentialsProvider extends AwsCredentialsProvider, SdkAutoCloseable { 29 interface Builder<TypeToBuildT extends HttpCredentialsProvider, BuilderT extends Builder<?, ?>> { 30 /** 31 * Configure whether the provider should fetch credentials asynchronously in the background. If this is true, 32 * threads are less likely to block when credentials are loaded, but additional resources are used to maintain 33 * the provider. 34 * 35 * <p>By default, this is disabled.</p> 36 */ asyncCredentialUpdateEnabled(Boolean asyncCredentialUpdateEnabled)37 BuilderT asyncCredentialUpdateEnabled(Boolean asyncCredentialUpdateEnabled); 38 39 /** 40 * When {@link #asyncCredentialUpdateEnabled(Boolean)} is true, this configures the name of the threads used for 41 * credential refreshing. 42 */ asyncThreadName(String asyncThreadName)43 BuilderT asyncThreadName(String asyncThreadName); 44 45 /** 46 * Override the default hostname (not path) that is used for credential refreshing. Most users do not need to modify 47 * this behavior, except for testing purposes where mocking the HTTP credential source would be useful. 48 */ endpoint(String endpoint)49 BuilderT endpoint(String endpoint); 50 51 /** 52 * Build the credentials provider based on the configuration on this builder. 53 */ build()54 TypeToBuildT build(); 55 } 56 } 57