{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MacieV2.Types.ClassificationResult
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MacieV2.Types.ClassificationResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MacieV2.Types.ClassificationResultStatus
import Amazonka.MacieV2.Types.CustomDataIdentifiers
import Amazonka.MacieV2.Types.SensitiveDataItem
import qualified Amazonka.Prelude as Prelude

-- | Provides the details of a sensitive data finding, including the types,
-- number of occurrences, and locations of the sensitive data that was
-- detected.
--
-- /See:/ 'newClassificationResult' smart constructor.
data ClassificationResult = ClassificationResult'
  { -- | Specifies whether Amazon Macie detected additional occurrences of
    -- sensitive data in the S3 object. A finding includes location data for a
    -- maximum of 15 occurrences of sensitive data.
    --
    -- This value can help you determine whether to investigate additional
    -- occurrences of sensitive data in an object. You can do this by referring
    -- to the corresponding sensitive data discovery result for the finding
    -- (ClassificationDetails.detailedResultsLocation).
    ClassificationResult -> Maybe Bool
additionalOccurrences :: Prelude.Maybe Prelude.Bool,
    -- | The custom data identifiers that detected the sensitive data and the
    -- number of occurrences of the data that they detected.
    ClassificationResult -> Maybe CustomDataIdentifiers
customDataIdentifiers :: Prelude.Maybe CustomDataIdentifiers,
    -- | The type of content, as a MIME type, that the finding applies to. For
    -- example, application\/gzip, for a GNU Gzip compressed archive file, or
    -- application\/pdf, for an Adobe Portable Document Format file.
    ClassificationResult -> Maybe Text
mimeType :: Prelude.Maybe Prelude.Text,
    -- | The category, types, and number of occurrences of the sensitive data
    -- that produced the finding.
    ClassificationResult -> Maybe [SensitiveDataItem]
sensitiveData :: Prelude.Maybe [SensitiveDataItem],
    -- | The total size, in bytes, of the data that the finding applies to.
    ClassificationResult -> Maybe Integer
sizeClassified :: Prelude.Maybe Prelude.Integer,
    -- | The status of the finding.
    ClassificationResult -> Maybe ClassificationResultStatus
status :: Prelude.Maybe ClassificationResultStatus
  }
  deriving (ClassificationResult -> ClassificationResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClassificationResult -> ClassificationResult -> Bool
$c/= :: ClassificationResult -> ClassificationResult -> Bool
== :: ClassificationResult -> ClassificationResult -> Bool
$c== :: ClassificationResult -> ClassificationResult -> Bool
Prelude.Eq, ReadPrec [ClassificationResult]
ReadPrec ClassificationResult
Int -> ReadS ClassificationResult
ReadS [ClassificationResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClassificationResult]
$creadListPrec :: ReadPrec [ClassificationResult]
readPrec :: ReadPrec ClassificationResult
$creadPrec :: ReadPrec ClassificationResult
readList :: ReadS [ClassificationResult]
$creadList :: ReadS [ClassificationResult]
readsPrec :: Int -> ReadS ClassificationResult
$creadsPrec :: Int -> ReadS ClassificationResult
Prelude.Read, Int -> ClassificationResult -> ShowS
[ClassificationResult] -> ShowS
ClassificationResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClassificationResult] -> ShowS
$cshowList :: [ClassificationResult] -> ShowS
show :: ClassificationResult -> String
$cshow :: ClassificationResult -> String
showsPrec :: Int -> ClassificationResult -> ShowS
$cshowsPrec :: Int -> ClassificationResult -> ShowS
Prelude.Show, forall x. Rep ClassificationResult x -> ClassificationResult
forall x. ClassificationResult -> Rep ClassificationResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClassificationResult x -> ClassificationResult
$cfrom :: forall x. ClassificationResult -> Rep ClassificationResult x
Prelude.Generic)

-- |
-- Create a value of 'ClassificationResult' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'additionalOccurrences', 'classificationResult_additionalOccurrences' - Specifies whether Amazon Macie detected additional occurrences of
-- sensitive data in the S3 object. A finding includes location data for a
-- maximum of 15 occurrences of sensitive data.
--
-- This value can help you determine whether to investigate additional
-- occurrences of sensitive data in an object. You can do this by referring
-- to the corresponding sensitive data discovery result for the finding
-- (ClassificationDetails.detailedResultsLocation).
--
-- 'customDataIdentifiers', 'classificationResult_customDataIdentifiers' - The custom data identifiers that detected the sensitive data and the
-- number of occurrences of the data that they detected.
--
-- 'mimeType', 'classificationResult_mimeType' - The type of content, as a MIME type, that the finding applies to. For
-- example, application\/gzip, for a GNU Gzip compressed archive file, or
-- application\/pdf, for an Adobe Portable Document Format file.
--
-- 'sensitiveData', 'classificationResult_sensitiveData' - The category, types, and number of occurrences of the sensitive data
-- that produced the finding.
--
-- 'sizeClassified', 'classificationResult_sizeClassified' - The total size, in bytes, of the data that the finding applies to.
--
-- 'status', 'classificationResult_status' - The status of the finding.
newClassificationResult ::
  ClassificationResult
newClassificationResult :: ClassificationResult
newClassificationResult =
  ClassificationResult'
    { $sel:additionalOccurrences:ClassificationResult' :: Maybe Bool
additionalOccurrences =
        forall a. Maybe a
Prelude.Nothing,
      $sel:customDataIdentifiers:ClassificationResult' :: Maybe CustomDataIdentifiers
customDataIdentifiers = forall a. Maybe a
Prelude.Nothing,
      $sel:mimeType:ClassificationResult' :: Maybe Text
mimeType = forall a. Maybe a
Prelude.Nothing,
      $sel:sensitiveData:ClassificationResult' :: Maybe [SensitiveDataItem]
sensitiveData = forall a. Maybe a
Prelude.Nothing,
      $sel:sizeClassified:ClassificationResult' :: Maybe Integer
sizeClassified = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ClassificationResult' :: Maybe ClassificationResultStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether Amazon Macie detected additional occurrences of
-- sensitive data in the S3 object. A finding includes location data for a
-- maximum of 15 occurrences of sensitive data.
--
-- This value can help you determine whether to investigate additional
-- occurrences of sensitive data in an object. You can do this by referring
-- to the corresponding sensitive data discovery result for the finding
-- (ClassificationDetails.detailedResultsLocation).
classificationResult_additionalOccurrences :: Lens.Lens' ClassificationResult (Prelude.Maybe Prelude.Bool)
classificationResult_additionalOccurrences :: Lens' ClassificationResult (Maybe Bool)
classificationResult_additionalOccurrences = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationResult' {Maybe Bool
additionalOccurrences :: Maybe Bool
$sel:additionalOccurrences:ClassificationResult' :: ClassificationResult -> Maybe Bool
additionalOccurrences} -> Maybe Bool
additionalOccurrences) (\s :: ClassificationResult
s@ClassificationResult' {} Maybe Bool
a -> ClassificationResult
s {$sel:additionalOccurrences:ClassificationResult' :: Maybe Bool
additionalOccurrences = Maybe Bool
a} :: ClassificationResult)

-- | The custom data identifiers that detected the sensitive data and the
-- number of occurrences of the data that they detected.
classificationResult_customDataIdentifiers :: Lens.Lens' ClassificationResult (Prelude.Maybe CustomDataIdentifiers)
classificationResult_customDataIdentifiers :: Lens' ClassificationResult (Maybe CustomDataIdentifiers)
classificationResult_customDataIdentifiers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationResult' {Maybe CustomDataIdentifiers
customDataIdentifiers :: Maybe CustomDataIdentifiers
$sel:customDataIdentifiers:ClassificationResult' :: ClassificationResult -> Maybe CustomDataIdentifiers
customDataIdentifiers} -> Maybe CustomDataIdentifiers
customDataIdentifiers) (\s :: ClassificationResult
s@ClassificationResult' {} Maybe CustomDataIdentifiers
a -> ClassificationResult
s {$sel:customDataIdentifiers:ClassificationResult' :: Maybe CustomDataIdentifiers
customDataIdentifiers = Maybe CustomDataIdentifiers
a} :: ClassificationResult)

-- | The type of content, as a MIME type, that the finding applies to. For
-- example, application\/gzip, for a GNU Gzip compressed archive file, or
-- application\/pdf, for an Adobe Portable Document Format file.
classificationResult_mimeType :: Lens.Lens' ClassificationResult (Prelude.Maybe Prelude.Text)
classificationResult_mimeType :: Lens' ClassificationResult (Maybe Text)
classificationResult_mimeType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationResult' {Maybe Text
mimeType :: Maybe Text
$sel:mimeType:ClassificationResult' :: ClassificationResult -> Maybe Text
mimeType} -> Maybe Text
mimeType) (\s :: ClassificationResult
s@ClassificationResult' {} Maybe Text
a -> ClassificationResult
s {$sel:mimeType:ClassificationResult' :: Maybe Text
mimeType = Maybe Text
a} :: ClassificationResult)

-- | The category, types, and number of occurrences of the sensitive data
-- that produced the finding.
classificationResult_sensitiveData :: Lens.Lens' ClassificationResult (Prelude.Maybe [SensitiveDataItem])
classificationResult_sensitiveData :: Lens' ClassificationResult (Maybe [SensitiveDataItem])
classificationResult_sensitiveData = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationResult' {Maybe [SensitiveDataItem]
sensitiveData :: Maybe [SensitiveDataItem]
$sel:sensitiveData:ClassificationResult' :: ClassificationResult -> Maybe [SensitiveDataItem]
sensitiveData} -> Maybe [SensitiveDataItem]
sensitiveData) (\s :: ClassificationResult
s@ClassificationResult' {} Maybe [SensitiveDataItem]
a -> ClassificationResult
s {$sel:sensitiveData:ClassificationResult' :: Maybe [SensitiveDataItem]
sensitiveData = Maybe [SensitiveDataItem]
a} :: ClassificationResult) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The total size, in bytes, of the data that the finding applies to.
classificationResult_sizeClassified :: Lens.Lens' ClassificationResult (Prelude.Maybe Prelude.Integer)
classificationResult_sizeClassified :: Lens' ClassificationResult (Maybe Integer)
classificationResult_sizeClassified = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationResult' {Maybe Integer
sizeClassified :: Maybe Integer
$sel:sizeClassified:ClassificationResult' :: ClassificationResult -> Maybe Integer
sizeClassified} -> Maybe Integer
sizeClassified) (\s :: ClassificationResult
s@ClassificationResult' {} Maybe Integer
a -> ClassificationResult
s {$sel:sizeClassified:ClassificationResult' :: Maybe Integer
sizeClassified = Maybe Integer
a} :: ClassificationResult)

-- | The status of the finding.
classificationResult_status :: Lens.Lens' ClassificationResult (Prelude.Maybe ClassificationResultStatus)
classificationResult_status :: Lens' ClassificationResult (Maybe ClassificationResultStatus)
classificationResult_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationResult' {Maybe ClassificationResultStatus
status :: Maybe ClassificationResultStatus
$sel:status:ClassificationResult' :: ClassificationResult -> Maybe ClassificationResultStatus
status} -> Maybe ClassificationResultStatus
status) (\s :: ClassificationResult
s@ClassificationResult' {} Maybe ClassificationResultStatus
a -> ClassificationResult
s {$sel:status:ClassificationResult' :: Maybe ClassificationResultStatus
status = Maybe ClassificationResultStatus
a} :: ClassificationResult)

instance Data.FromJSON ClassificationResult where
  parseJSON :: Value -> Parser ClassificationResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ClassificationResult"
      ( \Object
x ->
          Maybe Bool
-> Maybe CustomDataIdentifiers
-> Maybe Text
-> Maybe [SensitiveDataItem]
-> Maybe Integer
-> Maybe ClassificationResultStatus
-> ClassificationResult
ClassificationResult'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"additionalOccurrences")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"customDataIdentifiers")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"mimeType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"sensitiveData" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"sizeClassified")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"status")
      )

instance Prelude.Hashable ClassificationResult where
  hashWithSalt :: Int -> ClassificationResult -> Int
hashWithSalt Int
_salt ClassificationResult' {Maybe Bool
Maybe Integer
Maybe [SensitiveDataItem]
Maybe Text
Maybe ClassificationResultStatus
Maybe CustomDataIdentifiers
status :: Maybe ClassificationResultStatus
sizeClassified :: Maybe Integer
sensitiveData :: Maybe [SensitiveDataItem]
mimeType :: Maybe Text
customDataIdentifiers :: Maybe CustomDataIdentifiers
additionalOccurrences :: Maybe Bool
$sel:status:ClassificationResult' :: ClassificationResult -> Maybe ClassificationResultStatus
$sel:sizeClassified:ClassificationResult' :: ClassificationResult -> Maybe Integer
$sel:sensitiveData:ClassificationResult' :: ClassificationResult -> Maybe [SensitiveDataItem]
$sel:mimeType:ClassificationResult' :: ClassificationResult -> Maybe Text
$sel:customDataIdentifiers:ClassificationResult' :: ClassificationResult -> Maybe CustomDataIdentifiers
$sel:additionalOccurrences:ClassificationResult' :: ClassificationResult -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
additionalOccurrences
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomDataIdentifiers
customDataIdentifiers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
mimeType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SensitiveDataItem]
sensitiveData
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
sizeClassified
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ClassificationResultStatus
status

instance Prelude.NFData ClassificationResult where
  rnf :: ClassificationResult -> ()
rnf ClassificationResult' {Maybe Bool
Maybe Integer
Maybe [SensitiveDataItem]
Maybe Text
Maybe ClassificationResultStatus
Maybe CustomDataIdentifiers
status :: Maybe ClassificationResultStatus
sizeClassified :: Maybe Integer
sensitiveData :: Maybe [SensitiveDataItem]
mimeType :: Maybe Text
customDataIdentifiers :: Maybe CustomDataIdentifiers
additionalOccurrences :: Maybe Bool
$sel:status:ClassificationResult' :: ClassificationResult -> Maybe ClassificationResultStatus
$sel:sizeClassified:ClassificationResult' :: ClassificationResult -> Maybe Integer
$sel:sensitiveData:ClassificationResult' :: ClassificationResult -> Maybe [SensitiveDataItem]
$sel:mimeType:ClassificationResult' :: ClassificationResult -> Maybe Text
$sel:customDataIdentifiers:ClassificationResult' :: ClassificationResult -> Maybe CustomDataIdentifiers
$sel:additionalOccurrences:ClassificationResult' :: ClassificationResult -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
additionalOccurrences
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomDataIdentifiers
customDataIdentifiers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mimeType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [SensitiveDataItem]
sensitiveData
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
sizeClassified
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ClassificationResultStatus
status