plugin

package
v2.2.0-rc71 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuotaNode  = "maxNodeCount"
	QuotaBatch = "maxBatchCount"
)

Variables

This section is empty.

Functions

func ClosePlugins

func ClosePlugins()

ClosePlugins ClosePlugins

func RegisterFactory

func RegisterFactory(name string, f Factory)

RegisterFactory adds a supported plugin

Types

type AppHistory added in v2.1.1

type AppHistory interface {
	CreateApplicationHis(app *v1.Application) (sql.Result, error)
	UpdateApplicationHis(app *v1.Application, oldVersion string) (sql.Result, error)
	DeleteApplicationHis(name, namespace, version string) (sql.Result, error)
	GetApplicationHis(name, namespace, version string) (*v1.Application, error)
	ListApplicationHis(namespace string, filter *models.Filter) ([]v1.Application, error)
	CreateApplicationHisWithTx(tx *sqlx.Tx, app *v1.Application) (sql.Result, error)
	UpdateApplicationHisWithTx(tx *sqlx.Tx, app *v1.Application, oldVersion string) (sql.Result, error)
	DeleteApplicationHisWithTx(tx *sqlx.Tx, name, namespace, version string) (sql.Result, error)
	CountApplicationHis(tx *sqlx.Tx, name, namespace string) (int, error)
	io.Closer
}

type Application

type Application interface {
	GetApplication(namespace, name, version string) (*v1.Application, error)
	CreateApplication(namespace string, application *v1.Application) (*v1.Application, error)
	UpdateApplication(namespace string, application *v1.Application) (*v1.Application, error)
	DeleteApplication(namespace, name string) error
	ListApplication(namespace string, listOptions *models.ListOptions) (*models.ApplicationList, error)
}

type Auth

type Auth interface {
	Authenticate(c *common.Context) error
	SignToken(meta []byte) ([]byte, error)
	VerifyToken(meta, sign []byte) bool
	io.Closer
}

Auth interfaces of auth

type Cert

type Cert struct {
	CertId      string    `db:"cert_id"`
	ParentId    string    `db:"parent_id"`
	Type        string    `db:"type"`
	CommonName  string    `db:"common_name"`
	Csr         string    `db:"csr"`         // base64
	Content     string    `db:"content"`     // base64
	PrivateKey  string    `db:"private_key"` // base64
	Description string    `db:"description"`
	NotBefore   time.Time `db:"not_before"`
	NotAfter    time.Time `db:"not_after"`
}

type Configuration

type Configuration interface {
	GetConfig(namespace, name, version string) (*v1.Configuration, error)
	CreateConfig(namespace string, configModel *v1.Configuration) (*v1.Configuration, error)
	UpdateConfig(namespace string, configurationModel *v1.Configuration) (*v1.Configuration, error)
	DeleteConfig(namespace, name string) error
	ListConfig(namespace string, listOptions *models.ListOptions) (*models.ConfigurationList, error)
}

type Factory

type Factory func() (Plugin, error)

Factory create engine by given config

type Function

type Function interface {
	List(userID string) ([]models.Function, error)
	ListFunctionVersions(userID, name string) ([]models.Function, error)
	Get(userID, name, version string) (*models.Function, error)
	io.Closer
}

Function interface of Function

type Index added in v2.1.1

type Index interface {
	// index
	CreateIndex(namespace string, keyA, keyB common.Resource, valueA, valueB string) (sql.Result, error)
	ListIndex(namespace string, keyA, byKeyB common.Resource, valueB string) ([]string, error)
	DeleteIndex(namespace string, keyA, byKeyB common.Resource, valueB string) (sql.Result, error)
	CreateIndexTx(tx *sqlx.Tx, namespace string, keyA, keyB common.Resource, valueA, valueB string) (sql.Result, error)
	ListIndexTx(tx *sqlx.Tx, namespace string, keyA, byKeyB common.Resource, valueB string) ([]string, error)
	DeleteIndexTx(tx *sqlx.Tx, namespace string, keyA, byKeyB common.Resource, valueB string) (sql.Result, error)
	RefreshIndex(namespace string, keyA, keyB common.Resource, valueA string, valueBs []string) error
	io.Closer
}

Index interface of Index

type License

type License interface {
	ProtectCode() error
	CheckLicense() error
	GetQuota(namespace string) (map[string]int, error)
	GetDefaultQuotas(namespace string) (map[string]int, error)
	CreateQuota(namespace string, quotas map[string]int) error
	UpdateQuota(namespace, quotaName string, quota int) error
	AcquireQuota(namespace, quotaName string, number int) error
	ReleaseQuota(namespace, quotaName string, number int) error
	DeleteQuota(namespace, quotaName string) error
	DeleteQuotaByNamespace(namespace string) error
	io.Closer
}

type Locker added in v2.2.0

type Locker interface {

	// Lock lock the resource
	// PARAMS:
	//   - name: the lock's name
	// RETURNS:
	//   true: if locked success
	//   error: if has error else nil
	Lock(name string) (bool, error)

	// LockWithExpireTime lock the resouce with expire time
	// PARAMS:
	//   - name: the lock's name
	//   - expireTime(seconds): the expire time of the lock, if acquired the lock
	// RETURNS:
	//   true: if locked success
	//   error: if has error else nil
	LockWithExpireTime(name string, expireTime int64) (bool, error)

	// ReleaseLock release the lock by name
	// PARAMS:
	//	 - name: the lock's name
	// RETURNS:
	//   true: if lock is released
	//   error: if has error else nil
	ReleaseLock(name string) (bool, error)
}

Locker - the lock manager for baetyl cloud

type Module added in v2.2.0

type Module interface {
	GetModules(name string) ([]models.Module, error)
	GetModuleByVersion(name, version string) (*models.Module, error)
	GetModuleByImage(name, image string) (*models.Module, error)
	GetLatestModule(name string) (*models.Module, error)
	CreateModule(module *models.Module) (*models.Module, error)
	UpdateModuleByVersion(module *models.Module) (*models.Module, error)
	DeleteModules(name string) error
	DeleteModuleByVersion(name, version string) error
	ListModules(filter *models.Filter) ([]models.Module, error)
	ListOptionalSysModules(filter *models.Filter) ([]models.Module, error)
	ListRuntimeModules(filter *models.Filter) ([]models.Module, error)
	GetLatestModuleImage(name string) (string, error)
	GetLatestModuleProgram(name, platform string) (string, error)

	GetModuleTx(tx *sqlx.Tx, name string) ([]models.Module, error)
	GetModuleByVersionTx(tx *sqlx.Tx, name, version string) (*models.Module, error)
	GetModuleByImageTx(tx *sqlx.Tx, name, image string) (*models.Module, error)
	GetLatestModuleTx(tx *sqlx.Tx, name string) (*models.Module, error)
	CreateModuleTx(tx *sqlx.Tx, module *models.Module) error
	UpdateModuleByVersionTx(tx *sqlx.Tx, module *models.Module) error
	DeleteModulesTx(tx *sqlx.Tx, name string) error
	DeleteModuleByVersionTx(tx *sqlx.Tx, name, version string) error
	ListModulesTx(tx *sqlx.Tx, filter *models.Filter) ([]models.Module, error)
	ListOptionalSysModulesTx(tx *sqlx.Tx, filter *models.Filter) ([]models.Module, error)
	ListRuntimeModulesTx(tx *sqlx.Tx, filter *models.Filter) ([]models.Module, error)
	GetLatestModuleImageTx(tx *sqlx.Tx, name string) (string, error)
	GetLatestModuleProgramTx(tx *sqlx.Tx, name, platform string) (string, error)

	// close
	io.Closer
}

type Namespace

type Namespace interface {
	GetNamespace(namespace string) (*models.Namespace, error)
	CreateNamespace(namespace *models.Namespace) (*models.Namespace, error)
	ListNamespace(listOptions *models.ListOptions) (*models.NamespaceList, error)
	DeleteNamespace(namespace *models.Namespace) error
}

type Node

type Node interface {
	GetNode(namespace, name string) (*v1.Node, error)
	CreateNode(namespace string, node *v1.Node) (*v1.Node, error)
	UpdateNode(namespace string, node *v1.Node) (*v1.Node, error)
	DeleteNode(namespace, name string) error
	ListNode(namespace string, listOptions *models.ListOptions) (*models.NodeList, error)
}

type Object

type Object interface {
	IsAccountEnabled() bool

	ListInternalBuckets(userID string) ([]models.Bucket, error)
	HeadInternalBucket(userID, bucket string) error
	CreateInternalBucket(userID, bucket, permission string) error
	ListInternalBucketObjects(userID, bucket string, params *models.ObjectParams) (*models.ListObjectsResult, error)
	PutInternalObject(userID, bucket, name string, b []byte) error
	PutInternalObjectFromURL(userID, bucket, name, url string) error
	GetInternalObject(userID, bucket, name string) (*models.Object, error)
	HeadInternalObject(userID, bucket, name string) (*models.ObjectMeta, error)
	DeleteInternalObject(userID, bucket, name string) error
	GenInternalObjectURL(userID, bucket, name string) (*models.ObjectURL, error)

	ListExternalBuckets(info models.ExternalObjectInfo) ([]models.Bucket, error)
	HeadExternalBucket(info models.ExternalObjectInfo, bucket string) error
	ListExternalBucketObjects(info models.ExternalObjectInfo, bucket string, params *models.ObjectParams) (*models.ListObjectsResult, error)
	GenExternalObjectURL(info models.ExternalObjectInfo, bucket, name string) (*models.ObjectURL, error)

	io.Closer
}

Object Object TODO: userID doesn't belong to Object, should in the metedata

type PKI

type PKI interface {
	// root cert
	GetRootCertId() string
	// info : 生成根证书的相关信息   parentId : 上一级根证书id,可为空
	CreateRootCert(info *x509.CertificateRequest, parentId string) (string, error)
	GetRootCert(rootId string) ([]byte, error)
	DeleteRootCert(rootId string) error

	// server cert
	CreateServerCert(csr []byte, rootId string) (string, error)
	GetServerCert(certId string) ([]byte, error)
	DeleteServerCert(certId string) error

	// client cert
	CreateClientCert(csr []byte, rootId string) (string, error)
	GetClientCert(certId string) ([]byte, error)
	DeleteClientCert(certId string) error

	// close
	io.Closer
}

type PKIStorage

type PKIStorage interface {
	CreateCert(cert Cert) error
	DeleteCert(certId string) error
	UpdateCert(cert Cert) error
	GetCert(certId string) (*Cert, error)
	CountCertByParentId(parentId string) (int, error)
	io.Closer
}

type Plugin

type Plugin interface {
	io.Closer
}

Plugin interfaces

func GetPlugin

func GetPlugin(name string) (Plugin, error)

GetPlugin GetPlugin

type Property

type Property interface {
	GetProperty(name string) (*models.Property, error)
	CreateProperty(property *models.Property) error
	DeleteProperty(name string) error
	ListProperty(page *models.Filter) ([]models.Property, error) //Pagination
	CountProperty(name string) (int, error)
	UpdateProperty(property *models.Property) error

	GetPropertyValue(name string) (string, error)

	io.Closer
}

type Pubsub

type Pubsub interface {
	pubsub.Pubsub
}

type QuotaCollector

type QuotaCollector func(namespace string) (map[string]int, error)

type Resource added in v2.2.0

type Resource interface {
	Node
	Application
	Configuration
	Secret
	Namespace
	io.Closer
}

type Secret

type Secret interface {
	GetSecret(namespace, name, version string) (*v1.Secret, error)
	CreateSecret(namespace string, SecretModel *v1.Secret) (*v1.Secret, error)
	UpdateSecret(namespace string, SecretMapModel *v1.Secret) (*v1.Secret, error)
	DeleteSecret(namespace, name string) error
	ListSecret(namespace string, listOptions *models.ListOptions) (*models.SecretList, error)
}

type Shadow

type Shadow interface {
	Get(namespace, name string) (*models.Shadow, error)
	Create(shadow *models.Shadow) (*models.Shadow, error)
	Delete(namespace, name string) error
	UpdateDesire(shadow *models.Shadow) (*models.Shadow, error)
	UpdateReport(shadow *models.Shadow) (*models.Shadow, error)
	List(namespace string, nodeList *models.NodeList) (*models.ShadowList, error)
	io.Closer
}

Shadow

type SyncLink interface {
	Start()
	AddMsgRouter(k string, v interface{})
	io.Closer
}

type Task added in v2.1.1

type Task interface {
	CreateTask(task *models.Task) (bool, error)
	GetTask(name string) (*models.Task, error)
	AcquireTaskLock(task *models.Task) (bool, error)
	GetNeedProcessTask(number int32, expiredSeconds int32) ([]*models.Task, error)
	UpdateTask(task *models.Task) (bool, error)
	DeleteTask(taskName string) (bool, error)

	io.Closer
}

Task interface of Task

Directories

Path Synopsis
default
pki
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/cloud/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/cloud/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
link

Jump to

Keyboard shortcuts

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