diff options
Diffstat (limited to 'kube2consul/src/kube2consul/util/restclient/restclient.go')
-rw-r--r-- | kube2consul/src/kube2consul/util/restclient/restclient.go | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/kube2consul/src/kube2consul/util/restclient/restclient.go b/kube2consul/src/kube2consul/util/restclient/restclient.go deleted file mode 100644 index e01ae0f..0000000 --- a/kube2consul/src/kube2consul/util/restclient/restclient.go +++ /dev/null @@ -1,42 +0,0 @@ -package restclient - -import ( - "fmt" - "io/ioutil" - "net/http" -) - -type RESTClient struct { - base string - resource string - param string -} - -func NewRESTClient(baseURL string, versionedAPIPath string, urlParameter string) *RESTClient { - return &RESTClient{ - base: baseURL, - resource: versionedAPIPath, - param: urlParameter, - } -} - -func (c *RESTClient) Get() (b []byte, err error) { - url := c.base + "/" + c.resource + "/" + c.param - res, err := http.Get(url) - if err != nil { - return nil, err - } - - if res.StatusCode != 200 { - return nil, fmt.Errorf(res.Status) - } - - buf, err := ioutil.ReadAll(res.Body) - res.Body.Close() - - if err != nil { - return nil, err - } - - return buf, nil -} |