download

package
v2.10.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChecksumDownloader

type ChecksumDownloader interface {
	DownloadChecksum(ctx context.Context, logE *logrus.Entry, rt *runtime.Runtime, pkg *config.Package) (io.ReadCloser, int64, error)
}

type ChecksumDownloaderImpl

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

func NewChecksumDownloader

func NewChecksumDownloader(gh github.RepositoriesService, rt *runtime.Runtime, httpDownloader HTTPDownloader) *ChecksumDownloaderImpl

func (*ChecksumDownloaderImpl) DownloadChecksum

func (dl *ChecksumDownloaderImpl) DownloadChecksum(ctx context.Context, logE *logrus.Entry, rt *runtime.Runtime, pkg *config.Package) (io.ReadCloser, int64, error)

type ClientAPI

type ClientAPI interface {
	GetReadCloser(ctx context.Context, logE *logrus.Entry, file *File) (io.ReadCloser, int64, error)
}

type DownloadedFile

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

func NewDownloadedFile

func NewDownloadedFile(fs afero.Fs, body io.ReadCloser, pb *progressbar.ProgressBar) *DownloadedFile

func (*DownloadedFile) Close

func (file *DownloadedFile) Close() error

func (*DownloadedFile) GetPath

func (file *DownloadedFile) GetPath() (string, error)

func (*DownloadedFile) Read

func (file *DownloadedFile) Read() (io.ReadCloser, error)

func (*DownloadedFile) ReadLast

func (file *DownloadedFile) ReadLast() (io.ReadCloser, error)

func (*DownloadedFile) Remove

func (file *DownloadedFile) Remove() error

func (*DownloadedFile) Wrap

func (file *DownloadedFile) Wrap(w io.Writer) io.Writer

type Downloader

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

func NewDownloader

func NewDownloader(gh github.RepositoriesService, httpDownloader HTTPDownloader) *Downloader

func (*Downloader) GetReadCloser

func (downloader *Downloader) GetReadCloser(ctx context.Context, logE *logrus.Entry, file *File) (io.ReadCloser, int64, error)

type File

type File struct {
	Type      string
	RepoOwner string
	RepoName  string
	Version   string
	Asset     string
	URL       string
	Path      string
	Private   bool
}

func ConvertDownloadedFileToFile

func ConvertDownloadedFileToFile(file *registry.DownloadedFile, art *File, rt *runtime.Runtime, tplParam *template.Artifact) (*File, error)

func ConvertPackageToFile

func ConvertPackageToFile(pkg *config.Package, assetName string, rt *runtime.Runtime) (*File, error)

func ConvertRegistryToFile

func ConvertRegistryToFile(rgst *khulnasoft.Registry) (*File, error)

type GitHubContentAPI

type GitHubContentAPI interface {
	GetContents(ctx context.Context, repoOwner, repoName, path string, opt *github.RepositoryContentGetOptions) (*github.RepositoryContent, []*github.RepositoryContent, *github.Response, error)
}

type GitHubContentFileDownloader

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

func NewGitHubContentFileDownloader

func NewGitHubContentFileDownloader(gh GitHubContentAPI, httpDL HTTPDownloader) *GitHubContentFileDownloader

func (*GitHubContentFileDownloader) DownloadGitHubContentFile

func (dl *GitHubContentFileDownloader) DownloadGitHubContentFile(ctx context.Context, logE *logrus.Entry, param *domain.GitHubContentFileParam) (*domain.GitHubContentFile, error)

type GitHubReleaseAPI

type GitHubReleaseAPI interface {
	GetReleaseByTag(ctx context.Context, owner, repoName, version string) (*github.RepositoryRelease, *github.Response, error)
	DownloadReleaseAsset(ctx context.Context, owner, repoName string, assetID int64, httpClient *http.Client) (io.ReadCloser, string, error)
}

type GitHubReleaseDownloader

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

func NewGitHubReleaseDownloader

func NewGitHubReleaseDownloader(gh GitHubReleaseAPI, httpDL HTTPDownloader) *GitHubReleaseDownloader

func (*GitHubReleaseDownloader) DownloadGitHubRelease

func (dl *GitHubReleaseDownloader) DownloadGitHubRelease(ctx context.Context, logE *logrus.Entry, param *domain.DownloadGitHubReleaseParam) (io.ReadCloser, int64, error)

type HTTPDownloader

type HTTPDownloader interface {
	Download(ctx context.Context, u string) (io.ReadCloser, int64, error)
}

func NewHTTPDownloader

func NewHTTPDownloader(httpClient *http.Client) HTTPDownloader

type Mock

type Mock struct {
	RC   io.ReadCloser
	Code int64
	Err  error
}

func (*Mock) GetReadCloser

func (mock *Mock) GetReadCloser(ctx context.Context, logE *logrus.Entry, file *File) (io.ReadCloser, int64, error)

type MockChecksumDownloader

type MockChecksumDownloader struct {
	Body string
	Code int64
	Err  error
}

func (*MockChecksumDownloader) DownloadChecksum

func (chkDL *MockChecksumDownloader) DownloadChecksum(ctx context.Context, logE *logrus.Entry, rt *runtime.Runtime, pkg *config.Package) (io.ReadCloser, int64, error)

Jump to

Keyboard shortcuts

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