enhance CLI with apply, merge, set, and firmware upload - #47
Merged
Conversation
Add myc apply for YAML/JSON resource files (add, merge, delete, replace), myc set for nested properties with --file, myc set value field for live values, and myc upload firmware for binaries. Document the CLI in docs/cli.md.
Wire myc reboot node and myc action for reboot, reset, firmware-update, heartbeat, refresh-node-info, and gateway discover-nodes. Resolve node quick ids (gw.node), look up gateways before acting, and accept multiple space-separated ids.
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.
Summary
myc apply -fto add, merge, or delete gateways, nodes, sources, fields, firmware, and data repositories from YAML/JSON (includingitems,--dry-run, and--replace).mergedeep-merges maps (labels,others,provider) and keyed arrays;addfails if the resource exists unless--replace/replace: truerecreates it with the same id.myc set <kind> <id> <key-path>for stored properties (scripts via--file) andmyc set value fieldfor live field values.myc upload firmware <id> <file>for binaries and print stored file details after upload.docs/cli.md.Test plan
go test ./cmd/client/command/apply/ ./cmd/client/command/set/ ./cmd/client/command/upload/ ./cmd/client/api/ ./pkg/api/field/myc apply -f resources.yaml --dry-runthen apply without--replaceon existing resources (expectfailed: already exists)myc apply -f resources.yaml --replacerecreates with the same idsoperation: mergekeeps omittedlabels/providerkeys and overlays only file valuesmyc set field <id> formatter.onReceive --file script.jsandmyc set value field <quick-id> 23.5myc upload firmware <id> ./firmware.binprints name, size, checksum, modified