daemon: Refactor endpoint API handling
daemon: Refactor endpoint API handling

Refactor these functions to put a little distance between the API
responders and the implementations, which will allow an upcoming commit
to unit-test some of this functionality.

Signed-off-by: Joe Stringer <16a9a54ddf4259952e3c118c763138e83693d7fd@covalent.io>

cilium/cilium,michi-covalent/cilium,scanf/cilium,eloycoto/cilium,cilium/cilium,tgraf/cilium,eloycoto/cilium,tgraf/cilium,cilium-team/cilium,michi-covalent/cilium,eloycoto/cilium,scanf/cilium,eloycoto/cilium,cilium/cilium,tgraf/cilium,scanf/cilium,tgraf/cilium,tklauser/cilium,michi-covalent/cilium,eloycoto/cilium,eloycoto/cilium,eloycoto/cilium,tklauser/cilium,michi-covalent/cilium,cilium/cilium,scanf/cilium,scanf/cilium,tklauser/cilium,tgraf/cilium,tklauser/cilium,cilium/cilium,michi-covalent/cilium,cilium-team/cilium,tklauser/cilium,scanf/cilium,scanf/cilium,tgraf/cilium