[METHOD] /v1/sort
(w http.ResponseWriter, r *http.Request)
| 2735 | |
| 2736 | // [METHOD] /v1/sort |
| 2737 | func (p *proxy) dsortHandler(w http.ResponseWriter, r *http.Request) { |
| 2738 | if !p.ClusterStartedWithRetry() { |
| 2739 | w.WriteHeader(http.StatusServiceUnavailable) |
| 2740 | return |
| 2741 | } |
| 2742 | if err := p.checkAccess(w, r, nil, apc.AceAdmin); err != nil { |
| 2743 | return |
| 2744 | } |
| 2745 | |
| 2746 | apiItems, err := cmn.MatchRESTItems(r.URL.Path, 0, true, apc.URLPathdSort.L) |
| 2747 | if err != nil { |
| 2748 | p.writeErrURL(w, r) |
| 2749 | return |
| 2750 | } |
| 2751 | |
| 2752 | switch r.Method { |
| 2753 | case http.MethodPost: |
| 2754 | p.proxyStartSortHandler(w, r) |
| 2755 | case http.MethodGet: |
| 2756 | dsort.ProxyGetHandler(w, r) |
| 2757 | case http.MethodDelete: |
| 2758 | if len(apiItems) == 1 && apiItems[0] == apc.Abort { |
| 2759 | dsort.ProxyAbortSortHandler(w, r) |
| 2760 | } else if len(apiItems) == 0 { |
| 2761 | dsort.ProxyRemoveSortHandler(w, r) |
| 2762 | } else { |
| 2763 | p.writeErrURL(w, r) |
| 2764 | } |
| 2765 | default: |
| 2766 | cmn.WriteErr405(w, r, http.MethodDelete, http.MethodGet, http.MethodPost) |
| 2767 | } |
| 2768 | } |
| 2769 | |
| 2770 | // http reverse-proxy handler, to handle unmodified requests |
| 2771 | // (not to confuse with p.rproxy) |
nothing calls this directly
no test coverage detected