Skip to content

Commit 51352aa

Browse files
committed
Add EndpointOperInfo
Signed-off-by: Dave Tucker <[email protected]>
1 parent 8e20a40 commit 51352aa

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

api.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const (
2222
createNetworkPath = "/NetworkDriver.CreateNetwork"
2323
deleteNetworkPath = "/NetworkDriver.DeleteNetwork"
2424
createEndpointPath = "/NetworkDriver.CreateEndpoint"
25-
//infoEndpointPath = "/NetworkDriver.EndpointOperInfo"
25+
endpointInfoPath = "/NetworkDriver.EndpointOperInfo"
2626
deleteEndpointPath = "/NetworkDriver.DeleteEndpoint"
2727
joinPath = "/NetworkDriver.Join"
2828
leavePath = "/NetworkDriver.Leave"
@@ -36,6 +36,7 @@ type Driver interface {
3636
DeleteNetwork(*DeleteNetworkRequest) error
3737
CreateEndpoint(*CreateEndpointRequest) error
3838
DeleteEndpoint(*DeleteEndpointRequest) error
39+
EndpointInfo(*InfoRequest) (*InfoResponse, error)
3940
Join(*JoinRequest) (*JoinResponse, error)
4041
Leave(*LeaveRequest) error
4142
}
@@ -81,16 +82,14 @@ type InterfaceName struct {
8182
DstPrefix string
8283
}
8384

84-
/* Not supported in this library right now
85-
type EndpointOperInfoRequest struct {
85+
type InfoRequest struct {
8686
NetworkID string
8787
EnpointID string
8888
}
8989

90-
type EndpointOperInfoResponse struct {
90+
type InfoResponse struct {
9191
Value map[string]string
9292
}
93-
*/
9493

9594
type JoinRequest struct {
9695
NetworkID string
@@ -196,6 +195,20 @@ func (h *Handler) initMux() {
196195
}
197196
successResponse(w)
198197
})
198+
h.mux.HandleFunc(endpointInfoPath, func(w http.ResponseWriter, r *http.Request) {
199+
req := &InfoRequest{}
200+
err := decodeRequest(r, req)
201+
if err != nil {
202+
badRequestResponse(w)
203+
return
204+
}
205+
res, err := h.driver.EndpointInfo(req)
206+
if err != nil {
207+
errorResponse(w, err)
208+
return
209+
}
210+
objectResponse(w, res)
211+
})
199212
h.mux.HandleFunc(joinPath, func(w http.ResponseWriter, r *http.Request) {
200213
req := &JoinRequest{}
201214
err := decodeRequest(r, req)

0 commit comments

Comments
 (0)