mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
Add functions to get endpoint from list by name and by id
This commit is contained in:
parent
a6f4f88fd2
commit
6c4ecb1c90
@ -92,6 +92,24 @@ func GetEndpointByName(name string) (endpoint portainer.Endpoint, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func GetEndpointFromListById(endpoints []portainer.Endpoint, id portainer.EndpointID) (endpoint portainer.Endpoint, err error) {
|
||||
for i := range endpoints {
|
||||
if endpoints[i].ID == id {
|
||||
return endpoints[i], err
|
||||
}
|
||||
}
|
||||
return endpoint, ErrEndpointNotFound
|
||||
}
|
||||
|
||||
func GetEndpointFromListByName(endpoints []portainer.Endpoint, name string) (endpoint portainer.Endpoint, err error) {
|
||||
for i := range endpoints {
|
||||
if endpoints[i].Name == name {
|
||||
return endpoints[i], err
|
||||
}
|
||||
}
|
||||
return endpoint, ErrEndpointNotFound
|
||||
}
|
||||
|
||||
func GetEndpointSwarmClusterId(endpointId portainer.EndpointID) (endpointSwarmClusterId string, err error) {
|
||||
// Get docker information for endpoint
|
||||
portainerClient, err := GetClient()
|
||||
|
Loading…
Reference in New Issue
Block a user