tools

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultNamespace       = "sealyun"
	DefaultAdminSecretName = "fist-admin"

	UserOperator OperatorType = 1 + iota

	UserSecretPrefix = "fist-users-"
)

consts

View Source
const (
	ErrMessageSystem = "system error"
)

const is global const

Variables

View Source
var (
	ErrUserNameEmpty           = errors.New("the username is empty")
	ErrPasswordEmpty           = errors.New("the password is empty")
	ErrValidateUserPassword    = errors.New("the username and password is mismatching")
	ErrServiceAccountEmpty     = errors.New("the serviceAccount token is empty")
	ErrServiceAccountNotExists = errors.New("the serviceAccount token is not exists")
	ErrParamTidEmpty           = errors.New("the param tid is empty")
	ErrUserAuth                = errors.New("user auth failed ")
	ErrUserAdd                 = errors.New("user add failed ")
	ErrUserUpdate              = errors.New("user update failed ")
	ErrUserDel                 = errors.New("user del failed ")
	ErrUserGet                 = errors.New("user get failed ")
	ErrK8sClientInitFailed     = errors.New("kubernetes client init failed")
	//validate
	ErrUserName      = errors.New("user name is error ")
	ErrUserNotExists = errors.New("user not exists ")
	ErrUserExists    = errors.New("user is exists ")
	//
	ErrUserNotLogin = errors.New("user not login ")
	//ldap
	ErrLdapUserNotExists = errors.New("ldap user not exists ")
)

vars is global var

Functions

func CookieRead added in v0.0.1

func CookieRead(req *restful.Request, name string) string

CookieRead is read value from cookie

func CookieRemoveValue added in v0.0.1

func CookieRemoveValue(resp *restful.Response, name string)

CookieRemoveValue is remove cookies of name value

func CookieWriteValue added in v0.0.1

func CookieWriteValue(resp *restful.Response, name, value string)

CookieWriteValue is write cookies of name value

func Cors

func Cors(wsContainer *restful.Container)

Cors is cors for restful tools

func CreateNamespace

func CreateNamespace(namespace string) error

CreateNamespace create namespace

func DESDecrypt added in v0.0.1

func DESDecrypt(data string, key []byte) string

DESDecrypt is des decrypt

func DESEncrypt added in v0.0.1

func DESEncrypt(origData, key []byte) string

DESEncrypt is des encrypt

func GetK8sClient

func GetK8sClient() *kubernetes.Clientset

GetK8sClient get a kubernetes in cluster clientset

func MD5 added in v0.0.1

func MD5(data string) string

MD5 is method for md5

func MapToString

func MapToString(labels map[string]string) string

MapToString is used for k8s select string from map convert

func NewUUID

func NewUUID() string

NewUUID is generator uuid

func NotEmptyAll

func NotEmptyAll(str ...string) bool

NotEmptyAll is not empty for all

func ResponseAuthError added in v0.0.1

func ResponseAuthError(response *restful.Response)

ResponseAuthError is web response for error of cookie not login

func ResponseError

func ResponseError(response *restful.Response, err error)

ResponseError is web response for error

func ResponseErrorAndCodeMessage

func ResponseErrorAndCodeMessage(response *restful.Response, code int32, err error, message string)

ResponseErrorAndCodeMessage is web response for error

func ResponseErrorAndMessage

func ResponseErrorAndMessage(response *restful.Response, err error, message string)

ResponseErrorAndMessage is web response for error

func ResponseSuccess

func ResponseSuccess(response *restful.Response, data interface{})

ResponseSuccess is web response for success

func ResponseSystemError

func ResponseSystemError(response *restful.Response, err error)

ResponseSystemError is web response for error

func SealyunCreateSecretsForMap

func SealyunCreateSecretsForMap(operatorType OperatorType, name string, data, labels map[string]string) error

SealyunCreateSecretsForMap is create function for map

func SealyunDeleteSecrets

func SealyunDeleteSecrets(operatorType OperatorType, name string) error

SealyunDeleteSecrets is delete function

func SealyunGetAdminSecretString

func SealyunGetAdminSecretString(key string) string

SealyunGetAdminSecretString is Sealyun admin module function

func SealyunGetSecretMap

func SealyunGetSecretMap(operatorType OperatorType, name string) map[string]string

SealyunGetSecretMap is Sealyun function get map

func SealyunGetSecretString

func SealyunGetSecretString(operatorType OperatorType, name, key string) string

SealyunGetSecretString is Sealyun function get str

func SealyunListSecrets

func SealyunListSecrets(operatorType OperatorType, labels map[string]string) []map[string]string

SealyunListSecrets is list function

func SealyunUpdateSecretsForMap

func SealyunUpdateSecretsForMap(operatorType OperatorType, name string, data, labels map[string]string) error

SealyunUpdateSecretsForMap is update function for map

func SealyunUpdateSecretsForString

func SealyunUpdateSecretsForString(operatorType OperatorType, name, key, value string, labels map[string]string) error

SealyunUpdateSecretsForString is update function for map

Types

type OperatorType

type OperatorType int

OperatorType is enum of operator type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL