diff --git a/src/Seq.Api/Client/SeqApiClient.cs b/src/Seq.Api/Client/SeqApiClient.cs index ac9a718..dddc689 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 SeqApiV11MediaType = "application/vnd.datalust.seq.v11+json"; + const string SeqApiV11MediaType = "application/vnd.datalust.seq.v12+json"; // ReSharper disable once NotAccessedField.Local readonly bool _defaultMessageHandler; diff --git a/src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs b/src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs index e563308..f103554 100644 --- a/src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs +++ b/src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs @@ -19,160 +19,139 @@ using Seq.Api.Model.Inputs; using Seq.Api.Model.Signals; using Seq.Api.ResourceGroups; +// ReSharper disable UnusedAutoPropertyAccessor.Global #nullable enable -namespace Seq.Api.Model.AppInstances +namespace Seq.Api.Model.AppInstances; + +/// +/// App instances are individual processes based on a running that can +/// read from and write to the Seq event stream. +/// +public class AppInstanceEntity : Entity { /// - /// App instances are individual processes based on a running that can - /// read from and write to the Seq event stream. + /// Construct an with default values. /// - public class AppInstanceEntity : Entity + /// Instead of constructing an instance directly, consider using + /// to obtain a partly-initialized instance. + public AppInstanceEntity() { - /// - /// Construct an with default values. - /// - /// Instead of constructing an instance directly, consider using - /// to obtain a partly-initialized instance. - public AppInstanceEntity() - { - Settings = new Dictionary(); - InvocationOverridableSettings = new List(); - InvocationOverridableSettingDefinitions = new List(); - EventsPerSuppressionWindow = 1; - ProcessMetrics = new AppInstanceProcessMetricsPart(); - InputSettings = new InputSettingsPart(); - InputMetrics = new InputMetricsPart(); - DiagnosticInputMetrics = new InputMetricsPart(); - OutputMetrics = new AppInstanceOutputMetricsPart(); - } - - /// - /// The id of the that this is an instance of. - /// - public string? AppId { get; set; } - - /// - /// The user-friendly title of the app instance. - /// - public string? Title { get; set; } - - /// - /// Values for the settings exposed by the app. - /// - public Dictionary? Settings { get; set; } - - /// - /// If true, administrative users may invoke the app manually or through alerts. - /// This field is read-only from the API and generally indicates that the app is an input. - /// - public bool AcceptPrivilegedInvocation { get; set; } - - /// - /// If true, regular users can manually send events to the app, or use the app - /// as the target for alert notifications. - /// - public bool AcceptDirectInvocation { get; set; } - - /// - /// The settings that can be overridden at invocation time (when an event is sent to - /// the instance). - /// - public List? InvocationOverridableSettings { get; set; } - - /// - /// Metadata describing the overridable settings. This field is provided by the server - /// and cannot be modified. - /// - public List? InvocationOverridableSettingDefinitions { get; set; } - - /// - /// If true, events will be streamed to the app. Otherwise, events will be - /// sent only manually or in response to alerts being triggered. - /// - public bool AcceptStreamedEvents { get; set; } - - /// - /// The signal expression describing which events will be sent to the app; if null, - /// all events will reach the app. - /// - public SignalExpressionPart? StreamedSignalExpression { get; set; } - - /// - /// If a value is specified, events will be buffered to disk and sorted by timestamp-order - /// within the specified window. This is not recommended for performance reasons, and should - /// be avoided when possible. - /// - public TimeSpan? ArrivalWindow { get; set; } - - /// - /// The time after an event reaches the app during which no further events will be processed. - /// The default indicates no suppression time, and all events - /// will be processed in that case. - /// - public TimeSpan SuppressionTime { get; set; } - - /// - /// If is set, the number of events that will be allowed during the - /// suppression window. The default is 1, to allow only the initial event that triggered suppression. - /// - public int EventsPerSuppressionWindow { get; set; } - - /// - /// Settings that control how events are ingested through the app. - /// - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] - 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.")] - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] - public bool? IsManualInputOnly { get; set; } - - /// - /// Obsolete. - /// - [Obsolete("Use !AcceptDirectInvocation instead.")] - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] - public bool? DisallowManualInput { get; set; } - - /// - /// The name of the app. - /// - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] - public string? AppName { get; set; } - - /// - /// If true, then the app is able to write events to the log. - /// - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] - public bool? IsInput { get; set; } + Settings = new Dictionary(); + InvocationOverridableSettings = new List(); + InvocationOverridableSettingDefinitions = new List(); + EventsPerSuppressionWindow = 1; + ProcessMetrics = new AppInstanceProcessMetricsPart(); + InputSettings = new InputSettingsPart(); + InputMetrics = new InputMetricsPart(); + DiagnosticInputMetrics = new InputMetricsPart(); + OutputMetrics = new AppInstanceOutputMetricsPart(); } + + /// + /// The id of the that this is an instance of. + /// + public string? AppId { get; set; } + + /// + /// The user-friendly title of the app instance. + /// + public string? Title { get; set; } + + /// + /// Values for the settings exposed by the app. + /// + public Dictionary? Settings { get; set; } + + /// + /// If true, administrative users may invoke the app manually or through alerts. + /// This field is read-only from the API and generally indicates that the app is an input. + /// + public bool AcceptPrivilegedInvocation { get; set; } + + /// + /// If true, regular users can manually send events to the app, or use the app + /// as the target for alert notifications. + /// + public bool AcceptDirectInvocation { get; set; } + + /// + /// The settings that can be overridden at invocation time (when an event is sent to + /// the instance). + /// + public List? InvocationOverridableSettings { get; set; } + + /// + /// Metadata describing the overridable settings. This field is provided by the server + /// and cannot be modified. + /// + public List? InvocationOverridableSettingDefinitions { get; set; } + + /// + /// If true, events will be streamed to the app. Otherwise, events will be + /// sent only manually or in response to alerts being triggered. + /// + public bool AcceptStreamedEvents { get; set; } + + /// + /// The signal expression describing which events will be sent to the app; if null, + /// all events will reach the app. + /// + public SignalExpressionPart? StreamedSignalExpression { get; set; } + + /// + /// The time after an event reaches the app during which no further events will be processed. + /// The default indicates no suppression time, and all events + /// will be processed in that case. + /// + public TimeSpan SuppressionTime { get; set; } + + /// + /// If is set, the number of events that will be allowed during the + /// suppression window. The default is 1, to allow only the initial event that triggered suppression. + /// + public int EventsPerSuppressionWindow { get; set; } + + /// + /// Settings that control how events are ingested through the app. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + 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; } + + /// + /// The name of the app. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public string? AppName { get; set; } + + /// + /// If true, then the app is able to write events to the log. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool? IsInput { get; set; } } diff --git a/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs b/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs index 2a12737..cb58ba7 100644 --- a/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs @@ -72,14 +72,12 @@ public async Task TemplateAsync(string appId, CancellationTok /// Add a new app instance. /// /// The app instance to add. - /// If true, events already on the server will be sent to the app. Note that this requires disk buffering and persistent bookmarks - /// for the app, which is not recommended for performance reasons. /// A allowing the operation to be canceled. /// The app instance, with server-allocated properties such as initialized. - public async Task AddAsync(AppInstanceEntity entity, bool runOnExisting = false, CancellationToken cancellationToken = default) + public async Task AddAsync(AppInstanceEntity entity, CancellationToken cancellationToken = default) { if (entity == null) throw new ArgumentNullException(nameof(entity)); - return await GroupCreateAsync(entity, new Dictionary { { "runOnExisting", runOnExisting } }, cancellationToken) + return await GroupCreateAsync(entity, cancellationToken: cancellationToken) .ConfigureAwait(false); } diff --git a/src/Seq.Api/Seq.Api.csproj b/src/Seq.Api/Seq.Api.csproj index 52b80af..9148561 100644 --- a/src/Seq.Api/Seq.Api.csproj +++ b/src/Seq.Api/Seq.Api.csproj @@ -28,7 +28,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive