Complete management API and CLI command parity
This commit is contained in:
@@ -19,6 +19,8 @@ public static class TemplateCommands
|
||||
var command = new Command("template") { Description = "Manage templates" };
|
||||
|
||||
command.Add(BuildList(urlOption, formatOption, usernameOption, passwordOption));
|
||||
command.Add(BuildResolvedMembers(urlOption, formatOption, usernameOption, passwordOption));
|
||||
command.Add(BuildMove(urlOption, formatOption, usernameOption, passwordOption));
|
||||
command.Add(BuildGet(urlOption, formatOption, usernameOption, passwordOption));
|
||||
command.Add(BuildCreate(urlOption, formatOption, usernameOption, passwordOption));
|
||||
command.Add(BuildUpdate(urlOption, formatOption, usernameOption, passwordOption));
|
||||
@@ -139,6 +141,65 @@ public static class TemplateCommands
|
||||
return group;
|
||||
}
|
||||
|
||||
private static Command BuildResolvedMembers(Option<string> urlOption, Option<string> formatOption, Option<string> usernameOption, Option<string> passwordOption)
|
||||
{
|
||||
var idOption = new Option<int>("--id") { Description = "Template ID", Required = true };
|
||||
var cmd = new Command("resolved-members") { Description = "Inspect resolved template members including inherited members" };
|
||||
cmd.Add(idOption);
|
||||
cmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
result, urlOption, formatOption, usernameOption, passwordOption,
|
||||
new GetResolvedTemplateMembersCommand(result.GetValue(idOption)));
|
||||
});
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private static Command BuildMove(Option<string> urlOption, Option<string> formatOption, Option<string> usernameOption, Option<string> passwordOption)
|
||||
{
|
||||
var idOption = new Option<int>("--id") { Description = "Template ID", Required = true };
|
||||
var folderOption = new Option<int?>("--folder-id") { Description = "Destination folder ID; omit to move to the tree root" };
|
||||
var cmd = new Command("move") { Description = "Move a template into a folder or to the tree root" };
|
||||
cmd.Add(idOption);
|
||||
cmd.Add(folderOption);
|
||||
cmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
result, urlOption, formatOption, usernameOption, passwordOption,
|
||||
new MoveTemplateToFolderCommand(result.GetValue(idOption), result.GetValue(folderOption)));
|
||||
});
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private static Command BuildUpdateNativeAlarmSource(Option<string> urlOption, Option<string> formatOption, Option<string> usernameOption, Option<string> passwordOption)
|
||||
{
|
||||
var idOption = new Option<int>("--id") { Description = "Native alarm source ID", Required = true };
|
||||
var nameOption = new Option<string>("--name") { Description = "Source binding name", Required = true };
|
||||
var connectionOption = new Option<string>("--connection") { Description = "Alarm-capable data connection name", Required = true };
|
||||
var sourceOption = new Option<string>("--source-ref") { Description = "Source reference (OPC UA SourceNode nodeId, or MxAccess object/area)", Required = true };
|
||||
var filterOption = new Option<string?>("--filter") { Description = "Condition filter; omit to clear and mirror all conditions" };
|
||||
var descriptionOption = new Option<string?>("--description") { Description = "Description; omit to clear" };
|
||||
var lockedOption = new Option<bool>("--locked") { Description = "Lock status; omit for unlocked" };
|
||||
var cmd = new Command("update") { Description = "Replace the fields of a native alarm source binding" };
|
||||
cmd.Add(idOption);
|
||||
cmd.Add(nameOption);
|
||||
cmd.Add(connectionOption);
|
||||
cmd.Add(sourceOption);
|
||||
cmd.Add(filterOption);
|
||||
cmd.Add(descriptionOption);
|
||||
cmd.Add(lockedOption);
|
||||
cmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
result, urlOption, formatOption, usernameOption, passwordOption,
|
||||
new UpdateTemplateNativeAlarmSourceCommand(
|
||||
result.GetValue(idOption), result.GetValue(nameOption)!,
|
||||
result.GetValue(connectionOption)!, result.GetValue(sourceOption)!,
|
||||
result.GetValue(filterOption), result.GetValue(descriptionOption), result.GetValue(lockedOption)));
|
||||
});
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private static Command BuildResyncMembers(Option<string> urlOption, Option<string> formatOption, Option<string> usernameOption, Option<string> passwordOption)
|
||||
{
|
||||
var idOption = new Option<int>("--id") { Description = "Template ID (its derived subtree is included)", Required = true };
|
||||
@@ -758,6 +819,8 @@ public static class TemplateCommands
|
||||
Description = "Manage template native alarm source bindings (read-only mirror of OPC UA A&C / MxGateway alarms)"
|
||||
};
|
||||
|
||||
group.Add(BuildUpdateNativeAlarmSource(urlOption, formatOption, usernameOption, passwordOption));
|
||||
|
||||
// add
|
||||
var templateIdOption = new Option<int>("--template-id") { Description = "Template ID", Required = true };
|
||||
var nameOption = new Option<string>("--name") { Description = "Source binding name", Required = true };
|
||||
|
||||
Reference in New Issue
Block a user