utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayStringContains

func ArrayStringContains(s []string, e string) bool

func EncodeVars

func EncodeVars(vars map[string]string) map[string]string

func GenerateToken

func GenerateToken() (string, error)

func GetImageAndTag

func GetImageAndTag(image string) (string, string)

func GetLocalLLMUrl

func GetLocalLLMUrl() (*url.URL, error)

func MergeMapString

func MergeMapString(current, overwrite map[string]string) map[string]string

func MergeYAML

func MergeYAML(originYaml, overwriteYaml string) (string, error)

MergeYAML takes two YAML strings, merges them, and returns the resulting YAML string.

func ReplaceAndLower

func ReplaceAndLower(s string) string

ReplaceAndLower replaces underscores and colons with hyphens and converts the string to lowercase.

func ResponseAPIError

func ResponseAPIError(rw http.ResponseWriter, statusCode int, err *apierror.APIError)

func ResponseBody

func ResponseBody(obj interface{}) []byte

func ResponseError

func ResponseError(rw http.ResponseWriter, statusCode int, err error)

func ResponseErrorMsg

func ResponseErrorMsg(rw http.ResponseWriter, statusCode int, errMsg string)

func ResponseOKWithBody

func ResponseOKWithBody(rw http.ResponseWriter, obj interface{})

func ResponseOKWithNoContent

func ResponseOKWithNoContent(rw http.ResponseWriter)

func ValidateVolumeClaimTemplatesAnnotation

func ValidateVolumeClaimTemplatesAnnotation(pvcAnno string) error

Types

type ErrorResponse

type ErrorResponse struct {
	Code      string `json:"code,omitempty"`
	Status    int    `json:"status,omitempty"`
	Message   string `json:"message,omitempty"`
	Type      string `json:"type,omitempty"`
	FieldName string `json:"fieldName,omitempty"`
	Error     string `json:"error,omitempty"`
}

ErrorResponse describe the error response happened during request.

type PVCHandler

type PVCHandler struct {
	// contains filtered or unexported fields
}

func (*PVCHandler) CreatePVCByVolume

func (h *PVCHandler) CreatePVCByVolume(pvcs []mlv1.Volume, namespace string, ownerRefs []metav1.OwnerReference) error

func (*PVCHandler) CreatePVCFromAnnotation

func (h *PVCHandler) CreatePVCFromAnnotation(pvcTemplates, namespace string, ownerRefs []metav1.OwnerReference) error

CreatePVCFromAnnotation helps to create PVCs from the annotation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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