From b9cc7f5fa9a8f8a14fabc9ad89d47e317e5dcba2 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Fri, 22 Mar 2024 12:29:34 +1000 Subject: [PATCH 1/2] Seq 2024.2 API updates --- .gitignore | 2 ++ example/SeqEnableAAD/Program.cs | 8 +++---- seq-api.sln | 1 + src/Seq.Api/Client/SeqApiClient.cs | 6 +++--- src/Seq.Api/Model/Events/EventEntity.cs | 8 +++++++ src/Seq.Api/Model/Settings/SettingName.cs | 26 +++++++++++++---------- src/Seq.Api/Seq.Api.csproj | 2 +- 7 files changed, 34 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index ef76fc3..7062706 100644 --- a/.gitignore +++ b/.gitignore @@ -253,3 +253,5 @@ paket-files/ .vscode/ *.orig + +.DS_Store diff --git a/example/SeqEnableAAD/Program.cs b/example/SeqEnableAAD/Program.cs index cb58208..93d5a59 100644 --- a/example/SeqEnableAAD/Program.cs +++ b/example/SeqEnableAAD/Program.cs @@ -54,10 +54,10 @@ static async Task Run(string server, string? username, string? tenantId, string? var user = await connection.Users.FindCurrentAsync(); var provider = await connection.Settings.FindNamedAsync(SettingName.AuthenticationProvider); - var cid = await connection.Settings.FindNamedAsync(SettingName.AzureADClientId); - var ckey = await connection.Settings.FindNamedAsync(SettingName.AzureADClientKey); - var aut = await connection.Settings.FindNamedAsync(SettingName.AzureADAuthority); - var tid = await connection.Settings.FindNamedAsync(SettingName.AzureADTenantId); + var cid = await connection.Settings.FindNamedAsync(SettingName.EntraIDClientId); + var ckey = await connection.Settings.FindNamedAsync(SettingName.EntraIDClientKey); + var aut = await connection.Settings.FindNamedAsync(SettingName.EntraIDAuthority); + var tid = await connection.Settings.FindNamedAsync(SettingName.EntraIDTenantId); user.Username = username; provider.Value = "Azure Active Directory"; diff --git a/seq-api.sln b/seq-api.sln index 8fda661..883a5c6 100644 --- a/seq-api.sln +++ b/seq-api.sln @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{7DCED6 Build.ps1 = Build.ps1 LICENSE = LICENSE README.md = README.md + .gitignore = .gitignore EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{5E7A565B-A8EE-43E7-A225-5B640A5D29A0}" diff --git a/src/Seq.Api/Client/SeqApiClient.cs b/src/Seq.Api/Client/SeqApiClient.cs index 295467b..c39cc7a 100644 --- a/src/Seq.Api/Client/SeqApiClient.cs +++ b/src/Seq.Api/Client/SeqApiClient.cs @@ -42,7 +42,7 @@ public sealed class SeqApiClient : IDisposable // Future versions of Seq may not completely support vN-1 features, however // providing this as an Accept header will ensure what compatibility is available // can be utilized. - const string SeqApiV9MediaType = "application/vnd.datalust.seq.v9+json"; + const string SeqApiV10MediaType = "application/vnd.datalust.seq.v10+json"; readonly CookieContainer _cookies = new(); readonly JsonSerializer _serializer = JsonSerializer.Create( @@ -106,12 +106,12 @@ public SeqApiClient(string serverUrl, string apiKey = null, Func [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string ParentId { get; set; } + + /// + /// If the event is a span, its kind. This will typically be one of either Client, Server, + /// Producer, Consumer, or Internal. The span kind records how the span relates to its + /// parent or child span within a trace. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string SpanKind { get; set; } /// /// A collection of properties describing the origin of the event, if any. These correspond to resource diff --git a/src/Seq.Api/Model/Settings/SettingName.cs b/src/Seq.Api/Model/Settings/SettingName.cs index 9947669..1a36756 100644 --- a/src/Seq.Api/Model/Settings/SettingName.cs +++ b/src/Seq.Api/Model/Settings/SettingName.cs @@ -27,7 +27,7 @@ public enum SettingName { /// /// The authentication provider to use. Allowed values are null (local username/password), - /// "Active Directory", "Azure Active Directory" and "OpenID Connect". + /// "Active Directory", "Microsoft Entra ID" and "OpenID Connect". /// AuthenticationProvider, @@ -38,7 +38,7 @@ public enum SettingName AutomaticAccessADGroup, /// - /// If true, Azure Active Directory accounts in the configured tenant will + /// If true, Microsoft Entra ID accounts in the configured tenant will /// be automatically granted user access to Seq. /// [Obsolete("Use `AutomaticallyProvisionAuthenticatedUsers`.", error: true)] @@ -51,25 +51,29 @@ public enum SettingName AutomaticallyProvisionAuthenticatedUsers, /// - /// The AAD authority. The default is login.windows.net; government cloud users may + /// The Microsoft Entra ID authority. The default is login.windows.net; government cloud users may /// require login.microsoftonline.us or similar. /// - AzureADAuthority, + // ReSharper disable once InconsistentNaming + EntraIDAuthority, /// - /// The Azure Active Directory client id. + /// The Microsoft Entra ID client id. /// - AzureADClientId, + // ReSharper disable once InconsistentNaming + EntraIDClientId, /// - /// The Azure Active Directory client key. + /// The Microsoft Entra ID client key. /// - AzureADClientKey, + // ReSharper disable once InconsistentNaming + EntraIDClientKey, /// - /// The Azure Active Directory tenant id. + /// The Microsoft Entra ID tenant id. /// - AzureADTenantId, + // ReSharper disable once InconsistentNaming + EntraIDTenantId, /// /// Server-local filesystem location where automatic backups are stored. @@ -170,7 +174,7 @@ public enum SettingName /// If using OpenID Connect, overrides the URI of the provider's metadata endpoint. /// OpenIdConnectMetadataAddress, - + /// /// 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/Seq.Api.csproj b/src/Seq.Api/Seq.Api.csproj index 033ae26..13e4ee2 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. - 2024.1.0 + 2024.2.0 Datalust;Contributors netstandard2.0;net6.0 true From e9d71aa6f34756b45f612799c75ffbee2bd87bba Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Fri, 22 Mar 2024 12:55:50 +1000 Subject: [PATCH 2/2] Suppress warning in test for deprecated API --- test/Seq.Api.Tests/SeqConnectionTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Seq.Api.Tests/SeqConnectionTests.cs b/test/Seq.Api.Tests/SeqConnectionTests.cs index 2c30f87..cbaa9bf 100644 --- a/test/Seq.Api.Tests/SeqConnectionTests.cs +++ b/test/Seq.Api.Tests/SeqConnectionTests.cs @@ -9,10 +9,12 @@ public void WhenConstructedTheHandlerConfigurationCallbackIsCalled() { var callCount = 0; +#pragma warning disable CS0618 // Type or member is obsolete using var _ = new SeqConnection("https://test.example.com", null, handler => { Assert.NotNull(handler); ++callCount; }); +#pragma warning restore CS0618 // Type or member is obsolete Assert.Equal(1, callCount); }