-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Restful service #29
Conversation
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.
Here is a first round of comments, I need to take a closer look at the REST API.
yeah vfkit version is good to have (possibly with git hash if that's easy to get). |
should be updated now |
8a21b0f
to
bdbc7d3
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 looks good! A few comments up for discussion
cmd.Flags().StringArrayVarP(&opts.Devices, "device", "d", []string{}, "devices") | ||
|
||
cmd.Flags().StringVar(&opts.LogLevel, "log-level", "", "set log level") | ||
cmd.Flags().StringVar(&opts.RestfulURI, "restful-uri", DefaultRestfulURI, "URI address for RestFul services") |
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.
Any reason for using none://
instead of ""
as the default?
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.
i prefer this approach because the default IS none and this saves us a conditional check later ...
/lgtm |
add restful service to VFKit which defaults to `tcp://localhost:8081`. The URL can be changed using the newly introduced --restful-uri option. The schemes may be `tcp` or `unix` (unix domain socket). The service for the unix domain implementation is incomplete and should be considered a TODO still. users can also opt out of the service with a `--restful-uri none`. the restful service now replies to three endpoints: /vm/state GET which returns the state of the vm /vm/state POST which allows for a state change /vm/inspect GET which returns basic information about the virtual machine error handling for the endpoints needs to be completed still. these endpoints should return http response codes (like 200) based on the error handling. this can be completed in a subsequent PR. /version GET should also probably be added. I was unsure if we should return the version of vfkit (my first inclination) or some sort of API version. maybe we should return both? added tests for new content where applicable Signed-off-by: Brent Baude <[email protected]>
I have updated the PR per your wishes |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: baude, cfergeau The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
add restful service to VFKit which defaults to
tcp://localhost:8081
. The URL can be changed using the newly introduced --restful-uri option. The schemes may betcp
orunix
(unix domain socket). The service for the unix domain implementation is incomplete and should be considered a TODO still. users can also opt out of the service with a--restful-uri none
.the restful service now replies to three endpoints:
/vm/state GET which returns the state of the vm
/vm/state POST which allows for a state change
/vm/inspect GET which returns basic information about the virtual machine
error handling for the endpoints needs to be completed still. these endpoints should return http response codes (like 200) based on the error handling. this can be completed in a subsequent PR.
/version GET should also probably be added. I was unsure if we should return the version of vfkit (my first inclination) or some sort of API version. maybe we should return both?
added tests for new content where applicable