Repository navigation
feat: nrc monitor (every Norcube Monitor operation) - #15
Merged
Merged
Conversation
Registry entry pulsecheck (Norcube PulseCheck, audience pulsecheck, https://pulsecheck.api.norcube.com/app/v1, spec apps/pulsecheck/docs/ app_swagger.json), so `nrc api pulsecheck`, --endpoint-url pulsecheck=... and NORCUBE_PULSECHECK_URL work. The hand-kept tables get it too: the config switch, the service key constant, the audience constant, `auth token --audience pulsecheck` and the CI token audiences. The client is generated from the spec that adds operation ids, security, problems and x-norcube-scopes to every operation; the Status tag (the public service status route) is excluded. Signed-off-by: Jan Švábík <jansvabik@jansvabik.cz>
…er has - status: open incidents, monitors by status and the ones that need attention; --fail-on critical|warning exits 1 with the new code unhealthy (the report is printed either way). - monitors list|get|create|update|delete|pause|resume|run, bulk pause|resume|delete, results list, status-changes list, stats get, availability get, certificate get, alerts get|set. Typed flags per type (http, keyword, ssl, domain) or the API body with --from-file; secret headers only from a file or stdin; update starts from the current settings. Monitors are named by id or exact name. run --wait makes the check's verdict the exit code (job_failed, --fail-on warning). - incidents list|get|acknowledge|summary with every API filter. - channels list|get|create|update|delete|test|verify, deliveries list. A webhook's signing secret goes to --secret-file and is never printed; Slack and Discord URLs come from a file or stdin; verify asks for the code on a terminal or reads --code-file. - Completion for monitor, channel and incident ids. The shared error formatter reads RFC 9457 problems (detail, field errors, reason INSUFFICIENT_SCOPE to exit 5, the rest in details). output.Object.Text keeps -o text columns fixed for objects whose fields depend on the resource, and tables colour PulseCheck's status words. Tests: golden files in every format for each read command, the command tree of the group, and command tests for every write, the usage errors before any request, confirmations, name resolution, --wait outcomes, secrets kept off stdout and the problem mapping. Signed-off-by: Jan Švábík <jansvabik@jansvabik.cz>
The backend adds pulsecheck.channels: CI tokens and scoped sign-ins can manage alert channels, send test alerts and verification codes with it, and pulsecheck.write doesn't include it. Help text, DESIGN.md and the changelog say so instead of calling channels person-only; the spec is regenerated (x-norcube-scopes only, the client is unchanged), and a test pins that a refusal naming the scope exits 5. Signed-off-by: Jan Švábík <jansvabik@jansvabik.cz>
The backend renamed the service before its first release, every technical name included, and the CLI follows: command group `monitor` (`nrc monitor monitors list`, `nrc monitor status`), registry key, OAuth audience and generated package `monitor`, scopes `monitor.read|check|write|channels`, endpoint https://monitor.api.norcube.com/app/v1 and `NORCUBE_MONITOR_URL`. The client and spec are regenerated from the renamed backend; only names in descriptions and examples change. The goldens differ only by the name (and one table column that got narrower with a shorter fixture URL). No `pulsecheck` alias: the old name was never released, so no script, config file or token depends on it. Signed-off-by: Jan Švábík <jansvabik@jansvabik.cz>
Signed-off-by: Jan Švábík <jansvabik@jansvabik.cz>
Signed-off-by: Jan Švábík <jansvabik@jansvabik.cz>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
nrc monitor: every Norcube Monitor operation an organization member has, following DESIGN.md 6.1 (steps 5 to 10 and 14). The product was called PulseCheck until the backend renamed it before launch (jetlio/norcube-platform-backend-mono#159); this PR replaces #14 and carries its commits plus the rename. Needs the backend's Monitor scopes for CI use; signed-in people can use it as soon as the endpoint is live. The client is generated from #159's spec.Names
monitor--endpoint-urlkeymonitor(NORCUBE_MONITOR_URL)monitormonitor.read,monitor.check,monitor.write,monitor.channelshttps://monitor.api.norcube.com/app/v1apps/monitor/docs/app_swagger.json→specs/monitor.openapi.json,internal/api/monitorNo
pulsecheckalias orcmdutil.Renamedentry: the old name was never in a release, so no script, config file or token depends on it (decision-log entry in DESIGN.md).Commands
status(--fail-on critical|warning|none, default none; exit 1 with the new codeunhealthy, report printed either way)monitors list | get | create | update | delete | pause | resume | run;monitors bulk pause | resume | delete;monitors results list,status-changes list(aliashistory),stats get,availability get,certificate get,alerts get | setincidents list | get | acknowledge (ack) | summarychannels list | get | create | update | delete | test | verify;channels deliveries listMonitors and channels are named by id or exact name (ambiguous names are a usage error).
monitors run --waitturns the synchronous check's verdict into the exit code (job_failedon critical or inconclusive;--fail-on warning; exit 7 after--wait-timeout). CI tokens:monitor.read,monitor.check,monitor.write, andmonitor.channelsfor alert channels (not included inmonitor.write). Secrets: secret headers only from a file or stdin, Slack/Discord URLs only via--url-file, a webhook's signing secret only to--secret-file(0600, never overwritten, never printed), verification codes via a hidden prompt or--code-file.Shared changes (additive)
apierrorparses RFC 9457 problems (detail, fielderrors,reason;INSUFFICIENT_SCOPE→ exit 5);detailsin-o jsonerrors.clierr.CodeUnhealthy(exit 1).output.Object.Text: a fixed-o textrecord for objects whose fields depend on the resource.acknowledge,verify,summary(DESIGN.md), decision-log entries, inventory, 6.1 state.Codegen
make codegen MONO=<backend at #159>regeneratesspecs/monitor.openapi.jsonandinternal/api/monitor; against the previous spec only the title, scope names inx-norcube-scopesand one example URL change (the client differs in two comment lines).make codegenalso shows drift in billing, domainradar and langsync: it is pre-existing and left out of this PR on purpose.Goldens
Renamed
pulsecheck-*→monitor-*andcommands-pulsecheck.json→commands-monitor.json. Content differs only by the name;monitor-channels-list.txthas one column two characters narrower because a fixture URL got shorter.commands-billing.*lists the service keymonitorin--endpoint-url's description.Not verified against a live service
No credentials were used: everything is tested in-process against the fake backend (golden files in all four formats for every read command, command tests for every write and the key errors,
commands-monitor.json).Checks
go build,go vet,go test -race ./...,go mod tidy -diff,scripts/govulncheck.sh, golangci-lint v2.12.2 (0 issues).make docsgenerates 206 reference pages, 43 of themmonitor-*, none naming PulseCheck (not committed in the docs repo).