From dd7088b30b4e7736625c54147f6da8a9bb47a531 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Tue, 10 Dec 2019 07:47:43 +1000 Subject: [PATCH 1/9] Dev version bump [skip ci] --- src/Seq.Api/Seq.Api.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Seq.Api/Seq.Api.csproj b/src/Seq.Api/Seq.Api.csproj index 5f43eeb..d5fd432 100644 --- a/src/Seq.Api/Seq.Api.csproj +++ b/src/Seq.Api/Seq.Api.csproj @@ -1,7 +1,7 @@ - + Client library for the Seq HTTP API. - 5.1.2 + 5.1.3 Datalust;Contributors netstandard2.0 true From 5fcbae272652116e7ac810f66db68b819d5d8b1f Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Sat, 28 Dec 2019 09:21:10 +1000 Subject: [PATCH 2/9] Provide a configuration callback that acts on the underlying HttpClientHandler, e.g. for certificate validation or proxy configuration; adds a missing IDisposable implementation on SeqConnection --- src/Seq.Api/Client/SeqApiClient.cs | 21 +++++++++++++++--- src/Seq.Api/SeqConnection.cs | 28 ++++++++++++++++++++++-- test/Seq.Api.Tests/SeqConnectionTests.cs | 20 +++++++++++++++++ 3 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 test/Seq.Api.Tests/SeqConnectionTests.cs diff --git a/src/Seq.Api/Client/SeqApiClient.cs b/src/Seq.Api/Client/SeqApiClient.cs index f505450..13445df 100644 --- a/src/Seq.Api/Client/SeqApiClient.cs +++ b/src/Seq.Api/Client/SeqApiClient.cs @@ -14,6 +14,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Net; using System.Net.Http; @@ -56,7 +57,20 @@ public class SeqApiClient : IDisposable /// The base URL of the Seq server. /// An API key to use when making requests to the server, if required. /// Whether default credentials will be sent with HTTP requests; the default is true. - public SeqApiClient(string serverUrl, string apiKey = null, bool useDefaultCredentials = true) + [Obsolete("Prefer `SeqApiClient(serverUrl, apiKey, handler => handler.UseDefaultCredentials = true)` instead."), EditorBrowsable(EditorBrowsableState.Never)] + public SeqApiClient(string serverUrl, string apiKey, bool useDefaultCredentials) + : this(serverUrl, apiKey, handler => handler.UseDefaultCredentials = useDefaultCredentials) + { + } + + /// + /// Construct a . + /// + /// The base URL of the Seq server. + /// An API key to use when making requests to the server, if required. + /// An optional callback to configure the used when making HTTP requests + /// to the Seq API. + public SeqApiClient(string serverUrl, string apiKey = null, Action configureHttpClientHandler = null) { ServerUrl = serverUrl ?? throw new ArgumentNullException(nameof(serverUrl)); @@ -65,10 +79,11 @@ public SeqApiClient(string serverUrl, string apiKey = null, bool useDefaultCrede var handler = new HttpClientHandler { - CookieContainer = _cookies, - UseDefaultCredentials = useDefaultCredentials + CookieContainer = _cookies }; + configureHttpClientHandler?.Invoke(handler); + var baseAddress = serverUrl; if (!baseAddress.EndsWith("/")) baseAddress += "/"; diff --git a/src/Seq.Api/SeqConnection.cs b/src/Seq.Api/SeqConnection.cs index 8388519..d7e7ba8 100644 --- a/src/Seq.Api/SeqConnection.cs +++ b/src/Seq.Api/SeqConnection.cs @@ -14,7 +14,9 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Net; +using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Seq.Api.Client; @@ -27,7 +29,7 @@ namespace Seq.Api /// /// Exposes high-level (typed) interactions with the Seq API through various resource groups. /// - public class SeqConnection : ISeqConnection + public class SeqConnection : ISeqConnection, IDisposable { readonly object _sync = new object(); readonly Dictionary> _resourceGroups = new Dictionary>(); @@ -39,12 +41,34 @@ public class SeqConnection : ISeqConnection /// The base URL of the Seq server. /// An API key to use when making requests to the server, if required. /// Whether default credentials will be sent with HTTP requests; the default is true. - public SeqConnection(string serverUrl, string apiKey = null, bool useDefaultCredentials = true) + [Obsolete("Prefer `SeqConnection(serverUrl, apiKey, handler => handler.UseDefaultCredentials = true)` instead."), EditorBrowsable(EditorBrowsableState.Never)] + public SeqConnection(string serverUrl, string apiKey, bool useDefaultCredentials) { if (serverUrl == null) throw new ArgumentNullException(nameof(serverUrl)); Client = new SeqApiClient(serverUrl, apiKey, useDefaultCredentials); } + + /// + /// Construct a . + /// + /// The base URL of the Seq server. + /// An API key to use when making requests to the server, if required. + /// An optional callback to configure the used when making HTTP requests + /// to the Seq API. + public SeqConnection(string serverUrl, string apiKey = null, Action configureHttpClientHandler = null) + { + if (serverUrl == null) throw new ArgumentNullException(nameof(serverUrl)); + Client = new SeqApiClient(serverUrl, apiKey, configureHttpClientHandler); + } + /// + /// + /// + public void Dispose() + { + Client.Dispose(); + } + /// /// Access the lower-level that can be used for resource-oriented navigation through /// the HTTP API. diff --git a/test/Seq.Api.Tests/SeqConnectionTests.cs b/test/Seq.Api.Tests/SeqConnectionTests.cs new file mode 100644 index 0000000..2c30f87 --- /dev/null +++ b/test/Seq.Api.Tests/SeqConnectionTests.cs @@ -0,0 +1,20 @@ +using Xunit; + +namespace Seq.Api.Tests +{ + public class SeqConnectionTests + { + [Fact] + public void WhenConstructedTheHandlerConfigurationCallbackIsCalled() + { + var callCount = 0; + + using var _ = new SeqConnection("https://test.example.com", null, handler => { + Assert.NotNull(handler); + ++callCount; + }); + + Assert.Equal(1, callCount); + } + } +} From d78719ac16b961ff5cc15a87cb04e31106555615 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Sat, 28 Dec 2019 09:25:04 +1000 Subject: [PATCH 3/9] Use VS2019 build image --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index d9e88cd..696820f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ version: '{build}' skip_tags: true -image: Visual Studio 2017 +image: Visual Studio 2019 configuration: Release install: build_script: From 8dea854ae43f0c3f1198a20bc49734cef5477d33 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Sat, 28 Dec 2019 09:26:04 +1000 Subject: [PATCH 4/9] Quick YAML clean-up --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 696820f..872f321 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,6 @@ version: '{build}' skip_tags: true image: Visual Studio 2019 -configuration: Release -install: build_script: - ps: ./Build.ps1 test: off From e4e3f276049220ba75d3953b4cb8124812d83367 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Wed, 22 Apr 2020 13:18:00 +1000 Subject: [PATCH 5/9] Update with the lastest Seq preview features --- example/SignalCopy/Program.cs | 2 +- src/Seq.Api/Client/SeqApiClient.cs | 2 +- src/Seq.Api/Client/SeqApiException.cs | 2 +- .../Model/AppInstances/AppInstanceEntity.cs | 2 +- .../AppInstances/AppInstanceMetricsPart.cs | 2 +- src/Seq.Api/Model/Apps/AppEntity.cs | 2 +- src/Seq.Api/Model/Apps/AppPackagePart.cs | 2 +- src/Seq.Api/Model/Apps/AppSettingPart.cs | 2 +- src/Seq.Api/Model/Backups/BackupEntity.cs | 2 +- .../Data/QueryExecutionStatisticsPart.cs | 6 +- src/Seq.Api/Model/Data/QueryResultPart.cs | 2 +- src/Seq.Api/Model/Data/TimeSlicePart.cs | 2 +- src/Seq.Api/Model/Data/TimeseriesPart.cs | 2 +- .../Model/Diagnostics/RunningTaskPart.cs | 2 +- .../Model/Diagnostics/ServerMetricsEntity.cs | 2 +- .../Model/Diagnostics/ServerStatusPart.cs | 2 +- .../Model/Diagnostics/StatusMessagePart.cs | 2 +- src/Seq.Api/Model/Entity.cs | 2 +- src/Seq.Api/Model/Events/DeleteResultPart.cs | 2 +- src/Seq.Api/Model/Events/EventEntity.cs | 2 +- .../Model/Events/EventInputResultPart.cs | 2 +- src/Seq.Api/Model/Events/EventPropertyPart.cs | 2 +- .../Model/Events/MessageTemplateTokenPart.cs | 2 +- src/Seq.Api/Model/Events/ResultSetPart.cs | 2 +- .../Model/Expressions/ExpressionPart.cs | 2 +- .../Model/Expressions/SqlExpressionPart.cs | 2 +- src/Seq.Api/Model/Feeds/NuGetFeedEntity.cs | 2 +- src/Seq.Api/Model/ILinked.cs | 2 +- src/Seq.Api/Model/Inputs/ApiKeyEntity.cs | 2 +- src/Seq.Api/Model/Inputs/ApiKeyMetricsPart.cs | 2 +- .../Model/Inputs/InputAppliedPropertyPart.cs | 2 +- src/Seq.Api/Model/License/LicenseEntity.cs | 2 +- src/Seq.Api/Model/Link.cs | 2 +- src/Seq.Api/Model/LinkCollection.cs | 2 +- src/Seq.Api/Model/LogEvents/LogEventLevel.cs | 2 +- src/Seq.Api/Model/Monitoring/AlertPart.cs | 2 +- .../Model/Monitoring/AlertStateEntity.cs | 79 +++++++++++++++++++ .../Model/Monitoring/ChartDisplayStylePart.cs | 2 +- src/Seq.Api/Model/Monitoring/ChartPart.cs | 2 +- .../Model/Monitoring/ChartQueryPart.cs | 2 +- .../Model/Monitoring/DashboardEntity.cs | 2 +- .../Monitoring/MeasurementDisplayPalette.cs | 2 +- .../Monitoring/MeasurementDisplayStylePart.cs | 2 +- .../Monitoring/MeasurementDisplayType.cs | 2 +- .../Model/Monitoring/MeasurementPart.cs | 2 +- .../Model/Permalinks/PermalinkEntity.cs | 2 +- src/Seq.Api/Model/ResourceGroup.cs | 2 +- .../Model/Retention/RetentionPolicyEntity.cs | 2 +- src/Seq.Api/Model/Root/RootEntity.cs | 2 +- src/Seq.Api/Model/Security/Permission.cs | 2 +- src/Seq.Api/Model/Security/RoleEntity.cs | 2 +- src/Seq.Api/Model/Security/WellKnownRole.cs | 2 +- .../InternalErrorReportingSettingsPart.cs | 2 +- src/Seq.Api/Model/Settings/SettingEntity.cs | 2 +- src/Seq.Api/Model/Settings/SettingName.cs | 7 +- .../Model/Shared/DeferredRequestEntity.cs | 2 +- src/Seq.Api/Model/Shared/ErrorPart.cs | 2 +- src/Seq.Api/Model/Shared/ResultSetStatus.cs | 2 +- src/Seq.Api/Model/Shared/StatisticsPart.cs | 4 +- ...gedPropertyPart.cs => SignalColumnPart.cs} | 10 +-- src/Seq.Api/Model/Signals/SignalEntity.cs | 8 +- .../Model/Signals/SignalExpressionKind.cs | 2 +- .../Model/Signals/SignalExpressionPart.cs | 2 +- src/Seq.Api/Model/Signals/SignalFilterPart.cs | 2 +- src/Seq.Api/Model/Signals/SignalGrouping.cs | 2 +- .../Model/SqlQueries/SqlQueryEntity.cs | 2 +- .../Model/Updates/AvailableUpdateEntity.cs | 2 +- .../Model/Users/AuthProviderInfoPart.cs | 2 +- src/Seq.Api/Model/Users/AuthProvidersPart.cs | 2 +- src/Seq.Api/Model/Users/CredentialsPart.cs | 2 +- .../Model/Users/SearchHistoryEntity.cs | 2 +- .../Model/Users/SearchHistoryItemPart.cs | 2 +- .../Model/Users/SearchHistoryItemStatus.cs | 2 +- src/Seq.Api/Model/Users/UserEntity.cs | 2 +- .../Model/Workspaces/WorkspaceContentPart.cs | 2 +- .../Model/Workspaces/WorkspaceEntity.cs | 2 +- .../ResourceGroups/AlertStateResourceGroup.cs | 65 +++++++++++++++ .../ResourceGroups/ApiKeysResourceGroup.cs | 2 +- .../ResourceGroups/ApiResourceGroup.cs | 2 +- .../AppInstancesResourceGroup.cs | 2 +- .../ResourceGroups/AppsResourceGroup.cs | 4 +- .../ResourceGroups/BackupsResourceGroup.cs | 2 +- .../ResourceGroups/DashboardsResourceGroup.cs | 2 +- .../ResourceGroups/DataResourceGroup.cs | 2 +- .../DiagnosticsResourceGroup.cs | 2 +- .../ResourceGroups/EventsResourceGroup.cs | 2 +- .../ExpressionsResourceGroup.cs | 2 +- .../ResourceGroups/FeedsResourceGroup.cs | 4 +- src/Seq.Api/ResourceGroups/ISeqConnection.cs | 2 +- .../ResourceGroups/LicensesResourceGroup.cs | 2 +- .../ResourceGroups/PermalinksResourceGroup.cs | 2 +- .../RetentionPoliciesResourceGroup.cs | 2 +- .../ResourceGroups/RolesResourceGroup.cs | 2 +- .../ResourceGroups/SettingsResourceGroup.cs | 12 +-- .../ResourceGroups/SignalsResourceGroup.cs | 2 +- .../ResourceGroups/SqlQueriesResourceGroup.cs | 2 +- .../ResourceGroups/UpdatesResourceGroup.cs | 2 +- .../ResourceGroups/UsersResourceGroup.cs | 4 +- .../ResourceGroups/WorkspacesResourceGroup.cs | 2 +- src/Seq.Api/Seq.Api.csproj | 10 +-- src/Seq.Api/SeqConnection.cs | 10 ++- .../Serialization/LinkCollectionConverter.cs | 2 +- .../Streams/ObservableStream.Unsubscriber.cs | 2 +- src/Seq.Api/Streams/ObservableStream.cs | 22 +++--- 104 files changed, 292 insertions(+), 133 deletions(-) create mode 100644 src/Seq.Api/Model/Monitoring/AlertStateEntity.cs rename src/Seq.Api/Model/Signals/{TaggedPropertyPart.cs => SignalColumnPart.cs} (74%) create mode 100644 src/Seq.Api/ResourceGroups/AlertStateResourceGroup.cs diff --git a/example/SignalCopy/Program.cs b/example/SignalCopy/Program.cs index 539afe6..89b57cd 100644 --- a/example/SignalCopy/Program.cs +++ b/example/SignalCopy/Program.cs @@ -94,7 +94,7 @@ static async Task Run(string src, string srcKey, string dst, string dstKey) target.Title = signal.Title; target.Filters = signal.Filters; - target.TaggedProperties = signal.TaggedProperties; + target.Columns = signal.Columns; target.Description = signal.Description + " (copy)"; await (target.Id != null ? dstConnection.Signals.UpdateAsync(target) : dstConnection.Signals.AddAsync(target)); diff --git a/src/Seq.Api/Client/SeqApiClient.cs b/src/Seq.Api/Client/SeqApiClient.cs index 13445df..2108ac1 100644 --- a/src/Seq.Api/Client/SeqApiClient.cs +++ b/src/Seq.Api/Client/SeqApiClient.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Client/SeqApiException.cs b/src/Seq.Api/Client/SeqApiException.cs index fc53da9..853a1b3 100644 --- a/src/Seq.Api/Client/SeqApiException.cs +++ b/src/Seq.Api/Client/SeqApiException.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs b/src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs index ea7558f..2f76a56 100644 --- a/src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs +++ b/src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/AppInstances/AppInstanceMetricsPart.cs b/src/Seq.Api/Model/AppInstances/AppInstanceMetricsPart.cs index a164809..bcf348c 100644 --- a/src/Seq.Api/Model/AppInstances/AppInstanceMetricsPart.cs +++ b/src/Seq.Api/Model/AppInstances/AppInstanceMetricsPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Apps/AppEntity.cs b/src/Seq.Api/Model/Apps/AppEntity.cs index f7a260e..a2ee358 100644 --- a/src/Seq.Api/Model/Apps/AppEntity.cs +++ b/src/Seq.Api/Model/Apps/AppEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Apps/AppPackagePart.cs b/src/Seq.Api/Model/Apps/AppPackagePart.cs index 42b28fe..6064781 100644 --- a/src/Seq.Api/Model/Apps/AppPackagePart.cs +++ b/src/Seq.Api/Model/Apps/AppPackagePart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Apps/AppSettingPart.cs b/src/Seq.Api/Model/Apps/AppSettingPart.cs index ddc21bc..d04f83e 100644 --- a/src/Seq.Api/Model/Apps/AppSettingPart.cs +++ b/src/Seq.Api/Model/Apps/AppSettingPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Backups/BackupEntity.cs b/src/Seq.Api/Model/Backups/BackupEntity.cs index 3823b2c..9130f30 100644 --- a/src/Seq.Api/Model/Backups/BackupEntity.cs +++ b/src/Seq.Api/Model/Backups/BackupEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Data/QueryExecutionStatisticsPart.cs b/src/Seq.Api/Model/Data/QueryExecutionStatisticsPart.cs index 5a7e8c7..ac3f6d7 100644 --- a/src/Seq.Api/Model/Data/QueryExecutionStatisticsPart.cs +++ b/src/Seq.Api/Model/Data/QueryExecutionStatisticsPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,12 +23,12 @@ public class QueryExecutionStatisticsPart /// The number of events inspected in the course of computing the query result. This will /// not include events that could be skipped based on index information or text pre-filtering. /// - public long ScannedEventCount { get; set; } + public ulong ScannedEventCount { get; set; } /// /// The number of events that contributed to the query result. /// - public long MatchingEventCount { get; set; } + public ulong MatchingEventCount { get; set; } /// /// Whether the query needed to search disk-backed storage. diff --git a/src/Seq.Api/Model/Data/QueryResultPart.cs b/src/Seq.Api/Model/Data/QueryResultPart.cs index 81bb654..dcbefd6 100644 --- a/src/Seq.Api/Model/Data/QueryResultPart.cs +++ b/src/Seq.Api/Model/Data/QueryResultPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Data/TimeSlicePart.cs b/src/Seq.Api/Model/Data/TimeSlicePart.cs index 32f7b93..7b50ff8 100644 --- a/src/Seq.Api/Model/Data/TimeSlicePart.cs +++ b/src/Seq.Api/Model/Data/TimeSlicePart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Data/TimeseriesPart.cs b/src/Seq.Api/Model/Data/TimeseriesPart.cs index 058dad5..0713919 100644 --- a/src/Seq.Api/Model/Data/TimeseriesPart.cs +++ b/src/Seq.Api/Model/Data/TimeseriesPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Diagnostics/RunningTaskPart.cs b/src/Seq.Api/Model/Diagnostics/RunningTaskPart.cs index 5274276..fc6c2fd 100644 --- a/src/Seq.Api/Model/Diagnostics/RunningTaskPart.cs +++ b/src/Seq.Api/Model/Diagnostics/RunningTaskPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs b/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs index 2865050..63051ea 100644 --- a/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs +++ b/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Diagnostics/ServerStatusPart.cs b/src/Seq.Api/Model/Diagnostics/ServerStatusPart.cs index 00c3054..e9fc286 100644 --- a/src/Seq.Api/Model/Diagnostics/ServerStatusPart.cs +++ b/src/Seq.Api/Model/Diagnostics/ServerStatusPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Diagnostics/StatusMessagePart.cs b/src/Seq.Api/Model/Diagnostics/StatusMessagePart.cs index 196ee8e..e35e0f3 100644 --- a/src/Seq.Api/Model/Diagnostics/StatusMessagePart.cs +++ b/src/Seq.Api/Model/Diagnostics/StatusMessagePart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Entity.cs b/src/Seq.Api/Model/Entity.cs index 9b3e02e..23e0825 100644 --- a/src/Seq.Api/Model/Entity.cs +++ b/src/Seq.Api/Model/Entity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Events/DeleteResultPart.cs b/src/Seq.Api/Model/Events/DeleteResultPart.cs index 4c7943d..0c54518 100644 --- a/src/Seq.Api/Model/Events/DeleteResultPart.cs +++ b/src/Seq.Api/Model/Events/DeleteResultPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Events/EventEntity.cs b/src/Seq.Api/Model/Events/EventEntity.cs index 5995066..48181d6 100644 --- a/src/Seq.Api/Model/Events/EventEntity.cs +++ b/src/Seq.Api/Model/Events/EventEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Events/EventInputResultPart.cs b/src/Seq.Api/Model/Events/EventInputResultPart.cs index 07ec1f6..c0ca947 100644 --- a/src/Seq.Api/Model/Events/EventInputResultPart.cs +++ b/src/Seq.Api/Model/Events/EventInputResultPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Events/EventPropertyPart.cs b/src/Seq.Api/Model/Events/EventPropertyPart.cs index 006ce1e..1c54054 100644 --- a/src/Seq.Api/Model/Events/EventPropertyPart.cs +++ b/src/Seq.Api/Model/Events/EventPropertyPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Events/MessageTemplateTokenPart.cs b/src/Seq.Api/Model/Events/MessageTemplateTokenPart.cs index a691e52..707c0a1 100644 --- a/src/Seq.Api/Model/Events/MessageTemplateTokenPart.cs +++ b/src/Seq.Api/Model/Events/MessageTemplateTokenPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Events/ResultSetPart.cs b/src/Seq.Api/Model/Events/ResultSetPart.cs index c900a15..6a05567 100644 --- a/src/Seq.Api/Model/Events/ResultSetPart.cs +++ b/src/Seq.Api/Model/Events/ResultSetPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Expressions/ExpressionPart.cs b/src/Seq.Api/Model/Expressions/ExpressionPart.cs index 5362840..82a492b 100644 --- a/src/Seq.Api/Model/Expressions/ExpressionPart.cs +++ b/src/Seq.Api/Model/Expressions/ExpressionPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Expressions/SqlExpressionPart.cs b/src/Seq.Api/Model/Expressions/SqlExpressionPart.cs index e7650e6..efd26c7 100644 --- a/src/Seq.Api/Model/Expressions/SqlExpressionPart.cs +++ b/src/Seq.Api/Model/Expressions/SqlExpressionPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Feeds/NuGetFeedEntity.cs b/src/Seq.Api/Model/Feeds/NuGetFeedEntity.cs index bb318f0..03184d3 100644 --- a/src/Seq.Api/Model/Feeds/NuGetFeedEntity.cs +++ b/src/Seq.Api/Model/Feeds/NuGetFeedEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/ILinked.cs b/src/Seq.Api/Model/ILinked.cs index ae30187..6c3dbe6 100644 --- a/src/Seq.Api/Model/ILinked.cs +++ b/src/Seq.Api/Model/ILinked.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Inputs/ApiKeyEntity.cs b/src/Seq.Api/Model/Inputs/ApiKeyEntity.cs index 9cc7300..f755713 100644 --- a/src/Seq.Api/Model/Inputs/ApiKeyEntity.cs +++ b/src/Seq.Api/Model/Inputs/ApiKeyEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Inputs/ApiKeyMetricsPart.cs b/src/Seq.Api/Model/Inputs/ApiKeyMetricsPart.cs index d68ec35..7e431ad 100644 --- a/src/Seq.Api/Model/Inputs/ApiKeyMetricsPart.cs +++ b/src/Seq.Api/Model/Inputs/ApiKeyMetricsPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Inputs/InputAppliedPropertyPart.cs b/src/Seq.Api/Model/Inputs/InputAppliedPropertyPart.cs index 3a6fb3d..6f4d3d4 100644 --- a/src/Seq.Api/Model/Inputs/InputAppliedPropertyPart.cs +++ b/src/Seq.Api/Model/Inputs/InputAppliedPropertyPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/License/LicenseEntity.cs b/src/Seq.Api/Model/License/LicenseEntity.cs index f03d3ca..ea7aa61 100644 --- a/src/Seq.Api/Model/License/LicenseEntity.cs +++ b/src/Seq.Api/Model/License/LicenseEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Link.cs b/src/Seq.Api/Model/Link.cs index 0513d68..6d48fc8 100644 --- a/src/Seq.Api/Model/Link.cs +++ b/src/Seq.Api/Model/Link.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/LinkCollection.cs b/src/Seq.Api/Model/LinkCollection.cs index 27fc505..b122b97 100644 --- a/src/Seq.Api/Model/LinkCollection.cs +++ b/src/Seq.Api/Model/LinkCollection.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/LogEvents/LogEventLevel.cs b/src/Seq.Api/Model/LogEvents/LogEventLevel.cs index dde7281..35160e7 100644 --- a/src/Seq.Api/Model/LogEvents/LogEventLevel.cs +++ b/src/Seq.Api/Model/LogEvents/LogEventLevel.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Monitoring/AlertPart.cs b/src/Seq.Api/Model/Monitoring/AlertPart.cs index d9b10a7..678311d 100644 --- a/src/Seq.Api/Model/Monitoring/AlertPart.cs +++ b/src/Seq.Api/Model/Monitoring/AlertPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Monitoring/AlertStateEntity.cs b/src/Seq.Api/Model/Monitoring/AlertStateEntity.cs new file mode 100644 index 0000000..27ba7f6 --- /dev/null +++ b/src/Seq.Api/Model/Monitoring/AlertStateEntity.cs @@ -0,0 +1,79 @@ +// Copyright Datalust and contributors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace Seq.Api.Model.Monitoring +{ + /// + /// Describes the state of an active alert. + /// + public class AlertStateEntity : Entity + { + /// + /// The unique id of the alert being described. + /// + public string AlertId { get; set; } + + /// + /// The alert's title. + /// + public string Title { get; set; } + + /// + /// The title of the chart to which the alert is attached. + /// + public string ChartTitle { get; set; } + + /// + /// The title of the dashboards in which the alert is set. + /// + public string DashboardTitle { get; set; } + + /// + /// The user id of the user who owns the alert; if null, the alert is shared. + /// + public string OwnerId { get; set; } + + /// + /// The notification level associated with the alert. + /// + public string Level { get; set; } + + /// + /// The id of an app instance that will receive notifications when the alert is triggered. + /// + public string NotificationAppInstanceId { get; set; } + + /// + /// The time at which the alert was last checked. Not preserved across server restarts. + /// + public DateTime? LastCheck { get; set; } + + /// + /// The time at which the alert last triggered a notification. Not preserved across server restarts. + /// + public DateTime? LastNotification { get; set; } + + /// + /// The time until which no further notifications will be sent by the alert. + /// + public DateTime? SuppressedUntil { get; set; } + + /// + /// true if the alert is in the failing state; otherwise, false. + /// + public bool IsFailing { get; set; } + } +} diff --git a/src/Seq.Api/Model/Monitoring/ChartDisplayStylePart.cs b/src/Seq.Api/Model/Monitoring/ChartDisplayStylePart.cs index 32af9b0..7f6dbf4 100644 --- a/src/Seq.Api/Model/Monitoring/ChartDisplayStylePart.cs +++ b/src/Seq.Api/Model/Monitoring/ChartDisplayStylePart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Monitoring/ChartPart.cs b/src/Seq.Api/Model/Monitoring/ChartPart.cs index 196a11c..6e8c092 100644 --- a/src/Seq.Api/Model/Monitoring/ChartPart.cs +++ b/src/Seq.Api/Model/Monitoring/ChartPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Monitoring/ChartQueryPart.cs b/src/Seq.Api/Model/Monitoring/ChartQueryPart.cs index d2562bb..069bf86 100644 --- a/src/Seq.Api/Model/Monitoring/ChartQueryPart.cs +++ b/src/Seq.Api/Model/Monitoring/ChartQueryPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Monitoring/DashboardEntity.cs b/src/Seq.Api/Model/Monitoring/DashboardEntity.cs index ba6f91a..9a49d10 100644 --- a/src/Seq.Api/Model/Monitoring/DashboardEntity.cs +++ b/src/Seq.Api/Model/Monitoring/DashboardEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Monitoring/MeasurementDisplayPalette.cs b/src/Seq.Api/Model/Monitoring/MeasurementDisplayPalette.cs index 8b16577..401c3f8 100644 --- a/src/Seq.Api/Model/Monitoring/MeasurementDisplayPalette.cs +++ b/src/Seq.Api/Model/Monitoring/MeasurementDisplayPalette.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Monitoring/MeasurementDisplayStylePart.cs b/src/Seq.Api/Model/Monitoring/MeasurementDisplayStylePart.cs index 9f22f40..9cfd9c6 100644 --- a/src/Seq.Api/Model/Monitoring/MeasurementDisplayStylePart.cs +++ b/src/Seq.Api/Model/Monitoring/MeasurementDisplayStylePart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Monitoring/MeasurementDisplayType.cs b/src/Seq.Api/Model/Monitoring/MeasurementDisplayType.cs index c1f28cc..61e6b57 100644 --- a/src/Seq.Api/Model/Monitoring/MeasurementDisplayType.cs +++ b/src/Seq.Api/Model/Monitoring/MeasurementDisplayType.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Monitoring/MeasurementPart.cs b/src/Seq.Api/Model/Monitoring/MeasurementPart.cs index b43f863..97edb6a 100644 --- a/src/Seq.Api/Model/Monitoring/MeasurementPart.cs +++ b/src/Seq.Api/Model/Monitoring/MeasurementPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Permalinks/PermalinkEntity.cs b/src/Seq.Api/Model/Permalinks/PermalinkEntity.cs index 539e0fe..d2fc667 100644 --- a/src/Seq.Api/Model/Permalinks/PermalinkEntity.cs +++ b/src/Seq.Api/Model/Permalinks/PermalinkEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/ResourceGroup.cs b/src/Seq.Api/Model/ResourceGroup.cs index 3837ca8..0d4ba32 100644 --- a/src/Seq.Api/Model/ResourceGroup.cs +++ b/src/Seq.Api/Model/ResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Retention/RetentionPolicyEntity.cs b/src/Seq.Api/Model/Retention/RetentionPolicyEntity.cs index 451460b..ef8a587 100644 --- a/src/Seq.Api/Model/Retention/RetentionPolicyEntity.cs +++ b/src/Seq.Api/Model/Retention/RetentionPolicyEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Root/RootEntity.cs b/src/Seq.Api/Model/Root/RootEntity.cs index f529f3b..ebaacf7 100644 --- a/src/Seq.Api/Model/Root/RootEntity.cs +++ b/src/Seq.Api/Model/Root/RootEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Security/Permission.cs b/src/Seq.Api/Model/Security/Permission.cs index 0ef450c..8c8b015 100644 --- a/src/Seq.Api/Model/Security/Permission.cs +++ b/src/Seq.Api/Model/Security/Permission.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Security/RoleEntity.cs b/src/Seq.Api/Model/Security/RoleEntity.cs index c44748c..57ad0e8 100644 --- a/src/Seq.Api/Model/Security/RoleEntity.cs +++ b/src/Seq.Api/Model/Security/RoleEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Security/WellKnownRole.cs b/src/Seq.Api/Model/Security/WellKnownRole.cs index 4a05e5c..b4631ef 100644 --- a/src/Seq.Api/Model/Security/WellKnownRole.cs +++ b/src/Seq.Api/Model/Security/WellKnownRole.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Settings/InternalErrorReportingSettingsPart.cs b/src/Seq.Api/Model/Settings/InternalErrorReportingSettingsPart.cs index cee8bd9..8f6a00d 100644 --- a/src/Seq.Api/Model/Settings/InternalErrorReportingSettingsPart.cs +++ b/src/Seq.Api/Model/Settings/InternalErrorReportingSettingsPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Settings/SettingEntity.cs b/src/Seq.Api/Model/Settings/SettingEntity.cs index 9b35481..11e4153 100644 --- a/src/Seq.Api/Model/Settings/SettingEntity.cs +++ b/src/Seq.Api/Model/Settings/SettingEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Settings/SettingName.cs b/src/Seq.Api/Model/Settings/SettingName.cs index 955684f..5740a87 100644 --- a/src/Seq.Api/Model/Settings/SettingName.cs +++ b/src/Seq.Api/Model/Settings/SettingName.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -110,6 +110,11 @@ public enum SettingName /// MinimumFreeStorageSpace, + /// + /// A comma-separated list of role ids that will be assigned to new users by default. + /// + NewUserRoleIds, + /// /// A comma-separated list of (shared) signal ids that will be included in any new user's /// personal default workspace. diff --git a/src/Seq.Api/Model/Shared/DeferredRequestEntity.cs b/src/Seq.Api/Model/Shared/DeferredRequestEntity.cs index 517b19a..486e851 100644 --- a/src/Seq.Api/Model/Shared/DeferredRequestEntity.cs +++ b/src/Seq.Api/Model/Shared/DeferredRequestEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Shared/ErrorPart.cs b/src/Seq.Api/Model/Shared/ErrorPart.cs index fca82e2..d3dcdc9 100644 --- a/src/Seq.Api/Model/Shared/ErrorPart.cs +++ b/src/Seq.Api/Model/Shared/ErrorPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Shared/ResultSetStatus.cs b/src/Seq.Api/Model/Shared/ResultSetStatus.cs index dcd375d..23fbb04 100644 --- a/src/Seq.Api/Model/Shared/ResultSetStatus.cs +++ b/src/Seq.Api/Model/Shared/ResultSetStatus.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Shared/StatisticsPart.cs b/src/Seq.Api/Model/Shared/StatisticsPart.cs index c66140d..a560132 100644 --- a/src/Seq.Api/Model/Shared/StatisticsPart.cs +++ b/src/Seq.Api/Model/Shared/StatisticsPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ public class StatisticsPart /// The number of events that were scanned in the search (and were not /// able to be excluded based on index information or pre-filtering). /// - public long ScannedEventCount { get; set; } + public ulong ScannedEventCount { get; set; } /// /// The id of the last event inspected in the search. diff --git a/src/Seq.Api/Model/Signals/TaggedPropertyPart.cs b/src/Seq.Api/Model/Signals/SignalColumnPart.cs similarity index 74% rename from src/Seq.Api/Model/Signals/TaggedPropertyPart.cs rename to src/Seq.Api/Model/Signals/SignalColumnPart.cs index 2e54080..f716900 100644 --- a/src/Seq.Api/Model/Signals/TaggedPropertyPart.cs +++ b/src/Seq.Api/Model/Signals/SignalColumnPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,14 +15,14 @@ namespace Seq.Api.Model.Signals { /// - /// A property that will be displayed as a column when a signal + /// An expression that will be displayed as a column when a signal /// including it is selected. /// - public class TaggedPropertyPart + public class SignalColumnPart { /// - /// The property name. + /// The expression to show as a column. /// - public string PropertyName { get; set; } + public string Expression { get; set; } } } diff --git a/src/Seq.Api/Model/Signals/SignalEntity.cs b/src/Seq.Api/Model/Signals/SignalEntity.cs index c45d02d..0c266d0 100644 --- a/src/Seq.Api/Model/Signals/SignalEntity.cs +++ b/src/Seq.Api/Model/Signals/SignalEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ public SignalEntity() { Title = "New Signal"; Filters = new List(); - TaggedProperties = new List(); + Columns = new List(); } /// @@ -50,9 +50,9 @@ public SignalEntity() public List Filters { get; set; } /// - /// Properties that show as columns when the signal is selected in the events screen. + /// Expressions that show as columns when the signal is selected in the events screen. /// - public List TaggedProperties { get; set; } + public List Columns { get; set; } /// /// Obsolete. diff --git a/src/Seq.Api/Model/Signals/SignalExpressionKind.cs b/src/Seq.Api/Model/Signals/SignalExpressionKind.cs index 323bf65..ee1540e 100644 --- a/src/Seq.Api/Model/Signals/SignalExpressionKind.cs +++ b/src/Seq.Api/Model/Signals/SignalExpressionKind.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Signals/SignalExpressionPart.cs b/src/Seq.Api/Model/Signals/SignalExpressionPart.cs index 054c08b..7f31382 100644 --- a/src/Seq.Api/Model/Signals/SignalExpressionPart.cs +++ b/src/Seq.Api/Model/Signals/SignalExpressionPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Signals/SignalFilterPart.cs b/src/Seq.Api/Model/Signals/SignalFilterPart.cs index 78675e9..7f77324 100644 --- a/src/Seq.Api/Model/Signals/SignalFilterPart.cs +++ b/src/Seq.Api/Model/Signals/SignalFilterPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Signals/SignalGrouping.cs b/src/Seq.Api/Model/Signals/SignalGrouping.cs index e4e9c8c..db31b85 100644 --- a/src/Seq.Api/Model/Signals/SignalGrouping.cs +++ b/src/Seq.Api/Model/Signals/SignalGrouping.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/SqlQueries/SqlQueryEntity.cs b/src/Seq.Api/Model/SqlQueries/SqlQueryEntity.cs index 826928b..528c865 100644 --- a/src/Seq.Api/Model/SqlQueries/SqlQueryEntity.cs +++ b/src/Seq.Api/Model/SqlQueries/SqlQueryEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Updates/AvailableUpdateEntity.cs b/src/Seq.Api/Model/Updates/AvailableUpdateEntity.cs index 938fe46..a87fd8e 100644 --- a/src/Seq.Api/Model/Updates/AvailableUpdateEntity.cs +++ b/src/Seq.Api/Model/Updates/AvailableUpdateEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Users/AuthProviderInfoPart.cs b/src/Seq.Api/Model/Users/AuthProviderInfoPart.cs index deeece0..1e17049 100644 --- a/src/Seq.Api/Model/Users/AuthProviderInfoPart.cs +++ b/src/Seq.Api/Model/Users/AuthProviderInfoPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Users/AuthProvidersPart.cs b/src/Seq.Api/Model/Users/AuthProvidersPart.cs index effaca0..4bedb21 100644 --- a/src/Seq.Api/Model/Users/AuthProvidersPart.cs +++ b/src/Seq.Api/Model/Users/AuthProvidersPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Users/CredentialsPart.cs b/src/Seq.Api/Model/Users/CredentialsPart.cs index 46d95c5..252394e 100644 --- a/src/Seq.Api/Model/Users/CredentialsPart.cs +++ b/src/Seq.Api/Model/Users/CredentialsPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Users/SearchHistoryEntity.cs b/src/Seq.Api/Model/Users/SearchHistoryEntity.cs index 19c5638..9d2c901 100644 --- a/src/Seq.Api/Model/Users/SearchHistoryEntity.cs +++ b/src/Seq.Api/Model/Users/SearchHistoryEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Users/SearchHistoryItemPart.cs b/src/Seq.Api/Model/Users/SearchHistoryItemPart.cs index 91777fa..1014a7a 100644 --- a/src/Seq.Api/Model/Users/SearchHistoryItemPart.cs +++ b/src/Seq.Api/Model/Users/SearchHistoryItemPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Users/SearchHistoryItemStatus.cs b/src/Seq.Api/Model/Users/SearchHistoryItemStatus.cs index 57c76a5..7944494 100644 --- a/src/Seq.Api/Model/Users/SearchHistoryItemStatus.cs +++ b/src/Seq.Api/Model/Users/SearchHistoryItemStatus.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Users/UserEntity.cs b/src/Seq.Api/Model/Users/UserEntity.cs index d3e97d3..d206fab 100644 --- a/src/Seq.Api/Model/Users/UserEntity.cs +++ b/src/Seq.Api/Model/Users/UserEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Workspaces/WorkspaceContentPart.cs b/src/Seq.Api/Model/Workspaces/WorkspaceContentPart.cs index 82b19af..9b5d666 100644 --- a/src/Seq.Api/Model/Workspaces/WorkspaceContentPart.cs +++ b/src/Seq.Api/Model/Workspaces/WorkspaceContentPart.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Model/Workspaces/WorkspaceEntity.cs b/src/Seq.Api/Model/Workspaces/WorkspaceEntity.cs index 9c3a448..f7b434c 100644 --- a/src/Seq.Api/Model/Workspaces/WorkspaceEntity.cs +++ b/src/Seq.Api/Model/Workspaces/WorkspaceEntity.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/AlertStateResourceGroup.cs b/src/Seq.Api/ResourceGroups/AlertStateResourceGroup.cs new file mode 100644 index 0000000..2ad1fb9 --- /dev/null +++ b/src/Seq.Api/ResourceGroups/AlertStateResourceGroup.cs @@ -0,0 +1,65 @@ +// Copyright Datalust and contributors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Seq.Api.Model.Monitoring; + +namespace Seq.Api.ResourceGroups +{ + /// + /// Inspect the current states of alerts being monitored by the server.. + /// + public class AlertStateResourceGroup : ApiResourceGroup + { + internal AlertStateResourceGroup(ISeqConnection connection) + : base("AlertState", connection) + { + } + + /// + /// Retrieve the alert state with the given id; throws if the entity does not exist. + /// + /// The id of the alert state. + /// A allowing the operation to be canceled. + /// The alert state. + public async Task FindAsync(string id, CancellationToken cancellationToken = default) + { + if (id == null) throw new ArgumentNullException(nameof(id)); + return await GroupGetAsync("Item", new Dictionary { { "id", id } }, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve the states of all alerts being monitored by the server. + /// + /// allowing the operation to be canceled. + /// A list containing all current alert states. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + return await GroupListAsync("Items", null, cancellationToken).ConfigureAwait(false); + } + + /// + /// Remove an alert state; this will remove the corresponding alert. + /// + /// The alert state to remove + /// allowing the operation to be canceled. + public async Task RemoveAsync(AlertStateEntity entity, CancellationToken cancellationToken = default) + { + await Client.DeleteAsync(entity, "Self", entity, cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} diff --git a/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs b/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs index 8f4533e..7de4f5c 100644 --- a/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/ApiResourceGroup.cs b/src/Seq.Api/ResourceGroups/ApiResourceGroup.cs index a31667e..a515dd6 100644 --- a/src/Seq.Api/ResourceGroups/ApiResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/ApiResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs b/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs index d7c55e8..208ddcd 100644 --- a/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/AppsResourceGroup.cs b/src/Seq.Api/ResourceGroups/AppsResourceGroup.cs index 66a6bb0..9b9d76d 100644 --- a/src/Seq.Api/ResourceGroups/AppsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/AppsResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ public async Task TemplateAsync(CancellationToken cancellationToken = /// The app, with server-allocated properties such as initialized. public async Task AddAsync(AppEntity entity, CancellationToken cancellationToken = default) { - return await Client.PostAsync(entity, "Create", entity, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GroupCreateAsync(entity, cancellationToken: cancellationToken).ConfigureAwait(false); } /// diff --git a/src/Seq.Api/ResourceGroups/BackupsResourceGroup.cs b/src/Seq.Api/ResourceGroups/BackupsResourceGroup.cs index 885bc4f..8277985 100644 --- a/src/Seq.Api/ResourceGroups/BackupsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/BackupsResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/DashboardsResourceGroup.cs b/src/Seq.Api/ResourceGroups/DashboardsResourceGroup.cs index b5f7b06..4a673cf 100644 --- a/src/Seq.Api/ResourceGroups/DashboardsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/DashboardsResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/DataResourceGroup.cs b/src/Seq.Api/ResourceGroups/DataResourceGroup.cs index 3ab76f2..33b2690 100644 --- a/src/Seq.Api/ResourceGroups/DataResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/DataResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs b/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs index 6fc7643..9eddec4 100644 --- a/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/EventsResourceGroup.cs b/src/Seq.Api/ResourceGroups/EventsResourceGroup.cs index ad50d98..01b4259 100644 --- a/src/Seq.Api/ResourceGroups/EventsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/EventsResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/ExpressionsResourceGroup.cs b/src/Seq.Api/ResourceGroups/ExpressionsResourceGroup.cs index 0c7631c..50043c0 100644 --- a/src/Seq.Api/ResourceGroups/ExpressionsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/ExpressionsResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/FeedsResourceGroup.cs b/src/Seq.Api/ResourceGroups/FeedsResourceGroup.cs index 937bd57..121ce97 100644 --- a/src/Seq.Api/ResourceGroups/FeedsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/FeedsResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ public async Task TemplateAsync(CancellationToken cancellationT /// The feed, with server-allocated properties such as initialized. public async Task AddAsync(NuGetFeedEntity entity, CancellationToken cancellationToken = default) { - return await Client.PostAsync(entity, "Create", entity, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GroupCreateAsync(entity, cancellationToken: cancellationToken).ConfigureAwait(false); } /// diff --git a/src/Seq.Api/ResourceGroups/ISeqConnection.cs b/src/Seq.Api/ResourceGroups/ISeqConnection.cs index 990c01e..ae29134 100644 --- a/src/Seq.Api/ResourceGroups/ISeqConnection.cs +++ b/src/Seq.Api/ResourceGroups/ISeqConnection.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/LicensesResourceGroup.cs b/src/Seq.Api/ResourceGroups/LicensesResourceGroup.cs index 7d96750..9bb8e17 100644 --- a/src/Seq.Api/ResourceGroups/LicensesResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/LicensesResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/PermalinksResourceGroup.cs b/src/Seq.Api/ResourceGroups/PermalinksResourceGroup.cs index 6c46965..166821d 100644 --- a/src/Seq.Api/ResourceGroups/PermalinksResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/PermalinksResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/RetentionPoliciesResourceGroup.cs b/src/Seq.Api/ResourceGroups/RetentionPoliciesResourceGroup.cs index 759f40a..9c3d712 100644 --- a/src/Seq.Api/ResourceGroups/RetentionPoliciesResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/RetentionPoliciesResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/RolesResourceGroup.cs b/src/Seq.Api/ResourceGroups/RolesResourceGroup.cs index 4e3aee3..bdc61ca 100644 --- a/src/Seq.Api/ResourceGroups/RolesResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/RolesResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/SettingsResourceGroup.cs b/src/Seq.Api/ResourceGroups/SettingsResourceGroup.cs index be9925a..8146b97 100644 --- a/src/Seq.Api/ResourceGroups/SettingsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/SettingsResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -67,20 +67,22 @@ public async Task UpdateAsync(SettingEntity entity, CancellationToken cancellati /// /// Get internal error reporting settings. /// + /// A allowing the operation to be canceled. /// Internal error reporting settings. - public async Task GetInternalErrorReportingAsync() + public async Task GetInternalErrorReportingAsync(CancellationToken cancellationToken = default) { - return await GroupGetAsync("InternalErrorReporting").ConfigureAwait(false); + return await GroupGetAsync("InternalErrorReporting", cancellationToken: cancellationToken).ConfigureAwait(false); } /// /// Update internal error reporting settings. /// /// New internal error reporting settings. + /// A allowing the operation to be canceled. /// A task indicating completion. - public async Task UpdateInternalErrorReportingAsync(InternalErrorReportingSettingsPart internalErrorReporting) + public async Task UpdateInternalErrorReportingAsync(InternalErrorReportingSettingsPart internalErrorReporting, CancellationToken cancellationToken = default) { - await GroupPutAsync("InternalErrorReporting", internalErrorReporting).ConfigureAwait(false); + await GroupPutAsync("InternalErrorReporting", internalErrorReporting, cancellationToken: cancellationToken).ConfigureAwait(false); } } } diff --git a/src/Seq.Api/ResourceGroups/SignalsResourceGroup.cs b/src/Seq.Api/ResourceGroups/SignalsResourceGroup.cs index 4fa3dff..c1fb65c 100644 --- a/src/Seq.Api/ResourceGroups/SignalsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/SignalsResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/SqlQueriesResourceGroup.cs b/src/Seq.Api/ResourceGroups/SqlQueriesResourceGroup.cs index 968ed51..7ce7cde 100644 --- a/src/Seq.Api/ResourceGroups/SqlQueriesResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/SqlQueriesResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/UpdatesResourceGroup.cs b/src/Seq.Api/ResourceGroups/UpdatesResourceGroup.cs index 0016bf8..d5146b2 100644 --- a/src/Seq.Api/ResourceGroups/UpdatesResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/UpdatesResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/ResourceGroups/UsersResourceGroup.cs b/src/Seq.Api/ResourceGroups/UsersResourceGroup.cs index d9a8a9b..c99dae0 100644 --- a/src/Seq.Api/ResourceGroups/UsersResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/UsersResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ public async Task TemplateAsync(CancellationToken cancellationToken /// The user, with server-allocated properties such as initialized. public async Task AddAsync(UserEntity entity, CancellationToken cancellationToken = default) { - return await Client.PostAsync(entity, "Create", entity, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GroupCreateAsync(entity, cancellationToken: cancellationToken).ConfigureAwait(false); } /// diff --git a/src/Seq.Api/ResourceGroups/WorkspacesResourceGroup.cs b/src/Seq.Api/ResourceGroups/WorkspacesResourceGroup.cs index 2231ef9..89b4ce0 100644 --- a/src/Seq.Api/ResourceGroups/WorkspacesResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/WorkspacesResourceGroup.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Seq.Api.csproj b/src/Seq.Api/Seq.Api.csproj index d5fd432..0138235 100644 --- a/src/Seq.Api/Seq.Api.csproj +++ b/src/Seq.Api/Seq.Api.csproj @@ -1,20 +1,20 @@ Client library for the Seq HTTP API. - 5.1.3 + 2020.1.0 Datalust;Contributors - netstandard2.0 + netstandard2.0 true true seq - Copyright © 2014-2019 Datalust Pty Ltd and Contributors + Copyright © Datalust Pty Ltd and Contributors https://datalust.co/images/seq-nuget.png https://github.com/datalust/seq-api Apache-2.0 - 7.3 + 8 - + diff --git a/src/Seq.Api/SeqConnection.cs b/src/Seq.Api/SeqConnection.cs index d7e7ba8..f1f96ba 100644 --- a/src/Seq.Api/SeqConnection.cs +++ b/src/Seq.Api/SeqConnection.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -75,6 +75,12 @@ public void Dispose() /// public SeqApiClient Client { get; } + /// + /// List and administratively remove active alerts. To create/edit/remove alerts in normal + /// circumstances, use . + /// + public AlertStateResourceGroup AlertState => new AlertStateResourceGroup(this); + /// /// Perform operations on API keys. /// @@ -181,7 +187,7 @@ public void Dispose() /// /// The maximum amount of time to retry until giving up. /// A task that will complete if the API could be reached, or fault otherwise. - public async Task EnsureConnected(TimeSpan timeout) + public async Task EnsureConnectedAsync(TimeSpan timeout) { var started = DateTime.UtcNow; // Fractional milliseconds are lost here, but that's fine. diff --git a/src/Seq.Api/Serialization/LinkCollectionConverter.cs b/src/Seq.Api/Serialization/LinkCollectionConverter.cs index c560bed..6c518d5 100644 --- a/src/Seq.Api/Serialization/LinkCollectionConverter.cs +++ b/src/Seq.Api/Serialization/LinkCollectionConverter.cs @@ -1,4 +1,4 @@ -// Copyright 2014-2019 Datalust and contributors. +// Copyright © Datalust and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/Seq.Api/Streams/ObservableStream.Unsubscriber.cs b/src/Seq.Api/Streams/ObservableStream.Unsubscriber.cs index f7f510b..ffded68 100644 --- a/src/Seq.Api/Streams/ObservableStream.Unsubscriber.cs +++ b/src/Seq.Api/Streams/ObservableStream.Unsubscriber.cs @@ -1,4 +1,4 @@ -// Copyright 2016 Datalust; based on code from +// Copyright © Datalust; based on code from // Serilog.Sinks.Observable, Copyright 2013-2016 Serilog Contributors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/Seq.Api/Streams/ObservableStream.cs b/src/Seq.Api/Streams/ObservableStream.cs index 2af4853..00a735e 100644 --- a/src/Seq.Api/Streams/ObservableStream.cs +++ b/src/Seq.Api/Streams/ObservableStream.cs @@ -1,4 +1,4 @@ -// Copyright 2016 Datalust; based on code from +// Copyright © Datalust; based on code from // Serilog.Sinks.Observable, Copyright 2013-2016 Serilog Contributors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -52,7 +52,7 @@ public IDisposable Subscribe(IObserver observer) lock (_syncRoot) { if (_disposed) - throw new ObjectDisposedException(message: "The observable stream is disposed.", innerException: null); + throw new ObjectDisposedException("The observable stream is disposed."); if (_ended) { @@ -76,7 +76,7 @@ void Unsubscribe(IObserver observer) lock (_syncRoot) { if (_disposed) - throw new ObjectDisposedException(message: "The observable stream is disposed.", innerException: null); + throw new ObjectDisposedException("The observable stream is disposed."); _observers = _observers.Except(new[] { observer }).ToList(); } @@ -93,7 +93,11 @@ async Task Receive() var received = await _socket.ReceiveAsync(new ArraySegment(buffer), CancellationToken.None); if (received.MessageType == WebSocketMessageType.Close) { - await _socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None); + // Managed web sockets are self-closing + if (_socket.State != WebSocketState.Closed) + { + await _socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None); + } } else { @@ -198,12 +202,10 @@ public void Dispose() { if (_socket.State == WebSocketState.Open) { - using (var timeout = new CancellationTokenSource()) - { - timeout.CancelAfter(30000); - _socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Close requested", timeout.Token) - .ConfigureAwait(false).GetAwaiter().GetResult(); - } + using var timeout = new CancellationTokenSource(); + timeout.CancelAfter(30000); + _socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Close requested", timeout.Token) + .ConfigureAwait(false).GetAwaiter().GetResult(); } } catch From afc7b422562aa1d22cc14e2704e9ee77f844b63e Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Wed, 22 Apr 2020 13:24:31 +1000 Subject: [PATCH 6/9] Use GroupCreateAsync to add app instances --- src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs b/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs index 208ddcd..1a16f39 100644 --- a/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs @@ -78,7 +78,7 @@ public async Task TemplateAsync(string appId, CancellationTok public async Task AddAsync(AppInstanceEntity entity, bool runOnExisting = false, CancellationToken cancellationToken = default) { if (entity == null) throw new ArgumentNullException(nameof(entity)); - return await Client.PostAsync(entity, "Create", entity, new Dictionary { { "runOnExisting", runOnExisting } }, cancellationToken) + return await GroupCreateAsync(entity, new Dictionary { { "runOnExisting", runOnExisting } }, cancellationToken) .ConfigureAwait(false); } From f264d504599f182aae5d81e08c60f7efb3529d5a Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Thu, 23 Apr 2020 09:40:35 +1000 Subject: [PATCH 7/9] NuGet.org publishing key --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 872f321..4743d67 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ artifacts: deploy: - provider: NuGet api_key: - secure: jFkBflAkupwH+6ebPfcScQzBwCJGArjzcE6716DMgVG5SSktBSXIgAtPE2URki8r + secure: sMicBLl7Z83H/mhX10DL7Yqwa80ZHUbb9fRHKmxd5m2MN2DWAE1kbYH/GPQPFajZ skip_symbols: true on: branch: /^(master|dev)$/ From fad043d47d1979fe78811cfdbb953078a8cef42c Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Tue, 5 May 2020 13:47:03 +1000 Subject: [PATCH 8/9] Update to dotnet CLI in the README example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dbcb791..71ee848 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ If you want to *write events* to Seq, use one of the logging framework clients, Install from NuGet: ```powershell -Install-Package Seq.Api +dotnet add package Seq.Api ``` Create a `SeqConnection` with your server URL: From b03ed68cf07d70eb735572f20d90978e217003ce Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Fri, 15 May 2020 14:04:48 +1000 Subject: [PATCH 9/9] Update to the latest Seq 2020.1 API version (breaking changes, here) * `SeqApiClient` now accepts `application/vnd.datalust.seq.v8+json`, the media type indicating 2020.1 API support * `AppInstanceEntity.InputSignalExpression` renamed to `StreamedSignalExpression` to avoid confusion with _inputs_ * `AppInstanceEntity.InputSettings` added, to support filtering, property tagging, etc. * `AppInstanceEntity.Metrics` split into `ProcessMetrics`, `InputMetrics`, `DiagnosticInputMetrics` and `OutputMetrics` (with corresponding split of `AppInstanceMetricsPart`) * `RunningTaskPart` moved from _Seq.Api.Model.Diagnostics_ to _RunningTasks_ * `Entity` carries `ExtensionData` to ease backwards compatibility on the server-side * `ApiKeyEntity.InputFilter`, `MinimumLevel`, `UseServerTimestamps` and `AppliedProperties` moved to `ApiKeyEntity.InputSettings` * New `SettingName` entries for various OpenID Connect settings, `AuthenticationProvider`, `AutomaticallyProvisionAuthenticatedUsers`, and `AzureADAuthority`; some obsolete settings removed/marked * `SignalFilterPart` renamed to `DescriptiveFilterPart`, to clarify its use across the API and not only with signals * `SeqConnection.RunningTasks` added to support diagnostics and task cancellation * `UserEntity` now exposes `AuthenticationProvider` and `AuthenticationProviderUniqueIdentifier` * `ApiKeysResourceGroup`, `AppInstancesResourceGroup` and `DiagnosticsResourceGroup` now expose `GetMeasurementTimeseriesAsync()` for 24-hr metric histograms --- src/Seq.Api/Client/SeqApiClient.cs | 4 +- .../Model/AppInstances/AppInstanceEntity.cs | 41 ++++++++++-- .../AppInstanceOutputMetricsPart.cs | 15 +++++ ...rt.cs => AppInstanceProcessMetricsPart.cs} | 17 +---- .../Diagnostics/MeasurementTimeseriesPart.cs | 39 +++++++++++ .../Model/Diagnostics/ServerMetricsEntity.cs | 41 ++---------- src/Seq.Api/Model/Entity.cs | 12 ++++ src/Seq.Api/Model/Inputs/ApiKeyEntity.cs | 37 +++-------- ...iKeyMetricsPart.cs => InputMetricsPart.cs} | 20 +++--- src/Seq.Api/Model/Inputs/InputSettingsPart.cs | 51 ++++++++++++++ src/Seq.Api/Model/Settings/SettingName.cs | 48 ++++++++++++-- .../DescriptiveFilterPart.cs} | 6 +- src/Seq.Api/Model/Signals/SignalEntity.cs | 5 +- .../RunningTaskEntity.cs} | 16 ++--- src/Seq.Api/Model/Users/UserEntity.cs | 23 ++++++- .../ResourceGroups/AlertStateResourceGroup.cs | 2 +- .../ResourceGroups/ApiKeysResourceGroup.cs | 14 ++++ .../AppInstancesResourceGroup.cs | 14 ++++ .../DiagnosticsResourceGroup.cs | 14 ++++ .../RunningTasksResourceGroup.cs | 66 +++++++++++++++++++ src/Seq.Api/SeqConnection.cs | 5 ++ 21 files changed, 375 insertions(+), 115 deletions(-) create mode 100644 src/Seq.Api/Model/AppInstances/AppInstanceOutputMetricsPart.cs rename src/Seq.Api/Model/AppInstances/{AppInstanceMetricsPart.cs => AppInstanceProcessMetricsPart.cs} (61%) create mode 100644 src/Seq.Api/Model/Diagnostics/MeasurementTimeseriesPart.cs rename src/Seq.Api/Model/Inputs/{ApiKeyMetricsPart.cs => InputMetricsPart.cs} (57%) create mode 100644 src/Seq.Api/Model/Inputs/InputSettingsPart.cs rename src/Seq.Api/Model/{Signals/SignalFilterPart.cs => Shared/DescriptiveFilterPart.cs} (91%) rename src/Seq.Api/Model/{Diagnostics/RunningTaskPart.cs => Tasks/RunningTaskEntity.cs} (85%) create mode 100644 src/Seq.Api/ResourceGroups/RunningTasksResourceGroup.cs diff --git a/src/Seq.Api/Client/SeqApiClient.cs b/src/Seq.Api/Client/SeqApiClient.cs index 2108ac1..12d8f88 100644 --- a/src/Seq.Api/Client/SeqApiClient.cs +++ b/src/Seq.Api/Client/SeqApiClient.cs @@ -42,7 +42,7 @@ public class SeqApiClient : IDisposable // Future versions of Seq may not completely support v1 features, however // providing this as an Accept header will ensure what compatibility is available // can be utilized. - const string SeqApiV7MediaType = "application/vnd.datalust.seq.v7+json"; + const string SeqApiV8MediaType = "application/vnd.datalust.seq.v8+json"; readonly CookieContainer _cookies = new CookieContainer(); readonly JsonSerializer _serializer = JsonSerializer.Create( @@ -89,7 +89,7 @@ public SeqApiClient(string serverUrl, string apiKey = null, Action(); InvocationOverridableSettingDefinitions = new List(); EventsPerSuppressionWindow = 1; - Metrics = new AppInstanceMetricsPart(); + ProcessMetrics = new AppInstanceProcessMetricsPart(); + InputSettings = new InputSettingsPart(); + InputMetrics = new InputMetricsPart(); + DiagnosticInputMetrics = new InputMetricsPart(); + OutputMetrics = new AppInstanceOutputMetricsPart(); } /// @@ -90,7 +95,7 @@ public AppInstanceEntity() /// The signal expression describing which events will be sent to the app; if null, /// all events will reach the app. /// - public SignalExpressionPart InputSignalExpression { get; set; } + public SignalExpressionPart StreamedSignalExpression { get; set; } /// /// If a value is specified, events will be buffered to disk and sorted by timestamp-order @@ -113,22 +118,46 @@ public AppInstanceEntity() public int EventsPerSuppressionWindow { get; set; } /// - /// Metrics describing the state and activity of the app. + /// Settings that control how events are ingested through the app. /// [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] - public AppInstanceMetricsPart Metrics { get; set; } + public InputSettingsPart InputSettings { get; set; } + /// + /// Metrics describing the state and activity of the app process. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public AppInstanceProcessMetricsPart ProcessMetrics { get; set; } + + /// + /// Information about ingestion activity through this app. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public InputMetricsPart InputMetrics { get; set; } + + /// + /// Information about the app's diagnostic input. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public InputMetricsPart DiagnosticInputMetrics { get; set; } + + /// + /// Information about events output through the app. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public AppInstanceOutputMetricsPart OutputMetrics { get; set; } + /// /// Obsolete. /// - [Obsolete("Use !AcceptStreamedEvents instead. This field will be removed in Seq 6.0.")] + [Obsolete("Use !AcceptStreamedEvents instead.")] [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool? IsManualInputOnly { get; set; } /// /// Obsolete. /// - [Obsolete("Use !AcceptDirectInvocation instead. This field will be removed in Seq 6.0.")] + [Obsolete("Use !AcceptDirectInvocation instead.")] [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool? DisallowManualInput { get; set; } } diff --git a/src/Seq.Api/Model/AppInstances/AppInstanceOutputMetricsPart.cs b/src/Seq.Api/Model/AppInstances/AppInstanceOutputMetricsPart.cs new file mode 100644 index 0000000..d0f36bb --- /dev/null +++ b/src/Seq.Api/Model/AppInstances/AppInstanceOutputMetricsPart.cs @@ -0,0 +1,15 @@ +namespace Seq.Api.Model.AppInstances +{ + /// + /// Describes the events reaching being output from Seq through the app. + /// + public class AppInstanceOutputMetricsPart + { + /// + /// The number of events per minute sent from Seq to the app. Includes streamed events (if enabled), + /// manual invocations, and alert notifications. There may be some delay between dispatching an event, and + /// it being processed by the app. + /// + public int DispatchedEventsPerMinute { get; set; } + } +} diff --git a/src/Seq.Api/Model/AppInstances/AppInstanceMetricsPart.cs b/src/Seq.Api/Model/AppInstances/AppInstanceProcessMetricsPart.cs similarity index 61% rename from src/Seq.Api/Model/AppInstances/AppInstanceMetricsPart.cs rename to src/Seq.Api/Model/AppInstances/AppInstanceProcessMetricsPart.cs index bcf348c..9eb9794 100644 --- a/src/Seq.Api/Model/AppInstances/AppInstanceMetricsPart.cs +++ b/src/Seq.Api/Model/AppInstances/AppInstanceProcessMetricsPart.cs @@ -15,25 +15,14 @@ namespace Seq.Api.Model.AppInstances { /// - /// Metrics describing an . + /// Metrics describing the running server-side process for an . /// - public class AppInstanceMetricsPart + public class AppInstanceProcessMetricsPart { - /// - /// The number of events that reached the app in the past minute. - /// - public int ReceivedEventsPerMinute { get; set; } - - /// - /// The number of diagnostic events raised by the app in the past minute. - /// - /// This does not include the events received by an input app. - public int EmittedEventsPerMinute { get; set; } - /// /// The size, in bytes, of the app process working set. /// - public long ProcessWorkingSetBytes { get; set; } + public long WorkingSetBytes { get; set; } /// /// If the app process is running, true; otherwise, false. diff --git a/src/Seq.Api/Model/Diagnostics/MeasurementTimeseriesPart.cs b/src/Seq.Api/Model/Diagnostics/MeasurementTimeseriesPart.cs new file mode 100644 index 0000000..50efe27 --- /dev/null +++ b/src/Seq.Api/Model/Diagnostics/MeasurementTimeseriesPart.cs @@ -0,0 +1,39 @@ +// Copyright © Datalust and contributors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace Seq.Api.Model.Diagnostics +{ + /// + /// A histogram presenting a measurement taken at equal intervals. + /// + public class MeasurementTimeseriesPart + { + /// + /// The point in time from which measurement begins. + /// + public DateTime MeasuredFrom { get; set; } + + /// + /// The interval at which the measurement is taken. + /// + public ulong MeasurementIntervalMilliseconds { get; set; } + + /// + /// The measurements at each interval, beginning with . + /// + public long[] Measurements { get; set; } + } +} diff --git a/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs b/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs index 63051ea..bca4e1c 100644 --- a/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs +++ b/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs @@ -27,7 +27,6 @@ public class ServerMetricsEntity : Entity /// public ServerMetricsEntity() { - RunningTasks = new List(); } /// @@ -40,16 +39,6 @@ public ServerMetricsEntity() /// public int EventStoreEventsCached { get; set; } - /// - /// The oldest on-disk extent currently stored. - /// - public DateTime? EventStoreFirstExtentRangeStartUtc { get; set; } - - /// - /// The most recent on-disk extent currently stored. - /// - public DateTime? EventStoreLastExtentRangeEndUtc { get; set; } - /// /// Bytes of free space remaining on the disk used for event storage. /// @@ -58,27 +47,27 @@ public ServerMetricsEntity() /// /// The number of events that arrived at the ingestion endpoint in the past minute. /// - public int EndpointArrivalsPerMinute { get; set; } + public int InputArrivedEventsPerMinute { get; set; } /// /// The number of events ingested in the past minute. /// - public int EndpointInfluxPerMinute { get; set; } + public int InputIngestedEventsPerMinute { get; set; } /// /// The number of bytes of raw JSON event data ingested in the past minute (approximate). /// - public long EndpointIngestedBytesPerMinute { get; set; } + public long InputIngestedBytesPerMinute { get; set; } /// /// The number of invalid event payloads seen in the past minute. /// - public int EndpointInvalidPayloadsPerMinute { get; set; } + public int InvalidPayloadsPerMinute { get; set; } /// /// The number of unauthorized event payloads seen in the past minute. /// - public int EndpointUnauthorizedPayloadsPerMinute { get; set; } + public int HttpUnauthorizedPayloadsPerMinute { get; set; } /// /// The length of time for which the Seq server process has been running. @@ -95,26 +84,11 @@ public ServerMetricsEntity() /// public int ProcessThreads { get; set; } - /// - /// The number of thread pool user threads available. - /// - public int ProcessThreadPoolUserThreadsAvailable { get; set; } - - /// - /// The number of async I/O thread pool threads available. - /// - public int ProcessThreadPoolIocpThreadsAvailable { get; set; } - /// /// The proportion of system physical memory that is currently allocated. /// public double SystemMemoryUtilization { get; set; } - /// - /// Tasks running in the Seq server. - /// - public List RunningTasks { get; set; } - /// /// The number of SQL-style queries executed in the past minute. /// @@ -129,10 +103,5 @@ public ServerMetricsEntity() /// The number of cached SQL query time slices invalidated in the past minute. /// public int QueryCacheInvalidationsPerMinute { get; set; } - - /// - /// The number of active sessions reading from or writing to Seq's internal metadata store. - /// - public int DocumentStoreActiveSessions { get; set; } } } diff --git a/src/Seq.Api/Model/Entity.cs b/src/Seq.Api/Model/Entity.cs index 23e0825..67a9408 100644 --- a/src/Seq.Api/Model/Entity.cs +++ b/src/Seq.Api/Model/Entity.cs @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + namespace Seq.Api.Model { /// @@ -41,5 +46,12 @@ protected Entity() /// was instantiated locally and not received from the API. /// public LinkCollection Links { get; set; } + + /// + /// Facilitates backwards compatibility in the Seq server. Should not be used by consumers/clients. + /// + [JsonExtensionData, JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + [Obsolete("Facilitates backwards compatibility in the Seq server. Should not be used by consumers/clients.")] + public Dictionary ExtensionData { get; set; } } } diff --git a/src/Seq.Api/Model/Inputs/ApiKeyEntity.cs b/src/Seq.Api/Model/Inputs/ApiKeyEntity.cs index f755713..bb0c4a6 100644 --- a/src/Seq.Api/Model/Inputs/ApiKeyEntity.cs +++ b/src/Seq.Api/Model/Inputs/ApiKeyEntity.cs @@ -14,9 +14,7 @@ using System.Collections.Generic; using Newtonsoft.Json; -using Seq.Api.Model.LogEvents; using Seq.Api.Model.Security; -using Seq.Api.Model.Signals; namespace Seq.Api.Model.Inputs { @@ -33,10 +31,10 @@ public class ApiKeyEntity : Entity public string Title { get; set; } /// - /// The API key token. API keys generated for versions of Seq prior to 5.0 will expose this value. From 5.0 onwards, - /// can be specified explicitly when creating an API key, but is not readable once the API key is created. - /// Leaving the token blank will cause the server to generate a cryptographically random API key token. After creation, the first - /// few characters of the token will be readable from , but because only a cryptographically-secure + /// The API key token. can be specified explicitly when creating an API key, but is not + /// readable once the API key is created. Leaving the token blank will cause the server to generate a + /// cryptographically random API key token. After creation, the first few (additional, redundant) characters + /// of the token will be readable from , but because only a cryptographically-secure /// hash of the token is stored internally, the token itself cannot be retrieved. /// public string Token { get; set; } @@ -47,31 +45,12 @@ public class ApiKeyEntity : Entity public string TokenPrefix { get; set; } /// - /// Properties that will be automatically added to all events ingested using the key. These will override any properties with - /// the same names already present on the event. + /// Settings that control how events are ingested through the API key. /// - public List AppliedProperties { get; set; } = new List(); + public InputSettingsPart InputSettings { get; set; } = new InputSettingsPart(); /// - /// A filter that selects events to ingest. If null, all events received using the key will be ingested. - /// - public SignalFilterPart InputFilter { get; set; } = new SignalFilterPart(); - - /// - /// A minimum level at which events received using the key will be ingested. The level hierarchy understood by Seq is fuzzy - /// enough to handle most common leveling schemes. This value will be provided to callers so that they can dynamically - /// filter events client-side, if supported. - /// - public LogEventLevel? MinimumLevel { get; set; } - - /// - /// If true, timestamps already present on the events will be ignored, and server timestamps used instead. This is not - /// recommended for most use cases. - /// - public bool UseServerTimestamps { get; set; } - - /// - /// If true, the key is the built-in (tokenless) API key. + /// If true, the key is the built-in (tokenless) API key representing unauthenticated HTTP ingestion. /// public bool IsDefault { get; set; } @@ -90,6 +69,6 @@ public class ApiKeyEntity : Entity /// Information about the ingestion activity using this API key. /// [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] - public ApiKeyMetricsPart Metrics { get; set; } = new ApiKeyMetricsPart(); + public InputMetricsPart InputMetrics { get; set; } = new InputMetricsPart(); } } diff --git a/src/Seq.Api/Model/Inputs/ApiKeyMetricsPart.cs b/src/Seq.Api/Model/Inputs/InputMetricsPart.cs similarity index 57% rename from src/Seq.Api/Model/Inputs/ApiKeyMetricsPart.cs rename to src/Seq.Api/Model/Inputs/InputMetricsPart.cs index 7e431ad..7e96fe7 100644 --- a/src/Seq.Api/Model/Inputs/ApiKeyMetricsPart.cs +++ b/src/Seq.Api/Model/Inputs/InputMetricsPart.cs @@ -17,24 +17,28 @@ namespace Seq.Api.Model.Inputs /// /// Information about ingestion activity using an API key. /// - public class ApiKeyMetricsPart + public class InputMetricsPart { /// - /// The number of events that arrived at the server tagged with this - /// key in the past minute. + /// The number of events that arrived at the server from this input in the past minute. /// - public int ArrivalsPerMinute { get; set; } + public int ArrivedEventsPerMinute { get; set; } /// - /// The number of events that ingested by the server tagged with this - /// key in the past minute. + /// The number of events that ingested by the server from this input in the past minute. /// - public int InfluxPerMinute { get; set; } + public int IngestedEventsPerMinute { get; set; } /// - /// The raw JSON bytes (approximate) tagged with this API key that were ingested + /// The raw JSON bytes (approximate) from this input that were ingested /// by the server in the past minute. /// public long IngestedBytesPerMinute { get; set; } + + /// + /// The number of invalid payloads reaching this input in the past minute. Invalid payloads includes malformed + /// and oversized JSON event bodies, as well as malformed or oversized batches. + /// + public long InvalidPayloadsPerMinute { get; set; } } } \ No newline at end of file diff --git a/src/Seq.Api/Model/Inputs/InputSettingsPart.cs b/src/Seq.Api/Model/Inputs/InputSettingsPart.cs new file mode 100644 index 0000000..540b566 --- /dev/null +++ b/src/Seq.Api/Model/Inputs/InputSettingsPart.cs @@ -0,0 +1,51 @@ +// Copyright © Datalust and contributors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Collections.Generic; +using Seq.Api.Model.LogEvents; +using Seq.Api.Model.Shared; +using Seq.Api.Model.Signals; + +namespace Seq.Api.Model.Inputs +{ + /// + /// Settings carried by API keys, (input) app instances, and other inputs. + /// + public class InputSettingsPart + { + /// + /// Properties that will be automatically added to all events ingested using the key. These will override any properties with + /// the same names already present on the event. + /// + public List AppliedProperties { get; set; } = new List(); + + /// + /// A filter that selects events to ingest. If null, all events received using the key will be ingested. + /// + public DescriptiveFilterPart Filter { get; set; } = new DescriptiveFilterPart(); + + /// + /// A minimum level at which events received using the key will be ingested. The level hierarchy understood by Seq is fuzzy + /// enough to handle most common leveling schemes. This value will be provided to callers so that they can dynamically + /// filter events client-side, if supported. + /// + public LogEventLevel? MinimumLevel { get; set; } + + /// + /// If true, timestamps already present on the events will be ignored, and server timestamps used instead. This is not + /// recommended for most use cases. + /// + public bool UseServerTimestamps { get; set; } + } +} \ No newline at end of file diff --git a/src/Seq.Api/Model/Settings/SettingName.cs b/src/Seq.Api/Model/Settings/SettingName.cs index 5740a87..d6e48f8 100644 --- a/src/Seq.Api/Model/Settings/SettingName.cs +++ b/src/Seq.Api/Model/Settings/SettingName.cs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; using Seq.Api.Model.Apps; using Seq.Api.Model.Updates; using Seq.Api.ResourceGroups; @@ -24,6 +25,12 @@ namespace Seq.Api.Model.Settings /// public enum SettingName { + /// + /// The authentication provider to use. Allowed values are null (local username/password), + /// "Active Directory", "Azure Active Directory" and "OpenID Connect". + /// + AuthenticationProvider, + /// /// The name of an Active Directory group within which users will be automatically /// be granted user access to Seq. @@ -34,8 +41,21 @@ public enum SettingName /// If true, Azure Active Directory accounts in the configured tenant will /// be automatically granted user access to Seq. /// + [Obsolete("Use `AutomaticallyProvisionAuthenticatedUsers`.", error: true)] AutomaticallyGrantUserAccessToADAccounts, + + /// + /// If true, users authenticated with the configured authentication provider + /// be automatically granted default user access to Seq. + /// + AutomaticallyProvisionAuthenticatedUsers, + /// + /// The AAD authority. The default is login.windows.net; government cloud users may + /// require login.microsoftonline.us or similar. + /// + AzureADAuthority, + /// /// The Azure Active Directory client id. /// @@ -87,6 +107,7 @@ public enum SettingName /// /// If true, the server supports Active Directory authentication. /// + [Obsolete("Set `AuthenticationProvider` to \"Active Directory\" to enable.", error: true)] IsActiveDirectoryAuthentication, /// @@ -94,11 +115,6 @@ public enum SettingName /// IsAuthenticationEnabled, - /// - /// Obsolete. - /// - LazilyFlushEventWrites, - /// /// Tracks whether an admin user has dismissed the master key backup warning. /// @@ -133,6 +149,28 @@ public enum SettingName /// NewUserShowDashboardIds, + /// + /// If using OpenID Connect authentication, the URL of the authorization endpoint. For example, + /// https://example.com. + /// + OpenIdConnectAuthority, + + /// + /// If using OpenID Connect, the client id assigned to Seq in the provider. + /// + OpenIdConnectClientId, + + /// + /// If using OpenID Connect, the client secret assigned to Seq in the provider. + /// + OpenIdConnectClientSecret, + + /// + /// If using OpenID Connect, the scopes Seq will request when authorizing the client, as a comma-separated + /// list. For example, openid, profile, email. + /// + OpenIdConnectScopes, + /// /// If true, ingestion requests incoming via HTTP must be authenticated using an API key or /// logged-in user session. Only effective when is true. diff --git a/src/Seq.Api/Model/Signals/SignalFilterPart.cs b/src/Seq.Api/Model/Shared/DescriptiveFilterPart.cs similarity index 91% rename from src/Seq.Api/Model/Signals/SignalFilterPart.cs rename to src/Seq.Api/Model/Shared/DescriptiveFilterPart.cs index 7f77324..05761de 100644 --- a/src/Seq.Api/Model/Signals/SignalFilterPart.cs +++ b/src/Seq.Api/Model/Shared/DescriptiveFilterPart.cs @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -namespace Seq.Api.Model.Signals +namespace Seq.Api.Model.Shared { /// - /// An individual filter incorporated within a signal. + /// An expression-based filter that carries additional descriptive information. /// - public class SignalFilterPart + public class DescriptiveFilterPart { /// /// A friendly, human-readable description of the filter. diff --git a/src/Seq.Api/Model/Signals/SignalEntity.cs b/src/Seq.Api/Model/Signals/SignalEntity.cs index 0c266d0..38f8e62 100644 --- a/src/Seq.Api/Model/Signals/SignalEntity.cs +++ b/src/Seq.Api/Model/Signals/SignalEntity.cs @@ -16,6 +16,7 @@ using System.Collections.Generic; using Newtonsoft.Json; using Seq.Api.Model.Security; +using Seq.Api.Model.Shared; namespace Seq.Api.Model.Signals { @@ -30,7 +31,7 @@ public class SignalEntity : Entity public SignalEntity() { Title = "New Signal"; - Filters = new List(); + Filters = new List(); Columns = new List(); } @@ -47,7 +48,7 @@ public SignalEntity() /// /// Filters that are combined (using the and operator) to identify events matching the filter. /// - public List Filters { get; set; } + public List Filters { get; set; } /// /// Expressions that show as columns when the signal is selected in the events screen. diff --git a/src/Seq.Api/Model/Diagnostics/RunningTaskPart.cs b/src/Seq.Api/Model/Tasks/RunningTaskEntity.cs similarity index 85% rename from src/Seq.Api/Model/Diagnostics/RunningTaskPart.cs rename to src/Seq.Api/Model/Tasks/RunningTaskEntity.cs index fc6c2fd..ce713e8 100644 --- a/src/Seq.Api/Model/Diagnostics/RunningTaskPart.cs +++ b/src/Seq.Api/Model/Tasks/RunningTaskEntity.cs @@ -14,18 +14,13 @@ using System; -namespace Seq.Api.Model.Diagnostics +namespace Seq.Api.Model.Tasks { /// /// Describes a task being actively performed by the Seq server. /// - public class RunningTaskPart + public class RunningTaskEntity: Entity { - /// - /// A unique identifier for the task. - /// - public Guid Id { get; set; } - /// /// A description of the task. /// @@ -35,5 +30,10 @@ public class RunningTaskPart /// When the task started. /// public DateTime StartedAtUtc { get; set; } + + /// + /// Whether or not the task can be cancelled. + /// + public bool CanCancel { get; set; } } -} \ No newline at end of file +} diff --git a/src/Seq.Api/Model/Users/UserEntity.cs b/src/Seq.Api/Model/Users/UserEntity.cs index d206fab..81002f1 100644 --- a/src/Seq.Api/Model/Users/UserEntity.cs +++ b/src/Seq.Api/Model/Users/UserEntity.cs @@ -13,6 +13,8 @@ // limitations under the License. using System.Collections.Generic; +using Newtonsoft.Json; +using Seq.Api.Model.Shared; using Seq.Api.Model.Signals; namespace Seq.Api.Model.Users @@ -46,19 +48,22 @@ public class UserEntity : Entity /// /// If changing password, the new password for the user. /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string NewPassword { get; set; } /// /// A filter that is applied to searches and queries instigated by /// the user. /// - public SignalFilterPart ViewFilter { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public DescriptiveFilterPart ViewFilter { get; set; } /// /// If true, the user will be unable to log in without first /// changing their password. Recommended when administratively assigning /// a password for the user. /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool MustChangePassword { get; set; } /// @@ -66,5 +71,21 @@ public class UserEntity : Entity /// the Seq UI currently only supports a single role when editing users. /// public HashSet RoleIds { get; set; } = new HashSet(); + + /// + /// The authentication provider associated with the user account. This will normally be + /// the system-configured authentication provider, but if the provider is changed, the + /// user may need to be unlinked from an existing provider so that login can proceed through + /// the new provider. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public string AuthenticationProvider { get; set; } + + /// + /// The unique identifier that links the identity provided by the authentication provider + /// with the Seq user. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public string AuthenticationProviderUniqueIdentifier { get; set; } } } diff --git a/src/Seq.Api/ResourceGroups/AlertStateResourceGroup.cs b/src/Seq.Api/ResourceGroups/AlertStateResourceGroup.cs index 2ad1fb9..8b8fa17 100644 --- a/src/Seq.Api/ResourceGroups/AlertStateResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/AlertStateResourceGroup.cs @@ -21,7 +21,7 @@ namespace Seq.Api.ResourceGroups { /// - /// Inspect the current states of alerts being monitored by the server.. + /// Inspect the current states of alerts being monitored by the server. /// public class AlertStateResourceGroup : ApiResourceGroup { diff --git a/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs b/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs index 7de4f5c..883ec1d 100644 --- a/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs @@ -17,6 +17,7 @@ using System.Threading; using System.Threading.Tasks; using Seq.Api.Model; +using Seq.Api.Model.Diagnostics; using Seq.Api.Model.Inputs; using Seq.Api.Model.Users; @@ -107,5 +108,18 @@ public async Task UpdateAsync(ApiKeyEntity entity, CancellationToken cancellatio { await Client.PutAsync(entity, "Self", entity, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Retrieve a detailed metric for the API key. + /// + /// The API key to retrieve metrics for. + /// A allowing the operation to be canceled. + /// The measurement to get. + /// + public async Task GetMeasurementTimeseriesAsync(ApiKeyEntity entity, string measurement, CancellationToken cancellationToken = default) + { + var parameters = new Dictionary{ ["id"] = entity.Id, ["measurement"] = measurement }; + return await GroupGetAsync("Metric", parameters, cancellationToken); + } } } diff --git a/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs b/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs index 1a16f39..0ee6737 100644 --- a/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs @@ -19,6 +19,7 @@ using Seq.Api.Model; using Seq.Api.Model.AppInstances; using Seq.Api.Model.Apps; +using Seq.Api.Model.Diagnostics; namespace Seq.Api.ResourceGroups { @@ -122,5 +123,18 @@ public async Task InvokeAsync(AppInstanceEntity entity, string eventId, IReadOnl var postedSettings = settingOverrides ?? new Dictionary(); await Client.PostAsync(entity, "Invoke", postedSettings, new Dictionary{{"eventId", eventId}}, cancellationToken); } + + /// + /// Retrieve a detailed metric for the app instance. + /// + /// The app instance to retrieve metrics for. + /// A allowing the operation to be canceled. + /// The measurement to get. + /// + public async Task GetMeasurementTimeseriesAsync(AppInstanceEntity entity, string measurement, CancellationToken cancellationToken = default) + { + var parameters = new Dictionary{ ["id"] = entity.Id, ["measurement"] = measurement }; + return await GroupGetAsync("Metric", parameters, cancellationToken); + } } } diff --git a/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs b/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs index 9eddec4..a386bc0 100644 --- a/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Seq.Api.Model.Diagnostics; +using Seq.Api.Model.Inputs; namespace Seq.Api.ResourceGroups { @@ -57,5 +59,17 @@ public async Task GetIngestionLogAsync(CancellationToken cancellationTok { return await GroupGetStringAsync("IngestionLog", cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Retrieve a detailed system metric. + /// + /// A allowing the operation to be canceled. + /// The measurement to get. + /// + public async Task GetMeasurementTimeseriesAsync(string measurement, CancellationToken cancellationToken = default) + { + var parameters = new Dictionary{ ["measurement"] = measurement }; + return await GroupGetAsync("Metric", parameters, cancellationToken); + } } } diff --git a/src/Seq.Api/ResourceGroups/RunningTasksResourceGroup.cs b/src/Seq.Api/ResourceGroups/RunningTasksResourceGroup.cs new file mode 100644 index 0000000..0327347 --- /dev/null +++ b/src/Seq.Api/ResourceGroups/RunningTasksResourceGroup.cs @@ -0,0 +1,66 @@ +// Copyright Datalust and contributors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Seq.Api.Model.Monitoring; +using Seq.Api.Model.Tasks; + +namespace Seq.Api.ResourceGroups +{ + /// + /// Inspect and cancel tasks running in the Seq server. + /// + public class RunningTasksResourceGroup : ApiResourceGroup + { + internal RunningTasksResourceGroup (ISeqConnection connection) + : base("RunningTasks", connection) + { + } + + /// + /// Retrieve the task with the given id; throws if the entity does not exist. + /// + /// The id of the task. + /// A allowing the operation to be canceled. + /// The task. + public async Task FindAsync(string id, CancellationToken cancellationToken = default) + { + if (id == null) throw new ArgumentNullException(nameof(id)); + return await GroupGetAsync("Item", new Dictionary { { "id", id } }, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve all tasks running on the server. + /// + /// allowing the operation to be canceled. + /// A list containing all running tasks. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + return await GroupListAsync("Items", null, cancellationToken).ConfigureAwait(false); + } + + /// + /// Request cancellation of a running task. The task must support cancellation; see . + /// + /// The task to cancel. + /// allowing the cancellation operation itself to be canceled. + public async Task RequestCancellationAsync(AlertStateEntity entity, CancellationToken cancellationToken = default) + { + await Client.DeleteAsync(entity, "Self", entity, cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} diff --git a/src/Seq.Api/SeqConnection.cs b/src/Seq.Api/SeqConnection.cs index f1f96ba..1710ff3 100644 --- a/src/Seq.Api/SeqConnection.cs +++ b/src/Seq.Api/SeqConnection.cs @@ -151,6 +151,11 @@ public void Dispose() /// public RolesResourceGroup Roles => new RolesResourceGroup(this); + /// + /// Perform operations on tasks running in the Seq server. + /// + public RunningTasksResourceGroup RunningTasks => new RunningTasksResourceGroup(this); + /// /// Perform operations on system settings. ///