# This file is automatically generated by botocraft.  Do not edit directly.
# mypy: disable-error-code="index, override, assignment, union-attr, misc"
from botocraft.mixins.tags import TagsDictMixin
from .abstract import PrimaryBoto3ModelQuerySet
from botocraft.mixins.inspector2 import VulnerabilityManagerMixin
from typing import ClassVar, Type, Optional, Literal, Dict, List, Union, Any, cast
from botocraft.mixins.inspector2 import convert_delegated_admin
from datetime import datetime
from botocraft.mixins.inspector2 import CisScanConfigurationManagerMixin
from pydantic import Field
from .abstract import (
    Boto3Model,
    ReadonlyBoto3Model,
    PrimaryBoto3Model,
    ReadonlyPrimaryBoto3Model,
    Boto3ModelManager,
    ReadonlyBoto3ModelManager,
)
from botocraft.mixins.inspector2 import list_augment_delegated_admin_accounts

# ===============
# Managers
# ===============


class CisScanConfigurationManager(CisScanConfigurationManagerMixin, Boto3ModelManager):
    service_name: str = "inspector2"

    def create(self, model: "CisScanConfiguration") -> str:
        """
        Create a new CIS scan configuration.

        Args:
            model: The :py:class:`CisScanConfiguration` to create.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            scanName=data.get("scanName"),
            securityLevel=data.get("securityLevel"),
            schedule=data.get("schedule"),
            targets=data.get("targets"),
            tags=data.get("tags"),
        )
        _response = self.client.create_cis_scan_configuration(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CreateCisScanConfigurationResponse(**_response)

        self.sessionize(response.scanConfigurationArn)
        return cast("str", response.scanConfigurationArn)

    def delete(self, scanConfigurationArn: str) -> "CisScanConfiguration":
        """
        Delete a CIS scan configuration.

        Args:
            scanConfigurationArn: The ARN of the CIS scan configuration.
        """
        args: Dict[str, Any] = dict(
            scanConfigurationArn=self.serialize(scanConfigurationArn)
        )
        _response = self.client.delete_cis_scan_configuration(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DeleteCisScanConfigurationResponse(**_response)
        return cast("CisScanConfiguration", response.scanConfigurationArn)

    def update(self, model: "CisScanConfiguration") -> str:
        """
        Update a CIS scan configuration.

        Args:
            model: The :py:class:`CisScanConfiguration` to update.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            scanConfigurationArn=data.get("scanConfigurationArn"),
            scanName=data.get("scanName"),
            securityLevel=data.get("securityLevel"),
            schedule=data.get("schedule"),
            targets=data.get("targets"),
        )
        _response = self.client.update_cis_scan_configuration(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = UpdateCisScanConfigurationResponse(**_response)

        self.sessionize(response.scanConfigurationArn)
        return cast("str", response.scanConfigurationArn)

    def list(
        self,
        *,
        filterCriteria: Optional["ListCisScanConfigurationsFilterCriteria"] = None,
        sortBy: Literal["SCAN_NAME", "SCAN_CONFIGURATION_ARN"] | None = None,
        sortOrder: Literal["ASC", "DESC"] | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Lists CIS scan configurations.

        Keyword Args:
            filterCriteria: The CIS scan configuration filter criteria.
            sortBy: The CIS scan configuration sort by order.
            sortOrder: The CIS scan configuration sort order order.
        """
        paginator = self.client.get_paginator("list_cis_scan_configurations")
        args: Dict[str, Any] = dict(
            filterCriteria=self.serialize(filterCriteria),
            sortBy=self.serialize(sortBy),
            sortOrder=self.serialize(sortOrder),
        )
        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 = ListCisScanConfigurationsResponse(**_response)
            if response.scanConfigurations:
                results.extend(response.scanConfigurations)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results


class Inspector2FilterManager(Boto3ModelManager):
    service_name: str = "inspector2"

    def create(
        self, model: "Inspector2Filter", filterCriteria: "FilterCriteria"
    ) -> str:
        """
        Create an inspector2 filter.

        Args:
            model: The :py:class:`Filter` to create.
            filterCriteria: Defines the criteria to be used in the filter for querying findings.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            action=data.get("action"),
            filterCriteria=self.serialize(filterCriteria),
            name=data.get("name"),
            description=data.get("description"),
            tags=data.get("tags"),
            reason=data.get("reason"),
        )
        _response = self.client.create_filter(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CreateFilterResponse(**_response)

        self.sessionize(response.arn)
        return cast("str", response.arn)

    def delete(self, arn: str) -> "Inspector2Filter":
        """
        Delete an inspector2 filter.

        Args:
            arn: The Amazon Resource Number (ARN) of the filter to be deleted.
        """
        args: Dict[str, Any] = dict(arn=self.serialize(arn))
        _response = self.client.delete_filter(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DeleteFilterResponse(**_response)
        return cast("Inspector2Filter", response.arn)

    def update(
        self,
        model: "Inspector2Filter",
        filterArn: str,
        filterCriteria: Optional["FilterCriteria"] = None,
    ) -> str:
        """
        Update an inspector2 filter.

        Args:
            model: The :py:class:`Filter` to update.
            filterArn: The Amazon Resource Number (ARN) of the filter to update.

        Keyword Args:
            filterCriteria: Defines the criteria to be update in the filter.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            filterArn=self.serialize(filterArn),
            action=data.get("action"),
            description=data.get("description"),
            filterCriteria=self.serialize(filterCriteria),
            name=data.get("name"),
            reason=data.get("reason"),
        )
        _response = self.client.update_filter(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = UpdateFilterResponse(**_response)

        self.sessionize(response.arn)
        return cast("str", response.arn)

    def get(self, arn: str) -> Optional["Inspector2Filter"]:
        """
        Get an inspector2 filter.

        Args:
            arn: The ARN of the filter to get.
        """
        args: Dict[str, Any] = dict(arns=self.serialize([arn]))
        _response = self.client.list_filters(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = ListFiltersResponse(**_response)

        if response and response.filters:
            self.sessionize(response.filters[0])
            return response.filters[0]
        return None

    def list(
        self,
        *,
        arns: List[str] | None = None,
        action: Literal["NONE", "SUPPRESS"] | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Lists the filters associated with your account.

        Keyword Args:
            arns: The Amazon resource number (ARN) of the filter.
            action: The action the filter applies to matched findings.
        """
        paginator = self.client.get_paginator("list_filters")
        args: Dict[str, Any] = dict(
            arns=self.serialize(arns), action=self.serialize(action)
        )
        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 = ListFiltersResponse(**_response)
            if response.filters:
                results.extend(response.filters)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results


class FindingManager(ReadonlyBoto3ModelManager):
    service_name: str = "inspector2"

    def get(
        self,
        *,
        filterCriteria: Optional["FilterCriteria"] = None,
        sortCriteria: Optional["SortCriteria"] = None,
    ) -> Optional["Finding"]:
        """
        Get an inspector2 finding.

        Keyword Args:
            filterCriteria: Details on the filters to apply to your finding results.
            sortCriteria: Details on the sort criteria to apply to your finding results.
        """
        args: Dict[str, Any] = dict(
            filterCriteria=self.serialize(filterCriteria),
            sortCriteria=self.serialize(sortCriteria),
        )
        _response = self.client.list_findings(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = ListFindingsResponse(**_response)

        if response and response.findings:
            self.sessionize(response.findings[0])
            return response.findings[0]
        return None

    def list(
        self,
        *,
        filterCriteria: Optional["FilterCriteria"] = None,
        sortCriteria: Optional["SortCriteria"] = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Lists findings for your environment.

        Keyword Args:
            filterCriteria: Details on the filters to apply to your finding results.
            sortCriteria: Details on the sort criteria to apply to your finding results.
        """
        paginator = self.client.get_paginator("list_findings")
        args: Dict[str, Any] = dict(
            filterCriteria=self.serialize(filterCriteria),
            sortCriteria=self.serialize(sortCriteria),
        )
        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 = ListFindingsResponse(**_response)
            if response.findings:
                results.extend(response.findings)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results

    def list_aggregations(
        self,
        aggregationType: Literal[
            "FINDING_TYPE",
            "PACKAGE",
            "TITLE",
            "REPOSITORY",
            "AMI",
            "AWS_EC2_INSTANCE",
            "AWS_ECR_CONTAINER",
            "IMAGE_LAYER",
            "ACCOUNT",
            "AWS_LAMBDA_FUNCTION",
            "LAMBDA_LAYER",
            "CODE_REPOSITORY",
        ],
        *,
        accountIds: List["StringFilter"] | None = None,
        aggregationRequest: Optional["AggregationRequest"] = None,
    ) -> List["AggregationResponse"]:
        """
        Lists aggregated finding data for your environment based on specific criteria.

        Args:
            aggregationType: The type of the aggregation request.

        Keyword Args:
            accountIds: The Amazon Web Services account IDs to retrieve finding aggregation data for.
            aggregationRequest: Details of the aggregation request that is used to filter your aggregation results.
        """
        paginator = self.client.get_paginator("list_finding_aggregations")
        args: Dict[str, Any] = dict(
            aggregationType=self.serialize(aggregationType),
            accountIds=self.serialize(accountIds),
            aggregationRequest=self.serialize(aggregationRequest),
        )
        response_iterator = paginator.paginate(
            **{k: v for k, v in args.items() if v is not None}
        )

        results: List["AggregationResponse"] = []

        for _response in response_iterator:
            response = ListFindingAggregationsResponse(**_response)
            if response.responses is not None:
                results.extend(response.responses)
            else:
                break

        self.sessionize(results)
        return cast("List[AggregationResponse]", results)

    def batch_get_finding_details(
        self, findingArns: List[str]
    ) -> "BatchGetFindingDetailsResponse":
        """
        Gets vulnerability details for findings.

        Args:
            findingArns: A list of finding ARNs.
        """
        args: Dict[str, Any] = dict(findingArns=self.serialize(findingArns))
        _response = self.client.batch_get_finding_details(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = BatchGetFindingDetailsResponse(**_response)

        results: "BatchGetFindingDetailsResponse" = None
        if response is not None:
            results = response

        self.sessionize(results)
        return cast("BatchGetFindingDetailsResponse", results)


class FindingsReportManager(Boto3ModelManager):
    service_name: str = "inspector2"

    def create(self, model: "FindingsReport") -> str:
        """
        Creates a finding report. By default only ``ACTIVE`` findings are returned in
        the report. To see ``SUPRESSED`` or ``CLOSED`` findings you must specify a value
        for the ``findingStatus`` filter criteria.

        Args:
            model: The :py:class:`FindingsReport` to create.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            reportFormat=data.get("reportFormat"),
            s3Destination=data.get("s3Destination"),
            filterCriteria=data.get("filterCriteria"),
        )
        _response = self.client.create_findings_report(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CreateFindingsReportResponse(**_response)

        self.sessionize(response.reportId)
        return cast("str", response.reportId)

    def get_status(
        self, *, reportId: str | None = None
    ) -> "GetFindingsReportStatusResponse":
        """
        Gets the status of a findings report.

        Keyword Args:
            reportId: The ID of the report to retrieve the status of.
        """
        args: Dict[str, Any] = dict(reportId=self.serialize(reportId))
        _response = self.client.get_findings_report_status(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = GetFindingsReportStatusResponse(**_response)

        results: "GetFindingsReportStatusResponse" = None
        if response is not None:
            results = response

        self.sessionize(results)
        return cast("GetFindingsReportStatusResponse", results)

    def create_report(
        self,
        reportFormat: Literal["CSV", "JSON"],
        s3Destination: "Destination",
        *,
        filterCriteria: Optional["FilterCriteria"] = None,
    ) -> str:
        """
        Creates a finding report. By default only ``ACTIVE`` findings are returned in
        the report. To see ``SUPRESSED`` or ``CLOSED`` findings you must specify a value
        for the ``findingStatus`` filter criteria.

        Args:
            reportFormat: The format to generate the report in.
            s3Destination: The Amazon S3 export destination for the report.

        Keyword Args:
            filterCriteria: The filter criteria to apply to the results of the finding report.
        """
        args: Dict[str, Any] = dict(
            reportFormat=self.serialize(reportFormat),
            s3Destination=self.serialize(s3Destination),
            filterCriteria=self.serialize(filterCriteria),
        )
        _response = self.client.create_findings_report(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CreateFindingsReportResponse(**_response)

        results: str = None
        if response is not None:
            results = response.reportId

        self.sessionize(results)
        return cast("str", results)

    def cancel_report(self, reportId: str) -> str:
        """
        Cancels the given findings report.

        Args:
            reportId: The ID of the report to be canceled.
        """
        args: Dict[str, Any] = dict(reportId=self.serialize(reportId))
        _response = self.client.cancel_findings_report(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CancelFindingsReportResponse(**_response)

        results: str = None
        if response is not None:
            results = response.reportId

        self.sessionize(results)
        return cast("str", results)


class DelegatedAdminAccountManager(Boto3ModelManager):
    service_name: str = "inspector2"

    @list_augment_delegated_admin_accounts
    def list(
        self,
    ) -> Optional["DelegatedAdmin"]:
        """
        Lists information about the Amazon Inspector delegated administrator of your
        organization.
        """
        paginator = self.client.get_paginator("list_delegated_admin_accounts")
        args: Dict[str, Any] = dict()
        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 = ListDelegatedAdminAccountsResponse(**_response)
            if response.delegatedAdminAccounts:
                results.extend(response.delegatedAdminAccounts)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results

    @convert_delegated_admin
    def get(
        self,
    ) -> Optional["DelegatedAdmin"]:
        """
        Retrieves information about the Amazon Inspector delegated administrator for
        your organization.
        """
        args: Dict[str, Any] = dict()
        _response = self.client.get_delegated_admin_account(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = GetDelegatedAdminAccountResponse(**_response)

        if response and response.delegatedAdmin:
            self.sessionize(response.delegatedAdmin)
            return response.delegatedAdmin
        return None

    def enable(
        self, delegatedAdminAccountId: str, *, clientToken: str | None = None
    ) -> str:
        """
        Enables the Amazon Inspector delegated administrator for your Organizations
        organization.

        Args:
            delegatedAdminAccountId: The Amazon Web Services account ID of the Amazon Inspector delegated administrator.

        Keyword Args:
            clientToken: The idempotency token for the request.
        """
        args: Dict[str, Any] = dict(
            delegatedAdminAccountId=self.serialize(delegatedAdminAccountId),
            clientToken=self.serialize(clientToken),
        )
        _response = self.client.enable_delegated_admin_account(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = EnableDelegatedAdminAccountResponse(**_response)

        results: str = None
        if response is not None:
            results = response.delegatedAdminAccountId

        self.sessionize(results)
        return cast("str", results)

    def disable(self, delegatedAdminAccountId: str) -> str:
        """
        Disables the Amazon Inspector delegated administrator for your organization.

        Args:
            delegatedAdminAccountId: The Amazon Web Services account ID of the current Amazon Inspector delegated administrator.
        """
        args: Dict[str, Any] = dict(
            delegatedAdminAccountId=self.serialize(delegatedAdminAccountId)
        )
        _response = self.client.disable_delegated_admin_account(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DisableDelegatedAdminAccountResponse(**_response)

        results: str = None
        if response is not None:
            results = response.delegatedAdminAccountId

        self.sessionize(results)
        return cast("str", results)


class VulnerabilityManager(ReadonlyBoto3ModelManager):
    service_name: str = "inspector2"

    def list(
        self, filterCriteria: "SearchVulnerabilitiesFilterCriteria"
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Lists Amazon Inspector coverage details for a specific vulnerability.

        Args:
            filterCriteria: The criteria used to filter the results of a vulnerability search.
        """
        paginator = self.client.get_paginator("search_vulnerabilities")
        args: Dict[str, Any] = dict(filterCriteria=self.serialize(filterCriteria))
        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 = SearchVulnerabilitiesResponse(**_response)
            if response.vulnerabilities:
                results.extend(response.vulnerabilities)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results


# ==============
# Service Models
# ==============


class OneTimeSchedule(Boto3Model):
    """
    A one time schedule.
    """



class Time(Boto3Model):
    """
    The time.
    """

    timeOfDay: str
    """
    The time of day in 24-hour format (00:00).
    """
    timezone: str
    """
    The timezone.
    """


class DailySchedule(Boto3Model):
    """
    A daily schedule.
    """

    startTime: Time
    """
    The schedule start time.
    """


class WeeklySchedule(Boto3Model):
    """
    A weekly schedule.
    """

    startTime: Time
    """
    The weekly schedule's start time.
    """
    days: List[Literal["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]]
    """
    The weekly schedule's days.
    """


class MonthlySchedule(Boto3Model):
    """
    A monthly schedule.
    """

    startTime: Time
    """
    The monthly schedule's start time.
    """
    day: Literal["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
    """
    The monthly schedule's day.
    """


class Schedule(Boto3Model):
    """
    A schedule.
    """

    oneTime: OneTimeSchedule | None = None
    """
    The schedule's one time.
    """
    daily: DailySchedule | None = None
    """
    The schedule's daily.
    """
    weekly: WeeklySchedule | None = None
    """
    The schedule's weekly.
    """
    monthly: MonthlySchedule | None = None
    """
    The schedule's monthly.
    """


class CisTargets(Boto3Model):
    """
    The CIS targets.
    """

    accountIds: List[str] | None = None
    """
    The CIS target account ids.
    """
    targetResourceTags: Dict[str, List[str]] | None = None
    """
    The CIS target resource tags.
    """


class CisScanConfiguration(PrimaryBoto3Model):
    """
    The CIS scan configuration.
    """

    manager_class: ClassVar[Type[Boto3ModelManager]] = CisScanConfigurationManager

    Tags: Dict[str, str] = Field(default_factory=dict, alias="tags")
    """
    The CIS scan configuration's tags.
    """
    scanConfigurationArn: str
    """
    The CIS scan configuration's scan configuration ARN.
    """
    ownerId: str = Field(default=None, frozen=True)
    """
    The CIS scan configuration's owner ID.
    """
    scanName: str | None = None
    """
    The name of the CIS scan configuration.
    """
    securityLevel: Literal["LEVEL_1", "LEVEL_2"] | None = None
    """
    The CIS scan configuration's security level.
    """
    schedule: Schedule | None = None
    """
    The CIS scan configuration's schedule.
    """
    targets: CisTargets | None = None
    """
    The CIS scan configuration's targets.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`scanConfigurationArn` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.scanConfigurationArn

    @property
    def arn(self) -> str | None:
        """
        Return the ARN of the model.   This is the value of the
        :py:attr:`scanConfigurationArn` attribute.

        Returns:
            The ARN of the model instance.
        """
        return self.scanConfigurationArn

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the :py:attr:`scanName`
        attribute.

        Returns:
            The name of the model instance.
        """
        return self.scanName

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`scanConfigurationArn` attribute.
        """
        return hash(self.scanConfigurationArn)


class StringFilter(Boto3Model):
    """
    An object that describes the details of a string filter.
    """

    comparison: Literal["EQUALS", "PREFIX", "NOT_EQUALS"]
    """
    The operator to use when comparing values in the filter.
    """
    value: str
    """
    The value to filter on.
    """


class DateFilter(Boto3Model):
    """
    Contains details on the time range used to filter findings.
    """

    startInclusive: datetime | None = None
    """
    A timestamp representing the start of the time period filtered on.
    """
    endInclusive: datetime | None = None
    """
    A timestamp representing the end of the time period filtered on.
    """


class NumberFilter(Boto3Model):
    """
    An object that describes the details of a number filter.
    """

    upperInclusive: float | None = None
    """
    The highest number to be included in the filter.
    """
    lowerInclusive: float | None = None
    """
    The lowest number to be included in the filter.
    """


class MapFilter(Boto3Model):
    """
    An object that describes details of a map filter.
    """

    comparison: Literal["EQUALS"]
    """
    The operator to use when comparing values in the filter.
    """
    key: str
    """
    The tag key used in the filter.
    """
    value: str | None = None
    """
    The tag value used in the filter.
    """


class PortRangeFilter(Boto3Model):
    """
    An object that describes the details of a port range filter.
    """

    beginInclusive: int | None = None
    """
    The port number the port range begins at.
    """
    endInclusive: int | None = None
    """
    The port number the port range ends at.
    """


class PackageFilter(Boto3Model):
    """
    Contains information on the details of a package filter.
    """

    name: StringFilter | None = None
    """
    An object that contains details on the name of the package to filter on.
    """
    version: StringFilter | None = None
    """
    The package version to filter on.
    """
    epoch: NumberFilter | None = None
    """
    An object that contains details on the package epoch to filter on.
    """
    release: StringFilter | None = None
    """
    An object that contains details on the package release to filter on.
    """
    architecture: StringFilter | None = None
    """
    An object that contains details on the package architecture type to filter on.
    """
    sourceLayerHash: StringFilter | None = None
    """
    An object that contains details on the source layer hash to filter on.
    """
    sourceLambdaLayerArn: StringFilter | None = None
    """
    An object that describes the details of a string filter.
    """
    filePath: StringFilter | None = None
    """
    An object that contains details on the package file path to filter on.
    """


class FilterCriteria(Boto3Model):
    """
    Details on the criteria used to define the filter.
    """

    findingArn: List["StringFilter"] | None = None
    """
    Details on the finding ARNs used to filter findings.
    """
    awsAccountId: List["StringFilter"] | None = None
    """
    Details of the Amazon Web Services account IDs used to filter findings.
    """
    findingType: List["StringFilter"] | None = None
    """
    Details on the finding types used to filter findings.
    """
    severity: List["StringFilter"] | None = None
    """
    Details on the severity used to filter findings.
    """
    firstObservedAt: List["DateFilter"] | None = None
    """
    Details on the date and time a finding was first seen used to filter findings.
    """
    lastObservedAt: List["DateFilter"] | None = None
    """
    Details on the date and time a finding was last seen used to filter findings.
    """
    updatedAt: List["DateFilter"] | None = None
    """
    Details on the date and time a finding was last updated at used to filter findings.
    """
    findingStatus: List["StringFilter"] | None = None
    """
    Details on the finding status types used to filter findings.
    """
    title: List["StringFilter"] | None = None
    """
    Details on the finding title used to filter findings.
    """
    inspectorScore: List["NumberFilter"] | None = None
    """
    The Amazon Inspector score to filter on.
    """
    resourceType: List["StringFilter"] | None = None
    """
    Details on the resource types used to filter findings.
    """
    resourceId: List["StringFilter"] | None = None
    """
    Details on the resource IDs used to filter findings.
    """
    resourceTags: List["MapFilter"] | None = None
    """
    Details on the resource tags used to filter findings.
    """
    ec2InstanceImageId: List["StringFilter"] | None = None
    """
    Details of the Amazon EC2 instance image IDs used to filter findings.
    """
    ec2InstanceVpcId: List["StringFilter"] | None = None
    """
    Details of the Amazon EC2 instance VPC IDs used to filter findings.
    """
    ec2InstanceSubnetId: List["StringFilter"] | None = None
    """
    Details of the Amazon EC2 instance subnet IDs used to filter findings.
    """
    ecrImagePushedAt: List["DateFilter"] | None = None
    """
    Details on the Amazon ECR image push date and time used to filter findings.
    """
    ecrImageArchitecture: List["StringFilter"] | None = None
    """
    Details of the Amazon ECR image architecture types used to filter findings.
    """
    ecrImageRegistry: List["StringFilter"] | None = None
    """
    Details on the Amazon ECR registry used to filter findings.
    """
    ecrImageRepositoryName: List["StringFilter"] | None = None
    """
    Details on the name of the Amazon ECR repository used to filter findings.
    """
    ecrImageTags: List["StringFilter"] | None = None
    """
    The tags attached to the Amazon ECR container image.
    """
    ecrImageHash: List["StringFilter"] | None = None
    """
    Details of the Amazon ECR image hashes used to filter findings.
    """
    ecrImageLastInUseAt: List["DateFilter"] | None = None
    """
    Filter criteria indicating when an Amazon ECR image was last used in an Amazon ECS
    cluster task or Amazon EKS cluster pod.
    """
    ecrImageInUseCount: List["NumberFilter"] | None = None
    """
    Filter criteria indicating when details for an Amazon ECR image include when an
    Amazon ECR image is in use.
    """
    portRange: List["PortRangeFilter"] | None = None
    """
    Details on the port ranges used to filter findings.
    """
    networkProtocol: List["StringFilter"] | None = None
    """
    Details on network protocol used to filter findings.
    """
    componentId: List["StringFilter"] | None = None
    """
    Details of the component IDs used to filter findings.
    """
    componentType: List["StringFilter"] | None = None
    """
    Details of the component types used to filter findings.
    """
    vulnerabilityId: List["StringFilter"] | None = None
    """
    Details on the vulnerability ID used to filter findings.
    """
    vulnerabilitySource: List["StringFilter"] | None = None
    """
    Details on the vulnerability type used to filter findings.
    """
    vendorSeverity: List["StringFilter"] | None = None
    """
    Details on the vendor severity used to filter findings.
    """
    vulnerablePackages: List["PackageFilter"] | None = None
    """
    Details on the vulnerable packages used to filter findings.
    """
    relatedVulnerabilities: List["StringFilter"] | None = None
    """
    Details on the related vulnerabilities used to filter findings.
    """
    fixAvailable: List["StringFilter"] | 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.
    """
    lambdaFunctionName: List["StringFilter"] | None = None
    """
    Filters the list of Amazon Web Services Lambda functions by the name of the
    function.
    """
    lambdaFunctionLayers: List["StringFilter"] | None = None
    """
Filters the list of Amazon Web Services Lambda functions by the function's
`layers <https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html>`_. A Lambda function can have up to five
layers.
    """
    lambdaFunctionRuntime: List["StringFilter"] | None = None
    """
    Filters the list of Amazon Web Services Lambda functions by the runtime environment
    for the Lambda function.
    """
    lambdaFunctionLastModifiedAt: List["DateFilter"] | None = None
    """
Filters the list of Amazon Web Services Lambda functions by the date and time that a user last updated the
configuration, in `ISO 8601 format <https://www.iso.org/iso-8601-date-and-time-format.html>`_
    """
    lambdaFunctionExecutionRoleArn: List["StringFilter"] | None = None
    """
    Filters the list of Amazon Web Services Lambda functions by execution role.
    """
    exploitAvailable: List["StringFilter"] | None = None
    """
    Filters the list of Amazon Web Services Lambda findings by the availability of
    exploits.
    """
    codeVulnerabilityDetectorName: List["StringFilter"] | None = None
    """
    The name of the detector used to identify a code vulnerability in a Lambda function
    used to filter findings.
    """
    codeVulnerabilityDetectorTags: List["StringFilter"] | None = None
    """
    The detector type tag associated with the vulnerability used to filter findings.

    Detector tags group related vulnerabilities by common themes or tactics. For a list
    of available tags by programming language, see
    `Java tags <https://docs.aws.amazon.com/codeguru/detector-library/java/tags/>`_,
    or
    `Python tags <https://docs.aws.amazon.com/codeguru/detector-library/python/tags/>`_.
    """
    codeVulnerabilityFilePath: List["StringFilter"] | None = None
    """
    The file path to the file in a Lambda function that contains a code vulnerability
    used to filter findings.
    """
    epssScore: List["NumberFilter"] | None = None
    """
    The EPSS score used to filter findings.
    """
    codeRepositoryProjectName: List["StringFilter"] | None = None
    """
    Filter criteria for findings based on the project name in a code repository.
    """
    codeRepositoryProviderType: List["StringFilter"] | None = None
    """
    Filter criteria for findings based on the repository provider type (such as GitHub,
    GitLab, etc.).
    """


class Inspector2Filter(PrimaryBoto3Model):
    """
    Details about a filter.
    """

    manager_class: ClassVar[Type[Boto3ModelManager]] = Inspector2FilterManager

    filterArn: str = Field(default=None, alias="arn")
    """
    The Amazon Resource Number (ARN) associated with this filter.
    """
    filterName: str = Field(default=None, alias="name")
    """
    The name of the filter.
    """
    Tags: Dict[str, str] = Field(default_factory=dict, alias="tags")
    """
    The tags attached to the filter.
    """
    ownerId: str = Field(frozen=True)
    """
    The Amazon Web Services account ID of the account that created the filter.
    """
    criteria: FilterCriteria = Field(frozen=True)
    """
    Details on the filter criteria associated with this filter.
    """
    action: Literal["NONE", "SUPPRESS"]
    """
    The action that is to be applied to the findings that match the filter.
    """
    createdAt: datetime = Field(frozen=True)
    """
    The date and time this filter was created at.
    """
    updatedAt: datetime = Field(frozen=True)
    """
    The date and time the filter was last updated at.
    """
    description: str | None = None
    """
    A description of the filter.
    """
    reason: str | None = None
    """
    The reason for the filter.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`filterArn` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.filterArn

    @property
    def arn(self) -> str | None:
        """
        Return the ARN of the model.   This is the value of the :py:attr:`filterArn`
        attribute.

        Returns:
            The ARN of the model instance.
        """
        return self.filterArn

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`filterArn` attribute.
        """
        return hash(self.filterArn)


class Recommendation(Boto3Model):
    """
    Details about the recommended course of action to remediate the finding.
    """

    text: str | None = None
    """
    The recommended course of action to remediate the finding.
    """
    Url: str | None = None
    """
    The URL address to the CVE remediation recommendations.
    """


class Remediation(Boto3Model):
    """
    Information on how to remediate a finding.
    """

    recommendation: Recommendation | None = None
    """
    An object that contains information about the recommended course of action to
    remediate the finding.
    """


class AwsEc2InstanceDetails(Boto3Model):
    """
    Details of the Amazon EC2 instance involved in a finding.
    """

    type: str | None = None
    """
    The type of the Amazon EC2 instance.
    """
    imageId: str | None = None
    """
    The image ID of the Amazon EC2 instance.
    """
    ipV4Addresses: List[str] | None = None
    """
    The IPv4 addresses of the Amazon EC2 instance.
    """
    ipV6Addresses: List[str] | None = None
    """
    The IPv6 addresses of the Amazon EC2 instance.
    """
    keyName: str | None = None
    """
    The name of the key pair used to launch the Amazon EC2 instance.
    """
    iamInstanceProfileArn: str | None = None
    """
    The IAM instance profile ARN of the Amazon EC2 instance.
    """
    vpcId: str | None = None
    """
    The VPC ID of the Amazon EC2 instance.
    """
    subnetId: str | None = None
    """
    The subnet ID of the Amazon EC2 instance.
    """
    launchedAt: datetime | None = None
    """
    The date and time the Amazon EC2 instance was launched at.
    """
    platform: str | None = None
    """
    The platform of the Amazon EC2 instance.
    """


class AwsEcrContainerImageDetails(Boto3Model):
    """
    The image details of the Amazon ECR container image.
    """

    repositoryName: str
    """
    The name of the repository the Amazon ECR container image resides in.
    """
    imageTags: List[str] | None = None
    """
    The image tags attached to the Amazon ECR container image.
    """
    pushedAt: datetime | None = None
    """
    The date and time the Amazon ECR container image was pushed.
    """
    author: str | None = None
    """
    The image author of the Amazon ECR container image.
    """
    architecture: str | None = None
    """
    The architecture of the Amazon ECR container image.
    """
    imageHash: str
    """
    The image hash of the Amazon ECR container image.
    """
    registry: str
    """
    The registry for the Amazon ECR container image.
    """
    platform: str | None = None
    """
    The platform of the Amazon ECR container image.
    """
    lastInUseAt: datetime | None = None
    """
    The last time an Amazon ECR image was used in an Amazon ECS task or Amazon EKS pod.
    """
    inUseCount: int | None = None
    """
    The number of Amazon ECS tasks or Amazon EKS pods where the Amazon ECR container
    image is in use.
    """


class LambdaVpcConfig(Boto3Model):
    """
    The VPC security groups and subnets that are attached to an Amazon Web Services
    Lambda function.

    For more information, see
    `VPC Settings <https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html>`_.
    """

    subnetIds: List[str] | None = None
    """
    A list of VPC subnet IDs.
    """
    securityGroupIds: List[str] | None = None
    """
    The VPC security groups and subnets that are attached to an Amazon Web Services
    Lambda function.

    For more information, see
    `VPC Settings <https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html>`_.
    """
    vpcId: str | None = None
    """
    The ID of the VPC.
    """


class AwsLambdaFunctionDetails(Boto3Model):
    """
    A summary of information about the Amazon Web Services Lambda function.
    """

    functionName: str
    """
    The name of the Amazon Web Services Lambda function.
    """
    runtime: Literal[
        "NODEJS",
        "NODEJS_12_X",
        "NODEJS_14_X",
        "NODEJS_16_X",
        "JAVA_8",
        "JAVA_8_AL2",
        "JAVA_11",
        "PYTHON_3_7",
        "PYTHON_3_8",
        "PYTHON_3_9",
        "UNSUPPORTED",
        "NODEJS_18_X",
        "GO_1_X",
        "JAVA_17",
        "PYTHON_3_10",
        "PYTHON_3_11",
        "DOTNETCORE_3_1",
        "DOTNET_6",
        "DOTNET_7",
        "RUBY_2_7",
        "RUBY_3_2",
    ]
    """
    The runtime environment for the Amazon Web Services Lambda function.
    """
    codeSha256: str
    """
    The SHA256 hash of the Amazon Web Services Lambda function's deployment package.
    """
    version: str
    """
    The version of the Amazon Web Services Lambda function.
    """
    executionRoleArn: str
    """
    The Amazon Web Services Lambda function's execution role.
    """
    layers: List[str] | None = None
    """
The Amazon Web Services Lambda function's  `layers <https://docs.aws.amazon.com/lambda/latest/dg/configuration-
layers.html>`_. A Lambda function can have up to five layers.
    """
    vpcConfig: LambdaVpcConfig | None = None
    """
    The Amazon Web Services Lambda function's networking configuration.
    """
    packageType: Literal["IMAGE", "ZIP"] | None = None
    """
    The type of deployment package.

    Set to ``Image`` for container image and set ``Zip`` for .zip file archive.
    """
    architectures: List[Literal["X86_64", "ARM64"]] | None = None
    """
    The instruction set architecture that the Amazon Web Services Lambda function
    supports.

    Architecture is a string array
    with one of the valid values. The default architecture value is ``x86_64``.
    """
    lastModifiedAt: datetime | None = None
    """
The date and time that a user last updated the configuration, in `ISO 8601 format <https://www.iso.org/iso-8601-date-
and-time-format.html>`_
    """


class CodeRepositoryDetails(Boto3Model):
    """
    Contains details about a code repository associated with a finding.
    """

    projectName: str | None = None
    """
    The name of the project in the code repository.
    """
    integrationArn: str | None = None
    """
    The Amazon Resource Name (ARN) of the code security integration associated with the
    repository.
    """
    providerType: Literal["GITHUB", "GITLAB_SELF_MANAGED"] | None = None
    """
    The type of repository provider (such as GitHub, GitLab, etc.).
    """


class ResourceDetails(Boto3Model):
    """
    Contains details about the resource involved in the finding.
    """

    awsEc2Instance: AwsEc2InstanceDetails | None = None
    """
    An object that contains details about the Amazon EC2 instance involved in the
    finding.
    """
    awsEcrContainerImage: AwsEcrContainerImageDetails | None = None
    """
    An object that contains details about the Amazon ECR container image involved in the
    finding.
    """
    awsLambdaFunction: AwsLambdaFunctionDetails | None = None
    """
    A summary of the information about an Amazon Web Services Lambda function affected
    by a finding.
    """
    codeRepository: CodeRepositoryDetails | None = None
    """
    Contains details about a code repository resource associated with a finding.
    """


class Inspector2Resource(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.
    """
    type: Literal[
        "AWS_EC2_INSTANCE",
        "AWS_ECR_CONTAINER_IMAGE",
        "AWS_ECR_REPOSITORY",
        "AWS_LAMBDA_FUNCTION",
        "CODE_REPOSITORY",
    ]
    """
    The type of resource.
    """
    id: str
    """
    The ID of the resource.
    """
    partition: str | None = None
    """
    The partition of the resource.
    """
    region: str | None = None
    """
    The Amazon Web Services Region the impacted resource is located in.
    """
    details: ResourceDetails | None = None
    """
    An object that contains details about the resource involved in a finding.
    """


class CvssScoreAdjustment(Boto3Model):
    """
    Details on adjustments Amazon Inspector made to the CVSS score for a finding.
    """

    metric: str
    """
    The metric used to adjust the CVSS score.
    """
    reason: str
    """
    The reason the CVSS score has been adjustment.
    """


class CvssScoreDetails(Boto3Model):
    """
    Information about the CVSS score.
    """

    scoreSource: str
    """
    The source for the CVSS score.
    """
    cvssSource: str | None = None
    """
    The source of the CVSS data.
    """
    version: str
    """
    The CVSS version used in scoring.
    """
    score: float
    """
    The CVSS score.
    """
    scoringVector: str
    """
    The vector for the CVSS score.
    """
    adjustments: List["CvssScoreAdjustment"] | None = None
    """
    An object that contains details about adjustment Amazon Inspector made to the CVSS
    score.
    """


class InspectorScoreDetails(Boto3Model):
    """
    Information about the Amazon Inspector score given to a finding.
    """

    adjustedCvss: CvssScoreDetails | None = None
    """
    An object that contains details about the CVSS score given to a finding.
    """


class PortRange(Boto3Model):
    """
    Details about the port range associated with a finding.
    """

    begin: int
    """
    The beginning port in a port range.
    """
    end: int
    """
    The ending port in a port range.
    """


class Step(Boto3Model):
    """
    Details about the step associated with a finding.
    """

    componentId: str
    """
    The component ID.
    """
    componentType: str
    """
    The component type.
    """
    componentArn: str | None = None
    """
    The component ARN.

    The ARN can be null and is not displayed in the Amazon Web Services console.
    """


class NetworkPath(Boto3Model):
    """
    Information on the network path associated with a finding.
    """

    steps: List["Step"] | None = None
    """
    The details on the steps in the network path.
    """


class NetworkReachabilityDetails(Boto3Model):
    """
    Contains the details of a network reachability finding.
    """

    openPortRange: PortRange
    """
    An object that contains details about the open port range associated with a finding.
    """
    protocol: Literal["TCP", "UDP"]
    """
    The protocol associated with a finding.
    """
    networkPath: NetworkPath
    """
    An object that contains details about a network path associated with a finding.
    """


class VulnerablePackage(Boto3Model):
    """
    Information on the vulnerable package identified by a finding.
    """

    packageManager: Literal["BUNDLER", "CARGO", "COMPOSER", "NPM", "NUGET", "PIPENV", "POETRY", "YARN", "GOBINARY", "GOMOD", "JAR", "OS", "PIP", "PYTHONPKG", "NODEPKG", "POM", "GEMSPEC", "DOTNET_CORE", "PYTHON", "RUST", "RUBY", "GOLANG", "JAVA", "NODEJS", "PHP", "DOTNET", "DOTNET5", "DOTNET6", "DOTNET7", "GENERIC"] | None = None
    """
    The package manager of the vulnerable package.
    """
    name: str
    """
    The name of the vulnerable package.
    """
    version: str
    """
    The version of the vulnerable package.
    """
    sourceLayerHash: str | None = None
    """
    The source layer hash of the vulnerable package.
    """
    epoch: int | None = None
    """
    The epoch of the vulnerable package.
    """
    release: str | None = None
    """
    The release of the vulnerable package.
    """
    arch: str | None = None
    """
    The architecture of the vulnerable package.
    """
    filePath: str | None = None
    """
    The file path of the vulnerable package.
    """
    fixedInVersion: str | None = None
    """
    The version of the package that contains the vulnerability fix.
    """
    remediation: str | None = None
    """
    The code to run in your environment to update packages with a fix available.
    """
    sourceLambdaLayerArn: str | None = None
    """
    The Amazon Resource Number (ARN) of the Amazon Web Services Lambda function affected
    by a finding.
    """


class CvssScore(Boto3Model):
    """
    The CVSS score for a finding.
    """

    baseScore: float
    """
    The base CVSS score used for the finding.
    """
    scoringVector: str
    """
    The vector string of the CVSS score.
    """
    version: str
    """
    The version of CVSS used for the score.
    """
    source: str
    """
    The source of the CVSS score.
    """


class PackageVulnerabilityDetails(Boto3Model):
    """
    Information about a package vulnerability finding.
    """

    vulnerabilityId: str
    """
    The ID given to this vulnerability.
    """
    vulnerablePackages: List["VulnerablePackage"] | None = None
    """
    The packages impacted by this vulnerability.
    """
    source: str
    """
    The source of the vulnerability information.
    """
    cvss: List["CvssScore"] | None = None
    """
    An object that contains details about the CVSS score of a finding.
    """
    relatedVulnerabilities: List[str] | None = None
    """
    One or more vulnerabilities related to the one identified in this finding.
    """
    sourceUrl: str | None = None
    """
    A URL to the source of the vulnerability information.
    """
    vendorSeverity: str | None = None
    """
    The severity the vendor has given to this vulnerability type.
    """
    vendorCreatedAt: datetime | None = None
    """
    The date and time that this vulnerability was first added to the vendor's database.
    """
    vendorUpdatedAt: datetime | None = None
    """
    The date and time the vendor last updated this vulnerability in their database.
    """
    referenceUrls: List[str] | None = None
    """
    One or more URLs that contain details about this vulnerability type.
    """


class ExploitabilityDetails(Boto3Model):
    """
    The details of an exploit available for a finding discovered in your environment.
    """

    lastKnownExploitAt: datetime | None = None
    """
    The date and time of the last exploit associated with a finding discovered in your
    environment.
    """


class CodeFilePath(Boto3Model):
    """
    Contains information on where a code vulnerability is located in your Lambda
    function.
    """

    fileName: str
    """
    The name of the file the code vulnerability was found in.
    """
    filePath: str
    """
    The file path to the code that a vulnerability was found in.
    """
    startLine: int
    """
    The line number of the first line of code that a vulnerability was found in.
    """
    endLine: int
    """
    The line number of the last line of code that a vulnerability was found in.
    """


class CodeVulnerabilityDetails(Boto3Model):
    """
    Contains information on the code vulnerability identified in your Lambda function.
    """

    filePath: CodeFilePath
    """
    Contains information on where the code vulnerability is located in your code.
    """
    detectorTags: List[str] | None = None
    """
    The detector tag associated with the vulnerability.

    Detector tags group related vulnerabilities by common themes or tactics. For a list
    of available tags by programming language, see
    `Java tags <https://docs.aws.amazon.com/codeguru/detector-library/java/tags/>`_,
    or
    `Python tags <https://docs.aws.amazon.com/codeguru/detector-library/python/tags/>`_.
    """
    referenceUrls: List[str] | None = None
    """
    A URL containing supporting documentation about the code vulnerability detected.
    """
    ruleId: str | None = None
    """
    The identifier for a rule that was used to detect the code vulnerability.
    """
    sourceLambdaLayerArn: str | None = None
    """
    The Amazon Resource Name (ARN) of the Lambda layer that the code vulnerability was
    detected in.
    """
    detectorId: str
    """
    The ID for the Amazon CodeGuru detector associated with the finding.

    For more information on detectors see
    `Amazon CodeGuru Detector Library <https://docs.aws.amazon.com/codeguru/detector-library>`_.
    """
    detectorName: str
    """
    The name of the detector used to identify the code vulnerability.

    For more information on detectors see
    `CodeGuru Detector Library <https://docs.aws.amazon.com/codeguru/detector-library>`_.
    """
    cwes: List[str]
    """
    The Common Weakness Enumeration (CWE) item associated with the detected
    vulnerability.
    """


class EpssDetails(Boto3Model):
    """
    Details about the Exploit Prediction Scoring System (EPSS) score for a finding.
    """

    score: float | None = None
    """
    The EPSS score.
    """


class Finding(ReadonlyPrimaryBoto3Model):
    """
    Details about an Amazon Inspector finding.
    """

    manager_class: ClassVar[Type[Boto3ModelManager]] = FindingManager

    findingArn: str
    """
    The Amazon Resource Number (ARN) of the finding.
    """
    awsAccountId: str
    """
    The Amazon Web Services account ID associated with the finding.
    """
    type: Literal["NETWORK_REACHABILITY", "PACKAGE_VULNERABILITY", "CODE_VULNERABILITY"]
    """
    The type of the finding.

    The ``type`` value determines the valid values for ``resource`` in your request. For more
    information, see `Finding types <https://docs.aws.amazon.com/inspector/latest/user/findings-types.html>`_ in the Amazon
    Inspector user guide.
    """
    description: str
    """
    The description of the finding.
    """
    title: str | None = None
    """
    The title of the finding.
    """
    remediation: Remediation
    """
    An object that contains the details about how to remediate a finding.
    """
    severity: Literal["INFORMATIONAL", "LOW", "MEDIUM", "HIGH", "CRITICAL", "UNTRIAGED"]
    """
    The severity of the finding.

    ``UNTRIAGED`` applies to ``PACKAGE_VULNERABILITY`` type findings that the vendor has not
    assigned a severity yet. For more information, see `Severity levels for
    findings <https://docs.aws.amazon.com/inspector/latest/user/findings-understanding-severity.html>`_ in the Amazon
    Inspector user guide.
    """
    firstObservedAt: datetime
    """
    The date and time that the finding was first observed.
    """
    lastObservedAt: datetime
    """
    The date and time the finding was last observed.

    This timestamp for this field remains unchanged until a finding is updated.
    """
    updatedAt: datetime | None = None
    """
    The date and time the finding was last updated at.
    """
    status: Literal["ACTIVE", "SUPPRESSED", "CLOSED"]
    """
    The status of the finding.
    """
    resources: List["Inspector2Resource"]
    """
    Contains information on the resources involved in a finding.

    The ``resource`` value determines the valid values for
    ``type`` in your request. For more information, see `Finding
    types <https://docs.aws.amazon.com/inspector/latest/user/findings-types.html>`_ in the Amazon Inspector user guide.
    """
    inspectorScore: float | None = None
    """
    The Amazon Inspector score given to the finding.
    """
    inspectorScoreDetails: InspectorScoreDetails | None = None
    """
    An object that contains details of the Amazon Inspector score.
    """
    networkReachabilityDetails: NetworkReachabilityDetails | None = None
    """
    An object that contains the details of a network reachability finding.
    """
    packageVulnerabilityDetails: PackageVulnerabilityDetails | None = None
    """
    An object that contains the details of a package vulnerability finding.
    """
    fixAvailable: Literal["YES", "NO", "PARTIAL"] | 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: Literal["YES", "NO"] | None = None
    """
    If a finding discovered in your environment has an exploit available.
    """
    exploitabilityDetails: ExploitabilityDetails | None = None
    """
    The details of an exploit available for a finding discovered in your environment.
    """
    codeVulnerabilityDetails: CodeVulnerabilityDetails | None = None
    """
    Details about the code vulnerability identified in a Lambda function used to filter
    findings.
    """
    epss: EpssDetails | None = None
    """
    The finding's EPSS score.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`findingArn` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.findingArn

    @property
    def arn(self) -> str | None:
        """
        Return the ARN of the model.   This is the value of the :py:attr:`findingArn`
        attribute.

        Returns:
            The ARN of the model instance.
        """
        return self.findingArn

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`findingArn` attribute.
        """
        return hash(self.findingArn)


class FindingsReport(ReadonlyPrimaryBoto3Model):
    manager_class: ClassVar[Type[Boto3ModelManager]] = FindingsReportManager

    reportId: str = None
    """
    The ID of the report.
    """
    reportFormat: Literal["CSV", "JSON"]
    """
    The format of the report.
    """
    s3Destination: "Destination"
    """
    Info about the S3 bucket to which to send the report.
    """
    filterCriteria: Optional["FilterCriteria"] = None
    """
    The criteria for the report.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`reportId` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.reportId

    @property
    def arn(self) -> str | None:
        """
        Return the ARN of the model.   This is the value of the :py:attr:`reportId`
        attribute.

        Returns:
            The ARN of the model instance.
        """
        return self.reportId

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`reportId` attribute.
        """
        return hash(self.reportId)


class DelegatedAdminAccount(ReadonlyPrimaryBoto3Model):
    """
    Details of the Amazon Inspector delegated administrator for your organization.
    """

    manager_class: ClassVar[Type[Boto3ModelManager]] = DelegatedAdminAccountManager

    status: Literal["ENABLED", "DISABLE_IN_PROGRESS"] | None = None
    """
    The status of the Amazon Inspector delegated administrator.
    """
    accountId: str | None = None
    """
    The Amazon Web Services account ID of the Amazon Inspector delegated administrator
    for your organization.
    """
    relationshipStatus: Literal["CREATED", "INVITED", "DISABLED", "ENABLED", "REMOVED", "RESIGNED", "DELETED", "EMAIL_VERIFICATION_IN_PROGRESS", "EMAIL_VERIFICATION_FAILED", "REGION_DISABLED", "ACCOUNT_SUSPENDED", "CANNOT_CREATE_DETECTOR_IN_ORG_MASTER"] | None = None
    """
    The status of the relationship.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`accountId` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.accountId

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`accountId` attribute.
        """
        return hash(self.accountId)

    def enable(self) -> "str":
        """
        Enable a delegated admin account.
        """

        return (
            cast("DelegatedAdminAccountManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .enable(
                cast("str", self.accountId),
            )
        )

    def disable(self) -> "str":
        """
        Disable a delegated admin account.
        """

        return (
            cast("DelegatedAdminAccountManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .disable(
                cast("str", self.accountId),
            )
        )


class CisaData(Boto3Model):
    """
    The Cybersecurity and Infrastructure Security Agency (CISA) details for a specific
    vulnerability.
    """

    dateAdded: datetime | None = None
    """
    The date and time CISA added this vulnerability to their catalogue.
    """
    dateDue: datetime | None = None
    """
    The date and time CISA expects a fix to have been provided vulnerability.
    """
    action: str | None = None
    """
    The remediation action recommended by CISA for this vulnerability.
    """


class AtigData(Boto3Model):
    """
    The Amazon Web Services Threat Intel Group (ATIG) details for a specific
    vulnerability.
    """

    firstSeen: datetime | None = None
    """
    The date and time this vulnerability was first observed.
    """
    lastSeen: datetime | None = None
    """
    The date and time this vulnerability was last observed.
    """
    targets: List[str] | None = None
    """
    The commercial sectors this vulnerability targets.
    """
    ttps: List[str] | None = None
    """
The `MITRE ATT&CK <https://attack.mitre.org/>`_ tactics, techniques, and procedures (TTPs) associated with vulnerability.
    """


class Cvss4(Boto3Model):
    """
    The Common Vulnerability Scoring System (CVSS) version 4 details for the
    vulnerability.
    """

    baseScore: float | None = None
    """
    The base CVSS v4 score for the vulnerability finding, which rates the severity of
    the vulnerability on a scale from 0 to 10.
    """
    scoringVector: str | None = None
    """
    The CVSS v4 scoring vector, which contains the metrics and measurements that were
    used to calculate the base score.
    """


class Cvss3(Boto3Model):
    """
    The Common Vulnerability Scoring System (CVSS) version 3 details for the
    vulnerability.
    """

    baseScore: float | None = None
    """
    The CVSS v3 base score for the vulnerability.
    """
    scoringVector: str | None = None
    """
    The scoring vector associated with the CVSS v3 score.
    """


class Cvss2(Boto3Model):
    """
    The Common Vulnerability Scoring System (CVSS) version 2 details for the
    vulnerability.
    """

    baseScore: float | None = None
    """
    The CVSS v2 base score for the vulnerability.
    """
    scoringVector: str | None = None
    """
    The scoring vector associated with the CVSS v2 score.
    """


class ExploitObserved(Boto3Model):
    """
    Contains information on when this exploit was observed.
    """

    lastSeen: datetime | None = None
    """
    The date an time when the exploit was last seen.
    """
    firstSeen: datetime | None = None
    """
    The date an time when the exploit was first seen.
    """


class Epss(Boto3Model):
    """
    Details about the Exploit Prediction Scoring System (EPSS) score.
    """

    score: float | None = None
    """
    The Exploit Prediction Scoring System (EPSS) score.
    """


class Vulnerability(ReadonlyPrimaryBoto3Model):
    """
    Contains details about a specific vulnerability Amazon Inspector can detect.
    """

    manager_class: ClassVar[Type[Boto3ModelManager]] = VulnerabilityManager

    id: str
    """
    The ID for the specific vulnerability.
    """
    cwes: List[str] | None = None
    """
    The Common Weakness Enumeration (CWE) associated with the vulnerability.
    """
    cisaData: CisaData | None = None
    """
    An object that contains the Cybersecurity and Infrastructure Security Agency (CISA)
    details for the vulnerability.
    """
    source: Literal["NVD"] | None = None
    """
    The source of the vulnerability information.

    Possible results are ``RHEL``, ``AMAZON_CVE``, ``DEBIAN`` or ``NVD``.
    """
    description: str | None = None
    """
    A description of the vulnerability.
    """
    atigData: AtigData | None = None
    """
    An object that contains information about the Amazon Web Services Threat Intel Group
    (ATIG) details for the vulnerability.
    """
    vendorSeverity: str | None = None
    """
    The severity assigned by the vendor.
    """
    cvss4: Cvss4 | None = None
    """
    An object that contains the Common Vulnerability Scoring System (CVSS) Version 4
    details for the vulnerability.
    """
    cvss3: Cvss3 | None = None
    """
    An object that contains the Common Vulnerability Scoring System (CVSS) Version 3
    details for the vulnerability.
    """
    relatedVulnerabilities: List[str] | None = None
    """
    A list of related vulnerabilities.
    """
    cvss2: Cvss2 | None = None
    """
    An object that contains the Common Vulnerability Scoring System (CVSS) Version 2
    details for the vulnerability.
    """
    vendorCreatedAt: datetime | None = None
    """
    The date and time when the vendor created this vulnerability.
    """
    vendorUpdatedAt: datetime | None = None
    """
    The date and time when the vendor last updated this vulnerability.
    """
    sourceUrl: str | None = None
    """
    A link to the official source material for this vulnerability.
    """
    referenceUrls: List[str] | None = None
    """
    Links to various resources with more information on this vulnerability.
    """
    exploitObserved: ExploitObserved | None = None
    """
    An object that contains details on when the exploit was observed.
    """
    detectionPlatforms: List[str] | None = None
    """
    Platforms that the vulnerability can be detected on.
    """
    epss: Epss | None = None
    """
    An object that contains the Exploit Prediction Scoring System (EPSS) score for a
    vulnerability.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the :py:attr:`id`
        attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.id

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`id` attribute.
        """
        return hash(self.id)


# =======================
# Request/Response Models
# =======================


class CreateCisTargets(Boto3Model):
    """
    Creates CIS targets.
    """

    accountIds: List[str]
    """
    The CIS target account ids.
    """
    targetResourceTags: Dict[str, List[str]]
    """
    The CIS target resource tags.
    """


class CreateCisScanConfigurationResponse(Boto3Model):
    scanConfigurationArn: str | None = None
    """
    The scan configuration ARN for the CIS scan configuration.
    """


class DeleteCisScanConfigurationResponse(Boto3Model):
    scanConfigurationArn: str
    """
    The ARN of the CIS scan configuration.
    """


class UpdateCisTargets(Boto3Model):
    """
    Updates CIS targets.
    """

    accountIds: List[str] | None = None
    """
    The target account ids.
    """
    targetResourceTags: Dict[str, List[str]] | None = None
    """
    The target resource tags.
    """


class UpdateCisScanConfigurationResponse(Boto3Model):
    scanConfigurationArn: str
    """
    The CIS scan configuration ARN.
    """


class CisStringFilter(Boto3Model):
    """
    The CIS string filter.
    """

    comparison: Literal["EQUALS", "PREFIX", "NOT_EQUALS"]
    """
    The comparison value of the CIS string filter.
    """
    value: str
    """
    The value of the CIS string filter.
    """


class TagFilter(Boto3Model):
    """
    The tag filter.
    """

    comparison: Literal["EQUALS"]
    """
    The tag filter comparison value.
    """
    key: str
    """
    The tag filter key.
    """
    value: str
    """
    The tag filter value.
    """


class ListCisScanConfigurationsFilterCriteria(Boto3Model):
    """
    A list of CIS scan configurations filter criteria.
    """

    scanNameFilters: List["CisStringFilter"] | None = None
    """
    The list of scan name filters.
    """
    targetResourceTagFilters: List["TagFilter"] | None = None
    """
    The list of target resource tag filters.
    """
    scanConfigurationArnFilters: List["CisStringFilter"] | None = None
    """
    The list of scan configuration ARN filters.
    """


class ListCisScanConfigurationsResponse(Boto3Model):
    scanConfigurations: List["CisScanConfiguration"] | None = None
    """
    The CIS scan configuration scan configurations.
    """
    nextToken: str | None = None
    """
    The pagination token from a previous request that's used to retrieve the next page
    of results.
    """


class CreateFilterResponse(Boto3Model):
    arn: str
    """
    The Amazon Resource Number (ARN) of the successfully created filter.
    """


class DeleteFilterResponse(Boto3Model):
    arn: str
    """
    The Amazon Resource Number (ARN) of the filter that has been deleted.
    """


class UpdateFilterResponse(Boto3Model):
    arn: str
    """
    The Amazon Resource Number (ARN) of the successfully updated filter.
    """


class ListFiltersResponse(Boto3Model):
    filters: List["Inspector2Filter"]
    """
    Contains details on the filters associated with your account.
    """
    nextToken: str | None = None
    """
    A token to use for paginating results that are returned in the response.

    Set the value of this parameter to null for the
    first request to a list action. For subsequent calls, use the ``NextToken`` value returned from the previous request to
    continue listing results after the first page.
    """


class SortCriteria(Boto3Model):
    """
    Details about the criteria used to sort finding results.
    """

    field: Literal[
        "AWS_ACCOUNT_ID",
        "FINDING_TYPE",
        "SEVERITY",
        "FIRST_OBSERVED_AT",
        "LAST_OBSERVED_AT",
        "FINDING_STATUS",
        "RESOURCE_TYPE",
        "ECR_IMAGE_PUSHED_AT",
        "ECR_IMAGE_REPOSITORY_NAME",
        "ECR_IMAGE_REGISTRY",
        "NETWORK_PROTOCOL",
        "COMPONENT_TYPE",
        "VULNERABILITY_ID",
        "VULNERABILITY_SOURCE",
        "INSPECTOR_SCORE",
        "VENDOR_SEVERITY",
        "EPSS_SCORE",
    ]
    """
    The finding detail field by which results are sorted.
    """
    sortOrder: Literal["ASC", "DESC"]
    """
    The order by which findings are sorted.
    """


class ListFindingsResponse(Boto3Model):
    nextToken: str | None = None
    """
    A token to use for paginating results that are returned in the response.

    Set the value of this parameter to null for the
    first request to a list action. For subsequent calls, use the ``NextToken`` value returned from the previous request to
    continue listing results after the first page.
    """
    findings: List["Finding"] | None = None
    """
    Contains details on the findings in your environment.
    """


class AccountAggregation(Boto3Model):
    """
    An object that contains details about an aggregation response based on Amazon Web
    Services accounts.
    """

    findingType: Literal["NETWORK_REACHABILITY", "PACKAGE_VULNERABILITY", "CODE_VULNERABILITY"] | None = None
    """
    The type of finding.
    """
    resourceType: Literal["AWS_EC2_INSTANCE", "AWS_ECR_CONTAINER_IMAGE", "AWS_LAMBDA_FUNCTION", "CODE_REPOSITORY"] | None = None
    """
    The type of resource.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The sort order (ascending or descending).
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL"] | None = None
    """
    The value to sort by.
    """


class AmiAggregation(Boto3Model):
    """
    The details that define an aggregation based on Amazon machine images (AMIs).
    """

    amis: List["StringFilter"] | None = None
    """
    The IDs of AMIs to aggregate findings for.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The order to sort results by.
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL", "AFFECTED_INSTANCES"] | None = None
    """
    The value to sort results by.
    """


class AwsEcrContainerAggregation(Boto3Model):
    """
    An aggregation of information about Amazon ECR containers.
    """

    resourceIds: List["StringFilter"] | None = None
    """
    The container resource IDs.
    """
    imageShas: List["StringFilter"] | None = None
    """
    The image SHA values.
    """
    repositories: List["StringFilter"] | None = None
    """
    The container repositories.
    """
    architectures: List["StringFilter"] | None = None
    """
    The architecture of the containers.
    """
    imageTags: List["StringFilter"] | None = None
    """
    The image tags.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The sort order (ascending or descending).
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL"] | None = None
    """
    The value to sort by.
    """
    lastInUseAt: List["DateFilter"] | None = None
    """
    The last time an Amazon ECR image was used in an Amazon ECS task or Amazon EKS pod.
    """
    inUseCount: List["NumberFilter"] | None = None
    """
    The number of Amazon ECS tasks or Amazon EKS pods where the Amazon ECR container
    image is in use.
    """


class Ec2InstanceAggregation(Boto3Model):
    """
    The details that define an aggregation based on Amazon EC2 instances.
    """

    amis: List["StringFilter"] | None = None
    """
    The AMI IDs associated with the Amazon EC2 instances to aggregate findings for.
    """
    operatingSystems: List["StringFilter"] | None = None
    """
    The operating system types to aggregate findings for.

    Valid values must be uppercase and underscore separated, examples
    are ``ORACLE_LINUX_7`` and ``ALPINE_LINUX_3_8``.
    """
    instanceIds: List["StringFilter"] | None = None
    """
    The Amazon EC2 instance IDs to aggregate findings for.
    """
    instanceTags: List["MapFilter"] | None = None
    """
    The Amazon EC2 instance tags to aggregate findings for.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The order to sort results by.
    """
    sortBy: Literal["NETWORK_FINDINGS", "CRITICAL", "HIGH", "ALL"] | None = None
    """
    The value to sort results by.
    """


class FindingTypeAggregation(Boto3Model):
    """
    The details that define an aggregation based on finding type.
    """

    findingType: Literal["NETWORK_REACHABILITY", "PACKAGE_VULNERABILITY", "CODE_VULNERABILITY"] | None = None
    """
    The finding type to aggregate.
    """
    resourceType: Literal["AWS_EC2_INSTANCE", "AWS_ECR_CONTAINER_IMAGE", "AWS_LAMBDA_FUNCTION", "CODE_REPOSITORY"] | None = None
    """
    The resource type to aggregate.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The order to sort results by.
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL"] | None = None
    """
    The value to sort results by.
    """


class ImageLayerAggregation(Boto3Model):
    """
    The details that define an aggregation based on container image layers.
    """

    repositories: List["StringFilter"] | None = None
    """
    The repository associated with the container image hosting the layers.
    """
    resourceIds: List["StringFilter"] | None = None
    """
    The ID of the container image layer.
    """
    layerHashes: List["StringFilter"] | None = None
    """
    The hashes associated with the layers.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The order to sort results by.
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL"] | None = None
    """
    The value to sort results by.
    """


class PackageAggregation(Boto3Model):
    """
    The details that define an aggregation based on operating system package type.
    """

    packageNames: List["StringFilter"] | None = None
    """
    The names of packages to aggregate findings on.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The order to sort results by.
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL"] | None = None
    """
    The value to sort results by.
    """


class RepositoryAggregation(Boto3Model):
    """
    The details that define an aggregation based on repository.
    """

    repositories: List["StringFilter"] | None = None
    """
    The names of repositories to aggregate findings on.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The order to sort results by.
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL", "AFFECTED_IMAGES"] | None = None
    """
    The value to sort results by.
    """


class TitleAggregation(Boto3Model):
    """
    The details that define an aggregation based on finding title.
    """

    titles: List["StringFilter"] | None = None
    """
    The finding titles to aggregate on.
    """
    vulnerabilityIds: List["StringFilter"] | None = None
    """
    The vulnerability IDs of the findings.
    """
    resourceType: Literal["AWS_EC2_INSTANCE", "AWS_ECR_CONTAINER_IMAGE", "AWS_LAMBDA_FUNCTION", "CODE_REPOSITORY"] | None = None
    """
    The resource type to aggregate on.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The order to sort results by.
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL"] | None = None
    """
    The value to sort results by.
    """
    findingType: Literal["NETWORK_REACHABILITY", "PACKAGE_VULNERABILITY", "CODE_VULNERABILITY"] | None = None
    """
    The type of finding to aggregate on.
    """


class LambdaLayerAggregation(Boto3Model):
    """
    The details that define a findings aggregation based on an Amazon Web Services
    Lambda function's layers.
    """

    functionNames: List["StringFilter"] | None = None
    """
    The names of the Amazon Web Services Lambda functions associated with the layers.
    """
    resourceIds: List["StringFilter"] | None = None
    """
    The resource IDs for the Amazon Web Services Lambda function layers.
    """
    layerArns: List["StringFilter"] | None = None
    """
    The Amazon Resource Name (ARN) of the Amazon Web Services Lambda function layer.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The order to use for sorting the results.
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL"] | None = None
    """
    The finding severity to use for sorting the results.
    """


class LambdaFunctionAggregation(Boto3Model):
    """
    The details that define a findings aggregation based on Amazon Web Services Lambda
    functions.
    """

    resourceIds: List["StringFilter"] | None = None
    """
    The resource IDs to include in the aggregation results.
    """
    functionNames: List["StringFilter"] | None = None
    """
    The Amazon Web Services Lambda function names to include in the aggregation results.
    """
    runtimes: List["StringFilter"] | None = None
    """
    Returns findings aggregated by Amazon Web Services Lambda function runtime
    environments.
    """
    functionTags: List["MapFilter"] | None = None
    """
    The tags to include in the aggregation results.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The order to use for sorting the results.
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL"] | None = None
    """
    The finding severity to use for sorting the results.
    """


class CodeRepositoryAggregation(Boto3Model):
    """
    The details that define an aggregation based on code repositories.
    """

    projectNames: List["StringFilter"] | None = None
    """
    The project names to include in the aggregation results.
    """
    providerTypes: List["StringFilter"] | None = None
    """
    The repository provider types to include in the aggregation results.
    """
    sortOrder: Literal["ASC", "DESC"] | None = None
    """
    The order to sort results by (ascending or descending) in the code repository
    aggregation.
    """
    sortBy: Literal["CRITICAL", "HIGH", "ALL"] | None = None
    """
    The value to sort results by in the code repository aggregation.
    """
    resourceIds: List["StringFilter"] | None = None
    """
    The resource IDs to include in the aggregation results.
    """


class AggregationRequest(Boto3Model):
    """
    Contains details about an aggregation request.
    """

    accountAggregation: AccountAggregation | None = None
    """
    An object that contains details about an aggregation request based on Amazon Web
    Services account IDs.
    """
    amiAggregation: AmiAggregation | None = None
    """
    An object that contains details about an aggregation request based on Amazon Machine
    Images (AMIs).
    """
    awsEcrContainerAggregation: AwsEcrContainerAggregation | None = None
    """
    An object that contains details about an aggregation request based on Amazon ECR
    container images.
    """
    ec2InstanceAggregation: Ec2InstanceAggregation | None = None
    """
    An object that contains details about an aggregation request based on Amazon EC2
    instances.
    """
    findingTypeAggregation: FindingTypeAggregation | None = None
    """
    An object that contains details about an aggregation request based on finding types.
    """
    imageLayerAggregation: ImageLayerAggregation | None = None
    """
    An object that contains details about an aggregation request based on container
    image layers.
    """
    packageAggregation: PackageAggregation | None = None
    """
    An object that contains details about an aggregation request based on operating
    system package type.
    """
    repositoryAggregation: RepositoryAggregation | None = None
    """
    An object that contains details about an aggregation request based on Amazon ECR
    repositories.
    """
    titleAggregation: TitleAggregation | None = None
    """
    An object that contains details about an aggregation request based on finding title.
    """
    lambdaLayerAggregation: LambdaLayerAggregation | None = None
    """
    Returns an object with findings aggregated by Amazon Web Services Lambda layer.
    """
    lambdaFunctionAggregation: LambdaFunctionAggregation | None = None
    """
    Returns an object with findings aggregated by Amazon Web Services Lambda function.
    """
    codeRepositoryAggregation: CodeRepositoryAggregation | None = None
    """
    An object that contains details about an aggregation request based on code
    repositories.
    """


class SeverityCounts(Boto3Model):
    """
    An object that contains the counts of aggregated finding per severity.
    """

    all: int | None = None
    """
    The total count of findings from all severities.
    """
    medium: int | None = None
    """
    The total count of medium severity findings.
    """
    high: int | None = None
    """
    The total count of high severity findings.
    """
    critical: int | None = None
    """
    The total count of critical severity findings.
    """


class AccountAggregationResponse(Boto3Model):
    """
    An aggregation of findings by Amazon Web Services account ID.
    """

    accountId: str | None = None
    """
    The Amazon Web Services account ID.
    """
    severityCounts: SeverityCounts | None = None
    """
    The number of findings by severity.
    """
    exploitAvailableCount: int | None = None
    """
    The number of findings that have an exploit available.
    """
    fixAvailableCount: int | None = None
    """
    Details about the number of fixes.
    """


class AmiAggregationResponse(Boto3Model):
    """
    A response that contains the results of a finding aggregation by AMI.
    """

    ami: str
    """
    The ID of the AMI that findings were aggregated for.
    """
    accountId: str | None = None
    """
    The Amazon Web Services account ID for the AMI.
    """
    severityCounts: SeverityCounts | None = None
    """
    An object that contains the count of matched findings per severity.
    """
    affectedInstances: int | None = None
    """
    The IDs of Amazon EC2 instances using this AMI.
    """


class AwsEcrContainerAggregationResponse(Boto3Model):
    """
    An aggregation of information about Amazon ECR containers.
    """

    resourceId: str
    """
    The resource ID of the container.
    """
    imageSha: str | None = None
    """
    The SHA value of the container image.
    """
    repository: str | None = None
    """
    The container repository.
    """
    architecture: str | None = None
    """
    The architecture of the container.
    """
    imageTags: List[str] | None = None
    """
    The container image stags.
    """
    accountId: str | None = None
    """
    The Amazon Web Services account ID of the account that owns the container.
    """
    severityCounts: SeverityCounts | None = None
    """
    The number of finding by severity.
    """
    lastInUseAt: datetime | None = None
    """
    The last time an Amazon ECR image was used in an Amazon ECS task or Amazon EKS pod.
    """
    inUseCount: int | None = None
    """
    The number of Amazon ECS tasks or Amazon EKS pods where the Amazon ECR container
    image is in use.
    """


class Ec2InstanceAggregationResponse(Boto3Model):
    """
    A response that contains the results of a finding aggregation by Amazon EC2
    instance.
    """

    instanceId: str
    """
    The Amazon EC2 instance ID.
    """
    ami: str | None = None
    """
    The Amazon Machine Image (AMI) of the Amazon EC2 instance.
    """
    operatingSystem: str | None = None
    """
    The operating system of the Amazon EC2 instance.
    """
    instanceTags: Dict[str, str] | None = None
    """
    The tags attached to the instance.
    """
    accountId: str | None = None
    """
    The Amazon Web Services account for the Amazon EC2 instance.
    """
    severityCounts: SeverityCounts | None = None
    """
    An object that contains the count of matched findings per severity.
    """
    networkFindings: int | None = None
    """
    The number of network findings for the Amazon EC2 instance.
    """


class FindingTypeAggregationResponse(Boto3Model):
    """
    A response that contains the results of a finding type aggregation.
    """

    accountId: str | None = None
    """
    The ID of the Amazon Web Services account associated with the findings.
    """
    severityCounts: SeverityCounts | None = None
    """
    The value to sort results by.
    """
    exploitAvailableCount: int | None = None
    """
    The number of findings that have an exploit available.
    """
    fixAvailableCount: int | None = None
    """
    Details about the number of fixes.
    """


class ImageLayerAggregationResponse(Boto3Model):
    """
    A response that contains the results of a finding aggregation by image layer.
    """

    repository: str
    """
    The repository the layer resides in.
    """
    resourceId: str
    """
    The resource ID of the container image layer.
    """
    layerHash: str
    """
    The layer hash.
    """
    accountId: str
    """
    The ID of the Amazon Web Services account that owns the container image hosting the
    layer image.
    """
    severityCounts: SeverityCounts | None = None
    """
    An object that represents the count of matched findings per severity.
    """


class PackageAggregationResponse(Boto3Model):
    """
    A response that contains the results of a finding aggregation by image layer.
    """

    packageName: str
    """
    The name of the operating system package.
    """
    accountId: str | None = None
    """
    The ID of the Amazon Web Services account associated with the findings.
    """
    severityCounts: SeverityCounts | None = None
    """
    An object that contains the count of matched findings per severity.
    """


class RepositoryAggregationResponse(Boto3Model):
    """
    A response that contains details on the results of a finding aggregation by
    repository.
    """

    repository: str
    """
    The name of the repository associated with the findings.
    """
    accountId: str | None = None
    """
    The ID of the Amazon Web Services account associated with the findings.
    """
    severityCounts: SeverityCounts | None = None
    """
    An object that represent the count of matched findings per severity.
    """
    affectedImages: int | None = None
    """
    The number of container images impacted by the findings.
    """


class TitleAggregationResponse(Boto3Model):
    """
    A response that contains details on the results of a finding aggregation by title.
    """

    title: str
    """
    The title that the findings were aggregated on.
    """
    vulnerabilityId: str | None = None
    """
    The vulnerability ID of the finding.
    """
    accountId: str | None = None
    """
    The ID of the Amazon Web Services account associated with the findings.
    """
    severityCounts: SeverityCounts | None = None
    """
    An object that represent the count of matched findings per severity.
    """


class LambdaLayerAggregationResponse(Boto3Model):
    """
    A response that contains the results of an Amazon Web Services Lambda function layer
    finding aggregation.
    """

    functionName: str
    """
    The names of the Amazon Web Services Lambda functions associated with the layers.
    """
    resourceId: str
    """
    The Resource ID of the Amazon Web Services Lambda function layer.
    """
    layerArn: str
    """
    The Amazon Resource Name (ARN) of the Amazon Web Services Lambda function layer.
    """
    accountId: str
    """
    The account ID of the Amazon Web Services Lambda function layer.
    """
    severityCounts: SeverityCounts | None = None
    """
    An object that contains the counts of aggregated finding per severity.
    """


class LambdaFunctionAggregationResponse(Boto3Model):
    """
    A response that contains the results of an Amazon Web Services Lambda function
    finding aggregation.
    """

    resourceId: str
    """
    The resource IDs included in the aggregation results.
    """
    functionName: str | None = None
    """
    The Amazon Web Services Lambda function names included in the aggregation results.
    """
    runtime: str | None = None
    """
    The runtimes included in the aggregation results.
    """
    lambdaTags: Dict[str, str] | None = None
    """
    The tags included in the aggregation results.
    """
    accountId: str | None = None
    """
    The ID of the Amazon Web Services account that owns the Amazon Web Services Lambda
    function.
    """
    severityCounts: SeverityCounts | None = None
    """
    An object that contains the counts of aggregated finding per severity.
    """
    lastModifiedAt: datetime | None = None
    """
    The date that the Amazon Web Services Lambda function included in the aggregation
    results was last changed.
    """


class CodeRepositoryAggregationResponse(Boto3Model):
    """
    A response that contains the results of a finding aggregation by code repository.
    """

    projectNames: str
    """
    The names of the projects associated with the code repository.
    """
    providerType: str | None = None
    """
    The type of repository provider for the code repository.
    """
    severityCounts: SeverityCounts | None = None
    """
    An object that contains the counts of aggregated finding per severity.
    """
    exploitAvailableActiveFindingsCount: int | None = None
    """
    The number of active findings that have an exploit available for the code
    repository.
    """
    fixAvailableActiveFindingsCount: int | None = None
    """
    The number of active findings that have a fix available for the code repository.
    """
    accountId: str | None = None
    """
    The Amazon Web Services account ID associated with the code repository.
    """
    resourceId: str | None = None
    """
    The resource ID of the code repository.
    """


class AggregationResponse(Boto3Model):
    """
    A structure that contains details about the results of an aggregation type.
    """

    accountAggregation: AccountAggregationResponse | None = None
    """
    An object that contains details about an aggregation response based on Amazon Web
    Services account IDs.
    """
    amiAggregation: AmiAggregationResponse | None = None
    """
    An object that contains details about an aggregation response based on Amazon
    Machine Images (AMIs).
    """
    awsEcrContainerAggregation: AwsEcrContainerAggregationResponse | None = None
    """
    An object that contains details about an aggregation response based on Amazon ECR
    container images.
    """
    ec2InstanceAggregation: Ec2InstanceAggregationResponse | None = None
    """
    An object that contains details about an aggregation response based on Amazon EC2
    instances.
    """
    findingTypeAggregation: FindingTypeAggregationResponse | None = None
    """
    An object that contains details about an aggregation response based on finding
    types.
    """
    imageLayerAggregation: ImageLayerAggregationResponse | None = None
    """
    An object that contains details about an aggregation response based on container
    image layers.
    """
    packageAggregation: PackageAggregationResponse | None = None
    """
    An object that contains details about an aggregation response based on operating
    system package type.
    """
    repositoryAggregation: RepositoryAggregationResponse | None = None
    """
    An object that contains details about an aggregation response based on Amazon ECR
    repositories.
    """
    titleAggregation: TitleAggregationResponse | None = None
    """
    An object that contains details about an aggregation response based on finding
    title.
    """
    lambdaLayerAggregation: LambdaLayerAggregationResponse | None = None
    """
    An aggregation of findings by Amazon Web Services Lambda layer.
    """
    lambdaFunctionAggregation: LambdaFunctionAggregationResponse | None = None
    """
    An aggregation of findings by Amazon Web Services Lambda function.
    """
    codeRepositoryAggregation: CodeRepositoryAggregationResponse | None = None
    """
    An object that contains details about an aggregation response based on code
    repositories.
    """


class ListFindingAggregationsResponse(Boto3Model):
    aggregationType: Literal[
        "FINDING_TYPE",
        "PACKAGE",
        "TITLE",
        "REPOSITORY",
        "AMI",
        "AWS_EC2_INSTANCE",
        "AWS_ECR_CONTAINER",
        "IMAGE_LAYER",
        "ACCOUNT",
        "AWS_LAMBDA_FUNCTION",
        "LAMBDA_LAYER",
        "CODE_REPOSITORY",
    ]
    """
    The type of aggregation to perform.
    """
    responses: List["AggregationResponse"] | None = None
    """
    Objects that contain the results of an aggregation operation.
    """
    nextToken: str | None = None
    """
    A token to use for paginating results that are returned in the response.

    Set the value of this parameter to null for the
    first request to a list action. For subsequent calls, use the ``NextToken`` value returned from the previous request to
    continue listing results after the first page.
    """


class Evidence(Boto3Model):
    """
    Details of the evidence for a vulnerability identified in a finding.
    """

    evidenceRule: str | None = None
    """
    The evidence rule.
    """
    evidenceDetail: str | None = None
    """
    The evidence details.
    """
    severity: str | None = None
    """
    The evidence severity.
    """


class FindingDetail(Boto3Model):
    """
    Details of the vulnerability identified in a finding.
    """

    findingArn: str | None = None
    """
    The finding ARN that the vulnerability details are associated with.
    """
    cisaData: CisaData | None = None
    """
    The Cybersecurity and Infrastructure Security Agency (CISA) details for a specific
    vulnerability.
    """
    riskScore: int | None = None
    """
    The risk score of the vulnerability.
    """
    evidences: List["Evidence"] | None = None
    """
    Information on the evidence of the vulnerability.
    """
    ttps: List[str] | None = None
    """
    The MITRE adversary tactics, techniques, or procedures (TTPs) associated with the
    vulnerability.
    """
    tools: List[str] | None = None
    """
    The known malware tools or kits that can exploit the vulnerability.
    """
    exploitObserved: ExploitObserved | None = None
    """
    Contains information on when this exploit was observed.
    """
    referenceUrls: List[str] | None = None
    """
    The reference URLs for the vulnerability data.
    """
    cwes: List[str] | None = None
    """
    The Common Weakness Enumerations (CWEs) associated with the vulnerability.
    """
    epssScore: float | None = None
    """
    The Exploit Prediction Scoring System (EPSS) score of the vulnerability.
    """


class FindingDetailsError(Boto3Model):
    """
    Details about an error encountered when trying to return vulnerability data for a
    finding.
    """

    findingArn: str
    """
    The finding ARN that returned an error.
    """
    errorCode: Literal[
        "INTERNAL_ERROR", "ACCESS_DENIED", "FINDING_DETAILS_NOT_FOUND", "INVALID_INPUT"
    ]
    """
    The error code.
    """
    errorMessage: str
    """
    The error message.
    """


class BatchGetFindingDetailsResponse(Boto3Model):
    findingDetails: List["FindingDetail"] | None = None
    """
    A finding's vulnerability details.
    """
    errors: List["FindingDetailsError"] | None = None
    """
    Error information for findings that details could not be returned for.
    """


class Destination(Boto3Model):
    """
    Contains details of the Amazon S3 bucket and KMS key used to export findings.
    """

    bucketName: str
    """
    The name of the Amazon S3 bucket to export findings to.
    """
    keyPrefix: str | None = None
    """
    The prefix that the findings will be written under.
    """
    kmsKeyArn: str
    """
    The ARN of the KMS key used to encrypt data when exporting findings.
    """


class CreateFindingsReportResponse(Boto3Model):
    reportId: str | None = None
    """
    The ID of the report.
    """


class GetFindingsReportStatusResponse(Boto3Model):
    reportId: str | None = None
    """
    The ID of the report.
    """
    status: Literal["SUCCEEDED", "IN_PROGRESS", "CANCELLED", "FAILED"] | None = None
    """
    The status of the report.
    """
    errorCode: Literal["INTERNAL_ERROR", "INVALID_PERMISSIONS", "NO_FINDINGS_FOUND", "BUCKET_NOT_FOUND", "INCOMPATIBLE_BUCKET_REGION", "MALFORMED_KMS_KEY"] | None = None
    """
    The error code of the report.
    """
    errorMessage: str | None = None
    """
    The error message of the report.
    """
    destination: Destination | None = None
    """
    The destination of the report.
    """
    filterCriteria: FilterCriteria | None = None
    """
    The filter criteria associated with the report.
    """


class CancelFindingsReportResponse(Boto3Model):
    reportId: str
    """
    The ID of the canceled report.
    """


class ListDelegatedAdminAccountsResponse(Boto3Model):
    delegatedAdminAccounts: List["DelegatedAdminAccount"] | None = None
    """
    Details of the Amazon Inspector delegated administrator of your organization.
    """
    nextToken: str | None = None
    """
    A token to use for paginating results that are returned in the response.

    Set the value of this parameter to null for the
    first request to a list action. For subsequent calls, use the ``NextToken`` value returned from the previous request to
    continue listing results after the first page.
    """


class DelegatedAdmin(Boto3Model):
    """
    Details of the Amazon Inspector delegated administrator for your organization.
    """

    accountId: str | None = None
    """
    The Amazon Web Services account ID of the Amazon Inspector delegated administrator
    for your organization.
    """
    relationshipStatus: Literal["CREATED", "INVITED", "DISABLED", "ENABLED", "REMOVED", "RESIGNED", "DELETED", "EMAIL_VERIFICATION_IN_PROGRESS", "EMAIL_VERIFICATION_FAILED", "REGION_DISABLED", "ACCOUNT_SUSPENDED", "CANNOT_CREATE_DETECTOR_IN_ORG_MASTER"] | None = None
    """
    The status of the Amazon Inspector delegated administrator.
    """


class GetDelegatedAdminAccountResponse(Boto3Model):
    delegatedAdmin: DelegatedAdmin | None = None
    """
    The Amazon Web Services account ID of the Amazon Inspector delegated administrator.
    """


class EnableDelegatedAdminAccountResponse(Boto3Model):
    delegatedAdminAccountId: str
    """
    The Amazon Web Services account ID of the successfully Amazon Inspector delegated
    administrator.
    """


class DisableDelegatedAdminAccountResponse(Boto3Model):
    delegatedAdminAccountId: str
    """
    The Amazon Web Services account ID of the successfully disabled delegated
    administrator.
    """


class SearchVulnerabilitiesFilterCriteria(Boto3Model):
    """
    Details on the criteria used to define the filter for a vulnerability search.
    """

    vulnerabilityIds: List[str]
    """
    The IDs for specific vulnerabilities.
    """


class SearchVulnerabilitiesResponse(Boto3Model):
    vulnerabilities: List["Vulnerability"]
    """
    Details about the listed vulnerability.
    """
    nextToken: str | None = None
    """
    The pagination parameter to be used on the next list operation to retrieve more
    items.
    """
