Skip to content

chore(v2): Split parameters module up by parameter provider #1403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 51 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a4d019a
Starting by splitting SSM provider out
scottgerring Aug 29, 2023
a357255
Move secrets out
scottgerring Aug 29, 2023
7dd85d2
Move DDB out
scottgerring Aug 29, 2023
058fb13
Moved AppConfig out
scottgerring Aug 29, 2023
2f79e7c
Gutting ParamManager
scottgerring Aug 30, 2023
65501c3
Breaking up aspects
scottgerring Sep 8, 2023
357f859
More rejigging
scottgerring Sep 8, 2023
e93b1d0
Fix build?
scottgerring Sep 8, 2023
69619e8
spotbugs exclude path change
scottgerring Sep 8, 2023
9bfff82
More excludes
scottgerring Sep 8, 2023
f1106d4
Fix pom
scottgerring Sep 8, 2023
5ce1d86
Trying to write an aspect test
scottgerring Sep 11, 2023
aaba843
Build fix?
scottgerring Sep 18, 2023
0cd48da
Fix test
scottgerring Sep 18, 2023
4b89862
Remove gradle noise
scottgerring Sep 18, 2023
28b70ea
Review feedback
scottgerring Sep 29, 2023
7bbf6cb
Merge branch 'v2' into v2-split-params
scottgerring Sep 29, 2023
5c1e135
Merge branch 'v2' into v2-split-params
scottgerring Nov 16, 2023
ee09290
Remove mockito config
scottgerring Nov 16, 2023
f7cf908
Aspect tests for all the params aspects
scottgerring Nov 16, 2023
54039ad
Merge branch 'v2' into v2-split-params
scottgerring Nov 22, 2023
bf433f1
Write some docs
scottgerring Nov 22, 2023
2a7f9cb
rearrange pom
scottgerring Nov 22, 2023
54c1664
More warning ignores
scottgerring Nov 22, 2023
762baf3
Removed some unecessary overrides
scottgerring Nov 23, 2023
b5e0602
Remove defaultMaxAge from BaseProvider intf
scottgerring Nov 28, 2023
8e680f7
Refactoring param aspects to pull out shared code
scottgerring Nov 29, 2023
cb87a5c
Refactoring param aspects to pull out shared code
scottgerring Nov 29, 2023
e283e4a
Undid madness
scottgerring Nov 29, 2023
9f8486f
Another unused field
scottgerring Nov 29, 2023
a955fac
Checkstyle
scottgerring Nov 29, 2023
9c86b6f
Drop final modifier for tests
scottgerring Nov 29, 2023
47400cb
Merge branch 'v2' into v2-split-params
scottgerring Dec 8, 2023
cf170d4
Review comments
scottgerring Dec 8, 2023
23c7e1c
Incremental doc changes
scottgerring Dec 8, 2023
646bd54
Cleanup
scottgerring Dec 8, 2023
e994192
Apply suggestions from code review
scottgerring Dec 8, 2023
19fc988
Apply suggestions from code review
scottgerring Dec 8, 2023
8fee25b
Review feedback
scottgerring Dec 8, 2023
73e3a87
Merge remote-tracking branch 'refs/remotes/origin/v2-split-params' in…
scottgerring Dec 8, 2023
f356ab4
More review changes
scottgerring Dec 8, 2023
4a5cecf
Update powertools-parameters/powertools-parameters-appconfig/src/main…
scottgerring Dec 8, 2023
f27b69f
E2E tests fix
scottgerring Dec 8, 2023
07cd9e2
Merge remote-tracking branch 'refs/remotes/origin/v2-split-params' in…
scottgerring Dec 8, 2023
dccd961
A final change?
scottgerring Dec 8, 2023
fab773e
Removed useless create
scottgerring Dec 8, 2023
f7e1a24
Will this do it?
scottgerring Dec 8, 2023
487bd77
Clean up E2E test tree
scottgerring Dec 8, 2023
d36f36d
Apply suggestions from code review
scottgerring Dec 11, 2023
c7422f2
Apply suggestions from code review
scottgerring Dec 11, 2023
75abe1e
Update powertools-parameters/powertools-parameters-appconfig/src/test…
scottgerring Dec 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
693 changes: 366 additions & 327 deletions docs/utilities/parameters.md

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion examples/powertools-examples-parameters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@
</dependency>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-parameters</artifactId>
<artifactId>powertools-parameters-ssm</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-parameters-secrets</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,30 @@
import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import software.amazon.lambda.powertools.parameters.ParamManager;
import software.amazon.lambda.powertools.parameters.SSMProvider;
import software.amazon.lambda.powertools.parameters.SecretsProvider;
import software.amazon.lambda.powertools.parameters.secrets.SecretsParam;
import software.amazon.lambda.powertools.parameters.secrets.SecretsProvider;
import software.amazon.lambda.powertools.parameters.ssm.SSMParam;
import software.amazon.lambda.powertools.parameters.ssm.SSMProvider;

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

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

String simpleValue = ssmProvider.defaultMaxAge(30, SECONDS).get("/powertools-java/sample/simplekey");
// Annotation-style injection from Systems Manager
@SSMParam(key = "/powertools-java/sample/simplekey")
String ssmParamInjected;

SSMProvider ssmProvider = SSMProvider
.builder()
.build();
SecretsProvider secretsProvider = SecretsProvider
.builder()
.build();

String simpleValue = ssmProvider.withMaxAge(30, SECONDS).get("/powertools-java/sample/simplekey");
String listValue = ssmProvider.withMaxAge(60, SECONDS).get("/powertools-java/sample/keylist");
MyObject jsonObj = ssmProvider.withTransformation(json).get("/powertools-java/sample/keyjson", MyObject.class);
Map<String, String> allValues = ssmProvider.getMultiple("/powertools-java/sample");
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ extra_javascript:

extra:
powertools:
version: 1.18.0 # to update after each release (we do not want snapshot version here)
version: 2.0.0 # to update after each release (we do not want snapshot version here)

repo_url: https://github.com/aws-powertools/powertools-lambda-java
edit_uri: edit/main/docs
34 changes: 5 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
<module>powertools-e2e-tests</module>
<module>powertools-batch</module>
<module>examples</module>
<module>powertools-parameters/powertools-parameters-ssm</module>
<module>powertools-parameters/powertools-parameters-secrets</module>
<module>powertools-parameters/powertools-parameters-dynamodb</module>
<module>powertools-parameters/powertools-parameters-appconfig</module>
<module>powertools-parameters/powertools-parameters-tests</module>
</modules>

<scm>
Expand Down Expand Up @@ -600,35 +605,6 @@
</activation>
<build>
<plugins>
<plugin>
<!-- we run checkstyle only on Java 11, no need to run it for all JDK, it's just code style -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<!-- does not work without this dependency -->
<!-- does not work with this dependency on Java 8 -->
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.12.3</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down
2 changes: 1 addition & 1 deletion powertools-e2e-tests/handlers/batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>e2e-test-handler-batch</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion powertools-e2e-tests/handlers/idempotency/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>e2e-test-handler-idempotency</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion powertools-e2e-tests/handlers/largemessage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>e2e-test-handler-largemessage</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>e2e-test-handler-large-msg-idempotent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion powertools-e2e-tests/handlers/logging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>e2e-test-handler-logging</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions powertools-e2e-tests/handlers/metrics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

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

<dependencies>
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions powertools-e2e-tests/handlers/parameters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>e2e-test-handler-parameters</artifactId>
<packaging>jar</packaging>
<name>A Lambda function using powertools logging</name>
<name>A Lambda function using powertools parameters</name>

<dependencies>
<dependency>
Expand All @@ -19,7 +19,7 @@
</dependency>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-parameters</artifactId>
<artifactId>powertools-parameters-appconfig</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import software.amazon.lambda.powertools.logging.Logging;
import software.amazon.lambda.powertools.parameters.AppConfigProvider;
import software.amazon.lambda.powertools.parameters.ParamManager;
import software.amazon.lambda.powertools.parameters.appconfig.AppConfigProvider;

public class Function implements RequestHandler<Input, String> {

@Logging
public String handleRequest(Input input, Context context) {
AppConfigProvider provider = ParamManager.getAppConfigProvider(input.getEnvironment(), input.getApp());
AppConfigProvider provider = AppConfigProvider.builder()
.withApplication(input.getApp())
.withEnvironment(input.getEnvironment())
.build();

//(input.getEnvironment(), input.getApp());
return provider.get(input.getKey());

}
Expand Down
10 changes: 7 additions & 3 deletions powertools-e2e-tests/handlers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Handlers for End-to-End tests</name>
<description>Fake handlers that use Powertools for AWS Lambda (Java).</description>
Expand All @@ -27,12 +27,16 @@
</properties>

<modules>
<module>batch</module>
<module>largemessage</module>
<module>largemessage_idempotent</module>
<module>logging</module>
<module>tracing</module>
<module>metrics</module>
<module>idempotency</module>
<module>parameters</module>
<module>validation</module>
<module>validation-alb-event</module>
<module>validation-apigw-event</module>
</modules>

<dependencyManagement>
Expand Down Expand Up @@ -71,7 +75,7 @@
</dependency>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-parameters</artifactId>
<artifactId>powertools-parameters-appconfig</artifactId>
<version>${lambda.powertools.version}</version>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion powertools-e2e-tests/handlers/tracing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>e2e-test-handler-tracing</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion powertools-e2e-tests/handlers/validation-alb-event/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>e2e-test-handler-validation-alb-event</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>1.0.0</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>e2e-test-handler-validation-apigw-event</artifactId>
Expand Down
62 changes: 1 addition & 61 deletions powertools-parameters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,77 +28,17 @@

<name>Powertools for AWS Lambda (Java) library Parameters</name>

<description>
Set of utilities to retrieve parameters from Secrets Manager or SSM Parameter Store
</description>
<url>https://aws.amazon.com/lambda/</url>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/aws-powertools/powertools-lambda-java/issues</url>
</issueManagement>
<scm>
<url>https://github.com/aws-powertools/powertools-lambda-java.git</url>
</scm>
<developers>
<developer>
<name>Powertools for AWS Lambda team</name>
<organization>Amazon Web Services</organization>
<organizationUrl>https://aws.amazon.com/</organizationUrl>
</developer>
</developers>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://aws.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<description>Set of utilities to retrieve parameters - common interface</description>

<dependencies>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-common</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssm</artifactId>
<exclusions>
<exclusion>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
</exclusion>
<exclusion>
<groupId>software.amazon.awssdk</groupId>
<artifactId>netty-nio-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>secretsmanager</artifactId>
<exclusions>
<exclusion>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
</exclusion>
<exclusion>
<groupId>software.amazon.awssdk</groupId>
<artifactId>netty-nio-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>url-connection-client</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>dynamodb</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>appconfigdata</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Loading