2016-12-18 05:21:29 +00:00
|
|
|
package portainer
|
|
|
|
|
2017-04-09 18:38:41 +00:00
|
|
|
import "io"
|
2016-12-25 20:34:02 +00:00
|
|
|
|
2016-12-18 05:21:29 +00:00
|
|
|
type (
|
|
|
|
// Pair defines a key/value string pair
|
|
|
|
Pair struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Value string `json:"value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// CLIFlags represents the available flags on the CLI.
|
|
|
|
CLIFlags struct {
|
2017-02-06 05:29:34 +00:00
|
|
|
Addr *string
|
2018-01-24 20:58:58 +00:00
|
|
|
AdminPassword *string
|
|
|
|
AdminPasswordFile *string
|
2017-02-06 05:29:34 +00:00
|
|
|
Assets *string
|
|
|
|
Data *string
|
|
|
|
Endpoint *string
|
2018-01-15 18:34:07 +00:00
|
|
|
ExternalEndpoints *string
|
2018-01-24 20:58:58 +00:00
|
|
|
Labels *[]Pair
|
|
|
|
Logo *string
|
2017-02-06 05:29:34 +00:00
|
|
|
NoAuth *bool
|
2017-03-03 11:54:22 +00:00
|
|
|
NoAnalytics *bool
|
2018-01-24 20:58:58 +00:00
|
|
|
Templates *string
|
2017-02-06 05:29:34 +00:00
|
|
|
TLSVerify *bool
|
|
|
|
TLSCacert *string
|
|
|
|
TLSCert *string
|
|
|
|
TLSKey *string
|
2017-04-25 09:51:22 +00:00
|
|
|
SSL *bool
|
|
|
|
SSLCert *string
|
|
|
|
SSLKey *string
|
2018-01-15 18:34:07 +00:00
|
|
|
SyncInterval *string
|
2017-06-01 08:14:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Status represents the application status.
|
|
|
|
Status struct {
|
|
|
|
Authentication bool `json:"Authentication"`
|
|
|
|
EndpointManagement bool `json:"EndpointManagement"`
|
|
|
|
Analytics bool `json:"Analytics"`
|
|
|
|
Version string `json:"Version"`
|
2016-12-18 05:21:29 +00:00
|
|
|
}
|
|
|
|
|
2017-08-10 08:35:23 +00:00
|
|
|
// LDAPSettings represents the settings used to connect to a LDAP server.
|
|
|
|
LDAPSettings struct {
|
|
|
|
ReaderDN string `json:"ReaderDN"`
|
|
|
|
Password string `json:"Password"`
|
|
|
|
URL string `json:"URL"`
|
|
|
|
TLSConfig TLSConfiguration `json:"TLSConfig"`
|
|
|
|
StartTLS bool `json:"StartTLS"`
|
|
|
|
SearchSettings []LDAPSearchSettings `json:"SearchSettings"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// TLSConfiguration represents a TLS configuration.
|
|
|
|
TLSConfiguration struct {
|
|
|
|
TLS bool `json:"TLS"`
|
|
|
|
TLSSkipVerify bool `json:"TLSSkipVerify"`
|
|
|
|
TLSCACertPath string `json:"TLSCACert,omitempty"`
|
|
|
|
TLSCertPath string `json:"TLSCert,omitempty"`
|
|
|
|
TLSKeyPath string `json:"TLSKey,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// LDAPSearchSettings represents settings used to search for users in a LDAP server.
|
|
|
|
LDAPSearchSettings struct {
|
|
|
|
BaseDN string `json:"BaseDN"`
|
|
|
|
Filter string `json:"Filter"`
|
|
|
|
UserNameAttribute string `json:"UserNameAttribute"`
|
|
|
|
}
|
|
|
|
|
2017-06-01 08:14:55 +00:00
|
|
|
// Settings represents the application settings.
|
2016-12-18 05:21:29 +00:00
|
|
|
Settings struct {
|
2017-09-27 07:26:04 +00:00
|
|
|
TemplatesURL string `json:"TemplatesURL"`
|
|
|
|
LogoURL string `json:"LogoURL"`
|
|
|
|
BlackListedLabels []Pair `json:"BlackListedLabels"`
|
2017-11-26 09:05:03 +00:00
|
|
|
DisplayDonationHeader bool `json:"DisplayDonationHeader"`
|
2017-09-27 07:26:04 +00:00
|
|
|
DisplayExternalContributors bool `json:"DisplayExternalContributors"`
|
|
|
|
AuthenticationMethod AuthenticationMethod `json:"AuthenticationMethod"`
|
|
|
|
LDAPSettings LDAPSettings `json:"LDAPSettings"`
|
|
|
|
AllowBindMountsForRegularUsers bool `json:"AllowBindMountsForRegularUsers"`
|
|
|
|
AllowPrivilegedModeForRegularUsers bool `json:"AllowPrivilegedModeForRegularUsers"`
|
2016-12-18 05:21:29 +00:00
|
|
|
}
|
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
// User represents a user account.
|
2016-12-18 05:21:29 +00:00
|
|
|
User struct {
|
2017-03-12 16:24:15 +00:00
|
|
|
ID UserID `json:"Id"`
|
|
|
|
Username string `json:"Username"`
|
|
|
|
Password string `json:"Password,omitempty"`
|
|
|
|
Role UserRole `json:"Role"`
|
2016-12-18 05:21:29 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 16:24:15 +00:00
|
|
|
// UserID represents a user identifier
|
|
|
|
UserID int
|
|
|
|
|
|
|
|
// UserRole represents the role of a user. It can be either an administrator
|
2017-05-23 18:56:10 +00:00
|
|
|
// or a regular user
|
2017-03-12 16:24:15 +00:00
|
|
|
UserRole int
|
|
|
|
|
2017-08-10 08:35:23 +00:00
|
|
|
// AuthenticationMethod represents the authentication method used to authenticate a user.
|
|
|
|
AuthenticationMethod int
|
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
// Team represents a list of user accounts.
|
|
|
|
Team struct {
|
|
|
|
ID TeamID `json:"Id"`
|
|
|
|
Name string `json:"Name"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// TeamID represents a team identifier
|
|
|
|
TeamID int
|
|
|
|
|
|
|
|
// TeamMembership represents a membership association between a user and a team
|
|
|
|
TeamMembership struct {
|
|
|
|
ID TeamMembershipID `json:"Id"`
|
|
|
|
UserID UserID `json:"UserID"`
|
|
|
|
TeamID TeamID `json:"TeamID"`
|
|
|
|
Role MembershipRole `json:"Role"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// TeamMembershipID represents a team membership identifier
|
|
|
|
TeamMembershipID int
|
|
|
|
|
|
|
|
// MembershipRole represents the role of a user within a team
|
|
|
|
MembershipRole int
|
|
|
|
|
2016-12-18 05:21:29 +00:00
|
|
|
// TokenData represents the data embedded in a JWT token.
|
|
|
|
TokenData struct {
|
2017-03-12 16:24:15 +00:00
|
|
|
ID UserID
|
2016-12-18 05:21:29 +00:00
|
|
|
Username string
|
2017-03-12 16:24:15 +00:00
|
|
|
Role UserRole
|
2016-12-18 05:21:29 +00:00
|
|
|
}
|
|
|
|
|
2017-10-15 17:24:40 +00:00
|
|
|
// StackID represents a stack identifier (it must be composed of Name + "_" + SwarmID to create a unique identifier).
|
|
|
|
StackID string
|
|
|
|
|
|
|
|
// Stack represents a Docker stack created via docker stack deploy.
|
|
|
|
Stack struct {
|
|
|
|
ID StackID `json:"Id"`
|
|
|
|
Name string `json:"Name"`
|
|
|
|
EntryPoint string `json:"EntryPoint"`
|
|
|
|
SwarmID string `json:"SwarmId"`
|
|
|
|
ProjectPath string
|
2017-11-01 09:30:02 +00:00
|
|
|
Env []Pair `json:"Env"`
|
2017-10-15 17:24:40 +00:00
|
|
|
}
|
|
|
|
|
2017-06-20 11:00:32 +00:00
|
|
|
// RegistryID represents a registry identifier.
|
|
|
|
RegistryID int
|
|
|
|
|
|
|
|
// Registry represents a Docker registry with all the info required
|
|
|
|
// to connect to it.
|
|
|
|
Registry struct {
|
|
|
|
ID RegistryID `json:"Id"`
|
|
|
|
Name string `json:"Name"`
|
|
|
|
URL string `json:"URL"`
|
|
|
|
Authentication bool `json:"Authentication"`
|
|
|
|
Username string `json:"Username"`
|
|
|
|
Password string `json:"Password"`
|
|
|
|
AuthorizedUsers []UserID `json:"AuthorizedUsers"`
|
|
|
|
AuthorizedTeams []TeamID `json:"AuthorizedTeams"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// DockerHub represents all the required information to connect and use the
|
|
|
|
// Docker Hub.
|
|
|
|
DockerHub struct {
|
|
|
|
Authentication bool `json:"Authentication"`
|
|
|
|
Username string `json:"Username"`
|
|
|
|
Password string `json:"Password"`
|
|
|
|
}
|
|
|
|
|
2016-12-25 20:34:02 +00:00
|
|
|
// EndpointID represents an endpoint identifier.
|
|
|
|
EndpointID int
|
|
|
|
|
|
|
|
// Endpoint represents a Docker endpoint with all the info required
|
|
|
|
// to connect to it.
|
|
|
|
Endpoint struct {
|
2017-09-14 06:08:37 +00:00
|
|
|
ID EndpointID `json:"Id"`
|
|
|
|
Name string `json:"Name"`
|
|
|
|
URL string `json:"URL"`
|
|
|
|
PublicURL string `json:"PublicURL"`
|
|
|
|
TLSConfig TLSConfiguration `json:"TLSConfig"`
|
|
|
|
AuthorizedUsers []UserID `json:"AuthorizedUsers"`
|
|
|
|
AuthorizedTeams []TeamID `json:"AuthorizedTeams"`
|
|
|
|
|
|
|
|
// Deprecated fields
|
|
|
|
// Deprecated in DBVersion == 4
|
|
|
|
TLS bool `json:"TLS,omitempty"`
|
|
|
|
TLSCACertPath string `json:"TLSCACert,omitempty"`
|
|
|
|
TLSCertPath string `json:"TLSCert,omitempty"`
|
|
|
|
TLSKeyPath string `json:"TLSKey,omitempty"`
|
2016-12-18 05:21:29 +00:00
|
|
|
}
|
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
// ResourceControlID represents a resource control identifier.
|
|
|
|
ResourceControlID int
|
|
|
|
|
|
|
|
// ResourceControl represent a reference to a Docker resource with specific access controls
|
2017-03-12 16:24:15 +00:00
|
|
|
ResourceControl struct {
|
2017-09-14 06:08:37 +00:00
|
|
|
ID ResourceControlID `json:"Id"`
|
|
|
|
ResourceID string `json:"ResourceId"`
|
|
|
|
SubResourceIDs []string `json:"SubResourceIds"`
|
|
|
|
Type ResourceControlType `json:"Type"`
|
|
|
|
AdministratorsOnly bool `json:"AdministratorsOnly"`
|
|
|
|
UserAccesses []UserResourceAccess `json:"UserAccesses"`
|
|
|
|
TeamAccesses []TeamResourceAccess `json:"TeamAccesses"`
|
2017-05-23 18:56:10 +00:00
|
|
|
|
|
|
|
// Deprecated fields
|
2017-09-14 06:08:37 +00:00
|
|
|
// Deprecated in DBVersion == 2
|
|
|
|
OwnerID UserID `json:"OwnerId,omitempty"`
|
|
|
|
AccessLevel ResourceAccessLevel `json:"AccessLevel,omitempty"`
|
2017-03-12 16:24:15 +00:00
|
|
|
}
|
|
|
|
|
2017-10-15 17:24:40 +00:00
|
|
|
// ResourceControlType represents the type of resource associated to the resource control (volume, container, service...).
|
2017-03-12 16:24:15 +00:00
|
|
|
ResourceControlType int
|
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
// UserResourceAccess represents the level of control on a resource for a specific user.
|
|
|
|
UserResourceAccess struct {
|
|
|
|
UserID UserID `json:"UserId"`
|
|
|
|
AccessLevel ResourceAccessLevel `json:"AccessLevel"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// TeamResourceAccess represents the level of control on a resource for a specific team.
|
|
|
|
TeamResourceAccess struct {
|
|
|
|
TeamID TeamID `json:"TeamId"`
|
|
|
|
AccessLevel ResourceAccessLevel `json:"AccessLevel"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// ResourceAccessLevel represents the level of control associated to a resource.
|
2017-03-12 16:24:15 +00:00
|
|
|
ResourceAccessLevel int
|
|
|
|
|
2016-12-25 20:34:02 +00:00
|
|
|
// TLSFileType represents a type of TLS file required to connect to a Docker endpoint.
|
|
|
|
// It can be either a TLS CA file, a TLS certificate file or a TLS key file.
|
|
|
|
TLSFileType int
|
|
|
|
|
2016-12-18 05:21:29 +00:00
|
|
|
// CLIService represents a service for managing CLI.
|
|
|
|
CLIService interface {
|
|
|
|
ParseFlags(version string) (*CLIFlags, error)
|
|
|
|
ValidateFlags(flags *CLIFlags) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// DataStore defines the interface to manage the data.
|
|
|
|
DataStore interface {
|
|
|
|
Open() error
|
|
|
|
Close() error
|
2017-03-12 16:24:15 +00:00
|
|
|
MigrateData() error
|
2016-12-18 05:21:29 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 16:24:15 +00:00
|
|
|
// Server defines the interface to serve the API.
|
2016-12-18 05:21:29 +00:00
|
|
|
Server interface {
|
|
|
|
Start() error
|
|
|
|
}
|
|
|
|
|
2017-03-12 16:24:15 +00:00
|
|
|
// UserService represents a service for managing user data.
|
2016-12-18 05:21:29 +00:00
|
|
|
UserService interface {
|
2017-03-12 16:24:15 +00:00
|
|
|
User(ID UserID) (*User, error)
|
|
|
|
UserByUsername(username string) (*User, error)
|
|
|
|
Users() ([]User, error)
|
|
|
|
UsersByRole(role UserRole) ([]User, error)
|
|
|
|
CreateUser(user *User) error
|
|
|
|
UpdateUser(ID UserID, user *User) error
|
|
|
|
DeleteUser(ID UserID) error
|
2016-12-18 05:21:29 +00:00
|
|
|
}
|
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
// TeamService represents a service for managing user data.
|
|
|
|
TeamService interface {
|
|
|
|
Team(ID TeamID) (*Team, error)
|
|
|
|
TeamByName(name string) (*Team, error)
|
|
|
|
Teams() ([]Team, error)
|
|
|
|
CreateTeam(team *Team) error
|
|
|
|
UpdateTeam(ID TeamID, team *Team) error
|
|
|
|
DeleteTeam(ID TeamID) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// TeamMembershipService represents a service for managing team membership data.
|
|
|
|
TeamMembershipService interface {
|
|
|
|
TeamMembership(ID TeamMembershipID) (*TeamMembership, error)
|
|
|
|
TeamMemberships() ([]TeamMembership, error)
|
|
|
|
TeamMembershipsByUserID(userID UserID) ([]TeamMembership, error)
|
|
|
|
TeamMembershipsByTeamID(teamID TeamID) ([]TeamMembership, error)
|
|
|
|
CreateTeamMembership(membership *TeamMembership) error
|
|
|
|
UpdateTeamMembership(ID TeamMembershipID, membership *TeamMembership) error
|
|
|
|
DeleteTeamMembership(ID TeamMembershipID) error
|
|
|
|
DeleteTeamMembershipByUserID(userID UserID) error
|
|
|
|
DeleteTeamMembershipByTeamID(teamID TeamID) error
|
|
|
|
}
|
|
|
|
|
2017-03-12 16:24:15 +00:00
|
|
|
// EndpointService represents a service for managing endpoint data.
|
2016-12-25 20:34:02 +00:00
|
|
|
EndpointService interface {
|
|
|
|
Endpoint(ID EndpointID) (*Endpoint, error)
|
|
|
|
Endpoints() ([]Endpoint, error)
|
|
|
|
CreateEndpoint(endpoint *Endpoint) error
|
|
|
|
UpdateEndpoint(ID EndpointID, endpoint *Endpoint) error
|
|
|
|
DeleteEndpoint(ID EndpointID) error
|
2017-02-06 05:29:34 +00:00
|
|
|
Synchronize(toCreate, toUpdate, toDelete []*Endpoint) error
|
2016-12-25 20:34:02 +00:00
|
|
|
}
|
|
|
|
|
2017-06-20 11:00:32 +00:00
|
|
|
// RegistryService represents a service for managing registry data.
|
|
|
|
RegistryService interface {
|
|
|
|
Registry(ID RegistryID) (*Registry, error)
|
|
|
|
Registries() ([]Registry, error)
|
|
|
|
CreateRegistry(registry *Registry) error
|
|
|
|
UpdateRegistry(ID RegistryID, registry *Registry) error
|
|
|
|
DeleteRegistry(ID RegistryID) error
|
|
|
|
}
|
|
|
|
|
2017-10-15 17:24:40 +00:00
|
|
|
// StackService represents a service for managing stack data.
|
|
|
|
StackService interface {
|
|
|
|
Stack(ID StackID) (*Stack, error)
|
|
|
|
Stacks() ([]Stack, error)
|
|
|
|
StacksBySwarmID(ID string) ([]Stack, error)
|
|
|
|
CreateStack(stack *Stack) error
|
|
|
|
UpdateStack(ID StackID, stack *Stack) error
|
|
|
|
DeleteStack(ID StackID) error
|
|
|
|
}
|
|
|
|
|
2017-06-20 11:00:32 +00:00
|
|
|
// DockerHubService represents a service for managing the DockerHub object.
|
|
|
|
DockerHubService interface {
|
|
|
|
DockerHub() (*DockerHub, error)
|
|
|
|
StoreDockerHub(registry *DockerHub) error
|
|
|
|
}
|
|
|
|
|
2017-06-01 08:14:55 +00:00
|
|
|
// SettingsService represents a service for managing application settings.
|
|
|
|
SettingsService interface {
|
|
|
|
Settings() (*Settings, error)
|
|
|
|
StoreSettings(settings *Settings) error
|
|
|
|
}
|
|
|
|
|
2017-03-12 16:24:15 +00:00
|
|
|
// VersionService represents a service for managing version data.
|
|
|
|
VersionService interface {
|
|
|
|
DBVersion() (int, error)
|
|
|
|
StoreDBVersion(version int) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// ResourceControlService represents a service for managing resource control data.
|
|
|
|
ResourceControlService interface {
|
2017-05-23 18:56:10 +00:00
|
|
|
ResourceControl(ID ResourceControlID) (*ResourceControl, error)
|
|
|
|
ResourceControlByResourceID(resourceID string) (*ResourceControl, error)
|
|
|
|
ResourceControls() ([]ResourceControl, error)
|
|
|
|
CreateResourceControl(rc *ResourceControl) error
|
|
|
|
UpdateResourceControl(ID ResourceControlID, resourceControl *ResourceControl) error
|
|
|
|
DeleteResourceControl(ID ResourceControlID) error
|
2017-03-12 16:24:15 +00:00
|
|
|
}
|
|
|
|
|
2016-12-18 05:21:29 +00:00
|
|
|
// CryptoService represents a service for encrypting/hashing data.
|
|
|
|
CryptoService interface {
|
|
|
|
Hash(data string) (string, error)
|
|
|
|
CompareHashAndData(hash string, data string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// JWTService represents a service for managing JWT tokens.
|
|
|
|
JWTService interface {
|
|
|
|
GenerateToken(data *TokenData) (string, error)
|
2017-03-12 16:24:15 +00:00
|
|
|
ParseAndVerifyToken(token string) (*TokenData, error)
|
2016-12-18 05:21:29 +00:00
|
|
|
}
|
2016-12-25 20:34:02 +00:00
|
|
|
|
|
|
|
// FileService represents a service for managing files.
|
|
|
|
FileService interface {
|
2017-10-15 17:24:40 +00:00
|
|
|
GetFileContent(filePath string) (string, error)
|
|
|
|
RemoveDirectory(directoryPath string) error
|
2017-08-10 08:35:23 +00:00
|
|
|
StoreTLSFile(folder string, fileType TLSFileType, r io.Reader) error
|
|
|
|
GetPathForTLSFile(folder string, fileType TLSFileType) (string, error)
|
2017-09-14 06:08:37 +00:00
|
|
|
DeleteTLSFile(folder string, fileType TLSFileType) error
|
2017-08-10 08:35:23 +00:00
|
|
|
DeleteTLSFiles(folder string) error
|
2017-10-15 17:24:40 +00:00
|
|
|
GetStackProjectPath(stackIdentifier string) string
|
|
|
|
StoreStackFileFromString(stackIdentifier string, stackFileContent string) (string, error)
|
|
|
|
StoreStackFileFromReader(stackIdentifier string, r io.Reader) (string, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GitService represents a service for managing Git.
|
|
|
|
GitService interface {
|
|
|
|
CloneRepository(url, destination string) error
|
2016-12-25 20:34:02 +00:00
|
|
|
}
|
2017-02-06 05:29:34 +00:00
|
|
|
|
|
|
|
// EndpointWatcher represents a service to synchronize the endpoints via an external source.
|
|
|
|
EndpointWatcher interface {
|
|
|
|
WatchEndpointFile(endpointFilePath string) error
|
|
|
|
}
|
2017-08-10 08:35:23 +00:00
|
|
|
|
|
|
|
// LDAPService represents a service used to authenticate users against a LDAP/AD.
|
|
|
|
LDAPService interface {
|
|
|
|
AuthenticateUser(username, password string, settings *LDAPSettings) error
|
|
|
|
TestConnectivity(settings *LDAPSettings) error
|
|
|
|
}
|
2017-10-15 17:24:40 +00:00
|
|
|
|
|
|
|
// StackManager represents a service to manage stacks.
|
|
|
|
StackManager interface {
|
2018-02-07 07:37:01 +00:00
|
|
|
Login(dockerhub *DockerHub, registries []Registry, endpoint *Endpoint)
|
2017-10-26 12:22:09 +00:00
|
|
|
Logout(endpoint *Endpoint) error
|
2018-01-20 17:05:01 +00:00
|
|
|
Deploy(stack *Stack, prune bool, endpoint *Endpoint) error
|
2017-10-15 17:24:40 +00:00
|
|
|
Remove(stack *Stack, endpoint *Endpoint) error
|
|
|
|
}
|
2016-12-18 05:21:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2017-05-23 18:56:10 +00:00
|
|
|
// APIVersion is the version number of the Portainer API.
|
2018-01-23 15:52:54 +00:00
|
|
|
APIVersion = "1.16.1"
|
2017-05-23 18:56:10 +00:00
|
|
|
// DBVersion is the version number of the Portainer database.
|
2017-11-28 12:40:33 +00:00
|
|
|
DBVersion = 7
|
2017-06-01 08:14:55 +00:00
|
|
|
// DefaultTemplatesURL represents the default URL for the templates definitions.
|
|
|
|
DefaultTemplatesURL = "https://raw.githubusercontent.com/portainer/templates/master/templates.json"
|
2016-12-18 05:21:29 +00:00
|
|
|
)
|
2016-12-25 20:34:02 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
// TLSFileCA represents a TLS CA certificate file.
|
|
|
|
TLSFileCA TLSFileType = iota
|
|
|
|
// TLSFileCert represents a TLS certificate file.
|
|
|
|
TLSFileCert
|
|
|
|
// TLSFileKey represents a TLS key file.
|
|
|
|
TLSFileKey
|
|
|
|
)
|
2017-03-12 16:24:15 +00:00
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
const (
|
|
|
|
_ MembershipRole = iota
|
|
|
|
// TeamLeader represents a leader role inside a team
|
|
|
|
TeamLeader
|
|
|
|
// TeamMember represents a member role inside a team
|
|
|
|
TeamMember
|
|
|
|
)
|
|
|
|
|
2017-03-12 16:24:15 +00:00
|
|
|
const (
|
|
|
|
_ UserRole = iota
|
|
|
|
// AdministratorRole represents an administrator user role
|
|
|
|
AdministratorRole
|
|
|
|
// StandardUserRole represents a regular user role
|
|
|
|
StandardUserRole
|
|
|
|
)
|
|
|
|
|
2017-08-10 08:35:23 +00:00
|
|
|
const (
|
|
|
|
_ AuthenticationMethod = iota
|
|
|
|
// AuthenticationInternal represents the internal authentication method (authentication against Portainer API)
|
|
|
|
AuthenticationInternal
|
|
|
|
// AuthenticationLDAP represents the LDAP authentication method (authentication against a LDAP server)
|
|
|
|
AuthenticationLDAP
|
|
|
|
)
|
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
const (
|
|
|
|
_ ResourceAccessLevel = iota
|
|
|
|
// ReadWriteAccessLevel represents an access level with read-write permissions on a resource
|
|
|
|
ReadWriteAccessLevel
|
|
|
|
)
|
|
|
|
|
2017-03-12 16:24:15 +00:00
|
|
|
const (
|
|
|
|
_ ResourceControlType = iota
|
2017-05-23 18:56:10 +00:00
|
|
|
// ContainerResourceControl represents a resource control associated to a Docker container
|
2017-03-12 16:24:15 +00:00
|
|
|
ContainerResourceControl
|
2017-05-23 18:56:10 +00:00
|
|
|
// ServiceResourceControl represents a resource control associated to a Docker service
|
2017-03-12 16:24:15 +00:00
|
|
|
ServiceResourceControl
|
2017-05-23 18:56:10 +00:00
|
|
|
// VolumeResourceControl represents a resource control associated to a Docker volume
|
2017-03-12 16:24:15 +00:00
|
|
|
VolumeResourceControl
|
2017-09-19 14:58:30 +00:00
|
|
|
// NetworkResourceControl represents a resource control associated to a Docker network
|
|
|
|
NetworkResourceControl
|
2017-09-19 15:10:15 +00:00
|
|
|
// SecretResourceControl represents a resource control associated to a Docker secret
|
|
|
|
SecretResourceControl
|
2017-10-15 17:24:40 +00:00
|
|
|
// StackResourceControl represents a resource control associated to a stack composed of Docker services
|
|
|
|
StackResourceControl
|
2017-11-06 08:47:31 +00:00
|
|
|
// ConfigResourceControl represents a resource control associated to a Docker config
|
|
|
|
ConfigResourceControl
|
2017-03-12 16:24:15 +00:00
|
|
|
)
|