-
Notifications
You must be signed in to change notification settings - Fork 239
Adding the CodePipelineEvent #363
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
smirnoal
merged 2 commits into
aws:events-v4-serialization-v2
from
msailes:codepipeline
Aug 11, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
156 changes: 156 additions & 0 deletions
156
...-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CodePipelineEvent.java
This file contains hidden or 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,156 @@ | ||
/* | ||
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
* the License. A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
package com.amazonaws.services.lambda.runtime.events; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
/** | ||
* Represents an CodePipeline event sent to Lambda. | ||
* See: <a href="https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html">Invoke an AWS Lambda function in a pipeline in CodePipeline</a> | ||
*/ | ||
@Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class CodePipelineEvent implements Serializable { | ||
private static final long serialVersionUID = -4828716548429210697L; | ||
|
||
@JsonProperty("CodePipeline.job") | ||
private Job codePipelineJob; | ||
|
||
@lombok.Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class Job implements Serializable { | ||
private static final long serialVersionUID = 2211711169692638977L; | ||
|
||
private String id; | ||
private String accountId; | ||
private Data data; | ||
} | ||
|
||
@lombok.Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class Data implements Serializable { | ||
private static final long serialVersionUID = 8786599041834868262L; | ||
|
||
private ActionConfiguration actionConfiguration; | ||
private List<Artifact> inputArtifacts; | ||
private List<Artifact> outputArtifacts; | ||
private ArtifactCredentials artifactCredentials; | ||
private String continuationToken; | ||
private EncryptionKey encryptionKey; | ||
} | ||
|
||
@lombok.Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class ActionConfiguration implements Serializable { | ||
private static final long serialVersionUID = -7285651174501621217L; | ||
|
||
private Configuration configuration; | ||
} | ||
|
||
@lombok.Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class Configuration implements Serializable { | ||
private static final long serialVersionUID = 580024317691702894L; | ||
|
||
@JsonProperty("FunctionName") | ||
private String functionName; | ||
@JsonProperty("UserParameters") | ||
private String userParameters; | ||
} | ||
|
||
@lombok.Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class Artifact implements Serializable { | ||
private static final long serialVersionUID = 6406621244704594358L; | ||
|
||
private String name; | ||
private String revision; | ||
private Location location; | ||
|
||
@JsonInclude | ||
public String getRevision() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added specific getter and setter for this attribute because Jackson was not including the attribute when it was attached to the parameter. @andclt suspected it might be a problem with Lombok and Jackson not working together. |
||
return revision; | ||
} | ||
|
||
@JsonInclude | ||
public void setRevision(String revision) { | ||
this.revision = revision; | ||
} | ||
} | ||
|
||
@lombok.Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class Location implements Serializable { | ||
private static final long serialVersionUID = 149382199413534713L; | ||
|
||
private String type; | ||
private S3Location s3Location; | ||
} | ||
|
||
@lombok.Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class S3Location implements Serializable { | ||
private static final long serialVersionUID = -8922449809993769709L; | ||
|
||
private String bucketName; | ||
private String objectKey; | ||
} | ||
|
||
@lombok.Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class ArtifactCredentials implements Serializable { | ||
private static final long serialVersionUID = 7710347495607396747L; | ||
|
||
private String accessKeyId; | ||
private String secretAccessKey; | ||
private String sessionToken; | ||
} | ||
|
||
@lombok.Data | ||
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class EncryptionKey implements Serializable { | ||
private static final long serialVersionUID = -9105569908901180610L; | ||
|
||
String id; | ||
String type; | ||
} | ||
} |
This file contains hidden or 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
38 changes: 38 additions & 0 deletions
38
aws-lambda-java-events/src/test/resources/event_models/code_pipeline_event.json
This file contains hidden or 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,38 @@ | ||
{ | ||
"CodePipeline.job": { | ||
"id": "11111111-abcd-1111-abcd-111111abcdef", | ||
"accountId": "111111111111", | ||
"data": { | ||
"actionConfiguration": { | ||
"configuration": { | ||
"FunctionName": "MyLambdaFunctionForAWSCodePipeline", | ||
"UserParameters": "some-input-such-as-a-URL" | ||
} | ||
}, | ||
"inputArtifacts": [ | ||
{ | ||
"location": { | ||
"s3Location": { | ||
"bucketName": "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", | ||
"objectKey": "the name of the application, for example CodePipelineDemoApplication.zip" | ||
}, | ||
"type": "S3" | ||
}, | ||
"revision": null, | ||
"name": "ArtifactName" | ||
} | ||
], | ||
"outputArtifacts": [], | ||
"artifactCredentials": { | ||
"secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", | ||
"sessionToken": "MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9wEXAMPLE=", | ||
"accessKeyId": "AKIAIOSFODNN7EXAMPLE" | ||
}, | ||
"continuationToken": "A continuation token if continuing job", | ||
"encryptionKey": { | ||
"id": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", | ||
"type": "KMS" | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or 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 hidden or 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
38 changes: 38 additions & 0 deletions
38
aws-lambda-java-tests/src/test/resources/codepipeline_event.json
This file contains hidden or 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,38 @@ | ||
{ | ||
"CodePipeline.job": { | ||
"id": "11111111-abcd-1111-abcd-111111abcdef", | ||
"accountId": "111111111111", | ||
"data": { | ||
"actionConfiguration": { | ||
"configuration": { | ||
"FunctionName": "MyLambdaFunctionForAWSCodePipeline", | ||
"UserParameters": "some-input-such-as-a-URL" | ||
} | ||
}, | ||
"inputArtifacts": [ | ||
{ | ||
"location": { | ||
"s3Location": { | ||
"bucketName": "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", | ||
"objectKey": "the name of the application, for example CodePipelineDemoApplication.zip" | ||
}, | ||
"type": "S3" | ||
}, | ||
"revision": null, | ||
"name": "ArtifactName" | ||
} | ||
], | ||
"outputArtifacts": [], | ||
"artifactCredentials": { | ||
"secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", | ||
"sessionToken": "MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9wEXAMPLE=", | ||
"accessKeyId": "AKIAIOSFODNN7EXAMPLE" | ||
}, | ||
"continuationToken": "A continuation token if continuing job", | ||
"encryptionKey": { | ||
"id": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", | ||
"type": "KMS" | ||
} | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fully qualified because there is a member variable named
data