Documentation
¶
Index ¶
- Constants
- Variables
- func ClosePlugins()
- func RegisterFactory(name string, f Factory)
- type Application
- type Auth
- type Cert
- type Configuration
- type Cron
- type CsrfValidator
- type DataCache
- type Decrypt
- type Factory
- type Function
- type Index
- type JWT
- type JWTInfo
- type License
- type Locker
- type Module
- type Namespace
- type Node
- type Object
- type PKI
- type PKIStorage
- type PermissionRequest
- type Plugin
- type Property
- type Pubsub
- type Quota
- type QuotaCollector
- type RequestContext
- type Resource
- type Secret
- type Shadow
- type Sign
- type SyncLink
- type Task
- type TransactionFactory
Constants ¶
View Source
const ( PermissionRead = "READ" PermissionFull = "FULL_CONTROL" PermissionResourceConfig = "config" PermissionResourceSecret = "secret" PermissionResourceApp = "app" PermissionResourceNode = "node" PermissionResourceBatch = "batch" PermissionResourceDevice = "device" PermissionResourceDeviceModel = "devicemodel" PermissionResourceDriver = "driver" )
View Source
const ( QuotaNode = "maxNodeCount" QuotaBatch = "maxBatchCount" MenuEnable = "menuEnable" )
Variables ¶
View Source
var (
ErrGetAuthorizedUserInfo = errors.New("failed to get authorized user info")
)
Functions ¶
func RegisterFactory ¶
RegisterFactory adds a supported plugin
Types ¶
type Application ¶
type Application interface {
GetApplication(tx interface{}, namespace, name, version string) (*v1.Application, error)
CreateApplication(tx interface{}, namespace string, application *v1.Application) (*v1.Application, error)
UpdateApplication(tx interface{}, namespace string, application *v1.Application) (*v1.Application, error)
DeleteApplication(tx interface{}, namespace, name string) error
ListApplication(tx interface{}, namespace string, listOptions *models.ListOptions) (*models.ApplicationList, error)
ListApplicationsByNames(tx interface{}, ns string, names []string) ([]models.AppItem, int, error)
}
type Auth ¶
type Auth interface {
Authenticate(c *common.Context) error
AuthAndVerify(c *common.Context, pr *PermissionRequest) error
Verify(c *common.Context, pr *PermissionRequest) error
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(tx interface{}, namespace, name, version string) (*v1.Configuration, error)
CreateConfig(tx interface{}, namespace string, configModel *v1.Configuration) (*v1.Configuration, error)
UpdateConfig(tx interface{}, namespace string, configurationModel *v1.Configuration) (*v1.Configuration, error)
DeleteConfig(tx interface{}, namespace, name string) error
ListConfig(namespace string, listOptions *models.ListOptions) (*models.ConfigurationList, error)
}
type CsrfValidator ¶ added in v2.3.0
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(tx interface{}, namespace string, keyA, keyB common.Resource, valueA string, valueBs []string) error
io.Closer
}
Index interface of Index
type Locker ¶ added in v2.2.0
type Locker interface {
// Lock lock the resource, Lock should be paired with Unlock.
// PARAMS:
// - name: the lock's name
// - ttl: expire time of lock, if 0, use default time.
// RETURNS:
// error: if has error else nil
Lock(ctx context.Context, name string, ttl int64) (string, error)
// Unlock release the lock by name
// PARAMS:
// - name: the lock's name
// RETURNS:
// error: if has error else nil
Unlock(ctx context.Context, name, version string)
io.Closer
}
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, tp common.ModuleType) ([]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)
GetLatestModuleImageTx(tx *sqlx.Tx, name string) (string, error)
GetLatestModuleProgramTx(tx *sqlx.Tx, name, platform string) (string, error)
// close
io.Closer
}
type Node ¶
type Node interface {
GetNode(tx interface{}, namespace, name string) (*v1.Node, error)
CreateNode(tx interface{}, namespace string, node *v1.Node) (*v1.Node, error)
UpdateNode(tx interface{}, namespace string, node []*v1.Node) ([]*v1.Node, error)
DeleteNode(tx interface{}, namespace, name string) error
ListNode(tx interface{}, namespace string, listOptions *models.ListOptions) (*models.NodeList, error)
CountAllNode(tx interface{}) (int, error)
GetNodeByNames(tx interface{}, namespace string, names []string) ([]v1.Node, 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
PutInternalObjectFromFile(userID, bucket, name, filename string) 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)
GenInternalPutObjectURL(userID, bucket, name string) (*models.ObjectURL, error)
ListExternalBuckets(info models.ExternalObjectInfo) ([]models.Bucket, error)
HeadExternalBucket(info models.ExternalObjectInfo, bucket string) error
CreateExternalBucket(info models.ExternalObjectInfo, bucket, permission string) error
ListExternalBucketObjects(info models.ExternalObjectInfo, bucket string, params *models.ObjectParams) (*models.ListObjectsResult, error)
PutExternalObject(info models.ExternalObjectInfo, bucket, name string, b []byte) error
PutExternalObjectFromFile(info models.ExternalObjectInfo, bucket, name, filename string) error
PutExternalObjectFromURL(info models.ExternalObjectInfo, bucket, name, url string) error
GetExternalObject(info models.ExternalObjectInfo, bucket, name string) (*models.Object, error)
HeadExternalObject(info models.ExternalObjectInfo, bucket, name string) (*models.ObjectMeta, error)
DeleteExternalObject(info models.ExternalObjectInfo, bucket, name string) 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 PermissionRequest ¶ added in v2.2.0
type PermissionRequest struct {
Region string `json:"region"`
Resource string `json:"resource"`
Permission []string `json:"permission"`
RequestContext RequestContext `json:"request_context"`
}
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 Quota ¶ added in v2.4.3
type Quota interface {
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 RequestContext ¶ added in v2.2.0
type Resource ¶ added in v2.2.0
type Resource interface {
Node
Application
Configuration
Secret
Namespace
io.Closer
}
type Secret ¶
type Secret interface {
GetSecret(tx interface{}, namespace, name, version string) (*v1.Secret, error)
CreateSecret(tx interface{}, namespace string, secretModel *v1.Secret) (*v1.Secret, error)
UpdateSecret(namespace string, secretMapModel *v1.Secret) (*v1.Secret, error)
DeleteSecret(tx interface{}, namespace, name string) error
ListSecret(namespace string, listOptions *models.ListOptions) (*models.SecretList, error)
}
type Shadow ¶
type Shadow interface {
Get(tx interface{}, namespace, name string) (*models.Shadow, error)
ListShadowByNames(tx interface{}, namespace string, names []string) ([]*models.Shadow, error)
Create(tx interface{}, shadow *models.Shadow) (*models.Shadow, error)
BatchCreateShadow(shadows []*models.Shadow) ([]*models.Shadow, error)
Delete(tx interface{}, namespace, name string) error
UpdateDesire(tx interface{}, shadow *models.Shadow) error
UpdateDesires(tx interface{}, shadows []*models.Shadow) error
UpdateReport(shadow *models.Shadow) (*models.Shadow, error)
List(namespace string, nodeList *models.NodeList) (*models.ShadowList, error)
ListAll(namespace string) (*models.ShadowList, error)
io.Closer
}
Shadow
type Sign ¶ added in v2.2.0
type Sign interface {
Signature(meta []byte) ([]byte, error)
Verify(meta, sign []byte) bool
io.Closer
}
Sign interfaces of Sign
type Task ¶ added in v2.1.1
type Task interface {
task.TaskProducer
task.TaskWorker
io.Closer
}
Task interface of Task
type TransactionFactory ¶ added in v2.2.0
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cache
|
|
|
localcache
Package localcache freecache implements a local cache for files
|
Package localcache freecache implements a local cache for files |
|
default
|
|
|
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
|
|
Click to show internal directories.
Click to hide internal directories.