Skip to content

Commit 4b8e1b4

Browse files
authored
Merge pull request #110 from datalust/dev
2022.1 Release
2 parents 64fd9bf + b0c8c22 commit 4b8e1b4

File tree

20 files changed

+222
-109
lines changed

20 files changed

+222
-109
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: '{build}'
22
skip_tags: true
3-
image: Visual Studio 2019
3+
image: Visual Studio 2022
44
build_script:
55
- ps: ./Build.ps1
66
test: off

src/Seq.Api/Client/SeqApiClient.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,22 @@ namespace Seq.Api.Client
3535
/// <summary>
3636
/// A low-level client that provides navigation over the linked resource structure of the Seq HTTP API.
3737
/// </summary>
38-
public class SeqApiClient : IDisposable
38+
public sealed class SeqApiClient : IDisposable
3939
{
4040
readonly string _apiKey;
4141

42-
// Future versions of Seq may not completely support v1 features, however
42+
// Future versions of Seq may not completely support vN-1 features, however
4343
// providing this as an Accept header will ensure what compatibility is available
4444
// can be utilized.
45-
const string SeqApiV8MediaType = "application/vnd.datalust.seq.v8+json";
45+
const string SeqApiV9MediaType = "application/vnd.datalust.seq.v9+json";
4646

47-
readonly CookieContainer _cookies = new CookieContainer();
47+
readonly CookieContainer _cookies = new();
4848
readonly JsonSerializer _serializer = JsonSerializer.Create(
4949
new JsonSerializerSettings
5050
{
51-
Converters = { new StringEnumConverter(), new LinkCollectionConverter() }
51+
Converters = { new StringEnumConverter(), new LinkCollectionConverter() },
52+
DateParseHandling = DateParseHandling.None,
53+
FloatParseHandling = FloatParseHandling.Decimal
5254
});
5355

5456
/// <summary>
@@ -89,7 +91,7 @@ public SeqApiClient(string serverUrl, string apiKey = null, Action<HttpClientHan
8991
baseAddress += "/";
9092

9193
HttpClient = new HttpClient(handler) { BaseAddress = new Uri(baseAddress) };
92-
HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(SeqApiV8MediaType));
94+
HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(SeqApiV9MediaType));
9395

9496
if (_apiKey != null)
9597
HttpClient.DefaultRequestHeaders.Add("X-Seq-ApiKey", _apiKey);
@@ -175,8 +177,8 @@ public async Task PostAsync<TEntity>(ILinked entity, string link, TEntity conten
175177
var linkUri = ResolveLink(entity, link, parameters);
176178
var request = new HttpRequestMessage(HttpMethod.Post, linkUri) { Content = MakeJsonContent(content) };
177179
var stream = await HttpSendAsync(request, cancellationToken).ConfigureAwait(false);
178-
using (var reader = new StreamReader(stream))
179-
reader.ReadToEnd();
180+
using var reader = new StreamReader(stream);
181+
await reader.ReadToEndAsync();
180182
}
181183

182184
/// <summary>
@@ -213,8 +215,8 @@ public async Task<string> PostReadStringAsync<TEntity>(ILinked entity, string li
213215
var linkUri = ResolveLink(entity, link, parameters);
214216
var request = new HttpRequestMessage(HttpMethod.Post, linkUri) { Content = MakeJsonContent(content) };
215217
var stream = await HttpSendAsync(request, cancellationToken).ConfigureAwait(false);
216-
using (var reader = new StreamReader(stream))
217-
return await reader.ReadToEndAsync();
218+
using var reader = new StreamReader(stream);
219+
return await reader.ReadToEndAsync();
218220
}
219221

220222
/// <summary>

src/Seq.Api/Model/Alerting/AlertEntity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class AlertEntity : Entity
4242
public string OwnerId { get; set; }
4343

4444
/// <summary>
45-
/// If <c>true</c>, the alert can only be modified by users with the <see cref="Permission.Setup"/> permission.
45+
/// If <c>true</c>, the alert can only be modified by users with the <see cref="Permission.Project"/> permission.
4646
/// </summary>
4747
public bool IsProtected { get; set; }
4848

src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
using Seq.Api.Model.Signals;
2121
using Seq.Api.ResourceGroups;
2222

23+
#nullable enable
24+
2325
namespace Seq.Api.Model.AppInstances
2426
{
2527
/// <summary>
@@ -49,17 +51,17 @@ public AppInstanceEntity()
4951
/// <summary>
5052
/// The id of the <see cref="AppEntity"/> that this is an instance of.
5153
/// </summary>
52-
public string AppId { get; set; }
54+
public string? AppId { get; set; }
5355

5456
/// <summary>
5557
/// The user-friendly title of the app instance.
5658
/// </summary>
57-
public string Title { get; set; }
59+
public string? Title { get; set; }
5860

5961
/// <summary>
6062
/// Values for the settings exposed by the app.
6163
/// </summary>
62-
public Dictionary<string, string> Settings { get; set; }
64+
public Dictionary<string, string>? Settings { get; set; }
6365

6466
/// <summary>
6567
/// If <c>true</c>, administrative users may invoke the app manually or through alerts.
@@ -77,13 +79,13 @@ public AppInstanceEntity()
7779
/// The settings that can be overridden at invocation time (when an event is sent to
7880
/// the instance).
7981
/// </summary>
80-
public List<string> InvocationOverridableSettings { get; set; }
82+
public List<string>? InvocationOverridableSettings { get; set; }
8183

8284
/// <summary>
8385
/// Metadata describing the overridable settings. This field is provided by the server
8486
/// and cannot be modified.
8587
/// </summary>
86-
public List<AppSettingPart> InvocationOverridableSettingDefinitions { get; set; }
88+
public List<AppSettingPart>? InvocationOverridableSettingDefinitions { get; set; }
8789

8890
/// <summary>
8991
/// If <c>true</c>, events will be streamed to the app. Otherwise, events will be
@@ -95,7 +97,7 @@ public AppInstanceEntity()
9597
/// The signal expression describing which events will be sent to the app; if <c>null</c>,
9698
/// all events will reach the app.
9799
/// </summary>
98-
public SignalExpressionPart StreamedSignalExpression { get; set; }
100+
public SignalExpressionPart? StreamedSignalExpression { get; set; }
99101

100102
/// <summary>
101103
/// If a value is specified, events will be buffered to disk and sorted by timestamp-order
@@ -121,31 +123,31 @@ public AppInstanceEntity()
121123
/// Settings that control how events are ingested through the app.
122124
/// </summary>
123125
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
124-
public InputSettingsPart InputSettings { get; set; }
126+
public InputSettingsPart? InputSettings { get; set; }
125127

126128
/// <summary>
127129
/// Metrics describing the state and activity of the app process.
128130
/// </summary>
129131
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
130-
public AppInstanceProcessMetricsPart ProcessMetrics { get; set; }
132+
public AppInstanceProcessMetricsPart? ProcessMetrics { get; set; }
131133

132134
/// <summary>
133135
/// Information about ingestion activity through this app.
134136
/// </summary>
135137
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
136-
public InputMetricsPart InputMetrics { get; set; }
138+
public InputMetricsPart? InputMetrics { get; set; }
137139

138140
/// <summary>
139141
/// Information about the app's diagnostic input.
140142
/// </summary>
141143
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
142-
public InputMetricsPart DiagnosticInputMetrics { get; set; }
144+
public InputMetricsPart? DiagnosticInputMetrics { get; set; }
143145

144146
/// <summary>
145147
/// Information about events output through the app.
146148
/// </summary>
147149
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
148-
public AppInstanceOutputMetricsPart OutputMetrics { get; set; }
150+
public AppInstanceOutputMetricsPart? OutputMetrics { get; set; }
149151

150152
/// <summary>
151153
/// Obsolete.
@@ -160,5 +162,17 @@ public AppInstanceEntity()
160162
[Obsolete("Use !AcceptDirectInvocation instead.")]
161163
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
162164
public bool? DisallowManualInput { get; set; }
165+
166+
/// <summary>
167+
/// The name of the app.
168+
/// </summary>
169+
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
170+
public string? AppName { get; set; }
171+
172+
/// <summary>
173+
/// If <c>true</c>, then the app is able to write events to the log.
174+
/// </summary>
175+
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
176+
public bool? IsInput { get; set; }
163177
}
164178
}

src/Seq.Api/Model/Apps/AppSettingPart.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,16 @@ public class AppSettingPart
5454
/// for the setting.
5555
/// </summary>
5656
public List<AppSettingValuePart> AllowedValues { get; set; } = new List<AppSettingValuePart>();
57+
58+
/// <summary>
59+
/// If the setting value contains code in a programming or markup language, the
60+
/// language name.
61+
/// </summary>
62+
/// <remarks>Valid names are a subset of the names and aliases recognized by
63+
/// <a href="https://github.com/github/linguist/blob/master/lib/linguist/languages.yml">GitHub
64+
/// Linguist</a>. The generic value <c>code</c> will be specified if the language is non-specific but
65+
/// the value should be displayed in fixed-width font. Seq also recognizes the special Seq-specific
66+
/// <c>template</c> and <c>expression</c> syntaxes.</remarks>
67+
public string Syntax { get; set; }
5768
}
5869
}

src/Seq.Api/Model/Dashboarding/DashboardEntity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class DashboardEntity : Entity
3434
public string Title { get; set; }
3535

3636
/// <summary>
37-
/// If <c>true</c>, only users with <see cref="Permission.Setup"/> can modify the dashboard.
37+
/// If <c>true</c>, only users with <see cref="Permission.Project"/> can modify the dashboard.
3838
/// </summary>
3939
public bool IsProtected { get; set; }
4040

src/Seq.Api/Model/Data/QueryResultPart.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
using System.Collections.Generic;
1516
using Newtonsoft.Json;
1617

1718
namespace Seq.Api.Model.Data
@@ -50,6 +51,12 @@ public class QueryResultPart
5051
/// </summary>
5152
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
5253
public TimeseriesPart[] Series { get; set; }
54+
55+
/// <summary>
56+
/// Result variables.
57+
/// </summary>
58+
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
59+
public Dictionary<string, object> Variables { get; set; }
5360

5461
/// <summary>
5562
/// On error only, a description of the error.

src/Seq.Api/Model/Link.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Seq.Api.Model
2626
/// parameterized in order to produce a complete URI (if the template contains no
2727
/// parameters then it may also be a literal URI).
2828
/// </summary>
29-
public struct Link
29+
public readonly struct Link
3030
{
3131
/// <summary>
3232
/// An empty link.

src/Seq.Api/Model/Security/Permission.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
using System;
16+
1517
namespace Seq.Api.Model.Security
1618
{
1719
/// <summary>
@@ -46,10 +48,29 @@ public enum Permission
4648
/// Write-access to signals, alerts, preferences etc.
4749
/// </summary>
4850
Write,
49-
51+
5052
/// <summary>
5153
/// Access to administrative features of Seq, management of other users, app installation, backups.
5254
/// </summary>
55+
[Obsolete("The `Setup` permission has been replaced by `Project` and `System`.")]
5356
Setup,
57+
58+
/// <summary>
59+
/// Access to settings that control data ingestion, storage, dashboarding and alerting.
60+
/// </summary>
61+
Project,
62+
63+
/// <summary>
64+
/// Access to settings and features that interact with, or provide access to, the underlying host server,
65+
/// such as app (plug-in) installation, backup settings, cluster configuration, diagnostics, and features
66+
/// relying on outbound network access like package feeds and update checks. This permission is required for
67+
/// configuration of the authentication provider and related settings.
68+
/// </summary>
69+
System,
70+
71+
/// <summary>
72+
/// Create, edit, and delete user accounts, reset local user passwords.
73+
/// </summary>
74+
Organization
5475
}
5576
}

src/Seq.Api/Model/Security/RoleEntity.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ public class RoleEntity : Entity
2929
/// <summary>
3030
/// Permissions granted to users in the role.
3131
/// </summary>
32-
public HashSet<Permission> Permissions { get; set; } = new HashSet<Permission>();
32+
public HashSet<Permission> Permissions { get; set; } = new();
33+
34+
/// <summary>
35+
/// Optionally, an extended description of the role.
36+
/// </summary>
37+
public string Description { get; set; }
3338
}
3439
}

0 commit comments

Comments
 (0)