pkg

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidMetadata indicates that the metadata provided is not valid.
	ErrInvalidMetadata = errors.New("invalid metadata")
)

Functions

func BuildKey added in v0.14.0

func BuildKey(p *hub.Package) string

BuildKey returns a key that identifies a concrete package version.

func GetPackageMetadata added in v0.12.0

func GetPackageMetadata(mdFile string) (*hub.PackageMetadata, error)

GetPackageMetadata reads, parses and validates the package metadata file provided.

func ParseKey added in v0.14.0

func ParseKey(key string) (string, string)

ParseKey parses a key identifying a package version and returns its name and version.

func PreparePackageFromMetadata added in v0.4.0

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 ValidatePackageMetadata added in v0.4.0

func ValidatePackageMetadata(md *hub.PackageMetadata) error

ValidatePackageMetadata validates if the package metadata provided is valid.

Types

type Manager

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

Manager provides an API to manage packages.

func NewManager

func NewManager(db hub.DB) *Manager

NewManager creates a new Manager instance.

func (*Manager) Get

func (m *Manager) Get(ctx context.Context, input *hub.GetPackageInput) (*hub.Package, error)

Get returns the package identified by the input provided.

func (*Manager) GetChangeLogJSON added in v0.9.0

func (m *Manager) GetChangeLogJSON(ctx context.Context, pkgID string) ([]byte, error)

GetChangeLogJSON returns the changelog for the package identified by the id provided.

func (*Manager) GetHarborReplicationDumpJSON added in v0.13.0

func (m *Manager) GetHarborReplicationDumpJSON(ctx context.Context) ([]byte, error)

GetHarborReplicationDumpJSON returns a json list with all packages versions of kind Helm available so that they can be synchronized in Harbor.

func (*Manager) GetJSON

func (m *Manager) GetJSON(ctx context.Context, input *hub.GetPackageInput) ([]byte, error)

GetJSON returns the package identified by the input provided as a json object. The json object is built by the database.

func (*Manager) GetRandomJSON added in v0.3.0

func (m *Manager) GetRandomJSON(ctx context.Context) ([]byte, error)

GetRandomJSON returns a json object with some random packages. The json object is built by the database.

func (*Manager) GetSnapshotSecurityReportJSON added in v0.7.0

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 added in v0.7.0

func (m *Manager) GetSnapshotsToScan(ctx context.Context) ([]*hub.SnapshotToScan, error)

GetSnapshotsToScan returns the packages' snapshots that need to be scanned for security vulnerabilities.

func (*Manager) GetStarredByUserJSON

func (m *Manager) GetStarredByUserJSON(ctx context.Context) ([]byte, 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

func (m *Manager) GetStarsJSON(ctx context.Context, packageID string) ([]byte, error)

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

func (m *Manager) GetStatsJSON(ctx context.Context) ([]byte, error)

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) GetValuesSchemaJSON added in v0.8.0

func (m *Manager) GetValuesSchemaJSON(ctx context.Context, pkgID, version string) ([]byte, error)

GetValuesSchemaJSON returns the values schema of the package's snapshot identified by the package id and version provided.

func (*Manager) Register

func (m *Manager) Register(ctx context.Context, pkg *hub.Package) error

Register registers the package provided in the database.

func (*Manager) SearchJSON

func (m *Manager) SearchJSON(ctx context.Context, input *hub.SearchPackageInput) ([]byte, 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 added in v0.5.0

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

func (m *Manager) ToggleStar(ctx context.Context, packageID string) error

ToggleStar stars or unstars a given package for the provided user.

func (*Manager) Unregister

func (m *Manager) Unregister(ctx context.Context, pkg *hub.Package) error

Unregister unregisters the package provided from the database.

func (*Manager) UpdateSnapshotSecurityReport added in v0.7.0

func (m *Manager) UpdateSnapshotSecurityReport(ctx context.Context, r *hub.SnapshotSecurityReport) error

UpdateSnapshotSecurityReport updates the security report for the snapshot provided.

type ManagerMock

type ManagerMock struct {
	mock.Mock
}

ManagerMock is a mock implementation of 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) GetChangeLogJSON added in v0.9.0

func (m *ManagerMock) GetChangeLogJSON(ctx context.Context, pkgID string) ([]byte, error)

GetChangeLogJSON implements the PackageManager interface.

func (*ManagerMock) GetHarborReplicationDumpJSON added in v0.13.0

func (m *ManagerMock) GetHarborReplicationDumpJSON(ctx context.Context) ([]byte, error)

GetHarborReplicationDumpJSON 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) GetRandomJSON added in v0.3.0

func (m *ManagerMock) GetRandomJSON(ctx context.Context) ([]byte, error)

GetRandomJSON implements the PackageManager interface.

func (*ManagerMock) GetSnapshotSecurityReportJSON added in v0.7.0

func (m *ManagerMock) GetSnapshotSecurityReportJSON(ctx context.Context, pkgID, version string) ([]byte, error)

GetSnapshotSecurityReportJSON implements the PackageManager interface.

func (*ManagerMock) GetSnapshotsToScan added in v0.7.0

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) ([]byte, error)

GetStarredByUserJSON implements the PackageManager interface.

func (*ManagerMock) GetStarsJSON

func (m *ManagerMock) GetStarsJSON(ctx context.Context, packageID string) ([]byte, error)

GetStarsJSON implements the PackageManager interface.

func (*ManagerMock) GetStatsJSON

func (m *ManagerMock) GetStatsJSON(ctx context.Context) ([]byte, error)

GetStatsJSON implements the PackageManager interface.

func (*ManagerMock) GetValuesSchemaJSON added in v0.8.0

func (m *ManagerMock) GetValuesSchemaJSON(ctx context.Context, pkgID, version string) ([]byte, error)

GetValuesSchemaJSON implements the PackageManager interface.

func (*ManagerMock) Register

func (m *ManagerMock) Register(ctx context.Context, pkg *hub.Package) error

Register implements the PackageManager interface.

func (*ManagerMock) SearchJSON

func (m *ManagerMock) SearchJSON(ctx context.Context, input *hub.SearchPackageInput) ([]byte, error)

SearchJSON implements the PackageManager interface.

func (*ManagerMock) SearchMonocularJSON added in v0.5.0

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

func (m *ManagerMock) Unregister(ctx context.Context, pkg *hub.Package) error

Unregister implements the PackageManager interface.

func (*ManagerMock) UpdateSnapshotSecurityReport added in v0.7.0

func (m *ManagerMock) UpdateSnapshotSecurityReport(ctx context.Context, r *hub.SnapshotSecurityReport) error

UpdateSnapshotSecurityReport implements the PackageManager interface.

Jump to

Keyboard shortcuts

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