mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
Add function to portainer client to get current user name
This commit is contained in:
parent
97f04cff31
commit
1674d1879c
@ -63,6 +63,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)
|
||||
|
||||
// GetUsername returns the user name used by the client
|
||||
GetUsername() string
|
||||
}
|
||||
|
||||
type portainerClientImp struct {
|
||||
@ -197,6 +200,10 @@ func (n *portainerClientImp) AfterResponse(hook func(resp *http.Response) (err e
|
||||
n.afterResponseHooks = append(n.afterResponseHooks, hook)
|
||||
}
|
||||
|
||||
func (n *portainerClientImp) GetUsername() string {
|
||||
return n.user
|
||||
}
|
||||
|
||||
// NewClient creates a new Portainer API client
|
||||
func NewClient(httpClient *http.Client, config Config) PortainerClient {
|
||||
return &portainerClientImp{
|
||||
|
Loading…
Reference in New Issue
Block a user