{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MacieV2.Types.ClassificationResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | The category, types, and number of occurrences of the sensitive data
    -- that produced the finding.
    ClassificationResult -> Maybe [SensitiveDataItem]
sensitiveData :: Prelude.Maybe [SensitiveDataItem],
    -- | The status of the finding.
    ClassificationResult -> Maybe ClassificationResultStatus
status :: Prelude.Maybe ClassificationResultStatus,
    -- | 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 total size, in bytes, of the data that the finding applies to.
    ClassificationResult -> Maybe Integer
sizeClassified :: Prelude.Maybe Prelude.Integer,
    -- | 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
  }
  deriving (ClassificationResult -> ClassificationResult -> Bool
(ClassificationResult -> ClassificationResult -> Bool)
-> (ClassificationResult -> ClassificationResult -> Bool)
-> Eq ClassificationResult
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]
(Int -> ReadS ClassificationResult)
-> ReadS [ClassificationResult]
-> ReadPrec ClassificationResult
-> ReadPrec [ClassificationResult]
-> Read 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
(Int -> ClassificationResult -> ShowS)
-> (ClassificationResult -> String)
-> ([ClassificationResult] -> ShowS)
-> Show ClassificationResult
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. ClassificationResult -> Rep ClassificationResult x)
-> (forall x. Rep ClassificationResult x -> ClassificationResult)
-> Generic ClassificationResult
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:
--
-- 'sensitiveData', 'classificationResult_sensitiveData' - The category, types, and number of occurrences of the sensitive data
-- that produced the finding.
--
-- 'status', 'classificationResult_status' - The status of the finding.
--
-- '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.
--
-- 'sizeClassified', 'classificationResult_sizeClassified' - The total size, in bytes, of the data that the finding applies to.
--
-- '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.
newClassificationResult ::
  ClassificationResult
newClassificationResult :: ClassificationResult
newClassificationResult =
  ClassificationResult' :: Maybe [SensitiveDataItem]
-> Maybe ClassificationResultStatus
-> Maybe Text
-> Maybe Integer
-> Maybe Bool
-> Maybe CustomDataIdentifiers
-> ClassificationResult
ClassificationResult'
    { $sel:sensitiveData:ClassificationResult' :: Maybe [SensitiveDataItem]
sensitiveData =
        Maybe [SensitiveDataItem]
forall a. Maybe a
Prelude.Nothing,
      $sel:status:ClassificationResult' :: Maybe ClassificationResultStatus
status = Maybe ClassificationResultStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:mimeType:ClassificationResult' :: Maybe Text
mimeType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sizeClassified:ClassificationResult' :: Maybe Integer
sizeClassified = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:additionalOccurrences:ClassificationResult' :: Maybe Bool
additionalOccurrences = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:customDataIdentifiers:ClassificationResult' :: Maybe CustomDataIdentifiers
customDataIdentifiers = Maybe CustomDataIdentifiers
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe [SensitiveDataItem] -> f (Maybe [SensitiveDataItem]))
-> ClassificationResult -> f ClassificationResult
classificationResult_sensitiveData = (ClassificationResult -> Maybe [SensitiveDataItem])
-> (ClassificationResult
    -> Maybe [SensitiveDataItem] -> ClassificationResult)
-> Lens
     ClassificationResult
     ClassificationResult
     (Maybe [SensitiveDataItem])
     (Maybe [SensitiveDataItem])
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) ((Maybe [SensitiveDataItem] -> f (Maybe [SensitiveDataItem]))
 -> ClassificationResult -> f ClassificationResult)
-> ((Maybe [SensitiveDataItem] -> f (Maybe [SensitiveDataItem]))
    -> Maybe [SensitiveDataItem] -> f (Maybe [SensitiveDataItem]))
-> (Maybe [SensitiveDataItem] -> f (Maybe [SensitiveDataItem]))
-> ClassificationResult
-> f ClassificationResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SensitiveDataItem]
  [SensitiveDataItem]
  [SensitiveDataItem]
  [SensitiveDataItem]
-> Iso
     (Maybe [SensitiveDataItem])
     (Maybe [SensitiveDataItem])
     (Maybe [SensitiveDataItem])
     (Maybe [SensitiveDataItem])
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 AnIso
  [SensitiveDataItem]
  [SensitiveDataItem]
  [SensitiveDataItem]
  [SensitiveDataItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The status of the finding.
classificationResult_status :: Lens.Lens' ClassificationResult (Prelude.Maybe ClassificationResultStatus)
classificationResult_status :: (Maybe ClassificationResultStatus
 -> f (Maybe ClassificationResultStatus))
-> ClassificationResult -> f ClassificationResult
classificationResult_status = (ClassificationResult -> Maybe ClassificationResultStatus)
-> (ClassificationResult
    -> Maybe ClassificationResultStatus -> ClassificationResult)
-> Lens
     ClassificationResult
     ClassificationResult
     (Maybe ClassificationResultStatus)
     (Maybe ClassificationResultStatus)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> ClassificationResult -> f ClassificationResult
classificationResult_mimeType = (ClassificationResult -> Maybe Text)
-> (ClassificationResult -> Maybe Text -> ClassificationResult)
-> Lens
     ClassificationResult ClassificationResult (Maybe Text) (Maybe Text)
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 total size, in bytes, of the data that the finding applies to.
classificationResult_sizeClassified :: Lens.Lens' ClassificationResult (Prelude.Maybe Prelude.Integer)
classificationResult_sizeClassified :: (Maybe Integer -> f (Maybe Integer))
-> ClassificationResult -> f ClassificationResult
classificationResult_sizeClassified = (ClassificationResult -> Maybe Integer)
-> (ClassificationResult -> Maybe Integer -> ClassificationResult)
-> Lens
     ClassificationResult
     ClassificationResult
     (Maybe Integer)
     (Maybe Integer)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> ClassificationResult -> f ClassificationResult
classificationResult_additionalOccurrences = (ClassificationResult -> Maybe Bool)
-> (ClassificationResult -> Maybe Bool -> ClassificationResult)
-> Lens
     ClassificationResult ClassificationResult (Maybe Bool) (Maybe Bool)
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 :: (Maybe CustomDataIdentifiers -> f (Maybe CustomDataIdentifiers))
-> ClassificationResult -> f ClassificationResult
classificationResult_customDataIdentifiers = (ClassificationResult -> Maybe CustomDataIdentifiers)
-> (ClassificationResult
    -> Maybe CustomDataIdentifiers -> ClassificationResult)
-> Lens
     ClassificationResult
     ClassificationResult
     (Maybe CustomDataIdentifiers)
     (Maybe 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)

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

instance Prelude.Hashable ClassificationResult

instance Prelude.NFData ClassificationResult