Documentation
¶
Index ¶
- Constants
- func CalculateBackoff(retryCount uint8) time.Duration
- func CloseHttpClient(resp *http.Response)
- func ComputePageRange(pageSize int32, offset int32, totalCount int) (int, int)
- func ConvertUrlToSecretpath(urls string) (string, error)
- func CopyFile(dstName, srcName string) (written int64, err error)
- func CreateHttpHeaderReq(method, url string, body *bytes.Reader, headers map[string]string) (*http.Request, error)
- func CreateHttpHeaderReqCtx(ctx context.Context, method, url string, body *bytes.Reader, ...) (*http.Request, error)
- func CreateRequestBody(bodyReq interface{}) (*bytes.Reader, error)
- func DoHttpRequestWithRetry(req *http.Request, httpClient *http.Client, maxRetries uint8) (*http.Response, error)
- func DownloadFile(filepath string, fileurl string) error
- func FileExists(filename string) bool
- func FilterPredicates(filters []*Filter, columns map[string]string) ([]func(s *sql.Selector), error)
- func GrpcToHttpStatusCode(grpcStatus codes.Code) int
- func HttpToGrpcStatusCode(httpStatusCode int) codes.Code
- func IsAbsFilePath(path string) error
- func IsUrl(u string) bool
- func IsValidDNSName(dnsName string) error
- func IsValidFile(filename string) bool
- func IsValidHost(host string) error
- func IsValidHostnamePort(val string) bool
- func IsValidIPV4Port(uRL string) error
- func IsValidNamespace(ns string) error
- func IsValidPort(port string) error
- func IsValidPortInt(port int) error
- func IsValidUrl(url string) error
- func NewInClusterClient() (kubernetes.Interface, error)
- func NewInClusterDynamicClient() (dynamic.Interface, error)
- func OrderByOptions(orderBys []*OrderBy, columns map[string]string) ([]func(selector *sql.Selector), error)
- func RemoveFile(name string) error
- func RetrieveFQDN(urls string) (string, error)
- func SetHttpHeaders(req *http.Request, headers map[string]string)
- func StartHttpReadinessProbe(readinessProbe string, baseURL string, pattern string, uri string)
- func TerminateSideCar(istioQuitEndpoint string) error
- type Filelink
- type Filter
- type KubernetesAPI
- type OrderBy
- type SchemeType
Constants ¶
const (
HELMNAMESPACEENV = "POD_NAMESPACE"
)
const (
HttpSchemePath = "https://"
)
Variables ¶
This section is empty.
Functions ¶
func CalculateBackoff ¶
Calculates the backoff duration for exponential backoff based on the retry count
func CloseHttpClient ¶
closing an HTTP client's response body
func ComputePageRange ¶
ComputePageRange computes the startIndex and endIndex based on the provided pageSize, offset and totalCount. It returns -1 for the endIndex if there are no items to paginate. This function is used during the handling of pageSize/Offset in a HTTP Query
func ConvertUrlToSecretpath ¶
ConvertUrlToFilepath converts URL to File path example: before: https://registry.intel.com/hello after: registryintelcom
func CreateHttpHeaderReq ¶
func CreateHttpHeaderReq(method, url string, body *bytes.Reader, headers map[string]string) (*http.Request, error)
Creates an HTTP request with the specified method, URL, request body, and headers
headers := map[string]string{
"Authorization": rc.AdminBearerToken,
"Accept": "application/json",
"Content-Type": "application/json",
// you can add more headers here
}
func CreateHttpHeaderReqCtx ¶
func CreateHttpHeaderReqCtx(ctx context.Context, method, url string, body *bytes.Reader, headers map[string]string) (*http.Request, error)
Creates an HTTP request with the specified context, method, URL, request body, and headers
headers := map[string]string{
"Authorization": rc.AdminBearerToken,
"Accept": "application/json",
"Content-Type": "application/json",
// you can add more headers here
}
func CreateRequestBody ¶
createRequestBody creates a request body from the given input using JSON marshaling
func DoHttpRequestWithRetry ¶
func DoHttpRequestWithRetry(req *http.Request, httpClient *http.Client, maxRetries uint8) (*http.Response, error)
The function attempts to send the request using the client, with the ability to retry multiple times in case of failure.
func DownloadFile ¶
DownloadFile Downloads file through url and copies it to the specified path
func FileExists ¶
func FilterPredicates ¶
func FilterPredicates(filters []*Filter, columns map[string]string) ([]func(s *sql.Selector), error)
FilterPredicates creates SQL predicates based on provided Filter configuration.
func GrpcToHttpStatusCode ¶
GrpcToHttpStatusCode coverts grpc status code to http status code
func HttpToGrpcStatusCode ¶
HttpToGrpcStatusCode coverts http status code to grpc status code
func IsAbsFilePath ¶
func IsValidDNSName ¶
func IsValidFile ¶
func IsValidHost ¶
IsValidHost TODO: This is a stupid validation. Fix this ASAP
func IsValidHostnamePort ¶
IsValidHostnamePort validates a <dns>:<port> combination for fields typically used for socket address.
func IsValidIPV4Port ¶
IsValidIPV4Port assumes the uRL is of the format <ip>:<port> for a valid url. The other assumption is that the host is a valid IP4 TODO: Enhance this function later if other formats are valid
func IsValidNamespace ¶
IsValidNamespace TODO: fix this rudimentary validation
func IsValidPort ¶
func IsValidPortInt ¶
func IsValidUrl ¶
func NewInClusterClient ¶
func NewInClusterClient() (kubernetes.Interface, error)
func OrderByOptions ¶
func OrderByOptions(orderBys []*OrderBy, columns map[string]string) ([]func(selector *sql.Selector), error)
OrderByOptions generates SQL selector based on the Ordering configuration and Valid Columns on which ordering is allowed
func RemoveFile ¶
func RetrieveFQDN ¶
RetrieveFQDN inspect and remove the sheme of http protocol example: before: https://registry.intel.com/hello after: registry.intel.com
func SetHttpHeaders ¶
Sets the headers of an HTTP request using the provided key-value pairs input paramter example:
headers := map[string]string{
"Authorization": rc.AdminBearerToken,
"Accept": "application/json",
"Content-Type": "application/json",
// you can add more headers here
}
func StartHttpReadinessProbe ¶
func TerminateSideCar ¶
Types ¶
type Filter ¶
func ParseFilter ¶
ParseFilter parses the given filter string and returns a list of Filter If any error is encountered, an nil Filter slice and non-nil error is returned
type KubernetesAPI ¶
type KubernetesAPI struct {
Client kubernetes.Interface
}
func (*KubernetesAPI) NewInClusterClient ¶
func (kapi *KubernetesAPI) NewInClusterClient() error
type OrderBy ¶
func ParseOrderBy ¶
ParseOrderBy parses the incoming orderBy query string Below is a sample orderBy query specifying that the results should be sorted that name is ascending and create_time should be descending
/books?orderBy="name asc, create_time desc"