Documentation ¶
Index ¶
- Variables
- type APIKey
- type APIKeyManager
- type ChartRepository
- type ChartRepositoryIndexLoader
- type ChartRepositoryManager
- type CheckAPIKeyOutput
- type CheckCredentialsOutput
- type CheckSessionOutput
- type DB
- type EmailSender
- type Event
- type EventKind
- type EventManager
- type GetPackageInput
- type Link
- type Maintainer
- type Notification
- type NotificationManager
- type NotificationTemplateData
- type Organization
- type OrganizationManager
- type Package
- type PackageKind
- type PackageManager
- type SearchPackageInput
- type Session
- type Subscription
- type SubscriptionManager
- type User
- type UserManager
- type Webhook
- type WebhookManager
Constants ¶
This section is empty.
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 ¶
This section is empty.
Types ¶
type APIKey ¶ added in v0.2.0
type APIKey struct { APIKeyID string `json:"api_key_id"` Name string `json:"name"` CreatedAt int64 `json:"created_at"` UserID string `json:"user_id"` }
APIKey represents a key used to interact with the HTTP API.
type APIKeyManager ¶ added in v0.2.0
type APIKeyManager interface { Add(ctx context.Context, ak *APIKey) ([]byte, error) Delete(ctx context.Context, apiKeyID string) error GetJSON(ctx context.Context, apiKeyID string) ([]byte, error) GetOwnedByUserJSON(ctx context.Context) ([]byte, error) Update(ctx context.Context, ak *APIKey) error }
APIKeyManager describes the methods an APIKeyManager implementation must provide.
type ChartRepository ¶
type ChartRepository struct { ChartRepositoryID string `json:"chart_repository_id"` Name string `json:"name"` DisplayName string `json:"display_name"` URL string `json:"url"` UserID string `json:"user_id"` }
ChartRepository represents a Helm chart repository.
type ChartRepositoryIndexLoader ¶
type ChartRepositoryIndexLoader interface {
LoadIndex(r *ChartRepository) (*repo.IndexFile, error)
}
ChartRepositoryIndexLoader interface defines the methods a chart repository index loader implementation should provide.
type ChartRepositoryManager ¶
type ChartRepositoryManager interface { Add(ctx context.Context, orgName string, r *ChartRepository) error CheckAvailability(ctx context.Context, resourceKind, value string) (bool, error) Delete(ctx context.Context, name string) error GetAll(ctx context.Context) ([]*ChartRepository, error) GetByName(ctx context.Context, name string) (*ChartRepository, error) GetPackagesDigest(ctx context.Context, chartRepositoryID string) (map[string]string, error) GetOwnedByOrgJSON(ctx context.Context, orgName string) ([]byte, error) GetOwnedByUserJSON(ctx context.Context) ([]byte, error) SetLastTrackingResults(ctx context.Context, chartRepositoryID, errs string) error Transfer(ctx context.Context, name, orgName string) error Update(ctx context.Context, r *ChartRepository) error }
ChartRepositoryManager describes the methods an ChartRepositoryManager implementation must provide.
type CheckAPIKeyOutput ¶ added in v0.2.0
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 DB ¶
type DB interface { 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 Event ¶
type Event struct { EventID string `json:"event_id"` EventKind EventKind `json:"event_kind"` PackageID string `json:"package_id"` PackageVersion string `json:"package_version"` }
Event represents the details of an event related to a package.
type EventManager ¶
EventManager describes the methods an EventManager implementation must provide.
type GetPackageInput ¶
type GetPackageInput struct { PackageID string `json:"package_id"` ChartRepositoryName string `json:"chart_repository_name"` PackageName string `json:"package_name"` Version string `json:"version"` }
GetPackageInput represents the input used to get a specific package.
type Maintainer ¶
type Maintainer struct { MaintainerID string `json:"maintainer_id"` Name string `json:"name"` Email string `json:"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 NotificationTemplateData ¶
type NotificationTemplateData struct { BaseURL string `json:"base_url"` Event map[string]interface{} `json:"event"` Package map[string]interface{} `json:"package"` }
NotificationTemplateData represents some details of a notification that will be exposed to notification templates.
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 packages and other entities like chart repositories.
type OrganizationManager ¶
type OrganizationManager interface { Add(ctx context.Context, org *Organization) error AddMember(ctx context.Context, orgName, userAlias, baseURL string) error CheckAvailability(ctx context.Context, resourceKind, value string) (bool, error) ConfirmMembership(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) ([]byte, error) GetMembersJSON(ctx context.Context, orgName string) ([]byte, error) Update(ctx context.Context, org *Organization) error }
OrganizationManager describes the methods an OrganizationManager implementation must provide.
type Package ¶
type Package struct { PackageID string `json:"package_id"` Kind PackageKind `json:"kind"` Name string `json:"name"` NormalizedName string `json:"normalized_name"` LogoURL string `json:"logo_url"` LogoImageID string `json:"logo_image_id"` DisplayName string `json:"display_name"` Description string `json:"description"` Keywords []string `json:"keywords"` HomeURL string `json:"home_url"` Readme string `json:"readme"` Links []*Link `json:"links"` Data map[string]interface{} `json:"data"` Version string `json:"version"` AvailableVersions []string `json:"available_versions"` AppVersion string `json:"app_version"` Digest string `json:"digest"` Deprecated bool `json:"deprecated"` License string `json:"license"` Signed bool `json:"signed"` ContentURL string `json:"content_url"` Maintainers []*Maintainer `json:"maintainers"` 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"` ChartRepository *ChartRepository `json:"chart_repository"` }
Package represents a Kubernetes package.
type PackageKind ¶
type PackageKind int64
PackageKind represents the kind of a given package.
const ( // Chart represents a Helm chart. Chart PackageKind = 0 // Falco represents a set of Falco rules. Falco PackageKind = 1 // OPA represents a set of OPA policies. OPA PackageKind = 2 )
type PackageManager ¶
type PackageManager interface { Get(ctx context.Context, input *GetPackageInput) (*Package, error) GetJSON(ctx context.Context, input *GetPackageInput) ([]byte, error) GetStarredByUserJSON(ctx context.Context) ([]byte, error) GetStarsJSON(ctx context.Context, packageID string) ([]byte, error) GetStatsJSON(ctx context.Context) ([]byte, error) GetUpdatesJSON(ctx context.Context) ([]byte, error) Register(ctx context.Context, pkg *Package) error SearchJSON(ctx context.Context, input *SearchPackageInput) ([]byte, error) ToggleStar(ctx context.Context, packageID string) error Unregister(ctx context.Context, pkg *Package) error }
PackageManager describes the methods a PackageManager implementation must provide.
type SearchPackageInput ¶
type SearchPackageInput struct { Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` Facets bool `json:"facets"` Text string `json:"text"` PackageKinds []PackageKind `json:"package_kinds,omitempty"` Users []string `json:"users,omitempty"` Orgs []string `json:"orgs,omitempty"` ChartRepositories []string `json:"chart_repositories,omitempty"` Deprecated bool `json:"deprecated"` }
SearchPackageInput represents the query input when searching for packages.
type Session ¶
type Session struct { SessionID string `json:"session_id"` UserID string `json:"user_id"` IP string `json:"ip"` UserAgent string `json:"user_agent"` }
Session represents some information about a user session.
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 Delete(ctx context.Context, s *Subscription) error GetByPackageJSON(ctx context.Context, packageID string) ([]byte, error) GetByUserJSON(ctx context.Context) ([]byte, error) GetSubscriptors(ctx context.Context, packageID string, eventKind EventKind) ([]*User, error) }
SubscriptionManager describes the methods a SubscriptionManager implementation must provide.
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"` }
User represents a Hub user.
type UserManager ¶
type UserManager interface { CheckAPIKey(ctx context.Context, key []byte) (*CheckAPIKeyOutput, error) CheckAvailability(ctx context.Context, resourceKind, value string) (bool, error) CheckCredentials(ctx context.Context, email, password string) (*CheckCredentialsOutput, error) CheckSession(ctx context.Context, sessionID []byte, duration time.Duration) (*CheckSessionOutput, error) DeleteSession(ctx context.Context, sessionID []byte) error GetProfileJSON(ctx context.Context) ([]byte, error) GetUserID(ctx context.Context, email string) (string, error) RegisterSession(ctx context.Context, session *Session) ([]byte, error) RegisterUser(ctx context.Context, user *User, baseURL string) error UpdatePassword(ctx context.Context, old, new string) error UpdateProfile(ctx context.Context, user *User) error VerifyEmail(ctx context.Context, code string) (bool, error) }
UserManager describes the methods a UserManager 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) ([]byte, error) GetOwnedByUserJSON(ctx context.Context) ([]byte, error) GetSubscribedTo(ctx context.Context, eventKind EventKind, packageID string) ([]*Webhook, error) Update(ctx context.Context, wh *Webhook) error }
WebhookManager describes the methods a WebhookManager implementation must provide.