Skip to content

Commit

Permalink
feat: add resourcePath and representation from AdminEvent (#19)
Browse files Browse the repository at this point in the history
* Add resourcePath and representation from AdminEvent
* remove PROVIDER_ID change
  • Loading branch information
valid-var authored Feb 20, 2024
1 parent 6504a2c commit dad9821
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions openapi/webhook.open-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ components:
type: string
details:
additionalProperties: true
resourcePath:
type: string
representation:
type: string
required:
- type
- realmId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class WebhookEventListenerProvider(
event.ipAddress,
event.type.toString(),
event.error,
event.details
event.details,
null,
null
)

override fun onEvent(event: AdminEvent, includeRepresentation: Boolean) = send(
Expand All @@ -42,6 +44,8 @@ class WebhookEventListenerProvider(
"${event.resourceType}-${event.operationType}",
event.error,
null,
event.resourcePath,
event.representation
)

private fun send(
Expand All @@ -53,7 +57,9 @@ class WebhookEventListenerProvider(
ipAddress: String?,
type: String,
error: String?,
details: Map<String, Any>?
details: Map<String, Any>?,
resourcePath: String?,
representation: String?,
) {
if (takeList != null && type !in takeList) {
LOG.debug("Event {} not in the taken list. Will be skipped ({}).", type, takeList)
Expand All @@ -70,6 +76,8 @@ class WebhookEventListenerProvider(
type = type,
details = details,
error = error,
resourcePath = resourcePath,
representation = representation
)

handlers?.forEach {
Expand Down

0 comments on commit dad9821

Please sign in to comment.