Documentation
¶
Overview ¶
Package azurecontainerregistry emulates the Azure Container Registry data plane: a Docker Registry v2 API per registry, the OAuth2 refresh and access token endpoints az acr login uses, admin-user Basic authentication and the /acr/v1 repository, tag and manifest metadata API. Registries are created through the ARM Microsoft.ContainerRegistry provider, which shares their credentials. See PARITY.md.
Index ¶
- Constants
- Variables
- func SelfSignedConfig() (*tls.Config, error)
- type AttrPatch
- type CacheCredentials
- type CacheRule
- type ConfigProvider
- type Credentials
- type DataDirConfig
- type EventContent
- type EventRequest
- type EventRequestMessage
- type EventResponseMessage
- type EventTarget
- type Forgotten
- type Handler
- func (h *Handler) ExtractOperation(*echo.Context) string
- func (h *Handler) ExtractResource(*echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Shutdown(ctx context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- type ImportRequest
- type ImportSource
- type InMemoryBackend
- func (b *InMemoryBackend) AccessTokenScopes(tok, reg string) ([]string, bool)
- func (b *InMemoryBackend) Allowed(reg, repo, ref, op string) bool
- func (b *InMemoryBackend) CheckKey(keyIdentifier string) error
- func (b *InMemoryBackend) Close()
- func (b *InMemoryBackend) CredentialHealth(usernameURI, passwordURI string) (bool, string, string)
- func (b *InMemoryBackend) Credentials(name string) (Credentials, error)
- func (b *InMemoryBackend) DeleteCacheRule(reg, name string) error
- func (b *InMemoryBackend) DeleteRegistry(name string) error
- func (b *InMemoryBackend) DeleteScopeMap(reg, name string) error
- func (b *InMemoryBackend) DeleteTag(ctx context.Context, reg, repo, tag string) error
- func (b *InMemoryBackend) DeleteToken(reg, name string) error
- func (b *InMemoryBackend) DeleteWebhook(reg, name string) error
- func (b *InMemoryBackend) DescribeManifest(ctx context.Context, reg, repo, ref string) (ManifestDetail, error)
- func (b *InMemoryBackend) FireManifest(reg string, c ManifestChange)
- func (b *InMemoryBackend) ForgetRepository(reg, repo string) (Forgotten, bool)
- func (b *InMemoryBackend) GenerateTokenPassword(reg, token, which string, expiry *time.Time) (TokenPassword, error)
- func (b *InMemoryBackend) HasWebhooks(reg string) bool
- func (b *InMemoryBackend) ImportImage(ctx context.Context, reg string, req ImportRequest) error
- func (b *InMemoryBackend) IssueAccessToken(reg, audience string, scopes []string) (string, error)
- func (b *InMemoryBackend) IssueRefreshToken(reg, audience string) (string, error)
- func (b *InMemoryBackend) Manifests(reg, repo string) ([]ManifestView, bool)
- func (b *InMemoryBackend) Names() []string
- func (b *InMemoryBackend) PatchManifest(reg, repo, digest string, p AttrPatch) error
- func (b *InMemoryBackend) PatchRepository(reg, repo string, p AttrPatch) error
- func (b *InMemoryBackend) PatchTag(reg, repo, tag string, p AttrPatch) error
- func (b *InMemoryBackend) PingWebhook(reg, name string) (string, error)
- func (b *InMemoryBackend) PutRegistry(name string, adminEnabled bool) (RegistryInfo, error)
- func (b *InMemoryBackend) RecordManifestDelete(reg, repo, ref string)
- func (b *InMemoryBackend) RecordManifestPut(reg, repo, ref, digest string)
- func (b *InMemoryBackend) RegenerateCredential(name, which string) (Credentials, error)
- func (b *InMemoryBackend) Registry(name string) (RegistryInfo, bool)
- func (b *InMemoryBackend) Repositories(reg string) []RepoView
- func (b *InMemoryBackend) Repository(reg, repo string) (RepoView, bool)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) ScopeMaps(reg string) ([]ScopeMap, error)
- func (b *InMemoryBackend) SetAnonymousPull(name string, enabled bool) error
- func (b *InMemoryBackend) SetCacheRule(reg string, rule CacheRule) error
- func (b *InMemoryBackend) SetClock(now func() time.Time)
- func (b *InMemoryBackend) SetContext(ctx context.Context)
- func (b *InMemoryBackend) SetDataDir(dir string)
- func (b *InMemoryBackend) SetEncryptionKey(name, keyIdentifier string) error
- func (b *InMemoryBackend) SetExportAllowed(name string, allowed bool) error
- func (b *InMemoryBackend) SetKeyChecker(c KeyChecker)
- func (b *InMemoryBackend) SetNetworkRules(name string, n NetworkRules) error
- func (b *InMemoryBackend) SetRemoteImports(on bool)
- func (b *InMemoryBackend) SetRetentionSource(s RetentionSource)
- func (b *InMemoryBackend) SetScopeMap(reg, name, description string, actions []string) (ScopeMap, error)
- func (b *InMemoryBackend) SetSecretResolver(r SecretResolver)
- func (b *InMemoryBackend) SetToken(reg, name, scopeMap string, enabled bool) error
- func (b *InMemoryBackend) SetWebhook(reg string, w Webhook) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) SweepRetention(ctx context.Context, reg string)
- func (b *InMemoryBackend) Tags(reg, repo string) ([]TagView, bool)
- func (b *InMemoryBackend) TokenPasswords(reg, token string) ([]TokenPassword, error)
- func (b *InMemoryBackend) Tokens(reg string) ([]TokenView, error)
- func (b *InMemoryBackend) UsedBytes(name string) (int64, error)
- func (b *InMemoryBackend) VerifyAccess(tok, reg string) bool
- func (b *InMemoryBackend) VerifyAdmin(reg, user, password string) bool
- func (b *InMemoryBackend) VerifyRefresh(tok, reg string) bool
- func (b *InMemoryBackend) VerifyToken(reg, user, password string) bool
- func (b *InMemoryBackend) WebhookEvents(reg, name string) ([]WebhookEvent, error)
- type KeyChecker
- type ManifestChange
- type ManifestDetail
- type ManifestView
- type NetworkRules
- type Provider
- type RegistryInfo
- type RepoView
- type RequestInfo
- type RetentionSource
- type ScopeMap
- type SecretResolver
- type Settings
- type TagView
- type Token
- type TokenPassword
- type TokenSecret
- type TokenView
- type Webhook
- type WebhookEvent
Constants ¶
const DefaultPort = 10011
DefaultPort is the registry data plane's TCP port.
const NullUsername = "00000000-0000-0000-0000-000000000000"
NullUsername is the username registry clients send with a refresh token as the password.
Variables ¶
var ( ErrRegistryNotFound = errors.New("azurecontainerregistry: registry not found") ErrInvalidName = errors.New("azurecontainerregistry: invalid registry name") ErrAdminDisabled = errors.New("azurecontainerregistry: admin user is not enabled") ErrInvalidCred = errors.New("azurecontainerregistry: credential name must be password or password2") ErrWebhookNotFound = errors.New("azurecontainerregistry: webhook not found") ErrNilAppContext = errors.New("azurecontainerregistry: nil app context") ErrNotFound = errors.New("azurecontainerregistry: not found") ErrDenied = errors.New("azurecontainerregistry: operation is disabled by the resource's attributes") ErrTLSKeyMissing = errors.New("azurecontainerregistry: --azure-acr-tls-cert set without --azure-acr-tls-key") ErrTLSCertMissing = errors.New("azurecontainerregistry: --azure-acr-tls-key set without --azure-acr-tls-cert") )
Backend errors.
var ( ErrScopeMapNotFound = errors.New("azurecontainerregistry: scope map not found") ErrScopeMapReadOnly = errors.New("azurecontainerregistry: system scope maps cannot be changed") ErrScopeMapInUse = errors.New("azurecontainerregistry: scope map is used by a token") ErrInvalidScopeMap = errors.New("azurecontainerregistry: invalid scope map action") ErrTokenNotFound = errors.New("azurecontainerregistry: token not found") ErrInvalidTokenName = errors.New("azurecontainerregistry: invalid token password name") ErrInvalidTokenState = errors.New("azurecontainerregistry: token status must be enabled or disabled") )
Scope map and token errors.
var ( ErrImportSourceNotFound = errors.New("azurecontainerregistry: import source image not found") ErrImportTagExists = errors.New("azurecontainerregistry: import target tag already exists") ErrImportRemoteDisabled = errors.New("azurecontainerregistry: importing from external registries is disabled") ErrImportAuth = errors.New("azurecontainerregistry: the source registry refused authentication") ErrImportExportOff = errors.New("azurecontainerregistry: the source registry has its export policy disabled") ErrImportInvalid = errors.New("azurecontainerregistry: invalid import request") ErrImportUpstream = errors.New("azurecontainerregistry: the source registry returned an error") )
Import errors.
var ErrCacheRuleNotFound = errors.New("azurecontainerregistry: cache rule not found")
ErrCacheRuleNotFound is returned for an unknown cache rule.
var ErrInvalidNetworkRule = errors.New("azurecontainerregistry: IP rule must be an IPv4 address or CIDR range")
ErrInvalidNetworkRule is returned for an IP rule that is not an IPv4 address or CIDR range.
ErrKeyUnavailable is returned when a customer-managed encryption key cannot be used.
Functions ¶
func SelfSignedConfig ¶
SelfSignedConfig returns a TLS config with a generated certificate, for callers that want HTTPS in tests.
Types ¶
type CacheCredentials ¶
type CacheCredentials struct {
LoginServer string `json:"loginServer"`
UsernameSecret string `json:"usernameSecret"`
PasswordSecret string `json:"passwordSecret"`
}
CacheCredentials locates the upstream login in Key Vault secrets.
type CacheRule ¶
type CacheRule struct {
CreatedAt time.Time `json:"createdAt"`
Credentials *CacheCredentials `json:"credentials,omitempty"`
Name string `json:"name"`
Source string `json:"source"`
Target string `json:"target"`
}
CacheRule pulls Source (host/path, optionally ending in /*) into Target on first pull.
type ConfigProvider ¶
type ConfigProvider interface {
GetAzureACRSettings() Settings
}
ConfigProvider extracts the Container Registry settings from the AppContext config.
type Credentials ¶
Credentials are a registry's admin-user credentials.
type DataDirConfig ¶
type DataDirConfig interface {
GetRegistryDataDir() string
}
DataDirConfig locates the directory registry blobs are kept in; empty keeps them in memory.
type EventContent ¶
type EventContent struct {
Target *EventTarget `json:"target,omitempty"`
Request *EventRequest `json:"request,omitempty"`
ID string `json:"id"`
Timestamp string `json:"timestamp"`
Action string `json:"action"`
}
EventContent is the JSON body posted to a webhook's service URI.
type EventRequest ¶
type EventRequest struct {
ID string `json:"id"`
Host string `json:"host"`
Method string `json:"method"`
Useragent string `json:"useragent"`
}
EventRequest is the registry request that caused an event.
type EventRequestMessage ¶
type EventRequestMessage struct {
Headers map[string]string `json:"headers"`
Content EventContent `json:"content"`
Method string `json:"method"`
RequestURI string `json:"requestUri"`
Version string `json:"version"`
}
EventRequestMessage is the HTTP request delivered to the service URI.
type EventResponseMessage ¶
type EventResponseMessage struct {
Headers map[string]string `json:"headers"`
Content string `json:"content"`
ReasonPhrase string `json:"reasonPhrase"`
StatusCode string `json:"statusCode,omitempty"`
Version string `json:"version"`
}
EventResponseMessage is the service URI's HTTP response.
type EventTarget ¶
type EventTarget struct {
MediaType string `json:"mediaType,omitempty"`
Digest string `json:"digest,omitempty"`
Repository string `json:"repository,omitempty"`
Tag string `json:"tag,omitempty"`
Size int64 `json:"size,omitempty"`
Length int64 `json:"length,omitempty"`
}
EventTarget is the artifact an event is about.
type Handler ¶
type Handler struct {
// ValidateToken checks a Microsoft Entra access token offered to /oauth2/exchange; nil accepts any non-empty
// token.
ValidateToken func(token, tenant string) error
Backend *InMemoryBackend
Settings Settings
Port int
// contains filtered or unexported fields
}
Handler owns the registry listener.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend, settings Settings) *Handler
NewHandler returns a Handler over backend.
func (*Handler) ExtractOperation ¶
ExtractOperation implements service.Service.
func (*Handler) ExtractResource ¶
ExtractResource implements service.Service.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations implements service.Service.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns a 404 handler; the real API is on the dedicated port.
func (*Handler) MatchPriority ¶
MatchPriority implements service.Registerable.
func (*Handler) RouteMatcher ¶
RouteMatcher never matches: the registry listens on its own port.
func (*Handler) ServeHTTP ¶
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP routes a request to the registry, token or metadata API.
type ImportRequest ¶
type ImportRequest struct {
Source ImportSource
TargetTags []string
UntaggedTargets []string
Force bool
}
ImportRequest is an importImage call.
type ImportSource ¶
type ImportSource struct {
Registry string
RegistryURI string
Image string
Username string
Password string
}
ImportSource is where importImage reads from: an emulated registry by name, or a registry URI.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend holds every registry's control-plane state under one lock; blobs and manifests live in per-registry ociregistry handlers.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates an empty backend that keeps blobs in memory.
func (*InMemoryBackend) AccessTokenScopes ¶
func (b *InMemoryBackend) AccessTokenScopes(tok, reg string) ([]string, bool)
AccessTokenScopes returns the scopes recorded in an access token of reg, as repository:name:actions strings.
func (*InMemoryBackend) Allowed ¶
func (b *InMemoryBackend) Allowed(reg, repo, ref, op string) bool
Allowed reports whether op (read, write or delete) may touch repo:ref.
func (*InMemoryBackend) CheckKey ¶
func (b *InMemoryBackend) CheckKey(keyIdentifier string) error
CheckKey runs the key checker; without one every key is accepted.
func (*InMemoryBackend) Close ¶
func (b *InMemoryBackend) Close()
Close stops webhook deliveries and releases every registry's storage handler without deleting stored images.
func (*InMemoryBackend) CredentialHealth ¶
func (b *InMemoryBackend) CredentialHealth(usernameURI, passwordURI string) (bool, string, string)
CredentialHealth reports whether both secret identifiers resolve; code and message describe the first failure.
func (*InMemoryBackend) Credentials ¶
func (b *InMemoryBackend) Credentials(name string) (Credentials, error)
Credentials returns the admin credentials; the admin user must be enabled.
func (*InMemoryBackend) DeleteCacheRule ¶
func (b *InMemoryBackend) DeleteCacheRule(reg, name string) error
DeleteCacheRule removes a cache rule; pulled images stay.
func (*InMemoryBackend) DeleteRegistry ¶
func (b *InMemoryBackend) DeleteRegistry(name string) error
DeleteRegistry removes the registry with its repositories, blobs and manifests.
func (*InMemoryBackend) DeleteScopeMap ¶
func (b *InMemoryBackend) DeleteScopeMap(reg, name string) error
DeleteScopeMap removes a user scope map that no token uses.
func (*InMemoryBackend) DeleteTag ¶
func (b *InMemoryBackend) DeleteTag(ctx context.Context, reg, repo, tag string) error
DeleteTag removes one tag, honouring the repository and tag delete attributes; the manifest is kept when other references remain.
func (*InMemoryBackend) DeleteToken ¶
func (b *InMemoryBackend) DeleteToken(reg, name string) error
DeleteToken removes a token and its passwords.
func (*InMemoryBackend) DeleteWebhook ¶
func (b *InMemoryBackend) DeleteWebhook(reg, name string) error
DeleteWebhook removes the webhook with its events; a missing one is not an error.
func (*InMemoryBackend) DescribeManifest ¶
func (b *InMemoryBackend) DescribeManifest(ctx context.Context, reg, repo, ref string) (ManifestDetail, error)
DescribeManifest reads the manifest at repo:ref (a tag or digest) and summarises it.
func (*InMemoryBackend) FireManifest ¶
func (b *InMemoryBackend) FireManifest(reg string, c ManifestChange)
FireManifest delivers the change to every enabled webhook of reg whose actions and scope match.
func (*InMemoryBackend) ForgetRepository ¶
func (b *InMemoryBackend) ForgetRepository(reg, repo string) (Forgotten, bool)
ForgetRepository drops a repository's metadata and returns the digests and tags it held.
func (*InMemoryBackend) GenerateTokenPassword ¶
func (b *InMemoryBackend) GenerateTokenPassword(reg, token, which string, expiry *time.Time) (TokenPassword, error)
GenerateTokenPassword replaces password1 or password2 of a token and returns the new value, which is never shown again.
func (*InMemoryBackend) HasWebhooks ¶
func (b *InMemoryBackend) HasWebhooks(reg string) bool
HasWebhooks reports whether reg has any webhook.
func (*InMemoryBackend) ImportImage ¶
func (b *InMemoryBackend) ImportImage(ctx context.Context, reg string, req ImportRequest) error
ImportImage copies an image from the source into the registry, as POST importImage does.
func (*InMemoryBackend) IssueAccessToken ¶
func (b *InMemoryBackend) IssueAccessToken(reg, audience string, scopes []string) (string, error)
IssueAccessToken mints a registry access token for the requested scopes.
func (*InMemoryBackend) IssueRefreshToken ¶
func (b *InMemoryBackend) IssueRefreshToken(reg, audience string) (string, error)
IssueRefreshToken mints the refresh token az acr login exchanges an Entra ID token for.
func (*InMemoryBackend) Manifests ¶
func (b *InMemoryBackend) Manifests(reg, repo string) ([]ManifestView, bool)
Manifests lists a repository's manifests in lexical digest order.
func (*InMemoryBackend) Names ¶
func (b *InMemoryBackend) Names() []string
Names lists registry names, in lookup order of the single-registry fallback.
func (*InMemoryBackend) PatchManifest ¶
func (b *InMemoryBackend) PatchManifest(reg, repo, digest string, p AttrPatch) error
PatchManifest updates a manifest's attributes.
func (*InMemoryBackend) PatchRepository ¶
func (b *InMemoryBackend) PatchRepository(reg, repo string, p AttrPatch) error
PatchRepository updates a repository's attributes.
func (*InMemoryBackend) PatchTag ¶
func (b *InMemoryBackend) PatchTag(reg, repo, tag string, p AttrPatch) error
PatchTag updates a tag's attributes.
func (*InMemoryBackend) PingWebhook ¶
func (b *InMemoryBackend) PingWebhook(reg, name string) (string, error)
PingWebhook delivers a ping event to the webhook and returns the event id.
func (*InMemoryBackend) PutRegistry ¶
func (b *InMemoryBackend) PutRegistry(name string, adminEnabled bool) (RegistryInfo, error)
PutRegistry creates the registry or updates its admin-user flag.
func (*InMemoryBackend) RecordManifestDelete ¶
func (b *InMemoryBackend) RecordManifestDelete(reg, repo, ref string)
RecordManifestDelete forgets a deleted manifest with its tags, or just the tag when ref is one. A manifest the deleted tag leaves untagged is scheduled for deletion when the retention policy is enabled. The caller holds the delete gate.
func (*InMemoryBackend) RecordManifestPut ¶
func (b *InMemoryBackend) RecordManifestPut(reg, repo, ref, digest string)
RecordManifestPut notes a stored manifest, and the tag when ref is one. A manifest left without tags is scheduled for deletion when the registry's retention policy is enabled.
func (*InMemoryBackend) RegenerateCredential ¶
func (b *InMemoryBackend) RegenerateCredential(name, which string) (Credentials, error)
RegenerateCredential replaces the "password" or "password2" credential and returns both.
func (*InMemoryBackend) Registry ¶
func (b *InMemoryBackend) Registry(name string) (RegistryInfo, bool)
Registry returns the registry named name.
func (*InMemoryBackend) Repositories ¶
func (b *InMemoryBackend) Repositories(reg string) []RepoView
Repositories lists the repositories holding at least one manifest, in lexical order.
func (*InMemoryBackend) Repository ¶
func (b *InMemoryBackend) Repository(reg, repo string) (RepoView, bool)
Repository returns one repository's entry.
func (*InMemoryBackend) Reset ¶
func (b *InMemoryBackend) Reset()
Reset removes every registry and its stored images.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads a snapshot, replacing every registry.
func (*InMemoryBackend) ScopeMaps ¶
func (b *InMemoryBackend) ScopeMaps(reg string) ([]ScopeMap, error)
ScopeMaps lists the system and user scope maps of a registry, sorted by name.
func (*InMemoryBackend) SetAnonymousPull ¶
func (b *InMemoryBackend) SetAnonymousPull(name string, enabled bool) error
SetAnonymousPull allows or refuses unauthenticated GET and HEAD of repository content.
func (*InMemoryBackend) SetCacheRule ¶
func (b *InMemoryBackend) SetCacheRule(reg string, rule CacheRule) error
SetCacheRule creates or replaces a cache rule.
func (*InMemoryBackend) SetClock ¶
func (b *InMemoryBackend) SetClock(now func() time.Time)
SetClock replaces the clock that dates ledger entries, retention deadlines and token expiry.
func (*InMemoryBackend) SetContext ¶
func (b *InMemoryBackend) SetContext(ctx context.Context)
SetContext bounds the lifetime of the registries the backend builds.
func (*InMemoryBackend) SetDataDir ¶
func (b *InMemoryBackend) SetDataDir(dir string)
SetDataDir keeps registry blobs under dir (one subdirectory per registry); empty keeps them in memory.
func (*InMemoryBackend) SetEncryptionKey ¶
func (b *InMemoryBackend) SetEncryptionKey(name, keyIdentifier string) error
SetEncryptionKey records the registry's customer-managed key; empty clears it.
func (*InMemoryBackend) SetExportAllowed ¶
func (b *InMemoryBackend) SetExportAllowed(name string, allowed bool) error
SetExportAllowed permits or refuses importing images out of the registry; Learn data-loss-prevention.
func (*InMemoryBackend) SetKeyChecker ¶
func (b *InMemoryBackend) SetKeyChecker(c KeyChecker)
SetKeyChecker lets registries with a customer-managed key follow the state of that key.
func (*InMemoryBackend) SetNetworkRules ¶
func (b *InMemoryBackend) SetNetworkRules(name string, n NetworkRules) error
SetNetworkRules replaces the registry's firewall.
func (*InMemoryBackend) SetRemoteImports ¶
func (b *InMemoryBackend) SetRemoteImports(on bool)
SetRemoteImports allows importImage to read from registries outside this process.
func (*InMemoryBackend) SetRetentionSource ¶
func (b *InMemoryBackend) SetRetentionSource(s RetentionSource)
SetRetentionSource lets registries delete untagged manifests after their retention period.
func (*InMemoryBackend) SetScopeMap ¶
func (b *InMemoryBackend) SetScopeMap(reg, name, description string, actions []string) (ScopeMap, error)
SetScopeMap creates or replaces a user scope map; system scope maps cannot be changed.
func (*InMemoryBackend) SetSecretResolver ¶
func (b *InMemoryBackend) SetSecretResolver(r SecretResolver)
SetSecretResolver lets cache rules read upstream credentials from Key Vault.
func (*InMemoryBackend) SetToken ¶
func (b *InMemoryBackend) SetToken(reg, name, scopeMap string, enabled bool) error
SetToken creates a token or updates its scope map and status; passwords are kept.
func (*InMemoryBackend) SetWebhook ¶
func (b *InMemoryBackend) SetWebhook(reg string, w Webhook) error
SetWebhook creates or replaces the webhook, keeping the events it already recorded.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises registries, credentials and image metadata. Blobs and manifests are not part of it: they live under the data directory when one is configured.
func (*InMemoryBackend) SweepRetention ¶
func (b *InMemoryBackend) SweepRetention(ctx context.Context, reg string)
SweepRetention deletes the untagged manifests of reg whose retention period has elapsed on the backend clock. Only Docker manifests and manifest lists are deleted, and never a manifest an index references.
func (*InMemoryBackend) Tags ¶
func (b *InMemoryBackend) Tags(reg, repo string) ([]TagView, bool)
Tags lists a repository's tags in lexical order.
func (*InMemoryBackend) TokenPasswords ¶
func (b *InMemoryBackend) TokenPasswords(reg, token string) ([]TokenPassword, error)
TokenPasswords lists the generated passwords of a token without their values.
func (*InMemoryBackend) Tokens ¶
func (b *InMemoryBackend) Tokens(reg string) ([]TokenView, error)
Tokens lists a registry's tokens, sorted by name.
func (*InMemoryBackend) UsedBytes ¶
func (b *InMemoryBackend) UsedBytes(name string) (int64, error)
UsedBytes returns the bytes of blobs and manifests the registry stores; blobs are content-addressed, so a layer shared by several images counts once.
func (*InMemoryBackend) VerifyAccess ¶
func (b *InMemoryBackend) VerifyAccess(tok, reg string) bool
VerifyAccess reports whether tok is an unexpired access token of reg.
func (*InMemoryBackend) VerifyAdmin ¶
func (b *InMemoryBackend) VerifyAdmin(reg, user, password string) bool
VerifyAdmin reports whether user and password are the registry's enabled admin credentials.
func (*InMemoryBackend) VerifyRefresh ¶
func (b *InMemoryBackend) VerifyRefresh(tok, reg string) bool
VerifyRefresh reports whether tok is an unexpired refresh token of reg.
func (*InMemoryBackend) VerifyToken ¶
func (b *InMemoryBackend) VerifyToken(reg, user, password string) bool
VerifyToken reports whether user and password are an enabled token's unexpired credentials.
func (*InMemoryBackend) WebhookEvents ¶
func (b *InMemoryBackend) WebhookEvents(reg, name string) ([]WebhookEvent, error)
WebhookEvents returns the webhook's recorded deliveries, oldest first.
type KeyChecker ¶
KeyChecker reports whether the Key Vault key at keyIdentifier exists, is enabled and is an RSA key.
type ManifestChange ¶
type ManifestChange struct {
Req RequestInfo
Repository string
Tag string
Digest string
MediaType string
ConfigType string
Size int64
Delete bool
}
ManifestChange is a manifest push or delete the registry observed.
type ManifestDetail ¶
type ManifestDetail struct {
Digest string
MediaType string
Architecture string
OS string
Children int
Size int64
Index bool
}
ManifestDetail summarises one stored manifest for inspection.
type ManifestView ¶
type ManifestView struct {
Created time.Time
Updated time.Time
Digest string
Tags []string
Attrs attrs
}
ManifestView is a manifest's listing entry.
type NetworkRules ¶
type NetworkRules struct {
Allow []string `json:"allow,omitempty"`
PublicDisabled bool `json:"publicDisabled,omitempty"`
DefaultDeny bool `json:"defaultDeny,omitempty"`
}
NetworkRules is the public-endpoint firewall of a registry. Disabled public access overrides every IP rule (Learn: container-registry-access-selected-networks).
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Azure Container Registry.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init builds the backend and handler; the port is bound by Handler.StartWorker.
type RegistryInfo ¶
RegistryInfo is the control-plane view of a registry.
type RepoView ¶
type RepoView struct {
Created time.Time
Updated time.Time
Name string
Attrs attrs
ManifestCount int
TagCount int
}
RepoView is a repository's listing entry.
type RequestInfo ¶
RequestInfo describes the registry request behind a manifest event.
type RetentionSource ¶
RetentionSource reports whether the untagged-manifest retention policy of a registry is enabled and its period in days.
type ScopeMap ¶
type ScopeMap struct {
CreatedAt time.Time `json:"createdAt"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Actions []string `json:"actions"`
System bool `json:"system,omitempty"`
}
ScopeMap is a named set of repository permissions applied to tokens.
type SecretResolver ¶
SecretResolver reads the value a Key Vault secret identifier URI points at.
type Settings ¶
type Settings struct {
TLSCertFile string `` //nolint:lll // config struct tags are intentionally verbose
/* 236-byte string literal not displayed */
TLSKeyFile string `` //nolint:lll // config struct tags are intentionally verbose
/* 131-byte string literal not displayed */
Port int `` //nolint:lll // config struct tags are intentionally verbose
/* 267-byte string literal not displayed */
RemoteImports bool `` //nolint:lll // config struct tags are intentionally verbose
/* 267-byte string literal not displayed */
}
Settings is the Kong-embedded configuration of the Azure Container Registry emulator.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings returns the settings used when no ConfigProvider exists.
type Token ¶
type Token struct {
CreatedAt time.Time `json:"createdAt"`
ScopeMap string `json:"scopeMap"`
Name string `json:"name"`
Passwords []*TokenSecret `json:"passwords,omitempty"`
Disabled bool `json:"disabled,omitempty"`
}
Token authenticates with a generated password and is limited by its scope map.
type TokenPassword ¶
TokenPassword describes a token password; Value is set only when it has just been generated.
type TokenSecret ¶
type TokenSecret struct {
Created time.Time `json:"created"`
Expiry *time.Time `json:"expiry,omitempty"`
Digest string `json:"digest"`
}
TokenSecret is one of a token's two passwords; only a digest is kept.
type TokenView ¶
type TokenView struct {
CreatedAt time.Time
Name string
ScopeMap string
Passwords []TokenPassword
Enabled bool
}
TokenView is a token with the metadata of its passwords.
type Webhook ¶
type Webhook struct {
Headers map[string]string `json:"headers,omitempty"`
Name string `json:"name"`
ServiceURI string `json:"serviceUri"`
Scope string `json:"scope,omitempty"`
Status string `json:"status"`
Actions []string `json:"actions"`
}
Webhook is a registry webhook fired on image and chart pushes and deletes.
type WebhookEvent ¶
type WebhookEvent struct {
EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"`
ID string `json:"id"`
EventRequestMessage EventRequestMessage `json:"eventRequestMessage"`
}
WebhookEvent is one recorded delivery attempt.