Exemplo n.º 1
0
Arquivo: ssl.go Projeto: kuenzaa/rack
func SSLUpdate(rw http.ResponseWriter, r *http.Request) *httperr.Error {
	a := mux.Vars(r)["app"]
	process := GetForm(r, "process")
	port := GetForm(r, "port")
	chain := GetForm(r, "chain")
	body := GetForm(r, "body")
	key := GetForm(r, "key")

	if process == "" {
		return httperr.Errorf(403, "must specify a process")
	}

	portn, err := strconv.Atoi(port)

	if err != nil {
		return httperr.Errorf(403, "port must be numeric")
	}

	ssl, err := models.UpdateSSL(a, process, portn, body, key, chain)

	if awsError(err) == "ValidationError" {
		return httperr.Errorf(404, "%s", err)
	}

	if err != nil {
		return httperr.Server(err)
	}

	return RenderJson(rw, ssl)
}
Exemplo n.º 2
0
Arquivo: ssl.go Projeto: gmelika/rack
func SSLUpdate(rw http.ResponseWriter, r *http.Request) *httperr.Error {
	vars := mux.Vars(r)
	a := vars["app"]
	process := vars["process"]
	port := vars["port"]
	id := GetForm(r, "id")

	if process == "" {
		return httperr.Errorf(403, "must specify a process")
	}

	portn, err := strconv.Atoi(port)

	if err != nil {
		return httperr.Errorf(403, "port must be numeric")
	}

	ssl, err := models.UpdateSSL(a, process, portn, id)

	if awsError(err) == "ValidationError" {
		return httperr.Errorf(404, "%s", err)
	}

	if err != nil {
		return httperr.Server(err)
	}

	return RenderJson(rw, ssl)
}