File: client_mount.go

package info (click to toggle)
golang-github-koofr-go-koofrclient 0.0~git20190724.8e5366d-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 136 kB
  • sloc: makefile: 5
file content (38 lines) | stat: -rw-r--r-- 776 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package koofrclient

import (
	"github.com/koofr/go-httpclient"
	"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
}