mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
Add function to portainer client to get users list
This commit is contained in:
parent
1674d1879c
commit
ca14cf6f5e
@ -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
12
client/user_list.go
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user