utils

package
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UnixEpoch is the number of seconds that have elapsed since January 1, 1970
	UnixEpoch      = time.Unix(0, 0)
	DefaultClient  = &http.Client{Transport: &http.Transport{Proxy: http.ProxyFromEnvironment}}
	InsecureClient = &http.Client{Transport: &http.Transport{
		Proxy:           http.ProxyFromEnvironment,
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true}},
	}
)

Functions

func ChartExistInIndex

func ChartExistInIndex(name string, version string, index *helmRepo.IndexFile) (bool, error)

ChartExistInIndex checks if a specific chart version is present in the index file.

func CopyFile

func CopyFile(destPath string, srcPath string) error

CopyFile copies a file from srcPath to destPath, ensuring the destPath directory exists.

func EncodeSha1

func EncodeSha1(s string) string

EncodeSha1 returns a SHA1 representation of the provided string

func FetchAndCache

func FetchAndCache(name, version string, cache cache.Cacher, fopts ...FetchOption) (string, error)

FetchAndCache fetches a chart and stores it in provided cache

func FileExists

func FileExists(f string) (bool, error)

FileExists will test if a file exists

func FindChartURL

func FindChartURL(name string, version string, index *helmRepo.IndexFile, sourceURL string) (string, error)

FindChartURL will return the chart url

func GetDateThreshold

func GetDateThreshold(date string) (time.Time, error)

GetDateThreshold will parse a string date agains a fixed layout and return a time.Date value

func GetFileContentType

func GetFileContentType(filepath string) (string, error)

GetFileContentType returns the content type of a file.

func GetListenAddress

func GetListenAddress() (string, error)

GetListenAddress returns a free local direction

func HTTPResponseBody

func HTTPResponseBody(res *http.Response) string

HTTPResponseBody returns the body of an HTTP response

func LoadIndexFromRepo

func LoadIndexFromRepo(repo *api.Repo) (*helmRepo.IndexFile, error)

LoadIndexFromRepo get the index.yaml from a Helm repo and returns an index object

func NormalizeChartURL

func NormalizeChartURL(repoURL, chartURL string) (string, error)

NormalizeChartURL forms the full download URL in case we pass a relative URL

func Untar

func Untar(tarball, targetDir string) error

Untar extracts compressed archives

Types

type FetchOption

type FetchOption func(opts *fetchOptions)

func WithFetchInsecure

func WithFetchInsecure(insecure bool) FetchOption

WithFetchInsecure enables insecure connection for fetch operations

func WithFetchPassword

func WithFetchPassword(pass string) FetchOption

WithFetchPassword configures a password for fetch operations

func WithFetchStatusHandler

func WithFetchStatusHandler(h statusHandler) FetchOption

WithFetchStatusHandler configures a status handler for fetch operations

func WithFetchURLBuilder

func WithFetchURLBuilder(h urlBuilder) FetchOption

WithFetchURLBuilder configures a URL builder for fetch operations

func WithFetchUsername

func WithFetchUsername(user string) FetchOption

WithFetchUsername configures a username for fetch operations

Jump to

Keyboard shortcuts

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