Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
63f414a
stubbed index commands
liammclennan Apr 19, 2024
1b26754
Adding index commands
liammclennan Apr 22, 2024
0e985ff
Complete index and expression index commands
liammclennan Apr 23, 2024
494999a
Delete test
liammclennan Apr 23, 2024
917cf12
PR feedback
liammclennan Apr 23, 2024
fed611a
Mark template export test case with min API version
nblumhardt Apr 23, 2024
e95cc7b
Version-gated end-to-end tests for new index-related commands
nblumhardt Apr 23, 2024
da903f4
Merge pull request #337 from liammclennan/indexes
nblumhardt Apr 23, 2024
ed4691c
Missed the 2024.3 version update in #337
nblumhardt Apr 24, 2024
1c5f905
Add example signal expression
liammclennan Apr 28, 2024
f4691dc
Merge pull request #338 from liammclennan/doc-appinstance-create
nblumhardt Apr 28, 2024
1bf380d
Use required keyword; ordinal string comparison
nblumhardt Apr 29, 2024
fd94db4
Fixes in test project
nblumhardt Apr 29, 2024
522821e
Merge pull request #339 from nblumhardt/final-2024.3
nblumhardt Apr 29, 2024
10797cc
Launch configurations for local executable vs Docker/latest vs Docker…
nblumhardt Apr 29, 2024
72ed0a8
launchSettings.json
nblumhardt Apr 29, 2024
ade3947
Merge pull request #340 from nblumhardt/easy-end-to-end
nblumhardt Apr 29, 2024
d1663bd
Fix end-to-end indexing tests; some templating updates were needed
nblumhardt Apr 29, 2024
1225878
Merge pull request #341 from nblumhardt/fix-indexing-tests
nblumhardt Apr 29, 2024
334583b
seqcli app uninstall
nblumhardt Apr 30, 2024
c563dcd
Merge pull request #342 from nblumhardt/appinstance-uninstall
KodrAus Apr 30, 2024
1ed8801
update to stable 2024.3 release of Seq.Api
KodrAus May 1, 2024
2678561
Merge pull request #343 from KodrAus/chore/2024-3-api
KodrAus May 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ dlldata.c
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json

*_i.c
*_p.c
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2024.2.{build}
version: 2024.3.{build}
skip_tags: true
image:
- Visual Studio 2022
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "8.0.203"
"version": "8.0.204"
}
}
1 change: 0 additions & 1 deletion src/Roastery/Data/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Serilog;
using Serilog.Events;
using SerilogTracing;
using SerilogTracing.Instrumentation;

namespace Roastery.Data;

Expand Down
1 change: 0 additions & 1 deletion src/Roastery/Web/RequestLoggingMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Serilog.Context;
using Serilog.Events;
using SerilogTracing;
using SerilogTracing.Instrumentation;

namespace Roastery.Web;

Expand Down
4 changes: 2 additions & 2 deletions src/SeqCli/Cli/CommandMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ namespace SeqCli.Cli;

public class CommandMetadata : ICommandMetadata
{
public string Name { get; set; } = null!;
public required string Name { get; set; }
public string? SubCommand { get; set; }
public string HelpText { get; set; } = null!;
public required string HelpText { get; set; }
public string? Example { get; set; }
}
64 changes: 64 additions & 0 deletions src/SeqCli/Cli/Commands/App/UninstallCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using SeqCli.Cli.Features;
using SeqCli.Connection;
using SeqCli.Util;
using Serilog;

namespace SeqCli.Cli.Commands.App;

[Command("app", "uninstall", "Uninstall an app package",
Example = "seqcli app uninstall --package-id 'Seq.App.JsonArchive'")]
// ReSharper disable once UnusedType.Global
class UninstallCommand : Command
{
readonly SeqConnectionFactory _connectionFactory;

string? _packageId, _id;
readonly ConnectionFeature _connection;

public UninstallCommand(SeqConnectionFactory connectionFactory)
{
_connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));

Options.Add(
"package-id=",
"The package id of the app package to uninstall",
packageId => _packageId = ArgumentString.Normalize(packageId));

Options.Add(
"i=|id=",
"The id of a single app package to uninstall",
t => _id = ArgumentString.Normalize(t));

_connection = Enable<ConnectionFeature>();
}

protected override async Task<int> Run()
{
if (_packageId == null && _id == null)
{
Log.Error("A `package-id` or `id` must be specified");
return 1;
}

var connection = _connectionFactory.Connect(_connection);

var toRemove = _id != null ? [await connection.Apps.FindAsync(_id)]
: (await connection.Apps.ListAsync())
.Where(app => _packageId == app.Package.PackageId)
.ToArray();

if (!toRemove.Any())
{
Log.Error("No matching API key was found");
return 1;
}

foreach (var app in toRemove)
await connection.Apps.RemoveAsync(app);

return 0;
}
}
4 changes: 2 additions & 2 deletions src/SeqCli/Cli/Commands/AppInstance/CreateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config

Options.Add(
"stream:",
"Stream incoming events to this app instance as they're ingested; optionally accepts a signal expression limiting which events should be streamed",
"Stream incoming events to this app instance as they're ingested; optionally accepts a signal expression limiting which events should be streamed, for example `signal-1,signal-2`",
s =>
{
_streamIncomingEvents = true;
Expand Down Expand Up @@ -116,4 +116,4 @@ bool ValidateSettingName(string settingName)

return 0;
}
}
}
4 changes: 2 additions & 2 deletions src/SeqCli/Cli/Commands/Bench/QueryBenchCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace SeqCli.Cli.Commands.Bench;

class QueryBenchCase
{
public string Id { get; set; } = null!;
public string Query { get; set; } = null!;
public required string Id { get; set; }
public required string Query { get; set; }
public string? SignalExpression { get; set; }

// Not used programmatically at this time.
Expand Down
70 changes: 70 additions & 0 deletions src/SeqCli/Cli/Commands/ExpressionIndex/CreateCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright © Datalust Pty Ltd 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.Threading.Tasks;
using Seq.Api.Model.Signals;
using SeqCli.Cli.Features;
using SeqCli.Config;
using SeqCli.Connection;
using SeqCli.Signals;
using SeqCli.Syntax;
using SeqCli.Util;
using Serilog;

namespace SeqCli.Cli.Commands.ExpressionIndex;

[Command("expressionindex", "create", "Create an expression index",
Example = "seqcli expressionindex create --expression \"ServerName\"")]
class CreateCommand : Command
{
readonly SeqConnectionFactory _connectionFactory;

readonly ConnectionFeature _connection;
readonly OutputFormatFeature _output;

string? _expression;

public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config)
{
_connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));

Options.Add(
"e=|expression=",
"The expression to index",
v => _expression = ArgumentString.Normalize(v));

_connection = Enable<ConnectionFeature>();
_output = Enable(new OutputFormatFeature(config.Output));
}

protected override async Task<int> Run()
{
var connection = _connectionFactory.Connect(_connection);

if (string.IsNullOrEmpty(_expression))
{
Log.Error("An `expression` must be specified");
return 1;
}

var index = await connection.ExpressionIndexes.TemplateAsync();
index.Expression = _expression;
index = await connection.ExpressionIndexes.AddAsync(index);

_output.WriteEntity(index);

return 0;
}
}
41 changes: 41 additions & 0 deletions src/SeqCli/Cli/Commands/ExpressionIndex/ListCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Threading.Tasks;
using SeqCli.Cli.Features;
using SeqCli.Config;
using SeqCli.Connection;

namespace SeqCli.Cli.Commands.ExpressionIndex;

[Command("expressionindex", "list", "List expression indexes", Example="seqcli expressionindex list")]
class ListCommand : Command
{
readonly SeqConnectionFactory _connectionFactory;

readonly ConnectionFeature _connection;
readonly OutputFormatFeature _output;
string? _id;

public ListCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config)
{
if (config == null) throw new ArgumentNullException(nameof(config));
_connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));

Options.Add(
"i=|id=",
"The id of a single expression index to list",
id => _id = id);

_output = Enable(new OutputFormatFeature(config.Output));
_connection = Enable<ConnectionFeature>();
}

protected override async Task<int> Run()
{
var connection = _connectionFactory.Connect(_connection);
var list = _id is not null
? [await connection.ExpressionIndexes.FindAsync(_id)]
: await connection.ExpressionIndexes.ListAsync();
_output.ListEntities(list);
return 0;
}
}
59 changes: 59 additions & 0 deletions src/SeqCli/Cli/Commands/ExpressionIndex/RemoveCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2018 Datalust Pty Ltd 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.Linq;
using System.Threading.Tasks;
using SeqCli.Cli.Features;
using SeqCli.Connection;
using Serilog;

namespace SeqCli.Cli.Commands.ExpressionIndex;

[Command("expressionindex", "remove", "Remove an expression index from the server",
Example = "seqcli expressionindex -i expressionindex-2529")]
class RemoveCommand : Command
{
readonly SeqConnectionFactory _connectionFactory;

readonly ConnectionFeature _connection;
string? _id;

public RemoveCommand(SeqConnectionFactory connectionFactory)
{
_connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));

Options.Add(
"i=|id=",
"The id of an expression index to remove",
id => _id = id);

_connection = Enable<ConnectionFeature>();
}

protected override async Task<int> Run()
{
if (_id == null)
{
Log.Error("An `id` must be specified");
return 1;
}

var connection = _connectionFactory.Connect(_connection);
var toRemove = await connection.ExpressionIndexes.FindAsync(_id);
await connection.ExpressionIndexes.RemoveAsync(toRemove);

return 0;
}
}
61 changes: 61 additions & 0 deletions src/SeqCli/Cli/Commands/Index/ListCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright 2018 Datalust Pty Ltd 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.Linq;
using System.Threading.Tasks;
using Seq.Api.Model.Indexes;
using SeqCli.Cli.Features;
using SeqCli.Config;
using SeqCli.Connection;

namespace SeqCli.Cli.Commands.Index;

[Command("index", "list", "List indexes", Example="seqcli index list")]
class ListCommand : Command
{
readonly SeqConnectionFactory _connectionFactory;

readonly ConnectionFeature _connection;
readonly OutputFormatFeature _output;
string? _id;

public ListCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config)
{
if (config == null) throw new ArgumentNullException(nameof(config));
_connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));

Options.Add(
"i=|id=",
"The id of a single index to list",
id => _id = id);

_output = Enable(new OutputFormatFeature(config.Output));
_connection = Enable<ConnectionFeature>();
}

protected override async Task<int> Run()
{
var connection = _connectionFactory.Connect(_connection);

var list = _id is not null
? [await connection.Indexes.FindAsync(_id)]
: await connection.Indexes.ListAsync();

_output.ListEntities(list);

return 0;
}
}
Loading