Skip to content

Commit 5771291

Browse files
committed
Address jvdl review comments
1 parent 21386f5 commit 5771291

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

docs/utilities/parameters.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ in order to get data from other regions or use specific credentials.
7676
}
7777
```
7878

79-
=== "SSMProvider with an explicit region"
79+
=== "SSMProvider with a custom client"
8080

8181
```java hl_lines="5 7"
8282
import software.amazon.lambda.powertools.parameters.SSMProvider;
@@ -151,7 +151,7 @@ in order to get data from other regions or use specific credentials.
151151
}
152152
```
153153

154-
=== "SecretsProvider with an explicit region"
154+
=== "SecretsProvider with a custom client"
155155

156156
```java hl_lines="5 7"
157157
import software.amazon.lambda.powertools.parameters.SecretsProvider;
@@ -188,7 +188,7 @@ a `DynamoDbProvider` providing a client if you need to configure it yourself.
188188
}
189189
```
190190

191-
=== "DynamoDbProvider with an explicit region"
191+
=== "DynamoDbProvider with a custom client"
192192

193193
```java hl_lines="9 10 11 12 15 18"
194194
import software.amazon.lambda.powertools.parameters.DynamoDbProvider;

powertools-parameters/src/main/java/software/amazon/lambda/powertools/parameters/DynamoDbProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ protected String getValue(String key) {
5353
GetItemResponse resp = client.getItem(GetItemRequest.builder()
5454
.tableName(tableName)
5555
.key(Collections.singletonMap("id", AttributeValue.fromS(key)))
56-
.attributesToGet("val")
56+
.attributesToGet("value")
5757
.build());
5858

5959
// If we have an item at the key, we should be able to get a 'val' out of it. If not it's
6060
// exceptional.
6161
// If we don't have an item at the key, we should return null.
6262
if (resp.hasItem() && !resp.item().values().isEmpty()) {
63-
return resp.item().get("val").s();
63+
return resp.item().get("value").s();
6464
}
6565

6666
return null;
@@ -87,7 +87,7 @@ protected Map<String, String> getMultipleValues(String path) {
8787
.collect(
8888
Collectors.toMap(
8989
(i) -> i.get("sk").s(),
90-
(i) -> i.get("val").s()));
90+
(i) -> i.get("value").s()));
9191

9292

9393
}

powertools-parameters/src/test/java/software/amazon/lambda/powertools/parameters/DynamoDbProviderE2ETest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
* of our unit test suite in the cloud.
2020
*
2121
* The test is kept here for 1/ local development and 2/ in preparation for future
22-
* E2E tests running in the cloud CI.
22+
* E2E tests running in the cloud CI. Once the E2E test structure is merged we
23+
* will move this across.
2324
*/
2425
@Disabled
2526
public class DynamoDbProviderE2ETest {
@@ -43,7 +44,7 @@ public void TestGetValue() {
4344
// Arrange
4445
HashMap<String, AttributeValue> testItem = new HashMap<String, AttributeValue>();
4546
testItem.put("id", AttributeValue.fromS("test_param"));
46-
testItem.put("val", AttributeValue.fromS("the_value_is_hello!"));
47+
testItem.put("value", AttributeValue.fromS("the_value_is_hello!"));
4748
ddbClient.putItem(PutItemRequest.builder()
4849
.tableName(ParamsTestTable)
4950
.item(testItem)
@@ -64,7 +65,7 @@ public void TestGetValues() {
6465
HashMap<String, AttributeValue> testItem = new HashMap<String, AttributeValue>();
6566
testItem.put("id", AttributeValue.fromS("test_param"));
6667
testItem.put("sk", AttributeValue.fromS("test_param_part_1"));
67-
testItem.put("val", AttributeValue.fromS("the_value_is_hello!"));
68+
testItem.put("value", AttributeValue.fromS("the_value_is_hello!"));
6869
ddbClient.putItem(PutItemRequest.builder()
6970
.tableName(MultiparamsTestTable)
7071
.item(testItem)
@@ -73,7 +74,7 @@ public void TestGetValues() {
7374
HashMap<String, AttributeValue> testItem2 = new HashMap<String, AttributeValue>();
7475
testItem2.put("id", AttributeValue.fromS("test_param"));
7576
testItem2.put("sk", AttributeValue.fromS("test_param_part_2"));
76-
testItem2.put("val", AttributeValue.fromS("the_value_is_still_hello!"));
77+
testItem2.put("value", AttributeValue.fromS("the_value_is_still_hello!"));
7778
ddbClient.putItem(PutItemRequest.builder()
7879
.tableName(MultiparamsTestTable)
7980
.item(testItem2)

powertools-parameters/src/test/java/software/amazon/lambda/powertools/parameters/DynamoDbProviderTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void getValue() {
4949
String expectedValue = "Value1";
5050
HashMap<String, AttributeValue> responseData = new HashMap<String, AttributeValue>();
5151
responseData.put("id", AttributeValue.fromS(key));
52-
responseData.put("val", AttributeValue.fromS(expectedValue));
52+
responseData.put("value", AttributeValue.fromS(expectedValue));
5353
GetItemResponse response = GetItemResponse.builder()
5454
.item(responseData)
5555
.build();
@@ -85,7 +85,7 @@ public void getValueWithMalformedRowThrows() {
8585
String key = "Key1";
8686
HashMap<String, AttributeValue> responseData = new HashMap<String, AttributeValue>();
8787
responseData.put("id", AttributeValue.fromS(key));
88-
responseData.put("not-val", AttributeValue.fromS("something"));
88+
responseData.put("not-value", AttributeValue.fromS("something"));
8989
Mockito.when(client.getItem(getItemValueCaptor.capture())).thenReturn(GetItemResponse.builder()
9090
.item(responseData)
9191
.build());
@@ -108,11 +108,11 @@ public void getValues() {
108108
HashMap<String, AttributeValue> item1 = new HashMap<String, AttributeValue>();
109109
item1.put("id", AttributeValue.fromS(key));
110110
item1.put("sk", AttributeValue.fromS(subkey1));
111-
item1.put("val", AttributeValue.fromS(val1));
111+
item1.put("value", AttributeValue.fromS(val1));
112112
HashMap<String, AttributeValue> item2 = new HashMap<String, AttributeValue>();
113113
item2.put("id", AttributeValue.fromS(key));
114114
item2.put("sk", AttributeValue.fromS(subkey2));
115-
item2.put("val", AttributeValue.fromS(val2));
115+
item2.put("value", AttributeValue.fromS(val2));
116116
QueryResponse response = QueryResponse.builder()
117117
.items(item1, item2)
118118
.build();
@@ -150,7 +150,7 @@ public void getValuesWithMalformedRowThrows() {
150150
HashMap<String, AttributeValue> item1 = new HashMap<String, AttributeValue>();
151151
item1.put("id", AttributeValue.fromS(key));
152152
item1.put("sk", AttributeValue.fromS("some-subkey"));
153-
item1.put("notVal", AttributeValue.fromS("somevalue"));
153+
item1.put("not-value", AttributeValue.fromS("somevalue"));
154154
QueryResponse response = QueryResponse.builder()
155155
.items(item1)
156156
.build();

0 commit comments

Comments
 (0)