Problem/Motivation
Create a WebhookManager service in the submodule.
It should handle the webhook lifecycle in one place:
- register
- deregister
- sync
- ping
- rotate
This avoids duplicating logic across hooks, the admin UI, and Drush.
As a developer, I want a WebhookManager service in the submodule.
The service should centralize all DAM webhook orchestration.
Acceptance criteria
- registerAll(bool $force = FALSE): array
- Registers per event type.
- Skips stored IDs unless $force is TRUE.
- Stores IDs in acquia_dam_webhooks.webhook_ids State key.
- deregisterAll(): void
- Performs a best-effort DELETE for each stored ID.
- Deletes acquia_dam_webhooks.webhook_ids and all acquia_dam_webhooks.webhook_secret.* State keys.
- syncFromDam(): array
- Reconciles stored IDs with listWebhooks() response.
- Re-registers missing webhooks.
- Returns ['ok', 'repaired', 'failed'].
- pingAll(): array
- Returns [event_type => bool].
- getOrCreateSecret(string $event_type): string
- Generates bin2hex(random_bytes(32)).
- Stores the secret in State.
- rotateAndReregister(): void
- Clears secrets and IDs.
- Calls registerAll().
- getDeliveryUrl(): string
- Uses Url::fromRoute('acquia_dam_webhooks.webhook_receiver', [], ['absolute' => TRUE]).
- getStoredWebhookIds(): array
- Reads State.
- Service registration
- Service must be registered as acquia_dam_webhooks.webhook_manager.
- Constructor injects AcquiaDamWebhookClient, not AcquiaDamClientFactory directly.
- All DAM webhook API calls must route through acquia_dam_webhooks.api_client.
Issue fork acquia_dam-3611279
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
rajeshreeputraRequesting review.
Comment #5
rajeshreeputraMR merged!