diff --git a/client/client.go b/client/client.go index 8993263..16b8ac7 100644 --- a/client/client.go +++ b/client/client.go @@ -64,6 +64,9 @@ type PortainerClient interface { // Proxy proxies a request to /endpoint/{id}/docker and returns its result Proxy(endpointID portainer.EndpointID, req *http.Request) (resp *http.Response, err error) + // UserList retrieves a list of users + UserList() (users []portainer.User, err error) + // GetUsername returns the user name used by the client GetUsername() string } diff --git a/client/user_list.go b/client/user_list.go new file mode 100644 index 0000000..b4e8342 --- /dev/null +++ b/client/user_list.go @@ -0,0 +1,12 @@ +package client + +import ( + "net/http" + + portainer "github.com/portainer/portainer/api" +) + +func (n *portainerClientImp) UserList() (users []portainer.User, err error) { + err = n.doJSONWithToken("users", http.MethodGet, http.Header{}, nil, &users) + return +}