Complete management API and CLI command parity
This commit is contained in:
@@ -4,9 +4,10 @@ namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Bidirectional name registry for management command records. The registry contains
|
||||
/// exactly the non-abstract <c>*Command</c> types declared in the
|
||||
/// the HTTP-eligible non-abstract <c>*Command</c> types declared in the
|
||||
/// <c>ZB.MOM.WW.ScadaBridge.Commons.Messages.Management</c> namespace; these are the commands that
|
||||
/// travel over the HTTP management boundary.
|
||||
/// travel over the HTTP management boundary. Site-only tag reads and the retired
|
||||
/// role-resolution flow are excluded; their internal message types remain available.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="Resolve"/> and <see cref="GetCommandName"/> are symmetric:
|
||||
@@ -41,7 +42,7 @@ public static class ManagementCommandRegistry
|
||||
/// <param name="commandType">The CLR type of the management command to look up.</param>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="commandType"/> is not a registered management
|
||||
/// command — i.e. not a non-abstract <c>*Command</c> type in the
|
||||
/// command — i.e. not an HTTP-eligible non-abstract <c>*Command</c> type in the
|
||||
/// <c>ZB.MOM.WW.ScadaBridge.Commons.Messages.Management</c> namespace. This keeps the method
|
||||
/// symmetric with <see cref="Resolve"/>: it never yields a name that
|
||||
/// <see cref="Resolve"/> cannot turn back into the same type.
|
||||
@@ -56,7 +57,7 @@ public static class ManagementCommandRegistry
|
||||
|
||||
throw new ArgumentException(
|
||||
$"'{commandType.FullName}' is not a registered management command. " +
|
||||
$"Management commands must be non-abstract '*Command' records declared in " +
|
||||
$"Management commands must be HTTP-eligible, non-abstract '*Command' records declared in " +
|
||||
$"the '{typeof(ManagementEnvelope).Namespace}' namespace.",
|
||||
nameof(commandType));
|
||||
}
|
||||
@@ -69,7 +70,12 @@ public static class ManagementCommandRegistry
|
||||
return assembly.GetTypes()
|
||||
.Where(t => t.Namespace == ns
|
||||
&& t.Name.EndsWith("Command", StringComparison.Ordinal)
|
||||
&& !t.IsAbstract)
|
||||
&& !t.IsAbstract
|
||||
// These records are internal/retired, not central HTTP operations.
|
||||
// Keep the types for site gRPC and compatibility, without advertising
|
||||
// names that ManagementActor cannot dispatch.
|
||||
&& t != typeof(ReadTagValuesCommand)
|
||||
&& t != typeof(ResolveRolesCommand))
|
||||
.ToFrozenDictionary(
|
||||
t => t.Name[..^"Command".Length],
|
||||
t => t,
|
||||
|
||||
Reference in New Issue
Block a user