Documentation ¶
Index ¶
- Constants
- func AppendUid(name string, uidLen int) string
- func BackendAlreadyExistsError(backend string, filePath string) error
- func BackendNameMapping(name string) string
- func BashExecReturnStdOut(ctx context.Context, cli string, args []string) ([]byte, error)
- func BuildBackendName(name string) string
- func ConvertInterface(i interface{}) interface{}
- func Examples(s string) string
- func ExecReturnStdOut(cli string, args []string) ([]byte, error)
- func ExecWithStdin(cli string, data []byte, args []string) error
- func GenerateHashCode(txt string, max int) string
- func GetBackendName(name string) string
- func GetPrintFunc[T any](format string) func(t []T)
- func GetSelectedNumber(tips string, maxValue int) (int, error)
- func IsDNSFormat(source string) bool
- func JSONToYAML(j []byte) ([]byte, error)
- func LogErrorf(format string, err error) error
- func LogInfof(ctx context.Context, format string, args ...interface{})
- func LogWarningf(ctx context.Context, format string, err error) error
- func MapTo[I any, O any](list []I, consumer func(I) O) []O
- func PrintBackend[T any](t []T, notFound []string, printFunc func(t []T))
- func PrintBackendAlreadyExists(backend string)
- func PrintNoResourceBackend(namespace string)
- func PrintNoResourceCert(backend, namespace string)
- func PrintNotFoundBackend(names ...string)
- func PrintNotFoundSecret(names ...string)
- func PrintOperateResult(resourceType, operate string, resourceNames ...string)
- func PrintResult(out string)
- func PrintSecret[T any](t []T, notFound []string, printFunc func(t []T))
- func PrintWithJson[T any](data []T)
- func PrintWithTable[T any](data []T)
- func PrintWithYaml[T any](data []T)
- func PrintlnError(err error) error
- func ReadHeader[T any](t T) []string
- func ReadRow[T any](t T) []string
- func ReadStruct[T any, O any](t T, readFunc func(field reflect.StructField, value reflect.Value) (O, bool)) []O
- func StartStdInput() (string, string, error)
- func StructToYAML[T any](t T) ([]byte, error)
- type GlobalGoroutineLimit
- type Normalizer
- type Once
- type Task
- type TaskHandler
Constants ¶
const BackendNameMaxLength = 63
const BackendNameUidMaxLength = 5
const Indentation = ` `
Variables ¶
This section is empty.
Functions ¶
func BackendAlreadyExistsError ¶
BackendAlreadyExistsError return a backend already exists error
func BackendNameMapping ¶
BackendNameMapping mapping backend name
func BashExecReturnStdOut ¶
BashExecReturnStdOut used to exec command, and return stdout.
func BuildBackendName ¶
BuildBackendName build backend name
func ConvertInterface ¶
func ConvertInterface(i interface{}) interface{}
ConvertInterface convert interface
func ExecReturnStdOut ¶
ExecReturnStdOut used to exec command, and return stdout.
func ExecWithStdin ¶
ExecWithStdin used to exec command, enter parameters using stdin
func GenerateHashCode ¶
GenerateHashCode generate hash code
func GetBackendName ¶
func GetPrintFunc ¶
GetPrintFunc get print function by format type
func GetSelectedNumber ¶
GetSelectedNumber get the number entered by the user
func IsDNSFormat ¶
IsDNSFormat Determine if the DNS format is met
func LogWarningf ¶
LogWarningf write error log and return the error
func MapTo ¶
MapTo Returns an array consisting of the results of applying the given function to the elements of this list.
func PrintBackend ¶
PrintBackend print backend
func PrintBackendAlreadyExists ¶
func PrintBackendAlreadyExists(backend string)
PrintBackendAlreadyExists print backend already exists error
func PrintNoResourceBackend ¶
func PrintNoResourceBackend(namespace string)
PrintNoResourceBackend print not found backend
func PrintNoResourceCert ¶
func PrintNoResourceCert(backend, namespace string)
PrintNoResourceCert print no cert found
func PrintNotFoundBackend ¶
func PrintNotFoundBackend(names ...string)
PrintNotFoundBackend print not found backend
func PrintNotFoundSecret ¶
func PrintNotFoundSecret(names ...string)
PrintNotFoundSecret print not found secret
func PrintOperateResult ¶
PrintOperateResult used to print operate result to terminal e.g. backend/backend-name created
func PrintSecret ¶
PrintSecret print secret
func ReadHeader ¶
ReadHeader read struct tag name T is a struct
func ReadStruct ¶
func ReadStruct[T any, O any](t T, readFunc func(field reflect.StructField, value reflect.Value) (O, bool)) []O
ReadStruct read struct T is a struct readFunc is a read struct func, e.g. read struct filed value
func StructToYAML ¶
StructToYAML convert struct to yaml
Types ¶
type GlobalGoroutineLimit ¶
type GlobalGoroutineLimit struct {
// contains filtered or unexported fields
}
GlobalGoroutineLimit is used to limit concurrency of goroutine
func NewGlobalGoroutineLimit ¶
func NewGlobalGoroutineLimit(maxGoroutineNum int) *GlobalGoroutineLimit
NewGlobalGoroutineLimit initialize a GlobalGoroutineLimit instance
func (*GlobalGoroutineLimit) AddWork ¶
func (n *GlobalGoroutineLimit) AddWork(num int)
AddWork add the work num for wait
func (*GlobalGoroutineLimit) HandleWork ¶
func (n *GlobalGoroutineLimit) HandleWork(work func())
HandleWork handle the work func with limit
type Normalizer ¶
type Normalizer struct {
// contains filtered or unexported fields
}
func NewNormalizer ¶
func NewNormalizer(s string) Normalizer
NewNormalizer initialize an instance of Normalizer
type Once ¶
type Once struct {
// contains filtered or unexported fields
}
Once same as sync.Once, but the Do() method is overridden.
type TaskHandler ¶
type TaskHandler struct {
// contains filtered or unexported fields
}
TaskHandler Define asynchronous task processing configuration
func NewTransmitter ¶
func NewTransmitter(maxHandlerNum, taskCapacity int) *TaskHandler
NewTransmitter initialize a TaskHandler instance
func (*TaskHandler) AddTask ¶
func (t *TaskHandler) AddTask(task Task)
AddTask add an asynchronous Task
func (*TaskHandler) Start ¶
func (t *TaskHandler) Start()
Start Create maxHandlerLimit goroutines to execute the task.