Documentation
¶
Overview ¶
Package sources provides implementations of the core.Source interface.
Package sources provides implementations of the core.Source interface.
Package sources provides implementations of the core.Source interface.
Index ¶
- func CreateHTTPRequest(ctx context.Context, location string) (*http.Request, error)
- type GenericSource
- type GitHubSource
- type HTTPSource
- func (s *HTTPSource) Close() error
- func (s *HTTPSource) DoRequest(req *http.Request) (*http.Response, error)
- func (s *HTTPSource) DownloadToTempFile(resp *http.Response) (io.ReadCloser, error)
- func (s *HTTPSource) EnsureTempDir() error
- func (s *HTTPSource) GetLogger() *logrus.Logger
- func (s *HTTPSource) SetClient(client *http.Client)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GenericSource ¶ added in v0.5.0
type GenericSource struct {
*HTTPSource
}
GenericSource implements core.Source for generic HTTP URLs. It doesn't perform any special validation or processing - it just downloads from any HTTP/HTTPS URL.
func NewGenericSource ¶ added in v0.5.0
func NewGenericSource(logger *logrus.Logger) *GenericSource
NewGenericSource creates a new GenericSource instance.
func (*GenericSource) Get ¶ added in v0.5.0
func (s *GenericSource) Get(ctx context.Context, artifact *core.Artifact) (io.ReadCloser, error)
Get retrieves an artifact from any HTTP/HTTPS URL.
func (*GenericSource) List ¶ added in v0.5.0
List is not implemented for generic source as it requires specific URLs.
func (*GenericSource) Validate ¶ added in v0.5.0
func (s *GenericSource) Validate() error
Validate checks if the source is properly configured.
type GitHubSource ¶
type GitHubSource struct {
*HTTPSource
}
GitHubSource implements core.Source for GitHub releases.
func NewGitHubSource ¶
func NewGitHubSource(logger *logrus.Logger) *GitHubSource
NewGitHubSource creates a new GitHubSource instance.
func (*GitHubSource) Get ¶
func (s *GitHubSource) Get(ctx context.Context, artifact *core.Artifact) (io.ReadCloser, error)
Get retrieves an artifact from GitHub.
func (*GitHubSource) List ¶
List is not implemented for GitHub source as it requires specific release URLs.
func (*GitHubSource) Validate ¶
func (s *GitHubSource) Validate() error
Validate checks if the source is properly configured.
type HTTPSource ¶ added in v0.5.0
type HTTPSource struct {
// contains filtered or unexported fields
}
HTTPSource provides common functionality for HTTP-based sources.
func NewHTTPSource ¶ added in v0.5.0
func NewHTTPSource(logger *logrus.Logger, prefix string) *HTTPSource
NewHTTPSource creates a new HTTPSource instance.
func (*HTTPSource) Close ¶ added in v0.5.0
func (s *HTTPSource) Close() error
Close cleans up any temporary resources.
func (*HTTPSource) DoRequest ¶ added in v0.5.0
DoRequest performs an HTTP request and returns the response.
func (*HTTPSource) DownloadToTempFile ¶ added in v0.5.0
func (s *HTTPSource) DownloadToTempFile(resp *http.Response) (io.ReadCloser, error)
DownloadToTempFile downloads the content from the response to a temporary file.
func (*HTTPSource) EnsureTempDir ¶ added in v0.5.0
func (s *HTTPSource) EnsureTempDir() error
EnsureTempDir ensures that a temporary directory exists for downloads.
func (*HTTPSource) GetLogger ¶ added in v0.5.0
func (s *HTTPSource) GetLogger() *logrus.Logger
GetLogger returns the logger instance.
func (*HTTPSource) SetClient ¶ added in v0.5.0
func (s *HTTPSource) SetClient(client *http.Client)
SetClient sets a custom HTTP client (useful for testing).