Documentation
¶
Overview ¶
Package gcpartifactregistry emulates Google Artifact Registry: the v1 API (repositories, packages, versions, tags and docker images) over gRPC and REST, and a Docker Registry v2 data plane for DOCKER repositories on the same listener, so pushed images show up in the API. See PARITY.md.
Index ¶
- Constants
- Variables
- type API
- type CleanupResult
- type ConfigProvider
- type DataDirConfig
- type DockerRepoInfo
- type Handler
- func (h *Handler) API() *API
- func (h *Handler) Addr() string
- 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) Shutdown(ctx context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- type InMemoryBackend
- func (b *InMemoryBackend) BatchDeleteVersions(_ context.Context, in *artifactregistrypb.BatchDeleteVersionsRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) CleanupLoop(ctx context.Context)
- func (b *InMemoryBackend) Close()
- func (b *InMemoryBackend) CreateAttachment(ctx context.Context, in *artifactregistrypb.CreateAttachmentRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) CreateRepository(in *artifactregistrypb.CreateRepositoryRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) CreateRule(in *artifactregistrypb.CreateRuleRequest) (*artifactregistrypb.Rule, error)
- func (b *InMemoryBackend) CreateTag(ctx context.Context, in *artifactregistrypb.CreateTagRequest) (*artifactregistrypb.Tag, error)
- func (b *InMemoryBackend) DeleteAttachment(name string) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) DeleteFile(_ context.Context, name string) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) DeletePackage(_ context.Context, name string) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) DeleteRepository(_ context.Context, name string) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) DeleteRule(name string) (*emptypb.Empty, error)
- func (b *InMemoryBackend) DeleteTag(ctx context.Context, name string) error
- func (b *InMemoryBackend) DeleteVersion(_ context.Context, in *artifactregistrypb.DeleteVersionRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) DockerHandler() http.Handler
- func (b *InMemoryBackend) ExportArtifact(in *artifactregistrypb.ExportArtifactRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) FileExtras() gcprest.Extra
- func (b *InMemoryBackend) GetAttachment(name string) (*artifactregistrypb.Attachment, error)
- func (b *InMemoryBackend) GetDockerImage(ctx context.Context, name string) (*artifactregistrypb.DockerImage, error)
- func (b *InMemoryBackend) GetFile(ctx context.Context, name string) (*artifactregistrypb.File, error)
- func (b *InMemoryBackend) GetIamPolicy(resource string, version int32) (*iampb.Policy, error)
- func (b *InMemoryBackend) GetPackage(name string) (*artifactregistrypb.Package, error)
- func (b *InMemoryBackend) GetProjectSettings(name string) (*artifactregistrypb.ProjectSettings, error)
- func (b *InMemoryBackend) GetRepository(name string) (*artifactregistrypb.Repository, error)
- func (b *InMemoryBackend) GetRule(name string) (*artifactregistrypb.Rule, error)
- func (b *InMemoryBackend) GetTag(name string) (*artifactregistrypb.Tag, error)
- func (b *InMemoryBackend) GetVPCSCConfig(name string) (*artifactregistrypb.VPCSCConfig, error)
- func (b *InMemoryBackend) GetVersion(ctx context.Context, in *artifactregistrypb.GetVersionRequest) (*artifactregistrypb.Version, error)
- func (b *InMemoryBackend) ImportAptArtifacts(_ context.Context, in *artifactregistrypb.ImportAptArtifactsRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) ImportYumArtifacts(_ context.Context, in *artifactregistrypb.ImportYumArtifactsRequest) (*longrunningpb.Operation, error)
- func (b *InMemoryBackend) ListAttachments(in *artifactregistrypb.ListAttachmentsRequest) ([]*artifactregistrypb.Attachment, string, error)
- func (b *InMemoryBackend) ListDockerImages(ctx context.Context, in *artifactregistrypb.ListDockerImagesRequest) ([]*artifactregistrypb.DockerImage, string, error)
- func (b *InMemoryBackend) ListFiles(ctx context.Context, in *artifactregistrypb.ListFilesRequest) ([]*artifactregistrypb.File, string, error)
- func (b *InMemoryBackend) ListPackages(in *artifactregistrypb.ListPackagesRequest) ([]*artifactregistrypb.Package, string, error)
- func (b *InMemoryBackend) ListRepositories(in *artifactregistrypb.ListRepositoriesRequest) ([]*artifactregistrypb.Repository, string, error)
- func (b *InMemoryBackend) ListRules(in *artifactregistrypb.ListRulesRequest) ([]*artifactregistrypb.Rule, string, error)
- func (b *InMemoryBackend) ListTags(in *artifactregistrypb.ListTagsRequest) ([]*artifactregistrypb.Tag, string, error)
- func (b *InMemoryBackend) ListVersions(ctx context.Context, in *artifactregistrypb.ListVersionsRequest) ([]*artifactregistrypb.Version, string, error)
- func (b *InMemoryBackend) LookupDockerRepo(project, id, location string) (DockerRepoInfo, bool)
- func (b *InMemoryBackend) PackageExtras() gcprest.Extra
- func (b *InMemoryBackend) PublishGoModule(project, repo string, zipData []byte) (string, string, string, error)
- func (b *InMemoryBackend) PublishMaven(project, repo, group, artifact, version, ext string, data []byte) (string, error)
- func (b *InMemoryBackend) PublishNPM(project, repo string, tarball []byte) (string, string, string, error)
- func (b *InMemoryBackend) PublishPython(project, repo, name, version, filename string, data []byte) (string, error)
- func (b *InMemoryBackend) RecordManifestDelete(repo, ref string)
- func (b *InMemoryBackend) RecordManifestPut(repo, ref, digest string)
- func (b *InMemoryBackend) Registry() http.Handler
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) RunCleanup(ctx context.Context) []CleanupResult
- func (b *InMemoryBackend) SetCleanupTicker(f TickerFunc)
- func (b *InMemoryBackend) SetClock(now func() time.Time)
- func (b *InMemoryBackend) SetContext(ctx context.Context)
- func (b *InMemoryBackend) SetDataDir(dir string)
- func (b *InMemoryBackend) SetIamPolicy(resource string, policy *iampb.Policy) (*iampb.Policy, error)
- func (b *InMemoryBackend) SetObjectStore(s ObjectStore)
- func (b *InMemoryBackend) SetOperationDelay(d time.Duration)
- func (b *InMemoryBackend) SetRegistryAddress(host, port string)
- func (b *InMemoryBackend) SetRemoteUpstreams(on bool)
- func (b *InMemoryBackend) SetSecretResolver(s SecretResolver)
- func (b *InMemoryBackend) SetUpstreamClient(c *http.Client)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagExists(repo, tag string) bool
- func (b *InMemoryBackend) TestIamPermissions(resource string, perms []string) ([]string, error)
- func (b *InMemoryBackend) UpdateFile(ctx context.Context, in *artifactregistrypb.UpdateFileRequest) (*artifactregistrypb.File, error)
- func (b *InMemoryBackend) UpdatePackage(in *artifactregistrypb.UpdatePackageRequest) (*artifactregistrypb.Package, error)
- func (b *InMemoryBackend) UpdateProjectSettings(in *artifactregistrypb.UpdateProjectSettingsRequest) (*artifactregistrypb.ProjectSettings, error)
- func (b *InMemoryBackend) UpdateRepository(in *artifactregistrypb.UpdateRepositoryRequest) (*artifactregistrypb.Repository, error)
- func (b *InMemoryBackend) UpdateRule(in *artifactregistrypb.UpdateRuleRequest) (*artifactregistrypb.Rule, error)
- func (b *InMemoryBackend) UpdateTag(ctx context.Context, in *artifactregistrypb.UpdateTagRequest) (*artifactregistrypb.Tag, error)
- func (b *InMemoryBackend) UpdateVPCSCConfig(in *artifactregistrypb.UpdateVPCSCConfigRequest) (*artifactregistrypb.VPCSCConfig, error)
- func (b *InMemoryBackend) UpdateVersion(in *artifactregistrypb.UpdateVersionRequest) (*artifactregistrypb.Version, error)
- func (b *InMemoryBackend) UploadGenericArtifact(_ context.Context, parent string, in uploadReq, data []byte) (*longrunningpb.Operation, error)
- type ObjectStore
- type Provider
- type SecretResolver
- type Settings
- type TickerFunc
Constants ¶
const DefaultPort = 8134
DefaultPort is the dedicated gRPC, REST and Docker Registry listener's default TCP port.
const DefaultRegistryHost = "localhost"
DefaultRegistryHost is the host advertised in repositories' registry_uri.
Variables ¶
var ErrNilAppContext = errors.New("gcpartifactregistry: nil app context")
ErrNilAppContext is returned when Init is called with a nil AppContext.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
artifactregistrypb.ArtifactRegistryServer
// contains filtered or unexported fields
}
API exposes the Artifact Registry service plus file bytes and cleanup previews to the dashboard proxy.
func (*API) FileContent ¶
FileContent returns the bytes of a file, refusing files larger than maxBytes before reading them.
type CleanupResult ¶
CleanupResult is what one policy run did to one repository.
type ConfigProvider ¶
type ConfigProvider interface {
GetGCPArtifactRegistrySettings() Settings
}
ConfigProvider extracts Artifact Registry configuration from the AppContext Config.
type DataDirConfig ¶
type DataDirConfig interface {
GetRegistryDataDir() string
}
DataDirConfig locates the directory image blobs are kept in; empty keeps them in memory.
type DockerRepoInfo ¶
type DockerRepoInfo struct {
Location string
Mode artifactregistrypb.Repository_Mode
Immutable bool
Docker bool
}
DockerRepoInfo describes the repository a registry path belongs to.
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
Port int
// contains filtered or unexported fields
}
Handler serves Artifact Registry on a dedicated listener.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend) *Handler
NewHandler creates a Handler; callers override Port from Settings.
func (*Handler) ExtractOperation ¶
ExtractOperation is unused: requests never reach the shared router.
func (*Handler) ExtractResource ¶
ExtractResource is unused: requests never reach the shared router.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists the supported gRPC methods.
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 is irrelevant because RouteMatcher never matches.
func (*Handler) RouteMatcher ¶
RouteMatcher never matches: Artifact Registry runs on its own listener.
type InMemoryBackend ¶
type InMemoryBackend struct {
// Audit records Cloud Audit Logs entries for repository and artifact changes.
Audit gcpaudit.Emitter
// contains filtered or unexported fields
}
InMemoryBackend holds all Artifact Registry state under one lock. Docker images live in one embedded registry whose repositories are named <project>/<repository>/<image>.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates an empty backend that keeps images in memory.
func (*InMemoryBackend) BatchDeleteVersions ¶
func (b *InMemoryBackend) BatchDeleteVersions( _ context.Context, in *artifactregistrypb.BatchDeleteVersionsRequest, ) (*longrunningpb.Operation, error)
BatchDeleteVersions deletes several manifests of one package, force-deleting tagged ones.
func (*InMemoryBackend) CleanupLoop ¶
func (b *InMemoryBackend) CleanupLoop(ctx context.Context)
CleanupLoop runs RunCleanup on every tick until ctx ends. Google runs cleanup policies about once a day.
func (*InMemoryBackend) Close ¶
func (b *InMemoryBackend) Close()
Close releases the embedded registry without deleting stored images.
func (*InMemoryBackend) CreateAttachment ¶
func (b *InMemoryBackend) CreateAttachment( ctx context.Context, in *artifactregistrypb.CreateAttachmentRequest, ) (*longrunningpb.Operation, error)
CreateAttachment stores an attachment when the returned operation finishes.
func (*InMemoryBackend) CreateRepository ¶
func (b *InMemoryBackend) CreateRepository( in *artifactregistrypb.CreateRepositoryRequest, ) (*longrunningpb.Operation, error)
CreateRepository stores a repository and returns the finished operation.
func (*InMemoryBackend) CreateRule ¶
func (b *InMemoryBackend) CreateRule(in *artifactregistrypb.CreateRuleRequest) (*artifactregistrypb.Rule, error)
CreateRule stores a rule; a repository holds one rule for itself and one per package.
func (*InMemoryBackend) CreateTag ¶
func (b *InMemoryBackend) CreateTag( ctx context.Context, in *artifactregistrypb.CreateTagRequest, ) (*artifactregistrypb.Tag, error)
CreateTag points a new tag at an existing version.
func (*InMemoryBackend) DeleteAttachment ¶
func (b *InMemoryBackend) DeleteAttachment(name string) (*longrunningpb.Operation, error)
DeleteAttachment removes an attachment when the returned operation finishes.
func (*InMemoryBackend) DeleteFile ¶
func (b *InMemoryBackend) DeleteFile(_ context.Context, name string) (*longrunningpb.Operation, error)
DeleteFile deletes a generic file; other formats refuse, as AR allows it on generic repositories only.
func (*InMemoryBackend) DeletePackage ¶
func (b *InMemoryBackend) DeletePackage(_ context.Context, name string) (*longrunningpb.Operation, error)
DeletePackage deletes every version of an image.
func (*InMemoryBackend) DeleteRepository ¶
func (b *InMemoryBackend) DeleteRepository( _ context.Context, name string, ) (*longrunningpb.Operation, error)
DeleteRepository removes a repository with every image in it.
func (*InMemoryBackend) DeleteRule ¶
func (b *InMemoryBackend) DeleteRule(name string) (*emptypb.Empty, error)
DeleteRule removes a rule.
func (*InMemoryBackend) DeleteTag ¶
func (b *InMemoryBackend) DeleteTag(ctx context.Context, name string) error
DeleteTag removes a tag, leaving its version in place.
func (*InMemoryBackend) DeleteVersion ¶
func (b *InMemoryBackend) DeleteVersion( _ context.Context, in *artifactregistrypb.DeleteVersionRequest, ) (*longrunningpb.Operation, error)
DeleteVersion deletes one manifest; force is required when tags point at it.
func (*InMemoryBackend) DockerHandler ¶
func (b *InMemoryBackend) DockerHandler() http.Handler
DockerHandler serves the Docker Registry v2 API for DOCKER repositories at /v2/<project>/<repository>/<image>. Any credential is accepted, as oauth2accesstoken:<token> Basic auth or a Bearer token; a request without one is challenged to fetch a token from /v2/token.
func (*InMemoryBackend) ExportArtifact ¶
func (b *InMemoryBackend) ExportArtifact( in *artifactregistrypb.ExportArtifactRequest, ) (*longrunningpb.Operation, error)
ExportArtifact copies the files of a version to a Cloud Storage path when the returned operation finishes.
func (*InMemoryBackend) FileExtras ¶
func (b *InMemoryBackend) FileExtras() gcprest.Extra
FileExtras routes the media endpoints that have no gRPC method: the generic artifact upload and file download.
func (*InMemoryBackend) GetAttachment ¶
func (b *InMemoryBackend) GetAttachment(name string) (*artifactregistrypb.Attachment, error)
GetAttachment returns one attachment.
func (*InMemoryBackend) GetDockerImage ¶
func (b *InMemoryBackend) GetDockerImage( ctx context.Context, name string, ) (*artifactregistrypb.DockerImage, error)
GetDockerImage returns one manifest of an image, addressed by digest or tag.
func (*InMemoryBackend) GetFile ¶
func (b *InMemoryBackend) GetFile(ctx context.Context, name string) (*artifactregistrypb.File, error)
GetFile returns one file.
func (*InMemoryBackend) GetIamPolicy ¶
GetIamPolicy returns a repository's policy at the requested version, or an empty one with an etag if none was set.
func (*InMemoryBackend) GetPackage ¶
func (b *InMemoryBackend) GetPackage(name string) (*artifactregistrypb.Package, error)
GetPackage returns one image as a package.
func (*InMemoryBackend) GetProjectSettings ¶
func (b *InMemoryBackend) GetProjectSettings(name string) (*artifactregistrypb.ProjectSettings, error)
GetProjectSettings returns a project's settings; a project that never changed them has the defaults.
func (*InMemoryBackend) GetRepository ¶
func (b *InMemoryBackend) GetRepository(name string) (*artifactregistrypb.Repository, error)
GetRepository returns a repository with its size and registry_uri filled in.
func (*InMemoryBackend) GetRule ¶
func (b *InMemoryBackend) GetRule(name string) (*artifactregistrypb.Rule, error)
GetRule returns one rule.
func (*InMemoryBackend) GetTag ¶
func (b *InMemoryBackend) GetTag(name string) (*artifactregistrypb.Tag, error)
GetTag returns one tag.
func (*InMemoryBackend) GetVPCSCConfig ¶
func (b *InMemoryBackend) GetVPCSCConfig(name string) (*artifactregistrypb.VPCSCConfig, error)
GetVPCSCConfig returns a location's VPC-SC policy; DENY, the documented default, until it is changed.
func (*InMemoryBackend) GetVersion ¶
func (b *InMemoryBackend) GetVersion( ctx context.Context, in *artifactregistrypb.GetVersionRequest, ) (*artifactregistrypb.Version, error)
GetVersion returns one manifest as a version.
func (*InMemoryBackend) ImportAptArtifacts ¶
func (b *InMemoryBackend) ImportAptArtifacts( _ context.Context, in *artifactregistrypb.ImportAptArtifactsRequest, ) (*longrunningpb.Operation, error)
ImportAptArtifacts imports .deb files from Cloud Storage.
func (*InMemoryBackend) ImportYumArtifacts ¶
func (b *InMemoryBackend) ImportYumArtifacts( _ context.Context, in *artifactregistrypb.ImportYumArtifactsRequest, ) (*longrunningpb.Operation, error)
ImportYumArtifacts imports .rpm files from Cloud Storage.
func (*InMemoryBackend) ListAttachments ¶
func (b *InMemoryBackend) ListAttachments( in *artifactregistrypb.ListAttachmentsRequest, ) ([]*artifactregistrypb.Attachment, string, error)
ListAttachments lists a repository's attachments, sorted by name.
func (*InMemoryBackend) ListDockerImages ¶
func (b *InMemoryBackend) ListDockerImages( ctx context.Context, in *artifactregistrypb.ListDockerImagesRequest, ) ([]*artifactregistrypb.DockerImage, string, error)
ListDockerImages lists every manifest of the repository's images.
func (*InMemoryBackend) ListFiles ¶
func (b *InMemoryBackend) ListFiles( ctx context.Context, in *artifactregistrypb.ListFilesRequest, ) ([]*artifactregistrypb.File, string, error)
ListFiles lists a repository's files, filtered by name, owner and annotations.
func (*InMemoryBackend) ListPackages ¶
func (b *InMemoryBackend) ListPackages( in *artifactregistrypb.ListPackagesRequest, ) ([]*artifactregistrypb.Package, string, error)
ListPackages lists the images of a DOCKER repository as packages.
func (*InMemoryBackend) ListRepositories ¶
func (b *InMemoryBackend) ListRepositories( in *artifactregistrypb.ListRepositoriesRequest, ) ([]*artifactregistrypb.Repository, string, error)
ListRepositories lists repositories under a location, or every location with "-".
func (*InMemoryBackend) ListRules ¶
func (b *InMemoryBackend) ListRules( in *artifactregistrypb.ListRulesRequest, ) ([]*artifactregistrypb.Rule, string, error)
ListRules lists a repository's rules by name.
func (*InMemoryBackend) ListTags ¶
func (b *InMemoryBackend) ListTags(in *artifactregistrypb.ListTagsRequest) ([]*artifactregistrypb.Tag, string, error)
ListTags lists an image's tags, optionally only those on one version.
func (*InMemoryBackend) ListVersions ¶
func (b *InMemoryBackend) ListVersions( ctx context.Context, in *artifactregistrypb.ListVersionsRequest, ) ([]*artifactregistrypb.Version, string, error)
ListVersions lists the manifests of an image as versions.
func (*InMemoryBackend) LookupDockerRepo ¶
func (b *InMemoryBackend) LookupDockerRepo(project, id, location string) (DockerRepoInfo, bool)
LookupDockerRepo resolves project/repository to its location and format; an empty location takes the first repository by name that has the id.
func (*InMemoryBackend) PackageExtras ¶
func (b *InMemoryBackend) PackageExtras() gcprest.Extra
PackageExtras routes the npm, Python, Maven, apt, yum, Go and KFP protocols on <location>-<format>.pkg.dev hosts, where the path is /<project>/<repository>/... (apt and yum: /projects/<project>/..., yum remote: /remote/<project>/<repository>/...), and at /<format>/... on any other host.
func (*InMemoryBackend) PublishGoModule ¶
func (b *InMemoryBackend) PublishGoModule(project, repo string, zipData []byte) (string, string, string, error)
PublishGoModule stores a module zip (golang.org/x/mod/zip layout) and returns its package resource name, the module path and the version.
func (*InMemoryBackend) PublishMaven ¶
func (b *InMemoryBackend) PublishMaven( project, repo, group, artifact, version, ext string, data []byte, ) (string, error)
PublishMaven stores one file of a Maven artifact and returns its package resource name. The file is stored as <group path>/<artifactId>/<version>/<artifactId>-<version><ext>, honouring the repository's version policy.
func (*InMemoryBackend) PublishNPM ¶
func (b *InMemoryBackend) PublishNPM(project, repo string, tarball []byte) (string, string, string, error)
PublishNPM stores an npm tarball (as `npm pack` writes it) and tags it latest. It returns the package resource name, the package name and the version.
func (*InMemoryBackend) PublishPython ¶
func (b *InMemoryBackend) PublishPython(project, repo, name, version, filename string, data []byte) (string, error)
PublishPython stores a wheel or sdist and returns its package resource name.
func (*InMemoryBackend) RecordManifestDelete ¶
func (b *InMemoryBackend) RecordManifestDelete(repo, ref string)
RecordManifestDelete notes a manifest or tag deleted through the Docker API.
func (*InMemoryBackend) RecordManifestPut ¶
func (b *InMemoryBackend) RecordManifestPut(repo, ref, digest string)
RecordManifestPut notes a manifest stored through the Docker API; repo is the embedded registry name.
func (*InMemoryBackend) Registry ¶
func (b *InMemoryBackend) Registry() http.Handler
Registry returns the embedded Docker registry handler (no authentication).
func (*InMemoryBackend) Reset ¶
func (b *InMemoryBackend) Reset()
Reset removes every repository and image.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads a snapshot, replacing every repository.
func (*InMemoryBackend) RunCleanup ¶
func (b *InMemoryBackend) RunCleanup(ctx context.Context) []CleanupResult
RunCleanup applies every standard repository's cleanup policies at the backend clock's current time. With cleanup_policy_dry_run set nothing is deleted and the result lists what would have been.
func (*InMemoryBackend) SetCleanupTicker ¶
func (b *InMemoryBackend) SetCleanupTicker(f TickerFunc)
SetCleanupTicker replaces the daily ticker the cleanup worker waits on.
func (*InMemoryBackend) SetClock ¶
func (b *InMemoryBackend) SetClock(now func() time.Time)
SetClock replaces the clock used for timestamps and cleanup ages; nil restores time.Now.
func (*InMemoryBackend) SetContext ¶
func (b *InMemoryBackend) SetContext(ctx context.Context)
SetContext bounds the lifetime of the embedded registry.
func (*InMemoryBackend) SetDataDir ¶
func (b *InMemoryBackend) SetDataDir(dir string)
SetDataDir keeps image blobs and manifests under dir; empty keeps them in memory.
func (*InMemoryBackend) SetIamPolicy ¶
func (b *InMemoryBackend) SetIamPolicy(resource string, policy *iampb.Policy) (*iampb.Policy, error)
SetIamPolicy replaces a repository's policy; a stale etag aborts the call.
func (*InMemoryBackend) SetObjectStore ¶
func (b *InMemoryBackend) SetObjectStore(s ObjectStore)
SetObjectStore connects the import RPCs to a Cloud Storage emulator.
func (*InMemoryBackend) SetOperationDelay ¶
func (b *InMemoryBackend) SetOperationDelay(d time.Duration)
SetOperationDelay makes every long-running operation start not-done and finish that long after it was started on the backend clock; zero (the default) finishes them before the call returns.
func (*InMemoryBackend) SetRegistryAddress ¶
func (b *InMemoryBackend) SetRegistryAddress(host, port string)
SetRegistryAddress sets the host and port advertised in registry_uri and image URIs.
func (*InMemoryBackend) SetRemoteUpstreams ¶
func (b *InMemoryBackend) SetRemoteUpstreams(on bool)
SetRemoteUpstreams lets remote repositories fetch from their upstream over the network; off by default.
func (*InMemoryBackend) SetSecretResolver ¶
func (b *InMemoryBackend) SetSecretResolver(s SecretResolver)
SetSecretResolver lets remote repositories resolve upstream_credentials password secret versions.
func (*InMemoryBackend) SetUpstreamClient ¶
func (b *InMemoryBackend) SetUpstreamClient(c *http.Client)
SetUpstreamClient replaces the HTTP client used for upstream fetches.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises repositories, IAM policies, the ledger, generic artifacts, rules, settings and operations. Image blobs and manifests are not part of it: they live under the data directory when one is configured.
func (*InMemoryBackend) TagExists ¶
func (b *InMemoryBackend) TagExists(repo, tag string) bool
TagExists reports whether tag already points at a manifest in repo.
func (*InMemoryBackend) TestIamPermissions ¶
func (b *InMemoryBackend) TestIamPermissions(resource string, perms []string) ([]string, error)
TestIamPermissions reports the requested Artifact Registry permissions as granted: the emulator does not enforce IAM.
func (*InMemoryBackend) UpdateFile ¶
func (b *InMemoryBackend) UpdateFile( ctx context.Context, in *artifactregistrypb.UpdateFileRequest, ) (*artifactregistrypb.File, error)
UpdateFile replaces the annotations of a file.
func (*InMemoryBackend) UpdatePackage ¶
func (b *InMemoryBackend) UpdatePackage( in *artifactregistrypb.UpdatePackageRequest, ) (*artifactregistrypb.Package, error)
UpdatePackage changes the display name and annotations of a package.
func (*InMemoryBackend) UpdateProjectSettings ¶
func (b *InMemoryBackend) UpdateProjectSettings( in *artifactregistrypb.UpdateProjectSettingsRequest, ) (*artifactregistrypb.ProjectSettings, error)
UpdateProjectSettings applies legacy_redirection_state and pull_percent.
func (*InMemoryBackend) UpdateRepository ¶
func (b *InMemoryBackend) UpdateRepository( in *artifactregistrypb.UpdateRepositoryRequest, ) (*artifactregistrypb.Repository, error)
UpdateRepository applies the masked fields (all set fields when the mask is empty).
func (*InMemoryBackend) UpdateRule ¶
func (b *InMemoryBackend) UpdateRule(in *artifactregistrypb.UpdateRuleRequest) (*artifactregistrypb.Rule, error)
UpdateRule applies the masked fields; an empty mask copies every field the request sets.
func (*InMemoryBackend) UpdateTag ¶
func (b *InMemoryBackend) UpdateTag( ctx context.Context, in *artifactregistrypb.UpdateTagRequest, ) (*artifactregistrypb.Tag, error)
UpdateTag moves an existing tag to another version.
func (*InMemoryBackend) UpdateVPCSCConfig ¶
func (b *InMemoryBackend) UpdateVPCSCConfig( in *artifactregistrypb.UpdateVPCSCConfigRequest, ) (*artifactregistrypb.VPCSCConfig, error)
UpdateVPCSCConfig sets vpcsc_policy.
func (*InMemoryBackend) UpdateVersion ¶
func (b *InMemoryBackend) UpdateVersion( in *artifactregistrypb.UpdateVersionRequest, ) (*artifactregistrypb.Version, error)
UpdateVersion changes the description and annotations of a version.
func (*InMemoryBackend) UploadGenericArtifact ¶
func (b *InMemoryBackend) UploadGenericArtifact( _ context.Context, parent string, in uploadReq, data []byte, ) (*longrunningpb.Operation, error)
UploadGenericArtifact stores a file of a generic repository, creating its package and version.
type ObjectStore ¶
type ObjectStore interface {
ReadObject(bucket, object string) ([]byte, error)
WriteObject(bucket, object string, data []byte, contentType string) error
ListObjects(bucket, prefix string) ([]string, error)
}
ObjectStore reads and writes Cloud Storage objects for the import and export RPCs; the in-process GCS emulator implements it.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Google Artifact Registry. It serves gRPC, REST and the Docker Registry API on its own listener (see Handler.StartWorker) and never matches on the shared AWS router.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init creates the backend and handler; the port is bound in StartWorker.
type SecretResolver ¶
SecretResolver reads a Secret Manager version payload; the in-process Secret Manager implements it.
type Settings ¶
type Settings struct {
RegistryHost string `` //nolint:lll // config struct tags are intentionally verbose
/* 206-byte string literal not displayed */
Port int `` //nolint:lll // config struct tags are intentionally verbose
/* 245-byte string literal not displayed */
RemoteUpstreams bool `` //nolint:lll // config struct tags are intentionally verbose
/* 313-byte string literal not displayed */
OperationDelay time.Duration `` //nolint:lll // config struct tags are intentionally verbose
/* 224-byte string literal not displayed */
}
Settings holds service-level configuration, embedded in the root CLI command as CLI.GCPArtifactRegistry.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings returns the settings used when no ConfigProvider is available.
Source Files
¶
- apt.go
- attachments.go
- audit.go
- backend.go
- cel.go
- cleanup.go
- deb.go
- docker.go
- docker_remote.go
- dockerlayout.go
- errors.go
- export.go
- filehttp.go
- files.go
- generic.go
- gomod.go
- grpc.go
- handler.go
- iam.go
- images.go
- imports.go
- inproc.go
- kfp.go
- locations.go
- maven.go
- media.go
- meta.go
- names.go
- npm.go
- npmtags.go
- ops.go
- packages.go
- persistence.go
- pkgfmt.go
- project.go
- provider.go
- publish.go
- python.go
- remote.go
- remote_validate.go
- repos.go
- rpm.go
- rules.go
- settings.go
- signing.go
- tags.go
- uploadtypes.go
- upstream_auth.go
- util.go
- virtual.go
- virtual_merge.go
- virtual_ospkg.go
- yum.go