feat: achieve CLI parity with Central UI
Add 33 new management message records, ManagementActor handlers, and CLI commands to close all functionality gaps between the Central UI and the Management CLI. New capabilities include: - Template member CRUD (attributes, alarms, scripts, compositions) - Shared script CRUD - Database connection definition CRUD - Inbound API method CRUD - LDAP scope rule management - API key enable/disable - Area update - Remote event log and parked message queries - Missing get/update commands for templates, sites, instances, data connections, external systems, notifications, and SMTP config Includes 12 new ManagementActor unit tests covering authorization, happy-path queries, and error handling. Updates CLI README and component design documents (Component-CLI.md, Component-ManagementService.md).
This commit is contained in:
@@ -11,14 +11,30 @@ public static class SiteCommands
|
||||
var command = new Command("site") { Description = "Manage sites" };
|
||||
|
||||
command.Add(BuildList(contactPointsOption, formatOption));
|
||||
command.Add(BuildGet(contactPointsOption, formatOption));
|
||||
command.Add(BuildCreate(contactPointsOption, formatOption));
|
||||
command.Add(BuildUpdate(contactPointsOption, formatOption));
|
||||
command.Add(BuildDelete(contactPointsOption, formatOption));
|
||||
command.Add(BuildDeployArtifacts(contactPointsOption, formatOption));
|
||||
command.Add(BuildArea(contactPointsOption, formatOption));
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
private static Command BuildGet(Option<string> contactPointsOption, Option<string> formatOption)
|
||||
{
|
||||
var idOption = new Option<int>("--id") { Description = "Site ID", Required = true };
|
||||
var cmd = new Command("get") { Description = "Get a site by ID" };
|
||||
cmd.Add(idOption);
|
||||
cmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
var id = result.GetValue(idOption);
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
result, contactPointsOption, formatOption, new GetSiteCommand(id));
|
||||
});
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private static Command BuildList(Option<string> contactPointsOption, Option<string> formatOption)
|
||||
{
|
||||
var cmd = new Command("list") { Description = "List all sites" };
|
||||
@@ -100,6 +116,67 @@ public static class SiteCommands
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private static Command BuildArea(Option<string> contactPointsOption, Option<string> formatOption)
|
||||
{
|
||||
var group = new Command("area") { Description = "Manage areas" };
|
||||
|
||||
var siteIdOption = new Option<int>("--site-id") { Description = "Site ID", Required = true };
|
||||
var listCmd = new Command("list") { Description = "List areas for a site" };
|
||||
listCmd.Add(siteIdOption);
|
||||
listCmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
var siteId = result.GetValue(siteIdOption);
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
result, contactPointsOption, formatOption, new ListAreasCommand(siteId));
|
||||
});
|
||||
group.Add(listCmd);
|
||||
|
||||
var createSiteIdOption = new Option<int>("--site-id") { Description = "Site ID", Required = true };
|
||||
var nameOption = new Option<string>("--name") { Description = "Area name", Required = true };
|
||||
var parentOption = new Option<int?>("--parent-id") { Description = "Parent area ID" };
|
||||
var createCmd = new Command("create") { Description = "Create an area" };
|
||||
createCmd.Add(createSiteIdOption);
|
||||
createCmd.Add(nameOption);
|
||||
createCmd.Add(parentOption);
|
||||
createCmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
var siteId = result.GetValue(createSiteIdOption);
|
||||
var name = result.GetValue(nameOption)!;
|
||||
var parentId = result.GetValue(parentOption);
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
result, contactPointsOption, formatOption,
|
||||
new CreateAreaCommand(siteId, name, parentId));
|
||||
});
|
||||
group.Add(createCmd);
|
||||
|
||||
var updateIdOption = new Option<int>("--id") { Description = "Area ID", Required = true };
|
||||
var updateNameOption = new Option<string>("--name") { Description = "New area name", Required = true };
|
||||
var updateCmd = new Command("update") { Description = "Update an area" };
|
||||
updateCmd.Add(updateIdOption);
|
||||
updateCmd.Add(updateNameOption);
|
||||
updateCmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
var id = result.GetValue(updateIdOption);
|
||||
var name = result.GetValue(updateNameOption)!;
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
result, contactPointsOption, formatOption, new UpdateAreaCommand(id, name));
|
||||
});
|
||||
group.Add(updateCmd);
|
||||
|
||||
var deleteIdOption = new Option<int>("--id") { Description = "Area ID", Required = true };
|
||||
var deleteCmd = new Command("delete") { Description = "Delete an area" };
|
||||
deleteCmd.Add(deleteIdOption);
|
||||
deleteCmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
var id = result.GetValue(deleteIdOption);
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
result, contactPointsOption, formatOption, new DeleteAreaCommand(id));
|
||||
});
|
||||
group.Add(deleteCmd);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
private static Command BuildDeployArtifacts(Option<string> contactPointsOption, Option<string> formatOption)
|
||||
{
|
||||
var siteIdOption = new Option<int?>("--site-id") { Description = "Target site ID (all sites if omitted)" };
|
||||
|
||||
Reference in New Issue
Block a user