Skip to content

Commit 440d0c1

Browse files
committed
merge v2 into logging
2 parents 634d13e + 6b0fe5a commit 440d0c1

File tree

68 files changed

+2360
-1734
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2360
-1734
lines changed

docs/utilities/parameters.md

Lines changed: 366 additions & 327 deletions
Large diffs are not rendered by default.

examples/powertools-examples-parameters/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@
2121
</dependency>
2222
<dependency>
2323
<groupId>software.amazon.lambda</groupId>
24-
<artifactId>powertools-parameters</artifactId>
24+
<artifactId>powertools-parameters-ssm</artifactId>
2525
<version>${project.version}</version>
2626
</dependency>
27+
<dependency>
28+
<groupId>software.amazon.lambda</groupId>
29+
<artifactId>powertools-parameters-secrets</artifactId>
30+
<version>${project.version}</version>
31+
</dependency>
32+
2733
<dependency>
2834
<groupId>com.amazonaws</groupId>
2935
<artifactId>aws-lambda-java-core</artifactId>

examples/powertools-examples-parameters/src/main/java/org/demo/parameters/ParametersFunction.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,30 @@
3131
import java.util.stream.Collectors;
3232
import org.slf4j.Logger;
3333
import org.slf4j.LoggerFactory;
34-
import software.amazon.lambda.powertools.parameters.ParamManager;
35-
import software.amazon.lambda.powertools.parameters.SSMProvider;
36-
import software.amazon.lambda.powertools.parameters.SecretsProvider;
34+
import software.amazon.lambda.powertools.parameters.secrets.SecretsParam;
35+
import software.amazon.lambda.powertools.parameters.secrets.SecretsProvider;
36+
import software.amazon.lambda.powertools.parameters.ssm.SSMParam;
37+
import software.amazon.lambda.powertools.parameters.ssm.SSMProvider;
3738

3839
public class ParametersFunction implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
3940
private static final Logger log = LoggerFactory.getLogger(ParametersFunction.class);
4041

41-
SSMProvider ssmProvider = ParamManager.getSsmProvider();
42-
SecretsProvider secretsProvider = ParamManager.getSecretsProvider();
42+
// Annotation-style injection from secrets manager
43+
@SecretsParam(key = "/powertools-java/userpwd")
44+
String secretParamInjected;
4345

44-
String simpleValue = ssmProvider.defaultMaxAge(30, SECONDS).get("/powertools-java/sample/simplekey");
46+
// Annotation-style injection from Systems Manager
47+
@SSMParam(key = "/powertools-java/sample/simplekey")
48+
String ssmParamInjected;
49+
50+
SSMProvider ssmProvider = SSMProvider
51+
.builder()
52+
.build();
53+
SecretsProvider secretsProvider = SecretsProvider
54+
.builder()
55+
.build();
56+
57+
String simpleValue = ssmProvider.withMaxAge(30, SECONDS).get("/powertools-java/sample/simplekey");
4558
String listValue = ssmProvider.withMaxAge(60, SECONDS).get("/powertools-java/sample/keylist");
4659
MyObject jsonObj = ssmProvider.withTransformation(json).get("/powertools-java/sample/keyjson", MyObject.class);
4760
Map<String, String> allValues = ssmProvider.getMultiple("/powertools-java/sample");

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656
<module>powertools-e2e-tests</module>
5757
<module>powertools-batch</module>
5858
<module>examples</module>
59+
<module>powertools-parameters/powertools-parameters-ssm</module>
60+
<module>powertools-parameters/powertools-parameters-secrets</module>
61+
<module>powertools-parameters/powertools-parameters-dynamodb</module>
62+
<module>powertools-parameters/powertools-parameters-appconfig</module>
63+
<module>powertools-parameters/powertools-parameters-tests</module>
5964
</modules>
6065

6166
<scm>

powertools-e2e-tests/handlers/batch/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>software.amazon.lambda</groupId>
77
<artifactId>e2e-test-handlers-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>e2e-test-handler-batch</artifactId>

powertools-e2e-tests/handlers/idempotency/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>software.amazon.lambda</groupId>
77
<artifactId>e2e-test-handlers-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>e2e-test-handler-idempotency</artifactId>

powertools-e2e-tests/handlers/largemessage/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>software.amazon.lambda</groupId>
77
<artifactId>e2e-test-handlers-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>e2e-test-handler-largemessage</artifactId>

powertools-e2e-tests/handlers/largemessage_idempotent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>software.amazon.lambda</groupId>
77
<artifactId>e2e-test-handlers-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>e2e-test-handler-large-msg-idempotent</artifactId>

powertools-e2e-tests/handlers/logging/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>software.amazon.lambda</groupId>
77
<artifactId>e2e-test-handlers-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>e2e-test-handler-logging</artifactId>

powertools-e2e-tests/handlers/metrics/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<parent>
66
<groupId>software.amazon.lambda</groupId>
77
<artifactId>e2e-test-handlers-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>e2e-test-handler-metrics</artifactId>
1212
<packaging>jar</packaging>
13-
<name>A Lambda function using Powertools for AWS Lambda (Java) Parameters</name>
13+
<name>A Lambda function using Powertools for AWS Lambda (Java) Metrics</name>
1414

1515
<dependencies>
1616
<dependency>

powertools-e2e-tests/handlers/parameters/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<parent>
66
<groupId>software.amazon.lambda</groupId>
77
<artifactId>e2e-test-handlers-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>e2e-test-handler-parameters</artifactId>
1212
<packaging>jar</packaging>
13-
<name>A Lambda function using powertools logging</name>
13+
<name>A Lambda function using powertools parameters</name>
1414

1515
<dependencies>
1616
<dependency>
@@ -19,7 +19,7 @@
1919
</dependency>
2020
<dependency>
2121
<groupId>software.amazon.lambda</groupId>
22-
<artifactId>powertools-parameters</artifactId>
22+
<artifactId>powertools-parameters-appconfig</artifactId>
2323
</dependency>
2424
<dependency>
2525
<groupId>com.amazonaws</groupId>

powertools-e2e-tests/handlers/parameters/src/main/java/software/amazon/lambda/powertools/e2e/Function.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@
1717
import com.amazonaws.services.lambda.runtime.Context;
1818
import com.amazonaws.services.lambda.runtime.RequestHandler;
1919
import software.amazon.lambda.powertools.logging.Logging;
20-
import software.amazon.lambda.powertools.parameters.AppConfigProvider;
21-
import software.amazon.lambda.powertools.parameters.ParamManager;
20+
import software.amazon.lambda.powertools.parameters.appconfig.AppConfigProvider;
2221

2322
public class Function implements RequestHandler<Input, String> {
2423

2524
@Logging
2625
public String handleRequest(Input input, Context context) {
27-
AppConfigProvider provider = ParamManager.getAppConfigProvider(input.getEnvironment(), input.getApp());
26+
AppConfigProvider provider = AppConfigProvider.builder()
27+
.withApplication(input.getApp())
28+
.withEnvironment(input.getEnvironment())
29+
.build();
30+
31+
//(input.getEnvironment(), input.getApp());
2832
return provider.get(input.getKey());
2933

3034
}

powertools-e2e-tests/handlers/pom.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>software.amazon.lambda</groupId>
66
<artifactId>e2e-test-handlers-parent</artifactId>
7-
<version>1.0.0</version>
7+
<version>2.0.0-SNAPSHOT</version>
88
<packaging>pom</packaging>
99
<name>Handlers for End-to-End tests</name>
1010
<description>Fake handlers that use Powertools for AWS Lambda (Java).</description>
@@ -26,6 +26,9 @@
2626
</properties>
2727

2828
<modules>
29+
<module>batch</module>
30+
<module>largemessage</module>
31+
<module>largemessage_idempotent</module>
2932
<module>logging</module>
3033
<module>tracing</module>
3134
<module>metrics</module>
@@ -74,7 +77,7 @@
7477
</dependency>
7578
<dependency>
7679
<groupId>software.amazon.lambda</groupId>
77-
<artifactId>powertools-parameters</artifactId>
80+
<artifactId>powertools-parameters-appconfig</artifactId>
7881
<version>${lambda.powertools.version}</version>
7982
</dependency>
8083
<dependency>

powertools-e2e-tests/handlers/tracing/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>software.amazon.lambda</groupId>
77
<artifactId>e2e-test-handlers-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>e2e-test-handler-tracing</artifactId>

powertools-e2e-tests/handlers/validation-alb-event/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>software.amazon.lambda</groupId>
77
<artifactId>e2e-test-handlers-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>e2e-test-handler-validation-alb-event</artifactId>

powertools-e2e-tests/handlers/validation-apigw-event/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>software.amazon.lambda</groupId>
77
<artifactId>e2e-test-handlers-parent</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>e2e-test-handler-validation-apigw-event</artifactId>

powertools-parameters/pom.xml

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,7 @@
2828

2929
<name>Powertools for AWS Lambda (Java) - Parameters</name>
3030

31-
<description>
32-
Set of utilities to retrieve parameters from Secrets Manager or SSM Parameter Store
33-
</description>
34-
<url>https://aws.amazon.com/lambda/</url>
35-
<issueManagement>
36-
<system>GitHub Issues</system>
37-
<url>https://github.com/aws-powertools/powertools-lambda-java/issues</url>
38-
</issueManagement>
39-
<scm>
40-
<url>https://github.com/aws-powertools/powertools-lambda-java.git</url>
41-
</scm>
42-
<developers>
43-
<developer>
44-
<name>Powertools for AWS Lambda team</name>
45-
<organization>Amazon Web Services</organization>
46-
<organizationUrl>https://aws.amazon.com/</organizationUrl>
47-
</developer>
48-
</developers>
49-
50-
<distributionManagement>
51-
<snapshotRepository>
52-
<id>ossrh</id>
53-
<url>https://aws.oss.sonatype.org/content/repositories/snapshots</url>
54-
</snapshotRepository>
55-
</distributionManagement>
31+
<description>Set of utilities to retrieve parameters - common interface</description>
5632

5733
<dependencies>
5834
<dependency>
@@ -64,46 +40,10 @@
6440
<groupId>software.amazon.lambda</groupId>
6541
<artifactId>powertools-common</artifactId>
6642
</dependency>
67-
<dependency>
68-
<groupId>software.amazon.awssdk</groupId>
69-
<artifactId>ssm</artifactId>
70-
<exclusions>
71-
<exclusion>
72-
<groupId>software.amazon.awssdk</groupId>
73-
<artifactId>apache-client</artifactId>
74-
</exclusion>
75-
<exclusion>
76-
<groupId>software.amazon.awssdk</groupId>
77-
<artifactId>netty-nio-client</artifactId>
78-
</exclusion>
79-
</exclusions>
80-
</dependency>
81-
<dependency>
82-
<groupId>software.amazon.awssdk</groupId>
83-
<artifactId>secretsmanager</artifactId>
84-
<exclusions>
85-
<exclusion>
86-
<groupId>software.amazon.awssdk</groupId>
87-
<artifactId>apache-client</artifactId>
88-
</exclusion>
89-
<exclusion>
90-
<groupId>software.amazon.awssdk</groupId>
91-
<artifactId>netty-nio-client</artifactId>
92-
</exclusion>
93-
</exclusions>
94-
</dependency>
9543
<dependency>
9644
<groupId>software.amazon.awssdk</groupId>
9745
<artifactId>url-connection-client</artifactId>
9846
</dependency>
99-
<dependency>
100-
<groupId>software.amazon.awssdk</groupId>
101-
<artifactId>dynamodb</artifactId>
102-
</dependency>
103-
<dependency>
104-
<groupId>software.amazon.awssdk</groupId>
105-
<artifactId>appconfigdata</artifactId>
106-
</dependency>
10747

10848
<dependency>
10949
<groupId>com.fasterxml.jackson.core</groupId>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>software.amazon.lambda</groupId>
9+
<artifactId>powertools-parent</artifactId>
10+
<version>2.0.0-SNAPSHOT</version>
11+
<relativePath>../../pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>powertools-parameters-appconfig</artifactId>
15+
<name>Powertools for AWS Lambda (Java) library Parameters - AppConfig</name>
16+
<description>AppConfig implementation for the Parameters module</description>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>software.amazon.lambda</groupId>
21+
<artifactId>powertools-parameters</artifactId>
22+
<version>${project.version}</version>
23+
</dependency>
24+
25+
<dependency>
26+
<groupId>software.amazon.awssdk</groupId>
27+
<artifactId>appconfigdata</artifactId>
28+
<exclusions>
29+
<exclusion>
30+
<groupId>software.amazon.awssdk</groupId>
31+
<artifactId>apache-client</artifactId>
32+
</exclusion>
33+
<exclusion>
34+
<groupId>software.amazon.awssdk</groupId>
35+
<artifactId>netty-nio-client</artifactId>
36+
</exclusion>
37+
</exclusions>
38+
</dependency>
39+
40+
<!-- Test dependencies -->
41+
<dependency>
42+
<groupId>org.junit.jupiter</groupId>
43+
<artifactId>junit-jupiter-api</artifactId>
44+
<scope>test</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.junit.jupiter</groupId>
48+
<artifactId>junit-jupiter-engine</artifactId>
49+
<scope>test</scope>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.apache.commons</groupId>
53+
<artifactId>commons-lang3</artifactId>
54+
<scope>test</scope>
55+
</dependency>
56+
<dependency>
57+
<groupId>org.assertj</groupId>
58+
<artifactId>assertj-core</artifactId>
59+
<scope>test</scope>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.aspectj</groupId>
63+
<artifactId>aspectjweaver</artifactId>
64+
<scope>test</scope>
65+
</dependency>
66+
</dependencies>
67+
68+
<build>
69+
<plugins>
70+
<plugin>
71+
<artifactId>maven-surefire-plugin</artifactId>
72+
<version>3.1.2</version>
73+
<configuration>
74+
<environmentVariables>
75+
<AWS_REGION>eu-central-1</AWS_REGION>
76+
</environmentVariables>
77+
</configuration>
78+
</plugin>
79+
<plugin>
80+
<groupId>org.apache.maven.plugins</groupId>
81+
<artifactId>maven-checkstyle-plugin</artifactId>
82+
</plugin>
83+
</plugins>
84+
</build>
85+
</project>

0 commit comments

Comments
 (0)