common

package
v0.0.0-...-55f83f6 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SwarmPoolBadRequestErrorCode   = "400001"
	IdentityBadRequestErrorCode    = "400002"
	SwarmPoolNotFoundErrorCode     = "404001"
	IdentityNotFoundErrorCode      = "404002"
	PeerNotFoundErrorCode          = "404003"
	SwarmPoolBadBodyErrorCode      = "422001"
	SwarmPoolAlreadyExistErrorCode = "422002"
	IdentityBadBodyErrorCode       = "422003"
	IdentityAlreadyExistErrorCode  = "422004"
)
View Source
const DNSRegexStringRFC1123 = "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"

Variables

Functions

func GetTranslator

func GetTranslator() *ut.Translator

func LoadKubeConfig

func LoadKubeConfig()

func RegisterDNSRegexRFC1123Validator

func RegisterDNSRegexRFC1123Validator(v *validator.Validate, trans *ut.Translator)

func RegisterIsDefaultIfNotPrivateValidator

func RegisterIsDefaultIfNotPrivateValidator(v *validator.Validate, trans *ut.Translator)

func RegisterRequiredWithTranslator

func RegisterRequiredWithTranslator(v *validator.Validate, trans *ut.Translator)

Types

type CommonError

type CommonError struct {
	Errors map[string]interface{} `json:"errors"`
}

func NewError

func NewError(key string, err error) CommonError

func NewValidatorError

func NewValidatorError(key string, errs validator.ValidationErrors) CommonError

To handle the error returned by c.Bind in gin framework https://github.com/go-playground/validator/blob/v9/_examples/translations/main.go

type ExtendedClientset

type ExtendedClientset struct {
	kubernetes.Clientset

	PeerdiscoveryV1alpha1 *rest.RESTClient
}
var KubeClient *ExtendedClientset

func GetKubeClient

func GetKubeClient() *ExtendedClientset

Using this function to get a connection, you can create your connection pool here.

Jump to

Keyboard shortcuts

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