diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index c7a02585d..b355b0c86 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -17,7 +17,11 @@ limitations under the License. package main import ( + "io/ioutil" + "net/http" + "net/url" "os" + "strings" "github.com/codegangsta/cli" "github.com/kubernetes/helm/pkg/client" @@ -84,3 +88,25 @@ func NewClient(c *cli.Context) *client.Client { timeout := c.GlobalInt("timeout") return client.NewClient(host).SetDebug(debug).SetTimeout(timeout) } + +func callService(path, method, description string) ([]byte, error) { + dmURL := "http://localhost:8080" + //dmURL := "http://localhost:8001/api/v1/proxy/namespaces/dm/services/manager-service:manager" + var URL *url.URL + URL, err := url.Parse(dmURL) + if err != nil { + return nil, err + } + URL.Path = strings.TrimRight(URL.String(), "/") + "/" + strings.TrimLeft(path, "/") + resp, err := http.Get(URL.Path) //TODO: change later + if err != nil { + return nil, err + } + + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + return body, nil +} diff --git a/cmd/helm/repository.go b/cmd/helm/repository.go index 8cd52273d..7863cd05f 100644 --- a/cmd/helm/repository.go +++ b/cmd/helm/repository.go @@ -91,6 +91,12 @@ func addRepo(c *cli.Context) error { } func listRepos(c *cli.Context) error { + path := "chart_repositories" + body, err := callService(path, "GET", "list chart repos") + if err != nil { + return err + } + format.Msg(string(body)) return nil }