plugin

package
v2.0.1-rc58 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 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 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 DBStorage

type DBStorage interface {
	Transact(func(*sqlx.Tx) error) error

	// 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

	// batch
	GetBatch(name, ns string) (*models.Batch, error)
	ListBatch(ns string, filter *models.Filter) ([]models.Batch, error)
	CreateBatch(batch *models.Batch) (sql.Result, error)
	UpdateBatch(batch *models.Batch) (sql.Result, error)
	DeleteBatch(name, ns string) (sql.Result, error)
	CountBatch(ns, name string) (int, error)
	CountBatchByCallback(callbackName, ns string) (int, error)
	GetBatchTx(tx *sqlx.Tx, name, ns string) (*models.Batch, error)
	ListBatchTx(tx *sqlx.Tx, ns string, filter *models.Filter) ([]models.Batch, error)
	CreateBatchTx(tx *sqlx.Tx, batch *models.Batch) (sql.Result, error)
	UpdateBatchTx(tx *sqlx.Tx, batch *models.Batch) (sql.Result, error)
	DeleteBatchTx(tx *sqlx.Tx, name, ns string) (sql.Result, error)
	CountBatchTx(tx *sqlx.Tx, ns, name string) (int, error)
	CountBatchByCallbackTx(tx *sqlx.Tx, callbackName, ns string) (int, error)

	// record
	CountRecord(batchName, fingerprintValue, ns string) (int, error)
	GetRecord(batchName, recordName, ns string) (*models.Record, error)
	GetRecordByFingerprint(batchName, ns, value string) (*models.Record, error)
	ListRecord(batchName, ns string, filter *models.Filter) ([]models.Record, error)
	CreateRecord(records []models.Record) (sql.Result, error)
	UpdateRecord(record *models.Record) (sql.Result, error)
	DeleteRecord(batchName, recordName, ns string) (sql.Result, error)
	GetRecordTx(tx *sqlx.Tx, batchName, recordName, ns string) (*models.Record, error)
	CountRecordTx(tx *sqlx.Tx, batchName, fingerprintValue, ns string) (int, error)
	GetRecordByFingerprintTx(tx *sqlx.Tx, batchName, ns, value string) (*models.Record, error)
	ListRecordTx(tx *sqlx.Tx, batchName, ns string, filter *models.Filter) ([]models.Record, error)
	CreateRecordTx(tx *sqlx.Tx, records []models.Record) (sql.Result, error)
	UpdateRecordTx(tx *sqlx.Tx, record *models.Record) (sql.Result, error)
	DeleteRecordTx(tx *sqlx.Tx, batchName, recordName, ns string) (sql.Result, error)

	// task
	CreateTask(task *models.Task) (sql.Result, error)
	UpdateTask(task *models.Task) (sql.Result, error)
	GetTask(traceId string) (*models.Task, error)
	DeleteTask(traceId string) (sql.Result, error)
	CountTask(task *models.Task) (int, error)

	GetTaskTx(tx *sqlx.Tx, traceId string) (*models.Task, error)
	CreateTaskTx(tx *sqlx.Tx, task *models.Task) (sql.Result, error)
	UpdateTaskTx(tx *sqlx.Tx, task *models.Task) (sql.Result, error)
	DeleteTaskTx(tx *sqlx.Tx, traceId string) (sql.Result, error)

	// callback
	GetCallback(name, namespace string) (*models.Callback, error)
	CreateCallback(callback *models.Callback) (sql.Result, error)
	UpdateCallback(callback *models.Callback) (sql.Result, error)
	DeleteCallback(name, ns string) (sql.Result, error)
	GetCallbackTx(tx *sqlx.Tx, name, namespace string) (*models.Callback, error)
	CreateCallbackTx(tx *sqlx.Tx, callback *models.Callback) (sql.Result, error)
	UpdateCallbackTx(tx *sqlx.Tx, callback *models.Callback) (sql.Result, error)
	DeleteCallbackTx(tx *sqlx.Tx, name, ns string) (sql.Result, error)

	// application
	CreateApplication(app *specV1.Application) (sql.Result, error)
	UpdateApplication(app *specV1.Application, oldVersion string) (sql.Result, error)
	DeleteApplication(name, namespace, version string) (sql.Result, error)
	GetApplication(name, namespace, version string) (*specV1.Application, error)
	ListApplication(namespace string, filter *models.Filter) ([]specV1.Application, error)
	CreateApplicationWithTx(tx *sqlx.Tx, app *specV1.Application) (sql.Result, error)
	UpdateApplicationWithTx(tx *sqlx.Tx, app *specV1.Application, oldVersion string) (sql.Result, error)
	DeleteApplicationWithTx(tx *sqlx.Tx, name, namespace, version string) (sql.Result, error)
	CountApplication(tx *sqlx.Tx, name, namespace string) (int, error)

	Shadow
}

DBStorage DBStorage

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 License

type License interface {
	ProtectCode() error
	CheckLicense() error
	GetQuota(namespace string) (map[string]int, error)
	io.Closer
}

type MessageQueue

type MessageQueue interface {
	mq.MessageQueue
}

type ModelStorage

type ModelStorage interface {
	GetNamespace(namespace string) (*models.Namespace, error)
	CreateNamespace(namespace *models.Namespace) (*models.Namespace, error)
	DeleteNamespace(namespace *models.Namespace) error

	GetNode(namespace, name string) (*specV1.Node, error)
	CreateNode(namespace string, node *specV1.Node) (*specV1.Node, error)
	UpdateNode(namespace string, node *specV1.Node) (*specV1.Node, error)
	DeleteNode(namespace, name string) error
	ListNode(namespace string, listOptions *models.ListOptions) (*models.NodeList, error)

	GetConfig(namespace, name, version string) (*specV1.Configuration, error)
	CreateConfig(namespace string, config *specV1.Configuration) (*specV1.Configuration, error)
	UpdateConfig(namespace string, config *specV1.Configuration) (*specV1.Configuration, error)
	DeleteConfig(namespace, name string) error
	ListConfig(namespace string, listOptions *models.ListOptions) (*models.ConfigurationList, error)

	GetApplication(namespace, name, version string) (*specV1.Application, error)
	CreateApplication(namespace string, application *specV1.Application) (*specV1.Application, error)
	UpdateApplication(namespace string, application *specV1.Application) (*specV1.Application, error)
	DeleteApplication(namespace, name string) error
	ListApplication(namespace string, listOptions *models.ListOptions) (*models.ApplicationList, error)

	GetSecret(namespace, name, version string) (*specV1.Secret, error)
	CreateSecret(namespace string, config *specV1.Secret) (*specV1.Secret, error)
	UpdateSecret(namespace string, config *specV1.Secret) (*specV1.Secret, error)
	DeleteSecret(namespace, name string) error
	ListSecret(namespace string, listOptions *models.ListOptions) (*models.SecretList, error)

	IsLabelMatch(labelSelector string, labels map[string]string) (bool, error)

	Shadow
}

ModelStorage ModelStorage

type Namespace

type Namespace interface {
	GetNamespace(namespace string) (*models.Namespace, error)
	CreateNamespace(namespace *models.Namespace) (*models.Namespace, 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 QuotaCollector

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

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
}

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