( w http.ResponseWriter, req *http.Request)
| 374 | } |
| 375 | |
| 376 | func (h *BackupIndexHandler) ServeHTTP( |
| 377 | w http.ResponseWriter, req *http.Request) { |
| 378 | queryParams := req.URL.Query() |
| 379 | var include bool |
| 380 | params := queryParams.Get("exclude") |
| 381 | if params == "" { |
| 382 | params = queryParams.Get("include") |
| 383 | include = true |
| 384 | } |
| 385 | |
| 386 | bucketFilters, scopeFilters, colFilters := parseBackupFilters(params, "") |
| 387 | |
| 388 | indexDefs, _, err := cbgt.CfgGetIndexDefs(h.mgr.Cfg()) |
| 389 | if err != nil { |
| 390 | rest.ShowError(w, req, "rest_backup_restore: "+ |
| 391 | "could not retrieve index defs", http.StatusInternalServerError) |
| 392 | return |
| 393 | } |
| 394 | |
| 395 | // filter index definitions for the given buckets/scopes/collections. |
| 396 | indexDefs = filterIndexDefinitions(indexDefs, bucketFilters, |
| 397 | scopeFilters, colFilters, include, false) |
| 398 | |
| 399 | rv := struct { |
| 400 | Status string `json:"status"` |
| 401 | IndexDefs *cbgt.IndexDefs `json:"indexDefs"` |
| 402 | }{ |
| 403 | Status: "ok", |
| 404 | IndexDefs: indexDefs, |
| 405 | } |
| 406 | rest.MustEncode(w, rv) |
| 407 | } |
| 408 | |
| 409 | // BucketBackupIndexHandler is a REST handler that processes |
| 410 | // a backup request at a bucket level. |
nothing calls this directly
no test coverage detected