Skip to content

Commit 6e099f1

Browse files
committed
Update JavaDoc
1 parent c52336e commit 6e099f1

File tree

4 files changed

+56
-54
lines changed

4 files changed

+56
-54
lines changed

ojdbc-provider-aws/src/main/java/oracle/jdbc/provider/aws/authentication/AwsCredentialsFactory.java

+6-52
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,18 @@
6767
public final class AwsCredentialsFactory
6868
implements ResourceFactory<AwsCredentials> {
6969

70-
/** Method of authentication supported by the Azure SDK */
70+
/** Method of authentication supported by the AWS SDK */
7171
public static final Parameter<AwsAuthenticationMethod>
7272
AUTHENTICATION_METHOD = Parameter.create(REQUIRED);
7373

74-
public static final Parameter<String> ACCESS_KEY_ID = Parameter.create(REQUIRED);
75-
76-
public static final Parameter<String> SECRET_ACCESS_KEY = Parameter.create(SENSITIVE, REQUIRED);
77-
7874
private static final AwsCredentialsFactory INSTANCE
7975
= new AwsCredentialsFactory();
8076

8177
private AwsCredentialsFactory() { }
8278

8379
/**
84-
* Returns a singleton of {@code TokenCredentialFactory}.
85-
* @return a singleton of {@code TokenCredentialFactory}
80+
* Returns a singleton of {@code AwsCredentialsFactory}.
81+
* @return a singleton of {@code AwsCredentialsFactory}
8682
*/
8783
public static AwsCredentialsFactory getInstance() {
8884
return INSTANCE;
@@ -98,7 +94,7 @@ public Resource<AwsCredentials> request(ParameterSet parameterSet) {
9894

9995
/**
10096
* Returns credentials for requesting an access token. The type of credentials
101-
* used are configured by the parameters of the given {@code parameters}.
97+
* used are configured by the parameters of the given {@code parameterSet}.
10298
* Supported parameters are defined by the class variables in
10399
* {@link AwsCredentialsFactory}.
104100
* @param parameterSet parameters that configure credentials. Not null.
@@ -111,7 +107,7 @@ private static AwsCredentials getCredential(ParameterSet parameterSet) {
111107

112108
switch (authenticationMethod) {
113109
case DEFAULT:
114-
return defaultCredentials(parameterSet);
110+
return defaultCredentials();
115111
default :
116112
throw new IllegalArgumentException(
117113
"Unrecognized authentication method: " + authenticationMethod);
@@ -120,53 +116,11 @@ private static AwsCredentials getCredential(ParameterSet parameterSet) {
120116

121117
/**
122118
* Returns credentials resolved by {@link AppConfigDataClient}.
123-
* @param parameterSet
124119
* @return
125120
*/
126-
private static AwsCredentials defaultCredentials(ParameterSet parameterSet) {
121+
private static AwsCredentials defaultCredentials() {
127122
return DefaultCredentialsProvider
128123
.builder()
129124
.build().resolveCredentials();
130125
}
131-
132-
/**
133-
* Returns the value of a required parameter that may be configured by a
134-
* provider or an SDK environment variable.
135-
* @param parameters Parameters provided by the provider. Not null
136-
* @param parameter Parameter that may be configured by the provider. Not null
137-
* @param sdkName Name of the SDK environment variable, or null if there is
138-
* none.
139-
* @return The configured value of the parameter. Not null.
140-
* @throws IllegalStateException If the parameter is not configured by the
141-
* provider or the SDK.
142-
*/
143-
private static String requireParameter(
144-
ParameterSet parameters, Parameter<String> parameter, String sdkName) {
145-
try {
146-
return parameters.getRequired(parameter);
147-
}
148-
catch (IllegalStateException parameterNotConfigured) {
149-
throw new IllegalArgumentException(format(
150-
"No value is configured for parameter \"%s\"," +
151-
" or SDK variable \"%s\"",
152-
parameters.getName(parameter), sdkName), parameterNotConfigured);
153-
}
154-
}
155-
156-
/**
157-
* Returns the value of an optional parameter which may be configured by a
158-
* provider or an SDK environment variable.
159-
* @param parameters Parameters provided by the provider. Not null
160-
* @param parameter Parameter that may be configured by the provider. Not null
161-
* @param sdkName Name of the SDK environment variable, or null if there is
162-
* none.
163-
* @return The configured value of the parameter, or null if not configured.
164-
*/
165-
private static String optionalParameter(
166-
ParameterSet parameters, Parameter<String> parameter, String sdkName) {
167-
String value = parameters.getOptional(parameter);
168-
169-
return value != null ? value : null;
170-
}
171-
172126
}

ojdbc-provider-aws/src/main/java/oracle/jdbc/provider/aws/configuration/AwsJsonSecretsManagerProvider.java

+21
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@
1212

1313
public class AwsJsonSecretsManagerProvider
1414
implements OracleConfigurationJsonSecretProvider {
15+
/**
16+
* {@inheritDoc}
17+
* <p>
18+
* Returns the password of the Secret that is retrieved from AWS Secrets
19+
* Manager secret.
20+
* </p>
21+
* <p>
22+
* The {@code jsonObject} has the following form:
23+
* </p>
24+
*
25+
* <pre>{@code
26+
* "password": {
27+
* "type": "awssecretsmanager",
28+
* "value": "<secret-name>"
29+
* }
30+
* }</pre>
31+
*
32+
* @param jsonObject json object to be parsed
33+
* @return encoded char array in base64 format that represents the retrieved
34+
* Secret.
35+
*/
1536
@Override
1637
public char[] getSecret(OracleJsonObject jsonObject) {
1738
ParameterSet parameterSet =

ojdbc-provider-aws/src/main/java/oracle/jdbc/provider/aws/configuration/AwsS3ConfigurationProvider.java

+13
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,21 @@
99
import java.net.URISyntaxException;
1010
import java.sql.SQLException;
1111

12+
/**
13+
* A provider for JSON payload which contains configuration from AWS S3.
14+
* See {@link #getJson(String)} for the spec of the JSON payload.
15+
**/
1216
public class AwsS3ConfigurationProvider extends OracleConfigurationJsonProvider {
1317

18+
/**
19+
* {@inheritDoc}
20+
* <p>
21+
* Returns the JSON payload stored in AWS S3.
22+
* </p>
23+
*
24+
* @param s3Url URI of the object stored in AWS S3
25+
* @return JSON payload
26+
*/
1427
@Override
1528
public InputStream getJson(String s3Url) throws SQLException {
1629

ojdbc-provider-aws/src/main/java/oracle/jdbc/provider/aws/configuration/AwsSecretsManagerConfigurationProvider.java

+16-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
import java.util.HashMap;
1111
import java.util.Map;
1212

13+
/**
14+
* A provider for JSON payload which contains configuration from AWS Secrets
15+
* Manager.
16+
* See {@link #getJson(String)} for the spec of the JSON payload.
17+
**/
1318
public class AwsSecretsManagerConfigurationProvider extends OracleConfigurationJsonProvider {
1419

1520
/**
@@ -24,11 +29,20 @@ public class AwsSecretsManagerConfigurationProvider extends OracleConfigurationJ
2429
.addParameter("key_name", SecretsManagerFactory.KEY_NAME))
2530
.build();
2631

32+
/**
33+
* {@inheritDoc}
34+
* <p>
35+
* Returns the JSON payload stored in AWS Secrets Manager secret.
36+
* </p>
37+
*
38+
* @param secretName name of the secret
39+
* @return JSON payload
40+
*/
2741
@Override
28-
public InputStream getJson(String secretId) {
42+
public InputStream getJson(String secretName) {
2943
final String valueFieldName = "value";
3044
Map<String, String> optionsWithSecret = new HashMap<>(options);
31-
optionsWithSecret.put(valueFieldName, secretId);
45+
optionsWithSecret.put(valueFieldName, secretName);
3246

3347
ParameterSet parameters = PARAMETER_SET_PARSER.parseNamedValues(optionsWithSecret);
3448

0 commit comments

Comments
 (0)