Documentation ¶
Index ¶
- Constants
- Variables
- func GetKindName(kind RepositoryKind) string
- type APIKey
- type APIKeyManager
- type Action
- type AuthorizationPolicy
- type AuthorizeInput
- type Authorizer
- type Change
- type Changelog
- type Channel
- type CheckAPIKeyOutput
- type CheckCredentialsOutput
- type CheckSessionOutput
- type ContainerImage
- type ContainerImageData
- type ContainerImageTag
- type DB
- type EmailSender
- type ErrorsCollector
- type Event
- type EventKind
- type EventManager
- type GetPackageInput
- type HTTPClient
- type HelmIndexLoader
- type JSONQueryResult
- type Link
- type Maintainer
- type Notification
- type NotificationManager
- type OCIPuller
- type OCISignatureChecker
- type OCITagsGetter
- type OLMOCIExporter
- type OptOut
- type Organization
- type OrganizationManager
- type Owner
- type Package
- type PackageCategory
- type PackageCategoryClassifier
- type PackageManager
- type PackageMetadata
- type PackageNotificationTemplateData
- type PackageStats
- type Pagination
- type Provider
- type Recommendation
- type Repository
- type RepositoryCloner
- type RepositoryIgnoreEntry
- type RepositoryKind
- type RepositoryManager
- type RepositoryMetadata
- type RepositoryNotificationTemplateData
- type Screenshot
- type SearchPackageInput
- type SearchRepositoryInput
- type SearchRepositoryResult
- type SecurityReportSummary
- type Session
- type SetupTFAOutput
- type SignKey
- type SnapshotSecurityReport
- type SnapshotToScan
- type StatsManager
- type Subscription
- type SubscriptionManager
- type TFAConfig
- type TektonData
- type TrackerServices
- type TrackerSource
- type TrackerSourceInput
- type TrackerSourceLoader
- type TrackerSourceServices
- type User
- type UserManager
- type Version
- type VersionChanges
- type ViewsTracker
- type Webhook
- type WebhookManager
Constants ¶
const ( // RepositoryMetadataFile represents the name of the file where the // Artifact Hub metadata for a given repository is stored. RepositoryMetadataFile = "boss-net-repo" // RepositoryOCIPrefix represents the prefix expected in the url when the // repository is stored in a OCI registry. RepositoryOCIPrefix = "oci://" )
const ( // Tekton catalog versioning kinds TektonDirBasedVersioning = "directory" TektonGitBasedVersioning = "git" )
const ( // HasNotChanged is a snapshot digest value that indicates that the digest // has not changed. HasNotChanged = "has-not-changed" )
const ( // PackageMetadataFile represents the name of the file where the Artifact // Hub metadata for a given package is stored. PackageMetadataFile = "boss-net-pkg" )
Variables ¶
var ( // ErrInvalidInput indicates that the input provided is not valid. ErrInvalidInput = errors.New("invalid input") // ErrInsufficientPrivilege indicates that the user does not have the // required privilege to perform the operation. ErrInsufficientPrivilege = errors.New("insufficient_privilege") // ErrNotFound indicates that the requested item was not found. ErrNotFound = errors.New("not found") )
var IndexMetaDescriptionKey = indexMetaDescriptionKey{}
IndexMetaDescriptionKey represents the key used for the description in the index metadata.
var IndexMetaTitleKey = indexMetaTitleKey{}
IndexMetaTitleKey represents the key used for the title in the index metadata.
var UserIDKey = userIDKey{}
UserIDKey represents the key used for the userID value inside a context.
Functions ¶
func GetKindName ¶
func GetKindName(kind RepositoryKind) string
GetKindName returns the name of the provided repository kind.
Types ¶
type APIKey ¶
type APIKey struct { APIKeyID string `json:"api_key_id"` Name string `json:"name"` Secret string `json:"secret"` CreatedAt int64 `json:"created_at"` UserID string `json:"user_id"` }
APIKey represents a key used to interact with the HTTP API.
type APIKeyManager ¶
type APIKeyManager interface { Add(ctx context.Context, ak *APIKey) (*APIKey, error) Check(ctx context.Context, apiKeyID, apiKeySecret string) (*CheckAPIKeyOutput, error) Delete(ctx context.Context, apiKeyID string) error GetJSON(ctx context.Context, apiKeyID string) ([]byte, error) GetOwnedByUserJSON(ctx context.Context, p *Pagination) (*JSONQueryResult, error) Update(ctx context.Context, ak *APIKey) error }
APIKeyManager describes the methods an APIKeyManager implementation must provide.
type Action ¶
type Action string
Action represents the kind of action a user intends to perform.
const ( // AddOrganizationMember represents the action of adding a member to an // organization. AddOrganizationMember Action = "addOrganizationMember" // AddOrganizationRepository represents the action of adding a repository // to an organization. AddOrganizationRepository Action = "addOrganizationRepository" // DeleteOrganization represents the action of deleting an organization. DeleteOrganization Action = "deleteOrganization" // DeleteOrganizationMember represents the action of deleting a member from // an organization. DeleteOrganizationMember Action = "deleteOrganizationMember" // DeleteOrganizationRepository represents the action of deleting a // repository from an organization. DeleteOrganizationRepository Action = "deleteOrganizationRepository" // GetAuthorizationPolicy represents the action of getting an organization // authorization policy. GetAuthorizationPolicy Action = "getAuthorizationPolicy" // TransferOrganizationRepository represents the action of transferring a // repository that belongs to an organization. TransferOrganizationRepository Action = "transferOrganizationRepository" // UpdateAuthorizationPolicy represents the action of updating an // organization authorization policy. UpdateAuthorizationPolicy Action = "updateAuthorizationPolicy" // UpdateOrganization represents the action of updating the details of an // organization. UpdateOrganization Action = "updateOrganization" // UpdateOrganizationRepository represents the action of updating a // repository that belongs to an organization. UpdateOrganizationRepository Action = "updateOrganizationRepository" )
type AuthorizationPolicy ¶
type AuthorizationPolicy struct { AuthorizationEnabled bool `json:"authorization_enabled"` PredefinedPolicy string `json:"predefined_policy"` CustomPolicy string `json:"custom_policy"` PolicyData json.RawMessage `json:"policy_data"` }
AuthorizationPolicy represents some information about the authorization policy for an organization.
type AuthorizeInput ¶
type AuthorizeInput struct { // OrganizationName represents the name of the organization owning the // resource affected by the action. OrganizationName string // UserID represents the id of the user who intends to perform the action. UserID string // Action represents the action to perform. Action Action }
AuthorizeInput represents the input required to call Authorize.
type Authorizer ¶
type Authorizer interface { Authorize(ctx context.Context, input *AuthorizeInput) error GetAllowedActions(ctx context.Context, userID, orgName string) ([]Action, error) WillUserBeLockedOut(ctx context.Context, newPolicy *AuthorizationPolicy, userID string) (bool, error) }
Authorizer describes the methods an Authorizer implementation must provide.
type Change ¶
type Change struct { Kind string `json:"kind,omitempty"` Description string `json:"description"` Links []*Link `json:"links,omitempty"` }
Change represents a change introduced in a package version.
type CheckAPIKeyOutput ¶
CheckAPIKeyOutput represents the output returned by the CheckApiKey method.
type CheckCredentialsOutput ¶
CheckCredentialsOutput represents the output returned by the CheckCredentials method.
type CheckSessionOutput ¶
CheckSessionOutput represents the output returned by the CheckSession method.
type ContainerImage ¶
type ContainerImage struct { Name string `json:"name" yaml:"name"` Image string `json:"image" yaml:"image"` Whitelisted bool `json:"whitelisted" yaml:"whitelisted"` Platforms []string `json:"platforms" yaml:"platforms"` }
ContainerImage represents a container image associated with a package.
type ContainerImageData ¶
type ContainerImageData struct {
Tags []ContainerImageTag `json:"tags"`
}
ContainerImageData represents some data specific to repositories of the container image kind.
type ContainerImageTag ¶
ContainerImageTag represents some information about a container image tag.
type DB ¶
type DB interface { Acquire(ctx context.Context) (*pgxpool.Conn, error) Begin(ctx context.Context) (pgx.Tx, error) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row }
DB defines the methods the database handler must provide.
type EmailSender ¶
EmailSender defines the methods the email sender must provide.
type ErrorsCollector ¶
type ErrorsCollector interface { Append(repositoryID string, err string) Flush() Init(repositoryID string) }
ErrorsCollector interface defines the methods that an errors collector implementation should provide.
type Event ¶
type Event struct { EventID string `json:"event_id"` EventKind EventKind `json:"event_kind"` RepositoryID string `json:"repository_id"` PackageID string `json:"package_id"` PackageVersion string `json:"package_version"` Data map[string]interface{} `json:"data"` }
Event represents the details of an event.
type EventKind ¶
type EventKind int64
EventKind represents the kind of an event.
const ( // NewRelease represents an event for a new package release. NewRelease EventKind = 0 // SecurityAlert represents an event for a security alert. SecurityAlert EventKind = 1 // RepositoryTrackingErrors represents an event for errors that occur while // a repository is being tracked. RepositoryTrackingErrors EventKind = 2 // RepositoryOwnershipClaim represents an event for a repository ownership // claim. RepositoryOwnershipClaim EventKind = 3 // RepositoryScanningErrors represents an event for errors that occur while // a repository is being scanned. RepositoryScanningErrors EventKind = 4 )
type EventManager ¶
EventManager describes the methods an EventManager implementation must provide.
type GetPackageInput ¶
type GetPackageInput struct { PackageID string `json:"package_id"` RepositoryName string `json:"repository_name"` PackageName string `json:"package_name"` Version string `json:"version"` }
GetPackageInput represents the input used to get a specific package.
type HTTPClient ¶
HTTPClient defines the methods an HTTPClient implementation must provide.
type HelmIndexLoader ¶
type HelmIndexLoader interface {
LoadIndex(r *Repository) (*helmrepo.IndexFile, string, error)
}
HelmIndexLoader interface defines the methods a Helm index loader implementation should provide.
type JSONQueryResult ¶
JSONQueryResult represents the result of a database query that returns json data alongside some metadata.
type Maintainer ¶
type Maintainer struct { MaintainerID string `json:"maintainer_id"` Name string `json:"name" yaml:"name"` Email string `json:"email" yaml:"email"` }
Maintainer represents a package's maintainer.
type Notification ¶
type Notification struct { NotificationID string `json:"notification_id"` Event *Event `json:"event"` User *User `json:"user"` Webhook *Webhook `json:"webhook"` }
Notification represents the details of a notification pending to be delivered.
type NotificationManager ¶
type NotificationManager interface { Add(ctx context.Context, tx pgx.Tx, n *Notification) error GetPending(ctx context.Context, tx pgx.Tx) (*Notification, error) UpdateStatus( ctx context.Context, tx pgx.Tx, notificationID string, delivered bool, deliveryErr error, ) error }
NotificationManager describes the methods an NotificationManager implementation must provide.
type OCIPuller ¶
type OCIPuller interface { PullLayer( ctx context.Context, ref, mediaType, username, password string, ) (ocispec.Descriptor, []byte, error) }
OCIPuller defines the methods an OCIPuller implementation must provide.
type OCISignatureChecker ¶
type OCISignatureChecker interface {
HasCosignSignature(ctx context.Context, ref, username, password string) (bool, error)
}
SignatureChecker is the interface that wraps the HasCosignSignature method, used to check if the OCI artifact identified by the reference provided has a cosign (sigstore) signature.
type OCITagsGetter ¶
type OCITagsGetter interface {
Tags(ctx context.Context, r *Repository, onlySemver bool) ([]string, error)
}
OCITagsGetter is the interface that wraps the Tags method, used to get all the tags available for a given repository in a OCI registry.
type OLMOCIExporter ¶
type OLMOCIExporter interface {
ExportRepository(ctx context.Context, r *Repository) (tmpDir string, err error)
}
OLMOCIExporter describes the methods an OLMOCIExporter implementation must provide.
type OptOut ¶
type OptOut struct { OptOutID string `json:"opt_out_id"` UserID string `json:"user_id"` RepositoryID string `json:"repository_id"` EventKind EventKind `json:"event_kind"` }
OptOut represents a user's opt-out entry to stop receiving notifications about a given repository and event kind.
type Organization ¶
type Organization struct { OrganizationID string `json:"organization_id"` Name string `json:"name"` DisplayName string `json:"display_name"` Description string `json:"description"` HomeURL string `json:"home_url"` LogoImageID string `json:"logo_image_id"` }
Organization represents an entity with one or more users associated that can own repositories and other entities like webhooks.
type OrganizationManager ¶
type OrganizationManager interface { Add(ctx context.Context, org *Organization) error AddMember(ctx context.Context, orgName, userAlias string) error CheckAvailability(ctx context.Context, resourceKind, value string) (bool, error) ConfirmMembership(ctx context.Context, orgName string) error Delete(ctx context.Context, orgName string) error DeleteMember(ctx context.Context, orgName, userAlias string) error GetJSON(ctx context.Context, orgName string) ([]byte, error) GetByUserJSON(ctx context.Context, p *Pagination) (*JSONQueryResult, error) GetAuthorizationPolicyJSON(ctx context.Context, orgName string) ([]byte, error) GetMembersJSON(ctx context.Context, orgName string, p *Pagination) (*JSONQueryResult, error) Update(ctx context.Context, orgName string, org *Organization) error UpdateAuthorizationPolicy(ctx context.Context, orgName string, policy *AuthorizationPolicy) error }
OrganizationManager describes the methods an OrganizationManager implementation must provide.
type Package ¶
type Package struct { PackageID string `json:"package_id" hash:"ignore"` Name string `json:"name"` NormalizedName string `json:"normalized_name" hash:"ignore"` AlternativeName string `json:"alternative_name"` Category PackageCategory `json:"category"` LogoURL string `json:"logo_url"` LogoImageID string `json:"logo_image_id" hash:"ignore"` IsOperator bool `json:"is_operator"` Official bool `json:"official" hash:"ignore"` CNCF bool `json:"cncf" hash:"ignore"` Channels []*Channel `json:"channels"` DefaultChannel string `json:"default_channel"` DisplayName string `json:"display_name"` Description string `json:"description"` Keywords []string `json:"keywords"` HomeURL string `json:"home_url"` Readme string `json:"readme"` Install string `json:"install"` Links []*Link `json:"links"` Capabilities string `json:"capabilities"` CRDs []interface{} `json:"crds"` CRDsExamples []interface{} `json:"crds_examples"` SecurityReportSummary *SecurityReportSummary `json:"security_report_summary" hash:"ignore"` SecurityReportCreatedAt int64 `json:"security_report_created_at,omitempty" hash:"ignore"` Data map[string]interface{} `json:"data"` Version string `json:"version"` AvailableVersions []*Version `json:"available_versions" hash:"ignore"` AppVersion string `json:"app_version"` Digest string `json:"digest"` Deprecated bool `json:"deprecated"` License string `json:"license"` Signed bool `json:"signed"` Signatures []string `json:"signatures"` ContentURL string `json:"content_url"` ContainersImages []*ContainerImage `json:"containers_images"` AllContainersImagesWhitelisted bool `json:"all_containers_images_whitelisted" hash:"ignore"` Provider string `json:"provider"` HasValuesSchema bool `json:"has_values_schema" hash:"ignore"` ValuesSchema json.RawMessage `json:"values_schema,omitempty"` HasChangelog bool `json:"has_changelog" hash:"ignore"` Changes []*Change `json:"changes"` ContainsSecurityUpdates bool `json:"contains_security_updates"` Prerelease bool `json:"prerelease"` Maintainers []*Maintainer `json:"maintainers"` Recommendations []*Recommendation `json:"recommendations"` Screenshots []*Screenshot `json:"screenshots"` SignKey *SignKey `json:"sign_key"` Repository *Repository `json:"repository" hash:"ignore"` TS int64 `json:"ts,omitempty" hash:"ignore"` Stats *PackageStats `json:"stats" hash:"ignore"` ProductionOrganizations []*Organization `json:"production_organizations" hash:"ignore"` RelativePath string `json:"relative_path"` }
Package represents a Kubernetes package.
func (*Package) SetAutoGeneratedDigest ¶
SetAutoGeneratedDigest sets an auto generated digest in the package.
type PackageCategory ¶
type PackageCategory int64
PackageCategory represents the category of a given package.
const ( SkipCategoryPrediction PackageCategory = -1 UnknownCategory PackageCategory = 0 AIMachineLearning PackageCategory = 1 Database PackageCategory = 2 IntegrationDelivery PackageCategory = 3 MonitoringLogging PackageCategory = 4 Networking PackageCategory = 5 Security PackageCategory = 6 Storage PackageCategory = 7 StreamingMessaging PackageCategory = 8 )
func PackageCategoryFromName ¶
func PackageCategoryFromName(category string) (PackageCategory, error)
PackageCategoryFromName returns the corresponding category from the name provided.
type PackageCategoryClassifier ¶
type PackageCategoryClassifier interface {
Predict(p *Package) PackageCategory
}
PackageCategoryClassifier describes the methods a PackageCategoryClassifier implementation must provide.
type PackageManager ¶
type PackageManager interface { AddProductionUsage(ctx context.Context, repoName, pkgName, orgName string) error DeleteProductionUsage(ctx context.Context, repoName, pkgName, orgName string) error Get(ctx context.Context, input *GetPackageInput) (*Package, error) GetChangelog(ctx context.Context, pkgID string) (*Changelog, error) GetHarborReplicationDumpJSON(ctx context.Context) ([]byte, error) GetHelmExporterDumpJSON(ctx context.Context) ([]byte, error) GetJSON(ctx context.Context, input *GetPackageInput) ([]byte, error) GetNovaDumpJSON(ctx context.Context) ([]byte, error) GetProductionUsageJSON(ctx context.Context, repoName, pkgName string) ([]byte, error) GetRandomJSON(ctx context.Context) ([]byte, error) GetSnapshotSecurityReportJSON(ctx context.Context, pkgID, version string) ([]byte, error) GetSnapshotsToScan(ctx context.Context) ([]*SnapshotToScan, error) GetStarredByUserJSON(ctx context.Context, p *Pagination) (*JSONQueryResult, error) GetStarsJSON(ctx context.Context, packageID string) ([]byte, error) GetStatsJSON(ctx context.Context) ([]byte, error) GetSummaryJSON(ctx context.Context, input *GetPackageInput) ([]byte, error) GetValuesSchemaJSON(ctx context.Context, pkgID, version string) ([]byte, error) GetViewsJSON(ctx context.Context, packageID string) ([]byte, error) Register(ctx context.Context, pkg *Package) error SearchJSON(ctx context.Context, input *SearchPackageInput) (*JSONQueryResult, error) SearchMonocularJSON(ctx context.Context, baseURL, tsQueryWeb string) ([]byte, error) ToggleStar(ctx context.Context, packageID string) error UpdateSnapshotSecurityReport(ctx context.Context, r *SnapshotSecurityReport) error Unregister(ctx context.Context, pkg *Package) error }
PackageManager describes the methods a PackageManager implementation must provide.
type PackageMetadata ¶
type PackageMetadata struct { Version string `yaml:"version"` Name string `yaml:"name"` AlternativeName string `yaml:"alternativeName"` Category string `yaml:"category"` DisplayName string `yaml:"displayName"` CreatedAt string `yaml:"createdAt"` Description string `yaml:"description"` LogoPath string `yaml:"logoPath"` LogoURL string `yaml:"logoURL"` Digest string `yaml:"digest"` License string `yaml:"license"` HomeURL string `yaml:"homeURL"` AppVersion string `yaml:"appVersion"` PublisherID string `yaml:"publisherID"` ContainersImages []*ContainerImage `yaml:"containersImages"` Operator bool `yaml:"operator"` Deprecated bool `yaml:"deprecated"` Keywords []string `yaml:"keywords"` Links []*Link `yaml:"links"` Readme string `yaml:"readme"` Install string `yaml:"install"` Changes []*Change `yaml:"changes"` ContainsSecurityUpdates bool `yaml:"containsSecurityUpdates"` Prerelease bool `yaml:"prerelease"` Maintainers []*Maintainer `yaml:"maintainers"` Provider *Provider `yaml:"provider"` Ignore []string `yaml:"ignore"` Recommendations []*Recommendation `yaml:"recommendations"` Screenshots []*Screenshot `yaml:"screenshots"` Annotations map[string]string `yaml:"annotations"` }
PackageMetadata represents some metadata about a given package. It's usually provided by repositories publishers, to provide the required information about the content they'd like to be indexed.
type PackageNotificationTemplateData ¶
type PackageNotificationTemplateData struct { BaseURL string `json:"base_url"` Event map[string]interface{} `json:"event"` Package map[string]interface{} `json:"package"` Theme map[string]string `json:"theme"` }
PackageNotificationTemplateData represents some details of a notification about a given package that will be exposed to notification templates.
type PackageStats ¶
type PackageStats struct { Subscriptions int `json:"subscriptions"` Webhooks int `json:"webhooks"` }
PackageStats represents some statistics about a package.
type Pagination ¶
Pagination defines some information about the results page to fetch.
type Provider ¶
type Provider struct {
Name string `yaml:"name"`
}
Provider represents a package's provider.
type Recommendation ¶
type Recommendation struct {
URL string `json:"url" yaml:"url"`
}
Recommendation represents some information about a recommended package.
type Repository ¶
type Repository struct { RepositoryID string `json:"repository_id"` Name string `json:"name"` DisplayName string `json:"display_name"` URL string `json:"url"` Branch string `json:"branch"` Private bool `json:"private"` AuthUser string `json:"auth_user"` AuthPass string `json:"auth_pass"` Digest string `json:"digest"` Kind RepositoryKind `json:"kind"` UserID string `json:"user_id"` UserAlias string `json:"user_alias"` OrganizationID string `json:"organization_id"` OrganizationName string `json:"organization_name"` OrganizationDisplayName string `json:"organization_display_name"` LastScanningErrors string `json:"last_scanning_errors"` LastTrackingErrors string `json:"last_tracking_errors"` VerifiedPublisher bool `json:"verified_publisher"` Official bool `json:"official"` CNCF bool `json:"cncf"` Disabled bool `json:"disabled"` ScannerDisabled bool `json:"scanner_disabled"` Data json.RawMessage `json:"data,omitempty"` }
Repository represents a packages repository.
type RepositoryCloner ¶
type RepositoryCloner interface { // CloneRepository clones the packages repository provided in a temporary // dir, returning the temporary directory path and the path where the // packages are located. It's the caller's responsibility to delete the // temporary dir when done. CloneRepository(ctx context.Context, r *Repository) (tmpDir string, packagesPath string, err error) }
RepositoryCloner describes the methods a RepositoryCloner implementation must provide.
type RepositoryIgnoreEntry ¶
RepositoryIgnoreEntry represents an entry in the ignore list. This list is meant to be used as a way to exclude packages from being indexed by Artifact Hub. The name corresponds to a package name, and it must be an exact match. The version field is a regular expression.
type RepositoryKind ¶
type RepositoryKind int64
RepositoryKind represents the kind of a given repository.
const ( // Helm represents a repository with Helm charts. Helm RepositoryKind = 0 // Falco represents a repository with Falco rules. Falco RepositoryKind = 1 // OPA represents a repository with OPA policies. OPA RepositoryKind = 2 // OLM represents a repository with OLM operators. OLM RepositoryKind = 3 // TBAction represents a repository with Tinkerbell actions. TBAction RepositoryKind = 4 // Krew represents a repository with kubectl plugins that can be managed by // the Krew plugin manager. Krew RepositoryKind = 5 // HelmPlugin represents a repository with Helm plugins. HelmPlugin RepositoryKind = 6 // TektonTask represents a repository with Tekton tasks. TektonTask RepositoryKind = 7 // KedaScaler represents a repository with KEDA scalers. KedaScaler RepositoryKind = 8 // CoreDNS represents a repository with CoreDNS plugins. CoreDNS RepositoryKind = 9 // Keptn represents a repository with Keptn integrations. Keptn RepositoryKind = 10 // TektonPipeline represents a repository with Tekton pipelines. TektonPipeline RepositoryKind = 11 // Container represents a repository with containers images. Container RepositoryKind = 12 // Kubewarden represents a repository with Kubewarden policies. Kubewarden RepositoryKind = 13 // Gatekeeper represents a repository with Gatekeeper policies. Gatekeeper RepositoryKind = 14 // Kyverno represents a repository with Kyverno policies. Kyverno RepositoryKind = 15 // KnativeClientPlugin represents a repository with Knative client plugins. KnativeClientPlugin RepositoryKind = 16 // Backstage represents a repository with Backstage plugins. Backstage RepositoryKind = 17 // ArgoTemplate represents a repository with Argo templates. ArgoTemplate RepositoryKind = 18 // KubeArmor represents a repository with KubeArmor policies. KubeArmor RepositoryKind = 19 )
func GetKindFromName ¶
func GetKindFromName(kind string) (RepositoryKind, error)
GetKindFromName returns the kind of the provided repository from the name provided.
type RepositoryManager ¶
type RepositoryManager interface { Add(ctx context.Context, orgName string, r *Repository) error CheckAvailability(ctx context.Context, resourceKind, value string) (bool, error) ClaimOwnership(ctx context.Context, name, orgName string) error Delete(ctx context.Context, name string) error GetByID(ctx context.Context, repositoryID string, includeCredentials bool) (*Repository, error) GetByName(ctx context.Context, name string, includeCredentials bool) (*Repository, error) GetMetadata(r *Repository, basePath string) (*RepositoryMetadata, error) GetPackagesDigest(ctx context.Context, repositoryID string) (map[string]string, error) GetRemoteDigest(ctx context.Context, r *Repository) (string, error) Search(ctx context.Context, input *SearchRepositoryInput) (*SearchRepositoryResult, error) SearchJSON(ctx context.Context, input *SearchRepositoryInput) (*JSONQueryResult, error) SetLastScanningResults(ctx context.Context, repositoryID, errs string) error SetLastTrackingResults(ctx context.Context, repositoryID, errs string) error SetVerifiedPublisher(ctx context.Context, repositoryID string, verified bool) error Transfer(ctx context.Context, name, orgName string, ownershipClaim bool) error Update(ctx context.Context, r *Repository) error UpdateDigest(ctx context.Context, repositoryID, digest string) error }
RepositoryManager describes the methods an RepositoryManager implementation must provide.
type RepositoryMetadata ¶
type RepositoryMetadata struct { RepositoryID string `yaml:"repositoryID"` Owners []*Owner `yaml:"owners,omitempty"` Ignore []*RepositoryIgnoreEntry `yaml:"ignore,omitempty"` }
RepositoryMetadata represents some metadata about a given repository. It's usually provided by repositories publishers, to provide some extra context about the repository they'd like to publish.
type RepositoryNotificationTemplateData ¶
type RepositoryNotificationTemplateData struct { BaseURL string `json:"base_url"` Event map[string]interface{} `json:"event"` Repository map[string]interface{} `json:"repository"` Theme map[string]string `json:"theme"` }
RepositoryNotificationTemplateData represents some details of a notification about a given repository that will be exposed to notification templates.
type Screenshot ¶
type Screenshot struct { Title string `json:"title" yaml:"title"` URL string `json:"url" yaml:"url"` }
Screenshot represents a screenshot associated with a package.
type SearchPackageInput ¶
type SearchPackageInput struct { Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` Facets bool `json:"facets"` TSQueryWeb string `json:"ts_query_web,omitempty"` TSQuery string `json:"ts_query,omitempty"` Users []string `json:"users,omitempty"` Orgs []string `json:"orgs,omitempty"` Repositories []string `json:"repositories,omitempty"` RepositoryKinds []RepositoryKind `json:"repository_kinds,omitempty"` Categories []PackageCategory `json:"categories,omitempty"` VerifiedPublisher bool `json:"verified_publisher"` Official bool `json:"official"` CNCF bool `json:"cncf"` Operators bool `json:"operators"` Deprecated bool `json:"deprecated"` Licenses []string `json:"licenses,omitempty"` Capabilities []string `json:"capabilities,omitempty"` Sort string `json:"sort,omitempty"` }
SearchPackageInput represents the query input when searching for packages.
type SearchRepositoryInput ¶
type SearchRepositoryInput struct { Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` Kinds []RepositoryKind `json:"kinds,omitempty"` Orgs []string `json:"orgs,omitempty"` Users []string `json:"users,omitempty"` IncludeCredentials bool `json:"include_credentials"` Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` }
SearchRepositoryInput represents the query input when searching for repositories.
type SearchRepositoryResult ¶
type SearchRepositoryResult struct { Repositories []*Repository TotalCount int }
SearchRepositoryResult represents the result of a repositories search.
type SecurityReportSummary ¶
type SecurityReportSummary struct { Critical int `json:"critical"` High int `json:"high"` Medium int `json:"medium"` Low int `json:"low"` Unknown int `json:"unknown"` }
SecurityReportSummary represents a summary of the security report.
type Session ¶
type Session struct { SessionID string `json:"session_id"` UserID string `json:"user_id"` IP string `json:"ip"` UserAgent string `json:"user_agent"` Approved bool `json:"approved"` }
Session represents some information about a user session.
type SetupTFAOutput ¶
type SetupTFAOutput struct { QRCode string `json:"qr_code"` RecoveryCodes []string `json:"recovery_codes"` Secret string `json:"secret"` }
SetupTFAOutput represents the output returned by the SetupTFA method.
type SignKey ¶
type SignKey struct { Fingerprint string `json:"fingerprint" yaml:"fingerprint"` URL string `json:"url" yaml:"url"` }
SignKey represents a key used to sign a package version.
type SnapshotSecurityReport ¶
type SnapshotSecurityReport struct { PackageID string `json:"package_id"` Version string `json:"version"` AlertDigest string `json:"alert_digest"` ImagesReports map[string]*trivy.Report `json:"images_reports"` Summary *SecurityReportSummary `json:"summary"` }
SnapshotSecurityReport represents some information about the security vulnerabilities the images used by a given package's snapshot may have.
type SnapshotToScan ¶
type SnapshotToScan struct { RepositoryID string `json:"repository_id"` PackageID string `json:"package_id"` PackageName string `json:"package_name"` Version string `json:"version"` ContainersImages []*ContainerImage `json:"containers_images"` }
SnapshotToScan represents some information about a package's snapshot that needs to be scanned for security vulnerabilities.
type StatsManager ¶
StatsManager describes the methods an StatsManager implementation must provide.
type Subscription ¶
type Subscription struct { UserID string `json:"user_id"` PackageID string `json:"package_id"` EventKind EventKind `json:"event_kind"` }
Subscription represents a user's subscription to receive notifications about a given package and event kind.
type SubscriptionManager ¶
type SubscriptionManager interface { Add(ctx context.Context, s *Subscription) error AddOptOut(ctx context.Context, o *OptOut) error Delete(ctx context.Context, s *Subscription) error DeleteOptOut(ctx context.Context, optOutID string) error GetByPackageJSON(ctx context.Context, packageID string) ([]byte, error) GetByUserJSON(ctx context.Context, p *Pagination) (*JSONQueryResult, error) GetOptOutListJSON(ctx context.Context, p *Pagination) (*JSONQueryResult, error) GetSubscriptors(ctx context.Context, e *Event) ([]*User, error) }
SubscriptionManager describes the methods a SubscriptionManager implementation must provide.
type TFAConfig ¶
type TFAConfig struct { Enabled bool `json:"enabled"` RecoveryCodes []string `json:"recovery_codes"` URL string `json:"url"` }
TFAConfig represents the TFA configuration for a given user.
type TektonData ¶
type TektonData struct {
Versioning string `json:"versioning"` // Options: directory or git
}
TektonData represents some data specific to repositories of the Tekton tasks or pipelines kinds.
type TrackerServices ¶
type TrackerServices struct { Ctx context.Context Cfg *viper.Viper Rm RepositoryManager Pm PackageManager Rc RepositoryCloner Oe OLMOCIExporter Ec ErrorsCollector Hc HTTPClient Op OCIPuller Is img.Store Sc OCISignatureChecker Pcc PackageCategoryClassifier SetupTrackerSource TrackerSourceLoader }
TrackerServices represents a set of services that must be provided to a Tracker instance so that it can perform its tasks.
type TrackerSource ¶
type TrackerSource interface { // GetPackagesAvailable represents a function that returns a list of // available packages in a given repository. Each repository kind will // require using a specific TrackerSource implementation that will know // best how to get the available packages in the repository. The key used // in the returned map is expected to be built using the BuildKey helper // function in the pkg package. GetPackagesAvailable() (map[string]*Package, error) }
TrackerSource defines the methods a TrackerSource implementation must provide.
type TrackerSourceInput ¶
type TrackerSourceInput struct { Repository *Repository RepositoryDigest string PackagesRegistered map[string]string BasePath string Svc *TrackerSourceServices }
TrackerSourceInput represents the input provided to a TrackerSource to get the packages available in a repository when tracking it.
type TrackerSourceLoader ¶
type TrackerSourceLoader func(i *TrackerSourceInput) TrackerSource
TrackerSourceLoader represents a function that sets up the appropriate tracker source for a given repository.
type TrackerSourceServices ¶
type TrackerSourceServices struct { Ctx context.Context Cfg *viper.Viper Ec ErrorsCollector Hc HTTPClient Op OCIPuller Is img.Store Sc OCISignatureChecker Logger zerolog.Logger }
TrackerSourceServices represents a set of services that will be provided to a TrackerSource instance so that it can perform its tasks.
type User ¶
type User struct { UserID string `json:"user_id"` Alias string `json:"alias"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` Password string `json:"password"` ProfileImageID string `json:"profile_image_id"` PasswordSet bool `json:"password_set"` TFAEnabled bool `json:"tfa_enabled"` }
User represents a Hub user.
type UserManager ¶
type UserManager interface { ApproveSession(ctx context.Context, sessionID, passcode string) error CheckAvailability(ctx context.Context, resourceKind, value string) (bool, error) CheckCredentials(ctx context.Context, email, password string) (*CheckCredentialsOutput, error) CheckSession(ctx context.Context, sessionID string, duration time.Duration) (*CheckSessionOutput, error) DeleteSession(ctx context.Context, sessionID string) error DeleteUser(ctx context.Context, code string) error DisableTFA(ctx context.Context, passcode string) error EnableTFA(ctx context.Context, passcode string) error GetProfile(ctx context.Context) (*User, error) GetProfileJSON(ctx context.Context) ([]byte, error) GetUserID(ctx context.Context, email string) (string, error) RegisterDeleteUserCode(ctx context.Context) error RegisterPasswordResetCode(ctx context.Context, userEmail string) error RegisterSession(ctx context.Context, session *Session) (*Session, error) RegisterUser(ctx context.Context, user *User) error ResetPassword(ctx context.Context, code, newPassword string) error SetupTFA(ctx context.Context) ([]byte, error) UpdatePassword(ctx context.Context, old, new string) error UpdateProfile(ctx context.Context, user *User) error VerifyEmail(ctx context.Context, code string) (bool, error) VerifyPasswordResetCode(ctx context.Context, code string) error }
UserManager describes the methods a UserManager implementation must provide.
type VersionChanges ¶
type VersionChanges struct { Version string `json:"version"` Changes []*Change `json:"changes"` TS int64 `json:"ts"` ContainsSecurityUpdates bool `json:"contains_security_updates"` Prerelease bool `json:"prerelease"` }
VersionChanges represents the changes introduced by a given package's version along with some extra metadata.
type ViewsTracker ¶
ViewsTracker describes the methods a ViewsTracker implementation must provide.
type Webhook ¶
type Webhook struct { WebhookID string `json:"webhook_id"` Name string `json:"name"` Description string `json:"description"` URL string `json:"url"` Secret string `json:"secret"` ContentType string `json:"content_type"` Template string `json:"template"` Active bool `json:"active"` EventKinds []EventKind `json:"event_kinds"` Packages []*Package `json:"packages"` }
Webhook represents the configuration of a webhook where notifications will be posted to.
type WebhookManager ¶
type WebhookManager interface { Add(ctx context.Context, orgName string, wh *Webhook) error Delete(ctx context.Context, webhookID string) error GetJSON(ctx context.Context, webhookID string) ([]byte, error) GetOwnedByOrgJSON(ctx context.Context, orgName string, p *Pagination) (*JSONQueryResult, error) GetOwnedByUserJSON(ctx context.Context, p *Pagination) (*JSONQueryResult, error) GetSubscribedTo(ctx context.Context, e *Event) ([]*Webhook, error) Update(ctx context.Context, wh *Webhook) error }
WebhookManager describes the methods a WebhookManager implementation must provide.