baasapi

package module
v0.0.0-...-b1a156a Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Zlib Imports: 0 Imported by: 0

README

Docker Pulls

BaaSapi is a lightweight management UI which allows you to easily manage your hyperledger fabric environments (kubernetes).

BaaSapi is meant to be as simple to deploy as it is to use. It consists of a single container that can run on any Docker engine (can be deployed as Linux container, supports other platforms too (x86 and s390x).

BaaSapi allows you to manage your hyperledger fabric resources (network, organization, nodes, CA, channel, chaincodes and more) !

Introduction

https://github.ibm.com/Liyong-Li/baasapi/blob/master/Blockchain_Platform_Solution_v1.0.pdf

Reporting bugs and contributing

Limitations

Documentation

Index

Constants

View Source
const (
	// APIVersion is the version number of the BaaSapi API
	APIVersion = "1.20.3"
	// DBVersion is the version number of the BaaSapi database
	DBVersion = 18
	// AssetsServerURL represents the URL of the BaaSapi asset server
	AssetsServerURL = "https://baasapi-io-assets.sfo2.digitaloceanspaces.com"
	// MessageOfTheDayURL represents the URL where BaaSapi MOTD message can be retrieved
	MessageOfTheDayURL = AssetsServerURL + "/motd.html"
	// MessageOfTheDayTitleURL represents the URL where BaaSapi MOTD title can be retrieved
	MessageOfTheDayTitleURL = AssetsServerURL + "/motd-title.txt"
	// ExtensionDefinitionsURL represents the URL where BaaSapi extension definitions can be retrieved
	ExtensionDefinitionsURL = AssetsServerURL + "/extensions-1.20.2.json"
	// BaaSapiAgentHeader represents the name of the header available in any agent response
	BaaSapiAgentHeader = "BaaSapi-Agent"
	// BaaSapiAgentTargetHeader represent the name of the header containing the target node name
	BaaSapiAgentTargetHeader = "X-BaaSapiAgent-Target"
	// BaaSapiAgentSignatureHeader represent the name of the header containing the digital signature
	BaaSapiAgentSignatureHeader = "X-BaaSapiAgent-Signature"
	// BaaSapiAgentPublicKeyHeader represent the name of the header containing the public key
	BaaSapiAgentPublicKeyHeader = "X-BaaSapiAgent-PublicKey"
	// BaaSapiAgentSignatureMessage represents the message used to create a digital signature
	// to be used when communicating with an agent
	BaaSapiAgentSignatureMessage = "BaaSapi-App"
	// SupportedDockerAPIVersion is the minimum Docker API version supported by BaaSapi
	SupportedDockerAPIVersion = "1.24"
)
View Source
const (
	ErrUnauthorized           = Error("Unauthorized")
	ErrResourceAccessDenied   = Error("Access denied to resource")
	ErrObjectNotFound         = Error("Object not found inside the database")
	ErrMissingSecurityContext = Error("Unable to find security details in request context")
)

General errors.

View Source
const (
	ErrUserAlreadyExists          = Error("User already exists")
	ErrInvalidUsername            = Error("Invalid username. White spaces are not allowed")
	ErrAdminAlreadyInitialized    = Error("An administrator user already exists")
	ErrAdminCannotRemoveSelf      = Error("Cannot remove your own user account. Contact another administrator")
	ErrCannotRemoveLastLocalAdmin = Error("Cannot remove the last local administrator account")
)

User errors.

View Source
const (
	ErrScaleTypeError   = Error("Scale resource type error")
	ErrScaleNumberError = Error("Scale number cannot be larger than 5")
)

scale_error

View Source
const (
	ErrPolicyAlreadyExists = Error("Policy already exists")
	ErrPolicyLastOne       = Error("Cannot Delete the last one")
)

Policy errors.

View Source
const (
	ErrResourceControlAlreadyExists = Error("A resource control is already applied on this resource")
	ErrInvalidResourceControlType   = Error("Unsupported resource control type")
)

ResourceControl errors.

View Source
const (
	ErrStackAlreadyExists              = Error("A stack already exists with this name")
	ErrComposeFileNotFoundInRepository = Error("Unable to find a Compose file in the repository")
	ErrStackNotExternal                = Error("Not an external stack")
)

Stack errors

View Source
const (
	ErrBaask8sExtensionNotSupported      = Error("This extension is not supported")
	ErrBaask8sExtensionAlreadyAssociated = Error("This extension is already associated to the baask8s")
)

Baask8s extensions error

View Source
const (
	ErrSecretGeneration   = Error("Unable to generate secret key")
	ErrInvalidJWTToken    = Error("Invalid JWT token")
	ErrMissingContextData = Error("Unable to find JWT data in request context")
)

JWT errors.

View Source
const (
	ErrWebhookAlreadyExists   = Error("A webhook for this resource already exists")
	ErrUnsupportedWebhookType = Error("Webhooks for this resource are not currently supported")
)

Webhook errors

View Source
const (
	ErrAzureInvalidCredentials = Error("Invalid Azure credentials")
)

Azure environment errors

View Source
const (
	ErrBaask8sAccessDenied = Error("Access denied to baask8s")
)

Baask8s errors.

View Source
const (
	ErrCannotRemoveDefaultGroup = Error("Cannot remove the default baask8s group")
)

Baask8s group errors.

View Source
const (
	ErrCryptoHashFailure = Error("Unable to hash data")
)

Crypto errors.

View Source
const (
	ErrExtensionAlreadyEnabled = Error("This extension is already enabled")
)

Extension errors.

View Source
const (
	ErrHostManagementFeaturesDisabled = Error("Host management features are disabled")
)

Schedule errors.

View Source
const (
	ErrRegistryAlreadyExists = Error("A registry is already defined for this URL")
)

Registry errors.

View Source
const (
	ErrTagAlreadyExists = Error("A tag already exists with this name")
)

Tag errors

View Source
const (
	ErrTeamAlreadyExists = Error("Team already exists")
)

Team errors.

View Source
const (
	ErrTeamMembershipAlreadyExists = Error("Team membership already exists for this user and team")
)

TeamMembership errors.

View Source
const (
	ErrUnableToPingBaask8s = Error("Unable to communicate with the baask8s")
)

Docker errors.

View Source
const (
	ErrUndefinedTLSFileType = Error("Undefined TLS file type")
)

File errors.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationMethod

type AuthenticationMethod int

AuthenticationMethod represents the authentication method used to authenticate a user

const (

	// AuthenticationInternal represents the internal authentication method (authentication against BaaSapi API)
	AuthenticationInternal AuthenticationMethod
	// AuthenticationLDAP represents the LDAP authentication method (authentication against a LDAP server)
	AuthenticationLDAP
	//AuthenticationOAuth represents the OAuth authentication method (authentication against a authorization server)
	AuthenticationOAuth
)

type AzureCredentials

type AzureCredentials struct {
	ApplicationID     string `json:"ApplicationID"`
	TenantID          string `json:"TenantID"`
	AuthenticationKey string `json:"AuthenticationKey"`
}

AzureCredentials represents the credentials used to connect to an Azure environment.

type BaasAPP

type BaasAPP struct {
	Name   string `json:"name"`
	Status string `json:"status"`
}

type Baask8s

type Baask8s struct {
	ID Baask8sID `json:"Id"`
	//GroupID          Baask8sGroupID      `json:"GroupId"`
	NetworkName     string    `json:"NetworkName"`
	NetworkID       string    `json:"NetworkID"`
	Owner           string    `json:"Owner"`
	Platform        string    `json:"Platform"`
	CreatedAt       string    `json:"CreatedAt"`
	MSPs            []MSP     `json:"MSPs"`
	CHLs            []CHL     `json:"CHLs"`
	Policys         []Policy  `json:"Policys"`
	CCs             []CC      `json:"CCs"`
	Applications    []BaasAPP `json:"Applications"`
	AuthorizedUsers []UserID  `json:"AuthorizedUsers"`
	AuthorizedTeams []TeamID  `json:"AuthorizedTeams"`
	//Tags             []string            `json:"Tags"`
	Status    Baask8sStatus `json:"Status"`
	Snapshots []Snapshot    `json:"Snapshots"`
	Namespace string        `json:"Namespace"`
}

Baask8s represents a Docker baask8s with all the info required to connect to it

type Baask8sGroup

type Baask8sGroup struct {
	ID              Baask8sGroupID `json:"Id"`
	Name            string         `json:"Name"`
	Description     string         `json:"Description"`
	AuthorizedUsers []UserID       `json:"AuthorizedUsers"`
	AuthorizedTeams []TeamID       `json:"AuthorizedTeams"`
	Tags            []string       `json:"Tags"`

	// Deprecated fields
	Labels []Pair `json:"Labels"`
}

Baask8sGroup represents a group of baask8ss

type Baask8sGroupID

type Baask8sGroupID int

Baask8sGroupID represents an baask8s group identifier

type Baask8sGroupService

type Baask8sGroupService interface {
	Baask8sGroup(ID Baask8sGroupID) (*Baask8sGroup, error)
	Baask8sGroups() ([]Baask8sGroup, error)
	CreateBaask8sGroup(group *Baask8sGroup) error
	UpdateBaask8sGroup(ID Baask8sGroupID, group *Baask8sGroup) error
	DeleteBaask8sGroup(ID Baask8sGroupID) error
}

Baask8sGroupService represents a service for managing baask8s group data

type Baask8sID

type Baask8sID int

Baask8sID represents an baask8s identifier

type Baask8sJob

type Baask8sJob struct {
	Baask8ss []Baask8sID
}

Baask8sJob represents a scheduled job that sync baask8s

type Baask8sService

type Baask8sService interface {
	Baask8s(ID Baask8sID) (*Baask8s, error)
	Baask8ss() ([]Baask8s, error)
	CreateBaask8s(baask8s *Baask8s) error
	UpdateBaask8s(ID Baask8sID, baask8s *Baask8s) error
	DeleteBaask8s(ID Baask8sID) error
	GetNextIdentifier() int
}

Baask8sService represents a service for managing baask8s data

type Baask8sStatus

type Baask8sStatus int

Baask8sStatus represents the status of an baask8s

const (

	// Baask8sStatusUp is used to represent an available baask8s
	Baask8sStatusUp Baask8sStatus
	// Baask8sStatusDown is used to represent an unavailable baask8s
	Baask8sStatusDown
)

type Baask8sType

type Baask8sType int

Baask8stype represents the type of an baask8s

const (

	// DockerEnvironment represents an baask8s connected to a Docker environment
	DockerEnvironment2 Baask8sType
	// AgentOnDockerEnvironment represents an baask8s connected to a BaaSapi agent deployed on a Docker environment
	AgentOnDockerEnvironment2
	// AzureEnvironment represents an baask8s connected to an Azure environment
	AzureEnvironment2
)

type Baasmsp

type Baasmsp struct {
	ID          BaasmspID `json:"Id"`
	NetworkName string    `json:"NetworkName"`
	NetworkID   string    `json:"NetworkID"`
	Owner       string    `json:"Owner"`
	Platform    string    `json:"Platform"`
	CreatedAt   int64     `json:"CreatedAt"`
	MSPs        []MSP     `json:"MSPs"`
	//Tags             []string            `json:"Tags"`
	Status    Baask8sStatus `json:"Status"`
	Snapshots []Snapshot    `json:"Snapshots"`
	Namespace string        `json:"Namespace"`
}

Baasmsp represents a baasmsp with all the info required to connect to it

type BaasmspID

type BaasmspID int

BaasmspID represents an baasmsp identifier

type BaasmspService

type BaasmspService interface {
	Baasmsp(ID BaasmspID) (*Baasmsp, error)
	Baasmsps() ([]Baasmsp, error)
	CreateBaasmsp(baasmsp *Baasmsp) error
	DeleteBaasmsp(ID BaasmspID) error
	GetNextIdentifier() int
}

BaasmspService represents a service for managing baasmsp data

type BaasmspStatus

type BaasmspStatus int

BaasmspStatus represents the status of an baasmsp

type BaasmspType

type BaasmspType int

Baasmsptype represents the type of an baasmsp

type CAFilesManager

type CAFilesManager interface {
	Deploy(creator string, networkID string, ansible_extra string, ansible_env string, ansible_config string, flag bool) error
	GetLogs(namespade string, nline int) (string, error)
}

CAFilesManager represents a service to manage CAFiles

type CC

type CC struct {
	//ID              CCID      `json:"id"`
	ID                    int         `json:"id"`
	CCName                string      `json:"chaincodeName"`
	CHLName               string      `json:"chlName"`
	Version               string      `json:"chaincodeVersion"`
	EndorsementPolicyparm interface{} `json:"endorsementPolicyparm"`
	InstallORGs           []MSPORG    `json:"installORGs"`
	InstantiateORGs       []MSPORG    `json:"instantiateORGs"`
	ChaincodeType         string      `json:"chaincodeType"`
	Path                  string      `json:"path"`
}

type CCID

type CCID int

CHLID represents a Channel identifier

type CHL

type CHL struct {
	ID        CHLID    `json:"Id"`
	CHLName   string   `json:"CHLName"`
	CreatedAt string   `json:"CreatedAt"`
	ORGs      []MSPORG `json:"ORGs"`
}

MSP represents a MSP

type CHLID

type CHLID int

CHLID represents a Channel identifier

type CLIFlags

type CLIFlags struct {
	Addr              *string
	AdminPassword     *string
	AdminPasswordFile *string
	Assets            *string
	Data              *string
	Labels            *[]Pair
	NoAuth            *bool
	NoAnalytics       *bool
	Templates         *string
	TemplateFile      *string
	TLS               *bool
	TLSSkipVerify     *bool
	TLSCacert         *string
	TLSCert           *string
	TLSKey            *string
	SSL               *bool
	SSLCert           *string
	SSLKey            *string
	SyncInterval      *string
	Snapshot          *bool
	SnapshotInterval  *string
	Baask8s           *bool
	Baask8sInterval   *string
}

CLIFlags represents the available flags on the CLI

type CLIService

type CLIService interface {
	ParseFlags(version string) (*CLIFlags, error)
	ValidateFlags(flags *CLIFlags) error
}

CLIService represents a service for managing CLI

type CryptoService

type CryptoService interface {
	Hash(data string) (string, error)
	CompareHashAndData(hash string, data string) error
}

CryptoService represents a service for encrypting/hashing data

type DataStore

type DataStore interface {
	Open() error
	Init() error
	Close() error
	MigrateData() error
}

DataStore defines the interface to manage the data

type DigitalSignatureService

type DigitalSignatureService interface {
	ParseKeyPair(private, public []byte) error
	GenerateKeyPair() ([]byte, []byte, error)
	EncodedPublicKey() string
	PEMHeaders() (string, string)
	CreateSignature(message string) (string, error)
}

DigitalSignatureService represents a service to manage digital signatures

type Error

type Error string

Error represents an application error.

func (Error) Error

func (e Error) Error() string

Error returns the error message.

type Extension

type Extension struct {
	ID               ExtensionID        `json:"Id"`
	Enabled          bool               `json:"Enabled"`
	Name             string             `json:"Name,omitempty"`
	ShortDescription string             `json:"ShortDescription,omitempty"`
	Description      string             `json:"Description,omitempty"`
	DescriptionURL   string             `json:"DescriptionURL,omitempty"`
	Price            string             `json:"Price,omitempty"`
	PriceDescription string             `json:"PriceDescription,omitempty"`
	Deal             bool               `json:"Deal,omitempty"`
	Available        bool               `json:"Available,omitempty"`
	License          LicenseInformation `json:"License,omitempty"`
	Version          string             `json:"Version"`
	UpdateAvailable  bool               `json:"UpdateAvailable"`
	ShopURL          string             `json:"ShopURL,omitempty"`
	Images           []string           `json:"Images,omitempty"`
}

Extension represents a BaaSapi extension

type ExtensionID

type ExtensionID int

ExtensionID represents a extension identifier

const (

	// RegistryManagementExtension represents the registry management extension
	RegistryManagementExtension ExtensionID
	// OAuthAuthenticationExtension represents the OAuth authentication extension
	OAuthAuthenticationExtension
)

type ExtensionManager

type ExtensionManager interface {
	FetchExtensionDefinitions() ([]Extension, error)
	EnableExtension(extension *Extension, licenseKey string) error
	DisableExtension(extension *Extension) error
	UpdateExtension(extension *Extension, version string) error
}

ExtensionManager represents a service used to manage extensions

type ExtensionService

type ExtensionService interface {
	Extension(ID ExtensionID) (*Extension, error)
	Extensions() ([]Extension, error)
	Persist(extension *Extension) error
	DeleteExtension(ID ExtensionID) error
}

ExtensionService represents a service for managing extension data

type FileService

type FileService interface {
	GetFileContent(filePath string) ([]byte, error)
	Rename(oldPath, newPath string) error
	RemoveDirectory(directoryPath string) error
	StoreTLSFileFromBytes(folder string, fileType TLSFileType, data []byte) (string, error)
	StoreKubeconfigFileFromBytes(folder string, fileType TLSFileType, data []byte) (string, error)
	GetPathForTLSFile(folder string, fileType TLSFileType) (string, error)
	DeleteTLSFile(folder string, fileType TLSFileType) error
	DeleteTLSFiles(folder string) error
	GetStackProjectPath(stackIdentifier string) string
	StoreStackFileFromBytes(stackIdentifier, fileName string, data []byte) (string, error)
	StoreRegistryManagementFileFromBytes(folder, fileName string, data []byte) (string, error)
	KeyPairFilesExist() (bool, error)
	StoreKeyPair(private, public []byte, privatePEMHeader, publicPEMHeader string) error
	LoadKeyPair() ([]byte, []byte, error)
	WriteJSONToFile(path string, content interface{}) error
	StoreYamlFileFromJSON(stackIdentifier, fileName string, content interface{}, creator string) (string, error)
	FileExists(path string) (bool, error)
	StoreScheduledJobFileFromBytes(identifier string, data []byte) (string, error)
	GetScheduleFolder(identifier string) string
	ExtractExtensionArchive(data []byte) error
	GetBinaryFolder() string
}

FileService represents a service for managing files

type GitService

type GitService interface {
	ClonePublicRepository(repositoryURL, referenceName string, destination string) error
	ClonePrivateRepositoryWithBasicAuth(repositoryURL, referenceName string, destination, username, password string) error
}

GitService represents a service for managing Git

type JWTService

type JWTService interface {
	GenerateToken(data *TokenData) (string, error)
	ParseAndVerifyToken(token string) (*TokenData, error)
}

JWTService represents a service for managing JWT tokens

type JobRunner

type JobRunner interface {
	Run()
	GetSchedule() *Schedule
}

JobRunner represents a service that can be used to run a job

type JobScheduler

type JobScheduler interface {
	ScheduleJob(runner JobRunner) error
	UpdateJobSchedule(runner JobRunner) error
	UpdateSystemJobSchedule(jobType JobType, newCronExpression string) error
	UnscheduleJob(ID ScheduleID)
	Start()
}

JobScheduler represents a service to run jobs on a periodic basis

type JobService

type JobService interface {
	ExecuteScript(baask8s *Baask8s, nodeName, image string, script []byte, schedule *Schedule) error
}

JobService represents a service to manage job execution on hosts

type JobType

type JobType int

JobType represents a job type

const (

	// ScriptExecutionJobType is a non-system job used to execute a script against a list of
	// baask8ss via privileged containers
	ScriptExecutionJobType JobType
	// SnapshotJobType is a system job used to create baask8s snapshots
	SnapshotJobType
	// Baask8sJobType is a system job used to sync baask8s
	Baask8sJobType
	Baask8sSyncJobType
)

type LDAPGroupSearchSettings

type LDAPGroupSearchSettings struct {
	GroupBaseDN    string `json:"GroupBaseDN"`
	GroupFilter    string `json:"GroupFilter"`
	GroupAttribute string `json:"GroupAttribute"`
}

LDAPGroupSearchSettings represents settings used to search for groups in a LDAP server

type LDAPSearchSettings

type LDAPSearchSettings struct {
	BaseDN            string `json:"BaseDN"`
	Filter            string `json:"Filter"`
	UserNameAttribute string `json:"UserNameAttribute"`
}

LDAPSearchSettings represents settings used to search for users in a LDAP server

type LDAPService

type LDAPService interface {
	AuthenticateUser(username, password string, settings *LDAPSettings) error
	TestConnectivity(settings *LDAPSettings) error
	GetUserGroups(username string, settings *LDAPSettings) ([]string, error)
}

LDAPService represents a service used to authenticate users against a LDAP/AD

type LDAPSettings

type LDAPSettings struct {
	ReaderDN            string                    `json:"ReaderDN"`
	Password            string                    `json:"Password,omitempty"`
	URL                 string                    `json:"URL"`
	TLSConfig           TLSConfiguration          `json:"TLSConfig"`
	StartTLS            bool                      `json:"StartTLS"`
	SearchSettings      []LDAPSearchSettings      `json:"SearchSettings"`
	GroupSearchSettings []LDAPGroupSearchSettings `json:"GroupSearchSettings"`
	AutoCreateUsers     bool                      `json:"AutoCreateUsers"`
}

LDAPSettings represents the settings used to connect to a LDAP server

type LicenseInformation

type LicenseInformation struct {
	LicenseKey string `json:"LicenseKey,omitempty"`
	Company    string `json:"Company,omitempty"`
	Expiration string `json:"Expiration,omitempty"`
	Valid      bool   `json:"Valid,omitempty"`
}

LicenseInformation represents information about an extension license

type MSP

type MSP struct {
	ID      int      `json:"Id"`
	MSPName string   `json:"MSPName"`
	ORGs    []MSPORG `json:"ORGs"`
	Role    int      `json:"Role"`
}

MSP represents a MSP

type MSPORG

type MSPORG struct {
	ORGName string   `json:"ORGName"`
	Anchor  string   `json:"Anchor"`
	Peers   []string `json:"Peers"`
}

MSP-ORG represents a ORG identifier

type MembershipRole

type MembershipRole int

MembershipRole represents the role of a user within a team

const (

	// TeamLeader represents a leader role inside a team
	TeamLeader MembershipRole
	// TeamMember represents a member role inside a team
	TeamMember
)

type OAuthSettings

type OAuthSettings struct {
	ClientID             string `json:"ClientID"`
	ClientSecret         string `json:"ClientSecret,omitempty"`
	AccessTokenURI       string `json:"AccessTokenURI"`
	AuthorizationURI     string `json:"AuthorizationURI"`
	ResourceURI          string `json:"ResourceURI"`
	RedirectURI          string `json:"RedirectURI"`
	UserIdentifier       string `json:"UserIdentifier"`
	Scopes               string `json:"Scopes"`
	OAuthAutoCreateUsers bool   `json:"OAuthAutoCreateUsers"`
	DefaultTeamID        TeamID `json:"DefaultTeamID"`
}

OAuthSettings represents the settings used to authorize with an authorization server

type Pair

type Pair struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Pair defines a key/value string pair

type Policy

type Policy struct {
	Name                  string      `json:"name"`
	Description           string      `json:"desc"`
	EndorsementPolicyparm interface{} `json:"endorsementPolicyparm"`
}

type Registry

type Registry struct {
	ID                      RegistryID                       `json:"Id"`
	Type                    RegistryType                     `json:"Type"`
	Name                    string                           `json:"Name"`
	URL                     string                           `json:"URL"`
	Authentication          bool                             `json:"Authentication"`
	Username                string                           `json:"Username"`
	Password                string                           `json:"Password,omitempty"`
	AuthorizedUsers         []UserID                         `json:"AuthorizedUsers"`
	AuthorizedTeams         []TeamID                         `json:"AuthorizedTeams"`
	ManagementConfiguration *RegistryManagementConfiguration `json:"ManagementConfiguration"`
}

Registry represents a Docker registry with all the info required to connect to it

type RegistryID

type RegistryID int

RegistryID represents a registry identifier

type RegistryManagementConfiguration

type RegistryManagementConfiguration struct {
	Type           RegistryType     `json:"Type"`
	Authentication bool             `json:"Authentication"`
	Username       string           `json:"Username"`
	Password       string           `json:"Password"`
	TLSConfig      TLSConfiguration `json:"TLSConfig"`
}

RegistryManagementConfiguration represents a configuration that can be used to query the registry API via the registry management extension.

type RegistryService

type RegistryService interface {
	Registry(ID RegistryID) (*Registry, error)
	Registries() ([]Registry, error)
	CreateRegistry(registry *Registry) error
	UpdateRegistry(ID RegistryID, registry *Registry) error
	DeleteRegistry(ID RegistryID) error
}

RegistryService represents a service for managing registry data

type RegistryType

type RegistryType int

RegistryType represents a type of registry

const (

	// QuayRegistry represents a Quay.io registry
	QuayRegistry RegistryType
	// AzureRegistry represents an ACR registry
	AzureRegistry
	// CustomRegistry represents a custom registry
	CustomRegistry
)

type ResourceAccessLevel

type ResourceAccessLevel int

ResourceAccessLevel represents the level of control associated to a resource

const (

	// ReadWriteAccessLevel represents an access level with read-write permissions on a resource
	ReadWriteAccessLevel ResourceAccessLevel
)

type ResourceControl

type ResourceControl struct {
	ID             ResourceControlID    `json:"Id"`
	ResourceID     string               `json:"ResourceId"`
	SubResourceIDs []string             `json:"SubResourceIds"`
	Type           ResourceControlType  `json:"Type"`
	UserAccesses   []UserResourceAccess `json:"UserAccesses"`
	TeamAccesses   []TeamResourceAccess `json:"TeamAccesses"`
	Public         bool                 `json:"Public"`

	// Deprecated fields
	// Deprecated in DBVersion == 2
	OwnerID     UserID              `json:"OwnerId,omitempty"`
	AccessLevel ResourceAccessLevel `json:"AccessLevel,omitempty"`

	// Deprecated in DBVersion == 14
	AdministratorsOnly bool `json:"AdministratorsOnly,omitempty"`
}

ResourceControl represent a reference to a Docker resource with specific access controls

type ResourceControlID

type ResourceControlID int

ResourceControlID represents a resource control identifier

type ResourceControlService

type ResourceControlService interface {
	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
}

ResourceControlService represents a service for managing resource control data

type ResourceControlType

type ResourceControlType int

ResourceControlType represents the type of resource associated to the resource control (volume, container, service...)

const (

	// ContainerResourceControl represents a resource control associated to a Docker container
	ContainerResourceControl ResourceControlType
	// ServiceResourceControl represents a resource control associated to a Docker service
	ServiceResourceControl
	// VolumeResourceControl represents a resource control associated to a Docker volume
	VolumeResourceControl
	// NetworkResourceControl represents a resource control associated to a Docker network
	NetworkResourceControl
	// SecretResourceControl represents a resource control associated to a Docker secret
	SecretResourceControl
	// StackResourceControl represents a resource control associated to a stack composed of Docker services
	StackResourceControl
	// ConfigResourceControl represents a resource control associated to a Docker config
	ConfigResourceControl
)

type Schedule

type Schedule struct {
	ID                 ScheduleID `json:"Id"`
	Name               string
	CronExpression     string
	Recurring          bool
	Created            int64
	JobType            JobType
	ScriptExecutionJob *ScriptExecutionJob
	SnapshotJob        *SnapshotJob
	Baask8sJob         *Baask8sJob
}

Schedule represents a scheduled job. It only contains a pointer to one of the JobRunner implementations based on the JobType. NOTE: The Recurring option is only used by ScriptExecutionJob at the moment

type ScheduleID

type ScheduleID int

ScheduleID represents a schedule identifier.

type ScheduleService

type ScheduleService interface {
	Schedule(ID ScheduleID) (*Schedule, error)
	Schedules() ([]Schedule, error)
	SchedulesByJobType(jobType JobType) ([]Schedule, error)
	CreateSchedule(schedule *Schedule) error
	UpdateSchedule(ID ScheduleID, schedule *Schedule) error
	DeleteSchedule(ID ScheduleID) error
	GetNextIdentifier() int
}

ScheduleService represents a service for managing schedule data

type ScriptExecutionJob

type ScriptExecutionJob struct {
	Baask8ss      []Baask8sID
	Image         string
	ScriptPath    string
	RetryCount    int
	RetryInterval int
}

ScriptExecutionJob represents a scheduled job that can execute a script via a privileged container

type Server

type Server interface {
	Start() error
}

Server defines the interface to serve the API

type Settings

type Settings struct {
	LogoURL                            string               `json:"LogoURL"`
	BlackListedLabels                  []Pair               `json:"BlackListedLabels"`
	AuthenticationMethod               AuthenticationMethod `json:"AuthenticationMethod"`
	LDAPSettings                       LDAPSettings         `json:"LDAPSettings"`
	OAuthSettings                      OAuthSettings        `json:"OAuthSettings"`
	AllowBindMountsForRegularUsers     bool                 `json:"AllowBindMountsForRegularUsers"`
	AllowPrivilegedModeForRegularUsers bool                 `json:"AllowPrivilegedModeForRegularUsers"`
	SnapshotInterval                   string               `json:"SnapshotInterval"`
	Baask8sInterval                    string               `json:"Baask8sInterval"`
	TemplatesURL                       string               `json:"TemplatesURL"`
	EnableHostManagementFeatures       bool                 `json:"EnableHostManagementFeatures"`

	// Deprecated fields
	DisplayDonationHeader       bool
	DisplayExternalContributors bool
}

Settings represents the application settings

type SettingsService

type SettingsService interface {
	Settings() (*Settings, error)
	UpdateSettings(settings *Settings) error
}

SettingsService represents a service for managing application settings

type Snapshot

type Snapshot struct {
	Time                  int64       `json:"Time"`
	DockerVersion         string      `json:"DockerVersion"`
	Swarm                 bool        `json:"Swarm"`
	TotalCPU              int         `json:"TotalCPU"`
	TotalMemory           int64       `json:"TotalMemory"`
	RunningContainerCount int         `json:"RunningContainerCount"`
	StoppedContainerCount int         `json:"StoppedContainerCount"`
	VolumeCount           int         `json:"VolumeCount"`
	ImageCount            int         `json:"ImageCount"`
	ServiceCount          int         `json:"ServiceCount"`
	StackCount            int         `json:"StackCount"`
	SnapshotRaw           SnapshotRaw `json:"SnapshotRaw"`
}

Snapshot represents a snapshot of a specific baask8s at a specific time

type SnapshotJob

type SnapshotJob struct{}

SnapshotJob represents a scheduled job that can create baask8s snapshots

type SnapshotRaw

type SnapshotRaw struct {
	Containers interface{} `json:"Containers"`
	Volumes    interface{} `json:"Volumes"`
	Networks   interface{} `json:"Networks"`
	Images     interface{} `json:"Images"`
	Info       interface{} `json:"Info"`
	Version    interface{} `json:"Version"`
}

SnapshotRaw represents all the information related to a snapshot as returned by the Docker API

type Snapshotter

type Snapshotter interface {
	CreateSnapshot(baask8s *Baask8s) (*Snapshot, error)
}

Snapshotter represents a service used to create baask8s snapshots

type Status

type Status struct {
	Authentication    bool   `json:"Authentication"`
	Baask8sManagement bool   `json:"Baask8sManagement"`
	Snapshot          bool   `json:"Snapshot"`
	Analytics         bool   `json:"Analytics"`
	Version           string `json:"Version"`
}

Status represents the application status

type TLSConfiguration

type 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"`
}

TLSConfiguration represents a TLS configuration

type TLSFileType

type TLSFileType int

TLSFileType represents a type of TLS file required to connect to a Docker baask8s. It can be either a TLS CA file, a TLS certificate file or a TLS key file

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
	// Other file
	TLSFileOther
)

type Tag

type Tag struct {
	ID   TagID
	Name string `json:"Name"`
}

Tag represents a tag that can be associated to a resource

type TagID

type TagID int

TagID represents a tag identifier

type TagService

type TagService interface {
	Tags() ([]Tag, error)
	CreateTag(tag *Tag) error
	DeleteTag(ID TagID) error
}

TagService represents a service for managing tag data

type Team

type Team struct {
	ID   TeamID `json:"Id"`
	Name string `json:"Name"`
}

Team represents a list of user accounts

type TeamID

type TeamID int

TeamID represents a team identifier

type TeamMembership

type TeamMembership struct {
	ID     TeamMembershipID `json:"Id"`
	UserID UserID           `json:"UserID"`
	TeamID TeamID           `json:"TeamID"`
	Role   MembershipRole   `json:"Role"`
}

TeamMembership represents a membership association between a user and a team

type TeamMembershipID

type TeamMembershipID int

TeamMembershipID represents a team membership identifier

type TeamMembershipService

type 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
}

TeamMembershipService represents a service for managing team membership data

type TeamResourceAccess

type TeamResourceAccess struct {
	TeamID      TeamID              `json:"TeamId"`
	AccessLevel ResourceAccessLevel `json:"AccessLevel"`
}

TeamResourceAccess represents the level of control on a resource for a specific team

type TeamService

type 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
}

TeamService represents a service for managing user data

type Template

type Template struct {
	// Mandatory container/stack fields
	ID                TemplateID   `json:"Id"`
	Type              TemplateType `json:"type"`
	Title             string       `json:"title"`
	Description       string       `json:"description"`
	AdministratorOnly bool         `json:"administrator_only"`

	// Mandatory container fields
	Image string `json:"image"`

	// Mandatory stack fields
	Repository TemplateRepository `json:"repository"`

	// Optional stack/container fields
	Name       string        `json:"name,omitempty"`
	Env        []TemplateEnv `json:"env,omitempty"`
	Note       string        `json:"note,omitempty"`
	Platform   string        `json:"platform,omitempty"`
	Categories []string      `json:"categories,omitempty"`

	// Optional container fields
	Registry      string           `json:"registry,omitempty"`
	Command       string           `json:"command,omitempty"`
	Network       string           `json:"network,omitempty"`
	Volumes       []TemplateVolume `json:"volumes,omitempty"`
	Ports         []string         `json:"ports,omitempty"`
	Labels        []Pair           `json:"labels,omitempty"`
	Privileged    bool             `json:"privileged,omitempty"`
	Interactive   bool             `json:"interactive,omitempty"`
	RestartPolicy string           `json:"restart_policy,omitempty"`
	Hostname      string           `json:"hostname,omitempty"`
}

Template represents an application template

type TemplateEnv

type TemplateEnv struct {
	Name        string              `json:"name"`
	Label       string              `json:"label,omitempty"`
	Description string              `json:"description,omitempty"`
	Default     string              `json:"default,omitempty"`
	Preset      bool                `json:"preset,omitempty"`
	Select      []TemplateEnvSelect `json:"select,omitempty"`
}

TemplateEnv represents a template environment variable configuration

type TemplateEnvSelect

type TemplateEnvSelect struct {
	Text    string `json:"text"`
	Value   string `json:"value"`
	Default bool   `json:"default"`
}

TemplateEnvSelect represents text/value pair that will be displayed as a choice for the template user

type TemplateID

type TemplateID int

TemplateID represents a template identifier

type TemplateRepository

type TemplateRepository struct {
	URL       string `json:"url"`
	StackFile string `json:"stackfile"`
}

TemplateRepository represents the git repository configuration for a template

type TemplateService

type TemplateService interface {
	Templates() ([]Template, error)
	Template(ID TemplateID) (*Template, error)
	CreateTemplate(template *Template) error
	UpdateTemplate(ID TemplateID, template *Template) error
	DeleteTemplate(ID TemplateID) error
}

TemplateService represents a service for managing template data

type TemplateType

type TemplateType int

TemplateType represents the type of a template

const (

	// ContainerTemplate represents a container template
	ContainerTemplate TemplateType
	// SwarmStackTemplate represents a template used to deploy a Swarm stack
	SwarmStackTemplate
	// ComposeStackTemplate represents a template used to deploy a Compose stack
	ComposeStackTemplate
)

type TemplateVolume

type TemplateVolume struct {
	Container string `json:"container"`
	Bind      string `json:"bind,omitempty"`
	ReadOnly  bool   `json:"readonly,omitempty"`
}

TemplateVolume represents a template volume configuration

type TokenData

type TokenData struct {
	ID       UserID
	Username string
	Role     UserRole
}

TokenData represents the data embedded in a JWT token

type User

type User struct {
	ID       UserID   `json:"Id"`
	Username string   `json:"Username"`
	Password string   `json:"Password,omitempty"`
	Role     UserRole `json:"Role"`
}

User represents a user account

type UserID

type UserID int

UserID represents a user identifier

type UserResourceAccess

type UserResourceAccess struct {
	UserID      UserID              `json:"UserId"`
	AccessLevel ResourceAccessLevel `json:"AccessLevel"`
}

UserResourceAccess represents the level of control on a resource for a specific user

type UserRole

type UserRole int

UserRole represents the role of a user. It can be either an administrator or a regular user

const (

	// AdministratorRole represents an administrator user role
	AdministratorRole UserRole
	// StandardUserRole represents a regular user role
	StandardUserRole
)

type UserService

type UserService interface {
	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
}

UserService represents a service for managing user data

type VersionService

type VersionService interface {
	DBVersion() (int, error)
	StoreDBVersion(version int) error
}

VersionService represents a service for managing version data

type Webhook

type Webhook struct {
	ID          WebhookID   `json:"Id"`
	Token       string      `json:"Token"`
	ResourceID  string      `json:"ResourceId"`
	Baask8sID   Baask8sID   `json:"Baask8sId"`
	WebhookType WebhookType `json:"Type"`
}

Webhook represents a url webhook that can be used to update a service

type WebhookID

type WebhookID int

WebhookID represents a webhook identifier.

type WebhookService

type WebhookService interface {
	Webhooks() ([]Webhook, error)
	Webhook(ID WebhookID) (*Webhook, error)
	CreateWebhook(baasapi *Webhook) error
	WebhookByResourceID(resourceID string) (*Webhook, error)
	WebhookByToken(token string) (*Webhook, error)
	DeleteWebhook(serviceID WebhookID) error
}

WebhookService represents a service for managing webhook data.

type WebhookType

type WebhookType int

WebhookType represents the type of resource a webhook is related to

const (

	// ServiceWebhook is a webhook for restarting a docker service
	ServiceWebhook WebhookType
)

Directories

Path Synopsis
api
cli
git
jwt
tag
build
cmd

Jump to

Keyboard shortcuts

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