Package dev.dokimos.server.service
Class AlertWebhookService
java.lang.Object
dev.dokimos.server.service.AlertWebhookService
Manages a project's regression-alert webhooks. Responses never carry the signing secret; only
whether one is configured is exposed. All operations are scoped to a project so a webhook can only
be read or mutated through its owning project.
-
Constructor Summary
ConstructorsConstructorDescriptionAlertWebhookService(AlertWebhookRepository webhookRepository, ProjectRepository projectRepository) -
Method Summary
Modifier and TypeMethodDescriptioncreate(UUID projectId, CreateAlertWebhookRequest request) Registers a webhook for a project.voidDeletes one of a project's webhooks.Returns one of a project's webhooks.Lists a project's webhooks in creation order.update(UUID projectId, UUID webhookId, UpdateAlertWebhookRequest request) Replaces a webhook's url and enabled flag, and optionally its secret.
-
Constructor Details
-
AlertWebhookService
public AlertWebhookService(AlertWebhookRepository webhookRepository, ProjectRepository projectRepository)
-
-
Method Details
-
create
Registers a webhook for a project.- Parameters:
projectId- the project to attach the webhook torequest- the webhook definition- Returns:
- the public view of the saved webhook
- Throws:
IllegalArgumentException- if the project does not exist (mapped to 404)
-
list
Lists a project's webhooks in creation order.- Throws:
IllegalArgumentException- if the project does not exist (mapped to 404)
-
get
Returns one of a project's webhooks.- Throws:
IllegalArgumentException- if the project or webhook does not exist, or the webhook belongs to another project (mapped to 404)
-
update
@Transactional public AlertWebhookView update(UUID projectId, UUID webhookId, UpdateAlertWebhookRequest request) Replaces a webhook's url and enabled flag, and optionally its secret. A blank secret keeps the existing secret so a receiver never loses a configured secret by accident.- Throws:
IllegalArgumentException- if the project or webhook does not exist, or the webhook belongs to another project (mapped to 404)
-
delete
Deletes one of a project's webhooks.- Throws:
IllegalArgumentException- if the project or webhook does not exist, or the webhook belongs to another project (mapped to 404)
-