Documentation
¶
Overview ¶
Package quayapi is a Quay-compatible API facade: the subset of the Quay v1 REST API the Konflux image-controller drives to onboard a component (repositories, robot accounts, repository and team permissions, tags and notifications). OpenArtifact stands in for the Quay registry: an organization is a hosted docker repository, a Quay repository is an image path inside it, and a robot account is a service account whose deploy token is scoped to one or more image paths. See docs/integrations/konflux-image-controller.md.
The facade is mounted at Prefix only when quayApi.enabled is set. Its errors are Quay-shaped ({"error_message": ...}) rather than the {error, code} envelope of /api/v1, because the image-controller decodes them.
Index ¶
Constants ¶
const Prefix = "/quay/api/v1"
Prefix is where the facade is mounted: Konflux's quayapiurl is https://<host>/quay/api/v1.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
type Authorizer interface {
Evaluate(ctx context.Context, principal auth.Principal, repoName, artifactPath, action string) (bool, error)
}
Authorizer is the part of the permission evaluator the facade needs.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves the Quay-compatible API.
func New ¶
New returns a Handler. organizations lists the hosted docker repositories a client may use as its organization; empty allows every one.
type Store ¶
type Store interface {
GetRepositoryByName(ctx context.Context, name string) (*models.Repository, error)
GetUserByUsername(ctx context.Context, username string) (*models.User, error)
CreateQuayRepository(ctx context.Context, spec database.QuayRepositorySpec) (*models.QuayRepository, error)
GetQuayRepository(ctx context.Context, repositoryID, name string) (*models.QuayRepository, error)
ListQuayRepositories(ctx context.Context, repositoryID string) ([]*models.QuayRepository, error)
DeleteQuayRepository(ctx context.Context, q *models.QuayRepository) error
ListQuayTags(ctx context.Context, repositoryID, image string, page, limit int) ([]*models.QuayTag, bool, error)
SetQuayPermission(ctx context.Context, q *models.QuayRepository, principalType, principalID string, write bool) error
RemoveQuayPermission(ctx context.Context, q *models.QuayRepository, principalType, principalID string) (bool, error)
ListQuayUserPermissions(ctx context.Context, q *models.QuayRepository) ([]*models.QuayUserPermission, error)
ListQuayTeamPermissions(ctx context.Context, groupID string) ([]*models.QuayTeamPermission, error)
CreateQuayRobot(ctx context.Context, spec database.QuayRobotSpec) (*models.QuayRobot, error)
GetQuayRobot(ctx context.Context, repositoryID, name string) (*models.QuayRobot, error)
ListQuayRobots(ctx context.Context, repositoryID string) ([]*models.QuayRobot, error)
RotateQuayRobotToken(ctx context.Context, b *models.QuayRobot, kind, name, hash, tokenEnc string) (*models.QuayRobot, error)
DeleteQuayRobot(ctx context.Context, b *models.QuayRobot) error
CreateQuayTeam(ctx context.Context, repositoryID, name, groupName string) (*models.QuayTeam, error)
GetQuayTeam(ctx context.Context, repositoryID, name string) (*models.QuayTeam, error)
ListUsersByGroup(ctx context.Context, groupID string) ([]*models.User, error)
AddUserToGroup(ctx context.Context, userID, groupID string) error
RemoveUserFromGroup(ctx context.Context, userID, groupID string) error
DeleteGroup(ctx context.Context, id string) error
CreateQuayNotification(ctx context.Context, n *models.QuayNotification) (*models.QuayNotification, error)
GetQuayNotification(ctx context.Context, quayRepoID, id string) (*models.QuayNotification, error)
ListQuayNotifications(ctx context.Context, quayRepoID string) ([]*models.QuayNotification, error)
UpdateQuayNotification(ctx context.Context, n *models.QuayNotification) (*models.QuayNotification, error)
DeleteQuayNotification(ctx context.Context, quayRepoID, id string) (bool, error)
GetDockerTag(ctx context.Context, repoID, image, name string) (*models.DockerTag, error)
DeleteDockerTag(ctx context.Context, repoID, image, name string) error
}
Store is the part of the database the facade needs.