Created
October 26, 2021 18:59
-
-
Save flochaz/f3fb3ee38c2b28963d89115eec9317fe to your computer and use it in GitHub Desktop.
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
new AwsCustomResource(this, "trigger", AwsCustomResourceProps.builder() | |
.logRetention(options.logRetention != null ? options.logRetention : RetentionDays.ONE_DAY) | |
.onUpdate(AwsSdkCall.builder() | |
.service("Lambda") | |
.action("invoke") | |
.physicalResourceId(PhysicalResourceId.of("flywayTrigger")) | |
.parameters(Map.of( | |
"FunctionName", flywayServiceLambda.getFunctionName(), | |
"InvocationType", "RequestResponse", | |
"Payload", "{" + | |
"\"flywayRequest\":{\"flywayMethod\": \"migrate\"}," + | |
" \"assetHash\": \"" + ((Asset) migrationFilesDeployment.getNode().findChild("Asset1")).getAssetHash()+ "\"}" | |
)).build()) | |
.policy(AwsCustomResourcePolicy.fromStatements(List.of(PolicyStatement.Builder.create() | |
.actions(List.of("lambda:InvokeFunction")) | |
.resources(List.of(flywayServiceLambda.getFunctionArn())) | |
.build()))) | |
.build()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment