|
| 1 | +/* |
| 2 | + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with |
| 5 | + * the License. A copy of the License is located at |
| 6 | + * |
| 7 | + * http://aws.amazon.com/apache2.0 |
| 8 | + * |
| 9 | + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 10 | + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions |
| 11 | + * and limitations under the License. |
| 12 | + */ |
| 13 | + |
| 14 | +package com.amazonaws.services.lambda.runtime.events; |
| 15 | + |
| 16 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 17 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 18 | +import lombok.AllArgsConstructor; |
| 19 | +import lombok.Builder; |
| 20 | +import lombok.Data; |
| 21 | +import lombok.NoArgsConstructor; |
| 22 | + |
| 23 | +import java.io.Serializable; |
| 24 | +import java.util.List; |
| 25 | + |
| 26 | +/** |
| 27 | + * Represents an CodePipeline event sent to Lambda. |
| 28 | + * 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> |
| 29 | + */ |
| 30 | +@Data |
| 31 | +@Builder(setterPrefix = "with") |
| 32 | +@NoArgsConstructor |
| 33 | +@AllArgsConstructor |
| 34 | +public class CodePipelineEvent implements Serializable { |
| 35 | + private static final long serialVersionUID = -4828716548429210697L; |
| 36 | + |
| 37 | + @JsonProperty("CodePipeline.job") |
| 38 | + private Job codePipelineJob; |
| 39 | + |
| 40 | + @lombok.Data |
| 41 | + @Builder(setterPrefix = "with") |
| 42 | + @NoArgsConstructor |
| 43 | + @AllArgsConstructor |
| 44 | + public static class Job implements Serializable { |
| 45 | + private static final long serialVersionUID = 2211711169692638977L; |
| 46 | + |
| 47 | + private String id; |
| 48 | + private String accountId; |
| 49 | + private Data data; |
| 50 | + } |
| 51 | + |
| 52 | + @lombok.Data |
| 53 | + @Builder(setterPrefix = "with") |
| 54 | + @NoArgsConstructor |
| 55 | + @AllArgsConstructor |
| 56 | + public static class Data implements Serializable { |
| 57 | + private static final long serialVersionUID = 8786599041834868262L; |
| 58 | + |
| 59 | + private ActionConfiguration actionConfiguration; |
| 60 | + private List<Artifact> inputArtifacts; |
| 61 | + private List<Artifact> outputArtifacts; |
| 62 | + private ArtifactCredentials artifactCredentials; |
| 63 | + private String continuationToken; |
| 64 | + private EncryptionKey encryptionKey; |
| 65 | + } |
| 66 | + |
| 67 | + @lombok.Data |
| 68 | + @Builder(setterPrefix = "with") |
| 69 | + @NoArgsConstructor |
| 70 | + @AllArgsConstructor |
| 71 | + public static class ActionConfiguration implements Serializable { |
| 72 | + private static final long serialVersionUID = -7285651174501621217L; |
| 73 | + |
| 74 | + private Configuration configuration; |
| 75 | + } |
| 76 | + |
| 77 | + @lombok.Data |
| 78 | + @Builder(setterPrefix = "with") |
| 79 | + @NoArgsConstructor |
| 80 | + @AllArgsConstructor |
| 81 | + public static class Configuration implements Serializable { |
| 82 | + private static final long serialVersionUID = 580024317691702894L; |
| 83 | + |
| 84 | + @JsonProperty("FunctionName") |
| 85 | + private String functionName; |
| 86 | + @JsonProperty("UserParameters") |
| 87 | + private String userParameters; |
| 88 | + } |
| 89 | + |
| 90 | + @lombok.Data |
| 91 | + @Builder(setterPrefix = "with") |
| 92 | + @NoArgsConstructor |
| 93 | + @AllArgsConstructor |
| 94 | + public static class Artifact implements Serializable { |
| 95 | + private static final long serialVersionUID = 6406621244704594358L; |
| 96 | + |
| 97 | + private String name; |
| 98 | + private String revision; |
| 99 | + private Location location; |
| 100 | + |
| 101 | + @JsonInclude |
| 102 | + public String getRevision() { |
| 103 | + return revision; |
| 104 | + } |
| 105 | + |
| 106 | + @JsonInclude |
| 107 | + public void setRevision(String revision) { |
| 108 | + this.revision = revision; |
| 109 | + } |
| 110 | + } |
| 111 | + |
| 112 | + @lombok.Data |
| 113 | + @Builder(setterPrefix = "with") |
| 114 | + @NoArgsConstructor |
| 115 | + @AllArgsConstructor |
| 116 | + public static class Location implements Serializable { |
| 117 | + private static final long serialVersionUID = 149382199413534713L; |
| 118 | + |
| 119 | + private String type; |
| 120 | + private S3Location s3Location; |
| 121 | + } |
| 122 | + |
| 123 | + @lombok.Data |
| 124 | + @Builder(setterPrefix = "with") |
| 125 | + @NoArgsConstructor |
| 126 | + @AllArgsConstructor |
| 127 | + public static class S3Location implements Serializable { |
| 128 | + private static final long serialVersionUID = -8922449809993769709L; |
| 129 | + |
| 130 | + private String bucketName; |
| 131 | + private String objectKey; |
| 132 | + } |
| 133 | + |
| 134 | + @lombok.Data |
| 135 | + @Builder(setterPrefix = "with") |
| 136 | + @NoArgsConstructor |
| 137 | + @AllArgsConstructor |
| 138 | + public static class ArtifactCredentials implements Serializable { |
| 139 | + private static final long serialVersionUID = 7710347495607396747L; |
| 140 | + |
| 141 | + private String accessKeyId; |
| 142 | + private String secretAccessKey; |
| 143 | + private String sessionToken; |
| 144 | + } |
| 145 | + |
| 146 | + @lombok.Data |
| 147 | + @Builder(setterPrefix = "with") |
| 148 | + @NoArgsConstructor |
| 149 | + @AllArgsConstructor |
| 150 | + public static class EncryptionKey implements Serializable { |
| 151 | + private static final long serialVersionUID = -9105569908901180610L; |
| 152 | + |
| 153 | + String id; |
| 154 | + String type; |
| 155 | + } |
| 156 | +} |
0 commit comments