< Summary

Information
Class: Elsa.Secrets.Endpoints.Secrets.Rotate.Endpoint
Assembly: Elsa.Secrets
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Secrets/Endpoints/Secrets/Rotate/Endpoint.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 32
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
Configure()100%210%
HandleAsync()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Secrets/Endpoints/Secrets/Rotate/Endpoint.cs

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Secrets.Permissions;
 3using Elsa.Secrets.Services;
 4
 5namespace Elsa.Secrets.Endpoints.Secrets.Rotate;
 6
 07internal class Endpoint(ISecretManager manager) : ElsaEndpoint<RotateSecretRequest, SecretModel>
 8{
 9    public override void Configure()
 10    {
 011        Post("/secrets/{name}/rotate");
 012        ConfigurePermissions(SecretsPermissions.Write);
 013    }
 14
 15    public override async Task HandleAsync(RotateSecretRequest request, CancellationToken cancellationToken)
 16    {
 17        try
 18        {
 019            var secret = await manager.RotateAsync(Route<string>("name")!, request, cancellationToken);
 020            await Send.OkAsync(secret.ToModel(), cancellationToken);
 021        }
 022        catch (InvalidOperationException e)
 23        {
 024            AddError(e.Message);
 025            await Send.ErrorsAsync(cancellation: cancellationToken);
 026        }
 027        catch (KeyNotFoundException)
 28        {
 029            await Send.NotFoundAsync(cancellationToken);
 30        }
 031    }
 32}