Add function to portainer client to get users list

This commit is contained in:
Juan Carlos Mejías Rodríguez 2019-09-09 00:15:46 -04:00
parent 1674d1879c
commit ca14cf6f5e
2 changed files with 15 additions and 0 deletions

View File

@ -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
}

12
client/user_list.go Normal file
View File

@ -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
}