Skip to content

Commit 1b0383b

Browse files
committed
Renaming some modules
1 parent f35e292 commit 1b0383b

File tree

11 files changed

+65
-103
lines changed

11 files changed

+65
-103
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ jobs:
5151
path: ~/.m2
5252
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
5353
restore-keys: ${{ runner.os }}-m2
54+
- name: maven-settings-xml-action
55+
uses: whelk-io/maven-settings-xml-action@v22
56+
with:
57+
servers: '[{ "id": "github", "password": "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" }]'
5458
- name: Build with Maven
5559
env:
5660
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
<!--- Please include the following in your Pull Request when applicable: -->
99

10-
- [ ] Describe what you did in the pull request description
10+
- [ ] Describe what you did in the pull secret description
1111
- [ ] Add Unit and Integration Tests - at least 80% unit tests for new code.
1212
- [ ] Added or updated documentation

pom.xml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484

8585
<dependencyManagement>
8686
<dependencies>
87-
8887
<dependency>
8988
<groupId>io.awspring.cloud</groupId>
9089
<artifactId>spring-cloud-aws-dependencies</artifactId>
@@ -108,14 +107,8 @@
108107
<!-- SPRING-NATIVE-AWS-LAMBDA ENDS -->
109108

110109
<dependency>
111-
<groupId>com.coffeebeans</groupId>
112-
<artifactId>coffeebeans-cdk-core</artifactId>
113-
<version>1.0-SNAPSHOT</version>
114-
</dependency>
115-
116-
<dependency>
117-
<groupId>com.coffeebeans</groupId>
118-
<artifactId>coffeebeans-cdk-assertions</artifactId>
110+
<groupId>io.sandpipers</groupId>
111+
<artifactId>sandpipers-cdk-bom</artifactId>
119112
<version>1.0-SNAPSHOT</version>
120113
</dependency>
121114

@@ -298,16 +291,6 @@
298291
</plugins>
299292
</build>
300293

301-
<repositories>
302-
<repository>
303-
<id>github</id>
304-
<url>https://public:&#48;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@maven.pkg.github.com/muhamadto/*</url>
305-
<snapshots>
306-
<enabled>true</enabled>
307-
</snapshots>
308-
</repository>
309-
</repositories>
310-
311294
<licenses>
312295
<license>
313296
<name>Apache License, Version 2.0</name>

spring-native-aws-service-infra/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
<!-- AWS CDK ENDS -->
5757

5858
<dependency>
59-
<groupId>com.coffeebeans</groupId>
60-
<artifactId>coffeebeans-cdk-core</artifactId>
59+
<groupId>io.sandpipers</groupId>
60+
<artifactId>sandpipers-cdk-core</artifactId>
6161
</dependency>
6262

6363
<!-- UTILS -->
@@ -99,8 +99,8 @@
9999

100100
<!-- TEST -->
101101
<dependency>
102-
<groupId>com.coffeebeans</groupId>
103-
<artifactId>coffeebeans-cdk-assertions</artifactId>
102+
<groupId>io.sandpipers</groupId>
103+
<artifactId>sandpipers-cdk-assertions</artifactId>
104104
<scope>test</scope>
105105
</dependency>
106106

spring-native-aws-service/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@
166166
<plugin>
167167
<groupId>org.graalvm.buildtools</groupId>
168168
<artifactId>native-maven-plugin</artifactId>
169-
<version>0.10.1</version>
170169
<configuration>
171170
<mainClass>com.coffeebeans.springnativeawslambda.Application</mainClass>
172171
<buildArgs combine.children="append">

spring-native-aws-service/src/main/java/com/coffeebeans/springnativeawslambda/ReflectionRuntimeHints.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,24 @@
1818

1919
package com.coffeebeans.springnativeawslambda;
2020

21-
import com.coffeebeans.springnativeawslambda.entity.Secret;
22-
import com.coffeebeans.springnativeawslambda.repository.SecretRepository;
23-
import io.awspring.cloud.dynamodb.DynamoDbTemplate;
2421
import java.util.List;
2522
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
2623
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
27-
import com.coffeebeans.springnativeawslambda.model.Request;
28-
import com.coffeebeans.springnativeawslambda.model.Response;
29-
import java.util.Map;
24+
import com.coffeebeans.springnativeawslambda.model.Secret;
3025
import org.joda.time.DateTime;
3126
import org.springframework.aot.hint.MemberCategory;
3227
import org.springframework.aot.hint.RuntimeHints;
3328
import org.springframework.aot.hint.RuntimeHintsRegistrar;
3429
import org.springframework.aot.hint.TypeReference;
3530
import org.springframework.lang.Nullable;
36-
import software.amazon.awssdk.enhanced.dynamodb.DefaultAttributeConverterProvider;
37-
import software.amazon.awssdk.enhanced.dynamodb.TableSchema;
38-
import software.amazon.awssdk.enhanced.dynamodb.internal.mapper.BeanTableSchemaAttributeTags;
39-
import software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema;
4031

4132
public class ReflectionRuntimeHints implements RuntimeHintsRegistrar {
4233

4334
@Override
4435
public void registerHints(final RuntimeHints hints, @Nullable final ClassLoader classLoader) {
4536
final List<TypeReference> typeReferences = List.of(
4637
TypeReference.of(DateTime.class),
47-
TypeReference.of(Response.class),
48-
TypeReference.of(Request.class),
38+
TypeReference.of(Secret.class),
4939
TypeReference.of(APIGatewayProxyResponseEvent.class),
5040
TypeReference.of(APIGatewayProxyRequestEvent.class),
5141
TypeReference.of(APIGatewayProxyRequestEvent.ProxyRequestContext.class)

spring-native-aws-service/src/main/java/com/coffeebeans/springnativeawslambda/entity/Secret.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66
import lombok.Builder;
77
import lombok.Data;
88
import lombok.NoArgsConstructor;
9-
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
10-
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbPartitionKey;
119

1210
@Data
1311
@Builder
1412
@NoArgsConstructor
1513
@AllArgsConstructor
16-
@DynamoDbBean
1714
public class Secret implements Serializable {
1815

1916
private String env;
@@ -24,11 +21,22 @@ public class Secret implements Serializable {
2421

2522
private String partitionKey;
2623

27-
private Map<String, String> variables;
24+
private Map<String, String> items;
2825

29-
@DynamoDbPartitionKey
3026
public String getPartitionKey() {
3127
return env + costCentre + applicationName;
3228
}
3329

30+
public static Secret of(final com.coffeebeans.springnativeawslambda.model.Secret secretModel) {
31+
final String env = secretModel.getEnv();
32+
final String costCentre = secretModel.getCostCentre();
33+
final String applicationName = secretModel.getApplicationName();
34+
return Secret.builder()
35+
.env(env)
36+
.costCentre(costCentre)
37+
.applicationName(applicationName)
38+
.items(secretModel.getItems())
39+
.partitionKey(secretModel.getId())
40+
.build();
41+
}
3442
}

spring-native-aws-service/src/main/java/com/coffeebeans/springnativeawslambda/function/ExampleFunction.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020

2121
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
2222
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
23-
import com.coffeebeans.springnativeawslambda.entity.Secret;
24-
import com.coffeebeans.springnativeawslambda.model.Request;
25-
import com.coffeebeans.springnativeawslambda.model.Response;
23+
import com.coffeebeans.springnativeawslambda.model.Secret;
2624
import com.coffeebeans.springnativeawslambda.repository.SecretRepository;
2725
import com.fasterxml.jackson.core.JsonProcessingException;
2826
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -31,7 +29,6 @@
3129
import java.util.function.Function;
3230
import lombok.SneakyThrows;
3331
import lombok.extern.slf4j.Slf4j;
34-
import org.springframework.http.MediaType;
3532
import org.springframework.stereotype.Component;
3633
import org.springframework.validation.annotation.Validated;
3734

@@ -66,24 +63,14 @@ public ExampleFunction(
6663
public APIGatewayProxyResponseEvent apply(final APIGatewayProxyRequestEvent proxyRequestEvent) {
6764
log.info("Converting request into a response...'");
6865

69-
final Request request = objectMapper.readValue(proxyRequestEvent.getBody(), Request.class);
66+
final Secret secret = objectMapper.readValue(proxyRequestEvent.getBody(), Secret.class);
7067

71-
final Response response = Response.builder()
72-
.name(request.getName())
73-
.saved(true)
74-
.build();
75-
76-
this.secretRepository.save(Secret.builder()
77-
.env("dev")
78-
.costCentre("coffeebeans")
79-
.applicationName("native-lambda")
80-
.variables(Map.of("ENV", "dev", "PASSWORD", "changeit"))
81-
.build());
68+
this.secretRepository.save(com.coffeebeans.springnativeawslambda.entity.Secret.of(secret));
8269

8370
log.info("Converted request into a response.");
8471

8572
return new APIGatewayProxyResponseEvent()
8673
.withStatusCode(200)
87-
.withBody(objectMapper.writeValueAsString(response));
74+
.withBody(objectMapper.writeValueAsString(secret));
8875
}
8976
}

spring-native-aws-service/src/main/java/com/coffeebeans/springnativeawslambda/model/Request.java

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
import com.fasterxml.jackson.annotation.JsonProperty;
2222
import com.fasterxml.jackson.annotation.JsonProperty.Access;
2323
import jakarta.validation.constraints.NotBlank;
24-
import jakarta.validation.constraints.NotNull;
24+
import jakarta.validation.constraints.NotEmpty;
25+
import java.util.Map;
2526
import lombok.AllArgsConstructor;
2627
import lombok.Builder;
2728
import lombok.Data;
@@ -31,13 +32,25 @@
3132
@Builder
3233
@NoArgsConstructor
3334
@AllArgsConstructor
34-
public class Response {
35-
35+
public class Secret {
3636
@NotBlank
3737
@JsonProperty(access = Access.READ_ONLY)
38-
private String name;
38+
private String id;
39+
40+
@NotBlank
41+
private String env;
42+
43+
@NotBlank
44+
private String costCentre;
45+
46+
@NotBlank
47+
private String applicationName;
48+
49+
@NotEmpty
50+
private Map<String, String> items;
51+
52+
public String getId() {
53+
return "%s-%s-%s".formatted(env, costCentre, applicationName).toLowerCase().replaceAll("[^a-zA-Z0-9]", "");
54+
}
3955

40-
@NotNull
41-
@JsonProperty(access = Access.READ_ONLY)
42-
private boolean saved;
4356
}

0 commit comments

Comments
 (0)