├── .gitattributes
├── .gitignore
├── Build.ps1
├── Directory.Build.props
├── LICENSE
├── README.md
├── appveyor.yml
├── example
├── SeqEnableAAD
│ ├── Program.cs
│ ├── README.md
│ └── SeqEnableAAD.csproj
├── SeqQuery
│ ├── Program.cs
│ └── SeqQuery.csproj
├── SeqTail
│ ├── Program.cs
│ └── SeqTail.csproj
└── SignalCopy
│ ├── Program.cs
│ └── SignalCopy.csproj
├── seq-api.sln
├── seq-api.sln.DotSettings
├── src
└── Seq.Api
│ ├── Client
│ ├── SeqApiClient.cs
│ └── SeqApiException.cs
│ ├── Model
│ ├── Alerting
│ │ ├── AlertActivityPart.cs
│ │ ├── AlertEntity.cs
│ │ ├── AlertNotificationPart.cs
│ │ ├── AlertOccurrencePart.cs
│ │ ├── AlertOccurrenceRangePart.cs
│ │ ├── AlertStateEntity.cs
│ │ └── NotificationChannelPart.cs
│ ├── AppInstances
│ │ ├── AppInstanceEntity.cs
│ │ ├── AppInstanceOutputMetricsPart.cs
│ │ └── AppInstanceProcessMetricsPart.cs
│ ├── Apps
│ │ ├── AppEntity.cs
│ │ ├── AppPackageIdentityPart.cs
│ │ ├── AppPackagePart.cs
│ │ ├── AppSettingPart.cs
│ │ └── AppSettingValuePart.cs
│ ├── Backups
│ │ └── BackupEntity.cs
│ ├── Cluster
│ │ ├── ClusterNodeEntity.cs
│ │ ├── HealthCheckResultPart.cs
│ │ └── HealthStatus.cs
│ ├── Dashboarding
│ │ ├── ChartDisplayStylePart.cs
│ │ ├── ChartPart.cs
│ │ ├── ChartQueryPart.cs
│ │ ├── DashboardEntity.cs
│ │ ├── MeasurementDisplayPalette.cs
│ │ ├── MeasurementDisplayStylePart.cs
│ │ └── MeasurementDisplayType.cs
│ ├── Data
│ │ ├── ColumnMetadataPart.cs
│ │ ├── QueryExecutionStatisticsPart.cs
│ │ ├── QueryResultPart.cs
│ │ ├── TimeSlicePart.cs
│ │ └── TimeseriesPart.cs
│ ├── Diagnostics
│ │ ├── ClusterMetricsPart.cs
│ │ ├── MeasurementTimeseriesPart.cs
│ │ ├── ServerMetricsPart.cs
│ │ ├── ServerStatusPart.cs
│ │ ├── StatusMessagePart.cs
│ │ └── Storage
│ │ │ ├── ColumnDescriptionPart.cs
│ │ │ ├── ColumnType.cs
│ │ │ ├── RowsetPart.cs
│ │ │ └── StorageConsumptionPart.cs
│ ├── Entity.cs
│ ├── Events
│ │ ├── DeleteResultPart.cs
│ │ ├── EventEntity.cs
│ │ ├── EventInputResultPart.cs
│ │ ├── MessageTemplateTokenPart.cs
│ │ └── ResultSetPart.cs
│ ├── Expressions
│ │ ├── ExpressionPart.cs
│ │ └── SqlExpressionPart.cs
│ ├── Feeds
│ │ └── NuGetFeedEntity.cs
│ ├── ILinked.cs
│ ├── Indexes
│ │ ├── IndexEntity.cs
│ │ └── IndexedEntityType.cs
│ ├── Indexing
│ │ └── ExpressionIndexEntity.cs
│ ├── Inputs
│ │ ├── ApiKeyEntity.cs
│ │ ├── InputMetricsPart.cs
│ │ └── InputSettingsPart.cs
│ ├── License
│ │ └── LicenseEntity.cs
│ ├── Link.cs
│ ├── LinkCollection.cs
│ ├── LogEvents
│ │ └── LogEventLevel.cs
│ ├── Permalinks
│ │ └── PermalinkEntity.cs
│ ├── ResourceGroup.cs
│ ├── Retention
│ │ └── RetentionPolicyEntity.cs
│ ├── Root
│ │ └── RootEntity.cs
│ ├── Security
│ │ ├── Permission.cs
│ │ ├── RoleEntity.cs
│ │ └── WellKnownRole.cs
│ ├── Settings
│ │ ├── InternalErrorReportingSettingsPart.cs
│ │ ├── SettingEntity.cs
│ │ └── SettingName.cs
│ ├── Shared
│ │ ├── DateTimeRange.cs
│ │ ├── DeferredRequestEntity.cs
│ │ ├── DescriptiveFilterPart.cs
│ │ ├── ErrorPart.cs
│ │ ├── EvaluationContextPart.cs
│ │ ├── EventPropertyPart.cs
│ │ ├── GroupingColumnPart.cs
│ │ ├── MeasurementPart.cs
│ │ ├── ResultSetStatus.cs
│ │ └── StatisticsPart.cs
│ ├── Signals
│ │ ├── SignalColumnPart.cs
│ │ ├── SignalEntity.cs
│ │ ├── SignalExpressionKind.cs
│ │ ├── SignalExpressionPart.cs
│ │ └── SignalGrouping.cs
│ ├── SqlQueries
│ │ └── SqlQueryEntity.cs
│ ├── Tasks
│ │ └── RunningTaskEntity.cs
│ ├── Updates
│ │ └── AvailableUpdateEntity.cs
│ ├── Users
│ │ ├── AuthProviderInfoPart.cs
│ │ ├── AuthProvidersPart.cs
│ │ ├── CredentialsPart.cs
│ │ ├── SearchHistoryEntity.cs
│ │ ├── SearchHistoryItemAction.cs
│ │ ├── SearchHistoryItemPart.cs
│ │ └── UserEntity.cs
│ └── Workspaces
│ │ ├── WorkspaceContentPart.cs
│ │ └── WorkspaceEntity.cs
│ ├── ResourceGroups
│ ├── AlertStateResourceGroup.cs
│ ├── AlertsResourceGroup.cs
│ ├── ApiKeysResourceGroup.cs
│ ├── ApiResourceGroup.cs
│ ├── AppInstancesResourceGroup.cs
│ ├── AppsResourceGroup.cs
│ ├── BackupsResourceGroup.cs
│ ├── ClusterResourceGroup.cs
│ ├── DashboardsResourceGroup.cs
│ ├── DataResourceGroup.cs
│ ├── DiagnosticsResourceGroup.cs
│ ├── EventsResourceGroup.cs
│ ├── ExpressionIndexesResourceGroup.cs
│ ├── ExpressionsResourceGroup.cs
│ ├── FeedsResourceGroup.cs
│ ├── ILoadResourceGroup.cs
│ ├── IndexesResourceGroup.cs
│ ├── LicensesResourceGroup.cs
│ ├── PermalinksResourceGroup.cs
│ ├── RetentionPoliciesResourceGroup.cs
│ ├── RolesResourceGroup.cs
│ ├── RunningTasksResourceGroup.cs
│ ├── SettingsResourceGroup.cs
│ ├── SignalsResourceGroup.cs
│ ├── SqlQueriesResourceGroup.cs
│ ├── UpdatesResourceGroup.cs
│ ├── UsersResourceGroup.cs
│ └── WorkspacesResourceGroup.cs
│ ├── Seq.Api.csproj
│ ├── SeqConnection.cs
│ ├── Serialization
│ └── LinkCollectionConverter.cs
│ ├── Streams
│ └── WebSocketTaskExtensions.cs
│ └── seq-api-icon.png
└── test
└── Seq.Api.Tests
├── LinkTests.cs
├── Seq.Api.Tests.csproj
└── SeqConnectionTests.cs
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/Build.ps1:
--------------------------------------------------------------------------------
1 | # This script originally (c) 2016 Serilog Contributors - license Apache 2.0
2 |
3 | echo "build: Build started"
4 |
5 | Push-Location $PSScriptRoot
6 |
7 | if(Test-Path .\artifacts) {
8 | echo "build: Cleaning .\artifacts"
9 | Remove-Item .\artifacts -Force -Recurse
10 | }
11 |
12 | & dotnet restore --no-cache
13 | if($LASTEXITCODE -ne 0) { exit 1 }
14 |
15 | $branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
16 | $revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
17 | $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
18 |
19 | echo "build: Version suffix is $suffix"
20 |
21 | foreach ($src in ls src/*) {
22 | Push-Location $src
23 |
24 | echo "build: Packaging project in $src"
25 |
26 | if ($suffix) {
27 | & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix
28 | } else {
29 | & dotnet pack -c Release -o ..\..\artifacts
30 | }
31 | if($LASTEXITCODE -ne 0) { exit 1 }
32 |
33 | Pop-Location
34 | }
35 |
36 | foreach ($test in ls test/*.Tests) {
37 | Push-Location $test
38 |
39 | echo "build: Testing project in $test"
40 |
41 | & dotnet test -c Release
42 | if($LASTEXITCODE -ne 0) { exit 3 }
43 |
44 | Pop-Location
45 | }
46 |
47 | foreach ($test in ls test/*.Benchmarks) {
48 | Push-Location $test
49 |
50 | echo "build: Building performance test project in $test"
51 |
52 | & dotnet build -c Release
53 | if($LASTEXITCODE -ne 0) { exit 2 }
54 |
55 | Pop-Location
56 | }
57 |
58 | foreach ($sample in ls example/*) {
59 | Push-Location $sample
60 |
61 | echo "build: Building sample project in $sample"
62 |
63 | & dotnet build -c Release
64 | if($LASTEXITCODE -ne 0) { exit 2 }
65 |
66 | Pop-Location
67 | }
68 |
69 | Pop-Location
70 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | latest
5 |
6 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: '{build}'
2 | skip_tags: true
3 | image: Visual Studio 2022
4 | build_script:
5 | - ps: ./Build.ps1
6 | test: off
7 | artifacts:
8 | - path: artifacts/Seq.Api.*.nupkg
9 | deploy:
10 | - provider: NuGet
11 | api_key:
12 | secure: Jxi/gameJWSW1ncE+SpU6C51kENE7mSxtKYPnM5CrvTYnfpaf8Y5B7PsROv2Oglg
13 | skip_symbols: true
14 | on:
15 | branch: /^(main|dev)$/
16 | - provider: GitHub
17 | auth_token:
18 | secure: hX+cZmW+9BCXy7vyH8myWsYdtQHyzzil9K5yvjJv7dK9XmyrGYYDj/DPzMqsXSjo
19 | artifact: /Seq.Api.*\.nupkg/
20 | tag: v$(appveyor_build_version)
21 | on:
22 | branch: main
23 |
--------------------------------------------------------------------------------
/example/SeqEnableAAD/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using DocoptNet;
4 | using Seq.Api;
5 | using Seq.Api.Model.Settings;
6 |
7 | const string usage = @"seq-enable-aad: enable authentication on your Seq server (for initial setup of a new Seq server only).
8 |
9 | Usage:
10 | seq-enable-aad.exe --uname= --tenantid= --clientid= --clientkey= [--authority=]
11 | seq-enable-aad.exe (-h | --help)
12 |
13 | Options:
14 | -h --help Show this screen.
15 | --uname= Username. Azure Active Directory usernames must take the form of an email address.
16 | --tenantid= Tenant ID.
17 | --clientid= Client ID.
18 | --clientkey= Client key.
19 | --authority= Authority (optional, defaults to 'login.windows.net').
20 | ";
21 |
22 | try
23 | {
24 | var arguments = new Docopt().Apply(usage, args, version: "Seq Enable AAD 0.1", exit: true)!;
25 |
26 | var server = arguments[""].ToString();
27 | var username = Normalize(arguments["--uname"]);
28 | var tenantId = Normalize(arguments["--tenantid"]);
29 | var clientId = Normalize(arguments["--clientid"]);
30 | var clientKey = Normalize(arguments["--clientkey"]);
31 | var authority = Normalize(arguments["--authority"]);
32 |
33 | await Run(server, username, tenantId, clientId, clientKey, authority);
34 | }
35 | catch (Exception ex)
36 | {
37 | Console.ForegroundColor = ConsoleColor.White;
38 | Console.BackgroundColor = ConsoleColor.Red;
39 | Console.WriteLine("seq-enable-aad: {0}", ex);
40 | Console.ResetColor();
41 | Environment.Exit(-1);
42 | }
43 |
44 | static string? Normalize(ValueObject? v)
45 | {
46 | if (v == null) return null;
47 | var s = v.ToString();
48 | return string.IsNullOrWhiteSpace(s) ? null : s;
49 | }
50 |
51 | static async Task Run(string server, string? username, string? tenantId, string? clientId, string? clientKey, string? authority="login.windows.net")
52 | {
53 | var connection = new SeqConnection(server);
54 |
55 | var user = await connection.Users.FindCurrentAsync();
56 | var provider = await connection.Settings.FindNamedAsync(SettingName.AuthenticationProvider);
57 | var cid = await connection.Settings.FindNamedAsync(SettingName.EntraIDClientId);
58 | var ckey = await connection.Settings.FindNamedAsync(SettingName.EntraIDClientKey);
59 | var aut = await connection.Settings.FindNamedAsync(SettingName.EntraIDAuthority);
60 | var tid = await connection.Settings.FindNamedAsync(SettingName.EntraIDTenantId);
61 |
62 | user.Username = username;
63 | provider.Value = "Microsoft Entra ID";
64 | cid.Value = clientId;
65 | ckey.Value = clientKey;
66 | tid.Value = tenantId;
67 | aut.Value = authority;
68 |
69 | await connection.Users.UpdateAsync(user);
70 | await connection.Settings.UpdateAsync(cid);
71 | await connection.Settings.UpdateAsync(ckey);
72 | await connection.Settings.UpdateAsync(tid);
73 | await connection.Settings.UpdateAsync(aut);
74 |
75 | await connection.Settings.UpdateAsync(provider); // needs to go before IsAuthenticationEnabled but after the other settings
76 |
77 | var iae = await connection.Settings.FindNamedAsync(SettingName.IsAuthenticationEnabled);
78 | iae.Value = true;
79 | await connection.Settings.UpdateAsync(iae); // this update needs to happen last, as enabling auth will lock this connection out
80 | }
81 |
--------------------------------------------------------------------------------
/example/SeqEnableAAD/README.md:
--------------------------------------------------------------------------------
1 | # Seq Enable AAD (Azure Active Directory)
2 |
3 | Be sure to read the [Seq Azure Active Directory documentation](https://docs.datalust.co/docs/azure-active-directory) to find the manual AAD setup instructions.
4 |
5 | ## Example usage:
6 |
7 | ```
8 | seq-enable-aad.exe https://seq.example.com --uname=example@microsoft.com --clientid=xxxxxx --tenantid=xxxxxx --clientkey=xxxxxx --authority=login.windows.net
9 | ```
10 |
11 | ### **Important note:**
12 |
13 | #### Windows
14 |
15 | Don't forget to set the "canonical URI" which Seq uses as a reply address for AAD.
16 |
17 | ```
18 | seq config -k api.canonicalUri -v https://seq.example.com
19 | seq service restart
20 | ```
21 |
22 | #### Linux / Docker
23 |
24 | Don't forget to include the BASE_URI which Seq uses as a reply address for AAD.
25 |
26 | ```
27 | docker run -d \
28 | --restart unless-stopped \
29 | --name seq \
30 | -p 5341:80 \
31 | -e ACCEPT_EULA=Y \
32 | -e BASE_URI=https://seq.example.com \
33 | datalust/seq:latest
34 | ```
--------------------------------------------------------------------------------
/example/SeqEnableAAD/SeqEnableAAD.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net9.0
6 | seq-enable-aad
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/example/SeqQuery/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using DocoptNet;
4 | using Seq.Api;
5 |
6 | const string usage = @"seq-query: run Seq SQL queries from your console.
7 |
8 | Usage:
9 | seq-query.exe [--apikey=] [--from=] [--to=]
10 | seq-query.exe (-h | --help)
11 |
12 | Options:
13 | -h --help Show this screen.
14 | --apikey= Seq API key.
15 | --from= ISO 8601 date/time to query from (default: now - 24h)
16 | --to= Date/time to query to (default: now)
17 |
18 | ";
19 |
20 | try
21 | {
22 | var arguments = new Docopt().Apply(usage, args, version: "Seq Query 0.1", exit: true)!;
23 |
24 | var server = arguments[""].ToString();
25 | var query = Normalize(arguments[""]);
26 | var apiKey = Normalize(arguments["--apikey"]);
27 | var from = Normalize(arguments["--from"]);
28 | var to = Normalize(arguments["--to"]);
29 |
30 | await Run(server, apiKey, query, from, to);
31 | }
32 | catch (Exception ex)
33 | {
34 | Console.ForegroundColor = ConsoleColor.White;
35 | Console.BackgroundColor = ConsoleColor.Red;
36 | Console.WriteLine("seq-query: {0}", ex);
37 | Console.ResetColor();
38 | Environment.Exit(-1);
39 | }
40 |
41 | static string? Normalize(ValueObject? v)
42 | {
43 | if (v == null) return null;
44 | var s = v.ToString();
45 | return string.IsNullOrWhiteSpace(s) ? null : s;
46 | }
47 |
48 | static async Task Run(string server, string? apiKey, string? query, string? from, string? to)
49 | {
50 | var connection = new SeqConnection(server, apiKey);
51 |
52 | var now = DateTime.UtcNow;
53 | var rangeStartUtc = from != null ? DateTime.Parse(from) : now - TimeSpan.FromDays(1);
54 | DateTime? rangeEndUtc = to != null ? DateTime.Parse(to) : now;
55 |
56 | var result = await connection.Data.QueryCsvAsync(query, rangeStartUtc, rangeEndUtc);
57 | Console.WriteLine(result);
58 | }
59 |
--------------------------------------------------------------------------------
/example/SeqQuery/SeqQuery.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net9.0
5 | Exe
6 | seq-query
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/example/SeqTail/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using DocoptNet;
4 | using Seq.Api;
5 | using Serilog;
6 | using Serilog.Formatting.Compact.Reader;
7 | using System.Threading;
8 |
9 | // ReSharper disable AccessToDisposedClosure
10 |
11 | const string usage = @"seq-tail: watch a Seq query from your console.
12 |
13 | Usage:
14 | seq-tail.exe [--filter=] [--apikey=]
15 | seq-tail.exe (-h | --help)
16 |
17 | Options:
18 | -h --help Show this screen.
19 | --filter= Filter expression or free text to match.
20 | --apikey= Seq API key.
21 | ";
22 |
23 | Log.Logger = new LoggerConfiguration()
24 | .MinimumLevel.Verbose()
25 | .WriteTo.Console()
26 | .CreateLogger();
27 |
28 | TaskScheduler.UnobservedTaskException += (_,e) => Log.Fatal(e.Exception, "Unobserved task exception");
29 |
30 | try
31 | {
32 | var arguments = new Docopt().Apply(usage, args, version: "Seq Tail 0.3", exit: true)!;
33 |
34 | var server = arguments[""].ToString();
35 | var apiKey = Normalize(arguments["--apikey"]);
36 | var filter = Normalize(arguments["--filter"]);
37 |
38 | using var cts = new CancellationTokenSource();
39 | Console.WriteLine("Tailing, press Ctrl+C to exit.");
40 | Console.CancelKeyPress += (_,_) => cts.Cancel();
41 |
42 | var run = Task.Run(() => Run(server, apiKey, filter, cts.Token), cts.Token);
43 |
44 | run.GetAwaiter().GetResult();
45 | }
46 | catch (Exception ex)
47 | {
48 | Log.Fatal(ex, "Tailing aborted");
49 | Environment.Exit(-1);
50 | }
51 |
52 | static string? Normalize(ValueObject? v)
53 | {
54 | if (v == null) return null;
55 | var s = v.ToString();
56 | return string.IsNullOrWhiteSpace(s) ? null : s;
57 | }
58 |
59 | static async Task Run(string server, string? apiKey, string? filter, CancellationToken cancel)
60 | {
61 | var connection = new SeqConnection(server, apiKey);
62 |
63 | string? strictFilter = null;
64 | if (filter != null)
65 | {
66 | var converted = await connection.Expressions.ToStrictAsync(filter);
67 | strictFilter = converted.StrictExpression;
68 | }
69 |
70 | await foreach (var evt in connection.Events.StreamDocumentsAsync(filter: strictFilter, clef: true, cancellationToken: cancel))
71 | {
72 | var logEvent = LogEventReader.ReadFromString(evt);
73 | Log.Write(logEvent);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/example/SeqTail/SeqTail.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net9.0
5 | seq-tail
6 | Exe
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/example/SignalCopy/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using DocoptNet;
4 | using Seq.Api;
5 | using Seq.Api.Model.Signals;
6 | using System.Collections.Generic;
7 |
8 | const string usage = @"signal-copy: copy Seq signals from one server to another.
9 |
10 | Usage:
11 | signal-copy.exe [--srckey=] [--dstkey=]
12 | signal-copy.exe (-h | --help)
13 |
14 | Options:
15 | -h --help Show this screen.
16 | --srckey= Source server API key.
17 | --dstkey= Destination server API key.
18 | ";
19 |
20 | try
21 | {
22 | var arguments = new Docopt().Apply(usage, args, version: "Seq Signal Copy 0.1", exit: true)!;
23 |
24 | var src = arguments[""].ToString();
25 | var dst = arguments[""].ToString();
26 | var srcKey = Normalize(arguments["--srckey"]);
27 | var dstKey = Normalize(arguments["--dstkey"]);
28 |
29 | await Run(src, srcKey, dst, dstKey);
30 | }
31 | catch (Exception ex)
32 | {
33 | Console.ForegroundColor = ConsoleColor.White;
34 | Console.BackgroundColor = ConsoleColor.Red;
35 | Console.WriteLine("signal-copy: {0}", ex);
36 | Console.ResetColor();
37 | Environment.Exit(-1);
38 | }
39 |
40 | static string? Normalize(ValueObject? v)
41 | {
42 | if (v == null) return null;
43 | var s = v.ToString();
44 | return string.IsNullOrWhiteSpace(s) ? null : s;
45 | }
46 |
47 | static async Task Run(string src, string? srcKey, string dst, string? dstKey)
48 | {
49 | var srcConnection = new SeqConnection(src, srcKey);
50 | var dstConnection = new SeqConnection(dst, dstKey);
51 |
52 | var dstSignals = new Dictionary();
53 | foreach (var dstSignal in await dstConnection.Signals.ListAsync())
54 | {
55 | if (dstSignals.ContainsKey(dstSignal.Title))
56 | {
57 | Console.WriteLine($"The destination server has more than one signal named '{dstSignal.Title}'; only one copy of the signal will be updated.");
58 | continue;
59 | }
60 |
61 | dstSignals.Add(dstSignal.Title, dstSignal);
62 | }
63 |
64 | var count = 0;
65 |
66 | foreach (var signal in await srcConnection.Signals.ListAsync())
67 | {
68 | if (dstSignals.TryGetValue(signal.Title, out var target))
69 | {
70 | if (target.IsProtected)
71 | {
72 | Console.WriteLine($"Skipping restricted signal '{signal.Title}' ({target.Id})");
73 | continue;
74 | }
75 |
76 | Console.WriteLine($"Updating existing signal '{signal.Title}' ({target.Id})");
77 | }
78 | else
79 | {
80 | Console.WriteLine($"Creating new signal '{signal.Title}'");
81 | target = await dstConnection.Signals.TemplateAsync();
82 | }
83 |
84 | target.Title = signal.Title;
85 | target.Filters = signal.Filters;
86 | target.Columns = signal.Columns;
87 | target.Description = signal.Description + " (copy)";
88 |
89 | await (target.Id != null ? dstConnection.Signals.UpdateAsync(target) : dstConnection.Signals.AddAsync(target));
90 | ++count;
91 | }
92 |
93 | Console.WriteLine($"Done, {count} signals updated.");
94 | }
95 |
--------------------------------------------------------------------------------
/example/SignalCopy/SignalCopy.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net9.0
5 | signal-copy
6 | Exe
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/seq-api.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | AD
3 | True
4 | True
5 | True
6 | True
7 | True
8 | True
9 | True
10 | True
11 | True
12 | True
13 | True
14 | True
15 | True
16 | True
17 | True
18 | True
19 | True
20 | True
21 | True
22 | True
23 | True
24 | True
25 | True
26 | True
27 | True
28 |
29 |
--------------------------------------------------------------------------------
/src/Seq.Api/Client/SeqApiException.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Net;
17 |
18 | #nullable enable
19 |
20 | namespace Seq.Api.Client;
21 |
22 | ///
23 | /// Thrown when an action cannot be performed.
24 | ///
25 | public class SeqApiException : Exception
26 | {
27 | ///
28 | /// Construct a with the given message and status code.
29 | ///
30 | /// A message describing the error.
31 | public SeqApiException(string message)
32 | : base(message)
33 | {
34 | }
35 |
36 | ///
37 | /// Construct a with the given message and status code.
38 | ///
39 | /// A message describing the error.
40 | /// The corresponding status code returned from Seq, if available.
41 | public SeqApiException(string message, HttpStatusCode? statusCode)
42 | : this(message)
43 | {
44 | StatusCode = statusCode;
45 | }
46 |
47 | ///
48 | /// Construct a with the given message and status code.
49 | ///
50 | /// A message describing the error.
51 | /// The cause of the API failure.
52 | public SeqApiException(string message, Exception innerException)
53 | : base(message, innerException)
54 | {
55 | }
56 |
57 | ///
58 | /// The status code returned from Seq, if available.
59 | ///
60 | public HttpStatusCode? StatusCode { get; }
61 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Alerting/AlertActivityPart.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | // ReSharper disable UnusedAutoPropertyAccessor.Global
5 |
6 | namespace Seq.Api.Model.Alerting
7 | {
8 | ///
9 | /// A summary of recent activity on an alert.
10 | ///
11 |
12 | public class AlertActivityPart
13 | {
14 | ///
15 | /// When the last check for the alert was performed.
16 | ///
17 | public DateTime? LastCheck { get; set; }
18 |
19 | ///
20 | /// Whether or not the last check triggered any notifications.
21 | ///
22 | public bool LastCheckTriggered { get; set; }
23 |
24 | ///
25 | /// Any failures that prevented the last check from completing successfully.
26 | /// These failures indicate a problem with the alert itself, not with the
27 | /// data being monitored.
28 | ///
29 | /// A value of null indicates the last check succeeded.
30 | ///
31 | public List LastCheckFailures { get; set; }
32 |
33 | ///
34 | /// When the alert may be checked again after being triggered.
35 | ///
36 | public DateTime? SuppressedUntil { get; set; }
37 |
38 | ///
39 | /// The most recent occurrences of the alert that triggered notifications.
40 | ///
41 | public List RecentOccurrences { get; set; } = new List();
42 |
43 | ///
44 | /// Minimal metrics for the most recent occurrences of the alert that triggered notifications.
45 | /// The metrics in this list are a superset of .
46 | ///
47 | public List RecentOccurrenceRanges { get; set; } =
48 | new List();
49 |
50 | ///
51 | /// The number of times this alert has been triggered since its creation.
52 | ///
53 | public int TotalOccurrences { get; set; }
54 |
55 | ///
56 | /// The detection time of the most recent occurrence not included in .
57 | ///
58 | public DateTime? LastEarlierOccurrence { get; set; }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Alerting/AlertNotificationPart.cs:
--------------------------------------------------------------------------------
1 | using Seq.Api.Model.AppInstances;
2 |
3 | namespace Seq.Api.Model.Alerting
4 | {
5 | ///
6 | /// A record of the that was notified of an alert occurrence.
7 | ///
8 | public class AlertNotificationPart
9 | {
10 | ///
11 | /// The that was notified.
12 | /// This id is a historical record, so it may be for app instance that no longer exists.
13 | ///
14 | public string HistoricalAppInstanceId { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Alerting/AlertOccurrencePart.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Seq.Api.Model.LogEvents;
4 | using Seq.Api.Model.Shared;
5 |
6 | namespace Seq.Api.Model.Alerting
7 | {
8 | ///
9 | /// An occurrence of an alert that triggered notifications.
10 | ///
11 | public class AlertOccurrencePart
12 | {
13 | ///
14 | /// The time when the alert was checked and triggered.
15 | ///
16 | public DateTime DetectedAt { get; set; }
17 |
18 | ///
19 | /// The time grouping that triggered the alert.
20 | ///
21 | public DateTimeRangePart DetectedOverRange { get; set; }
22 |
23 | ///
24 | /// The level of notifications sent for this instance.
25 | ///
26 | public LogEventLevel NotificationLevel { get; set; }
27 |
28 | ///
29 | /// The NotificationChannelParts that were alerted.
30 | ///
31 | public List Notifications { get; set; } = new List();
32 | }
33 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Alerting/AlertOccurrenceRangePart.cs:
--------------------------------------------------------------------------------
1 | using Seq.Api.Model.Shared;
2 |
3 | namespace Seq.Api.Model.Alerting
4 | {
5 | ///
6 | /// An occurrence metric of an alert that triggered notifications.
7 | ///
8 | public class AlertOccurrenceRangePart
9 | {
10 | ///
11 | /// The time grouping that triggered the alert.
12 | ///
13 | public DateTimeRangePart DetectedOverRange { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Alerting/AlertStateEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Seq.Api.Model.LogEvents;
17 |
18 | namespace Seq.Api.Model.Alerting
19 | {
20 | ///
21 | /// Describes the state of an active alert.
22 | ///
23 | public class AlertStateEntity : Entity
24 | {
25 | ///
26 | /// The unique id of the alert being described.
27 | ///
28 | public string AlertId { get; set; }
29 |
30 | ///
31 | /// The alert's title.
32 | ///
33 | public string Title { get; set; }
34 |
35 | ///
36 | /// The user id of the user who owns the alert; if null, the alert is shared.
37 | ///
38 | public string OwnerId { get; set; }
39 |
40 | ///
41 | /// The ids of app instances that receive notifications when the alert is triggered.
42 | ///
43 | public List NotificationAppInstanceIds { get; set; }
44 |
45 | ///
46 | /// A level indicating the severity or priority of the alert.
47 | ///
48 | public LogEventLevel NotificationLevel { get; set; }
49 |
50 | ///
51 | /// Any recent activity for the alert.
52 | ///
53 | public AlertActivityPart Activity { get; set; }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Alerting/NotificationChannelPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Seq.Api.Model.AppInstances;
17 |
18 | namespace Seq.Api.Model.Alerting
19 | {
20 | ///
21 | /// A notification channel belonging to an alert.
22 | ///
23 | public class NotificationChannelPart
24 | {
25 | ///
26 | /// A system-assigned identifier for the channel. This is used when updating channels to carry over unchanged
27 | /// values of sensitive settings, which are not round-tripped to the client for editing. When creating a
28 | /// new channel, this should be null.
29 | ///
30 | public string Id { get; set; }
31 |
32 | ///
33 | /// The message used for the title or subject of the notification. If not specified, a default message based
34 | /// on the alert title will be used.
35 | ///
36 | public string NotificationMessage { get; set; }
37 |
38 | ///
39 | /// If true, notifications will include a sample of the events that contributed to the triggering of
40 | /// the alert.
41 | ///
42 | public bool IncludeContributingEvents { get; set; }
43 |
44 | ///
45 | /// When is true, the maximum number of contributing events to
46 | /// include in the notification. Note that this value is an upper limit, and server resource constraints may
47 | /// prevent all contributing events from being included even below this limit.
48 | ///
49 | public uint? IncludedContributingEventLimit { get; set; }
50 |
51 | ///
52 | /// The id of an that will receive notifications from the alert.
53 | ///
54 | public string NotificationAppInstanceId { get; set; }
55 |
56 | ///
57 | /// Additional properties that will be used to configure the notification app when triggered
58 | /// by the alert.
59 | ///
60 | public Dictionary NotificationAppSettingOverrides { get; set; } =
61 | new Dictionary();
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/AppInstances/AppInstanceOutputMetricsPart.cs:
--------------------------------------------------------------------------------
1 | namespace Seq.Api.Model.AppInstances
2 | {
3 | ///
4 | /// Describes the events reaching being output from Seq through the app.
5 | ///
6 | public class AppInstanceOutputMetricsPart
7 | {
8 | ///
9 | /// The number of events per minute sent from Seq to the app. Includes streamed events (if enabled),
10 | /// manual invocations, and alert notifications. There may be some delay between dispatching an event, and
11 | /// it being processed by the app.
12 | ///
13 | public int DispatchedEventsPerMinute { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/AppInstances/AppInstanceProcessMetricsPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.AppInstances
16 | {
17 | ///
18 | /// Metrics describing the running server-side process for an .
19 | ///
20 | public class AppInstanceProcessMetricsPart
21 | {
22 | ///
23 | /// The size, in bytes, of the app process working set.
24 | ///
25 | public long WorkingSetBytes { get; set; }
26 |
27 | ///
28 | /// If the app process is running, true; otherwise, false.
29 | ///
30 | public bool IsRunning { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Apps/AppEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Seq.Api.ResourceGroups;
17 |
18 | namespace Seq.Api.Model.Apps
19 | {
20 | ///
21 | /// Seq apps are executable plug-ins that read from and write to the Seq event stream.
22 | ///
23 | public class AppEntity : Entity
24 | {
25 | ///
26 | /// Construct an with default values.
27 | ///
28 | /// Instead of constructing an instance directly, consider using
29 | /// to obtain a partly-initialized instance.
30 | public AppEntity()
31 | {
32 | Name = "New App";
33 | AvailableSettings = new List();
34 | }
35 |
36 | ///
37 | /// The friendly name of the app.
38 | ///
39 | public string Name { get; set; }
40 |
41 | ///
42 | /// A long-form description of the app.
43 | ///
44 | public string Description { get; set; }
45 |
46 | ///
47 | /// Metadata describing the settings exposed by instances of the app.
48 | ///
49 | public List AvailableSettings { get; set; }
50 |
51 | ///
52 | /// Whether instances of the app can safely process their own diagnostic events. The
53 | /// default is false. This option should not normally be set.
54 | ///
55 | public bool AllowReprocessing { get; set; }
56 |
57 | ///
58 | /// Metadata describing the NuGet package containing the executable app components.
59 | ///
60 | public AppPackagePart Package { get; set; }
61 |
62 | ///
63 | /// If true, the app produces an input stream and does not accept events itself.
64 | ///
65 | public bool IsInput { get; set; }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Apps/AppPackageIdentityPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Apps
16 | {
17 | ///
18 | /// The data required to identify a NuGet package version.
19 | ///
20 | public class AppPackageIdentityPart
21 | {
22 | ///
23 | /// The id of the from which the package was installed.
24 | ///
25 | public string NuGetFeedId { get; set; }
26 |
27 | ///
28 | /// The package id, for example Seq.Input.HealthCheck.
29 | ///
30 | public string PackageId { get; set; }
31 |
32 | ///
33 | /// The version of the package.
34 | ///
35 | public string Version { get; set; }
36 | }
37 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Apps/AppPackagePart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Seq.Api.Model.Feeds;
16 |
17 | namespace Seq.Api.Model.Apps
18 | {
19 | ///
20 | /// Describes a NuGet package containing executable app components.
21 | ///
22 | public class AppPackagePart : AppPackageIdentityPart
23 | {
24 | ///
25 | /// Package authorship information.
26 | ///
27 | public string Authors { get; set; }
28 |
29 | ///
30 | /// URL of the package license.
31 | ///
32 | public string LicenseUrl { get; set; }
33 |
34 | ///
35 | /// Whether an update is known to be available for the app.
36 | ///
37 | public bool UpdateAvailable { get; set; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Apps/AppSettingPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 |
17 | namespace Seq.Api.Model.Apps
18 | {
19 | ///
20 | /// Describes a setting exposed by instances of an .
21 | ///
22 | public class AppSettingPart
23 | {
24 | ///
25 | /// The unique name identifying the setting.
26 | ///
27 | public string Name { get; set; }
28 |
29 | ///
30 | /// A friendly, descriptive name of the setting.
31 | ///
32 | public string DisplayName { get; set; }
33 |
34 | ///
35 | /// Whether the setting is required in order for the app to function.
36 | ///
37 | public bool IsOptional { get; set; }
38 |
39 | ///
40 | /// Long-form description of the setting.
41 | ///
42 | public string HelpText { get; set; }
43 |
44 | ///
45 | /// The type of value accepted for the setting; valid values are Text, Select,
46 | /// LongText, Checkbox, Integer, Decimal, and Password.
47 | ///
48 | /// An enum was historically not used here in order to improve
49 | /// forwards/backwards compatibility.
50 | public string Type { get; set; }
51 |
52 | ///
53 | /// For settings of Select, a description of the values that can be chosen
54 | /// for the setting.
55 | ///
56 | public List AllowedValues { get; set; } = new List();
57 |
58 | ///
59 | /// If the setting value contains code in a programming or markup language, the
60 | /// language name.
61 | ///
62 | /// Valid names are a subset of the names and aliases recognized by
63 | /// GitHub
64 | /// Linguist. The generic value code will be specified if the language is non-specific but
65 | /// the value should be displayed in fixed-width font. Seq also recognizes the special Seq-specific
66 | /// template and expression syntaxes.
67 | public string Syntax { get; set; }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Apps/AppSettingValuePart.cs:
--------------------------------------------------------------------------------
1 | namespace Seq.Api.Model.Apps
2 | {
3 | ///
4 | /// Describes a value accepted for an with type Select.
5 | ///
6 | public class AppSettingValuePart
7 | {
8 | ///
9 | /// The value accepted for the setting.
10 | ///
11 | public string Value { get; set; }
12 |
13 | ///
14 | /// Optionally, a description of the value, which Seq will use as the value's label in the UI. By default,
15 | /// the will be used as the label.
16 | ///
17 | public string Description { get; set; }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Backups/BackupEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Backups
16 | {
17 | ///
18 | /// Seq backups include metadata like users, signals, API keys and other configuration, but do not include
19 | /// the event stream. Backups are fully encrypted with AES-256 and cannot be restored without the secret key
20 | /// from the originating Seq instance.
21 | ///
22 | public class BackupEntity : Entity
23 | {
24 | ///
25 | /// The time at which the backup was created (ISO-8601-encoded date/time).
26 | ///
27 | public string CreatedAt { get; set; }
28 |
29 | ///
30 | /// The filename (without path information) of the backup, within the server's
31 | /// configured backup location.
32 | ///
33 | public string Filename { get; set; }
34 |
35 | ///
36 | /// The size, in bytes, of the backup file.
37 | ///
38 | public long FileSizeBytes { get; set; }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Cluster/ClusterNodeEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Cluster
16 | {
17 | ///
18 | /// Describes a node in a Seq cluster.
19 | ///
20 | public class ClusterNodeEntity : Entity
21 | {
22 | ///
23 | /// An informational name associated with the node.
24 | ///
25 | public string Name { get; set; }
26 |
27 | ///
28 | /// The address the node will serve intra-cluster traffic on.
29 | ///
30 | public string ClusterListenUri { get; set; }
31 |
32 | ///
33 | /// The address the node will serve regular API requests on.
34 | ///
35 | public string InternalListenUri { get; set; }
36 |
37 | ///
38 | /// Whether any writes have occurred since the node's last completed sync.
39 | ///
40 | public bool IsUpToDate { get; set; }
41 |
42 | ///
43 | /// The time since the node's last completed sync operation.
44 | ///
45 | public double? DataAgeMilliseconds { get; set; }
46 |
47 | ///
48 | /// The time since the follower's active sync was started.
49 | ///
50 | public double? MillisecondsSinceActiveSync { get; set; }
51 |
52 | ///
53 | /// The time since the follower's last heartbeat.
54 | ///
55 | public double? MillisecondsSinceLastHeartbeat { get; set; }
56 |
57 | ///
58 | /// The total number of operations in the active sync.
59 | ///
60 | public int? TotalActiveOps { get; set; }
61 |
62 | ///
63 | /// The remaining number of operations in the active sync.
64 | ///
65 | public int? RemainingActiveOps { get; set; }
66 |
67 | ///
68 | /// Whether the node is currently leading the cluster.
69 | ///
70 | public bool IsLeading { get; set; }
71 |
72 | ///
73 | /// Whether the node has connected to the cluster network.
74 | ///
75 | public bool IsConnected { get; set; }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Cluster/HealthCheckResultPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Cluster
16 | {
17 | ///
18 | /// A result reported from a health check endpoint.
19 | ///
20 | public class HealthCheckResultPart
21 | {
22 | ///
23 | /// The status reported by the endpoint.
24 | ///
25 | public HealthStatus Status { get; set; }
26 |
27 | ///
28 | /// An informational description of the reported status.
29 | ///
30 | public string Description { get; set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Cluster/HealthStatus.cs:
--------------------------------------------------------------------------------
1 | // Copyright Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Cluster
16 | {
17 | ///
18 | /// A status value returned from a health check endpoint.
19 | ///
20 | /// Note that HTTP status code values returned from health checks should be inspected prior to
21 | /// reading status information from the health check response payload.
22 | public enum HealthStatus
23 | {
24 | ///
25 | /// The target is healthy.
26 | ///
27 | Healthy,
28 |
29 | ///
30 | /// The target is functioning in a degraded state; attention is required.
31 | ///
32 | Degraded,
33 |
34 | ///
35 | /// The target is unhealthy.
36 | ///
37 | Unhealthy
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Dashboarding/ChartDisplayStylePart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Dashboarding
16 | {
17 | ///
18 | /// How a chart will be displayed on a dashboard.
19 | ///
20 | public class ChartDisplayStylePart
21 | {
22 | ///
23 | /// The width of the chart, in 1/12th columns.
24 | ///
25 | public int WidthColumns { get; set; } = 6;
26 |
27 | ///
28 | /// The height of the chart, in rows.
29 | ///
30 | public int HeightRows { get; set; } = 1;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Dashboarding/ChartPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Seq.Api.Model.Signals;
17 |
18 | namespace Seq.Api.Model.Dashboarding
19 | {
20 | ///
21 | /// A chart that appears on a dashboard.
22 | ///
23 | public class ChartPart
24 | {
25 | ///
26 | /// The unique id assigned to the chart.
27 | ///
28 | public string Id { get; set; }
29 |
30 | ///
31 | /// A human-friendly title for the chart.
32 | ///
33 | public string Title { get; set; }
34 |
35 | ///
36 | /// An optional that limits what data the chart will display.
37 | ///
38 | public SignalExpressionPart SignalExpression { get; set; }
39 |
40 | ///
41 | /// The individual queries making up the chart. In most instances, only one query is currently supported
42 | /// here.
43 | ///
44 | public List Queries { get; set; } = new();
45 |
46 | ///
47 | /// How the chart will appear on the dashboard.
48 | ///
49 | public ChartDisplayStylePart DisplayStyle { get; set; } = new();
50 |
51 | ///
52 | /// A short summary of the chart contents.
53 | ///
54 | public string Description { get; set; }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Dashboarding/ChartQueryPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Seq.Api.Model.Shared;
17 | using Seq.Api.Model.Signals;
18 |
19 | namespace Seq.Api.Model.Dashboarding
20 | {
21 | ///
22 | /// A query within a chart.
23 | ///
24 | public class ChartQueryPart
25 | {
26 | ///
27 | /// The unique id assigned to the query.
28 | ///
29 | public string Id { get; set; }
30 |
31 | ///
32 | /// Individual measurements included in the query. These are effectively projected columns.
33 | ///
34 | public List Measurements { get; set; } = new List();
35 |
36 | ///
37 | /// An optional filtering where clause limiting the data that contributes to the chart.
38 | ///
39 | public string Where { get; set; }
40 |
41 | ///
42 | /// An optional limiting the data that contributes to the chart.
43 | ///
44 | public SignalExpressionPart SignalExpression { get; set; }
45 |
46 | ///
47 | /// A series of expressions used to group data returned by the query.
48 | ///
49 | public List GroupBy { get; set; } = new List();
50 |
51 | ///
52 | /// How measurements included in the chart will be displayed.
53 | ///
54 | public MeasurementDisplayStylePart DisplayStyle { get; set; } = new MeasurementDisplayStylePart();
55 |
56 | ///
57 | /// A filter that limits which groups will be displayed on the chart. Not supported by all chart types.
58 | ///
59 | public string Having { get; set; }
60 |
61 | ///
62 | /// An ordering applied to the results of the query; not supported by all chart types.
63 | ///
64 | public List OrderBy { get; set; } = new List();
65 |
66 | ///
67 | /// The row limit used for the query. By default, a server-determined limit will be applied.
68 | ///
69 | public int? Limit { get; set; }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Dashboarding/DashboardEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Seq.Api.Model.Security;
17 | using Seq.Api.Model.Signals;
18 |
19 | namespace Seq.Api.Model.Dashboarding
20 | {
21 | ///
22 | /// A dashboard.
23 | ///
24 | public class DashboardEntity : Entity
25 | {
26 | ///
27 | /// The user who owns the dashboard. If null, the dashboard is shared.
28 | ///
29 | public string OwnerId { get; set; }
30 |
31 | ///
32 | /// The friendly, human-readable title for the dashboard.
33 | ///
34 | public string Title { get; set; }
35 |
36 | ///
37 | /// If true, only users with can modify the dashboard.
38 | ///
39 | public bool IsProtected { get; set; }
40 |
41 | ///
42 | /// An optional that limits the data contributing to the dashboard.
43 | ///
44 | public SignalExpressionPart SignalExpression { get; set; }
45 |
46 | ///
47 | /// The list of charts included in the dashboard.
48 | ///
49 | public List Charts { get; set; } = new List();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Dashboarding/MeasurementDisplayPalette.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Dashboarding
16 | {
17 | ///
18 | /// The color palette used for displaying a measurement on a chart.
19 | ///
20 | public enum MeasurementDisplayPalette
21 | {
22 | ///
23 | /// The default palette.
24 | ///
25 | Default,
26 |
27 | ///
28 | /// A predominantly red palette.
29 | ///
30 | Reds,
31 |
32 | ///
33 | /// A predominantly green palette.
34 | ///
35 | Greens,
36 |
37 | ///
38 | /// A predominantly blue palette.
39 | ///
40 | Blues,
41 |
42 | ///
43 | /// An orange/purple palette.
44 | ///
45 | OrangePurple
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Dashboarding/MeasurementDisplayStylePart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Dashboarding
16 | {
17 | ///
18 | /// How a measurement will be displayed within a chart.
19 | ///
20 | public class MeasurementDisplayStylePart
21 | {
22 | ///
23 | /// The type of display used for the measurement.
24 | ///
25 | public MeasurementDisplayType Type { get; set; } = MeasurementDisplayType.Line;
26 |
27 | ///
28 | /// For line chart measurement display types, whether the area under the line will be filled.
29 | ///
30 | public bool LineFillToZeroY { get; set; }
31 |
32 | ///
33 | /// For line chart measurement display types, whether the points along the line will be visibly marked.
34 | ///
35 | public bool LineShowMarkers { get; set; } = true;
36 |
37 | ///
38 | /// For bar chart measurement display types, whether the sum of all bars will be shown as an overlay.
39 | ///
40 | public bool BarOverlaySum { get; set; }
41 |
42 | ///
43 | /// For heatmap measurement display types, whether the scale is logarithmic.
44 | ///
45 | public bool UseLogarithmicScale { get; set; }
46 |
47 | ///
48 | /// For measurement display types that include a legend, whether the legend will be shown.
49 | ///
50 | public bool SuppressLegend { get; set; }
51 |
52 | ///
53 | /// The color palette used to display the chart.
54 | ///
55 | public MeasurementDisplayPalette Palette { get; set; } = MeasurementDisplayPalette.Default;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Dashboarding/MeasurementDisplayType.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Dashboarding
16 | {
17 | ///
18 | /// The method used to visually represent a measurement.
19 | ///
20 | public enum MeasurementDisplayType
21 | {
22 | ///
23 | /// A line chart. Requires the measurement and query to include a time axis.
24 | ///
25 | Line,
26 |
27 | ///
28 | /// A bar chart.
29 | ///
30 | Bar,
31 |
32 | ///
33 | /// A point (scatter) chart.
34 | ///
35 | Point,
36 |
37 | ///
38 | /// A single textual value. Requires that the measurement and query produce a single value.
39 | ///
40 | Value,
41 |
42 | ///
43 | /// A (donut-styled) pie chart.
44 | ///
45 | Pie,
46 |
47 | ///
48 | /// A table of raw data values.
49 | ///
50 | Table,
51 |
52 | ///
53 | /// A heatmap chart.
54 | ///
55 | Heatmap,
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Data/ColumnMetadataPart.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Seq.Api.Model.Data
4 | {
5 | ///
6 | /// The metadata that can be reported for a column.
7 | ///
8 | public class ColumnMetadataPart
9 | {
10 | ///
11 | /// The error value for a column that is a `Bucket` expression.
12 | ///
13 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
14 | public decimal? BucketErrorParameter { get; set; }
15 |
16 | ///
17 | /// The time grouping in ticks.
18 | ///
19 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
20 | public decimal? IntervalTicks { get; set; }
21 | }
22 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Data/QueryExecutionStatisticsPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Data
16 | {
17 | ///
18 | /// Information describing the execution of a SQL-style query.
19 | ///
20 | public class QueryExecutionStatisticsPart
21 | {
22 | ///
23 | /// The server-side elapsed time taken to compute the query result.
24 | ///
25 | public double ElapsedMilliseconds { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Data/QueryResultPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Newtonsoft.Json;
17 |
18 | namespace Seq.Api.Model.Data
19 | {
20 | ///
21 | /// The result of executing a SQL-style query. Results are hierarchical, rather
22 | /// than tabular, to reduce the amount of data transfer required to send events to
23 | /// the client.
24 | ///
25 | ///
26 | /// Only one of , , or
27 | /// will be present for a given result set.
28 | /// Generally, the CSV-based query endpoints are more convenient to use for
29 | /// simple ETL tasks.
30 | public class QueryResultPart
31 | {
32 | ///
33 | /// The columns within the result set (at various levels of the hierarchy).
34 | ///
35 | public string[] Columns { get; set; }
36 |
37 | ///
38 | /// Metadata, grouped by column.
39 | ///
40 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
41 | public Dictionary ColumnMetadata { get; set; }
42 |
43 | ///
44 | /// Metadata for the time grouping column.
45 | ///
46 | public ColumnMetadataPart TimeColumnMetadata { get; set; }
47 |
48 | ///
49 | /// Result rows.
50 | ///
51 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
52 | public object[][] Rows { get; set; }
53 |
54 | ///
55 | /// Result time slices.
56 | ///
57 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
58 | public TimeSlicePart[] Slices { get; set; }
59 |
60 | ///
61 | /// Result timeseries.
62 | ///
63 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
64 | public TimeseriesPart[] Series { get; set; }
65 |
66 | ///
67 | /// Result variables.
68 | ///
69 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
70 | public Dictionary Variables { get; set; }
71 |
72 | ///
73 | /// On error only, a description of the error.
74 | ///
75 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
76 | public string Error { get; set; }
77 |
78 | ///
79 | /// Reasons for the .
80 | ///
81 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
82 | public string[] Reasons { get; set; }
83 |
84 | ///
85 | /// A corrected version of the query, if one could be suggested.
86 | ///
87 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
88 | public string Suggestion { get; set; }
89 |
90 | ///
91 | /// Execution statistics.
92 | ///
93 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
94 | public QueryExecutionStatisticsPart Statistics { get; set; }
95 | }
96 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Data/TimeSlicePart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Data
16 | {
17 | ///
18 | /// Results of a query for a given time slice.
19 | ///
20 | public class TimeSlicePart
21 | {
22 | ///
23 | /// The beginning of the interval contributing to the results,
24 | /// encoded as an ISO-8601 date/time string.
25 | ///
26 | public string Time { get; set; }
27 |
28 | ///
29 | /// Result rows within the interval.
30 | ///
31 | public object[][] Rows { get; set; }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Data/TimeseriesPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Data
16 | {
17 | ///
18 | /// A series of results.
19 | ///
20 | public class TimeseriesPart
21 | {
22 | ///
23 | /// The key (e.g. grouping columns) that identify the timeseries.
24 | ///
25 | public object[] Key { get; set; }
26 |
27 | ///
28 | /// The timestamped slices in the series.
29 | ///
30 | public TimeSlicePart[] Slices { get; set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Diagnostics/ClusterMetricsPart.cs:
--------------------------------------------------------------------------------
1 | namespace Seq.Api.Model.Diagnostics
2 | {
3 | ///
4 | /// Metrics related to cluster activity.
5 | ///
6 | public class ClusterMetricsPart
7 | {
8 | ///
9 | /// Construct a .
10 | ///
11 | public ClusterMetricsPart()
12 | {
13 | }
14 |
15 | ///
16 | /// A connection to the leader node was accepted.
17 | ///
18 | public ulong ConnectionAccepted { get; set; }
19 |
20 | ///
21 | /// A connection to the leader node was rejected due to an invalid authentication key.
22 | ///
23 | public ulong ConnectionInvalidKey { get; set; }
24 |
25 | ///
26 | /// A connection to the leader node was successfully authenticated and established.
27 | ///
28 | public ulong ConnectionEstablished { get; set; }
29 |
30 | ///
31 | /// A connection to the leader node was could not be established.
32 | ///
33 | public ulong ConnectionNotEstablished { get; set; }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Diagnostics/MeasurementTimeseriesPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Seq.Api.Model.Diagnostics
18 | {
19 | ///
20 | /// A histogram presenting a measurement taken at equal intervals.
21 | ///
22 | public class MeasurementTimeseriesPart
23 | {
24 | ///
25 | /// The point in time from which measurement begins.
26 | ///
27 | public DateTime MeasuredFrom { get; set; }
28 |
29 | ///
30 | /// The interval at which the measurement is taken.
31 | ///
32 | public ulong MeasurementIntervalMilliseconds { get; set; }
33 |
34 | ///
35 | /// The measurements at each interval, beginning with .
36 | ///
37 | public long[] Measurements { get; set; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Diagnostics/ServerMetricsPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Seq.Api.Model.Diagnostics
18 | {
19 | ///
20 | /// Metrics describing the state and performance of the Seq server.
21 | ///
22 | /// This information is not preserved across server restarts or fail-over.
23 | public class ServerMetricsPart
24 | {
25 | ///
26 | /// Construct a .
27 | ///
28 | public ServerMetricsPart()
29 | {
30 | }
31 |
32 | ///
33 | /// Bytes of free space remaining on the disk used for event storage.
34 | ///
35 | public long? EventStoreDiskRemainingBytes { get; set; }
36 |
37 | ///
38 | /// The total time spent indexing the event store in the last 24 hours.
39 | ///
40 | public TimeSpan EventStoreIndexingTimeLastDay { get; set; }
41 |
42 | ///
43 | /// The total time spent writing events to disk in the last minute.
44 | ///
45 | public TimeSpan EventStoreWriteTimeLastMinute { get; set; }
46 |
47 | ///
48 | /// The number of events that arrived at the ingestion endpoint in the past minute.
49 | ///
50 | public int InputArrivedEventsPerMinute { get; set; }
51 |
52 | ///
53 | /// The number of events ingested in the past minute.
54 | ///
55 | public int InputIngestedEventsPerMinute { get; set; }
56 |
57 | ///
58 | /// The number of bytes of raw JSON event data ingested in the past minute (approximate).
59 | ///
60 | public long InputIngestedBytesPerMinute { get; set; }
61 |
62 | ///
63 | /// The number of invalid event payloads seen in the past minute.
64 | ///
65 | public int InvalidPayloadsPerMinute { get; set; }
66 |
67 | ///
68 | /// The number of unauthorized event payloads seen in the past minute.
69 | ///
70 | public int HttpUnauthorizedPayloadsPerMinute { get; set; }
71 |
72 | ///
73 | /// The length of time for which the Seq server process has been running.
74 | ///
75 | public TimeSpan ProcessUptime { get; set; }
76 |
77 | ///
78 | /// The number of threads running in the Seq server process.
79 | ///
80 | public int ProcessThreads { get; set; }
81 |
82 | ///
83 | /// The number of queries and searches executed in the past minute.
84 | ///
85 | public int QueriesPerMinute { get; set; }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Diagnostics/ServerStatusPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Diagnostics
16 | {
17 | ///
18 | /// Describes the status of the Seq server.
19 | ///
20 | public class ServerStatusPart
21 | {
22 | ///
23 | /// Individual status messages.
24 | ///
25 | public StatusMessagePart[] StatusMessages { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Diagnostics/StatusMessagePart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Diagnostics
16 | {
17 | ///
18 | /// A status message relating to the Seq server.
19 | ///
20 | public class StatusMessagePart
21 | {
22 | ///
23 | /// A descriptive level (Information, Warning, or Error).
24 | ///
25 | public string Level { get; set; }
26 |
27 | ///
28 | /// The message text.
29 | ///
30 | public string Message { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Diagnostics/Storage/ColumnDescriptionPart.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Seq.Api.Model.Diagnostics.Storage
4 | {
5 | ///
6 | /// A description of a column in a rowset.
7 | ///
8 | public readonly struct ColumnDescriptionPart
9 | {
10 | ///
11 | /// A label for the column.
12 | ///
13 | public string Label { get; }
14 |
15 | ///
16 | /// Additional metadata describing the role of the column; this is separate from,
17 | /// but related to, the runtime type of the column values.
18 | ///
19 | public ColumnType Type { get; }
20 |
21 | ///
22 | /// Construct a .
23 | ///
24 | /// A label for the column.
25 | /// Additional metadata describing the role of the column; this is separate from,
26 | /// but related to, the runtime type of the column values.
27 | public ColumnDescriptionPart(string label, ColumnType type)
28 | {
29 | Label = label ?? throw new ArgumentNullException(nameof(label));
30 | Type = type;
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Diagnostics/Storage/ColumnType.cs:
--------------------------------------------------------------------------------
1 | namespace Seq.Api.Model.Diagnostics.Storage
2 | {
3 | ///
4 | /// Additional metadata describing the role of a column; this is separate from,
5 | /// but related to, the runtime type of the column values.
6 | ///
7 | public enum ColumnType
8 | {
9 | ///
10 | /// The column contains general data.
11 | ///
12 | General,
13 |
14 | ///
15 | /// The column contains timestamps that may be used to create a timeseries.
16 | ///
17 | Timestamp,
18 | }
19 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Diagnostics/Storage/RowsetPart.cs:
--------------------------------------------------------------------------------
1 | namespace Seq.Api.Model.Diagnostics.Storage
2 | {
3 | ///
4 | /// Values in rows and columns.
5 | ///
6 | public class RowsetPart
7 | {
8 | ///
9 | /// The columns of the rowset.
10 | ///
11 | public ColumnDescriptionPart[] Columns { get; set; }
12 |
13 | ///
14 | /// An array of rows, where each row is an array of values
15 | /// corresponding to the columns of the rowset.
16 | ///
17 | public object[][] Rows { get; set; }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Diagnostics/Storage/StorageConsumptionPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Seq.Api.Model.Shared;
16 |
17 | namespace Seq.Api.Model.Diagnostics.Storage
18 | {
19 | ///
20 | /// Describes storage space consumed by the event store, for a range
21 | /// of event timestamps.
22 | ///
23 | public class StorageConsumptionPart
24 | {
25 | ///
26 | /// The range of timestamps covered by the result.
27 | ///
28 | public DateTimeRangePart Range { get; set; }
29 |
30 | ///
31 | /// The available range of timestamps.
32 | ///
33 | public DateTimeRangePart FullRange { get; set; }
34 |
35 | ///
36 | /// The duration of the timestamp interval covered by each result.
37 | ///
38 | public uint IntervalSeconds { get; set; }
39 |
40 | ///
41 | /// The file interval of the underlying storage.
42 | ///
43 | public uint TickIntervalSeconds { get; set; }
44 |
45 | ///
46 | /// A potentially-sparse rowset describing the storage space consumed
47 | /// for a range of timestamp intervals.
48 | ///
49 | public RowsetPart Results { get; set; }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Entity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using Newtonsoft.Json;
18 | using Newtonsoft.Json.Linq;
19 |
20 | namespace Seq.Api.Model
21 | {
22 | ///
23 | /// A uniquely-identifiable resource available from the Seq HTTP API.
24 | ///
25 | /// Entities are the persistent top-level resources that have a stable
26 | /// URI. The API client uses the contrasting suffix *Part to designate
27 | /// resources that are transient or not directly addressable.
28 | public abstract class Entity : ILinked
29 | {
30 | ///
31 | /// Construct an .
32 | ///
33 | protected Entity()
34 | {
35 | Links = new LinkCollection();
36 | }
37 |
38 | ///
39 | /// The entity's unique identifier. This will be null if a newly-instantiated
40 | /// has not yet been sent to the server.
41 | ///
42 | public string Id { get; set; }
43 |
44 | ///
45 | /// A collection of outbound links from the entity. This will be empty if the entity
46 | /// was instantiated locally and not received from the API.
47 | ///
48 | public LinkCollection Links { get; set; }
49 |
50 | ///
51 | /// Facilitates backwards compatibility in the Seq server. Should not be used by consumers/clients.
52 | ///
53 | [JsonExtensionData, JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
54 | [Obsolete("Facilitates backwards compatibility in the Seq server. Should not be used by consumers/clients.")]
55 | public Dictionary ExtensionData { get; set; }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Events/DeleteResultPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Events
16 | {
17 | ///
18 | /// The (empty) result of executing a deletion request.
19 | ///
20 | public class DeleteResultPart
21 | {
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Events/EventInputResultPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Seq.Api.Model.LogEvents;
16 |
17 | namespace Seq.Api.Model.Events
18 | {
19 | ///
20 | /// The information returned from ingesting a batch of events.
21 | ///
22 | public class EventInputResultPart
23 | {
24 | ///
25 | /// The minimum level at which events will be accepted by the
26 | /// server.
27 | ///
28 | public LogEventLevel? MinimumLevelAccepted { get; set; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Events/MessageTemplateTokenPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Newtonsoft.Json;
16 |
17 | namespace Seq.Api.Model.Events
18 | {
19 | ///
20 | /// A token parsed from a message template.
21 | ///
22 | public class MessageTemplateTokenPart
23 | {
24 | ///
25 | /// Plain text, if the token is a text token.
26 | ///
27 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
28 | public string Text { get; set; }
29 |
30 | ///
31 | /// The name of the property to be rendered in place of the token, if a property token.
32 | ///
33 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
34 | public string PropertyName { get; set; }
35 |
36 | ///
37 | /// The raw source text from the message template (provided for both text and property tokens).
38 | ///
39 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
40 | public string RawText { get; set; }
41 |
42 | ///
43 | /// A pre-formatted value, if the token carries language-specific formatting directives.
44 | ///
45 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
46 | public string FormattedValue { get; set; }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Events/ResultSetPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Seq.Api.Model.Shared;
17 |
18 | namespace Seq.Api.Model.Events
19 | {
20 | ///
21 | /// The result of a request for events matching a filter or signal.
22 | ///
23 | public class ResultSetPart
24 | {
25 | ///
26 | /// Matching events.
27 | ///
28 | public List Events { get; set; }
29 |
30 | ///
31 | /// Statistics describing the server resources used to construct the
32 | /// result set.
33 | ///
34 | public StatisticsPart Statistics { get; set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Expressions/ExpressionPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Expressions
16 | {
17 | ///
18 | /// Information about a filter expression.
19 | ///
20 | public class ExpressionPart
21 | {
22 | ///
23 | /// The expression in strict syntax.
24 | ///
25 | public string StrictExpression { get; set; }
26 |
27 | ///
28 | /// Whether the expression was considered to be a free text search.
29 | ///
30 | public bool MatchedAsText { get; set; }
31 |
32 | ///
33 | /// If is true, the reason that the
34 | /// expression was not considered a valid structured expression.
35 | ///
36 | public string ReasonIfMatchedAsText { get; set; }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Expressions/SqlExpressionPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Expressions
16 | {
17 | ///
18 | /// Describes an expression in strict SQL-style syntax.
19 | ///
20 | public class SqlExpressionPart
21 | {
22 | ///
23 | /// The expression in SQL-style syntax.
24 | ///
25 | public string Expression { get; set; }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Feeds/NuGetFeedEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Feeds
16 | {
17 | ///
18 | /// A NuGet feed.
19 | ///
20 | public class NuGetFeedEntity : Entity
21 | {
22 | ///
23 | /// The feed name.
24 | ///
25 | public string Name { get; set; }
26 |
27 | ///
28 | /// A URI or folder path at which the feed is located.
29 | ///
30 | public string Location { get; set; }
31 |
32 | ///
33 | /// If required, a username that will be sent when accessing the feed.
34 | ///
35 | public string Username { get; set; }
36 |
37 | ///
38 | /// When is non-empty, can be used to set an associated
39 | /// password.
40 | ///
41 | public string NewPassword { get; set; }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/ILinked.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model
16 | {
17 | ///
18 | /// A resource that carries outbound links.
19 | ///
20 | public interface ILinked
21 | {
22 | ///
23 | /// Links associated with the resource.
24 | ///
25 | LinkCollection Links { get; }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Indexes/IndexEntity.cs:
--------------------------------------------------------------------------------
1 | namespace Seq.Api.Model.Indexes
2 | {
3 | ///
4 | /// An index over the event stream. May be one of several types discriminated by .
5 | ///
6 | public class IndexEntity: Entity
7 | {
8 | ///
9 | /// The `Id` of the associated entity (Signal, Alert or Expression index).
10 | ///
11 | public string IndexedEntityId { get; set; }
12 |
13 | ///
14 | /// The type of this index.
15 | ///
16 | public IndexedEntityType IndexedEntityType { get; set; }
17 |
18 | ///
19 | /// The owner / creator of this index.
20 | ///
21 | public string OwnerUsername { get; set; }
22 |
23 | ///
24 | /// The name of this index. May not be applicable to all index types.
25 | ///
26 | public string Label { get; set; }
27 |
28 | ///
29 | /// The storage used by this index.
30 | ///
31 | public ulong StorageBytes { get; set; }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Indexes/IndexedEntityType.cs:
--------------------------------------------------------------------------------
1 | namespace Seq.Api.Model.Indexes
2 | {
3 | ///
4 | /// The type of the index.
5 | ///
6 | public enum IndexedEntityType
7 | {
8 | ///
9 | /// A predicate index for a signal expression.
10 | ///
11 | Signal,
12 |
13 | ///
14 | /// An expression index.
15 | ///
16 | ExpressionIndex,
17 |
18 | ///
19 | /// A predicate index for an alert filter.
20 | ///
21 | Alert,
22 | }
23 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Indexing/ExpressionIndexEntity.cs:
--------------------------------------------------------------------------------
1 | namespace Seq.Api.Model.Indexing
2 | {
3 | ///
4 | /// An index based on an expression.
5 | ///
6 | public class ExpressionIndexEntity: Entity
7 | {
8 | ///
9 | /// The expression to be indexed.
10 | ///
11 | public string Expression { get; set; }
12 |
13 | ///
14 | /// A user-provided description of the index.
15 | ///
16 | public string Description { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Inputs/ApiKeyEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Newtonsoft.Json;
17 | using Seq.Api.Model.Security;
18 |
19 | namespace Seq.Api.Model.Inputs
20 | {
21 | ///
22 | /// API keys can be used to authenticate and identify log event sources, and for
23 | /// users to delegate some or all permissions to a client of the Seq API (app or integration) without exposing
24 | /// user credentials.
25 | ///
26 | public class ApiKeyEntity : Entity
27 | {
28 | ///
29 | /// A friendly human-readable description of the API key.
30 | ///
31 | public string Title { get; set; }
32 |
33 | ///
34 | /// The API key token. can be specified explicitly when creating an API key, but is not
35 | /// readable once the API key is created. Leaving the token blank will cause the server to generate a
36 | /// cryptographically random API key token. After creation, the first few (additional, redundant) characters
37 | /// of the token will be readable from , but because only a cryptographically-secure
38 | /// hash of the token is stored internally, the token itself cannot be retrieved.
39 | ///
40 | public string Token { get; set; }
41 |
42 | ///
43 | /// A few characters from the start of the stored as plain text, to aid in identifying tokens.
44 | ///
45 | public string TokenPrefix { get; set; }
46 |
47 | ///
48 | /// Settings that control how events are ingested through the API key.
49 | ///
50 | public InputSettingsPart InputSettings { get; set; } = new InputSettingsPart();
51 |
52 | ///
53 | /// If true, the key is the built-in (tokenless) API key representing unauthenticated HTTP ingestion.
54 | ///
55 | public bool IsDefault { get; set; }
56 |
57 | ///
58 | /// If non-null, the id of the user for whom this is a personal API key.
59 | ///
60 | public string OwnerId { get; set; }
61 |
62 | ///
63 | /// The s assigned to the API key. Note that, if the API key is owned by an individual user, permissions
64 | /// not held by the user will be ignored by the server.
65 | ///
66 | public HashSet AssignedPermissions { get; set; } = new HashSet();
67 |
68 | ///
69 | /// Information about the ingestion activity using this API key.
70 | ///
71 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
72 | public InputMetricsPart InputMetrics { get; set; } = new InputMetricsPart();
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Inputs/InputMetricsPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Inputs
16 | {
17 | ///
18 | /// Information about ingestion activity using an API key.
19 | ///
20 | public class InputMetricsPart
21 | {
22 | ///
23 | /// The number of events that arrived at the server from this input in the past minute.
24 | ///
25 | public int ArrivedEventsPerMinute { get; set; }
26 |
27 | ///
28 | /// The number of events that ingested by the server from this input in the past minute.
29 | ///
30 | public int IngestedEventsPerMinute { get; set; }
31 |
32 | ///
33 | /// The raw JSON bytes (approximate) from this input that were ingested
34 | /// by the server in the past minute.
35 | ///
36 | public long IngestedBytesPerMinute { get; set; }
37 |
38 | ///
39 | /// The number of invalid payloads reaching this input in the past minute. Invalid payloads includes malformed
40 | /// and oversized JSON event bodies, as well as malformed or oversized batches.
41 | ///
42 | public long InvalidPayloadsPerMinute { get; set; }
43 | }
44 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Inputs/InputSettingsPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Seq.Api.Model.LogEvents;
17 | using Seq.Api.Model.Shared;
18 |
19 | namespace Seq.Api.Model.Inputs
20 | {
21 | ///
22 | /// Settings carried by API keys, (input) app instances, and other inputs.
23 | ///
24 | public class InputSettingsPart
25 | {
26 | ///
27 | /// Properties that will be automatically added to all events ingested using the key. These will override any properties with
28 | /// the same names already present on the event.
29 | ///
30 | public List AppliedProperties { get; set; } = new List();
31 |
32 | ///
33 | /// A filter that selects events to ingest. If null, all events received using the key will be ingested.
34 | ///
35 | public DescriptiveFilterPart Filter { get; set; } = new DescriptiveFilterPart();
36 |
37 | ///
38 | /// A minimum level at which events received using the key will be ingested. The level hierarchy understood by Seq is fuzzy
39 | /// enough to handle most common leveling schemes. This value will be provided to callers so that they can dynamically
40 | /// filter events client-side, if supported.
41 | ///
42 | public LogEventLevel? MinimumLevel { get; set; }
43 |
44 | ///
45 | /// If true, timestamps already present on the events will be ignored, and server timestamps used instead. This is not
46 | /// recommended for most use cases.
47 | ///
48 | public bool UseServerTimestamps { get; set; }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/License/LicenseEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.License
16 | {
17 | ///
18 | /// A Seq license certificate.
19 | ///
20 | public class LicenseEntity : Entity
21 | {
22 | ///
23 | /// The cryptographically-signed certificate that describes the
24 | /// license, or null if the server is using the default license.
25 | ///
26 | public string LicenseText { get; set; }
27 |
28 | ///
29 | /// Whether or not the license is valid for the server.
30 | ///
31 | public bool IsValid { get; set; }
32 |
33 | ///
34 | /// If true, the server is using the default license which allows
35 | /// a single person to access the Seq server.
36 | ///
37 | public bool IsSingleUser { get; set; }
38 |
39 | ///
40 | /// If the license is a subscription, the subscription id.
41 | ///
42 | public string SubscriptionId { get; set; }
43 |
44 | ///
45 | /// Information about the status of the license.
46 | ///
47 | public string StatusDescription { get; set; }
48 |
49 | ///
50 | /// If true, see for important information.
51 | ///
52 | public bool IsWarning { get; set; }
53 |
54 | ///
55 | /// If true, the license can be renewed online.
56 | ///
57 | public bool CanRenewOnlineNow { get; set; }
58 |
59 | ///
60 | /// The number of users licensed to access the Seq server, or null if
61 | /// the license has no user limit.
62 | ///
63 | public int? LicensedUsers { get; set; }
64 |
65 | ///
66 | /// If the license is for a subscription, automatically check datalust.co and
67 | /// update the license when the subscription is renewed or tier changed.
68 | ///
69 | public bool AutomaticallyRefresh { get; set; }
70 |
71 | ///
72 | /// The amount of storage (in gigabytes) that Seq is licensed to store.
73 | ///
74 | public int? StorageLimitGigabytes { get; set; }
75 |
76 | ///
77 | /// If true, the license supports running Seq in a HA configuration.
78 | ///
79 | public bool Clustered { get; set; }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Link.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using Tavis.UriTemplates;
19 |
20 | // ReSharper disable PossibleMultipleEnumeration
21 |
22 | namespace Seq.Api.Model
23 | {
24 | ///
25 | /// A hypermedia link. A link is an RFC 6570 URI template that can be
26 | /// parameterized in order to produce a complete URI (if the template contains no
27 | /// parameters then it may also be a literal URI).
28 | ///
29 | public readonly struct Link
30 | {
31 | ///
32 | /// An empty link.
33 | ///
34 | public static Link Empty { get; } = default;
35 |
36 | ///
37 | /// Construct a link.
38 | ///
39 | /// The URI template.
40 | public Link(string template)
41 | {
42 | Template = template ?? throw new ArgumentNullException(nameof(template));
43 | }
44 |
45 | ///
46 | /// Get the unprocessed URI template.
47 | ///
48 | public string Template { get; }
49 |
50 | ///
51 | /// Parameterize the link to construct a URI.
52 | ///
53 | /// Parameters to substitute into the template, if any.
54 | /// A constructed URI.
55 | /// This method ensures that templates containing parameters cannot be accidentally
56 | /// used as URIs.
57 | public string GetUri(IDictionary parameters = null)
58 | {
59 | if (Template == null) throw new InvalidOperationException("Attempted to process an empty URI template.");
60 |
61 | var template = new UriTemplate(Template);
62 | if (parameters != null)
63 | {
64 | var missing = parameters.Select(p => p.Key).Except(template.GetParameterNames());
65 | if (missing.Any())
66 | throw new ArgumentException($"The URI template `{Template}` does not contain parameter: `{string.Join("`, `", missing)}`.");
67 |
68 | foreach (var parameter in parameters)
69 | {
70 | var value = parameter.Value is DateTime time
71 | ? time.ToString("O")
72 | : parameter.Value;
73 |
74 | template.SetParameter(parameter.Key, value);
75 | }
76 | }
77 |
78 | return template.Resolve();
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/LinkCollection.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using Newtonsoft.Json;
18 | using Seq.Api.Serialization;
19 |
20 | namespace Seq.Api.Model
21 | {
22 | ///
23 | /// A collection of s indexed by case-insensitive name.
24 | ///
25 | [JsonConverter(typeof(LinkCollectionConverter))]
26 | public class LinkCollection : Dictionary
27 | {
28 | ///
29 | /// Construct a .
30 | ///
31 | public LinkCollection() : base(StringComparer.OrdinalIgnoreCase) { }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/LogEvents/LogEventLevel.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.LogEvents
16 | {
17 | ///
18 | /// Specifies the meaning and relative importance of a log event.
19 | ///
20 | public enum LogEventLevel
21 | {
22 | ///
23 | /// Anything and everything you might want to know about
24 | /// a running block of code.
25 | ///
26 | Verbose,
27 |
28 | ///
29 | /// Internal system events that aren't necessarily
30 | /// observable from the outside.
31 | ///
32 | Debug,
33 |
34 | ///
35 | /// The lifeblood of operational intelligence - things
36 | /// happen.
37 | ///
38 | Information,
39 |
40 | ///
41 | /// Service is degraded or endangered.
42 | ///
43 | Warning,
44 |
45 | ///
46 | /// Functionality is unavailable, invariants are broken
47 | /// or data is lost.
48 | ///
49 | Error,
50 |
51 | ///
52 | /// If you have a pager, it goes off when one of these
53 | /// occurs.
54 | ///
55 | Fatal
56 | }
57 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Permalinks/PermalinkEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using Newtonsoft.Json;
17 | using Seq.Api.Model.Events;
18 | using Seq.Api.ResourceGroups;
19 |
20 | namespace Seq.Api.Model.Permalinks
21 | {
22 | ///
23 | /// A permanently preserved event with a stable URI.
24 | ///
25 | public class PermalinkEntity : Entity
26 | {
27 | ///
28 | /// When retrieving an event that may be permalinked (backwards compatibility),
29 | /// this hint is given by specifying `permalinkId=unknown` in the API call.
30 | ///
31 | public const string UnknownId = "unknown";
32 |
33 | ///
34 | /// The owner of the permalink.
35 | ///
36 | public string OwnerId { get; set; }
37 |
38 | ///
39 | /// The original id of the permalinked event.
40 | ///
41 | public string EventId { get; set; }
42 |
43 | ///
44 | /// When the permalink was created.
45 | ///
46 | public DateTime CreatedUtc { get; set; }
47 |
48 | ///
49 | /// The event itself. Only populated when explicitly requested from the API.
50 | /// See .
51 | ///
52 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
53 | public EventEntity Event { get; set; }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/ResourceGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model
16 | {
17 | ///
18 | /// A resource group is a logical partitioning of the API, usually
19 | /// associated with a particular type of entity.
20 | ///
21 | public class ResourceGroup : ILinked
22 | {
23 | ///
24 | /// Construct a .
25 | ///
26 | public ResourceGroup()
27 | {
28 | Links = new LinkCollection();
29 | }
30 |
31 | ///
32 | public LinkCollection Links { get; set; }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Retention/RetentionPolicyEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using Newtonsoft.Json;
17 | using Seq.Api.Model.Signals;
18 |
19 | namespace Seq.Api.Model.Retention
20 | {
21 | ///
22 | /// A retention policy. Identifies a subset of events to delete at a specified age.
23 | ///
24 | public class RetentionPolicyEntity : Entity
25 | {
26 | ///
27 | /// The age at which events will be deleted by the policy. This is based on the
28 | /// events' timestamps relative to the server's clock.
29 | ///
30 | public TimeSpan RetentionTime { get; set; }
31 |
32 | ///
33 | /// An optional describing the set of events
34 | /// to delete. If null, the policy will efficiently truncate the event store,
35 | /// deleting all events.
36 | ///
37 | public SignalExpressionPart RemovedSignalExpression { get; set; }
38 |
39 | ///
40 | /// Obsolete.
41 | ///
42 | [Obsolete("Replaced by RemovedSignalExpression."),
43 | JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
44 | public string SignalId { get; set; }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Root/RootEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Newtonsoft.Json;
17 |
18 | namespace Seq.Api.Model.Root
19 | {
20 | ///
21 | /// Information about the API exposed by the server.
22 | ///
23 | public class RootEntity : ILinked
24 | {
25 | ///
26 | /// Construct a .
27 | ///
28 | public RootEntity()
29 | {
30 | Links = new LinkCollection();
31 | }
32 |
33 | ///
34 | /// The product serving the API.
35 | ///
36 | public string Product { get; set; }
37 |
38 | ///
39 | /// The version of the product serving the API.
40 | ///
41 | public string Version { get; set; }
42 |
43 | ///
44 | /// An informational name identifying the instance.
45 | ///
46 | public string InstanceName { get; set; }
47 |
48 | ///
49 | /// A list of non-default features enabled on this server. Normally, null unless
50 | /// an administrator has explicitly opted-into alpha or beta-level features.
51 | ///
52 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
53 | public List EnabledFeatures { get; set; }
54 |
55 | ///
56 | /// Links to resources exposed by the API.
57 | ///
58 | public LinkCollection Links { get; set; }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Security/Permission.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Seq.Api.Model.Security
18 | {
19 | ///
20 | /// A permission is an access right 1) held by a principal, and 2) demanded by an endpoint. Permissions
21 | /// may be broad, such as the permission to modify administrative settings, or narrow (e.g. currently the
22 | /// permission to ingest events).
23 | ///
24 | public enum Permission
25 | {
26 | ///
27 | /// A sentinel value to detect uninitialized permissions.
28 | ///
29 | Undefined,
30 |
31 | ///
32 | /// Access to publicly-visible assets - the API root/metadata, HTML, JavaScript, CSS, information necessary
33 | /// to initiate the login process, and so-on.
34 | ///
35 | Public,
36 |
37 | ///
38 | /// Add events to the event store.
39 | ///
40 | Ingest,
41 |
42 | ///
43 | /// Query events, dashboards, signals, app instances.
44 | ///
45 | Read,
46 |
47 | ///
48 | /// Write-access to signals, alerts, preferences etc.
49 | ///
50 | Write,
51 |
52 | ///
53 | /// Access to administrative features of Seq, management of other users, app installation, backups.
54 | ///
55 | [Obsolete("The `Setup` permission has been replaced by `Project` and `System`.")]
56 | Setup,
57 |
58 | ///
59 | /// Access to settings that control data ingestion, storage, dashboarding and alerting.
60 | ///
61 | Project,
62 |
63 | ///
64 | /// Access to settings and features that interact with, or provide access to, the underlying host server,
65 | /// such as app (plug-in) installation, backup settings, cluster configuration, diagnostics, and features
66 | /// relying on outbound network access like package feeds and update checks. This permission is required for
67 | /// configuration of the authentication provider and related settings.
68 | ///
69 | System,
70 |
71 | ///
72 | /// Create, edit, and delete user accounts, reset local user passwords.
73 | ///
74 | Organization
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Security/RoleEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 |
17 | namespace Seq.Api.Model.Security
18 | {
19 | ///
20 | /// A role is a set of permissions designed to support a particular type of user.
21 | ///
22 | public class RoleEntity : Entity
23 | {
24 | ///
25 | /// The name of the role.
26 | ///
27 | public string Title { get; set; }
28 |
29 | ///
30 | /// Permissions granted to users in the role.
31 | ///
32 | public HashSet Permissions { get; set; } = new();
33 |
34 | ///
35 | /// Optionally, an extended description of the role.
36 | ///
37 | public string Description { get; set; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Security/WellKnownRole.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Seq.Api.Model.Security
18 | {
19 | ///
20 | /// Obsolete.
21 | ///
22 | [Obsolete("It's recommended that new code look up roles by name in `SeqConnection.Roles`.")]
23 | public static class WellKnownRole
24 | {
25 | ///
26 | /// Obsolete.
27 | ///
28 | public const string AdministratorRoleId = "role-administrator";
29 |
30 | ///
31 | /// Obsolete.
32 | ///
33 | public const string UserRoleId = "role-user";
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Settings/InternalErrorReportingSettingsPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Settings
16 | {
17 | ///
18 | /// Settings for internal error reporting.
19 | ///
20 | public class InternalErrorReportingSettingsPart
21 | {
22 | ///
23 | /// If true, redacted internal error reports will be sent
24 | /// automatically to Datalust.
25 | ///
26 | public bool InternalErrorReportingEnabled { get; set; }
27 |
28 | ///
29 | /// If internal error reporting is enabled, an optional email address
30 | /// that will be attached to error reports so that the support team
31 | /// at Datalust can respond with fix/mitigation information.
32 | ///
33 | public string ReplyEmail { get; set; }
34 |
35 | ///
36 | /// If true, anonymized usage telemetry will be sent
37 | /// automatically to Datalust.
38 | ///
39 | public bool UsageTelemetryEnabled { get; set; }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Settings/SettingEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Settings
16 | {
17 | ///
18 | /// A Seq system-level setting. Note that only runtime-modifiable
19 | /// settings are exposed this way. Other configuration options are
20 | /// set using the Seq server command-line.
21 | ///
22 | public class SettingEntity : Entity
23 | {
24 | ///
25 | /// The name of the setting. See for a selection
26 | /// of current values.
27 | ///
28 | public string Name { get; set; }
29 |
30 | ///
31 | /// The value of the setting.
32 | ///
33 | public object Value { get; set; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Shared/DateTimeRange.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Seq.Api.Model.Shared
4 | {
5 | ///
6 | /// A range represented by a start and end .
7 | ///
8 | public readonly struct DateTimeRangePart
9 | {
10 | ///
11 | /// The (inclusive) start of the range.
12 | ///
13 | public DateTime Start { get; }
14 |
15 | ///
16 | /// The (exclusive) end of the range.
17 | ///
18 | public DateTime End { get; }
19 |
20 | ///
21 | /// Construct a .
22 | ///
23 | /// The (inclusive) start of the range.
24 | /// The (exclusive) end of the range.
25 | public DateTimeRangePart(DateTime start, DateTime end)
26 | {
27 | Start = start;
28 | End = end;
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Shared/DeferredRequestEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Shared
16 | {
17 | ///
18 | /// An entity representing a request that will be executed as a long-running (background) task.
19 | /// Includes a link where the result of the request can be accessed.
20 | ///
21 | public class DeferredRequestEntity : Entity
22 | {
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Shared/DescriptiveFilterPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Shared
16 | {
17 | ///
18 | /// An expression-based filter that carries additional descriptive information.
19 | ///
20 | public class DescriptiveFilterPart
21 | {
22 | ///
23 | /// A friendly, human-readable description of the filter.
24 | ///
25 | public string Description { get; set; }
26 |
27 | ///
28 | /// If true, the description identifies events excluded by the filter. The
29 | /// Seq UI uses this to show the description in strikethrough.
30 | ///
31 | public bool DescriptionIsExcluded { get; set; }
32 |
33 | ///
34 | /// The strictly-valid expression language filter that identifies matching events.
35 | ///
36 | public string Filter { get; set; }
37 |
38 | ///
39 | /// The original ("fuzzy") text entered by the user into the filter bar when
40 | /// creating the filter. This may not be syntactically valid, e.g. it may be
41 | /// interpreted as free text - hence while it's displayed in the UI and forms the
42 | /// basis of user editing of the filter, the value is executed.
43 | ///
44 | public string FilterNonStrict { get; set; }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Shared/ErrorPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Shared
16 | {
17 | ///
18 | /// An error returned from the API.
19 | ///
20 | public class ErrorPart
21 | {
22 | ///
23 | /// The error message.
24 | ///
25 | public string Error { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Shared/EvaluationContextPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Seq.Api.Model.Signals;
17 |
18 | #nullable enable
19 |
20 | namespace Seq.Api.Model.Shared
21 | {
22 | ///
23 | /// Specifies the context that queries and searches execute within.
24 | ///
25 | public class EvaluationContextPart
26 | {
27 | ///
28 | /// An unsaved or modified signal.
29 | ///
30 | public SignalEntity? Signal { get; set; }
31 |
32 | ///
33 | /// Values for free variables that appear in the query or search condition.
34 | ///
35 | /// Variables will only be visible in the query or search being executed: any free variables
36 | /// in signal filters will remain undefined.
37 | public Dictionary? Variables { get; set; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Shared/EventPropertyPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 |
17 | // ReSharper disable MemberCanBePrivate.Global
18 |
19 | namespace Seq.Api.Model.Shared
20 | {
21 | ///
22 | /// A name/value property associated with an event.
23 | ///
24 | public class EventPropertyPart
25 | {
26 | ///
27 | /// Construct an .
28 | ///
29 | /// The property name (required).
30 | /// The property value, or null.
31 | public EventPropertyPart(string name, object value)
32 | {
33 | Name = name ?? throw new ArgumentNullException(nameof(name));
34 | Value = value;
35 | }
36 |
37 | ///
38 | /// The property name (required).
39 | ///
40 | public string Name { get; }
41 |
42 | ///
43 | /// The property value, or null.
44 | ///
45 | public object Value { get; }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Shared/GroupingColumnPart.cs:
--------------------------------------------------------------------------------
1 | namespace Seq.Api.Model.Shared
2 | {
3 | ///
4 | /// A column appearing within a group-by clause.
5 | ///
6 | public class GroupingColumnPart
7 | {
8 | ///
9 | /// The expression (selected column) that computes the value of the measurement.
10 | ///
11 | public string Value { get; set; }
12 |
13 | ///
14 | /// An optional label for the measurement (effectively the right-hand size of an as clause).
15 | ///
16 | public string Label { get; set; }
17 |
18 | ///
19 | /// If true, the grouping is case-insensitive; otherwise, the grouping will be case-sensitive.
20 | ///
21 | public bool IsCaseInsensitive { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Shared/MeasurementPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Shared
16 | {
17 | ///
18 | /// A column with value and label.
19 | ///
20 | public class ColumnPart
21 | {
22 | ///
23 | /// The expression (selected column) that computes the value of the measurement.
24 | ///
25 | public string Value { get; set; }
26 |
27 | ///
28 | /// An optional label for the measurement (effectively the right-hand size of an as clause).
29 | ///
30 | public string Label { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Shared/ResultSetStatus.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Shared
16 | {
17 | ///
18 | /// Information about the state of an event result set.
19 | ///
20 | public enum ResultSetStatus
21 | {
22 | ///
23 | /// Uninitialized value.
24 | ///
25 | Unknown,
26 |
27 | ///
28 | /// Still more to search (even if this result set is empty).
29 | ///
30 | Partial,
31 |
32 | ///
33 | /// Covers the whole range.
34 | ///
35 | Complete,
36 |
37 | ///
38 | /// Retrieved the requested event count, then stopped.
39 | ///
40 | Full
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Shared/StatisticsPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Seq.Api.Model.Shared
18 | {
19 | ///
20 | /// Information about a request to search for events.
21 | ///
22 | public class StatisticsPart
23 | {
24 | ///
25 | /// The server-side elapsed time taken satisfying the request.
26 | ///
27 | public TimeSpan Elapsed { get; set; }
28 |
29 | ///
30 | /// The id of the last event inspected in the search.
31 | ///
32 | public string LastReadEventId { get; set; }
33 |
34 | ///
35 | /// The timestamp of the last event inspected in the search.
36 | ///
37 | public string LastReadEventTimestamp { get; set; }
38 |
39 | ///
40 | /// Status of the result set.
41 | ///
42 | public ResultSetStatus Status { get; set; }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Signals/SignalColumnPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Signals
16 | {
17 | ///
18 | /// An expression that will be displayed as a column when a signal
19 | /// including it is selected.
20 | ///
21 | public class SignalColumnPart
22 | {
23 | ///
24 | /// The expression to show as a column.
25 | ///
26 | public string Expression { get; set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Signals/SignalEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using Newtonsoft.Json;
18 | using Seq.Api.Model.Security;
19 | using Seq.Api.Model.Shared;
20 |
21 | namespace Seq.Api.Model.Signals
22 | {
23 | ///
24 | /// A signal is a collection of filters that identifies a subset of the event stream.
25 | ///
26 | public class SignalEntity : Entity
27 | {
28 | ///
29 | /// Construct a .
30 | ///
31 | public SignalEntity()
32 | {
33 | Title = "New Signal";
34 | Filters = new List();
35 | Columns = new List();
36 | }
37 |
38 | ///
39 | /// The friendly, human readable title of the signal.
40 | ///
41 | public string Title { get; set; }
42 |
43 | ///
44 | /// A long-form description of the signal's purpose and contents.
45 | ///
46 | public string Description { get; set; }
47 |
48 | ///
49 | /// Filters that are combined (using the and operator) to identify events matching the filter.
50 | ///
51 | public List Filters { get; set; }
52 |
53 | ///
54 | /// Expressions that show as columns when the signal is selected in the events screen.
55 | ///
56 | public List Columns { get; set; }
57 |
58 | ///
59 | /// Obsolete.
60 | ///
61 | // ReSharper disable once UnusedMember.Global
62 | [Obsolete("This member has been renamed `IsProtected` to better reflect its purpose.")]
63 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
64 | public bool? IsRestricted { get; set; }
65 |
66 | ///
67 | /// If true, the signal can only be modified by users with the permission.
68 | ///
69 | public bool IsProtected { get; set; }
70 |
71 | ///
72 | /// If true, the signal has no backing index.
73 | ///
74 | public bool IsIndexSuppressed { get; set; }
75 |
76 | ///
77 | /// How the signal is grouped in the Seq UI.
78 | ///
79 | public SignalGrouping Grouping { get; set; }
80 |
81 | ///
82 | /// If is , the name of the group in which the signal appears.
83 | ///
84 | public string ExplicitGroupName { get; set; }
85 |
86 | ///
87 | /// The user id of the user who owns the signal; if null, the signal is shared.
88 | ///
89 | public string OwnerId { get; set; }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Signals/SignalExpressionKind.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Signals
16 | {
17 | ///
18 | /// The type of expression represented by a .
19 | ///
20 | public enum SignalExpressionKind
21 | {
22 | ///
23 | /// Uninitialized value.
24 | ///
25 | None,
26 |
27 | ///
28 | /// The expression identifies a single signal.
29 | ///
30 | Signal,
31 |
32 | ///
33 | /// The expression is an intersection (and operation) of two signal expressions.
34 | ///
35 | Intersection,
36 |
37 | ///
38 | /// The expression is a union (or operation) of two signal expressions.
39 | ///
40 | Union
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Signals/SignalGrouping.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Signals
16 | {
17 | ///
18 | /// The method by which a signal is grouped in the Seq UI.
19 | ///
20 | public enum SignalGrouping
21 | {
22 | ///
23 | /// The grouping is inferred from the filters within the signal. Currently, this
24 | /// will result in the signal being grouped only if the signal has a single
25 | /// equality-based filter.
26 | ///
27 | Inferred,
28 |
29 | ///
30 | /// The signal is given an explicit group name.
31 | ///
32 | Explicit,
33 |
34 | ///
35 | /// The signal is never displayed in a group.
36 | ///
37 | None
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/SqlQueries/SqlQueryEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Seq.Api.Model.Security;
16 |
17 | namespace Seq.Api.Model.SqlQueries
18 | {
19 | ///
20 | /// A saved SQL-style query.
21 | ///
22 | public class SqlQueryEntity : Entity
23 | {
24 | ///
25 | /// Construct a .
26 | ///
27 | public SqlQueryEntity()
28 | {
29 | Title = "New SQL Query";
30 | Sql = "";
31 | }
32 |
33 | ///
34 | /// A friendly, human-readable name for the query.
35 | ///
36 | public string Title { get; set; }
37 |
38 | ///
39 | /// A long-form description of the query.
40 | ///
41 | public string Description { get; set; }
42 |
43 | ///
44 | /// The query text.
45 | ///
46 | public string Sql { get; set; }
47 |
48 | ///
49 | /// If true, only users with permission can edit the SQL query.
50 | ///
51 | public bool IsProtected { get; set; }
52 |
53 | ///
54 | /// The id of a user who owns this query. If null, the query is shared.
55 | ///
56 | public string OwnerId { get; set; }
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Tasks/RunningTaskEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Seq.Api.Model.Tasks
18 | {
19 | ///
20 | /// Describes a task being actively performed by the Seq server.
21 | ///
22 | public class RunningTaskEntity: Entity
23 | {
24 | ///
25 | /// A description of the task.
26 | ///
27 | public string Description { get; set; }
28 |
29 | ///
30 | /// When the task started.
31 | ///
32 | public DateTime StartedAtUtc { get; set; }
33 |
34 | ///
35 | /// Whether or not the task can be cancelled.
36 | ///
37 | public bool CanCancel { get; set; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Updates/AvailableUpdateEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Updates
16 | {
17 | ///
18 | /// An update available for software running on or in the Seq server.
19 | ///
20 | public class AvailableUpdateEntity : Entity
21 | {
22 | ///
23 | /// A description of the update.
24 | ///
25 | public string Description { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Users/AuthProviderInfoPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Users
16 | {
17 | ///
18 | /// An authentication provider supported by the server.
19 | ///
20 | public class AuthProviderInfoPart
21 | {
22 | ///
23 | /// The friendly, human-readable name of the authentication provider.
24 | ///
25 | public string Name { get; set; }
26 |
27 | ///
28 | /// The URL where the user can log in with the provider.
29 | ///
30 | public string Url { get; set; }
31 |
32 | ///
33 | /// If true, the provider is shown as an additional/alternative way to
34 | /// log in using the default provider.
35 | ///
36 | public bool IsAlternative { get; set; }
37 |
38 | ///
39 | /// A template for the URL where the user can log in.
40 | ///
41 | public Link Challenge { get; set; }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Users/AuthProvidersPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 |
17 | namespace Seq.Api.Model.Users
18 | {
19 | ///
20 | /// Auth providers supported by the server.
21 | ///
22 | public class AuthProvidersPart
23 | {
24 | ///
25 | /// The providers.
26 | ///
27 | public List Providers { get; set; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Users/CredentialsPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Users
16 | {
17 | ///
18 | /// User credentials.
19 | ///
20 | public class CredentialsPart
21 | {
22 | ///
23 | /// The username.
24 | ///
25 | public string Username { get; set; }
26 |
27 | ///
28 | /// The current password; set e.g. when logging in.
29 | ///
30 | public string Password { get; set; }
31 |
32 | ///
33 | /// A new password; set e.g. when changing passwords.
34 | ///
35 | public string NewPassword { get; set; }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Users/SearchHistoryEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 |
17 | namespace Seq.Api.Model.Users
18 | {
19 | ///
20 | /// A user's search history.
21 | ///
22 | public class SearchHistoryEntity : Entity
23 | {
24 | ///
25 | /// The number of recent searches that the server will retain for the user.
26 | ///
27 | public uint RetainedRecentSearches { get; set; }
28 |
29 | ///
30 | /// Recent un-pinned searches, with the most recent included first.
31 | ///
32 | public List Recent { get; set; }
33 |
34 | ///
35 | /// Pinned search history items, with the most recent included first.
36 | ///
37 | public List Pinned { get; set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Users/SearchHistoryItemAction.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Seq.Api.Model.Users
16 | {
17 | ///
18 | /// An operation applied to a search history item.
19 | ///
20 | public enum SearchHistoryItemAction
21 | {
22 | ///
23 | /// The item was used (make it more recent).
24 | ///
25 | Used,
26 |
27 | ///
28 | /// The item has been pinned.
29 | ///
30 | Pinned,
31 |
32 | ///
33 | /// The item has been unpinned.
34 | ///
35 | Unpinned
36 | }
37 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Users/SearchHistoryItemPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | // ReSharper disable ClassNeverInstantiated.Global
16 |
17 | namespace Seq.Api.Model.Users
18 | {
19 | ///
20 | /// A entry to include in a user's search history.
21 | ///
22 | public class SearchHistoryItemPart
23 | {
24 | ///
25 | /// The search or query entered by the user into the search bar.
26 | ///
27 | public string Search { get; set; }
28 |
29 | ///
30 | /// Status to apply to the search history item.
31 | ///
32 | public SearchHistoryItemAction Action { get; set; }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Users/UserEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Newtonsoft.Json;
17 | using Seq.Api.Model.Shared;
18 |
19 | namespace Seq.Api.Model.Users
20 | {
21 | ///
22 | /// A user on the Seq server.
23 | ///
24 | public class UserEntity : Entity
25 | {
26 | ///
27 | /// The username that uniquely identifies the user.
28 | ///
29 | public string Username { get; set; }
30 |
31 | ///
32 | /// An optional display name to aid in identifying the user.
33 | ///
34 | public string DisplayName { get; set; }
35 |
36 | ///
37 | /// The user's email address. This will be used to show a
38 | /// Gravatar for the user in some situations.
39 | ///
40 | public string EmailAddress { get; set; }
41 |
42 | ///
43 | /// The user's preferences.
44 | ///
45 | public Dictionary Preferences { get; set; }
46 |
47 | ///
48 | /// If changing password, the new password for the user.
49 | ///
50 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
51 | public string NewPassword { get; set; }
52 |
53 | ///
54 | /// A filter that is applied to searches and queries instigated by
55 | /// the user.
56 | ///
57 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
58 | public DescriptiveFilterPart ViewFilter { get; set; }
59 |
60 | ///
61 | /// If true, the user will be unable to log in without first
62 | /// changing their password. Recommended when administratively assigning
63 | /// a password for the user.
64 | ///
65 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
66 | public bool MustChangePassword { get; set; }
67 |
68 | ///
69 | /// The ids of one or more roles that grant permissions to the user. Note that
70 | /// the Seq UI currently only supports a single role when editing users.
71 | ///
72 | public HashSet RoleIds { get; set; } = new HashSet();
73 |
74 | ///
75 | /// The authentication provider associated with the user account. This will normally be
76 | /// the system-configured authentication provider, but if the provider is changed, the
77 | /// user may need to be unlinked from an existing provider so that login can proceed through
78 | /// the new provider.
79 | ///
80 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
81 | public string AuthenticationProvider { get; set; }
82 |
83 | ///
84 | /// The unique identifier that links the identity provided by the authentication provider
85 | /// with the Seq user.
86 | ///
87 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
88 | public string AuthenticationProviderUniqueIdentifier { get; set; }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Workspaces/WorkspaceContentPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Seq.Api.Model.Dashboarding;
17 | using Seq.Api.Model.Signals;
18 | using Seq.Api.Model.SqlQueries;
19 |
20 | namespace Seq.Api.Model.Workspaces
21 | {
22 | ///
23 | /// The items included in a .
24 | ///
25 | public class WorkspaceContentPart
26 | {
27 | ///
28 | /// A list of ids to include in the workspace.
29 | ///
30 | public List SignalIds { get; set; } = new List();
31 |
32 | ///
33 | /// A list of ids to include in the workspace.
34 | ///
35 | public List QueryIds { get; set; } = new List();
36 |
37 | ///
38 | /// A list of ids to include in the workspace.
39 | ///
40 | public List DashboardIds { get; set; } = new List();
41 | }
42 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Model/Workspaces/WorkspaceEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Seq.Api.Model.Security;
16 | using Seq.Api.Model.Signals;
17 |
18 | namespace Seq.Api.Model.Workspaces
19 | {
20 | ///
21 | /// A workspace is a collection of related entities that help to focus
22 | /// the Seq UI around a particular context.
23 | ///
24 | public class WorkspaceEntity : Entity
25 | {
26 | ///
27 | /// A friendly, human-readable title for the workspace.
28 | ///
29 | public string Title { get; set; }
30 |
31 | ///
32 | /// An optional long-form description of the workspace.
33 | ///
34 | public string Description { get; set; }
35 |
36 | ///
37 | /// The id of the user who owns the workspace. If null, the workspace is shared.
38 | ///
39 | public string OwnerId { get; set; }
40 |
41 | ///
42 | /// If true, only users with the permission can modify the workspace.
43 | ///
44 | public bool IsProtected { get; set; }
45 |
46 | ///
47 | /// An optional that will be activated when opening the Events
48 | /// screen with the workspace selected.
49 | ///
50 | public SignalExpressionPart DefaultSignalExpression { get; set; }
51 |
52 | ///
53 | /// Content included in the workspace.
54 | ///
55 | public WorkspaceContentPart Content { get; set; } = new WorkspaceContentPart();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/Seq.Api/ResourceGroups/AlertStateResourceGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Threading;
18 | using System.Threading.Tasks;
19 | using Seq.Api.Model.Alerting;
20 |
21 | namespace Seq.Api.ResourceGroups
22 | {
23 | ///
24 | /// Inspect the current states of alerts being monitored by the server.
25 | ///
26 | public class AlertStateResourceGroup : ApiResourceGroup
27 | {
28 | internal AlertStateResourceGroup(ILoadResourceGroup connection)
29 | : base("AlertState", connection)
30 | {
31 | }
32 |
33 | ///
34 | /// Retrieve the alert state with the given id; throws if the entity does not exist.
35 | ///
36 | /// The id of the alert state.
37 | /// A allowing the operation to be canceled.
38 | /// The alert state.
39 | public async Task FindAsync(string id, CancellationToken cancellationToken = default)
40 | {
41 | if (id == null) throw new ArgumentNullException(nameof(id));
42 | return await GroupGetAsync("Item", new Dictionary { { "id", id } }, cancellationToken).ConfigureAwait(false);
43 | }
44 |
45 | ///
46 | /// Retrieve the states of all alerts being monitored by the server.
47 | ///
48 | /// allowing the operation to be canceled.
49 | /// A list containing all current alert states.
50 | public async Task> ListAsync(CancellationToken cancellationToken = default)
51 | {
52 | return await GroupListAsync("Items", null, cancellationToken).ConfigureAwait(false);
53 | }
54 |
55 | ///
56 | /// Remove an alert state; this will remove the corresponding alert.
57 | ///
58 | /// The alert state to remove
59 | /// allowing the operation to be canceled.
60 | public async Task RemoveAsync(AlertStateEntity entity, CancellationToken cancellationToken = default)
61 | {
62 | await Client.DeleteAsync(entity, "Self", entity, cancellationToken: cancellationToken).ConfigureAwait(false);
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/Seq.Api/ResourceGroups/BackupsResourceGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.IO;
18 | using System.Threading;
19 | using System.Threading.Tasks;
20 | using Seq.Api.Model.Backups;
21 |
22 | namespace Seq.Api.ResourceGroups
23 | {
24 | ///
25 | /// Perform operations on backups. Seq backups include metadata like users, signals, API keys and other configuration, but do not include
26 | /// the event stream. Backups are fully encrypted with AES-256 and cannot be restored without the secret key from the originating Seq instance.
27 | ///
28 | public class BackupsResourceGroup : ApiResourceGroup
29 | {
30 | internal BackupsResourceGroup(ILoadResourceGroup connection)
31 | : base("Backups", connection)
32 | {
33 | }
34 |
35 | ///
36 | /// Retrieve the backup with the given id; throws if the entity does not exist.
37 | ///
38 | /// The id of the backup.
39 | /// A allowing the operation to be canceled.
40 | /// The backup.
41 | public async Task FindAsync(string id, CancellationToken cancellationToken = default)
42 | {
43 | if (id == null) throw new ArgumentNullException(nameof(id));
44 | return await GroupGetAsync("Item", new Dictionary { { "id", id } }, cancellationToken).ConfigureAwait(false);
45 | }
46 |
47 | ///
48 | /// Retrieve backups.
49 | ///
50 | /// allowing the operation to be canceled.
51 | /// A list containing matching backups.
52 | public async Task> ListAsync(CancellationToken cancellationToken = default)
53 | {
54 | return await GroupListAsync("Items", cancellationToken: cancellationToken).ConfigureAwait(false);
55 | }
56 |
57 | ///
58 | /// Download a backup with the current state of the server. Note that the backup will not be stored server-side.
59 | ///
60 | /// allowing the operation to be canceled.
61 | /// The .seqbac backup file.
62 | public async Task DownloadImmediateAsync(CancellationToken cancellationToken = default)
63 | {
64 | return await GroupPostReadBytesAsync("Immediate", new object(), cancellationToken: cancellationToken).ConfigureAwait(false);
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/Seq.Api/ResourceGroups/ExpressionIndexesResourceGroup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using Seq.Api.Model;
6 | using Seq.Api.Model.Indexing;
7 |
8 | namespace Seq.Api.ResourceGroups
9 | {
10 | ///
11 | /// Perform operations on expression indexes.
12 | ///
13 | public class ExpressionIndexesResourceGroup: ApiResourceGroup
14 | {
15 | internal ExpressionIndexesResourceGroup(ILoadResourceGroup connection) : base("ExpressionIndexes", connection)
16 | {
17 | }
18 |
19 | ///
20 | /// Retrieve expression indexes.
21 | ///
22 | /// allowing the operation to be canceled.
23 | /// A list containing matching expression indexes.
24 | public async Task> ListAsync(CancellationToken cancellationToken = default)
25 | {
26 | return await GroupListAsync("Items", cancellationToken: cancellationToken).ConfigureAwait(false);
27 | }
28 |
29 | ///
30 | /// Retrieve the expression index with the given id; throws if the entity does not exist.
31 | ///
32 | /// The id of the expression index.
33 | /// A allowing the operation to be canceled.
34 | /// The expression index.
35 | public async Task FindAsync(string id, CancellationToken cancellationToken = default)
36 | {
37 | if (id == null) throw new ArgumentNullException(nameof(id));
38 | return await GroupGetAsync("Item", new Dictionary { { "id", id } }, cancellationToken).ConfigureAwait(false);
39 | }
40 |
41 | ///
42 | /// Construct an expression index with server defaults pre-initialized.
43 | ///
44 | /// allowing the operation to be canceled.
45 | /// The unsaved expression index.
46 | public async Task TemplateAsync(CancellationToken cancellationToken = default)
47 | {
48 | return await GroupGetAsync("Template", cancellationToken: cancellationToken).ConfigureAwait(false);
49 | }
50 |
51 | ///
52 | /// Add a new expression index.
53 | ///
54 | /// The expression index to add.
55 | /// A allowing the operation to be canceled.
56 | /// The expression index, with server-allocated properties such as initialized.
57 | public async Task AddAsync(ExpressionIndexEntity entity, CancellationToken cancellationToken = default)
58 | {
59 | return await GroupCreateAsync(entity, cancellationToken: cancellationToken).ConfigureAwait(false);
60 | }
61 |
62 | ///
63 | /// Remove an existing expression index.
64 | ///
65 | /// The expression index to remove.
66 | /// A allowing the operation to be canceled.
67 | /// A task indicating completion.
68 | public async Task RemoveAsync(ExpressionIndexEntity entity, CancellationToken cancellationToken = default)
69 | {
70 | await Client.DeleteAsync(entity, "Self", entity, cancellationToken: cancellationToken).ConfigureAwait(false);
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/src/Seq.Api/ResourceGroups/ExpressionsResourceGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using System.Threading;
17 | using System.Threading.Tasks;
18 | using Seq.Api.Model.Expressions;
19 |
20 | namespace Seq.Api.ResourceGroups
21 | {
22 | ///
23 | /// Perform operations on queries and filter expressions.
24 | ///
25 | public class ExpressionsResourceGroup : ApiResourceGroup
26 | {
27 | internal ExpressionsResourceGroup(ILoadResourceGroup connection)
28 | : base("Expressions", connection)
29 | {
30 | }
31 |
32 | ///
33 | /// Convert an expression in the relaxed syntax supported by the filter bar, to the strictly-valid
34 | /// syntax required by API interactions.
35 | ///
36 | /// The (potentially) relaxed-syntax expression.
37 | /// A allowing the operation to be canceled.
38 | /// The expression in a strictly-valid form.
39 | public Task ToStrictAsync(string fuzzy, CancellationToken cancellationToken = default)
40 | {
41 | return GroupGetAsync("ToStrict", new Dictionary
42 | {
43 | {"fuzzy", fuzzy}
44 | }, cancellationToken);
45 | }
46 |
47 | ///
48 | /// Convert an expression in the relaxed syntax supported by the filter bar, to the strict and limited
49 | /// syntax required within SQL queries.
50 | ///
51 | /// The (potentially) relaxed-syntax expression.
52 | /// A allowing the operation to be canceled.
53 | /// The expression in a form that can be used within SQL queries.
54 | public Task ToSqlAsync(string fuzzy, CancellationToken cancellationToken = default)
55 | {
56 | return GroupGetAsync("ToSql", new Dictionary
57 | {
58 | {"fuzzy", fuzzy}
59 | }, cancellationToken);
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/src/Seq.Api/ResourceGroups/ILoadResourceGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Threading;
16 | using System.Threading.Tasks;
17 | using Seq.Api.Client;
18 | using Seq.Api.Model;
19 |
20 | namespace Seq.Api.ResourceGroups
21 | {
22 | ///
23 | /// The contract between resource groups and the implementing connection type.
24 | ///
25 | /// This interface is an implementation detail that should not be relied on by
26 | /// application-level consumers.
27 | public interface ILoadResourceGroup
28 | {
29 | ///
30 | /// Load the resource group with the given .
31 | ///
32 | /// The resource group name. The name is the simple form, for example,
33 | /// "Dashboards".
34 | /// A allowing the operation to be canceled.
35 | /// The requested resource group.
36 | Task LoadResourceGroupAsync(string name, CancellationToken cancellationToken = default);
37 |
38 | ///
39 | /// The underlying Seq API client.
40 | ///
41 | SeqApiClient Client { get; }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Seq.Api/ResourceGroups/IndexesResourceGroup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using Seq.Api.Model.Alerting;
6 | using Seq.Api.Model.Indexes;
7 | using Seq.Api.Model.Indexing;
8 | using Seq.Api.Model.Signals;
9 |
10 | namespace Seq.Api.ResourceGroups
11 | {
12 | ///
13 | /// Statistics about indexes.
14 | ///
15 | public class IndexesResourceGroup : ApiResourceGroup
16 | {
17 | internal IndexesResourceGroup(ILoadResourceGroup connection)
18 | : base("Indexes", connection)
19 | {
20 | }
21 |
22 | ///
23 | /// Retrieve the index with the given id; throws if the entity does not exist.
24 | ///
25 | /// The id of the index.
26 | /// A allowing the operation to be canceled.
27 | /// The index.
28 | public async Task FindAsync(string id, CancellationToken cancellationToken = default)
29 | {
30 | if (id == null) throw new ArgumentNullException(nameof(id));
31 | return await GroupGetAsync("Item", new Dictionary { { "id", id } }, cancellationToken).ConfigureAwait(false);
32 | }
33 |
34 | ///
35 | /// Retrieve statistics on all indexes.
36 | ///
37 | /// allowing the operation to be canceled.
38 | /// A list containing matching expression indexes.
39 | public async Task> ListAsync(CancellationToken cancellationToken = default)
40 | {
41 | return await GroupListAsync("Items", cancellationToken: cancellationToken).ConfigureAwait(false);
42 | }
43 |
44 | ///
45 | /// Suppress an index. Not all index types can be suppressed: signal indexes do support suppression, in the case
46 | /// of which the flag will be set to .
47 | /// Expression indexes can only be suppressed by deleting the associated
48 | /// and alert indexes can only be suppressed by deleting the corresponding .
49 | ///
50 | /// The index to suppress.
51 | /// A allowing the operation to be canceled.
52 | /// A task indicating completion.
53 | public async Task SuppressAsync(IndexEntity entity, CancellationToken cancellationToken = default)
54 | {
55 | await Client.DeleteAsync(entity, "Self", entity, cancellationToken: cancellationToken).ConfigureAwait(false);
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/Seq.Api/ResourceGroups/LicensesResourceGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Threading;
18 | using System.Threading.Tasks;
19 | using Seq.Api.Model.License;
20 |
21 | namespace Seq.Api.ResourceGroups
22 | {
23 | ///
24 | /// Perform operations on the Seq license certificate.
25 | ///
26 | public class LicensesResourceGroup : ApiResourceGroup
27 | {
28 | internal LicensesResourceGroup(ILoadResourceGroup connection)
29 | : base("Licenses", connection)
30 | {
31 | }
32 |
33 | ///
34 | /// Retrieve the license with the given id; throws if the entity does not exist.
35 | ///
36 | /// The id of the license.
37 | /// A allowing the operation to be canceled.
38 | /// The license.
39 | public async Task FindAsync(string id, CancellationToken cancellationToken = default)
40 | {
41 | if (id == null) throw new ArgumentNullException(nameof(id));
42 | return await GroupGetAsync("Item", new Dictionary { { "id", id } }, cancellationToken).ConfigureAwait(false);
43 | }
44 |
45 | ///
46 | /// Retrieve the license being used by the server.
47 | ///
48 | /// A allowing the operation to be canceled.
49 | /// The license.
50 | public async Task FindCurrentAsync(CancellationToken cancellationToken = default)
51 | {
52 | return await GroupGetAsync("Current", cancellationToken: cancellationToken).ConfigureAwait(false);
53 | }
54 |
55 | ///
56 | /// Retrieve licenses.
57 | ///
58 | /// allowing the operation to be canceled.
59 | /// A list containing matching licenses.
60 | public async Task> ListAsync(CancellationToken cancellationToken = default)
61 | {
62 | return await GroupListAsync("Items", cancellationToken: cancellationToken).ConfigureAwait(false);
63 | }
64 |
65 | ///
66 | /// Update an existing license.
67 | ///
68 | /// The license to update.
69 | /// A allowing the operation to be canceled.
70 | /// A task indicating completion.
71 | public async Task UpdateAsync(LicenseEntity entity, CancellationToken cancellationToken = default)
72 | {
73 | await Client.PutAsync(entity, "Self", entity, cancellationToken: cancellationToken).ConfigureAwait(false);
74 | }
75 |
76 | ///
77 | /// Remove the current license, causing the server to fall back to the default configuration.
78 | ///
79 | /// allowing the operation to be canceled.
80 | /// A task indicating completion.
81 | public async Task DowngradeAsync(CancellationToken cancellationToken = default)
82 | {
83 | await GroupPostAsync("Downgrade", new object(), cancellationToken: cancellationToken).ConfigureAwait(false);
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/src/Seq.Api/ResourceGroups/RolesResourceGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Threading.Tasks;
18 | using System.Threading;
19 | using Seq.Api.Model.Security;
20 |
21 | namespace Seq.Api.ResourceGroups
22 | {
23 | ///
24 | /// Perform operations on user roles.
25 | ///
26 | public class RolesResourceGroup : ApiResourceGroup
27 | {
28 | internal RolesResourceGroup(ILoadResourceGroup connection)
29 | : base("Roles", connection)
30 | {
31 | }
32 |
33 | ///
34 | /// Retrieve the role with the given id; throws if the entity does not exist.
35 | ///
36 | /// The id of the role.
37 | /// A allowing the operation to be canceled.
38 | /// The role.
39 | public async Task FindAsync(string id, CancellationToken cancellationToken = default)
40 | {
41 | if (id == null) throw new ArgumentNullException(nameof(id));
42 | return await GroupGetAsync("Item", new Dictionary { { "id", id } }, cancellationToken).ConfigureAwait(false);
43 | }
44 |
45 | ///
46 | /// Retrieve roles.
47 | ///
48 | /// allowing the operation to be canceled.
49 | /// A list containing all roles available on the server.
50 | public async Task> ListAsync(CancellationToken cancellationToken = default)
51 | {
52 | return await GroupListAsync("Items", cancellationToken: cancellationToken).ConfigureAwait(false);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Seq.Api/ResourceGroups/RunningTasksResourceGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Threading;
18 | using System.Threading.Tasks;
19 | using Seq.Api.Model.Alerting;
20 | using Seq.Api.Model.Tasks;
21 |
22 | namespace Seq.Api.ResourceGroups
23 | {
24 | ///
25 | /// Inspect and cancel tasks running in the Seq server.
26 | ///
27 | public class RunningTasksResourceGroup : ApiResourceGroup
28 | {
29 | internal RunningTasksResourceGroup (ILoadResourceGroup connection)
30 | : base("RunningTasks", connection)
31 | {
32 | }
33 |
34 | ///
35 | /// Retrieve the task with the given id; throws if the entity does not exist.
36 | ///
37 | /// The id of the task.
38 | /// A allowing the operation to be canceled.
39 | /// The task.
40 | public async Task FindAsync(string id, CancellationToken cancellationToken = default)
41 | {
42 | if (id == null) throw new ArgumentNullException(nameof(id));
43 | return await GroupGetAsync("Item", new Dictionary { { "id", id } }, cancellationToken).ConfigureAwait(false);
44 | }
45 |
46 | ///
47 | /// Retrieve all tasks running on the server.
48 | ///
49 | /// allowing the operation to be canceled.
50 | /// A list containing all running tasks.
51 | public async Task> ListAsync(CancellationToken cancellationToken = default)
52 | {
53 | return await GroupListAsync("Items", null, cancellationToken).ConfigureAwait(false);
54 | }
55 |
56 | ///
57 | /// Request cancellation of a running task. The task must support cancellation; see .
58 | ///
59 | /// The task to cancel.
60 | /// allowing the cancellation operation itself to be canceled.
61 | public async Task RequestCancellationAsync(AlertStateEntity entity, CancellationToken cancellationToken = default)
62 | {
63 | await Client.DeleteAsync(entity, "Self", entity, cancellationToken: cancellationToken).ConfigureAwait(false);
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/Seq.Api/ResourceGroups/UpdatesResourceGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using System.Threading;
17 | using System.Threading.Tasks;
18 | using Seq.Api.Model.Updates;
19 |
20 | namespace Seq.Api.ResourceGroups
21 | {
22 | ///
23 | /// Perform operations on known available Seq versions.
24 | ///
25 | public class UpdatesResourceGroup : ApiResourceGroup
26 | {
27 | internal UpdatesResourceGroup(ILoadResourceGroup connection)
28 | : base("Updates", connection)
29 | {
30 | }
31 |
32 | ///
33 | /// Retrieve available updates.
34 | ///
35 | /// allowing the operation to be canceled.
36 | /// A list of available updates.
37 | public async Task> ListAsync(CancellationToken cancellationToken = default)
38 | {
39 | return await GroupListAsync("Items", cancellationToken: cancellationToken).ConfigureAwait(false);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Seq.Api/Seq.Api.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | Client library for the Seq HTTP API.
4 | 2025.1.1
5 | Datalust;Contributors
6 | netstandard2.0;net6.0;net8.0
7 | true
8 | true
9 | seq
10 | Copyright © Datalust Pty Ltd and Contributors
11 | seq-api-icon.png
12 | https://github.com/datalust/seq-api
13 | Apache-2.0
14 | latest
15 |
16 |
17 |
18 | $(DefineConstants);SOCKETS_HTTP_HANDLER
19 |
20 |
21 |
22 | $(DefineConstants);SOCKETS_HTTP_HANDLER;WEBSOCKET_USE_HTTPCLIENT
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | runtime; build; native; contentfiles; analyzers; buildtransitive
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/Seq.Api/Serialization/LinkCollectionConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Datalust and contributors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using Newtonsoft.Json;
19 | using Seq.Api.Model;
20 |
21 | namespace Seq.Api.Serialization
22 | {
23 | class LinkCollectionConverter : JsonConverter
24 | {
25 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
26 | {
27 | var lc = (LinkCollection)value;
28 | var dictionary = lc.ToDictionary(kv => kv.Key, kv => kv.Value.Template);
29 | serializer.Serialize(writer, dictionary);
30 | }
31 |
32 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
33 | {
34 | var hrefs = serializer.Deserialize>(reader);
35 | if (hrefs == null) return existingValue;
36 | var result = new LinkCollection();
37 | foreach (var href in hrefs)
38 | {
39 | result.Add(href.Key, new Link(href.Value));
40 | }
41 | return result;
42 | }
43 |
44 | public override bool CanConvert(Type objectType)
45 | {
46 | return objectType == typeof(LinkCollection);
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/src/Seq.Api/Streams/WebSocketTaskExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.WebSockets;
3 | using System.Threading.Tasks;
4 | using Seq.Api.Client;
5 |
6 | namespace Seq.Api.Streams;
7 |
8 | // Async enumerators and try/catch blocks don't play nicely together. These extensions help maintain the
9 | // previous exception contract around API calls.
10 | static class WebSocketTaskExtensions
11 | {
12 | public static async Task WithApiExceptions(this Task task)
13 | {
14 | await ((Task)task).WithApiExceptions();
15 | return task.Result;
16 | }
17 |
18 | public static async Task WithApiExceptions(this Task task)
19 | {
20 | try
21 | {
22 | await task;
23 | }
24 | catch (WebSocketException ex)
25 | {
26 | throw new SeqApiException($"The WebSocket API call failed ({ex.ErrorCode}/{ex.WebSocketErrorCode}).", ex);
27 | }
28 | catch (Exception ex)
29 | {
30 | throw new SeqApiException("The API call failed.", ex);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/Seq.Api/seq-api-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datalust/seq-api/9e2f53c66caa52f77912e6c6a8d6546bf88daedb/src/Seq.Api/seq-api-icon.png
--------------------------------------------------------------------------------
/test/Seq.Api.Tests/LinkTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Seq.Api.Model;
4 | using Xunit;
5 |
6 | namespace Seq.Api.Tests
7 | {
8 | public class LinkTests
9 | {
10 | [Fact]
11 | public void ALinkWithNoParametersIsLiteral()
12 | {
13 | const string uri = "https://example.com";
14 | var link = new Link(uri);
15 | var constructed = link.GetUri();
16 | Assert.Equal(uri, constructed);
17 | }
18 |
19 | [Fact]
20 | public void AParameterizedLinkCanBeConstructed()
21 | {
22 | const string template = "https://example.com/{name}";
23 | var link = new Link(template);
24 | var constructed = link.GetUri(new Dictionary {["name"] = "test"});
25 | Assert.Equal("https://example.com/test", constructed);
26 | }
27 |
28 | [Fact]
29 | public void InvalidParametersAreDetected()
30 | {
31 | const string template = "https://example.com";
32 | var link = new Link(template);
33 | Assert.Throws(() => link.GetUri(new Dictionary {["name"] = "test"}));
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/test/Seq.Api.Tests/Seq.Api.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net462;net6.0
5 | true
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | all
16 | runtime; build; native; contentfiles; analyzers; buildtransitive
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/Seq.Api.Tests/SeqConnectionTests.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 | using Xunit;
3 |
4 | namespace Seq.Api.Tests
5 | {
6 | public class SeqConnectionTests
7 | {
8 | [Fact]
9 | public void WhenConstructedTheHandlerConfigurationCallbackIsCalled()
10 | {
11 | var callCount = 0;
12 |
13 | using var _ = new SeqConnection(
14 | "https://test.example.com",
15 | apiKey: null,
16 | createHttpMessageHandler: cookies =>
17 | {
18 | ++callCount;
19 | return new HttpClientHandler { CookieContainer = cookies };
20 | });
21 |
22 | Assert.Equal(1, callCount);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------