Documentation
¶
Index ¶
- Variables
- type AwsEcrContainerImageDetails
- type Backend
- type CVSSScore
- type CompleteLayerUploadResult
- type EnhancedFindingResource
- type EnhancedFindingResourceDetails
- type EnhancedImageScanFinding
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *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) RegistryEnabled() bool
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- func (h *Handler) WithJanitor(interval time.Duration, taskTimeout ...time.Duration) *Handler
- type Image
- type ImageFailure
- type ImageIdentifier
- type ImageReferrer
- type ImageReplicationStatusEntry
- type ImageReplicationStatusResult
- type ImageScanFinding
- type ImageScanFindingsResult
- type ImageScanStartResult
- type ImageSigningStatusRecord
- type ImageSigningStatusResult
- type ImageStorageClassResult
- type ImageTagMutabilityExclusionFilter
- type InMemoryBackend
- func (b *InMemoryBackend) AccountID() string
- func (b *InMemoryBackend) AddImageInternal(repositoryName string, img Image)
- func (b *InMemoryBackend) AddLifecyclePolicyInternal(repositoryName, policy string)
- func (b *InMemoryBackend) AddRepositoryInternal(repo Repository)
- func (b *InMemoryBackend) BatchCheckLayerAvailability(ctx context.Context, repositoryName string, layerDigests []string) ([]LayerAvailability, []LayerFailure, error)
- func (b *InMemoryBackend) BatchDeleteImage(ctx context.Context, repositoryName string, imageIDs []ImageIdentifier) ([]ImageIdentifier, []ImageFailure, error)
- func (b *InMemoryBackend) BatchGetImage(ctx context.Context, repositoryName string, imageIDs []ImageIdentifier) ([]Image, []ImageFailure, error)
- func (b *InMemoryBackend) BatchGetRepositoryScanningConfiguration(ctx context.Context, repositoryNames []string) ([]RepositoryScanningConfiguration, []RepositoryScanningConfigurationFailure, ...)
- func (b *InMemoryBackend) CompleteLayerUpload(ctx context.Context, repositoryName, uploadID string, layerDigests []string) (*CompleteLayerUploadResult, error)
- func (b *InMemoryBackend) CreatePullThroughCacheRule(ctx context.Context, ...) (*PullThroughCacheRule, error)
- func (b *InMemoryBackend) CreateRepository(ctx context.Context, name, imageTagMutability string, scanOnPush bool, ...) (*Repository, error)
- func (b *InMemoryBackend) CreateRepositoryCreationTemplate(ctx context.Context, req *RepositoryCreationTemplate) (*RepositoryCreationTemplate, error)
- func (b *InMemoryBackend) DeleteLifecyclePolicy(ctx context.Context, repositoryName string) (*LifecyclePolicyResult, error)
- func (b *InMemoryBackend) DeletePullThroughCacheRule(ctx context.Context, prefix string) (*PullThroughCacheRule, error)
- func (b *InMemoryBackend) DeleteRegistryPolicy(ctx context.Context) (*RegistryPolicyResult, error)
- func (b *InMemoryBackend) DeleteRepository(ctx context.Context, name string) (*Repository, error)
- func (b *InMemoryBackend) DeleteRepositoryCreationTemplate(ctx context.Context, prefix string) (*RepositoryCreationTemplate, error)
- func (b *InMemoryBackend) DeleteRepositoryPolicy(ctx context.Context, repositoryName string) (*RepositoryPolicyResult, error)
- func (b *InMemoryBackend) DeleteSigningConfiguration(ctx context.Context) (*SigningSettings, error)
- func (b *InMemoryBackend) DeregisterPullTimeUpdateExclusion(ctx context.Context, principalArn string) (*PullTimeUpdateExclusion, error)
- func (b *InMemoryBackend) DescribeImageReplicationStatus(ctx context.Context, repositoryName string, imageID ImageIdentifier) (*ImageReplicationStatusResult, error)
- func (b *InMemoryBackend) DescribeImageScanFindings(ctx context.Context, repositoryName string, imageID ImageIdentifier, ...) (*ImageScanFindingsResult, string, error)
- func (b *InMemoryBackend) DescribeImageSigningStatus(ctx context.Context, repositoryName string, imageID ImageIdentifier) (*ImageSigningStatusResult, error)
- func (b *InMemoryBackend) DescribeImages(ctx context.Context, repositoryName string, imageIDs []ImageIdentifier) ([]Image, error)
- func (b *InMemoryBackend) DescribePullThroughCacheRules(ctx context.Context, prefixes []string) ([]PullThroughCacheRule, error)
- func (b *InMemoryBackend) DescribeRegistry(ctx context.Context) (*RegistryDescription, error)
- func (b *InMemoryBackend) DescribeRepositories(ctx context.Context, names []string) ([]Repository, error)
- func (b *InMemoryBackend) DescribeRepositoryCreationTemplates(ctx context.Context, prefixes []string) ([]RepositoryCreationTemplate, error)
- func (b *InMemoryBackend) GetAccountSetting(ctx context.Context, name string) (string, error)
- func (b *InMemoryBackend) GetDownloadURLForLayer(ctx context.Context, repositoryName, layerDigest string) (string, error)
- func (b *InMemoryBackend) GetLifecyclePolicy(ctx context.Context, repositoryName string) (*LifecyclePolicyResult, error)
- func (b *InMemoryBackend) GetLifecyclePolicyPreview(ctx context.Context, repositoryName string) (*LifecyclePolicyPreviewResult, error)
- func (b *InMemoryBackend) GetRegistryPolicy(ctx context.Context) (*RegistryPolicyResult, error)
- func (b *InMemoryBackend) GetRegistryScanningConfiguration(ctx context.Context) (*RegistryScanningSettings, error)
- func (b *InMemoryBackend) GetRepositoryPolicy(ctx context.Context, repositoryName string) (*RepositoryPolicyResult, error)
- func (b *InMemoryBackend) GetSigningConfiguration(ctx context.Context) (*SigningSettings, error)
- func (b *InMemoryBackend) InitiateLayerUpload(ctx context.Context, repositoryName string) (*LayerUploadInitiation, error)
- func (b *InMemoryBackend) ListImageReferrers(ctx context.Context, repositoryName string, subject ImageIdentifier) ([]ImageReferrer, error)
- func (b *InMemoryBackend) ListImages(ctx context.Context, repositoryName, tagStatusFilter string) ([]ImageIdentifier, error)
- func (b *InMemoryBackend) ListPullTimeUpdateExclusions(ctx context.Context) ([]PullTimeUpdateExclusion, error)
- func (b *InMemoryBackend) ListTagsForResource(ctx context.Context, resourceArn string) (map[string]string, error)
- func (b *InMemoryBackend) ProxyEndpoint() string
- func (b *InMemoryBackend) PutAccountSetting(ctx context.Context, name, value string) (string, error)
- func (b *InMemoryBackend) PutImage(ctx context.Context, repositoryName string, image Image) (*Image, error)
- func (b *InMemoryBackend) PutImageScanningConfiguration(ctx context.Context, repositoryName string, scanOnPush bool) (*RepositoryScanningConfiguration, error)
- func (b *InMemoryBackend) PutImageTagMutability(ctx context.Context, repositoryName, imageTagMutability string, ...) (*Repository, error)
- func (b *InMemoryBackend) PutLifecyclePolicy(ctx context.Context, repositoryName, policyText string) (*LifecyclePolicyResult, error)
- func (b *InMemoryBackend) PutRegistryPolicy(ctx context.Context, policyText string) (*RegistryPolicyResult, error)
- func (b *InMemoryBackend) PutRegistryScanningConfiguration(ctx context.Context, settings *RegistryScanningSettings) (*RegistryScanningSettings, error)
- func (b *InMemoryBackend) PutReplicationConfiguration(ctx context.Context, cfg *ReplicationConfig) (*ReplicationConfig, error)
- func (b *InMemoryBackend) PutSigningConfiguration(ctx context.Context, settings *SigningSettings) (*SigningSettings, error)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) RegisterPullTimeUpdateExclusion(ctx context.Context, principalArn string) (*PullTimeUpdateExclusion, error)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) RunLifecycleExpiry(ctx context.Context) int
- func (b *InMemoryBackend) SetEndpoint(endpoint string)
- func (b *InMemoryBackend) SetRegistryPolicyInternal(policy string)
- func (b *InMemoryBackend) SetRepositoryPolicy(ctx context.Context, repositoryName, policyText string) (*RepositoryPolicyResult, error)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) StartImageScan(ctx context.Context, repositoryName string, imageID ImageIdentifier) (*ImageScanStartResult, error)
- func (b *InMemoryBackend) StartLifecyclePolicyPreview(ctx context.Context, repositoryName, policyText string) (*LifecyclePolicyPreviewResult, error)
- func (b *InMemoryBackend) TagResource(ctx context.Context, resourceArn string, tags map[string]string) error
- func (b *InMemoryBackend) UntagResource(ctx context.Context, resourceArn string, tagKeys []string) error
- func (b *InMemoryBackend) UpdateImageStorageClass(ctx context.Context, repositoryName string, imageID ImageIdentifier, ...) (*ImageStorageClassResult, error)
- func (b *InMemoryBackend) UpdatePullThroughCacheRule(ctx context.Context, prefix, credentialArn, customRoleArn string) (*PullThroughCacheRule, error)
- func (b *InMemoryBackend) UpdateRepositoryCreationTemplate(ctx context.Context, req *RepositoryCreationTemplate) (*RepositoryCreationTemplate, error)
- func (b *InMemoryBackend) UploadLayerPart(ctx context.Context, repositoryName, uploadID string, ...) (*LayerUploadPartResult, error)
- func (b *InMemoryBackend) ValidatePullThroughCacheRule(ctx context.Context, prefix string) (*ValidatePullThroughCacheRuleResult, error)
- type Janitor
- type LayerAvailability
- type LayerFailure
- type LayerUploadInitiation
- type LayerUploadPartResult
- type LifecyclePolicyPreviewResult
- type LifecyclePolicyResult
- type PackageVulnerabilityDetails
- type Provider
- type PullThroughCacheRule
- type PullTimeUpdateExclusion
- type RegistryDescription
- type RegistryPolicyResult
- type RegistryScanningRule
- type RegistryScanningSettings
- type Remediation
- type RemediationRecommendation
- type ReplicationConfig
- type ReplicationDestination
- type ReplicationRule
- type Repository
- type RepositoryCreationTemplate
- type RepositoryFilter
- type RepositoryPolicyResult
- type RepositoryScanningConfiguration
- type RepositoryScanningConfigurationFailure
- type SigningRule
- type SigningSettings
- type Snapshottable
- type ValidatePullThroughCacheRuleResult
- type VulnerablePackage
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRepositoryNotFound is returned when a repository does not exist. ErrRepositoryNotFound = awserr.New("RepositoryNotFoundException", awserr.ErrNotFound) // ErrRepositoryAlreadyExists is returned when a repository already exists. ErrRepositoryAlreadyExists = awserr.New( "RepositoryAlreadyExistsException", awserr.ErrAlreadyExists, ) // ErrRepositoryNotEmpty is returned when deleting a non-empty repository without the force flag. ErrRepositoryNotEmpty = awserr.New("RepositoryNotEmptyException", awserr.ErrConflict) // ErrImageTagAlreadyExists is returned when re-tagging an image in an IMMUTABLE repository. ErrImageTagAlreadyExists = awserr.New("ImageTagAlreadyExistsException", awserr.ErrConflict) // ErrInvalidRepositoryName is returned when the repository name is invalid. ErrInvalidRepositoryName = errors.New("InvalidParameterException") // ErrPullThroughCacheRuleNotFound is returned when a pull-through cache rule does not exist. ErrPullThroughCacheRuleNotFound = awserr.New( "PullThroughCacheRuleNotFoundException", awserr.ErrNotFound, ) // ErrPullThroughCacheRuleAlreadyExists is returned when a pull-through cache rule already exists. ErrPullThroughCacheRuleAlreadyExists = awserr.New( "PullThroughCacheRuleAlreadyExistsException", awserr.ErrAlreadyExists, ) // ErrLifecyclePolicyNotFound is returned when a lifecycle policy does not exist. ErrLifecyclePolicyNotFound = awserr.New("LifecyclePolicyNotFoundException", awserr.ErrNotFound) // ErrRepositoryCreationTemplateNotFound is returned when a creation template does not exist. ErrRepositoryCreationTemplateNotFound = awserr.New( "TemplateNotFoundException", awserr.ErrNotFound, ) // ErrRepositoryCreationTemplateAlreadyExists is returned when a creation template prefix already exists. ErrRepositoryCreationTemplateAlreadyExists = awserr.New( "TemplateAlreadyExistsException", awserr.ErrAlreadyExists, ) // ErrRegistryPolicyNotFound is returned when the registry policy does not exist. ErrRegistryPolicyNotFound = awserr.New("RegistryPolicyNotFoundException", awserr.ErrNotFound) // ErrRepositoryPolicyNotFound is returned when a repository-level IAM policy does not exist. ErrRepositoryPolicyNotFound = awserr.New( "RepositoryPolicyNotFoundException", awserr.ErrNotFound, ) // ErrImageNotFound is returned when a requested image does not exist in a repository. ErrImageNotFound = awserr.New("ImageNotFoundException", awserr.ErrNotFound) // ErrScanNotFoundException is returned when DescribeImageScanFindings is called // on an image that has never had a scan started. ErrScanNotFoundException = awserr.New("ScanNotFoundException", awserr.ErrNotFound) )
var ( // ErrLayerInaccessible is returned when a layer exists but is not accessible. ErrLayerInaccessible = awserr.New("LayerInaccessibleException", awserr.ErrNotFound) // ErrLayersNotFound is returned when requested layers do not exist in the repository. ErrLayersNotFound = awserr.New("LayersNotFoundException", awserr.ErrNotFound) // ErrLayerAlreadyExists is returned when CompleteLayerUpload is called with a // digest that has already been registered as an available layer in the // repository (matches AWS: "The image layer already exists in the associated // repository."). ErrLayerAlreadyExists = awserr.New("LayerAlreadyExistsException", awserr.ErrAlreadyExists) // ErrInvalidLayerPart is returned when an UploadLayerPart's first byte is not // consecutive to the last byte received by a previous part in the same // upload session (matches AWS InvalidLayerPartException). ErrInvalidLayerPart = awserr.New("InvalidLayerPartException", awserr.ErrInvalidParameter) // ErrImageDigestDoesNotMatch is returned when a caller-supplied imageDigest on // PutImage does not match the digest ECR computes from the image manifest. ErrImageDigestDoesNotMatch = awserr.New( "ImageDigestDoesNotMatchException", awserr.ErrInvalidParameter, ) )
var ErrLayerDigestMismatch = awserr.New("InvalidLayerException", awserr.ErrInvalidParameter)
ErrLayerDigestMismatch is returned when the provided digest does not match the uploaded bytes.
var ErrNilAppContext = errors.New("AppContext is required")
ErrNilAppContext is returned by Init when appCtx is nil.
Functions ¶
This section is empty.
Types ¶
type AwsEcrContainerImageDetails ¶
type AwsEcrContainerImageDetails struct {
Architecture string `json:"architecture,omitempty"`
ImageHash string `json:"imageHash,omitempty"`
Platform string `json:"platform,omitempty"`
RegistryID string `json:"registryId,omitempty"`
RepositoryName string `json:"repositoryName,omitempty"`
ImageTags []string `json:"imageTags,omitempty"`
PushedAt float64 `json:"pushedAt"`
}
AwsEcrContainerImageDetails describes the ECR image an enhanced finding covers.
type Backend ¶
type Backend interface {
// CreateRepository creates a new ECR repository and returns its metadata.
// Returns ErrRepositoryAlreadyExists if a repository with that name already
// exists, or ErrInvalidRepositoryName when name is empty.
// imageTagMutability defaults to "MUTABLE" when empty.
// encryptionType defaults to "AES256" when empty; kmsKey is only used with "KMS".
CreateRepository(
ctx context.Context,
name, imageTagMutability string,
scanOnPush bool,
encryptionType, kmsKey string,
) (*Repository, error)
// DescribeRepositories returns repository metadata, optionally filtered by
// the provided names. Passing an empty slice returns all repositories.
// Returns ErrRepositoryNotFound if any requested name does not exist.
DescribeRepositories(ctx context.Context, names []string) ([]Repository, error)
// DeleteRepository removes the named repository and returns its metadata.
// Returns ErrRepositoryNotFound if the repository does not exist.
DeleteRepository(ctx context.Context, name string) (*Repository, error)
// ProxyEndpoint returns the registry endpoint embedded in repository URIs
// and returned by GetAuthorizationToken.
ProxyEndpoint() string
// SetEndpoint updates the registry endpoint used in new repository URIs.
// It should be called once the server's listening address is known.
SetEndpoint(endpoint string)
// BatchCheckLayerAvailability checks the availability of image layers.
BatchCheckLayerAvailability(
ctx context.Context,
repositoryName string,
layerDigests []string,
) ([]LayerAvailability, []LayerFailure, error)
// BatchDeleteImage deletes specified images from a repository.
BatchDeleteImage(
ctx context.Context,
repositoryName string,
imageIDs []ImageIdentifier,
) ([]ImageIdentifier, []ImageFailure, error)
// BatchGetImage gets details for specified images.
BatchGetImage(
ctx context.Context,
repositoryName string,
imageIDs []ImageIdentifier,
) ([]Image, []ImageFailure, error)
// DescribeImages returns image details for a repository.
DescribeImages(ctx context.Context, repositoryName string, imageIDs []ImageIdentifier) ([]Image, error)
// BatchGetRepositoryScanningConfiguration gets scanning config for repositories.
BatchGetRepositoryScanningConfiguration(
ctx context.Context,
repositoryNames []string,
) ([]RepositoryScanningConfiguration, []RepositoryScanningConfigurationFailure, error)
// CompleteLayerUpload completes the upload of an image layer.
CompleteLayerUpload(
ctx context.Context,
repositoryName, uploadID string,
layerDigests []string,
) (*CompleteLayerUploadResult, error)
// GetDownloadURLForLayer resolves a download URL for a repository layer.
GetDownloadURLForLayer(ctx context.Context, repositoryName, layerDigest string) (string, error)
// InitiateLayerUpload starts a layer upload session.
InitiateLayerUpload(ctx context.Context, repositoryName string) (*LayerUploadInitiation, error)
// UploadLayerPart records uploaded bytes for an existing session.
UploadLayerPart(
ctx context.Context,
repositoryName, uploadID string,
firstByte, lastByte int64,
blob []byte,
) (*LayerUploadPartResult, error)
// CreatePullThroughCacheRule creates a pull-through cache rule.
CreatePullThroughCacheRule(
ctx context.Context,
prefix, upstreamURL, credentialArn, upstreamRegistry, customRoleArn, upstreamRepositoryPrefix string,
) (*PullThroughCacheRule, error)
// DescribePullThroughCacheRules lists pull-through cache rules.
DescribePullThroughCacheRules(ctx context.Context, prefixes []string) ([]PullThroughCacheRule, error)
// CreateRepositoryCreationTemplate creates a repository creation template.
CreateRepositoryCreationTemplate(
ctx context.Context,
req *RepositoryCreationTemplate,
) (*RepositoryCreationTemplate, error)
// DeleteRepositoryCreationTemplate deletes a repository creation template.
DeleteRepositoryCreationTemplate(ctx context.Context, prefix string) (*RepositoryCreationTemplate, error)
// DescribeRepositoryCreationTemplates lists repository creation templates.
DescribeRepositoryCreationTemplates(ctx context.Context, prefixes []string) ([]RepositoryCreationTemplate, error)
// DeleteLifecyclePolicy deletes the lifecycle policy for a repository.
DeleteLifecyclePolicy(ctx context.Context, repositoryName string) (*LifecyclePolicyResult, error)
// GetLifecyclePolicy returns the lifecycle policy for a repository.
GetLifecyclePolicy(ctx context.Context, repositoryName string) (*LifecyclePolicyResult, error)
// GetLifecyclePolicyPreview returns the current lifecycle policy preview.
GetLifecyclePolicyPreview(ctx context.Context, repositoryName string) (*LifecyclePolicyPreviewResult, error)
// PutLifecyclePolicy creates or replaces the lifecycle policy for a repository.
PutLifecyclePolicy(ctx context.Context, repositoryName, policyText string) (*LifecyclePolicyResult, error)
// StartLifecyclePolicyPreview starts or refreshes a lifecycle policy preview.
StartLifecyclePolicyPreview(
ctx context.Context,
repositoryName, policyText string,
) (*LifecyclePolicyPreviewResult, error)
// DeletePullThroughCacheRule deletes a pull-through cache rule by prefix.
DeletePullThroughCacheRule(ctx context.Context, prefix string) (*PullThroughCacheRule, error)
// UpdatePullThroughCacheRule updates a pull-through cache rule by prefix.
UpdatePullThroughCacheRule(
ctx context.Context,
prefix, credentialArn, customRoleArn string,
) (*PullThroughCacheRule, error)
// ValidatePullThroughCacheRule validates a pull-through cache rule by prefix.
ValidatePullThroughCacheRule(ctx context.Context, prefix string) (*ValidatePullThroughCacheRuleResult, error)
// DeleteRegistryPolicy deletes the registry-level policy.
DeleteRegistryPolicy(ctx context.Context) (*RegistryPolicyResult, error)
// DescribeRegistry returns registry-wide metadata.
DescribeRegistry(ctx context.Context) (*RegistryDescription, error)
// GetRegistryPolicy returns the registry-level policy.
GetRegistryPolicy(ctx context.Context) (*RegistryPolicyResult, error)
// GetRegistryScanningConfiguration returns the registry scanning configuration.
GetRegistryScanningConfiguration(ctx context.Context) (*RegistryScanningSettings, error)
// PutRegistryPolicy creates or replaces the registry-level IAM policy.
PutRegistryPolicy(ctx context.Context, policyText string) (*RegistryPolicyResult, error)
// PutRegistryScanningConfiguration updates the registry scanning configuration.
PutRegistryScanningConfiguration(
ctx context.Context,
settings *RegistryScanningSettings,
) (*RegistryScanningSettings, error)
// PutReplicationConfiguration updates the registry replication configuration.
PutReplicationConfiguration(ctx context.Context, cfg *ReplicationConfig) (*ReplicationConfig, error)
// GetRepositoryPolicy returns the repository-level policy.
GetRepositoryPolicy(ctx context.Context, repositoryName string) (*RepositoryPolicyResult, error)
// SetRepositoryPolicy creates or replaces the repository-level IAM policy.
SetRepositoryPolicy(ctx context.Context, repositoryName, policyText string) (*RepositoryPolicyResult, error)
// DeleteRepositoryPolicy deletes the repository-level policy.
DeleteRepositoryPolicy(ctx context.Context, repositoryName string) (*RepositoryPolicyResult, error)
// GetSigningConfiguration returns the current registry signing configuration.
GetSigningConfiguration(ctx context.Context) (*SigningSettings, error)
// PutSigningConfiguration updates the registry signing configuration.
PutSigningConfiguration(ctx context.Context, settings *SigningSettings) (*SigningSettings, error)
// DeleteSigningConfiguration removes the registry signing configuration.
DeleteSigningConfiguration(ctx context.Context) (*SigningSettings, error)
// DescribeImageSigningStatus returns signing status for an image.
DescribeImageSigningStatus(
ctx context.Context,
repositoryName string,
imageID ImageIdentifier,
) (*ImageSigningStatusResult, error)
// DescribeImageScanFindings returns scan findings for an image.
DescribeImageScanFindings(
ctx context.Context,
repositoryName string,
imageID ImageIdentifier,
maxResults int,
nextToken string,
) (*ImageScanFindingsResult, string, error)
// StartImageScan starts an image scan and returns the scan status.
StartImageScan(ctx context.Context, repositoryName string, imageID ImageIdentifier) (*ImageScanStartResult, error)
// ListImages lists image identifiers for a repository.
// tagStatusFilter can be "TAGGED", "UNTAGGED", or "" / "ANY" for all images.
ListImages(ctx context.Context, repositoryName, tagStatusFilter string) ([]ImageIdentifier, error)
// ListImageReferrers lists image referrers for a subject image.
ListImageReferrers(ctx context.Context, repositoryName string, subject ImageIdentifier) ([]ImageReferrer, error)
// PutImage creates or replaces an image manifest.
PutImage(ctx context.Context, repositoryName string, image Image) (*Image, error)
// PutImageScanningConfiguration updates per-repository scan-on-push config.
PutImageScanningConfiguration(
ctx context.Context,
repositoryName string,
scanOnPush bool,
) (*RepositoryScanningConfiguration, error)
// PutImageTagMutability updates per-repository tag mutability.
PutImageTagMutability(
ctx context.Context,
repositoryName, imageTagMutability string,
exclusionFilters []ImageTagMutabilityExclusionFilter,
) (*Repository, error)
// DescribeImageReplicationStatus returns the current replication status for an image.
DescribeImageReplicationStatus(
ctx context.Context,
repositoryName string,
imageID ImageIdentifier,
) (*ImageReplicationStatusResult, error)
// UpdateImageStorageClass updates the storage class for an image.
UpdateImageStorageClass(
ctx context.Context,
repositoryName string,
imageID ImageIdentifier,
target string,
) (*ImageStorageClassResult, error)
// GetAccountSetting returns a registry account setting.
GetAccountSetting(ctx context.Context, name string) (string, error)
// PutAccountSetting updates a registry account setting.
PutAccountSetting(ctx context.Context, name, value string) (string, error)
// RegisterPullTimeUpdateExclusion creates a pull time update exclusion.
RegisterPullTimeUpdateExclusion(ctx context.Context, principalArn string) (*PullTimeUpdateExclusion, error)
// DeregisterPullTimeUpdateExclusion deletes a pull time update exclusion.
DeregisterPullTimeUpdateExclusion(ctx context.Context, principalArn string) (*PullTimeUpdateExclusion, error)
// ListPullTimeUpdateExclusions lists pull time update exclusions.
ListPullTimeUpdateExclusions(ctx context.Context) ([]PullTimeUpdateExclusion, error)
// UpdateRepositoryCreationTemplate updates a repository creation template.
UpdateRepositoryCreationTemplate(
ctx context.Context,
req *RepositoryCreationTemplate,
) (*RepositoryCreationTemplate, error)
// TagResource associates tags with a resource identified by ARN.
TagResource(ctx context.Context, resourceArn string, tags map[string]string) error
// UntagResource removes tags from a resource identified by ARN.
UntagResource(ctx context.Context, resourceArn string, tagKeys []string) error
// ListTagsForResource returns all tags for a resource identified by ARN.
ListTagsForResource(ctx context.Context, resourceArn string) (map[string]string, error)
// Reset clears all backend state.
Reset()
// Region returns the AWS region this backend is configured for.
Region() string
// AccountID returns the AWS account ID associated with this registry.
AccountID() string
}
Backend defines the interface for ECR control-plane operations. InMemoryBackend implements this interface; alternative backends (e.g. one that delegates to a real Docker daemon registry, or a test double) can implement it too, keeping the Handler backend-agnostic.
Data-plane methods take a context.Context as their first argument so that per-request metadata (notably the AWS region, via pkgs/awsmeta) can flow through to ARN construction and region-scoped behaviour.
type CVSSScore ¶
type CVSSScore struct {
ScoringVector string `json:"scoringVector,omitempty"`
Source string `json:"source,omitempty"`
Version string `json:"version,omitempty"`
BaseScore float64 `json:"baseScore,omitempty"`
}
CVSSScore is a single CVSS scoring entry for an enhanced finding.
type CompleteLayerUploadResult ¶
type CompleteLayerUploadResult struct {
LayerDigest string `json:"layerDigest"`
RepositoryName string `json:"repositoryName"`
RegistryID string `json:"registryId"`
UploadID string `json:"uploadId"`
}
CompleteLayerUploadResult is the result of a layer upload completion.
type EnhancedFindingResource ¶
type EnhancedFindingResource struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Details EnhancedFindingResourceDetails `json:"details"`
}
EnhancedFindingResource identifies the resource an enhanced finding applies to.
type EnhancedFindingResourceDetails ¶
type EnhancedFindingResourceDetails struct {
AwsEcrContainerImage AwsEcrContainerImageDetails `json:"awsEcrContainerImage"`
}
EnhancedFindingResourceDetails wraps the resource-type-specific detail.
type EnhancedImageScanFinding ¶
type EnhancedImageScanFinding struct {
PackageVulnerabilityDetails *PackageVulnerabilityDetails `json:"packageVulnerabilityDetails,omitempty"`
Remediation *Remediation `json:"remediation,omitempty"`
Description string `json:"description,omitempty"`
AwsAccountID string `json:"awsAccountId,omitempty"`
FindingArn string `json:"findingArn,omitempty"`
Severity string `json:"severity,omitempty"`
Status string `json:"status,omitempty"`
Title string `json:"title,omitempty"`
Type string `json:"type,omitempty"`
FixAvailable string `json:"fixAvailable,omitempty"`
Resources []EnhancedFindingResource `json:"resources,omitempty"`
UpdatedAt float64 `json:"updatedAt"`
LastObservedAt float64 `json:"lastObservedAt"`
FirstObservedAt float64 `json:"firstObservedAt"`
Score float64 `json:"score,omitempty"`
}
EnhancedImageScanFinding is an Inspector-style enhanced scan finding, returned under enhancedFindings when the registry uses ENHANCED scanning. It carries package-level vulnerability detail that the BASIC finding shape lacks.
type Handler ¶
type Handler struct {
Backend Backend
// contains filtered or unexported fields
}
Handler is the Echo HTTP handler for ECR operations.
func NewHandler ¶
NewHandler creates a new ECR handler. registryHandler may be nil when the local registry is disabled.
func (*Handler) ChaosOperations ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this ECR instance handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts the ECR action from the request.
func (*Handler) ExtractResource ¶
ExtractResource extracts the repository name from the request. For registry v2 paths (/v2/<name>/...) the name is taken from the URL to avoid buffering potentially large binary upload bodies.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the list of supported ECR operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function for ECR requests.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority for ECR. Control plane uses header-exact priority; registry uses path-based priority elevated above catch-alls.
func (*Handler) RegistryEnabled ¶
RegistryEnabled returns true if the embedded Docker registry is enabled.
func (*Handler) Reset ¶
func (h *Handler) Reset()
Reset clears the backend state and resets the endpoint lazy-init.
func (*Handler) Restore ¶
Restore implements persistence.Persistable by delegating to the backend when it implements Snapshottable. Non-snapshottable backends are skipped.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches ECR requests. It matches on:
- X-Amz-Target header with AmazonEC2ContainerRegistry_V20150921. prefix (control plane)
- /v2 or /v2/ path prefix (Docker registry v2 API, when local registry is enabled)
func (*Handler) Snapshot ¶
Snapshot implements persistence.Persistable by delegating to the backend when it implements Snapshottable. Returns nil for non-snapshottable backends.
func (*Handler) StartWorker ¶
StartWorker starts the background janitor if one is configured. It satisfies the service.BackgroundWorker interface.
func (*Handler) WithJanitor ¶
WithJanitor attaches a background lifecycle-expiry janitor to the handler. interval=0 uses the default of one minute. The optional taskTimeout bounds each sweep; 0 means no per-task timeout. It is a no-op unless the backend is an *InMemoryBackend.
type Image ¶
type Image struct {
ImagePushedAt time.Time `json:"imagePushedAt"`
ImageID ImageIdentifier `json:"imageId"`
ImageDigest string `json:"imageDigest"`
ImageManifest string `json:"imageManifest,omitempty"`
ImageManifestMediaType string `json:"imageManifestMediaType,omitempty"`
ImageStatus string `json:"imageStatus,omitempty"`
RepositoryName string `json:"repositoryName"`
RegistryID string `json:"registryId"`
StorageClass string `json:"storageClass,omitempty"`
Tags []string `json:"-"`
ImageSizeInBytes int64 `json:"imageSizeInBytes,omitempty"`
}
Image represents a Docker image in ECR.
type ImageFailure ¶
type ImageFailure struct {
ImageID ImageIdentifier `json:"imageId"`
FailureCode string `json:"failureCode"`
FailureReason string `json:"failureReason"`
}
ImageFailure represents an image that could not be processed.
type ImageIdentifier ¶
type ImageIdentifier struct {
ImageDigest string `json:"imageDigest,omitempty"`
ImageTag string `json:"imageTag,omitempty"`
}
ImageIdentifier identifies a specific image by digest or tag.
type ImageReferrer ¶
type ImageReferrer struct {
Annotations map[string]string `json:"annotations,omitempty"`
Digest string `json:"digest,omitempty"`
MediaType string `json:"mediaType,omitempty"`
ArtifactStatus string `json:"artifactStatus,omitempty"`
ArtifactType string `json:"artifactType,omitempty"`
Size int64 `json:"size,omitempty"`
}
ImageReferrer is an OCI referrer summary.
type ImageReplicationStatusEntry ¶
type ImageReplicationStatusEntry struct {
Region string `json:"region,omitempty"`
RegistryID string `json:"registryId,omitempty"`
Status string `json:"status"`
FailureCode string `json:"failureCode,omitempty"`
FailureReason string `json:"failureReason,omitempty"`
}
ImageReplicationStatusEntry is the replication status for a single destination.
type ImageReplicationStatusResult ¶
type ImageReplicationStatusResult struct {
ImageID ImageIdentifier `json:"imageId"`
RepositoryName string `json:"repositoryName"`
ReplicationStatuses []ImageReplicationStatusEntry `json:"replicationStatuses"`
}
ImageReplicationStatusResult stores image replication status.
type ImageScanFinding ¶
type ImageScanFinding struct {
Attributes map[string]string `json:"attributes,omitempty"`
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
Severity string `json:"severity,omitempty"`
URI string `json:"uri,omitempty"`
}
ImageScanFinding is an image scan finding.
type ImageScanFindingsResult ¶
type ImageScanFindingsResult struct {
CompletedAt time.Time `json:"completedAt"`
FindingSeverityCounts map[string]int32 `json:"findingSeverityCounts,omitempty"`
ImageID ImageIdentifier `json:"imageId"`
RepositoryName string `json:"repositoryName"`
RegistryID string `json:"registryId"`
Status string `json:"status"`
Description string `json:"description"`
Findings []ImageScanFinding `json:"findings,omitempty"`
// EnhancedFindings carries Inspector-style, package-level findings produced by
// ENHANCED registry scanning. It is empty for BASIC scans, which populate
// Findings instead — so the two scan types return genuinely different shapes.
EnhancedFindings []EnhancedImageScanFinding `json:"enhancedFindings,omitempty"`
}
ImageScanFindingsResult stores scan findings for an image.
type ImageScanStartResult ¶
type ImageScanStartResult struct {
ImageID ImageIdentifier `json:"imageId"`
RepositoryName string `json:"repositoryName"`
RegistryID string `json:"registryId"`
Status string `json:"status"`
Description string `json:"description"`
}
ImageScanStartResult is returned by StartImageScan.
type ImageSigningStatusRecord ¶
type ImageSigningStatusRecord struct {
FailureCode string `json:"failureCode,omitempty"`
FailureReason string `json:"failureReason,omitempty"`
SigningProfileArn string `json:"signingProfileArn,omitempty"`
Status string `json:"status"`
}
ImageSigningStatusRecord is a signing status entry.
type ImageSigningStatusResult ¶
type ImageSigningStatusResult struct {
ImageID ImageIdentifier `json:"imageId"`
RegistryID string `json:"registryId"`
RepositoryName string `json:"repositoryName"`
SigningStatuses []ImageSigningStatusRecord `json:"signingStatuses"`
}
ImageSigningStatusResult stores signing status for an image.
type ImageStorageClassResult ¶
type ImageStorageClassResult struct {
ImageID ImageIdentifier `json:"imageId"`
ImageStatus string `json:"imageStatus"`
RegistryID string `json:"registryId"`
RepositoryName string `json:"repositoryName"`
}
ImageStorageClassResult stores the image status after storage class updates.
type ImageTagMutabilityExclusionFilter ¶
type ImageTagMutabilityExclusionFilter struct {
Filter string `json:"filter,omitempty"`
FilterType string `json:"filterType,omitempty"`
}
ImageTagMutabilityExclusionFilter configures tag mutability exceptions.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend stores ECR repository state in memory.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID, region, endpoint string) *InMemoryBackend
NewInMemoryBackend creates a new InMemoryBackend with the given account ID and region.
func (*InMemoryBackend) AccountID ¶
func (b *InMemoryBackend) AccountID() string
AccountID returns the AWS account ID associated with this registry.
func (*InMemoryBackend) AddImageInternal ¶
func (b *InMemoryBackend) AddImageInternal(repositoryName string, img Image)
AddImageInternal seeds an image directly into the backend for testing. repositoryName is the repository to add the image to; img is the image to add.
func (*InMemoryBackend) AddLifecyclePolicyInternal ¶
func (b *InMemoryBackend) AddLifecyclePolicyInternal(repositoryName, policy string)
AddLifecyclePolicyInternal seeds a lifecycle policy directly into the backend for testing.
func (*InMemoryBackend) AddRepositoryInternal ¶
func (b *InMemoryBackend) AddRepositoryInternal(repo Repository)
AddRepositoryInternal seeds a repository directly into the backend for testing.
func (*InMemoryBackend) BatchCheckLayerAvailability ¶
func (b *InMemoryBackend) BatchCheckLayerAvailability( ctx context.Context, repositoryName string, layerDigests []string, ) ([]LayerAvailability, []LayerFailure, error)
BatchCheckLayerAvailability checks the availability of image layers in a repository.
func (*InMemoryBackend) BatchDeleteImage ¶
func (b *InMemoryBackend) BatchDeleteImage(ctx context.Context, repositoryName string, imageIDs []ImageIdentifier, ) ([]ImageIdentifier, []ImageFailure, error)
BatchDeleteImage deletes the specified images from a repository. When deleting by digest, all associated tags are removed and the image is deleted. When deleting by tag, only that tag binding is removed; the image remains accessible by digest (it becomes untagged if it had no other tags).
func (*InMemoryBackend) BatchGetImage ¶
func (b *InMemoryBackend) BatchGetImage(ctx context.Context, repositoryName string, imageIDs []ImageIdentifier, ) ([]Image, []ImageFailure, error)
BatchGetImage retrieves details for the specified images.
func (*InMemoryBackend) BatchGetRepositoryScanningConfiguration ¶
func (b *InMemoryBackend) BatchGetRepositoryScanningConfiguration( ctx context.Context, repositoryNames []string, ) ([]RepositoryScanningConfiguration, []RepositoryScanningConfigurationFailure, error)
BatchGetRepositoryScanningConfiguration returns scanning configuration for repositories.
func (*InMemoryBackend) CompleteLayerUpload ¶
func (b *InMemoryBackend) CompleteLayerUpload( ctx context.Context, repositoryName, uploadID string, layerDigests []string, ) (*CompleteLayerUploadResult, error)
CompleteLayerUpload finalises the upload of an image layer. If an upload session exists, it computes the SHA256 of accumulated bytes and verifies the digest. If no session exists (direct digest path), the provided digest is trusted as-is.
func (*InMemoryBackend) CreatePullThroughCacheRule ¶
func (b *InMemoryBackend) CreatePullThroughCacheRule( ctx context.Context, prefix, upstreamURL, credentialArn, upstreamRegistry, customRoleArn, upstreamRepositoryPrefix string, ) (*PullThroughCacheRule, error)
CreatePullThroughCacheRule creates a new pull-through cache rule.
func (*InMemoryBackend) CreateRepository ¶
func (b *InMemoryBackend) CreateRepository( ctx context.Context, name, imageTagMutability string, scanOnPush bool, encryptionType, kmsKey string, ) (*Repository, error)
CreateRepository creates a new ECR repository.
func (*InMemoryBackend) CreateRepositoryCreationTemplate ¶
func (b *InMemoryBackend) CreateRepositoryCreationTemplate( ctx context.Context, req *RepositoryCreationTemplate, ) (*RepositoryCreationTemplate, error)
CreateRepositoryCreationTemplate creates a new repository creation template.
func (*InMemoryBackend) DeleteLifecyclePolicy ¶
func (b *InMemoryBackend) DeleteLifecyclePolicy( ctx context.Context, repositoryName string, ) (*LifecyclePolicyResult, error)
DeleteLifecyclePolicy deletes the lifecycle policy for a repository.
func (*InMemoryBackend) DeletePullThroughCacheRule ¶
func (b *InMemoryBackend) DeletePullThroughCacheRule( ctx context.Context, prefix string, ) (*PullThroughCacheRule, error)
DeletePullThroughCacheRule deletes a pull-through cache rule by prefix.
func (*InMemoryBackend) DeleteRegistryPolicy ¶
func (b *InMemoryBackend) DeleteRegistryPolicy( ctx context.Context, ) (*RegistryPolicyResult, error)
DeleteRegistryPolicy deletes the registry-level IAM policy.
func (*InMemoryBackend) DeleteRepository ¶
func (b *InMemoryBackend) DeleteRepository( ctx context.Context, name string, ) (*Repository, error)
DeleteRepository removes a repository by name.
func (*InMemoryBackend) DeleteRepositoryCreationTemplate ¶
func (b *InMemoryBackend) DeleteRepositoryCreationTemplate( ctx context.Context, prefix string, ) (*RepositoryCreationTemplate, error)
DeleteRepositoryCreationTemplate deletes a repository creation template.
func (*InMemoryBackend) DeleteRepositoryPolicy ¶
func (b *InMemoryBackend) DeleteRepositoryPolicy( ctx context.Context, repositoryName string, ) (*RepositoryPolicyResult, error)
DeleteRepositoryPolicy deletes the repository-level policy.
func (*InMemoryBackend) DeleteSigningConfiguration ¶
func (b *InMemoryBackend) DeleteSigningConfiguration( ctx context.Context, ) (*SigningSettings, error)
DeleteSigningConfiguration removes the registry signing configuration.
func (*InMemoryBackend) DeregisterPullTimeUpdateExclusion ¶
func (b *InMemoryBackend) DeregisterPullTimeUpdateExclusion( ctx context.Context, principalArn string, ) (*PullTimeUpdateExclusion, error)
DeregisterPullTimeUpdateExclusion deletes a pull time update exclusion.
func (*InMemoryBackend) DescribeImageReplicationStatus ¶
func (b *InMemoryBackend) DescribeImageReplicationStatus( ctx context.Context, repositoryName string, imageID ImageIdentifier, ) (*ImageReplicationStatusResult, error)
DescribeImageReplicationStatus returns the current replication status for an image.
func (*InMemoryBackend) DescribeImageScanFindings ¶
func (b *InMemoryBackend) DescribeImageScanFindings( ctx context.Context, repositoryName string, imageID ImageIdentifier, maxResults int, nextToken string, ) (*ImageScanFindingsResult, string, error)
DescribeImageScanFindings returns scan findings for an image.
func (*InMemoryBackend) DescribeImageSigningStatus ¶
func (b *InMemoryBackend) DescribeImageSigningStatus( ctx context.Context, repositoryName string, imageID ImageIdentifier, ) (*ImageSigningStatusResult, error)
DescribeImageSigningStatus returns signing status for an image.
func (*InMemoryBackend) DescribeImages ¶
func (b *InMemoryBackend) DescribeImages( ctx context.Context, repositoryName string, imageIDs []ImageIdentifier, ) ([]Image, error)
DescribeImages returns image details for a repository.
func (*InMemoryBackend) DescribePullThroughCacheRules ¶
func (b *InMemoryBackend) DescribePullThroughCacheRules( ctx context.Context, prefixes []string, ) ([]PullThroughCacheRule, error)
DescribePullThroughCacheRules lists pull-through cache rules.
func (*InMemoryBackend) DescribeRegistry ¶
func (b *InMemoryBackend) DescribeRegistry( ctx context.Context, ) (*RegistryDescription, error)
DescribeRegistry returns registry-wide metadata.
func (*InMemoryBackend) DescribeRepositories ¶
func (b *InMemoryBackend) DescribeRepositories( ctx context.Context, names []string, ) ([]Repository, error)
DescribeRepositories returns all repositories, optionally filtered by name.
func (*InMemoryBackend) DescribeRepositoryCreationTemplates ¶
func (b *InMemoryBackend) DescribeRepositoryCreationTemplates( ctx context.Context, prefixes []string, ) ([]RepositoryCreationTemplate, error)
DescribeRepositoryCreationTemplates lists repository creation templates.
func (*InMemoryBackend) GetAccountSetting ¶
GetAccountSetting returns a registry account setting.
func (*InMemoryBackend) GetDownloadURLForLayer ¶
func (b *InMemoryBackend) GetDownloadURLForLayer( ctx context.Context, repositoryName, layerDigest string, ) (string, error)
GetDownloadURLForLayer resolves a local download URL for an uploaded layer.
func (*InMemoryBackend) GetLifecyclePolicy ¶
func (b *InMemoryBackend) GetLifecyclePolicy( ctx context.Context, repositoryName string, ) (*LifecyclePolicyResult, error)
GetLifecyclePolicy returns the lifecycle policy for a repository.
func (*InMemoryBackend) GetLifecyclePolicyPreview ¶
func (b *InMemoryBackend) GetLifecyclePolicyPreview( ctx context.Context, repositoryName string, ) (*LifecyclePolicyPreviewResult, error)
GetLifecyclePolicyPreview returns the current lifecycle policy preview.
func (*InMemoryBackend) GetRegistryPolicy ¶
func (b *InMemoryBackend) GetRegistryPolicy( ctx context.Context, ) (*RegistryPolicyResult, error)
GetRegistryPolicy returns the registry-level IAM policy.
func (*InMemoryBackend) GetRegistryScanningConfiguration ¶
func (b *InMemoryBackend) GetRegistryScanningConfiguration( ctx context.Context, ) (*RegistryScanningSettings, error)
GetRegistryScanningConfiguration returns the registry scanning configuration.
func (*InMemoryBackend) GetRepositoryPolicy ¶
func (b *InMemoryBackend) GetRepositoryPolicy( ctx context.Context, repositoryName string, ) (*RepositoryPolicyResult, error)
GetRepositoryPolicy returns the repository-level policy.
func (*InMemoryBackend) GetSigningConfiguration ¶
func (b *InMemoryBackend) GetSigningConfiguration( ctx context.Context, ) (*SigningSettings, error)
GetSigningConfiguration returns the current registry signing configuration.
func (*InMemoryBackend) InitiateLayerUpload ¶
func (b *InMemoryBackend) InitiateLayerUpload( ctx context.Context, repositoryName string, ) (*LayerUploadInitiation, error)
InitiateLayerUpload starts a layer upload session.
func (*InMemoryBackend) ListImageReferrers ¶
func (b *InMemoryBackend) ListImageReferrers( ctx context.Context, repositoryName string, subject ImageIdentifier, ) ([]ImageReferrer, error)
ListImageReferrers lists image referrers for a subject image.
func (*InMemoryBackend) ListImages ¶
func (b *InMemoryBackend) ListImages( ctx context.Context, repositoryName, tagStatusFilter string, ) ([]ImageIdentifier, error)
ListImages lists image identifiers for a repository. tagStatusFilter controls which images to return: "TAGGED", "UNTAGGED", or "ANY" (default).
func (*InMemoryBackend) ListPullTimeUpdateExclusions ¶
func (b *InMemoryBackend) ListPullTimeUpdateExclusions( ctx context.Context, ) ([]PullTimeUpdateExclusion, error)
ListPullTimeUpdateExclusions lists pull time update exclusions.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource( ctx context.Context, resourceArn string, ) (map[string]string, error)
ListTagsForResource returns all tags for an ECR resource identified by its ARN.
func (*InMemoryBackend) ProxyEndpoint ¶
func (b *InMemoryBackend) ProxyEndpoint() string
ProxyEndpoint returns the registry endpoint used in repository URIs and authorization tokens. It satisfies the Backend interface.
func (*InMemoryBackend) PutAccountSetting ¶
func (b *InMemoryBackend) PutAccountSetting( ctx context.Context, name, value string, ) (string, error)
PutAccountSetting updates a registry account setting.
func (*InMemoryBackend) PutImageScanningConfiguration ¶
func (b *InMemoryBackend) PutImageScanningConfiguration( ctx context.Context, repositoryName string, scanOnPush bool, ) (*RepositoryScanningConfiguration, error)
PutImageScanningConfiguration updates per-repository scan-on-push config.
func (*InMemoryBackend) PutImageTagMutability ¶
func (b *InMemoryBackend) PutImageTagMutability( ctx context.Context, repositoryName, imageTagMutability string, exclusionFilters []ImageTagMutabilityExclusionFilter, ) (*Repository, error)
PutImageTagMutability updates per-repository tag mutability.
func (*InMemoryBackend) PutLifecyclePolicy ¶
func (b *InMemoryBackend) PutLifecyclePolicy( ctx context.Context, repositoryName, policyText string, ) (*LifecyclePolicyResult, error)
PutLifecyclePolicy creates or replaces the lifecycle policy for a repository.
func (*InMemoryBackend) PutRegistryPolicy ¶
func (b *InMemoryBackend) PutRegistryPolicy( ctx context.Context, policyText string, ) (*RegistryPolicyResult, error)
PutRegistryPolicy creates or replaces the registry-level IAM policy.
func (*InMemoryBackend) PutRegistryScanningConfiguration ¶
func (b *InMemoryBackend) PutRegistryScanningConfiguration( ctx context.Context, settings *RegistryScanningSettings, ) (*RegistryScanningSettings, error)
PutRegistryScanningConfiguration updates the registry scanning configuration.
func (*InMemoryBackend) PutReplicationConfiguration ¶
func (b *InMemoryBackend) PutReplicationConfiguration( ctx context.Context, cfg *ReplicationConfig, ) (*ReplicationConfig, error)
PutReplicationConfiguration updates the registry replication configuration.
func (*InMemoryBackend) PutSigningConfiguration ¶
func (b *InMemoryBackend) PutSigningConfiguration( ctx context.Context, settings *SigningSettings, ) (*SigningSettings, error)
PutSigningConfiguration updates the registry signing configuration.
func (*InMemoryBackend) Region ¶
func (b *InMemoryBackend) Region() string
Region returns the AWS region this backend is configured for.
func (*InMemoryBackend) RegisterPullTimeUpdateExclusion ¶
func (b *InMemoryBackend) RegisterPullTimeUpdateExclusion( ctx context.Context, principalArn string, ) (*PullTimeUpdateExclusion, error)
RegisterPullTimeUpdateExclusion creates a pull time update exclusion.
func (*InMemoryBackend) Reset ¶
func (b *InMemoryBackend) Reset()
Reset clears all state in the backend.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.
func (*InMemoryBackend) RunLifecycleExpiry ¶
func (b *InMemoryBackend) RunLifecycleExpiry(ctx context.Context) int
RunLifecycleExpiry evaluates the lifecycle policy of every repository that has one and deletes any expired images. It is invoked by the ECR janitor on a timer so that count/age-based expirations happen in the background exactly as they do in AWS, independent of any API call. It returns the total number of images deleted across all repositories.
func (*InMemoryBackend) SetEndpoint ¶
func (b *InMemoryBackend) SetEndpoint(endpoint string)
SetEndpoint updates the registry endpoint used in repository URIs.
func (*InMemoryBackend) SetRegistryPolicyInternal ¶
func (b *InMemoryBackend) SetRegistryPolicyInternal(policy string)
SetRegistryPolicyInternal sets the registry policy directly for testing.
func (*InMemoryBackend) SetRepositoryPolicy ¶
func (b *InMemoryBackend) SetRepositoryPolicy( ctx context.Context, repositoryName, policyText string, ) (*RepositoryPolicyResult, error)
SetRepositoryPolicy creates or replaces the repository-level IAM policy.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state to JSON. It implements persistence.Persistable.
func (*InMemoryBackend) StartImageScan ¶
func (b *InMemoryBackend) StartImageScan(ctx context.Context, repositoryName string, imageID ImageIdentifier, ) (*ImageScanStartResult, error)
StartImageScan starts an image scan and returns the scan status.
func (*InMemoryBackend) StartLifecyclePolicyPreview ¶
func (b *InMemoryBackend) StartLifecyclePolicyPreview( ctx context.Context, repositoryName, policyText string, ) (*LifecyclePolicyPreviewResult, error)
StartLifecyclePolicyPreview starts or refreshes a lifecycle policy preview.
func (*InMemoryBackend) TagResource ¶
func (b *InMemoryBackend) TagResource( ctx context.Context, resourceArn string, tags map[string]string, ) error
TagResource associates tags with an ECR resource identified by its ARN.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource( ctx context.Context, resourceArn string, tagKeys []string, ) error
UntagResource removes tags from an ECR resource identified by its ARN.
func (*InMemoryBackend) UpdateImageStorageClass ¶
func (b *InMemoryBackend) UpdateImageStorageClass( ctx context.Context, repositoryName string, imageID ImageIdentifier, target string, ) (*ImageStorageClassResult, error)
UpdateImageStorageClass updates the storage class for an image.
func (*InMemoryBackend) UpdatePullThroughCacheRule ¶
func (b *InMemoryBackend) UpdatePullThroughCacheRule( ctx context.Context, prefix, credentialArn, customRoleArn string, ) (*PullThroughCacheRule, error)
UpdatePullThroughCacheRule updates a pull-through cache rule by prefix.
func (*InMemoryBackend) UpdateRepositoryCreationTemplate ¶
func (b *InMemoryBackend) UpdateRepositoryCreationTemplate( ctx context.Context, req *RepositoryCreationTemplate, ) (*RepositoryCreationTemplate, error)
UpdateRepositoryCreationTemplate updates a repository creation template.
func (*InMemoryBackend) UploadLayerPart ¶
func (b *InMemoryBackend) UploadLayerPart(ctx context.Context, repositoryName, uploadID string, firstByte, lastByte int64, blob []byte, ) (*LayerUploadPartResult, error)
UploadLayerPart records uploaded bytes for an existing upload session. AWS requires each part's first byte to be consecutive to the last byte received by the previous part (i.e. equal to the number of bytes already buffered for this session); a gap or overlap is rejected with InvalidLayerPartException.
func (*InMemoryBackend) ValidatePullThroughCacheRule ¶
func (b *InMemoryBackend) ValidatePullThroughCacheRule( ctx context.Context, prefix string, ) (*ValidatePullThroughCacheRuleResult, error)
ValidatePullThroughCacheRule validates a pull-through cache rule by prefix.
type Janitor ¶
type Janitor struct {
Backend *InMemoryBackend
Interval time.Duration
TaskTimeout time.Duration
}
Janitor is the ECR background worker. It periodically evaluates every repository's lifecycle policy and deletes images that the policy selects for expiration, mirroring the AWS ECR lifecycle evaluation job — so count- and age-based expirations happen without any API call.
func NewJanitor ¶
func NewJanitor(backend *InMemoryBackend, interval time.Duration) *Janitor
NewJanitor creates a Janitor for the given backend. A zero interval falls back to the default of one minute.
type LayerAvailability ¶
type LayerAvailability struct {
LayerDigest string `json:"layerDigest"`
LayerAvailability string `json:"layerAvailability"`
MediaType string `json:"mediaType,omitempty"`
LayerSize int64 `json:"layerSize,omitempty"`
}
LayerAvailability represents the availability of an image layer.
type LayerFailure ¶
type LayerFailure struct {
LayerDigest string `json:"layerDigest,omitempty"`
FailureCode string `json:"failureCode"`
FailureReason string `json:"failureReason"`
}
LayerFailure represents a layer that could not be checked.
type LayerUploadInitiation ¶
type LayerUploadInitiation struct {
UploadID string `json:"uploadId"`
PartSize int64 `json:"partSize"`
}
LayerUploadInitiation is returned when starting an ECR layer upload.
type LayerUploadPartResult ¶
type LayerUploadPartResult struct {
RepositoryName string `json:"repositoryName"`
RegistryID string `json:"registryId"`
UploadID string `json:"uploadId"`
LastByteReceived int64 `json:"lastByteReceived"`
}
LayerUploadPartResult records a received layer upload part.
type LifecyclePolicyPreviewResult ¶
type LifecyclePolicyPreviewResult struct {
LifecyclePolicyText string `json:"lifecyclePolicyText"`
RepositoryName string `json:"repositoryName"`
RegistryID string `json:"registryId"`
Status string `json:"status"`
PreviewResults []ImageIdentifier `json:"previewResults"`
}
LifecyclePolicyPreviewResult is an in-memory lifecycle preview snapshot.
type LifecyclePolicyResult ¶
type LifecyclePolicyResult struct {
LifecyclePolicyText string `json:"lifecyclePolicyText"`
LastEvaluatedAt time.Time `json:"lastEvaluatedAt"`
RepositoryName string `json:"repositoryName"`
RegistryID string `json:"registryId"`
}
LifecyclePolicyResult is the result of DeleteLifecyclePolicy.
type PackageVulnerabilityDetails ¶
type PackageVulnerabilityDetails struct {
VulnerabilityID string `json:"vulnerabilityId,omitempty"`
Source string `json:"source,omitempty"`
SourceURL string `json:"sourceUrl,omitempty"`
VendorSeverity string `json:"vendorSeverity,omitempty"`
Cvss []CVSSScore `json:"cvss,omitempty"`
ReferenceUrls []string `json:"referenceUrls,omitempty"`
RelatedVulnerabilities []string `json:"relatedVulnerabilities,omitempty"`
VulnerablePackages []VulnerablePackage `json:"vulnerablePackages,omitempty"`
VendorCreatedAt float64 `json:"vendorCreatedAt"`
}
PackageVulnerabilityDetails describes the vulnerability behind an enhanced finding, including CVSS scoring and the affected packages.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Amazon ECR.
func (*Provider) Init ¶
func (p *Provider) Init(appCtx *service.AppContext) (service.Registerable, error)
Init initializes the ECR service backend and handler.
type PullThroughCacheRule ¶
type PullThroughCacheRule struct {
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
EcrRepositoryPrefix string `json:"ecrRepositoryPrefix"`
UpstreamRegistryURL string `json:"upstreamRegistryUrl"`
CredentialArn string `json:"credentialArn,omitempty"`
CustomRoleArn string `json:"customRoleArn,omitempty"`
UpstreamRegistry string `json:"upstreamRegistry,omitempty"`
UpstreamRepositoryPrefix string `json:"upstreamRepositoryPrefix,omitempty"`
RegistryID string `json:"registryId"`
}
PullThroughCacheRule represents a pull-through cache rule.
type PullTimeUpdateExclusion ¶
type PullTimeUpdateExclusion struct {
CreatedAt time.Time `json:"createdAt"`
PrincipalArn string `json:"principalArn"`
}
PullTimeUpdateExclusion is an account-level pull time exclusion.
type RegistryDescription ¶
type RegistryDescription struct {
ReplicationConfiguration *ReplicationConfig `json:"replicationConfiguration,omitempty"`
RegistryID string `json:"registryId"`
}
RegistryDescription stores registry-wide ECR configuration.
type RegistryPolicyResult ¶
type RegistryPolicyResult struct {
PolicyText string `json:"policyText"`
RegistryID string `json:"registryId"`
Status string `json:"status"`
}
RegistryPolicyResult is the result of DeleteRegistryPolicy.
type RegistryScanningRule ¶
type RegistryScanningRule struct {
ScanFrequency string `json:"scanFrequency,omitempty"`
RepositoryFilters []RepositoryFilter `json:"repositoryFilters,omitempty"`
}
RegistryScanningRule is a registry scan rule.
type RegistryScanningSettings ¶
type RegistryScanningSettings struct {
ScanType string `json:"scanType,omitempty"`
Rules []RegistryScanningRule `json:"rules,omitempty"`
}
RegistryScanningSettings stores registry-wide scan configuration.
type Remediation ¶
type Remediation struct {
Recommendation RemediationRecommendation `json:"recommendation"`
}
Remediation carries the recommended fix for an enhanced finding.
type RemediationRecommendation ¶
type RemediationRecommendation struct {
Text string `json:"text,omitempty"`
URL string `json:"url,omitempty"`
}
RemediationRecommendation is the human-readable remediation guidance.
type ReplicationConfig ¶
type ReplicationConfig struct {
Rules []ReplicationRule `json:"rules,omitempty"`
}
ReplicationConfig stores ECR replication destinations.
type ReplicationDestination ¶
type ReplicationDestination struct {
Region string `json:"region,omitempty"`
RegistryID string `json:"registryId,omitempty"`
}
ReplicationDestination identifies a replication target.
type ReplicationRule ¶
type ReplicationRule struct {
Destinations []ReplicationDestination `json:"destinations,omitempty"`
RepositoryFilters []RepositoryFilter `json:"repositoryFilters,omitempty"`
}
ReplicationRule is an ECR replication rule.
type Repository ¶
type Repository struct {
CreatedAt time.Time `json:"createdAt"`
EncryptionType string `json:"encryptionType"`
KMSKey string `json:"kmsKey,omitempty"`
RegistryID string `json:"registryId"`
RepositoryARN string `json:"repositoryArn"`
RepositoryName string `json:"repositoryName"`
RepositoryURI string `json:"repositoryUri"`
ImageTagMutability string `json:"imageTagMutability"`
ImageTagMutabilityExclusionFilters []ImageTagMutabilityExclusionFilter `json:"imageTagMutabilityExclusionFilters,omitempty"` //nolint:lll // AWS-compatible JSON field name is long.
ScanOnPush bool `json:"scanOnPush"`
}
Repository represents an ECR repository.
type RepositoryCreationTemplate ¶
type RepositoryCreationTemplate struct {
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
ResourceTags map[string]string `json:"resourceTags,omitempty"`
ImageTagMutability string `json:"imageTagMutability,omitempty"`
EncryptionType string `json:"encryptionType,omitempty"`
KMSKey string `json:"kmsKey,omitempty"`
Description string `json:"description,omitempty"`
RepositoryPolicy string `json:"repositoryPolicy,omitempty"`
LifecyclePolicy string `json:"lifecyclePolicy,omitempty"`
CustomRoleArn string `json:"customRoleArn,omitempty"`
Prefix string `json:"prefix"`
ImageTagMutabilityExclusionFilters []ImageTagMutabilityExclusionFilter `json:"imageTagMutabilityExclusionFilters,omitempty"` //nolint:lll // AWS-compatible JSON field name is long.
AppliedFor []string `json:"appliedFor,omitempty"`
}
RepositoryCreationTemplate represents a repository creation template.
type RepositoryFilter ¶
type RepositoryFilter struct {
Filter string `json:"filter,omitempty"`
FilterType string `json:"filterType,omitempty"`
}
RepositoryFilter is used by scanning, signing, and replication configs.
type RepositoryPolicyResult ¶
type RepositoryPolicyResult struct {
PolicyText string `json:"policyText"`
RegistryID string `json:"registryId"`
RepositoryName string `json:"repositoryName"`
}
RepositoryPolicyResult stores a repository policy.
type RepositoryScanningConfiguration ¶
type RepositoryScanningConfiguration struct {
RepositoryARN string `json:"repositoryArn,omitempty"`
RepositoryName string `json:"repositoryName"`
ScanFrequency string `json:"scanFrequency"`
ScanOnPush bool `json:"scanOnPush"`
}
RepositoryScanningConfiguration represents scanning configuration for a repository.
type RepositoryScanningConfigurationFailure ¶
type RepositoryScanningConfigurationFailure struct {
RepositoryName string `json:"repositoryName"`
FailureCode string `json:"failureCode"`
FailureReason string `json:"failureReason"`
}
RepositoryScanningConfigurationFailure represents a failure in getting scanning config.
type SigningRule ¶
type SigningRule struct {
SigningProfileArn string `json:"signingProfileArn,omitempty"`
RepositoryFilters []RepositoryFilter `json:"repositoryFilters,omitempty"`
}
SigningRule is a registry signing rule.
type SigningSettings ¶
type SigningSettings struct {
Rules []SigningRule `json:"rules,omitempty"`
}
SigningSettings stores registry signing config.
type Snapshottable ¶
type Snapshottable interface {
Snapshot(ctx context.Context) []byte
Restore(ctx context.Context, data []byte) error
}
Snapshottable is an optional interface that a Backend may implement to support state serialisation and restoration (e.g. for --persist mode). Backends that do not implement it are silently skipped during snapshot/restore.
type ValidatePullThroughCacheRuleResult ¶
type ValidatePullThroughCacheRuleResult struct {
CredentialArn string `json:"credentialArn,omitempty"`
CustomRoleArn string `json:"customRoleArn,omitempty"`
EcrRepositoryPrefix string `json:"ecrRepositoryPrefix"`
Failure string `json:"failure,omitempty"`
RegistryID string `json:"registryId"`
UpstreamRegistryURL string `json:"upstreamRegistryUrl,omitempty"`
UpstreamRepositoryPrefix string `json:"upstreamRepositoryPrefix,omitempty"`
IsValid bool `json:"isValid"`
}
ValidatePullThroughCacheRuleResult is returned by ValidatePullThroughCacheRule.
type VulnerablePackage ¶
type VulnerablePackage struct {
Arch string `json:"arch,omitempty"`
FilePath string `json:"filePath,omitempty"`
Name string `json:"name,omitempty"`
PackageManager string `json:"packageManager,omitempty"`
Release string `json:"release,omitempty"`
SourceLayerHash string `json:"sourceLayerHash,omitempty"`
Version string `json:"version,omitempty"`
FixedInVersion string `json:"fixedInVersion,omitempty"`
Remediation string `json:"remediation,omitempty"`
Epoch int `json:"epoch,omitempty"`
}
VulnerablePackage describes an individual affected package in an enhanced finding.
Source Files
¶
- account_settings.go
- docker_registry.go
- errors.go
- handler.go
- handler_account_settings.go
- handler_auth_token.go
- handler_image_scanning.go
- handler_images.go
- handler_layers.go
- handler_lifecycle_policy.go
- handler_pull_through_cache.go
- handler_registry_policy.go
- handler_replication.go
- handler_repositories.go
- handler_repository_creation_templates.go
- handler_repository_policy.go
- handler_signing.go
- handler_tags.go
- image_scanning.go
- images.go
- interfaces.go
- janitor.go
- layers.go
- lifecycle.go
- lifecycle_policy.go
- models.go
- persistence.go
- provider.go
- pull_through_cache.go
- registry_policy.go
- replication.go
- repositories.go
- repository_creation_templates.go
- repository_policy.go
- scan.go
- signing.go
- store.go
- store_setup.go
- tags.go