-
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.
chore(deps): Update Java, Kotlin and AWS dependencies (#19)
- Loading branch information
1 parent
4021403
commit 8efe88a
Showing
10 changed files
with
82 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
Nexapp Libraries for Kotlin | ||
|
||
## Requirements | ||
* Java 8 | ||
* Java 11 | ||
* Maven 3.5+ | ||
* GNU Make | ||
|
||
|
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
5 changes: 2 additions & 3 deletions
5
nexapp-aws-lambda/src/main/kotlin/ca/nexapp/lambdas/contexts/env/LambdaEnvLoaderFactory.kt
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
38 changes: 21 additions & 17 deletions
38
nexapp-aws-lambda/src/test/kotlin/ca/nexapp/lambdas/contexts/env/SsmPathExtension.kt
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 |
---|---|---|
@@ -1,38 +1,42 @@ | ||
package ca.nexapp.lambdas.contexts.env | ||
|
||
import com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClientBuilder | ||
import com.amazonaws.services.simplesystemsmanagement.model.DeleteParametersRequest | ||
import com.amazonaws.services.simplesystemsmanagement.model.GetParametersByPathRequest | ||
import com.amazonaws.services.simplesystemsmanagement.model.ParameterType | ||
import com.amazonaws.services.simplesystemsmanagement.model.PutParameterRequest | ||
import org.junit.jupiter.api.extension.AfterAllCallback | ||
import org.junit.jupiter.api.extension.ExtensionContext | ||
import software.amazon.awssdk.services.ssm.SsmClient | ||
import software.amazon.awssdk.services.ssm.model.DeleteParametersRequest | ||
import software.amazon.awssdk.services.ssm.model.GetParametersByPathRequest | ||
import software.amazon.awssdk.services.ssm.model.ParameterType | ||
import software.amazon.awssdk.services.ssm.model.PutParameterRequest | ||
import java.util.UUID | ||
|
||
class SsmPathExtension : AfterAllCallback { | ||
|
||
val ssm = AWSSimpleSystemsManagementClientBuilder.defaultClient()!! | ||
val ssm: SsmClient = SsmClient.create() | ||
val ssmPath by lazy { "/lambda4j-test-${UUID.randomUUID()}" } | ||
|
||
fun add(name: String, value: String, encrypted: Boolean = false) { | ||
with(PutParameterRequest().withName("$ssmPath/$name").withValue(value)) { | ||
type = when (encrypted) { | ||
true -> ParameterType.SecureString.toString() | ||
false -> ParameterType.String.toString() | ||
} | ||
|
||
ssm.putParameter(this) | ||
} | ||
PutParameterRequest | ||
.builder() | ||
.name("$ssmPath/$name") | ||
.value(value) | ||
.type(if (encrypted) ParameterType.SECURE_STRING else ParameterType.STRING) | ||
.build() | ||
.also { ssm.putParameter(it) } | ||
} | ||
|
||
override fun afterAll(ctx: ExtensionContext?) { | ||
val parameters = ssm.getParametersByPath(GetParametersByPathRequest().withPath(ssmPath)) | ||
.parameters.map { p -> p.name } | ||
val parameters = GetParametersByPathRequest | ||
.builder() | ||
.path(ssmPath) | ||
.build() | ||
.let { ssm.getParametersByPath(it) } | ||
.parameters() | ||
.map { p -> p.name() } | ||
|
||
if (parameters.isEmpty()) { | ||
return | ||
} | ||
|
||
ssm.deleteParameters(DeleteParametersRequest().withNames(parameters)) | ||
ssm.deleteParameters(DeleteParametersRequest.builder().names(parameters).build()) | ||
} | ||
} |
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