| | | 1 | | using System.Text.Json.Serialization; |
| | | 2 | | |
| | | 3 | | namespace Elsa.Platform.Integration.Models; |
| | | 4 | | |
| | | 5 | | [JsonConverter(typeof(JsonStringEnumConverter<PlatformRuntimeCommandAction>))] |
| | | 6 | | public enum PlatformRuntimeCommandAction |
| | | 7 | | { |
| | | 8 | | Unknown, |
| | | 9 | | Deploy, |
| | | 10 | | Rollback, |
| | | 11 | | Validate, |
| | | 12 | | RuntimeControl |
| | | 13 | | } |
| | | 14 | | |
| | | 15 | | [JsonConverter(typeof(JsonStringEnumConverter<PlatformRuntimeCommandStatus>))] |
| | | 16 | | public enum PlatformRuntimeCommandStatus |
| | | 17 | | { |
| | | 18 | | Unknown, |
| | | 19 | | Pending, |
| | | 20 | | Claimed, |
| | | 21 | | Running, |
| | | 22 | | Completed, |
| | | 23 | | Failed, |
| | | 24 | | Rejected, |
| | | 25 | | Cancelled, |
| | | 26 | | RecoveryRequired, |
| | | 27 | | Expired |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | [JsonConverter(typeof(JsonStringEnumConverter<PlatformArtifactStatus>))] |
| | | 31 | | public enum PlatformArtifactStatus |
| | | 32 | | { |
| | | 33 | | Pending, |
| | | 34 | | Downloading, |
| | | 35 | | Validated, |
| | | 36 | | Applying, |
| | | 37 | | Applied, |
| | | 38 | | Failed, |
| | | 39 | | Rejected, |
| | | 40 | | Skipped |
| | | 41 | | } |
| | | 42 | | |
| | | 43 | | [JsonConverter(typeof(JsonStringEnumConverter<PlatformDiagnosticSeverity>))] |
| | | 44 | | public enum PlatformDiagnosticSeverity |
| | | 45 | | { |
| | | 46 | | Info, |
| | | 47 | | Warning, |
| | | 48 | | Error |
| | | 49 | | } |
| | | 50 | | |
| | | 51 | | public sealed record PlatformRuntimeCommandListResponse(IReadOnlyList<PlatformRuntimeCommand> Commands); |
| | | 52 | | |
| | | 53 | | public sealed record PlatformRuntimeCommandClaimRequest(Guid EngineId, string WorkerId, int LeaseSeconds); |
| | | 54 | | |
| | | 55 | | public sealed record PlatformRuntimeCommandClaimResponse(PlatformRuntimeCommand Command, string LeaseToken); |
| | | 56 | | |
| | | 57 | | public sealed record PlatformRuntimeCommandHeartbeatRequest(string LeaseToken, string WorkerId); |
| | | 58 | | |
| | | 59 | | public sealed record PlatformRuntimeCommandProgressRequest(string LeaseToken, string Status, int? PercentComplete, strin |
| | | 60 | | |
| | | 61 | | public sealed record PlatformRuntimeCommandCompleteRequest( |
| | | 62 | | string LeaseToken, |
| | | 63 | | PlatformArtifactDigest? ObservedArtifactDigest, |
| | | 64 | | string? RuntimeReference, |
| | | 65 | | IReadOnlyList<PlatformDiagnostic> Diagnostics, |
| | | 66 | | IReadOnlyList<PlatformArtifactOutcome>? Artifacts = null); |
| | | 67 | | |
| | | 68 | | public sealed record PlatformRuntimeCommandFailRequest( |
| | | 69 | | string LeaseToken, |
| | | 70 | | IReadOnlyList<PlatformDiagnostic> Diagnostics, |
| | | 71 | | IReadOnlyList<PlatformArtifactOutcome>? Artifacts = null); |
| | | 72 | | |
| | | 73 | | public sealed record PlatformRuntimeCommandRejectRequest( |
| | | 74 | | string LeaseToken, |
| | | 75 | | IReadOnlyList<PlatformDiagnostic> Diagnostics, |
| | | 76 | | IReadOnlyList<PlatformArtifactOutcome>? Artifacts = null); |
| | | 77 | | |
| | | 78 | | public sealed record PlatformRuntimeCommand( |
| | | 79 | | Guid Id, |
| | | 80 | | Guid WorkspaceId, |
| | | 81 | | Guid RunId, |
| | | 82 | | Guid EnvironmentId, |
| | | 83 | | Guid EngineId, |
| | | 84 | | PlatformRuntimeCommandAction Action, |
| | | 85 | | PlatformRuntimeCommandStatus Status, |
| | | 86 | | PlatformRuntimeCommandArtifactReference? Artifact, |
| | | 87 | | PlatformRuntimeCommandRevisionReference? Revision, |
| | | 88 | | string IdempotencyKey, |
| | | 89 | | string? WorkerId, |
| | | 90 | | DateTimeOffset? ClaimedAt, |
| | | 91 | | DateTimeOffset? LeaseExpiresAt, |
| | | 92 | | DateTimeOffset? HeartbeatAt, |
| | | 93 | | int AttemptNumber, |
| | | 94 | | int? PercentComplete, |
| | | 95 | | string? ProgressMessage, |
| | | 96 | | PlatformArtifactDigest? ObservedArtifactDigest, |
| | | 97 | | string? RuntimeReference, |
| | | 98 | | IReadOnlyList<PlatformDiagnostic> Diagnostics, |
| | | 99 | | DateTimeOffset CreatedAt, |
| | | 100 | | DateTimeOffset UpdatedAt, |
| | | 101 | | DateTimeOffset? AvailableAt, |
| | | 102 | | DateTimeOffset? ExpiresAt, |
| | | 103 | | DateTimeOffset? CompletedAt, |
| | | 104 | | IReadOnlyList<PlatformArtifactItem>? Artifacts = null); |
| | | 105 | | |
| | | 106 | | public sealed record PlatformRuntimeCommandArtifactReference( |
| | | 107 | | Guid? ArtifactRecordId, |
| | | 108 | | string? ArtifactId, |
| | | 109 | | string? ArtifactTypeId, |
| | | 110 | | PlatformArtifactDigest? ContentDigest); |
| | | 111 | | |
| | | 112 | | public sealed record PlatformRuntimeCommandRevisionReference(Guid? RevisionId); |
| | | 113 | | |
| | | 114 | | public sealed record PlatformArtifactItem( |
| | | 115 | | Guid ArtifactRecordId, |
| | | 116 | | string ArtifactId, |
| | | 117 | | string ArtifactTypeId, |
| | | 118 | | string? ArtifactSchemaVersion, |
| | | 119 | | PlatformArtifactDigest ContentDigest, |
| | | 120 | | string DisplayName, |
| | | 121 | | string? DownloadUrl, |
| | | 122 | | PlatformArtifactStatus Status, |
| | | 123 | | PlatformArtifactDigest? ObservedDigest, |
| | | 124 | | string? RuntimeReference, |
| | | 125 | | IReadOnlyList<PlatformDiagnostic>? Diagnostics); |
| | | 126 | | |
| | 0 | 127 | | public sealed record PlatformArtifactOutcome( |
| | 0 | 128 | | Guid ArtifactRecordId, |
| | 0 | 129 | | PlatformArtifactStatus Status, |
| | 0 | 130 | | PlatformArtifactDigest? ObservedDigest = null, |
| | 0 | 131 | | string? RuntimeReference = null, |
| | 0 | 132 | | IReadOnlyList<PlatformDiagnostic>? Diagnostics = null); |
| | | 133 | | |
| | | 134 | | public sealed record PlatformArtifactDigest(string Algorithm, string Value); |
| | | 135 | | |
| | | 136 | | public sealed record PlatformDiagnostic(string Code, PlatformDiagnosticSeverity Severity, string Message); |
| | | 137 | | |
| | | 138 | | public sealed record PlatformProblemDetails(string? Title, string? Detail); |