Documentation
¶
Index ¶
- Constants
- func BytesString(bytes uint64, accuracy int) string
- func CTFComponentArchiveFilename(name, version string) string
- func CacheDir() (string, error)
- func CalculateBlobUploadRef(repoCtx cdv2.OCIRegistryRepository, componentName string, ...) string
- func CleanMarkdownUsageFunc(cmd *cobra.Command)
- func ExponentialBackoff(backoffFactor time.Duration, retries uint64) time.Duration
- func GetFileType(fs vfs.FileSystem, path string) (string, error)
- func Gzip(data []byte, compressionLevel int) ([]byte, error)
- func PrintPrettyYaml(obj interface{}, enabled bool)
- func RandomString(n int) string
- func RawJSON(value interface{}) (*json.RawMessage, error)
- func SafeConvert(bytes []byte) string
- func TargetOCIArtifactRef(targetRepo, ref string, keepOrigHost bool) (string, error)
- func WriteFileToTARArchive(filename string, inputReader io.Reader, outputWriter *tar.Writer) error
Constants ¶
const ( BYTE = 1.0 << (10 * iota) KIBIBYTE MEBIBYTE GIBIBYTE )
Variables ¶
This section is empty.
Functions ¶
func BytesString ¶
BytesString converts bytes into a human readable string. This function is inspired by https://www.reddit.com/r/golang/comments/8micn7/review_bytes_to_human_readable_format/
func CTFComponentArchiveFilename ¶
CTFComponentArchiveFilename returns the name of the componant archive file in the ctf.
func CalculateBlobUploadRef ¶
func CalculateBlobUploadRef(repoCtx cdv2.OCIRegistryRepository, componentName string, componentVersion string) string
CalculateBlobUploadRef calculates the OCI reference where blobs for a component should be uploaded
func CleanMarkdownUsageFunc ¶
CleanMarkdownUsageFunc removes markdown tags from the long usage of the command. With this func it is possible to generate the markdown docs but still have readable commandline help func. Note: currently only "<pre>" tags are removed
func ExponentialBackoff ¶
ExponentialBackoff calculates an exponential backoff timeout
func GetFileType ¶
func GetFileType(fs vfs.FileSystem, path string) (string, error)
GetFileType returns the mimetype of a file.
func PrintPrettyYaml ¶
func PrintPrettyYaml(obj interface{}, enabled bool)
PrintPrettyYaml prints the given objects as yaml if enabled.
func RandomString ¶
RandomString creates a new random string with the given length.
func RawJSON ¶
func RawJSON(value interface{}) (*json.RawMessage, error)
RawJSON converts an arbitrary value to json.RawMessage
func SafeConvert ¶
SafeConvert converts a byte slice to string. If the byte slice is nil, an empty string is returned.
func TargetOCIArtifactRef ¶
TargetOCIArtifactRef calculates the target reference for
Types ¶
This section is empty.