quayapi

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func New(db Store, authz Authorizer, log *logger.Logger, organizations []string) *Handler

New returns a Handler. organizations lists the hosted docker repositories a client may use as its organization; empty allows every one.

func (*Handler) Register

func (h *Handler) Register(r chi.Router)

Register mounts the facade at Prefix on the authenticated router.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP authorizes the request and dispatches it by path.

func (*Handler) WithPublisher

func (h *Handler) WithPublisher(p webhook.Publisher) *Handler

WithPublisher sets the webhook publisher that announces tag deletions.

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.

Jump to

Keyboard shortcuts

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