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.profiles;
17 
18 import software.amazon.awssdk.annotations.SdkProtectedApi;
19 import software.amazon.awssdk.utils.SystemSetting;
20 
21 /**
22  * System settings for loading configuration from profile files.
23  */
24 @SdkProtectedApi
25 public enum ProfileFileSystemSetting implements SystemSetting {
26     /**
27      * Configure the default configuration file used in the ProfileFile. When not explicitly
28      * overridden in a client (eg. by specifying the region or credentials provider), this will be the location used when an
29      * AWS client is created.
30      *
31      * See http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html for more information on configuring the
32      * SDK via a configuration file.
33      */
34     AWS_CONFIG_FILE("aws.configFile", null),
35 
36     /**
37      * Configure the default credentials file used in the ProfileFile. When not explicitly
38      * overridden in a client (eg. by specifying the region or credentials provider), this will be the location used when an
39      * AWS client is created.
40      *
41      * See http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html for more information on configuring the
42      * SDK via a credentials file.
43      */
44     AWS_SHARED_CREDENTIALS_FILE("aws.sharedCredentialsFile", null),
45 
46     /**
47      * Configure the default profile that should be loaded from the {@link #AWS_CONFIG_FILE}
48      *
49      * @see #AWS_CONFIG_FILE
50      */
51     AWS_PROFILE("aws.profile", "default");
52 
53     private final String systemProperty;
54     private final String defaultValue;
55 
ProfileFileSystemSetting(String systemProperty, String defaultValue)56     ProfileFileSystemSetting(String systemProperty, String defaultValue) {
57         this.systemProperty = systemProperty;
58         this.defaultValue = defaultValue;
59     }
60 
61     @Override
property()62     public String property() {
63         return systemProperty;
64     }
65 
66     @Override
environmentVariable()67     public String environmentVariable() {
68         return name();
69     }
70 
71     @Override
defaultValue()72     public String defaultValue() {
73         return defaultValue;
74     }
75 }
76