|
|
@ -17,7 +17,11 @@ limitations under the License.
|
|
|
|
package main
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"net/url"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/codegangsta/cli"
|
|
|
|
"github.com/codegangsta/cli"
|
|
|
|
"github.com/kubernetes/helm/pkg/client"
|
|
|
|
"github.com/kubernetes/helm/pkg/client"
|
|
|
@ -84,3 +88,25 @@ func NewClient(c *cli.Context) *client.Client {
|
|
|
|
timeout := c.GlobalInt("timeout")
|
|
|
|
timeout := c.GlobalInt("timeout")
|
|
|
|
return client.NewClient(host).SetDebug(debug).SetTimeout(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
|
|
|
|
|
|
|
|
}
|
|
|
|