{-# 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.SensitiveDataItem
-- 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.SensitiveDataItem 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.DefaultDetection
import Amazonka.MacieV2.Types.SensitiveDataItemCategory
import qualified Amazonka.Prelude as Prelude

-- | Provides information about the category, types, and occurrences of
-- sensitive data that produced a sensitive data finding.
--
-- /See:/ 'newSensitiveDataItem' smart constructor.
data SensitiveDataItem = SensitiveDataItem'
  { -- | The category of sensitive data that was detected. For example:
    -- CREDENTIALS, for credentials data such as private keys or Amazon Web
    -- Services secret access keys; FINANCIAL_INFORMATION, for financial data
    -- such as credit card numbers; or, PERSONAL_INFORMATION, for personal
    -- health information, such as health insurance identification numbers, or
    -- personally identifiable information, such as passport numbers.
    SensitiveDataItem -> Maybe SensitiveDataItemCategory
category :: Prelude.Maybe SensitiveDataItemCategory,
    -- | An array of objects, one for each type of sensitive data that was
    -- detected. Each object reports the number of occurrences of a specific
    -- type of sensitive data that was detected, and the location of up to 15
    -- of those occurrences.
    SensitiveDataItem -> Maybe [DefaultDetection]
detections :: Prelude.Maybe [DefaultDetection],
    -- | The total number of occurrences of the sensitive data that was detected.
    SensitiveDataItem -> Maybe Integer
totalCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (SensitiveDataItem -> SensitiveDataItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SensitiveDataItem -> SensitiveDataItem -> Bool
$c/= :: SensitiveDataItem -> SensitiveDataItem -> Bool
== :: SensitiveDataItem -> SensitiveDataItem -> Bool
$c== :: SensitiveDataItem -> SensitiveDataItem -> Bool
Prelude.Eq, ReadPrec [SensitiveDataItem]
ReadPrec SensitiveDataItem
Int -> ReadS SensitiveDataItem
ReadS [SensitiveDataItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SensitiveDataItem]
$creadListPrec :: ReadPrec [SensitiveDataItem]
readPrec :: ReadPrec SensitiveDataItem
$creadPrec :: ReadPrec SensitiveDataItem
readList :: ReadS [SensitiveDataItem]
$creadList :: ReadS [SensitiveDataItem]
readsPrec :: Int -> ReadS SensitiveDataItem
$creadsPrec :: Int -> ReadS SensitiveDataItem
Prelude.Read, Int -> SensitiveDataItem -> ShowS
[SensitiveDataItem] -> ShowS
SensitiveDataItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SensitiveDataItem] -> ShowS
$cshowList :: [SensitiveDataItem] -> ShowS
show :: SensitiveDataItem -> String
$cshow :: SensitiveDataItem -> String
showsPrec :: Int -> SensitiveDataItem -> ShowS
$cshowsPrec :: Int -> SensitiveDataItem -> ShowS
Prelude.Show, forall x. Rep SensitiveDataItem x -> SensitiveDataItem
forall x. SensitiveDataItem -> Rep SensitiveDataItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SensitiveDataItem x -> SensitiveDataItem
$cfrom :: forall x. SensitiveDataItem -> Rep SensitiveDataItem x
Prelude.Generic)

-- |
-- Create a value of 'SensitiveDataItem' 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:
--
-- 'category', 'sensitiveDataItem_category' - The category of sensitive data that was detected. For example:
-- CREDENTIALS, for credentials data such as private keys or Amazon Web
-- Services secret access keys; FINANCIAL_INFORMATION, for financial data
-- such as credit card numbers; or, PERSONAL_INFORMATION, for personal
-- health information, such as health insurance identification numbers, or
-- personally identifiable information, such as passport numbers.
--
-- 'detections', 'sensitiveDataItem_detections' - An array of objects, one for each type of sensitive data that was
-- detected. Each object reports the number of occurrences of a specific
-- type of sensitive data that was detected, and the location of up to 15
-- of those occurrences.
--
-- 'totalCount', 'sensitiveDataItem_totalCount' - The total number of occurrences of the sensitive data that was detected.
newSensitiveDataItem ::
  SensitiveDataItem
newSensitiveDataItem :: SensitiveDataItem
newSensitiveDataItem =
  SensitiveDataItem'
    { $sel:category:SensitiveDataItem' :: Maybe SensitiveDataItemCategory
category = forall a. Maybe a
Prelude.Nothing,
      $sel:detections:SensitiveDataItem' :: Maybe [DefaultDetection]
detections = forall a. Maybe a
Prelude.Nothing,
      $sel:totalCount:SensitiveDataItem' :: Maybe Integer
totalCount = forall a. Maybe a
Prelude.Nothing
    }

-- | The category of sensitive data that was detected. For example:
-- CREDENTIALS, for credentials data such as private keys or Amazon Web
-- Services secret access keys; FINANCIAL_INFORMATION, for financial data
-- such as credit card numbers; or, PERSONAL_INFORMATION, for personal
-- health information, such as health insurance identification numbers, or
-- personally identifiable information, such as passport numbers.
sensitiveDataItem_category :: Lens.Lens' SensitiveDataItem (Prelude.Maybe SensitiveDataItemCategory)
sensitiveDataItem_category :: Lens' SensitiveDataItem (Maybe SensitiveDataItemCategory)
sensitiveDataItem_category = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SensitiveDataItem' {Maybe SensitiveDataItemCategory
category :: Maybe SensitiveDataItemCategory
$sel:category:SensitiveDataItem' :: SensitiveDataItem -> Maybe SensitiveDataItemCategory
category} -> Maybe SensitiveDataItemCategory
category) (\s :: SensitiveDataItem
s@SensitiveDataItem' {} Maybe SensitiveDataItemCategory
a -> SensitiveDataItem
s {$sel:category:SensitiveDataItem' :: Maybe SensitiveDataItemCategory
category = Maybe SensitiveDataItemCategory
a} :: SensitiveDataItem)

-- | An array of objects, one for each type of sensitive data that was
-- detected. Each object reports the number of occurrences of a specific
-- type of sensitive data that was detected, and the location of up to 15
-- of those occurrences.
sensitiveDataItem_detections :: Lens.Lens' SensitiveDataItem (Prelude.Maybe [DefaultDetection])
sensitiveDataItem_detections :: Lens' SensitiveDataItem (Maybe [DefaultDetection])
sensitiveDataItem_detections = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SensitiveDataItem' {Maybe [DefaultDetection]
detections :: Maybe [DefaultDetection]
$sel:detections:SensitiveDataItem' :: SensitiveDataItem -> Maybe [DefaultDetection]
detections} -> Maybe [DefaultDetection]
detections) (\s :: SensitiveDataItem
s@SensitiveDataItem' {} Maybe [DefaultDetection]
a -> SensitiveDataItem
s {$sel:detections:SensitiveDataItem' :: Maybe [DefaultDetection]
detections = Maybe [DefaultDetection]
a} :: SensitiveDataItem) 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 number of occurrences of the sensitive data that was detected.
sensitiveDataItem_totalCount :: Lens.Lens' SensitiveDataItem (Prelude.Maybe Prelude.Integer)
sensitiveDataItem_totalCount :: Lens' SensitiveDataItem (Maybe Integer)
sensitiveDataItem_totalCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SensitiveDataItem' {Maybe Integer
totalCount :: Maybe Integer
$sel:totalCount:SensitiveDataItem' :: SensitiveDataItem -> Maybe Integer
totalCount} -> Maybe Integer
totalCount) (\s :: SensitiveDataItem
s@SensitiveDataItem' {} Maybe Integer
a -> SensitiveDataItem
s {$sel:totalCount:SensitiveDataItem' :: Maybe Integer
totalCount = Maybe Integer
a} :: SensitiveDataItem)

instance Data.FromJSON SensitiveDataItem where
  parseJSON :: Value -> Parser SensitiveDataItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SensitiveDataItem"
      ( \Object
x ->
          Maybe SensitiveDataItemCategory
-> Maybe [DefaultDetection] -> Maybe Integer -> SensitiveDataItem
SensitiveDataItem'
            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
"category")
            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
"detections" 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
"totalCount")
      )

instance Prelude.Hashable SensitiveDataItem where
  hashWithSalt :: Int -> SensitiveDataItem -> Int
hashWithSalt Int
_salt SensitiveDataItem' {Maybe Integer
Maybe [DefaultDetection]
Maybe SensitiveDataItemCategory
totalCount :: Maybe Integer
detections :: Maybe [DefaultDetection]
category :: Maybe SensitiveDataItemCategory
$sel:totalCount:SensitiveDataItem' :: SensitiveDataItem -> Maybe Integer
$sel:detections:SensitiveDataItem' :: SensitiveDataItem -> Maybe [DefaultDetection]
$sel:category:SensitiveDataItem' :: SensitiveDataItem -> Maybe SensitiveDataItemCategory
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SensitiveDataItemCategory
category
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DefaultDetection]
detections
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
totalCount

instance Prelude.NFData SensitiveDataItem where
  rnf :: SensitiveDataItem -> ()
rnf SensitiveDataItem' {Maybe Integer
Maybe [DefaultDetection]
Maybe SensitiveDataItemCategory
totalCount :: Maybe Integer
detections :: Maybe [DefaultDetection]
category :: Maybe SensitiveDataItemCategory
$sel:totalCount:SensitiveDataItem' :: SensitiveDataItem -> Maybe Integer
$sel:detections:SensitiveDataItem' :: SensitiveDataItem -> Maybe [DefaultDetection]
$sel:category:SensitiveDataItem' :: SensitiveDataItem -> Maybe SensitiveDataItemCategory
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SensitiveDataItemCategory
category
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DefaultDetection]
detections
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
totalCount