ECR Image Scan

This is emitted when an ECR image scan occurs. See AWS documentation for more information on when this might be emitted.

Primary Model

pydantic model botocraft.eventbridge.ecr.ECRImageScanEvent[source]

Bases: EventBridgeEvent, ECRImageScanEvent

ECR Image Scan Event class.

Show JSON schema
{
   "title": "ECRImageScanEvent",
   "description": "ECR Image Scan Event class.",
   "type": "object",
   "properties": {
      "detail": {
         "$ref": "#/$defs/ECRImageScan"
      },
      "account": {
         "title": "Account",
         "type": "string"
      },
      "detail-type": {
         "title": "Detail-Type",
         "type": "string"
      },
      "id": {
         "title": "Id",
         "type": "string"
      },
      "region": {
         "title": "Region",
         "type": "string"
      },
      "resources": {
         "items": {
            "type": "string"
         },
         "title": "Resources",
         "type": "array"
      },
      "source": {
         "title": "Source",
         "type": "string"
      },
      "time": {
         "format": "date-time",
         "title": "Time",
         "type": "string"
      },
      "version": {
         "title": "Version",
         "type": "string"
      },
      "session": {
         "anyOf": [
            {},
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Session"
      }
   },
   "$defs": {
      "ECRImageScan": {
         "description": "Represents the details of an ECR image scan operation.\nContains information about the scanned image and the scan results.",
         "properties": {
            "image-digest": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Image-Digest"
            },
            "image-tags": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Image-Tags"
            },
            "repository-name": {
               "title": "Repository-Name",
               "type": "string"
            },
            "scan-status": {
               "title": "Scan-Status",
               "type": "string"
            },
            "finding-severity-counts": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FindingSeverityCounts"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "repository-name",
            "scan-status"
         ],
         "title": "ECRImageScan",
         "type": "object"
      },
      "FindingSeverityCounts": {
         "description": "Represents the counts of security findings by severity level from an ECR image scan.\nEach attribute indicates the number of findings at that severity level.",
         "properties": {
            "CRITICAL": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Critical"
            },
            "HIGH": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "High"
            },
            "INFORMATIONAL": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Informational"
            },
            "LOW": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Low"
            },
            "MEDIUM": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Medium"
            },
            "UNDEFINED": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Undefined"
            }
         },
         "title": "FindingSeverityCounts",
         "type": "object"
      }
   },
   "required": [
      "detail",
      "account",
      "detail-type",
      "id",
      "region",
      "resources",
      "source",
      "time",
      "version"
   ]
}

Fields:
field account: str [Required]

The AWS account ID where the scan was performed

field detail: ECRImageScan [Required]

The detailed information about the image scan operation

field detail_type: str [Required] (alias 'detail-type')

The human-readable type of the event (e.g., “ECR Image Scan”)

field id: str [Required]

The unique identifier for this event instance

field region: str [Required]

The AWS region where the scan was performed

field resources: list[str] [Required]

The AWS resources involved in this event, typically the repository ARN

field source: str [Required]

The source of the event (typically “aws.ecr”)

field time: datetime [Required]

The timestamp when the scan was completed and event generated, in UTC

field version: str [Required]

The version of the event schema format

classmethod construct(_fields_set: set[str] | None = None, **values: Any) Self
classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self

Creates a new instance of the Model class with validated data.

Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.

!!! note

model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.

Parameters:
  • _fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.

  • values – Trusted or pre-validated data dictionary.

Returns:

A new instance of the Model class with validated data.

model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) Self
!!! abstract “Usage Documentation”

[model_copy](../concepts/serialization.md#model_copy)

Returns a copy of the model.

!!! note

The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).

Parameters:
  • update – Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data.

  • deep – Set to True to make a deep copy of the model.

Returns:

New model instance.

model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) str
!!! abstract “Usage Documentation”

[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)

Generates a JSON representation of the model using Pydantic’s to_json method.

Parameters:
  • indent – Indentation to use in the JSON output. If None is passed, the output will be compact.

  • include – Field(s) to include in the JSON output.

  • exclude – Field(s) to exclude from the JSON output.

  • context – Additional context to pass to the serializer.

  • by_alias – Whether to serialize using field aliases.

  • exclude_unset – Whether to exclude fields that have not been explicitly set.

  • exclude_defaults – Whether to exclude fields that are set to their default value.

  • exclude_none – Whether to exclude fields that have a value of None.

  • round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].

  • warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].

  • fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.

  • serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.

Returns:

A JSON string representation of the model.

classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self

Validate a pydantic model instance.

Parameters:
  • obj – The object to validate.

  • strict – Whether to enforce types strictly.

  • from_attributes – Whether to extract data from object attributes.

  • context – Additional context to pass to the validator.

  • by_alias – Whether to use the field’s alias when validating against the provided input data.

  • by_name – Whether to use the field’s name when validating against the provided input data.

Raises:

ValidationError – If the object could not be validated.

Returns:

The validated model instance.

classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
!!! abstract “Usage Documentation”

[JSON Parsing](../concepts/json.md#json-parsing)

Validate the given JSON data against the Pydantic model.

Parameters:
  • json_data – The JSON data to validate.

  • strict – Whether to enforce types strictly.

  • context – Extra variables to pass to the validator.

  • by_alias – Whether to use the field’s alias when validating against the provided input data.

  • by_name – Whether to use the field’s name when validating against the provided input data.

Returns:

The validated Pydantic model.

Raises:

ValidationError – If json_data is not a JSON string or the object could not be validated.

classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self

Validate the given object with string data against the Pydantic model.

Parameters:
  • obj – The object containing string data to validate.

  • strict – Whether to enforce types strictly.

  • context – Extra variables to pass to the validator.

  • by_alias – Whether to use the field’s alias when validating against the provided input data.

  • by_name – Whether to use the field’s name when validating against the provided input data.

Returns:

The validated Pydantic model.

classmethod parse_file(path: str | Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self
classmethod parse_obj(obj: Any) Self
classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self
property image: ECRImage | None

Return the ECR image object named by the event.

session: Any | None = FieldInfo(annotation=Union[Any, NoneType], required=False, default=None, exclude=True)

Raw Event Models from AWS Schema

pydantic model botocraft.eventbridge.raw.ecr.ecr_image_scan.ECRImageScan[source]

Bases: BaseModel

Represents the details of an ECR image scan operation. Contains information about the scanned image and the scan results.

Show JSON schema
{
   "title": "ECRImageScan",
   "description": "Represents the details of an ECR image scan operation.\nContains information about the scanned image and the scan results.",
   "type": "object",
   "properties": {
      "image-digest": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Image-Digest"
      },
      "image-tags": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Image-Tags"
      },
      "repository-name": {
         "title": "Repository-Name",
         "type": "string"
      },
      "scan-status": {
         "title": "Scan-Status",
         "type": "string"
      },
      "finding-severity-counts": {
         "anyOf": [
            {
               "$ref": "#/$defs/FindingSeverityCounts"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "FindingSeverityCounts": {
         "description": "Represents the counts of security findings by severity level from an ECR image scan.\nEach attribute indicates the number of findings at that severity level.",
         "properties": {
            "CRITICAL": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Critical"
            },
            "HIGH": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "High"
            },
            "INFORMATIONAL": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Informational"
            },
            "LOW": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Low"
            },
            "MEDIUM": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Medium"
            },
            "UNDEFINED": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Undefined"
            }
         },
         "title": "FindingSeverityCounts",
         "type": "object"
      }
   },
   "required": [
      "repository-name",
      "scan-status"
   ]
}

Fields:
field finding_severity_counts: FindingSeverityCounts | None = None (alias 'finding-severity-counts')

The counts of findings grouped by severity level

field image_digest: str | None = None (alias 'image-digest')

The SHA256 digest of the image that was scanned

field image_tags: list[str] | None = None (alias 'image-tags')

The list of tags associated with the scanned image

field repository_name: str [Required] (alias 'repository-name')

The name of the ECR repository containing the scanned image

field scan_status: str [Required] (alias 'scan-status')

The status of the scan operation (e.g., “COMPLETE”, “FAILED”)

pydantic model botocraft.eventbridge.raw.ecr.ecr_image_scan.ECRImageScanEvent[source]

Bases: BaseModel

Represents a complete ECR Image Scan event from EventBridge. Contains metadata about the event and the actual scan details.

Show JSON schema
{
   "title": "ECRImageScanEvent",
   "description": "Represents a complete ECR Image Scan event from EventBridge.\nContains metadata about the event and the actual scan details.",
   "type": "object",
   "properties": {
      "detail": {
         "$ref": "#/$defs/ECRImageScan"
      },
      "account": {
         "title": "Account",
         "type": "string"
      },
      "detail-type": {
         "title": "Detail-Type",
         "type": "string"
      },
      "id": {
         "title": "Id",
         "type": "string"
      },
      "region": {
         "title": "Region",
         "type": "string"
      },
      "resources": {
         "items": {
            "type": "string"
         },
         "title": "Resources",
         "type": "array"
      },
      "source": {
         "title": "Source",
         "type": "string"
      },
      "time": {
         "format": "date-time",
         "title": "Time",
         "type": "string"
      },
      "version": {
         "title": "Version",
         "type": "string"
      }
   },
   "$defs": {
      "ECRImageScan": {
         "description": "Represents the details of an ECR image scan operation.\nContains information about the scanned image and the scan results.",
         "properties": {
            "image-digest": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Image-Digest"
            },
            "image-tags": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Image-Tags"
            },
            "repository-name": {
               "title": "Repository-Name",
               "type": "string"
            },
            "scan-status": {
               "title": "Scan-Status",
               "type": "string"
            },
            "finding-severity-counts": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FindingSeverityCounts"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "repository-name",
            "scan-status"
         ],
         "title": "ECRImageScan",
         "type": "object"
      },
      "FindingSeverityCounts": {
         "description": "Represents the counts of security findings by severity level from an ECR image scan.\nEach attribute indicates the number of findings at that severity level.",
         "properties": {
            "CRITICAL": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Critical"
            },
            "HIGH": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "High"
            },
            "INFORMATIONAL": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Informational"
            },
            "LOW": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Low"
            },
            "MEDIUM": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Medium"
            },
            "UNDEFINED": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Undefined"
            }
         },
         "title": "FindingSeverityCounts",
         "type": "object"
      }
   },
   "required": [
      "detail",
      "account",
      "detail-type",
      "id",
      "region",
      "resources",
      "source",
      "time",
      "version"
   ]
}

Fields:
field account: str [Required]

The AWS account ID where the scan was performed

field detail: ECRImageScan [Required]

The detailed information about the image scan operation

field detail_type: str [Required] (alias 'detail-type')

The human-readable type of the event (e.g., “ECR Image Scan”)

field id: str [Required]

The unique identifier for this event instance

field region: str [Required]

The AWS region where the scan was performed

field resources: list[str] [Required]

The AWS resources involved in this event, typically the repository ARN

field source: str [Required]

The source of the event (typically “aws.ecr”)

field time: datetime [Required]

The timestamp when the scan was completed and event generated, in UTC

field version: str [Required]

The version of the event schema format

pydantic model botocraft.eventbridge.raw.ecr.ecr_image_scan.FindingSeverityCounts[source]

Bases: BaseModel

Represents the counts of security findings by severity level from an ECR image scan. Each attribute indicates the number of findings at that severity level.

Show JSON schema
{
   "title": "FindingSeverityCounts",
   "description": "Represents the counts of security findings by severity level from an ECR image scan.\nEach attribute indicates the number of findings at that severity level.",
   "type": "object",
   "properties": {
      "CRITICAL": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Critical"
      },
      "HIGH": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "High"
      },
      "INFORMATIONAL": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Informational"
      },
      "LOW": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Low"
      },
      "MEDIUM": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Medium"
      },
      "UNDEFINED": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Undefined"
      }
   }
}

Fields:
field CRITICAL: float | None = None

Number of critical severity findings detected in the scan

field HIGH: float | None = None

Number of high severity findings detected in the scan

field INFORMATIONAL: float | None = None

Number of informational severity findings detected in the scan

field LOW: float | None = None

Number of low severity findings detected in the scan

field MEDIUM: float | None = None

Number of medium severity findings detected in the scan

field UNDEFINED: float | None = None

Number of findings with undefined severity level