adutra commented on code in PR #2836:
URL: https://github.com/apache/polaris/pull/2836#discussion_r2448136669
##########
runtime/service/src/main/java/org/apache/polaris/service/events/jsonEventListener/aws/cloudwatch/AwsCloudWatchEventListener.java:
##########
@@ -151,28 +158,44 @@ void shutdown() {
}
}
+ @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
+ public record CloudWatchEvent(
+ String principal,
+ String realmId,
+ Collection<String> activatedRoles,
+ String eventType,
+ @JsonUnwrapped PolarisEvent event // flatten
+ ) {}
+
@Override
- protected void transformAndSendEvent(HashMap<String, Object> properties) {
- properties.put("realm_id",
callContext.getRealmContext().getRealmIdentifier());
- properties.put("principal", securityContext.getUserPrincipal().getName());
- properties.put(
- "activated_roles", ((PolarisPrincipal)
securityContext.getUserPrincipal()).getRoles());
- // TODO: Add request ID when it is available
+ protected void
transformAndSendEvent(IcebergRestCatalogEvents.AfterRefreshTableEvent event) {
Review Comment:
As said above, this class _must_ handle all event types, or determine the
event types to handle via configuration.
For example, we could introduce the following configuration option:
```properties
polaris.event-listener.aws-cloudwatch.event-types=\
org.apache.polaris.service.events.IcebergRestCatalogEvents.AfterRefreshTableEvent,\
org.apache.polaris.service.events.IcebergRestCatalogEvents.AfterCommitTableEvent
```
I would be in favor of doing this change in this PR since it this class has
the same shortcomings as `PropertyMapEventListener`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]