This repository has been archived by the owner on Jan 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec128fc
commit d67e61b
Showing
31 changed files
with
1,664 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
# This file is part of the pl.wrzasq.lambda. | ||
# | ||
# @license http://mit-license.org/ The MIT license | ||
# @copyright 2019 © by Rafał Wrzeszcz - Wrzasq.pl. | ||
--> | ||
<project | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation=" | ||
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd | ||
"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<!-- core project settings --> | ||
<artifactId>lambda-macro-lambda-function</artifactId> | ||
<packaging>jar</packaging> | ||
<parent> | ||
<groupId>pl.wrzasq.lambda</groupId> | ||
<artifactId>lambda-macro</artifactId> | ||
<version>1.0.36-SNAPSHOT</version> | ||
<relativePath>../</relativePath> | ||
</parent> | ||
|
||
<!-- project meta info --> | ||
<name>WrzasqPl CloudFormation Lambda function macro</name> | ||
<url>https://rafalwrzeszcz-wrzasqpl.github.io/pl.wrzasq.lambda/lambda-macro/lambda-macro-lambda-function/</url> | ||
<description>Macro for generating enhanced Lambda function setup.</description> | ||
<inceptionYear>2019</inceptionYear> | ||
|
||
<!-- plugins configuration --> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<configuration> | ||
<usedDependencies> | ||
<usedDependency>com.amazonaws:aws-xray-recorder-sdk-aws-sdk</usedDependency> | ||
<usedDependency>com.amazonaws:aws-xray-recorder-sdk-aws-sdk-instrumentor</usedDependency> | ||
<usedDependency>io.symphonia:lambda-logging</usedDependency> | ||
</usedDependencies> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<!-- project dependencies --> | ||
<dependencies> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>lambda-json</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.amazonaws</groupId> | ||
<artifactId>aws-lambda-java-core</artifactId> | ||
<version>1.2.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.amazonaws</groupId> | ||
<artifactId>aws-xray-recorder-sdk-aws-sdk</artifactId> | ||
<version>2.2.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.amazonaws</groupId> | ||
<artifactId>aws-xray-recorder-sdk-aws-sdk-instrumentor</artifactId> | ||
<version>2.2.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
<version>2.10.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
<version>2.10.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.10.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.symphonia</groupId> | ||
<artifactId>lambda-logging</artifactId> | ||
<version>1.0.3</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.26</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
8 changes: 8 additions & 0 deletions
8
lambda-macro/lambda-macro-lambda-function/src/main/checkstyle/java.header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
^/\*$ | ||
^ \* This file is part of the pl\.wrzasq\.lambda\.$ | ||
^ \*$ | ||
^ \* @license http://mit-license\.org/ The MIT license$ | ||
^ \* @copyright \d{4}[0-9, -]* © by Rafał Wrzeszcz - Wrzasq\.pl\.$ | ||
^ \*/$ | ||
|
||
^package pl\.wrzasq\.lambda\.macro\.lambda\.function(\..+)?;$ |
48 changes: 48 additions & 0 deletions
48
...a-macro-lambda-function/src/main/java/pl/wrzasq/lambda/macro/lambda/function/Handler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* This file is part of the pl.wrzasq.lambda. | ||
* | ||
* @license http://mit-license.org/ The MIT license | ||
* @copyright 2019 © by Rafał Wrzeszcz - Wrzasq.pl. | ||
*/ | ||
|
||
package pl.wrzasq.lambda.macro.lambda.function; | ||
|
||
import java.util.Map; | ||
import java.util.function.Function; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
import com.amazonaws.services.lambda.runtime.RequestHandler; | ||
import pl.wrzasq.lambda.macro.lambda.function.model.CloudFormationMacroRequest; | ||
import pl.wrzasq.lambda.macro.lambda.function.model.CloudFormationMacroResponse; | ||
import pl.wrzasq.lambda.macro.lambda.function.template.ProcessedTemplate; | ||
|
||
/** | ||
* CloudFormation macro handler. | ||
* | ||
* <p>Recommended memory: 256MB.</p> | ||
*/ | ||
public class Handler implements RequestHandler<CloudFormationMacroRequest, CloudFormationMacroResponse> { | ||
/** | ||
* CloudFormation template provider. | ||
*/ | ||
private Function<Map<String, Object>, ProcessedTemplate> templateFactory; | ||
|
||
/** | ||
* Default constructor. | ||
*/ | ||
public Handler() { | ||
this.templateFactory = ProcessedTemplate::new; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public CloudFormationMacroResponse handleRequest(CloudFormationMacroRequest event, Context context) { | ||
return new CloudFormationMacroResponse( | ||
event.getRequestId(), | ||
CloudFormationMacroResponse.STATUS_SUCCESS, | ||
this.templateFactory.apply(event.getFragment()).getTemplate() | ||
); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...rc/main/java/pl/wrzasq/lambda/macro/lambda/function/model/CloudFormationMacroRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* This file is part of the pl.wrzasq.lambda. | ||
* | ||
* @license http://mit-license.org/ The MIT license | ||
* @copyright 2019 © by Rafał Wrzeszcz - Wrzasq.pl. | ||
*/ | ||
|
||
package pl.wrzasq.lambda.macro.lambda.function.model; | ||
|
||
import java.util.Map; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
/** | ||
* CloudFormation event request structure. | ||
*/ | ||
@AllArgsConstructor | ||
@Data | ||
public class CloudFormationMacroRequest { | ||
/** | ||
* Request ID. | ||
*/ | ||
private String requestId; | ||
|
||
/** | ||
* Template fragment. | ||
*/ | ||
private Map<String, Object> fragment; | ||
} |
40 changes: 40 additions & 0 deletions
40
...c/main/java/pl/wrzasq/lambda/macro/lambda/function/model/CloudFormationMacroResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* This file is part of the pl.wrzasq.lambda. | ||
* | ||
* @license http://mit-license.org/ The MIT license | ||
* @copyright 2019 © by Rafał Wrzeszcz - Wrzasq.pl. | ||
*/ | ||
|
||
package pl.wrzasq.lambda.macro.lambda.function.model; | ||
|
||
import java.util.Map; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
/** | ||
* CloudFormation event response structure. | ||
*/ | ||
@AllArgsConstructor | ||
@Data | ||
public class CloudFormationMacroResponse { | ||
/** | ||
* OK status. | ||
*/ | ||
public static final String STATUS_SUCCESS = "SUCCESS"; | ||
|
||
/** | ||
* Request ID. | ||
*/ | ||
private String requestId; | ||
|
||
/** | ||
* Operation status. | ||
*/ | ||
private String status; | ||
|
||
/** | ||
* Template fragment. | ||
*/ | ||
private Map<String, Object> fragment; | ||
} |
Oops, something went wrong.