Documentation ¶
Index ¶
- Constants
- Variables
- func AesDecrypt(encrypted string, key string) (string, error)
- func AesEncrypt(orig string, key string) (string, error)
- func BindJSON(r *http.Request, data interface{}) error
- func CheckFsNested(path1, path2 string) bool
- func CheckKerberosProperties(properties map[string]string) error
- func CheckPermission(requestUserName, ownerUserName, resourceType, resourceID string) error
- func ConnectionClosedError() error
- func DbDataNotExitError(errMsg string) error
- func DecryptPk(data string) (int64, error)
- func DuplicatedContentError(resourceType, md5, fsID string) error
- func DuplicatedNameError(resourceType, name, fsID string) error
- func EncryptPk(pk int64) (string, error)
- func FileTypeNotSupportedError(fileType, resourceType string) error
- func FsBeingUsedError(fsID string) error
- func GetAESEncryptKey() string
- func GetHttpStatusByCode(code string) int
- func GetMD5Hash(content []byte) string
- func GetMessageByCode(code string) string
- func GetRequestContext(r *http.Request) logger.RequestContext
- func ID(userName, fsName string) string
- func InformationFromURL(url string, properties map[string]string) (fileSystemType, serverAddress, subPath string)
- func InvalidField(field string, info string) error
- func InvalidMaxKeysError(maxKeys string) error
- func InvalidNamePatternError(name, resourceType, reg string) error
- func InvalidStartEndParams() error
- func InvalidStatisticsParams(param string) error
- func IsDNS1123Label(value string) []string
- func IsRootUser(userName string) bool
- func IsRunFinalStatus(status string) bool
- func IsValidQueueStatus(status string) bool
- func LinkPathError(fsPath string) error
- func LogFilePositionInvalidValueError() error
- func LogPageSizeOverMaxError() error
- func New(text string) error
- func NoAccessError(user, resourceType, resourceID string) error
- func NotFoundError(resourceType, ID string) error
- func PKCS7Padding(ciphertext []byte, blocksize int) []byte
- func PKCS7UnPadding(origData []byte) ([]byte, error)
- func PVCNotFountError(pvc, namespace string) error
- func RemoveDuplicateStr(strSlice []string) []string
- func Render(w http.ResponseWriter, httpCode int, data interface{})
- func RenderErr(w http.ResponseWriter, requestID string, code string)
- func RenderErrWithMessage(w http.ResponseWriter, requestID string, code string, message string)
- func RenderStatus(w http.ResponseWriter, httpCode int)
- func SplitString(str, sep string) []string
- func StringInSlice(s string, strSlice []string) bool
- func SubPathError(subPath string) error
- func SubPathFromUrl(urlSplit []string, split int) string
- type ErrorResponse
- type MarkerInfo
Constants ¶
View Source
const ( SeparatorComma = "," PrefixSchedule = "schedule-" PrefixRun = "run-" PrefixPipeline = "ppl-" PrefixCache = "cch-" PrefixGrant = "grant" PrefixQueue = "queue" PrefixCluster = "cluster" PrefixFlavour = "flavour" PrefixConnection = "conn" ResourceTypeSchedule = "schedule" ResourceTypeRun = "run" ResourceTypeRunCache = "run_cache" ResourceTypeArtifactEvent = "artifact_event" ResourceTypeUser = "user" ResourceTypeQueue = "queue" ResourceTypeFlavour = "flavour" ResourceTypeFs = "fs" ResourceTypeImage = "image" ResourceTypePipeline = "pipeline" ResourceTypeCluster = "cluster" ResourceTypeJob = "job" HeaderKeyRequestID = "x-pf-request-id" HeaderKeyUserName = "x-pf-user-name" HeaderKeyAuthorization = "x-pf-authorization" HeaderClientIDKey = "x-pf-client-id" ResponseCode = "code" ResponseMessage = "message" ResponseRequestID = "requestID" CFSSuccessMessage = "create file system success" ClaimsSuccessMessage = "create pv and pvc success" RegisterClientMessage = "register client success" HeartBeatMessage = "heat beat client success" BeginFilePosition = "begin" EndFilePosition = "end" LogPageSizeMax = 100 LogPageSizeDefault = 100 LogPageNoDefault = 1 Pod = "pod" StsMaxSeqData = 1000 PFTokenEnv = "PFToken" PFServer = "PFServer" )
View Source
const ( AESEncryptKey = "paddleflow123456" // 长度必须为16,分别对应加密算法AES-128 AESEncryptKeyEnv = "AESEncryptKey" PFSecretName = "pf-secret" )
View Source
const ( AccessDenied = "AccessDenied" // 无权限访问对应的资源 ActionNotAllowed = "ActionNotAllowed" // 此操作不被允许 InappropriateJSON = "InappropriateJSON" // 请求中的JSON格式正确,但语义上不符合要求。如缺少某个必需项,或者值类型不匹配等。出于兼容性考虑,对于所有无法识别的项应直接忽略,不应该返回这个错误。 InternalError = "InternalError" // 所有未定义的其他错误 InvalidHTTPRequest = "InvalidHTTPRequest" // HTTP body格式错误。例如不符合指定的Encoding等 InvalidURI = "InvalidURI" // URI形式不正确。例如一些服务定义的关键词不匹配等。对于ID不匹配等问题,应定义更加具体的错误码,例如NoSuchKey。 MalformedJSON = "MalformedJSON" // JSON格式不合法 MalformedYaml = "MalformedYaml" // Yaml格式不合法 DecodeBase64 = "Decode base64" // base64 字符串不合法 InvalidPipeline = "InvalidPipeline" // Pipeline校验不通过 InvalidVersion = "InvalidVersion" // URI的版本号不合法 FileTypeNotSupported = "FileTypeNotSupported" // 文件类型不支持 InvalidNamePattern = "InvalidNamePattern" // 命名格式不规范 RequestExpired = "RequestExpired" // 请求超时 OnlyRootAllowed = "OnlyRootAllowed" // 仅限管理员操作 InvalidMarker = "InvalidMarker" // 列表操作marker解析失败 InvalidScaleResource = "InvalidScaleResource" // 扩展资源类型不支持 IOOperationFailure = "IOOperationFailure" // I/O操作失败 NamespaceNotFound = "NamespaceNotFound" CPUNotFound = "CPUNotFound" MemoryNotFound = "MemoryNotFound" PathNotFound = "PathNotFound" MethodNotAllowed = "MethodNotAllowed" DuplicatedName = "DuplicatedName" DuplicatedContent = "DuplicatedContent" InvalidArguments = "InvalidArguments" RecordNotFound = "RecordNotFound" RequiredFieldEmpty = "RequiredFieldEmpty" AuthWithoutToken = "AuthWithoutToken" // 请求没有携带token AuthInvalidToken = "AuthInvalidToken" // 无效token AuthFailed = "AuthFailed" // 用户名或者密码错误 AuthIllegalUser = "AuthIllegalUser" // 非法用户 DBUpdateFailed = "UpdateDatabaseFailed" UserNameDuplicated = "UserNameDuplicated" UserNotExist = "UserNotExist" UserPasswordWeak = "UserPasswordWeak" InvalidComputeResource = "InvalidComputeResource" QueueNameDuplicated = "QueueNameDuplicated" QueueActionIsNotSupported = "QueueActionIsNotSupported" QueueNameNotFound = "QueueNameNotFound" QueueResourceNotMatch = "QueueResourceNotMatch" QueueQuotaTypeIsNotSupported = "QueueQuotaTypeIsNotSupported" QueueIsNotClosed = "QueueIsNotClosed" QueueIsInUse = "QueueIsInUse" QueueInvalidField = "QueueInvalidField" QueueUpdateFailed = "QueueUpdateFailed" GrantResourceTypeNotFound = "GrantResourceTypeNotFound" GrantNotFound = "GrantNotFound" GrantAlreadyExist = "GrantAlreadyExist" GrantRootActionNotSupport = "GrantRootActionNotSupport" RunNameDuplicated = "RunNameDuplicated" RunNotFound = "RunNotFound" PipelineNotFound = "PipelineNotFound" RunCacheNotFound = "RunCacheNotFound" ArtifactEventNotFound = "ArtifactEventNotFound" ReadYamlFileFailed = "ReadYamlFileFailed" ScheduleNotFound = "ScheduleNotFound" FlavourNotFound = "FlavourNotFound" // 未找到对应的资源套餐 FlavourNameEmpty = "FlavourNameEmpty" // 资源套餐名称为空 FlavourInvalidField = "FlavourInvalidField" // 资源套餐名称为空 JobInvalidField = "JobInvalidField" // job field invalid JobCreateFailed = "JobCreateFailed" // job create failed JobNotFound = "JobNotFound" ClusterNameNotFound = "ClusterNameNotFound" ClusterIdNotFound = "ClusterIdNotFound" ClusterNotFound = "ClusterNotFound" InvalidClusterProperties = "InvalidClusterProperties" InvalidCredential = "InvalidClusterCredential" InvalidClusterStatus = "InvalidClusterStatus" InvalidFileSystemURL = "InvalidFileSystemParamsURL" InvalidFileSystemProperties = "InvalidFileSystemParamsProperties" InvalidFileSystemMaxKeys = "InvalidFileSystemMaxKeys" InvalidFileSystemFsName = "InvalidFileSystemFsName" InvalidLinkURL = "InvalidLinkURL" InvalidLinkProperties = "InvalidLinkProperties" InvalidLinkMaxKeys = "InvalidFileSystemMaxKeys" FileSystemDataBaseError = "FileSystemDataBaseError" LinkModelError = "LinkModelError" LinkPathExist = "LinkPathExist" FileSystemClientBusy = "FileSystemClientBusy" K8sOperatorError = "K8sOperatorError" InvalidState = "InvalidState" GrantUserNameAndFs = "GrantUserNameAndFs" FileSystemNotExist = "FileSystemNotExist" FileSystemNameFormatError = "FileSystemNameFormatError" LinkFileSystemNotExist = "LinkFileSystemNotExist" FuseClientError = "FuseClientError" LinkFileSystemPathNotExist = "LinkFileSystemPathNotExist" LinkNotExist = "LinkNotExist" LinkPathMustBeEmpty = "LinkPathMustBeEmpty" ConnectivityFailed = "ConnectivityFailed" InvalidPVClaimsParams = "InvalidPVClaimsParams" GetNamespaceFail = "GetNamespaceFail" LinkMetaPersistError = "LinkMetaPersistError" )
View Source
const ( StatusRunInitiating = "initiating" StatusRunPending = "pending" StatusRunRunning = "running" StatusRunSucceeded = "succeeded" StatusRunFailed = "failed" StatusRunTerminating = "terminating" StatusRunTerminated = "terminated" StatusRunSkipped = "skipped" WfEventKeyRunID = "runID" WfEventKeyPK = "pk" WfEventKeyStatus = "status" WfEventKeyView = "runtime" WfEventKeyComponentName = "componentName" WfEventKeyComponentFullName = "componentFullName" WfEventKeyStartTime = "startTime" )
View Source
const ( RegPatternQueueName = "^[a-z0-9][a-z0-9-]{0,8}[a-z0-9]$" RegPatternUserName = "^[A-Za-z0-9]{4,16}$" RegPatternRunName = "^[A-Za-z_][A-Za-z0-9_-]{0,127}$" RegPatternPipelineName = "^[A-Za-z_][A-Za-z0-9_-]{0,127}$" RegPatternScheduleName = "^[A-Za-z_][A-Za-z0-9_]{1,49}$" RegPatternResource = "^[1-9][0-9]*([numkMGTPE]|Ki|Mi|Gi|Ti|Pi|Ei)?$" RegPatternClusterName = "^[A-Za-z0-9_][A-Za-z0-9-_]{0,253}[A-Za-z0-9_]$" // DNS1123LabelMaxLength is a label's max length in DNS (RFC 1123) DNS1123LabelMaxLength = 63 DNS1123LabelFmt = "[a-z0-9]([-a-z0-9]*[a-z0-9])?" JobNameMaxLength = 512 JobPortMaximums = 65535 IPDomainOrIPDomainPortPattern = "^([a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+)" + "(:([1-9]|[1-9]\\d{1,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5]))?$" TypeSplit = 0 HDFSSplit = 3 S3Split = 3 S3EndpointSplit = 2 S3SplitLen = 3 LocalSplit = 2 CFSSplit = 3 ServerAddressSplit = 2 S3AddressLength = 3 IDSliceLen = 3 FsPrefix = "fs-" UserRoot = "root" )
Variables ¶
View Source
var ( RunFinalStatus = []string{ StatusRunFailed, StatusRunSucceeded, StatusRunTerminated, StatusRunSkipped, } RunActiveStatus = []string{ StatusRunPending, StatusRunRunning, StatusRunTerminating, StatusRunInitiating, } )
Functions ¶
func CheckFsNested ¶
func CheckKerberosProperties ¶
func CheckPermission ¶ added in v0.14.5
func ConnectionClosedError ¶
func ConnectionClosedError() error
func DbDataNotExitError ¶
func DuplicatedContentError ¶
func DuplicatedNameError ¶
func FsBeingUsedError ¶ added in v0.14.3
func GetAESEncryptKey ¶ added in v0.14.6
func GetAESEncryptKey() string
func GetHttpStatusByCode ¶
func GetMD5Hash ¶
func GetMessageByCode ¶
func GetRequestContext ¶
func GetRequestContext(r *http.Request) logger.RequestContext
func InformationFromURL ¶
func InformationFromURL(url string, properties map[string]string) (fileSystemType, serverAddress, subPath string)
InformationFromURL get fs system information from url
func InvalidField ¶
func InvalidMaxKeysError ¶
func InvalidNamePatternError ¶
func InvalidStartEndParams ¶ added in v0.14.3
func InvalidStartEndParams() error
func InvalidStatisticsParams ¶ added in v0.14.3
func IsDNS1123Label ¶
IsDNS1123Label tests for a string that conforms to the definition of a label in DNS (RFC 1123).
func IsRootUser ¶
func IsRunFinalStatus ¶
func IsValidQueueStatus ¶
func LinkPathError ¶
func LogFilePositionInvalidValueError ¶
func LogFilePositionInvalidValueError() error
func LogPageSizeOverMaxError ¶
func LogPageSizeOverMaxError() error
func NoAccessError ¶
func NotFoundError ¶
func PKCS7Padding ¶
func PKCS7UnPadding ¶
func PVCNotFountError ¶
func RemoveDuplicateStr ¶
func Render ¶
func Render(w http.ResponseWriter, httpCode int, data interface{})
func RenderErrWithMessage ¶
func RenderErrWithMessage(w http.ResponseWriter, requestID string, code string, message string)
func RenderStatus ¶
func RenderStatus(w http.ResponseWriter, httpCode int)
func SplitString ¶
func StringInSlice ¶
check string is slice or not
func SubPathError ¶
func SubPathFromUrl ¶
Types ¶
type ErrorResponse ¶
type MarkerInfo ¶
Click to show internal directories.
Click to hide internal directories.