-
Notifications
You must be signed in to change notification settings - Fork 26
feat: add support for core-data endpoints #416
Conversation
a7cbc8b
to
dc49a0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good, and the new commands seem to work as advertised. That said, I'd added a number of comments inline which need discussion.
The only global comment I have is that the date/time format used (RFC1123) results in really long strings. I would suggest using RFC822 instead...
e74b1b3
to
d64473e
Compare
@tonyespy - thanks for the review. I've updated the implementation as suggested and responded to the comments, including changing the format to RFC822 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes:
- switch to using
-d
as the short arg for device or core data; use-v
for verbose - use RFC822 for date/time display
- added a
-t
arg for theevent add
command
A couple of comments/notes that we should discuss on Fri.
- Maybe it's worth updating the ADR to note the switch from
-d
to-v
? - The ADR says that
-v
will no longer trigger the output of response JSON, however when I specify-v
forevent list
, I see "Request" which is JSON, and then the URL (i.e. the request URL). I guess I assumed that-v
would just trigger more fields to be pretty printed? I'm not saying this is wrong, so just wanted to check with you... - Should the default
event list
output at least show how many readings the event contains? - It looks like Core Data doesn't do any validation of devices, profiles, or source names when a new event is added (@lenny-intel is there a setting to cause Core Data to validate these names)?
- I didn't expect event add to create a reading if
-r
wasn't specified. Was that by design? - If I add an event with the following command, the actual source name is being truncated either by the client or Core Data itself to just "ource":
$ ./bin/edgex-cli event add -d my-device -p my-profile -source my-source
$ ./bin/edgex-cli event list
Origin Device Profile Source
14 Oct 21 19:46 EDT my-device my-profile ource
Thanks for the review, @tonyespy
Yes - although it's now been approved and merged... Let's discuss.
Yes, this was wrong. I've now updated it. There are really three possible combinations
Test by trying:
Yes, I've added that now. The default shows number of readings, the verbose shows the actual readings array as well.
Yes. The V1 edgex-cli had 0 as the default value for -r. However, when I do that, I get an error from the SDK
and the syslog shows
So I can only assume that adding an event with no readings is not supported in the SDK, @lenny-intel ?
|
95cb0c2
to
383f8c2
Compare
6ede813
to
07018e7
Compare
@tonyespy , I don't think that exists any more. Used to be an option in V1. |
@siggiskulason , @tonyespy , correct V2 Core Metadata validate expects at least one reading when adding an Event. No longer supports Reading'less Events. |
07018e7
to
9586ec2
Compare
9586ec2
to
d16111b
Compare
d16111b
to
fffe382
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
recheck |
This commit adds support for the `event` and `reading` endpoints. ``` edgex-cli event add edgex-cli event count edgex-cli event list edgex-cli event rm edgex-cli reading count edgex-cli reading list ``` the `count` and `list` commands support the `-j` argument to return the raw json result. Signed-off-by: Siggi Skulason <siggi.skulason@canonical.com>
fffe382
to
082273a
Compare
Rebased... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your changes, looks good to me!
Two things we can follow-up on later:
- I still don't find the output of
-v
very useful - I would like to find out what happened to the event validation logic. @lenny-intel suggested that the validation logic in v1 wasn't forward ported to the v2, but I didn't seen an answer from @cloudxxx8 about this. I guess in the grand scheme of the things its not the end-of-the world if events can be pushed into Core Data with non-existent devices, profiles, or source names, but I would like to understand why we decided not to implement this (if the logic actually existing in V1).
This commit adds support for the
event
andreading
endpoints.the
count
andlist
commands support the-j
argument to return the raw json result, so that it's possible to doThis commit also updates all output methods to use
fmt.Print
rather thancmd.Print
, as thecmd.Print
method uses stderr by default instead of stdout - and it's really meant just for usage and error messages.Signed-off-by: Siggi Skulason siggi.skulason@canonical.com
PR Checklist
Please check if your PR fulfills the following requirements:
If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-cli/blob/master/.github/Contributing.md.
What is the current behavior?
V2 core-data endpoints are not supported
Issue Number:
fix #391
fix #386
What is the new behavior?
event
andreading
commands are now supportedDoes this PR introduce a breaking change?
New Imports
Specific Instructions
Are there any specific instructions or things that should be known prior to reviewing?
build and run with
Other information