Add GetEndpointGroups() function to client

This commit is contained in:
Juan Carlos Mejías Rodríguez 2019-08-09 13:17:40 -04:00
parent 219adc5c76
commit 2261b4f6ac

View File

@ -31,6 +31,9 @@ type PortainerClient interface {
// Get endpoints // Get endpoints
GetEndpoints() ([]EndpointSubset, error) GetEndpoints() ([]EndpointSubset, error)
// Get endpoint groups
GetEndpointGroups() ([]EndpointGroup, error)
// Get stacks, optionally filtered by swarmId and endpointId // Get stacks, optionally filtered by swarmId and endpointId
GetStacks(swarmId string, endpointId uint32) ([]Stack, error) GetStacks(swarmId string, endpointId uint32) ([]Stack, error)
@ -217,6 +220,11 @@ func (n *portainerClientImp) GetEndpoints() (endpoints []EndpointSubset, err err
return return
} }
func (n *portainerClientImp) GetEndpointGroups() (endpointGroups []EndpointGroup, err error) {
err = n.doJSON("endpoint_groups", http.MethodGet, nil, &endpointGroups)
return
}
func (n *portainerClientImp) GetStacks(swarmId string, endpointId uint32) (stacks []Stack, err error) { func (n *portainerClientImp) GetStacks(swarmId string, endpointId uint32) (stacks []Stack, err error) {
filter := StackListFilter{ filter := StackListFilter{
SwarmId: swarmId, SwarmId: swarmId,