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 Wrapper(handler HandlerFunc) func(c *gin.Context)
- func WrapperMis(handler HandlerFunc) func(c *gin.Context)
- func WrapperRaw(handler HandlerFunc) 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) LoadBody(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)
- type Event
- type F
- type HandlerFunc
- type Resource
- type Security
- type State
- type SystemApplication
- type User
- 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" // 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" // 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" // 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" // 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" )
View Source
const ( BaetylCloud = "baetyl-cloud" BaetylCloudGroup = "cloud.baetyl.io" Description = "description" UpdateTimestamp = "updateTimestamp" Metadata = "matadata" PkiCertID = "pkiCertID" AnnotationDescription = BaetylCloudGroup + "/" + Description AnnotationUpdateTimestamp = BaetylCloudGroup + "/" + UpdateTimestamp AnnotationMetadata = BaetylCloudGroup + "/" + Metadata AnnotationPkiCertID = BaetylCloudGroup + "/" + PkiCertID )
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 ( 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 )
View Source
const ( // * plugin ErrPluginNotFound Code = "ErrPluginNotFound" ErrPluginInvalid = "ErrPluginInvalid" // * request ErrRequestAccessDenied = "ErrRequestAccessDenied" ErrRequestMethodNotFound = "ErrRequestMethodNotFound" ErrRequestParamInvalid = "ErrRequestParamInvalid" // * resource ErrResourceNotFound = "ErrResourceNotFound" ErrResourceAccessForbidden = "ErrResourceAccessForbidden" ErrResourceConflict = "ErrResourceConflict" 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" // * 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 ErrLicenseQuota = "ErrLicenseQuota" // * third server error ErrThirdServer = "ErrThirdServer" // * object error ErrObjectOperationException = "ErrObjectOperationException" )
all codes
View Source
const (
ConfigObjectPrefix = "_object_"
)
View Source
const (
UnpackTypeZip = "zip"
)
Variables ¶
View Source
var ( // Todo use global.go Cache map[string]string FingerprintMap = map[int]string{ 0x1: "sn", 0x2: "input", 0x4: "hostName", 0x8: "bootID", 0x10: "systemUUID", 0x20: "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 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) func(c *gin.Context)
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) SetNamespace ¶
SetNamespace sets namespace into context
type SystemApplication ¶
type SystemApplication string
type VolumeType ¶
type VolumeType string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.