Complete management API and CLI command parity
This commit is contained in:
+33
-5
@@ -44,7 +44,7 @@ Every command accepts `--format json` (default) or `--format table`. For JSON ou
|
||||
|
||||
## Architecture
|
||||
|
||||
`Program.cs` builds the `RootCommand` tree, attaches the four global options (`--url`, `--username`, `--password`, `--format`), and registers each command group:
|
||||
`Program.cs` invokes `CliApplication.BuildRoot()`, which builds the `RootCommand` tree, attaches the four global options (`--url`, `--username`, `--password`, `--format`), and registers each command group:
|
||||
|
||||
```csharp
|
||||
rootCommand.Add(TemplateCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
@@ -59,10 +59,14 @@ rootCommand.Add(AuditLogCommands.Build(urlOption, formatOption, usernameOption,
|
||||
rootCommand.Add(AuditCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
rootCommand.Add(HealthCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
rootCommand.Add(DebugCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
rootCommand.Add(SharedSchemaCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
rootCommand.Add(SharedScriptCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
rootCommand.Add(DbConnectionCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
rootCommand.Add(ApiMethodCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
rootCommand.Add(BundleCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
rootCommand.Add(CachedCallCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
rootCommand.Add(SecuredWriteCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
rootCommand.Add(FlowDebugCommands.Build(urlOption, formatOption, usernameOption, passwordOption));
|
||||
```
|
||||
|
||||
Every command's action delegates to `CommandHelpers.ExecuteCommandAsync`, which owns the URL/credential resolution, `ManagementHttpClient` lifetime, and exit-code mapping. This consolidation means the authorization-failure exit code (`2`) is enforced uniformly — including for the `bundle` group, which uses `ExecuteCommandAsync` with a longer 5-minute timeout and a per-command `onSuccess` handler rather than a separate HTTP path.
|
||||
@@ -105,14 +109,18 @@ scadabridge instance deploy --id 7
|
||||
|
||||
| Group | Subcommands | Role required |
|
||||
|-------|-------------|---------------|
|
||||
| `template` | `list`, `get`, `create`, `update`, `delete`, `validate`; `attribute add/update/delete`; `alarm add/update/delete`; `script add/update/delete`; `composition add/delete`; `native-alarm-source add/list/remove` | `Design` |
|
||||
| `instance` | `list`, `get`, `create`, `set-bindings`, `set-overrides`, `alarm-override set/delete/list`, `native-alarm-source set/clear`, `set-area`, `diff`, `deploy`, `enable`, `disable`, `delete` | `Deployment` |
|
||||
| `template` | `list`, `get`, `create`, `update`, `delete`, `validate`, `resolved-members`, `move`; `attribute add/update/delete`; `alarm add/update/delete`; `script add/update/delete`; `composition add/delete`; `native-alarm-source add/list/update/remove` | `Design` |
|
||||
| `instance` | `list`, `get`, `create`, `set-bindings`, `set-overrides`, `alarm-override set/delete/list`, `native-alarm-source set/clear/list/import`, `attribute-override delete`, `set-area`, `diff`, `deploy`, `enable`, `disable`, `delete` | `Deployment` |
|
||||
| `site` | `list`, `get`, `create`, `delete`, `deploy-artifacts`; `area list/create/update/delete` | `Admin` |
|
||||
| `deploy` | `instance`, `artifacts`, `status` | `Deployment` |
|
||||
| `data-connection` | `list`, `get`, `create`, `update`, `delete` | `Design` / `Deployment` |
|
||||
| `data-connection` | `list`, `get`, `create`, `update`, `delete`, `move`; `browse`, `search`, `verify-endpoint`, `certs` | `Design` / `Deployment` |
|
||||
| `external-system` | `list`, `get`, `create`, `update`, `delete` | `Design` |
|
||||
| `notification` | `list`, `get`, `create`, `update`, `delete`; `smtp list/update` | `Design` / `Admin` |
|
||||
| `notification` | `list`, `get`, `create`, `update`, `delete`, `rename`; `recipient add/delete`; `smtp list/create/update`; `sms list/create/update` | `Design` / `Admin` |
|
||||
| `security` | `api-key list/create/update/delete/set-methods`; `role-mapping list/create/update/delete`; `scope-rule list/add/delete` | `Admin` |
|
||||
| `shared-schema` | `list`, `get`, `create`, `update`, `delete` | Read: authenticated; mutations: Designer |
|
||||
| `secured-write` | `list`, `submit`, `approve`, `reject` | Operator / Verifier / Administrator, enforced per operation |
|
||||
| `cached-call` | `list`, `retry`, `discard` | Server-enforced operational roles and site scope |
|
||||
| `flow-debug` | `run-method`, `run-script`, `run-value-change`, `replay` | Deployer; replay also accepts OperationalAudit roles |
|
||||
| `shared-script` | `list`, `get`, `create`, `update`, `delete` | `Design` |
|
||||
| `db-connection` | `list`, `get`, `create`, `update`, `delete` | `Design` |
|
||||
| `api-method` | `list`, `get`, `create`, `update`, `delete` | `Design` |
|
||||
@@ -248,3 +256,23 @@ The `audit-log` command group was renamed to `audit-config` in M8 of Audit Log (
|
||||
- [Audit Log](./AuditLog.md)
|
||||
- [Security](./Security.md)
|
||||
- [Commons](./Commons.md)
|
||||
|
||||
|
||||
## Management parity and deadlines
|
||||
|
||||
All 149 HTTP-eligible management contracts are exposed across 20 production CLI
|
||||
groups, including the `shared-schema` library and the secured-write lifecycle.
|
||||
The [parity additions](../../src/ZB.MOM.WW.ScadaBridge.CLI/README.md#management-parity-additions-2026-09-10)
|
||||
document the individual notification edits, provider creation, template and
|
||||
instance operations, connection relocation, and SMS policy flags.
|
||||
|
||||
The production-root loopback test requires actual HTTP dispatch for every
|
||||
eligible contract. A separate actor test verifies every registered contract has
|
||||
a handler. `ReadTagValues` remains site-only and `ResolveRoles` remains retired;
|
||||
both are excluded from HTTP name resolution.
|
||||
|
||||
Every instance/artifact/site deployment alias lets the server own the overall
|
||||
deadline, while retaining a bounded connect timeout. This prevents the ordinary
|
||||
30-second client timer from abandoning a deployment still applying at the server.
|
||||
Secured-write approval interprets execution status as well as HTTP success:
|
||||
only `Executed` exits zero; failed execution or an invalid response exits one.
|
||||
|
||||
@@ -241,3 +241,14 @@ Any exception that is not a `ManagementCommandException` or `SiteScopeViolationE
|
||||
- [Security](./Security.md)
|
||||
- [Audit Log](./AuditLog.md)
|
||||
- [Host](./Host.md)
|
||||
|
||||
|
||||
## HTTP command eligibility
|
||||
|
||||
`ManagementCommandRegistry` includes 149 executable HTTP contracts. The site-only
|
||||
`ReadTagValuesCommand` and retired `ResolveRolesCommand` remain internal message
|
||||
types but are excluded from the HTTP registry, so `/management` rejects those
|
||||
names as unknown commands instead of accepting an undispatchable request. Site
|
||||
gRPC tag-read serialization and server-side LDAP role resolution are unchanged.
|
||||
The dispatch-coverage test now checks every HTTP-registered contract without
|
||||
exemptions, including create records inherited from update records.
|
||||
|
||||
Reference in New Issue
Block a user