Documentation
¶
Index ¶
- func CheckPortainerError(err error) (int, error)
- func EndpointLookup(cli *portainerapi.Portainer, name string) (*portainertype.Endpoint, error)
- func GetDockerEndpoint(path string, id int64) string
- func StackLookup(cli *portainerapi.Portainer, swarmID, name string) (*portainertype.Stack, error)
- func SwarmLookup(cli *dockerapi.DockerEngine) (*models.Swarm, error)
- type AuthContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPortainerError ¶
CheckPortainerError check for common error like server error or authentication failed. It returns 0 when the error is handled or the http error code otherwise
func EndpointLookup ¶
func EndpointLookup(cli *portainerapi.Portainer, name string) (*portainertype.Endpoint, error)
EndpointLookup look up for the endpoint based on the name and returns the Id
func GetDockerEndpoint ¶
GetDockerEndpoint returns the docker endpoint for a given portainer endpoint id
func StackLookup ¶
func StackLookup(cli *portainerapi.Portainer, swarmID, name string) (*portainertype.Stack, error)
StackLookup returns the stack with the name provided for the specified endpoint
func SwarmLookup ¶
func SwarmLookup(cli *dockerapi.DockerEngine) (*models.Swarm, error)
SwarmLookup look up for the swarm information of the given engine
Types ¶
type AuthContext ¶
type AuthContext struct {
// contains filtered or unexported fields
}
AuthContext is the configuration and authentication cache
func NewAuthContext ¶
func NewAuthContext() *AuthContext
NewAuthContext returns the portainer context loading authentication tokens from a file
func (*AuthContext) GetToken ¶
func (c *AuthContext) GetToken(host string) (runtime.ClientAuthInfoWriter, error)
GetToken return the current token associated with an host
func (*AuthContext) SaveContext ¶
func (c *AuthContext) SaveContext() error
SaveContext writes all the current tokens in a file
func (*AuthContext) SetToken ¶
func (c *AuthContext) SetToken(host, mode, token string)
SetToken sets the current token associated with an host