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, and every load is tenant-scoped so a cross-tenant id
surfaces as a 404.
-
Constructor Summary
ConstructorsConstructorDescriptionAlertWebhookService(AlertWebhookRepository webhookRepository, ProjectRepository projectRepository) -
Method Summary
Modifier and TypeMethodDescriptioncreate(UUID projectId, CreateAlertWebhookRequest request, TenantScope scope) Registers a webhook for a project, stamped with the project's tenant.voiddelete(UUID projectId, UUID webhookId, TenantScope scope) Deletes one of a project's webhooks.get(UUID projectId, UUID webhookId, TenantScope scope) Returns one of a project's webhooks.list(UUID projectId, TenantScope scope) Lists a project's webhooks in creation order.update(UUID projectId, UUID webhookId, UpdateAlertWebhookRequest request, TenantScope scope) Replaces a webhook's url and enabled flag, and optionally its secret.
-
Constructor Details
-
AlertWebhookService
public AlertWebhookService(AlertWebhookRepository webhookRepository, ProjectRepository projectRepository)
-
-
Method Details
-
create
@Transactional public AlertWebhookView create(UUID projectId, CreateAlertWebhookRequest request, TenantScope scope) Registers a webhook for a project, stamped with the project's tenant.- Parameters:
projectId- the project to attach the webhook torequest- the webhook definitionscope- the tenant scope of the caller- Returns:
- the public view of the saved webhook
- Throws:
IllegalArgumentException- if the project does not exist under the scope (mapped to 404)
-
list
Lists a project's webhooks in creation order.- Throws:
IllegalArgumentException- if the project does not exist under the scope (mapped to 404)
-
get
@Transactional(readOnly=true) public AlertWebhookView get(UUID projectId, UUID webhookId, TenantScope scope) Returns one of a project's webhooks.- Throws:
IllegalArgumentException- if the project or webhook does not exist under the scope, or the webhook belongs to another project (mapped to 404)
-
update
@Transactional public AlertWebhookView update(UUID projectId, UUID webhookId, UpdateAlertWebhookRequest request, TenantScope scope) 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 under the scope, 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 under the scope, or the webhook belongs to another project (mapped to 404)
-