Implement device claim, list, rename, and release - #14
Merged
Merged
Conversation
Claim validates the IMEI and fleet locally, then binds the device over
POST /fleets/{id}/devices. List shows IMEI, name, fleet, and a coarse
last-seen age, with an optional fleet filter and --json for machine
output. Rename sends the trimmed name. Release confirms on stdin before
unbinding. A shared devices.go holds the device fetch and IMEI check.
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.
Implements the four planned device commands against the new server routes
(superstack-server dev-devices branch, opened as its own PR):
device claim <imei> <fleet_id> [name]validates the IMEI and fleet idlocally, resolves the fleet name, and POSTs to
/fleets/{id}/devices.device list [fleet_id]renders IMEI, name, fleet, and a coarselast-seen age (
never,just now,N min ago,N h ago,N d ago),with
--jsonaccepted anywhere for machine output.device rename <imei> <new_name>PATCHes the trimmed name.device release <imei>confirms on stdin before DELETE; decliningprints
Nothing released.The four names leave the planned map in
main_test.go; help output isunchanged. No new dependencies,
const versionuntouched.Evidence: full suite green (
CGO_ENABLED=0 go build/vet/test,gofmtclean), and the whole surface exercised end to end against the local
server with the physical dev device: claim of a bogus IMEI refused with
the server's wording, real claim, rename, decline-then-confirm release,
re-claim, and
LAST SEENmoving fromnevertojust nowafter thedevice's DTLS-PSK handshake stamped it.
Two command summaries in the table promise more than the tree delivers
yet: claim's "press its button" and release's "factory reset it" both
need the device frame layer, so today claim binds without the button
gate and release only unbinds. Flagged in the server PR as well.