Files
kapow/internal/client/route_add.go
Roberto Abdelkader Martínez Pérez 4357b1ad20 Implementation of route add
2019-10-03 20:56:40 +02:00

19 lines
450 B
Go

package client
import (
"bytes"
"encoding/json"
"github.com/BBVA/kapow/internal/http"
)
// AddRoute will add a new route in kapow
func AddRoute(host, path, method, entrypoint, command string) error {
url := host + "/routes"
body, _ := json.Marshal(map[string]string{
"method": method,
"url_pattern": path,
"entrypoint": entrypoint,
"command": command})
return http.Put(url, "application/json", bytes.NewReader(body), nil)
}