Documentation ¶
Index ¶
- Constants
- Variables
- func AddSystemLabel(labels map[string]string, infos map[string]string) map[string]string
- func CompareNumericalString(a, b string) int
- func Error(c Code, fs ...*F) error
- func GetConfFile() string
- func GetTraceHeader() string
- func GetTraceKey() string
- func LoadConfig(cfg interface{}, files ...string) error
- func LogDirtyData(err error, fields ...log.Field)
- func PackageResponse(res interface{}) (int, interface{})
- func PopulateFailedMisResponse(cc *Context, err error, abort bool)
- func PopulateFailedResponse(cc *Context, err error, abort bool)
- func RandString(n int) string
- func SetConfFile(v string)
- func SetTraceHeader(v string)
- func SetTraceKey(v string)
- func UUID() string
- func UUIDPrune() string
- func UpdateSysAppByAccelerator(accelerator string, sysApps []string) []string
- func ValidIsInvisible(labels map[string]string) bool
- func ValidNonBaetyl(name string) bool
- func Wrapper(handler HandlerFunc) func(c *gin.Context)
- func WrapperMis(handler HandlerFunc) func(c *gin.Context)
- func WrapperRaw(handler HandlerFunc, abort bool) func(c *gin.Context)
- func WrapperWithLock(lockFunc LockFunc, unlockFunc UnlockFunc) func(c *gin.Context)
- type CertType
- type Code
- type Context
- func (c *Context) GetName() string
- func (c *Context) GetNameFromParam() string
- func (c *Context) GetNamespace() string
- func (c *Context) GetTrace() (k string, v string)
- func (c *Context) GetUser() User
- func (c *Context) GetUserInfo() UserInfo
- func (c *Context) LoadBody(obj interface{}) error
- func (c *Context) LoadBodyMulti(obj interface{}) error
- func (c *Context) SetName(n string)
- func (c *Context) SetNamespace(ns string)
- func (c *Context) SetTrace()
- func (c *Context) SetUser(user User)
- func (c *Context) SetUserInfo(info UserInfo)
- type Domain
- type Event
- type F
- type HandlerFunc
- type LockFunc
- type ModuleType
- type Resource
- type Role
- type Security
- type State
- type SyncMode
- type SystemApplication
- type UnlockFunc
- type User
- type UserInfo
- type VolumeType
Constants ¶
View Source
const ( // TimeFormat TimeFormat = "2006-01-02T15:04:05Z" // KeyContextNamespace the key of namespace in context KeyContextNamespace = "namespace" // ResourceName resource name ResourceName = "resourceName" // ResourceVersion resource version ResourceVersion = "resourceVersion" // ResourceInvisible resource invisible ResourceInvisible = "resource-invisible" // Application application resource Application Resource = "application" // App alias of application resource APP Resource = "app" // Configuration configuration resource Configuration Resource = "configuration" // Config config resource Config Resource = "config" // Secret secret resource Secret Resource = "secret" // Certificate certificate resource Certificate Resource = "certificate" // Registry registry resource Registry Resource = "registry" // Deprecated // Deployment deployment resource Deployment Resource = "deployment" // Node node resource Node Resource = "node" // Shadow shadow resource Shadow Resource = "shadow" // NodeDesire nodedesire resource NodeDesire Resource = "nodedesire" // NodeReport nodereport resource NodeReport Resource = "nodereport" // Batch batch resource Batch Resource = "batch" // Device device resource Device Resource = "device" // Driver driver resource Driver Resource = "driver" // DeviceModel devicemodel resource DeviceModel Resource = "devicemodel" // Index index resource Index Resource = "index" // !deprecated // DefaultConfigDir default host dir of config DefaultConfigDir = "var/db/baetyl" // DefaultLibDir lib dir of the service by default DefaultLibDir = "var/lib/baetyl" // DefaultBinDir the file path of master binary DefaultBinDir = "bin" // DefaultBinFile the file of master binary DefaultBinFile = "baetyl" // DefaultActiveWebPort the port of web active DefaultActiveWebPort = 30007 // The range of valid ports is 30000-32767 // AppConfFileName application config file name AppConfFileName = "application.yml" // DefaultSetupFile DefaultSetupFile = "setup.sh" // DefaultOffActivationFile DefaultOffActivationFile = "offlineActivation.sh" // DefaultOnActivationFile DefaultOnActivationFile = "onlineActivation.sh" // DefaultMasterConfDir master config dir by default DefaultMasterConfDir = "etc/baetyl" // DefaultMasterConfFile master config file by default DefaultMasterConfFile = "conf.yml" // DefaultMasterPlistFile DefaultMasterPlistFile = "baetyl.plist" // DefaultMasterDaemonFile DefaultMasterDaemonFile = "baetyl.service" // DefaultCoreFrequency DefaultCoreFrequency = "20" // DefaultCoreAPIPort DefaultCoreAPIPort = "30050" // ComposeVersion compose version ComposeVersion = "3" // Bind bind Bind VolumeType = "bind" // Volume volume Volume VolumeType = "volume" DesiredApplications = "apps" DesiredSysApplications = "sysapps" // Receive receive Receive State = "RECEIVE" // Deploy deploy Deploy State = "DEPLOYED" // Updating updating Updating State = "UPDATING" // Updated updated Updated State = "UPDATED" // Timeout timeout Timeout State = "TIMEOUT" // Failure failure Failure State = "FAILURE" // Secret type SecretRegistry = "registry" SecretConfig = "config" MaxRetryNum = 20 // LabelKeyFunction tag of function LabelKeyFunction = "baetyl-function" LabelNodeName = "baetyl-node-name" LabelAppName = "baetyl-app-name" LabelSystem = "baetyl-cloud-system" LabelBatch = "baetyl-batch" LabelAccelerator = "baetyl-accelerator" LabelCluster = "baetyl-cluster" LabelNodeMode = "baetyl-node-mode" LabelAppMode = "baetyl-app-mode" )
View Source
const ( BaetylCloud = "baetyl-cloud" BaetylCloudGroup = "cloud.baetyl.io" Description = "description" UpdateTimestamp = "updateTimestamp" Metadata = "matadata" PkiCertID = "pkiCertID" NodeSelector = "nodeSelector" AnnotationDescription = BaetylCloudGroup + "/" + Description AnnotationUpdateTimestamp = BaetylCloudGroup + "/" + UpdateTimestamp AnnotationMetadata = BaetylCloudGroup + "/" + Metadata AnnotationPkiCertID = BaetylCloudGroup + "/" + PkiCertID AnnotationNodeSelector = BaetylCloudGroup + "/" + NodeSelector )
View Source
const ( None Security = "None" Token Security = "Token" Cert Security = "Cert" Dongle Security = "Dongle" DefaultActiveTime = 1167580800 //todo avoid mysql ERROR 1292. "2007-01-01 00:00:00" s DefaultSN = "agent-sn" DefaultSNPath = "/var/lib/baetyl/sn" DefaultSNFile = "fingerprint.txt" DefaultInputField = "sn" DefaultAgentConfigMount = "/etc/baetyl" FingerprintSN = 0x1 FingerprintInput = 0x2 FingerprintHostName = 0x4 FingerprintBootID = 0x8 FingerprintSystemUUID = 0x10 FingerprintMachineID = 0x20 FilenameYamlService = "service.yml" PageSize = 20 Online = "online" Offline = "offline" Success Event = "success" Nothing Event = "nothing" Failed Event = "failed" Inactivated = 0x0 Activated = 0x1 DisableWhitelist = 0x0 EnableWhitelist = 0x1 )
View Source
const ( AWSS3ReadPermission = "public-read" AWSS3WritePermission = "public-read-write" AWSS3PrivatePermission = "private" )
View Source
const ( ContainerApp = "container" FunctionApp = "function" )
View Source
const ( ReportMeta = "reportMeta" DesireMeta = "desireMeta" NodeProps = "nodeprops" NodeInfo = "node" NodeStats = "nodestats" )
View Source
const ( KeyConfFile = "ConfFile" ValueConfFile = "etc/baetyl/cloud.yml" KeyTraceKey = "TraceKey" ValueTraceKey = "requestId" KeyTraceHeader = "TraceHeader" ValueTraceHeader = "x-bce-request-id" // TODO: change to x-baetyl-request-id when support configuration RegistryAuth = "system-registry-auth" )
View Source
const ( // * plugin ErrPluginNotFound Code = "ErrPluginNotFound" ErrPluginInvalid = "ErrPluginInvalid" // * request ErrRequestAccessDenied = "ErrRequestAccessDenied" ErrRequestMethodNotFound = "ErrRequestMethodNotFound" ErrRequestParamInvalid = "ErrRequestParamInvalid" // * resource ErrResourceNotFound = "ErrResourceNotFound" ErrResourceAccessForbidden = "ErrResourceAccessForbidden" ErrResourceConflict = "ErrResourceConflict" ErrResourceDeleteForbidden = "ErrResourceDeleteForbidden" ErrResourceHasBeenUsed = "ErrResourceHasBeenUsed" ErrNodeNotReady = "ErrNodeNotReady" ErrInvalidToken = "ErrInvalidToken" // * volumes ErrVolumeType = "ErrVolumeType" // * unknown ErrUnknown = "UnknownError" // * application ErrAppNameConflict = "ErrAppNameConflict" ErrVolumeNotFoundWhenMount = "ErrVolumeNotFoundWhenMount" ErrAppReferencedByNode = "ErrAppReferencedByNode" // * node ErrNodeNumMaxLimit = "ErrNodeNumMaxLimit" ErrNodeNumQueryException = "ErrNodeNumQueryException" // * config ErrConfigInUsed = "ErrConfigInUsed" // * register ErrRegisterQuotaNumOut = "ErrRegisterQuotaNumOut" ErrRegisterDeleteRecord = "ErrRegisterDeleteRecord" ErrRegisterDeleteCallback = "ErrRegisterDeleteCallback" ErrRegisterPackage = "ErrRegisterPackage" ErrRegisterRecordActivated = "ErrRegisterRecordActivated" // * db ErrDatabase = "ErrDatabase" ErrUpdateCas = "ErrUpdateCas" // * k8s ErrK8S = "ErrK8S" // * ceph ErrCeph = "ErrCeph" // * io ErrIO = "ErrIO" // * template ErrTemplate = "ErrTemplate" // * function ErrFunction = "ErrFunction" // * resourceName ErrInvalidResourceName = "resourceName" ErrInvalidLabels = "validLabels" ErrInvalidRequired = "required" // * batchOp ErrInvalidArrayLength = "maxLength" // * fingerprintValue ErrInvalidFingerprintValue = "fingerprintValue" // * memory ErrInvalidMemory = "memory" // * duration ErrInvalidDuration = "duration" // * setcpus ErrInvalidSetcpus = "setcpus" // * nonBaetyl ErrInvalidName = "nonBaetyl" // * license ErrLicenseExpired = "ErrLicenseExpired" ErrLicenseQuota = "ErrLicenseQuota" ErrLicenseQuotaAcquire = "ErrLicenseQuotaAcquire" ErrLicenseQuotaRelease = "ErrLicenseQuotaRelease" // * third server error ErrThirdServer = "ErrThirdServer" // * object error ErrObjectOperationException = "ErrObjectOperationException" ErrResourceInvisible = "ErrResourceInvisible" ErrConvertConflict = "ErrConvertConflict" ErrPubsubTimeout = "ErrPubsubTimeout" ErrUpdateSubLabels = "ErrUpdateSubLabels" )
all codes
View Source
const (
ConfigObjectPrefix = "_object_"
)
View Source
const (
TaskNamespaceDelete = "namespace-delete"
)
View Source
const (
UnpackTypeZip = "zip"
)
Variables ¶
View Source
var ( // Todo use global.go Cache map[string]string FingerprintMap = map[int]string{ FingerprintSN: "sn", FingerprintInput: "input", FingerprintHostName: "hostName", FingerprintBootID: "bootID", FingerprintSystemUUID: "systemUUID", FingerprintMachineID: "machineID", } )
Functions ¶
func AddSystemLabel ¶
func CompareNumericalString ¶
func GetConfFile ¶
func GetConfFile() string
func GetTraceHeader ¶
func GetTraceHeader() string
func GetTraceKey ¶
func GetTraceKey() string
func LoadConfig ¶
func LogDirtyData ¶
func PackageResponse ¶
func PackageResponse(res interface{}) (int, interface{})
PackageResponse PackageResponse
func PopulateFailedMisResponse ¶
PopulateFailedMisResponse PopulateFailedMisResponse
func PopulateFailedResponse ¶
PopulateFailedResponse PopulateFailedResponse
func RandString ¶
RandString
- param n: suggest at least 10 to avoid conflict
referred to https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-go
func SetConfFile ¶
func SetConfFile(v string)
func SetTraceHeader ¶
func SetTraceHeader(v string)
func SetTraceKey ¶
func SetTraceKey(v string)
func UpdateSysAppByAccelerator ¶ added in v2.2.0
func ValidIsInvisible ¶ added in v2.2.0
func ValidNonBaetyl ¶ added in v2.2.0
func Wrapper ¶
func Wrapper(handler HandlerFunc) func(c *gin.Context)
Wrapper Wrapper TODO: to use gin.HandlerFunc ?
func WrapperMis ¶
func WrapperMis(handler HandlerFunc) func(c *gin.Context)
func WrapperRaw ¶
func WrapperRaw(handler HandlerFunc, abort bool) func(c *gin.Context)
func WrapperWithLock ¶ added in v2.2.0
func WrapperWithLock(lockFunc LockFunc, unlockFunc UnlockFunc) func(c *gin.Context)
WrapperWithLock wrap handler with lock
Types ¶
type Context ¶
Context context
func NewContext ¶
NewContext create a new context with gin context
func (*Context) GetNameFromParam ¶
GetNameFromParam gets name from param if exists
func (*Context) GetNamespace ¶
GetNamespace gets namespace from context if exists
func (*Context) GetUserInfo ¶ added in v2.3.0
GetUser gets user info from context if exists
func (*Context) LoadBodyMulti ¶ added in v2.3.0
func (*Context) SetNamespace ¶
SetNamespace sets namespace into context
func (*Context) SetUserInfo ¶ added in v2.3.0
SetUser sets user info into context
type ModuleType ¶ added in v2.2.0
type ModuleType string
const ( TypeUser ModuleType = "user" TypeUserRuntime ModuleType = "runtime_user" TypeSystem ModuleType = "system" TypeSystemOptional ModuleType = "opt_system" TypeSystemKube ModuleType = "opt_system_kube" TypeSystemNative ModuleType = "opt_system_native" )
type SystemApplication ¶
type SystemApplication string
type UnlockFunc ¶ added in v2.2.0
type VolumeType ¶
type VolumeType string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.