func (h *componentHandler) UnRegister(w http.ResponseWriter, r *http.Request) {
	rc := getCluster(r)
	vars := mux.Vars(r)
	component := vars["component"]
	addr := vars["addr"]
	if err := rc.GetComponentManager().UnRegister(component, addr); err != nil {
		h.rd.JSON(w, http.StatusBadRequest, err.Error())
		return
	}
	h.rd.JSON(w, http.StatusOK, "The component address is unregistered successfully.")
}
@Tags component
@Summary Unregister component address.
@Produce json
@Success 200 {string} string "The component address is unregistered successfully."
@Failure 400 {string} string "The input is invalid."
@Router /component [delete]
package api
import (
	"errors"
	"net/http"
	"github.com/gorilla/mux"
	"github.com/pingcap/errcode"
	"github.com/tikv/pd/pkg/apiutil"
	"github.com/tikv/pd/server"
	"github.com/unrolled/render"
)
type Addresses map[string][]string
type componentHandler struct {
	svr *server.Server
	rd  *render.Render
}
func newComponentHandler(svr *server.Server, rd *render.Render) *componentHandler {
	return &componentHandler{
		svr: svr,
		rd:  rd,
	}
}
func (h *componentHandler) Register(w http.ResponseWriter, r *http.Request) {
	rc := getCluster(r)
	input := make(map[string]string)
	if err := apiutil.ReadJSONRespondError(h.rd, w, r.Body, &input); err != nil {
		return
	}
	component, ok := input["component"]
	if !ok {
		apiutil.ErrorResp(h.rd, w, errcode.NewInvalidInputErr(errors.New("not set component")))
		return
	}
	addr, ok := input["addr"]
	if !ok {
		apiutil.ErrorResp(h.rd, w, errcode.NewInvalidInputErr(errors.New("not set addr")))
		return
	}
	if err := rc.GetComponentManager().Register(component, addr); err != nil {
		h.rd.JSON(w, http.StatusBadRequest, err.Error())
		return
	}
	h.rd.JSON(w, http.StatusOK, "The component address is registered successfully.")
}