Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit da4501f

Browse files
ndiazgehazlett
authored andcommitted
Proxy api commands for networking (#848)
* Proxies api commands for networking * Fixed spacing
1 parent 914c079 commit da4501f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

controller/api/api.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ func (a *Api) Run() error {
148148
globalMux.Handle("/", http.FileServer(http.Dir("static")))
149149

150150
auditExcludes := []string{
151+
"^/networks",
151152
"^/containers/json",
152153
"^/images/json",
153154
"^/api/events",
@@ -202,6 +203,8 @@ func (a *Api) Run() error {
202203
"/images/{name:.*}/get": swarmRedirect,
203204
"/images/{name:.*}/history": swarmRedirect,
204205
"/images/{name:.*}/json": swarmRedirect,
206+
"/networks": swarmRedirect,
207+
"/networks/{name:.*}": swarmRedirect,
205208
"/containers/ps": swarmRedirect,
206209
"/containers/json": swarmRedirect,
207210
"/containers/{name:.*}/export": swarmRedirect,
@@ -221,6 +224,9 @@ func (a *Api) Run() error {
221224
"/images/load": swarmRedirect,
222225
"/images/{name:.*}/push": swarmRedirect,
223226
"/images/{name:.*}/tag": swarmRedirect,
227+
"/networks/create": swarmRedirect,
228+
"/networks/{name:.*}/connect": swarmRedirect,
229+
"/networks/{name:.*}/disconnect": swarmRedirect,
224230
"/containers/create": swarmRedirect,
225231
"/containers/{name:.*}/kill": swarmRedirect,
226232
"/containers/{name:.*}/pause": swarmRedirect,
@@ -238,6 +244,7 @@ func (a *Api) Run() error {
238244
"/exec/{execid:.*}/resize": swarmRedirect,
239245
},
240246
"DELETE": {
247+
"/networks/{name:.*}": swarmRedirect,
241248
"/containers/{name:.*}": swarmRedirect,
242249
"/images/{name:.*}": swarmRedirect,
243250
},
@@ -271,6 +278,8 @@ func (a *Api) Run() error {
271278
swarmAuthRouter.Use(negroni.HandlerFunc(swarmAccessRequired.HandlerFuncWithNext))
272279
swarmAuthRouter.Use(negroni.HandlerFunc(apiAuditor.HandlerFuncWithNext))
273280
swarmAuthRouter.UseHandler(swarmRouter)
281+
globalMux.Handle("/networks", swarmAuthRouter)
282+
globalMux.Handle("/networks/", swarmAuthRouter)
274283
globalMux.Handle("/containers/", swarmAuthRouter)
275284
globalMux.Handle("/_ping", swarmAuthRouter)
276285
globalMux.Handle("/commit", swarmAuthRouter)

0 commit comments

Comments
 (0)