# This file is automatically generated by botocraft. Do not edit directly.
# mypy: disable-error-code="index, override, assignment, union-attr, misc"
from botocraft.mixins.ecr import repo_get_add_tags
from .abstract import (
Boto3Model,
ReadonlyBoto3Model,
PrimaryBoto3Model,
ReadonlyPrimaryBoto3Model,
Boto3ModelManager,
ReadonlyBoto3ModelManager,
)
from botocraft.services.inspector2 import PackageVulnerabilityDetails
from .abstract import PrimaryBoto3ModelQuerySet
from datetime import datetime
from botocraft.mixins.ecr import repo_list_images_ecr_images_only
from botocraft.mixins.ecr import image_list_images_ecr_images_only
import builtins
from botocraft.mixins.ecr import repo_list_add_tags
from functools import cached_property
from pydantic import Field
from botocraft.mixins.ecr import ECRImageMixin
from botocraft.mixins.ecr import ECRImageManagerMixin
from botocraft.mixins.ecr import RepositoryMixin
from collections import OrderedDict
from typing import ClassVar, Literal, Any, cast
from botocraft.services.inspector2 import Remediation
from botocraft.mixins.tags import TagsDictMixin
from botocraft.services.common import Tag
from botocraft.services.inspector2 import CvssScoreDetails
from botocraft.services.inspector2 import ResourceDetails
# ===============
# Managers
# ===============
[docs]class RepositoryManager(Boto3ModelManager):
service_name: str = "ecr"
[docs] def create(self, model: "Repository") -> "Repository":
"""
Create an ECR repository.
Args:
model: The :py:class:`Repository` to create.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
repositoryName=data.get("repositoryName"),
registryId=data.get("registryId"),
tags=data.get("Tags"),
imageTagMutability=data.get("imageTagMutability"),
imageTagMutabilityExclusionFilters=data.get(
"imageTagMutabilityExclusionFilters"
),
imageScanningConfiguration=data.get("imageScanningConfiguration"),
encryptionConfiguration=data.get("encryptionConfiguration"),
)
_response = self.client.create_repository(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateRepositoryResponse(**_response)
self.sessionize(response.repository)
return cast("Repository", response.repository)
[docs] def delete(
self,
repositoryName: str,
*,
registryId: "str | None" = None,
force: "bool | None" = None,
) -> "Repository":
"""
Delete an ECR repository.
Args:
repositoryName: The name of the repository to delete.
Keyword Args:
registryId: The Amazon Web Services account ID associated with the registry that contains the repository to delete.
If you do not specify a registry, the default registry is assumed.
force: If true, deleting the repository force deletes the contents of the repository. If false, the repository must
be empty before attempting to delete it.
"""
args: dict[str, Any] = dict(
repositoryName=self.serialize(repositoryName),
registryId=self.serialize(registryId),
force=self.serialize(force),
)
_response = self.client.delete_repository(
**{k: v for k, v in args.items() if v is not None}
)
response = DeleteRepositoryResponse(**_response)
return cast("Repository", response.repository)
[docs] @repo_get_add_tags
def get(
self,
repositoryName: str,
*,
registryId: "str | None" = None,
include: "builtins.list[Literal['TAGS']] | None" = None,
) -> "Repository | None":
"""
Describes image repositories in a registry.
Args:
repositoryName: The name of the ECR repository to describe.
Keyword Args:
registryId: The Amazon Web Services account ID associated with the registry that contains the repositories to be
described. If you do not specify a registry, the default registry is assumed.
include: Extra things to include in the response. Tags are expensive to retrieve because they need a second, slow
API call, so you have to request them specifically. This is used only by the ````@repo_get_add_tags```` decorator,
which is why you don't see it in the function body.
"""
args: dict[str, Any] = dict(
registryId=self.serialize(registryId),
repositoryNames=self.serialize([repositoryName]),
)
_response = self.client.describe_repositories(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeRepositoriesResponse(**_response)
if response and response.repositories:
self.sessionize(response.repositories[0])
return response.repositories[0]
return None
[docs] @repo_list_add_tags
def list(
self,
*,
registryId: "str | None" = None,
repositoryNames: "builtins.list[str] | None" = None,
include: "builtins.list[Literal['TAGS']] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Describes image repositories in a registry.
Keyword Args:
registryId: The Amazon Web Services account ID associated with the registry that contains the repositories to be
described. If you do not specify a registry, the default registry is assumed.
repositoryNames: A list of repositories to describe. If this parameter is omitted, then all repositories in a
registry are described.
include: Extra things to include in the response. Tags are expensive to retrieve because they need a second, slow
API call, so you have to request them specifically.
"""
paginator = self.client.get_paginator("describe_repositories")
args: dict[str, Any] = dict(
registryId=self.serialize(registryId),
repositoryNames=self.serialize(repositoryNames),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = DescribeRepositoriesResponse(**_response)
if response.repositories:
results.extend(response.repositories)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] @repo_list_images_ecr_images_only
def list_images(
self,
repositoryName: str,
*,
registryId: "str | None" = None,
filter: "ListImagesFilter | None" = None,
) -> "builtins.list[ImageIdentifier]":
"""
Lists all the image IDs for the specified repository.
Args:
repositoryName: The repository with image IDs to be listed.
Keyword Args:
registryId: The Amazon Web Services account ID associated with the registry that contains the repository in which to
list images. If you do not specify a registry, the default registry is assumed.
filter: The filter key and value with which to filter your ``ListImages`` results.
"""
paginator = self.client.get_paginator("list_images")
args: dict[str, Any] = dict(
repositoryName=self.serialize(repositoryName),
registryId=self.serialize(registryId),
filter=self.serialize(filter),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results: "builtins.list[ImageIdentifier]" = []
for _response in response_iterator:
response = ListImagesResponse(**_response)
if response.imageIds is not None:
results.extend(response.imageIds)
else:
break
self.sessionize(results)
return cast("builtins.list[ImageIdentifier]", results)
[docs] def get_images(
self,
repositoryName: str,
imageIds: "builtins.list[ImageIdentifier]",
*,
acceptedMediaTypes: "builtins.list[str]" = [
"application/vnd.docker.distribution.manifest.v2+json"
],
) -> "list[ECRImage] | None":
"""
Use this method when you want to get just a few images from the repository. If
you want to get all images, use the ````list_images```` method.
Args:
repositoryName: The repository that contains the images to describe.
imageIds: A list of image ID references that correspond to images to describe. The format of the ``imageIds``
reference is ``imageTag=tag`` or ``imageDigest=digest``.
Keyword Args:
acceptedMediaTypes: The accepted media types for the request.
"""
args: dict[str, Any] = dict(
repositoryName=self.serialize(repositoryName),
imageIds=self.serialize(imageIds),
acceptedMediaTypes=self.serialize(acceptedMediaTypes),
)
_response = self.client.batch_get_image(
**{k: v for k, v in args.items() if v is not None}
)
response = BatchGetImageResponse(**_response)
results: "list[ECRImage] | None" = None
if response is not None:
results = response.images
self.sessionize(results)
return cast("list[ECRImage] | None", results)
[docs] def get_image(
self,
repositoryName: str,
imageId: "ImageIdentifier",
*,
acceptedMediaTypes: "builtins.list[str]" = [
"application/vnd.docker.distribution.manifest.v2+json"
],
) -> "ECRImage":
"""
Gets detailed information for an image. Images are specified with either an
``imageTag`` or ``imageDigest``.
Args:
repositoryName: The repository that contains the images to describe.
imageId: The image ID or tag to describe. The format of the imageId reference is ````imageTag=tag```` or
````imageDigest=digest````
Keyword Args:
acceptedMediaTypes: The accepted media types for the request.
"""
args: dict[str, Any] = dict(
repositoryName=self.serialize(repositoryName),
imageIds=self.serialize([imageId]),
acceptedMediaTypes=self.serialize(acceptedMediaTypes),
)
_response = self.client.batch_get_image(
**{k: v for k, v in args.items() if v is not None}
)
response = BatchGetImageResponse(**_response)
results: "ECRImage" = None
if response is not None:
results = response.images[0]
self.sessionize(results)
return cast("ECRImage", results)
[docs]class ECRImageManager(ECRImageManagerMixin, Boto3ModelManager):
service_name: str = "ecr"
[docs] def get(
self,
repositoryName: str,
imageId: "ImageIdentifier",
*,
acceptedMediaTypes: "builtins.list[str]" = [
"application/vnd.docker.distribution.manifest.v2+json"
],
) -> "ECRImage | None":
"""
Gets detailed information for an image. Images are specified with either an
``imageTag`` or ``imageDigest``.
Args:
repositoryName: The repository that contains the images to describe.
imageId: The image ID or tag to describe. The format of the imageId reference is ````imageTag=tag```` or
````imageDigest=digest````
Keyword Args:
acceptedMediaTypes: The accepted media types for the request.
"""
args: dict[str, Any] = dict(
repositoryName=self.serialize(repositoryName),
imageIds=self.serialize([imageId]),
acceptedMediaTypes=self.serialize(acceptedMediaTypes),
)
_response = self.client.batch_get_image(
**{k: v for k, v in args.items() if v is not None}
)
response = BatchGetImageResponse(**_response)
if response and response.images:
self.sessionize(response.images[0])
return response.images[0]
return None
[docs] def get_many(
self,
repositoryName: str,
imageIds: "builtins.list[ImageIdentifier]",
*,
acceptedMediaTypes: "builtins.list[str]" = [
"application/vnd.docker.distribution.manifest.v2+json"
],
) -> "BatchGetImageResponse":
"""
Gets detailed information for an image. Images are specified with either an
``imageTag`` or ``imageDigest``.
Args:
repositoryName: The repository that contains the images to describe.
imageIds: A list of image ID references that correspond to images to describe. The format of the ``imageIds``
reference is ``imageTag=tag`` or ``imageDigest=digest``.
Keyword Args:
acceptedMediaTypes: The accepted media types for the request.
"""
args: dict[str, Any] = dict(
repositoryName=self.serialize(repositoryName),
imageIds=self.serialize(imageIds),
acceptedMediaTypes=self.serialize(acceptedMediaTypes),
)
_response = self.client.batch_get_image(
**{k: v for k, v in args.items() if v is not None}
)
response = BatchGetImageResponse(**_response)
self.sessionize(response)
return response
[docs] @image_list_images_ecr_images_only
def list(
self, repositoryName: str, *, filter: "ListImagesFilter | None" = None
) -> PrimaryBoto3ModelQuerySet:
"""
Lists all the image IDs for the specified repository.
Args:
repositoryName: The repository with image IDs to be listed.
Keyword Args:
filter: The filter key and value with which to filter your ``ListImages`` results.
"""
paginator = self.client.get_paginator("list_images")
args: dict[str, Any] = dict(
repositoryName=self.serialize(repositoryName), filter=self.serialize(filter)
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListImagesResponse(**_response)
if response.imageIds:
results.extend(response.imageIds)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def delete(
self, repositoryName: str, imageId: "ImageIdentifier"
) -> "BatchDeleteImageResponse":
"""
Deletes a list of specified images within a repository. Images are specified
with either an ``imageTag`` or ``imageDigest``.
Args:
repositoryName: The repository that contains the image to delete.
imageId: The image ID or tag to delete. The format of the imageId reference is ````imageTag=tag```` or
````imageDigest=digest````
"""
args: dict[str, Any] = dict(
repositoryName=self.serialize(repositoryName),
imageIds=self.serialize([imageId]),
)
_response = self.client.batch_delete_image(
**{k: v for k, v in args.items() if v is not None}
)
response = BatchDeleteImageResponse(**_response)
return response
[docs] def replication_status(
self, repositoryName: str, imageId: "ImageIdentifier"
) -> "DescribeImageReplicationStatusResponse":
"""
Returns the replication status for a specified image.
Args:
repositoryName: The name of the repository that the image is in.
imageId: An object with identifying information for an image in an Amazon ECR repository.
"""
args: dict[str, Any] = dict(
repositoryName=self.serialize(repositoryName),
imageId=self.serialize(imageId),
)
_response = self.client.describe_image_replication_status(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeImageReplicationStatusResponse(**_response)
results: "DescribeImageReplicationStatusResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("DescribeImageReplicationStatusResponse", results)
[docs] def scan_findings(
self,
repositoryName: str,
imageId: "ImageIdentifier",
*,
nextToken: "str | None" = None,
maxResults: "int | None" = None,
) -> "list[DescribeImageScanFindingsResponse]":
"""
Returns the scan findings for the specified image.
Args:
repositoryName: The repository for the image for which to describe the scan findings.
imageId: An object with identifying information for an image in an Amazon ECR repository.
Keyword Args:
nextToken: The ``nextToken`` value returned from a previous paginated ``DescribeImageScanFindings`` request where
``maxResults`` was used and the results exceeded the value of that parameter. Pagination continues from the end of
the previous results that returned the ``nextToken`` value. This value is null when there are no more results to
return.
maxResults: The maximum number of image scan results returned by ``DescribeImageScanFindings`` in paginated output.
When this parameter is used, ``DescribeImageScanFindings`` only returns ``maxResults`` results in a single page
along with a ``nextToken`` response element. The remaining results of the initial request can be seen by sending
another ``DescribeImageScanFindings`` request with the returned ``nextToken`` value. This value can be between 1 and
1000. If this parameter is not used, then ``DescribeImageScanFindings`` returns up to 100 results and a
``nextToken`` value, if applicable.
"""
args: dict[str, Any] = dict(
repositoryName=self.serialize(repositoryName),
imageId=self.serialize(imageId),
nextToken=self.serialize(nextToken),
maxResults=self.serialize(maxResults),
)
_response = self.client.describe_image_scan_findings(
**{k: v for k, v in args.items() if v is not None}
)
response = DescribeImageScanFindingsResponse(**_response)
results: "list[DescribeImageScanFindingsResponse]" = None
if response is not None:
results = response
self.sessionize(results)
return cast("list[DescribeImageScanFindingsResponse]", results)
# ==============
# Service Models
# ==============
[docs]class ImageScanningConfiguration(Boto3Model):
"""
The image scanning configuration for a repository.
"""
scanOnPush: "bool | None" = None
"""
The setting that determines whether images are scanned after being pushed to a
repository.
If set to ``true``, images
will be scanned after being pushed. If this parameter is not specified, it will default to ``false`` and images will not
be scanned unless a scan is manually started with the
`API_StartImageScan <https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_StartImageScan.html>`_ API.
"""
[docs]class ImageTagMutabilityExclusionFilter(Boto3Model):
"""
A filter that specifies which image tags should be excluded from the repository's
image tag mutability setting.
"""
filterType: Literal["WILDCARD"]
"""
The type of filter to apply for excluding image tags from mutability settings.
"""
filter: str
"""
The filter value used to match image tags for exclusion from mutability settings.
"""
[docs]class EncryptionConfiguration(Boto3Model):
"""
The encryption configuration for the repository. This determines how the contents of
your repository are encrypted at rest.
By default, when no encryption configuration is set or the ``AES256`` encryption type is used, Amazon ECR uses server-
side encryption with Amazon S3-managed encryption keys which encrypts your data at rest using an AES256 encryption
algorithm. This does not require any action on your part.
For more control over the encryption of the contents of your repository, you can use server-side encryption with Key
Management Service key stored in Key Management Service (KMS) to encrypt your images. For more information, see `Amazon
ECR encryption at rest <https://docs.aws.amazon.com/AmazonECR/latest/userguide/encryption-at-rest.html>`_ in the *Amazon
Elastic Container Registry User Guide*.
"""
encryptionType: Literal["AES256", "KMS", "KMS_DSSE"]
"""
The encryption type to use.
"""
kmsKey: "str | None" = None
"""
If you use the ``KMS`` encryption type, specify the KMS key to use for encryption.
The alias, key ID, or full ARN of the KMS key can be specified. The key must exist
in the same Region as the repository. If no key is specified, the default Amazon Web
Services managed KMS key for Amazon ECR will be used.
"""
[docs]class Repository(TagsDictMixin, RepositoryMixin, PrimaryBoto3Model):
"""
An object representing a repository.
"""
tag_class: ClassVar[type[Boto3Model]] = Tag
manager_class: ClassVar[type[Boto3ModelManager]] = RepositoryManager
repositoryName: str
"""
The name of the repository.
"""
imageTagMutability: Literal[
"MUTABLE", "IMMUTABLE", "IMMUTABLE_WITH_EXCLUSION", "MUTABLE_WITH_EXCLUSION"
]
"""
The tag mutability setting for the repository.
"""
imageScanningConfiguration: ImageScanningConfiguration
"""
The image scanning configuration for a repository.
"""
repositoryArn: str = Field(default=None, frozen=True)
"""
The Amazon Resource Name (ARN) that identifies the repository.
The ARN contains the ``arn:aws:ecr`` namespace, followed
by the region of the repository, Amazon Web Services account ID of the repository owner, repository namespace, and
repository name. For example, ``arn:aws:ecr:region:012345678910:repository-namespace/repository-name``.
"""
registryId: "str | None" = None
"""
The Amazon Web Services account ID associated with the registry that contains the
repository.
"""
repositoryUri: str = Field(default=None, frozen=True)
"""
The URI for the repository.
You can use this URI for container image ``push`` and ``pull`` operations.
"""
createdAt: datetime = Field(default=None, frozen=True)
"""
The date and time, in JavaScript date format, when the repository was created.
"""
imageTagMutabilityExclusionFilters: "builtins.list[ImageTagMutabilityExclusionFilter] | None" = Field(
default_factory=list
)
"""
A list of filters that specify which image tags are excluded from the repository's
image tag mutability setting.
"""
encryptionConfiguration: "EncryptionConfiguration | None" = None
"""
The encryption configuration for the repository.
This determines how the contents of your repository are encrypted at rest.
"""
Tags: "builtins.list[Tag] | None" = Field(default_factory=list)
"""
The AWS tags associated with the repository.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`repositoryName` attribute.
Returns:
The primary key of the model instance.
"""
return self.repositoryName
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`repositoryArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.repositoryArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the
:py:attr:`repositoryName` attribute.
Returns:
The name of the model instance.
"""
return self.repositoryName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`repositoryName` attribute.
"""
return hash(self.repositoryName)
[docs]class ImageIdentifier(Boto3Model):
"""
An object with identifying information for an image in an Amazon ECR repository.
"""
imageDigest: "str | None" = None
"""
The ``sha256`` digest of the image manifest.
"""
imageTag: "str | None" = None
"""
The tag used for the image.
"""
[docs]class ECRImage(ECRImageMixin, ReadonlyPrimaryBoto3Model):
"""
An object representing an Amazon ECR image.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = ECRImageManager
registryId: "str | None" = None
"""
The Amazon Web Services account ID associated with the registry containing the
image.
"""
repositoryName: "str | None" = None
"""
The name of the repository associated with the image.
"""
imageId: ImageIdentifier = Field(default=None, frozen=True)
"""
An object containing the image tag and image digest associated with an image.
"""
imageManifest: str = Field(default=None, frozen=True)
"""
The image manifest associated with the image.
"""
imageManifestMediaType: str = Field(default=None, frozen=True)
"""
The manifest media type of the image.
"""
@property
def pk(self) -> OrderedDict[str, Any]:
return OrderedDict(
{
"repositoryName": self.repositoryName,
"imageId": self.imageId,
}
)
@cached_property
def repository(self) -> "Repository | None":
"""
Return the :py:class:`Repository` object that this image belongs to.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"repositoryName": self.repositoryName,
"include": ["TAGS"],
}
)
except AttributeError:
return None
return Repository.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs] def replication_status(self) -> "DescribeImageReplicationStatusResponse":
"""
Return the replication status for the image.
"""
return (
cast("ECRImageManager", self.objects) # type: ignore[attr-defined]
.using(self.session)
.replication_status(cast("str", self.repositoryName), imageId=self.imageId)
)
[docs] def scan_findings(self) -> "list[DescribeImageScanFindingsResponse]":
"""
Return the scan results for the image.
"""
return (
cast("ECRImageManager", self.objects) # type: ignore[attr-defined]
.using(self.session)
.scan_findings(cast("str", self.repositoryName), imageId=self.imageId)
)
# =======================
# Request/Response Models
# =======================
[docs]class CreateRepositoryResponse(Boto3Model):
repository: "Repository | None" = None
"""
The repository that was created.
"""
[docs]class DeleteRepositoryResponse(Boto3Model):
repository: "Repository | None" = None
"""
The repository that was deleted.
"""
[docs]class DescribeRepositoriesResponse(Boto3Model):
repositories: "builtins.list[Repository] | None" = Field(default_factory=list)
"""
A list of repository objects corresponding to valid repositories.
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``DescribeRepositories`` request.
When the results of a
``DescribeRepositories`` request exceed ``maxResults``, this value can be used to retrieve the next page of results.
This value is ``null`` when there are no more results to return.
"""
[docs]class ListImagesFilter(Boto3Model):
"""
An object representing a filter on a ListImages operation.
"""
tagStatus: "Literal['TAGGED', 'UNTAGGED', 'ANY'] | None" = None
"""
The tag status with which to filter your ListImages results.
"""
imageStatus: "Literal['ACTIVE', 'ARCHIVED', 'ACTIVATING', 'ANY'] | None" = None
"""
The image status with which to filter your ListImages results.
Valid values are ``ACTIVE``, ``ARCHIVED``, and
``ACTIVATING``. If not specified, only images with ``ACTIVE`` status are returned.
"""
[docs]class ListImagesResponse(Boto3Model):
imageIds: "builtins.list[ImageIdentifier] | None" = Field(default_factory=list)
"""
The list of image IDs for the requested repository.
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``ListImages`` request.
When the results of a ``ListImages`` request
exceed ``maxResults``, this value can be used to retrieve the next page of results. This value is ``null`` when there
are no more results to return.
"""
[docs]class ImageFailure(Boto3Model):
"""
An object representing an Amazon ECR image failure.
"""
imageId: "ImageIdentifier | None" = None
"""
The image ID associated with the failure.
"""
failureCode: "Literal['InvalidImageDigest', 'InvalidImageTag', 'ImageTagDoesNotMatchDigest', 'ImageNotFound', 'MissingDigestAndTag', 'ImageReferencedByManifestList', 'KmsError', 'UpstreamAccessDenied', 'UpstreamTooManyRequests', 'UpstreamUnavailable', 'ImageInaccessible'] | None" = None
"""
The code associated with the failure.
"""
failureReason: "str | None" = None
"""
The reason for the failure.
"""
[docs]class BatchGetImageResponse(Boto3Model):
images: "builtins.list[ECRImage] | None" = Field(default_factory=list)
"""
A list of image objects corresponding to the image references in the request.
"""
failures: "builtins.list[ImageFailure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class BatchDeleteImageResponse(Boto3Model):
imageIds: "builtins.list[ImageIdentifier] | None" = Field(default_factory=list)
"""
The image IDs of the deleted images.
"""
failures: "builtins.list[ImageFailure] | None" = Field(default_factory=list)
"""
Any failures associated with the call.
"""
[docs]class ImageReplicationStatus(Boto3Model):
"""
The status of the replication process for an image.
"""
region: "str | None" = None
"""
The destination Region for the image replication.
"""
registryId: "str | None" = None
"""
The Amazon Web Services account ID associated with the registry to which the image
belongs.
"""
status: "Literal['IN_PROGRESS', 'COMPLETE', 'FAILED'] | None" = None
"""
The image replication status.
"""
failureCode: "str | None" = None
"""
The failure code for a replication that has failed.
"""
[docs]class DescribeImageReplicationStatusResponse(Boto3Model):
repositoryName: "str | None" = None
"""
The repository name associated with the request.
"""
imageId: "ImageIdentifier | None" = None
"""
An object with identifying information for an image in an Amazon ECR repository.
"""
replicationStatuses: "builtins.list[ImageReplicationStatus] | None" = Field(
default_factory=list
)
"""
The replication status details for the images in the specified repository.
"""
[docs]class ImageScanStatus(Boto3Model):
"""
The current status of an image scan.
"""
status: "Literal['IN_PROGRESS', 'COMPLETE', 'FAILED', 'UNSUPPORTED_IMAGE', 'ACTIVE', 'PENDING', 'SCAN_ELIGIBILITY_EXPIRED', 'FINDINGS_UNAVAILABLE', 'LIMIT_EXCEEDED', 'IMAGE_ARCHIVED'] | None" = None
"""
The current state of an image scan.
"""
description: "str | None" = None
"""
The description of the image scan status.
"""
[docs]class ECRAttribute(Boto3Model):
"""
This data type is used in the ImageScanFinding data type.
"""
key: str
"""
The attribute key.
"""
value: "str | None" = None
"""
The value assigned to the attribute key.
"""
[docs]class ImageScanFinding(Boto3Model):
"""
Contains information about an image scan finding.
"""
name: "str | None" = None
"""
The name associated with the finding, usually a CVE number.
"""
description: "str | None" = None
"""
The description of the finding.
"""
uri: "str | None" = None
"""
A link containing additional details about the security vulnerability.
"""
severity: "Literal['INFORMATIONAL', 'LOW', 'MEDIUM', 'HIGH', 'CRITICAL', 'UNDEFINED'] | None" = None
"""
The finding severity.
"""
attributes: "builtins.list[ECRAttribute] | None" = Field(default_factory=list)
"""
A collection of attributes of the host from which the finding is generated.
"""
[docs]class Resource(Boto3Model):
"""
Details about the resource involved in a finding.
"""
Tags: dict[str, str] = Field(default_factory=dict, alias="tags")
"""
The tags attached to the resource.
"""
details: "ResourceDetails | None" = None
"""
An object that contains details about the resource involved in a finding.
"""
id: "str | None" = None
"""
The ID of the resource.
"""
type: "str | None" = None
"""
The type of resource.
"""
[docs]class ScoreDetails(Boto3Model):
"""
Information about the Amazon Inspector score given to a finding.
"""
cvss: "CvssScoreDetails | None" = None
"""
An object that contains details about the CVSS score given to a finding.
"""
[docs]class EnhancedImageScanFinding(Boto3Model):
"""
The details of an enhanced image scan.
This is returned when enhanced scanning is enabled for your private registry.
"""
awsAccountId: "str | None" = None
"""
The Amazon Web Services account ID associated with the image.
"""
description: "str | None" = None
"""
The description of the finding.
"""
findingArn: "str | None" = None
"""
The Amazon Resource Number (ARN) of the finding.
"""
firstObservedAt: "datetime | None" = None
"""
The date and time that the finding was first observed.
"""
lastObservedAt: "datetime | None" = None
"""
The date and time that the finding was last observed.
"""
packageVulnerabilityDetails: "PackageVulnerabilityDetails | None" = None
"""
An object that contains the details of a package vulnerability finding.
"""
remediation: "Remediation | None" = None
"""
An object that contains the details about how to remediate a finding.
"""
resources: "builtins.list[Resource] | None" = Field(default_factory=list)
"""
Contains information on the resources involved in a finding.
"""
score: "float | None" = None
"""
The Amazon Inspector score given to the finding.
"""
scoreDetails: "ScoreDetails | None" = None
"""
An object that contains details of the Amazon Inspector score.
"""
severity: "str | None" = None
"""
The severity of the finding.
"""
status: "str | None" = None
"""
The status of the finding.
"""
title: "str | None" = None
"""
The title of the finding.
"""
type: "str | None" = None
"""
The type of the finding.
"""
updatedAt: "datetime | None" = None
"""
The date and time the finding was last updated at.
"""
fixAvailable: "str | None" = None
"""
Details on whether a fix is available through a version update.
This value can be ``YES``, ``NO``, or ``PARTIAL``. A
``PARTIAL`` fix means that some, but not all, of the packages identified in the finding have fixes available through
updated versions.
"""
exploitAvailable: "str | None" = None
"""
If a finding discovered in your environment has an exploit available.
"""
[docs]class ImageScanFindings(ReadonlyBoto3Model):
"""
The details of an image scan.
"""
findingSeverityCounts: (
dict[
Literal[
"INFORMATIONAL",
"LOW",
"MEDIUM",
"HIGH",
"CRITICAL",
"UNDEFINED",
"UNTRIAGED",
],
int,
]
| None
) = Field(default_factory=dict)
"""
The image vulnerability counts, sorted by severity.
"""
imageScanCompletedAt: "datetime | None" = None
"""
The time of the last completed image scan.
"""
vulnerabilitySourceUpdatedAt: "datetime | None" = None
"""
The time when the vulnerability data was last scanned.
"""
findings: "builtins.list[ImageScanFinding] | None" = Field(default_factory=list)
"""
The findings from the image scan.
"""
enhancedFindings: "builtins.list[EnhancedImageScanFinding] | None" = Field(
default_factory=list
)
"""
Details about the enhanced scan findings from Amazon Inspector.
"""
[docs]class DescribeImageScanFindingsResponse(Boto3Model):
registryId: "str | None" = None
"""
The registry ID associated with the request.
"""
repositoryName: "str | None" = None
"""
The repository name associated with the request.
"""
imageId: "ImageIdentifier | None" = None
"""
An object with identifying information for an image in an Amazon ECR repository.
"""
imageScanStatus: "ImageScanStatus | None" = None
"""
The current state of the scan.
"""
imageScanFindings: "ImageScanFindings | None" = None
"""
The information contained in the image scan findings.
"""
nextToken: "str | None" = None
"""
The ``nextToken`` value to include in a future ``DescribeImageScanFindings``
request.
When the results of a
``DescribeImageScanFindings`` request exceed ``maxResults``, this value can be used to retrieve the next page of
results. This value is null when there are no more results to return.
"""