At first, all the event parameters were specified on the CLI args.
Then I moved them into config.yaml.
Then to prepare for the HTTP API, I moved it into a separate file called eventsample1.yml, with its definition in pkg/model/eventrequest.go. However, it isn't very useful for the API, because the client shouldn't have to specify
daemon_path: /tmp/workspace/bin/launchpayloadd and the same for cli_path and binary_path.
At the same time, these things are needed in the code.
Also, it seems "—provider" needs to go somewhere in EventRequest. It was previously specified only by a CLI argument.
in fact, given the similarity between EventRequest and pkg/model/model.go:Event, maybe one can throw away EventRequest altogether. I am not sure.
To test the HTTP API, convert the eventsample1.yml to eventsample1.json and run curl -H "Content-Type: application/json" -X POST --data @eventsample1.json localhost:8080/event (the @ is important otherwise curl won't read the file)
At first, all the event parameters were specified on the CLI args.
Then I moved them into config.yaml.
Then to prepare for the HTTP API, I moved it into a separate file called
eventsample1.yml, with its definition inpkg/model/eventrequest.go. However, it isn't very useful for the API, because the client shouldn't have to specifydaemon_path: /tmp/workspace/bin/launchpayloaddand the same forcli_pathandbinary_path.At the same time, these things are needed in the code.
Also, it seems "—provider" needs to go somewhere in
EventRequest. It was previously specified only by a CLI argument.in fact, given the similarity between EventRequest and
pkg/model/model.go:Event, maybe one can throw away EventRequest altogether. I am not sure.To test the HTTP API, convert the
eventsample1.ymltoeventsample1.jsonand runcurl -H "Content-Type: application/json" -X POST --data @eventsample1.json localhost:8080/event(the @ is important otherwise curl won't read the file)