common

package
v0.0.0-...-ac62dae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2019 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrStackNotFound             = Error("Stack not found")
	ErrStackClusterNotFound      = Error("Stack cluster not found")
	ErrEndpointNotFound          = Error("Endpoint not found")
	ErrEndpointGroupNotFound     = Error("Endpoint group not found")
	ErrSeveralEndpointsAvailable = Error("Several endpoints available")
	ErrNoEndpointsAvailable      = Error("No endpoints available")
	ErrUserNotFound              = Error("User not found")
	ErrAccessControlNotFound     = Error("Access control not found")
)

Common errors

Variables

This section is empty.

Functions

func AccessCmdInitFunc

func AccessCmdInitFunc(parentCmd *cobra.Command, resourceControlType client.ResourceType)

AccessCmdInitFunc creates an access command for a given Docker resource type

func CheckError

func CheckError(err error)

CheckError checks if an error occurred (it's not nil)

func CheckSettingKeyExists

func CheckSettingKeyExists(key string) (keyExists bool)

CheckSettingKeyExists checks a given setting key exists in the default viper

func GetClient

func GetClient() (c client.PortainerClient, err error)

GetClient returns the cached Portainer API client. If none is present, creates and returns a new one).

func GetDefaultClient

func GetDefaultClient() (c client.PortainerClient, err error)

GetDefaultClient returns a new Portainer API client with the default configuration

func GetDefaultClientConfig

func GetDefaultClientConfig() (config client.Config, err error)

GetDefaultClientConfig returns the default configuration for a Portainer API client

func GetDefaultEndpoint

func GetDefaultEndpoint() (endpoint portainer.Endpoint, err error)

GetDefaultEndpoint returns the default endpoint (if only one endpoint exists)

func GetDefaultHTTPClient

func GetDefaultHTTPClient() *http.Client

GetDefaultHTTPClient returns the default HTTP client for a Portainer API client

func GetDockerResourcePortainerAccessControl

func GetDockerResourcePortainerAccessControl(endpointID portainer.EndpointID, resourceID string, resourceControlType client.ResourceType) (resourceControl portainer.ResourceControl, err error)

GetDockerResourcePortainerAccessControl retrieves a Docker resource's Portainer access control (if any)

func GetEndpointByName

func GetEndpointByName(name string) (endpoint portainer.Endpoint, err error)

GetEndpointByName returns an endpoint by its name from the list of all endpoints

func GetEndpointFromListByID

func GetEndpointFromListByID(endpoints []portainer.Endpoint, id portainer.EndpointID) (endpoint portainer.Endpoint, err error)

GetEndpointFromListByID returns an endpoint by its id from a list of endpoints

func GetEndpointFromListByName

func GetEndpointFromListByName(endpoints []portainer.Endpoint, name string) (endpoint portainer.Endpoint, err error)

GetEndpointFromListByName returns an endpoint by its name from a list of endpoints

func GetEndpointGroupByName

func GetEndpointGroupByName(name string) (endpointGroup portainer.EndpointGroup, err error)

GetEndpointGroupByName returns an endpoint group by its name from the list of all endpoint groups

func GetEndpointSwarmClusterID

func GetEndpointSwarmClusterID(endpointID portainer.EndpointID) (endpointSwarmClusterID string, err error)

GetEndpointSwarmClusterID returns an endpoint's swarm cluster id

func GetFormatHelp

func GetFormatHelp(v interface{}) (r string)

GetFormatHelp returns the help string for --format flags

func GetStackByName

func GetStackByName(name string, swarmID string, endpointID portainer.EndpointID) (stack portainer.Stack, err error)

GetStackByName returns a stack by its name from the (endpoint filtered) list of all stacks

func GetStackPortainerAccessControl

func GetStackPortainerAccessControl(endpointID portainer.EndpointID, stackName string) (resourceControl portainer.ResourceControl, err error)

GetStackPortainerAccessControl retrieves a stacks's Portainer access control (if any)

func GetUserByName

func GetUserByName(name string) (user portainer.User, err error)

GetUserByName returns an user by its name from the list of all users

func LoadSettings

func LoadSettings() (v *viper.Viper, err error)

LoadSettings loads the settings file currently used by viper into a new viper instance

func NewAccessCmd

func NewAccessCmd(resourceType client.ResourceType, argumentName string) *cobra.Command

NewAccessCmd creates a new Cobra command for Docker resource access control management

func NewTabWriter

func NewTabWriter(headers []string) (*tabwriter.Writer, error)

NewTabWriter returns a new tabwriter.Writer

Types

type Error

type Error string

Error represents an application error.

func (Error) Error

func (e Error) Error() string

Error returns the error message.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL