summaryrefslogtreecommitdiff
path: root/pkg/bindings/mount.go
blob: 2e3d6d7f6213a5f5b77712c50a29c293d158b60e (plain)
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
package bindings

import (
	"fmt"
	"net/http"
)

func (c Connection) MountContainer(nameOrID string) (string, error) {
	var (
		path string
	)
	response, err := c.newRequest(http.MethodPost, fmt.Sprintf("/containers/%s/mount", nameOrID), nil, nil)
	if err != nil {
		return path, err
	}
	return path, response.Process(&path)
}

func (c Connection) GetMountedContainerPaths() (map[string]string, error) {
	mounts := make(map[string]string)
	response, err := c.newRequest(http.MethodGet, "/containers/showmounted", nil, nil)
	if err != nil {
		return mounts, err
	}
	return mounts, response.Process(&mounts)
}