Documentation ¶
Index ¶
- Variables
- func BuildKey(p *hub.Package) string
- func GetPackageMetadata(kind hub.RepositoryKind, mdFile string) (*hub.PackageMetadata, error)
- func NormalizeChange(change *hub.Change)
- func ParseKey(key string) (string, string)
- func PreparePackageFromMetadata(md *hub.PackageMetadata) (*hub.Package, error)
- func ValidateAnnotations(kind hub.RepositoryKind, annotations map[string]string) error
- func ValidateChange(change *hub.Change) error
- func ValidateContainersImages(kind hub.RepositoryKind, images []*hub.ContainerImage) error
- func ValidatePackageMetadata(kind hub.RepositoryKind, md *hub.PackageMetadata) error
- func WithFlushFrequency(d time.Duration) func(t *ViewsTracker)
- type Manager
- func (m *Manager) AddProductionUsage(ctx context.Context, repoName, pkgName, orgName string) error
- func (m *Manager) DeleteProductionUsage(ctx context.Context, repoName, pkgName, orgName string) error
- func (m *Manager) Get(ctx context.Context, input *hub.GetPackageInput) (*hub.Package, error)
- func (m *Manager) GetChangelog(ctx context.Context, pkgID string) (*hub.Changelog, error)
- func (m *Manager) GetHarborReplicationDumpJSON(ctx context.Context) ([]byte, error)
- func (m *Manager) GetHelmExporterDumpJSON(ctx context.Context) ([]byte, error)
- func (m *Manager) GetJSON(ctx context.Context, input *hub.GetPackageInput) ([]byte, error)
- func (m *Manager) GetNovaDumpJSON(ctx context.Context) ([]byte, error)
- func (m *Manager) GetProductionUsageJSON(ctx context.Context, repoName, pkgName string) ([]byte, error)
- func (m *Manager) GetRandomJSON(ctx context.Context) ([]byte, error)
- func (m *Manager) GetSnapshotSecurityReportJSON(ctx context.Context, pkgID, version string) ([]byte, error)
- func (m *Manager) GetSnapshotsToScan(ctx context.Context) ([]*hub.SnapshotToScan, error)
- func (m *Manager) GetStarredByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)
- func (m *Manager) GetStarsJSON(ctx context.Context, packageID string) ([]byte, error)
- func (m *Manager) GetStatsJSON(ctx context.Context) ([]byte, error)
- func (m *Manager) GetSummaryJSON(ctx context.Context, input *hub.GetPackageInput) ([]byte, error)
- func (m *Manager) GetValuesSchemaJSON(ctx context.Context, pkgID, version string) ([]byte, error)
- func (m *Manager) GetViewsJSON(ctx context.Context, pkgID string) ([]byte, error)
- func (m *Manager) Register(ctx context.Context, pkg *hub.Package) error
- func (m *Manager) SearchJSON(ctx context.Context, input *hub.SearchPackageInput) (*hub.JSONQueryResult, error)
- func (m *Manager) SearchMonocularJSON(ctx context.Context, baseURL, tsQueryWeb string) ([]byte, error)
- func (m *Manager) ToggleStar(ctx context.Context, packageID string) error
- func (m *Manager) Unregister(ctx context.Context, pkg *hub.Package) error
- func (m *Manager) UpdateSnapshotSecurityReport(ctx context.Context, r *hub.SnapshotSecurityReport) error
- type ManagerMock
- func (m *ManagerMock) AddProductionUsage(ctx context.Context, repoName, pkgName, orgName string) error
- func (m *ManagerMock) DeleteProductionUsage(ctx context.Context, repoName, pkgName, orgName string) error
- func (m *ManagerMock) Get(ctx context.Context, input *hub.GetPackageInput) (*hub.Package, error)
- func (m *ManagerMock) GetChangelog(ctx context.Context, pkgID string) (*hub.Changelog, error)
- func (m *ManagerMock) GetHarborReplicationDumpJSON(ctx context.Context) ([]byte, error)
- func (m *ManagerMock) GetHelmExporterDumpJSON(ctx context.Context) ([]byte, error)
- func (m *ManagerMock) GetJSON(ctx context.Context, input *hub.GetPackageInput) ([]byte, error)
- func (m *ManagerMock) GetNovaDumpJSON(ctx context.Context) ([]byte, error)
- func (m *ManagerMock) GetProductionUsageJSON(ctx context.Context, repoName, pkgName string) ([]byte, error)
- func (m *ManagerMock) GetRandomJSON(ctx context.Context) ([]byte, error)
- func (m *ManagerMock) GetSnapshotSecurityReportJSON(ctx context.Context, pkgID, version string) ([]byte, error)
- func (m *ManagerMock) GetSnapshotsToScan(ctx context.Context) ([]*hub.SnapshotToScan, error)
- func (m *ManagerMock) GetStarredByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)
- func (m *ManagerMock) GetStarsJSON(ctx context.Context, packageID string) ([]byte, error)
- func (m *ManagerMock) GetStatsJSON(ctx context.Context) ([]byte, error)
- func (m *ManagerMock) GetSummaryJSON(ctx context.Context, input *hub.GetPackageInput) ([]byte, error)
- func (m *ManagerMock) GetValuesSchemaJSON(ctx context.Context, pkgID, version string) ([]byte, error)
- func (m *ManagerMock) GetViewsJSON(ctx context.Context, packageID string) ([]byte, error)
- func (m *ManagerMock) Register(ctx context.Context, pkg *hub.Package) error
- func (m *ManagerMock) SearchJSON(ctx context.Context, input *hub.SearchPackageInput) (*hub.JSONQueryResult, error)
- func (m *ManagerMock) SearchMonocularJSON(ctx context.Context, baseURL, tsQueryWeb string) ([]byte, error)
- func (m *ManagerMock) ToggleStar(ctx context.Context, packageID string) error
- func (m *ManagerMock) Unregister(ctx context.Context, pkg *hub.Package) error
- func (m *ManagerMock) UpdateSnapshotSecurityReport(ctx context.Context, r *hub.SnapshotSecurityReport) error
- type ViewsTracker
- type ViewsTrackerMock
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidMetadata indicates that the metadata provided is not valid. ErrInvalidMetadata = errors.New("invalid metadata") )
Functions ¶
func GetPackageMetadata ¶
func GetPackageMetadata(kind hub.RepositoryKind, mdFile string) (*hub.PackageMetadata, error)
GetPackageMetadata reads, parses and validates the package metadata file provided.
func NormalizeChange ¶
NormalizeChange normalizes some values of the change provided when needed.
func ParseKey ¶
ParseKey parses a key identifying a package version and returns its name and version.
func PreparePackageFromMetadata ¶
func PreparePackageFromMetadata(md *hub.PackageMetadata) (*hub.Package, error)
PreparePackageFromMetadata prepares a Package struct that will be used to proceed with a package registration from the PackageMetadata provided by the publisher.
func ValidateAnnotations ¶
func ValidateAnnotations(kind hub.RepositoryKind, annotations map[string]string) error
ValidateAnnotations checks if the provided annotations are valid.
func ValidateChange ¶
ValidateChange validates if the provided change is valid.
func ValidateContainersImages ¶
func ValidateContainersImages(kind hub.RepositoryKind, images []*hub.ContainerImage) error
ValidateContainersImages checks if the provided containers images are valid.
func ValidatePackageMetadata ¶
func ValidatePackageMetadata(kind hub.RepositoryKind, md *hub.PackageMetadata) error
ValidatePackageMetadata validates if the package metadata provided is valid.
func WithFlushFrequency ¶
func WithFlushFrequency(d time.Duration) func(t *ViewsTracker)
WithFlushFrequency allows configuring the views tracker flush frequency.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides an API to manage packages.
func (*Manager) AddProductionUsage ¶
AddProductionUsage adds the given organization to the list of production users for the provided package.
func (*Manager) DeleteProductionUsage ¶
func (m *Manager) DeleteProductionUsage(ctx context.Context, repoName, pkgName, orgName string) error
DeleteProductionUsage deletes the given organization from the list of production users for the provided package.
func (*Manager) GetChangelog ¶
GetChangelog returns the changelog for the package identified by the id provided.
func (*Manager) GetHarborReplicationDumpJSON ¶
GetHarborReplicationDumpJSON returns a json list with all packages versions of kind Helm available so that they can be synchronized in Harbor.
func (*Manager) GetHelmExporterDumpJSON ¶
GetHelmExporterDumpJSON returns a json list with the latest version of all packages of kind Helm available so that they can be used by Helm exporter.
func (*Manager) GetJSON ¶
GetJSON returns the package identified by the input provided as a json object. The json object is built by the database.
func (*Manager) GetNovaDumpJSON ¶
GetNovaDumpJSON returns a json list with some information from all packages of kind Helm available so that it can be used by Fairwinds Nova.
func (*Manager) GetProductionUsageJSON ¶
func (m *Manager) GetProductionUsageJSON(ctx context.Context, repoName, pkgName string) ([]byte, error)
GetProductionUsageJSON returns a json object describing which of the organizations the user belongs to are using the package provided in production.
func (*Manager) GetRandomJSON ¶
GetRandomJSON returns a json object with some random packages. The json object is built by the database.
func (*Manager) GetSnapshotSecurityReportJSON ¶
func (m *Manager) GetSnapshotSecurityReportJSON(ctx context.Context, pkgID, version string) ([]byte, error)
GetSnapshotSecurityReportJSON returns the security report of the package's snapshot identified by the package id and version provided.
func (*Manager) GetSnapshotsToScan ¶
GetSnapshotsToScan returns the packages' snapshots that need to be scanned for security vulnerabilities.
func (*Manager) GetStarredByUserJSON ¶
func (m *Manager) GetStarredByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)
GetStarredByUserJSON returns a json object with packages starred by the user doing the request. The json object is built by the database.
func (*Manager) GetStarsJSON ¶
GetStarsJSON returns the number of stars of the given package, indicating as well if the user doing the request has starred it.
func (*Manager) GetStatsJSON ¶
GetStatsJSON returns a json object describing the number of packages and releases available in the database. The json object is built by the database.
func (*Manager) GetSummaryJSON ¶
GetSummaryJSON returns a summary of the package identified by the input provided as a json object. The json object is built by the database.
func (*Manager) GetValuesSchemaJSON ¶
GetValuesSchemaJSON returns the values schema of the package's snapshot identified by the package id and version provided.
func (*Manager) GetViewsJSON ¶
GetViewsJSON returns a json object with the package views organized by version and day. The json object is built by the database.
func (*Manager) SearchJSON ¶
func (m *Manager) SearchJSON(ctx context.Context, input *hub.SearchPackageInput) (*hub.JSONQueryResult, error)
SearchJSON returns a json object with the search results produced by the input provided. The json object is built by the database.
func (*Manager) SearchMonocularJSON ¶
func (m *Manager) SearchMonocularJSON(ctx context.Context, baseURL, tsQueryWeb string) ([]byte, error)
SearchMonocularJSON returns a json object with the search results produced by the input provided that is compatible with the Monocular search API. The json object is built by the database.
func (*Manager) ToggleStar ¶
ToggleStar stars or unstars a given package for the provided user.
func (*Manager) Unregister ¶
Unregister unregisters the package provided from the database.
func (*Manager) UpdateSnapshotSecurityReport ¶
func (m *Manager) UpdateSnapshotSecurityReport(ctx context.Context, r *hub.SnapshotSecurityReport) error
UpdateSnapshotSecurityReport updates the security report for the snapshot provided.
type ManagerMock ¶
ManagerMock is a mock implementation of the PackageManager interface.
func (*ManagerMock) AddProductionUsage ¶
func (m *ManagerMock) AddProductionUsage(ctx context.Context, repoName, pkgName, orgName string) error
AddProductionUsage implements the PackageManager interface.
func (*ManagerMock) DeleteProductionUsage ¶
func (m *ManagerMock) DeleteProductionUsage(ctx context.Context, repoName, pkgName, orgName string) error
DeleteProductionUsage implements the PackageManager interface.
func (*ManagerMock) Get ¶
func (m *ManagerMock) Get(ctx context.Context, input *hub.GetPackageInput) (*hub.Package, error)
Get implements the PackageManager interface.
func (*ManagerMock) GetChangelog ¶
GetChangelog implements the PackageManager interface.
func (*ManagerMock) GetHarborReplicationDumpJSON ¶
func (m *ManagerMock) GetHarborReplicationDumpJSON(ctx context.Context) ([]byte, error)
GetHarborReplicationDumpJSON implements the PackageManager interface.
func (*ManagerMock) GetHelmExporterDumpJSON ¶
func (m *ManagerMock) GetHelmExporterDumpJSON(ctx context.Context) ([]byte, error)
GetHelmExporterDumpJSON implements the PackageManager interface.
func (*ManagerMock) GetJSON ¶
func (m *ManagerMock) GetJSON(ctx context.Context, input *hub.GetPackageInput) ([]byte, error)
GetJSON implements the PackageManager interface.
func (*ManagerMock) GetNovaDumpJSON ¶
func (m *ManagerMock) GetNovaDumpJSON(ctx context.Context) ([]byte, error)
GetNovaDumpJSON implements the PackageManager interface.
func (*ManagerMock) GetProductionUsageJSON ¶
func (m *ManagerMock) GetProductionUsageJSON(ctx context.Context, repoName, pkgName string) ([]byte, error)
GetProductionUsageJSON implements the PackageManager interface.
func (*ManagerMock) GetRandomJSON ¶
func (m *ManagerMock) GetRandomJSON(ctx context.Context) ([]byte, error)
GetRandomJSON implements the PackageManager interface.
func (*ManagerMock) GetSnapshotSecurityReportJSON ¶
func (m *ManagerMock) GetSnapshotSecurityReportJSON(ctx context.Context, pkgID, version string) ([]byte, error)
GetSnapshotSecurityReportJSON implements the PackageManager interface.
func (*ManagerMock) GetSnapshotsToScan ¶
func (m *ManagerMock) GetSnapshotsToScan(ctx context.Context) ([]*hub.SnapshotToScan, error)
GetSnapshotsToScan implements the PackageManager interface.
func (*ManagerMock) GetStarredByUserJSON ¶
func (m *ManagerMock) GetStarredByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)
GetStarredByUserJSON implements the PackageManager interface.
func (*ManagerMock) GetStarsJSON ¶
GetStarsJSON implements the PackageManager interface.
func (*ManagerMock) GetStatsJSON ¶
func (m *ManagerMock) GetStatsJSON(ctx context.Context) ([]byte, error)
GetStatsJSON implements the PackageManager interface.
func (*ManagerMock) GetSummaryJSON ¶
func (m *ManagerMock) GetSummaryJSON(ctx context.Context, input *hub.GetPackageInput) ([]byte, error)
GetSummaryJSON implements the PackageManager interface.
func (*ManagerMock) GetValuesSchemaJSON ¶
func (m *ManagerMock) GetValuesSchemaJSON(ctx context.Context, pkgID, version string) ([]byte, error)
GetValuesSchemaJSON implements the PackageManager interface.
func (*ManagerMock) GetViewsJSON ¶
GetViewsJSON implements the PackageManager interface.
func (*ManagerMock) SearchJSON ¶
func (m *ManagerMock) SearchJSON(ctx context.Context, input *hub.SearchPackageInput) (*hub.JSONQueryResult, error)
SearchJSON implements the PackageManager interface.
func (*ManagerMock) SearchMonocularJSON ¶
func (m *ManagerMock) SearchMonocularJSON(ctx context.Context, baseURL, tsQueryWeb string) ([]byte, error)
SearchMonocularJSON implements the PackageManager interface.
func (*ManagerMock) ToggleStar ¶
func (m *ManagerMock) ToggleStar(ctx context.Context, packageID string) error
ToggleStar implements the PackageManager interface.
func (*ManagerMock) Unregister ¶
Unregister implements the PackageManager interface.
func (*ManagerMock) UpdateSnapshotSecurityReport ¶
func (m *ManagerMock) UpdateSnapshotSecurityReport(ctx context.Context, r *hub.SnapshotSecurityReport) error
UpdateSnapshotSecurityReport implements the PackageManager interface.
type ViewsTracker ¶
type ViewsTracker struct {
// contains filtered or unexported fields
}
ViewsTracker aggregates packages views that are periodically flushed to the database.
func NewViewsTracker ¶
func NewViewsTracker(db hub.DB, opts ...func(t *ViewsTracker)) *ViewsTracker
New creates a new ViewsTracker instance.
func (*ViewsTracker) Flusher ¶
func (t *ViewsTracker) Flusher(ctx context.Context, wg *sync.WaitGroup)
Flusher handles the periodic flushes of packages views. It'll keep running until the context provided is done.
func (*ViewsTracker) TrackView ¶
func (t *ViewsTracker) TrackView(packageID, version string) error
TrackView tracks a single view for a given package version.
type ViewsTrackerMock ¶
ViewsTrackerMock is a mock implementation of the ViewsTracker interface.
func (*ViewsTrackerMock) TrackView ¶
func (m *ViewsTrackerMock) TrackView(packageID, version string) error
TrackView implements the ViewsTracker interface.