2019-02-13 14:05:59 +01:00
|
|
|
package koofrclient
|
|
|
|
|
|
|
|
import (
|
2019-08-14 15:56:32 +02:00
|
|
|
"github.com/koofr/go-httpclient"
|
2019-02-13 14:05:59 +01:00
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (c *KoofrClient) Mounts() (mounts []Mount, err error) {
|
|
|
|
d := &struct {
|
|
|
|
Mounts *[]Mount
|
|
|
|
}{&mounts}
|
|
|
|
|
|
|
|
request := httpclient.RequestData{
|
|
|
|
Method: "GET",
|
|
|
|
Path: "/api/v2/mounts",
|
|
|
|
ExpectedStatus: []int{http.StatusOK},
|
|
|
|
RespEncoding: httpclient.EncodingJSON,
|
|
|
|
RespValue: &d,
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err = c.Request(&request)
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *KoofrClient) MountsDetails(mountId string) (mount Mount, err error) {
|
|
|
|
request := httpclient.RequestData{
|
|
|
|
Method: "GET",
|
|
|
|
Path: "/api/v2/mounts/" + mountId,
|
|
|
|
ExpectedStatus: []int{http.StatusOK},
|
|
|
|
RespEncoding: httpclient.EncodingJSON,
|
|
|
|
RespValue: &mount,
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err = c.Request(&request)
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|