| | | 1 | | using System.Security.Claims; |
| | | 2 | | using Elsa.Connections.Models; |
| | | 3 | | |
| | | 4 | | namespace Elsa.Connections.Contracts; |
| | | 5 | | |
| | | 6 | | public interface IConnectionLifecycleService |
| | | 7 | | { |
| | | 8 | | Task<ConnectionLifecycleResult> ConnectAsync(ClaimsPrincipal principal, ConnectConnectionRequest request, Cancellati |
| | | 9 | | |
| | | 10 | | Task<ConnectionAccessCredential> ResolveForUseAsync(ClaimsPrincipal principal, string tenantId, string environmentId |
| | | 11 | | |
| | | 12 | | Task<ConnectionLifecycleResult> RefreshAsync(ClaimsPrincipal principal, string tenantId, string environmentId, strin |
| | | 13 | | |
| | | 14 | | Task<ConnectionOffboardingOperationResult> DisconnectAsync(ClaimsPrincipal principal, string tenantId, string enviro |
| | | 15 | | |
| | | 16 | | Task<ConnectionOffboardingOperationResult> RequestTokenRevocationAsync(ClaimsPrincipal principal, string tenantId, s |
| | | 17 | | |
| | | 18 | | Task<ConnectionOffboardingOperationResult> RequestInstallationUninstallAsync(ClaimsPrincipal principal, string tenan |
| | | 19 | | |
| | | 20 | | Task<ConnectionLifecycleResult> CleanupGenerationAsync(ClaimsPrincipal principal, string tenantId, string environmen |
| | | 21 | | } |
| | | 22 | | |
| | | 23 | | /// <summary>Lifecycle operations for static credentials that have no provider refresh-token exchange.</summary> |
| | | 24 | | public interface IStaticApiKeyLifecycleService |
| | | 25 | | { |
| | | 26 | | Task<ConnectionLifecycleResult> ConnectApiKeyAsync(ClaimsPrincipal principal, ConnectApiKeyConnectionRequest request |
| | | 27 | | |
| | | 28 | | Task<ConnectionLifecycleResult> ReplaceApiKeyAsync(ClaimsPrincipal principal, string tenantId, string environmentId, |
| | | 29 | | } |
| | | 30 | | |
| | | 31 | | /// <summary>Host-owned background recovery contract. It receives no caller identity or caller-selectable system kind.</ |
| | | 32 | | public interface IConnectionLifecycleRecoveryService |
| | | 33 | | { |
| | | 34 | | Task<ConnectionLifecycleResult> ReconcileAsync(string tenantId, string environmentId, string connectionId, Cancellat |
| | | 35 | | |
| | | 36 | | Task<ConnectionOffboardingOperationResult> ReconcileOffboardingAsync(string tenantId, string environmentId, string c |
| | | 37 | | |
| | | 38 | | Task<ConnectionLifecycleResult> RefreshAsync(string tenantId, string environmentId, string connectionId, Cancellatio |
| | | 39 | | |
| | | 40 | | Task<ConnectionLifecycleResult> CleanupGenerationAsync(string tenantId, string environmentId, string connectionId, s |
| | | 41 | | } |
| | | 42 | | |
| | | 43 | | public sealed record ConnectConnectionRequest(string TenantId, string EnvironmentId, string ProviderId, string ProviderA |
| | | 44 | | |
| | | 45 | | public sealed record ConnectApiKeyConnectionRequest(string TenantId, string EnvironmentId, string ProviderId, string Pro |
| | | 46 | | { |
| | | 47 | | public override string ToString() => "ConnectApiKeyConnectionRequest { Redacted = true }"; |
| | | 48 | | } |
| | | 49 | | |
| | | 50 | | /// <summary>Non-secret identity and lifecycle metadata returned to authorized connection managers.</summary> |
| | 96 | 51 | | public sealed record ConnectionLifecycleMetadata( |
| | 24 | 52 | | string ConnectionId, |
| | 24 | 53 | | string ProviderId, |
| | 24 | 54 | | string ProviderAccountId, |
| | 24 | 55 | | ConnectionStatus Status, |
| | 24 | 56 | | long Revision, |
| | 125 | 57 | | string? GenerationId); |
| | | 58 | | |
| | | 59 | | public sealed record ConnectionLifecycleResult( |
| | | 60 | | bool Succeeded, |
| | | 61 | | string? SafeErrorCode, |
| | | 62 | | long? Revision, |
| | | 63 | | string? ConnectionId = null, |
| | | 64 | | ConnectionLifecycleMetadata? Connection = null); |
| | | 65 | | |
| | | 66 | | public sealed record ConnectionOffboardingOperationResult( |
| | | 67 | | bool Accepted, |
| | | 68 | | string? SafeErrorCode, |
| | | 69 | | string? OperationId, |
| | | 70 | | ConnectionOffboardingOperationStatus? Status, |
| | | 71 | | long? ConnectionRevision); |