{-# 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.SecurityHub.Types.CustomDataIdentifiersDetections
-- 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.SecurityHub.Types.CustomDataIdentifiersDetections where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.Occurrences

-- | The list of detected instances of sensitive data.
--
-- /See:/ 'newCustomDataIdentifiersDetections' smart constructor.
data CustomDataIdentifiersDetections = CustomDataIdentifiersDetections'
  { -- | Details about the sensitive data that was detected.
    CustomDataIdentifiersDetections -> Maybe Occurrences
occurrences :: Prelude.Maybe Occurrences,
    -- | The ARN of the custom identifier that was used to detect the sensitive
    -- data.
    CustomDataIdentifiersDetections -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The total number of occurrences of sensitive data that were detected.
    CustomDataIdentifiersDetections -> Maybe Integer
count :: Prelude.Maybe Prelude.Integer,
    -- | he name of the custom identifier that detected the sensitive data.
    CustomDataIdentifiersDetections -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (CustomDataIdentifiersDetections
-> CustomDataIdentifiersDetections -> Bool
(CustomDataIdentifiersDetections
 -> CustomDataIdentifiersDetections -> Bool)
-> (CustomDataIdentifiersDetections
    -> CustomDataIdentifiersDetections -> Bool)
-> Eq CustomDataIdentifiersDetections
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomDataIdentifiersDetections
-> CustomDataIdentifiersDetections -> Bool
$c/= :: CustomDataIdentifiersDetections
-> CustomDataIdentifiersDetections -> Bool
== :: CustomDataIdentifiersDetections
-> CustomDataIdentifiersDetections -> Bool
$c== :: CustomDataIdentifiersDetections
-> CustomDataIdentifiersDetections -> Bool
Prelude.Eq, ReadPrec [CustomDataIdentifiersDetections]
ReadPrec CustomDataIdentifiersDetections
Int -> ReadS CustomDataIdentifiersDetections
ReadS [CustomDataIdentifiersDetections]
(Int -> ReadS CustomDataIdentifiersDetections)
-> ReadS [CustomDataIdentifiersDetections]
-> ReadPrec CustomDataIdentifiersDetections
-> ReadPrec [CustomDataIdentifiersDetections]
-> Read CustomDataIdentifiersDetections
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomDataIdentifiersDetections]
$creadListPrec :: ReadPrec [CustomDataIdentifiersDetections]
readPrec :: ReadPrec CustomDataIdentifiersDetections
$creadPrec :: ReadPrec CustomDataIdentifiersDetections
readList :: ReadS [CustomDataIdentifiersDetections]
$creadList :: ReadS [CustomDataIdentifiersDetections]
readsPrec :: Int -> ReadS CustomDataIdentifiersDetections
$creadsPrec :: Int -> ReadS CustomDataIdentifiersDetections
Prelude.Read, Int -> CustomDataIdentifiersDetections -> ShowS
[CustomDataIdentifiersDetections] -> ShowS
CustomDataIdentifiersDetections -> String
(Int -> CustomDataIdentifiersDetections -> ShowS)
-> (CustomDataIdentifiersDetections -> String)
-> ([CustomDataIdentifiersDetections] -> ShowS)
-> Show CustomDataIdentifiersDetections
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomDataIdentifiersDetections] -> ShowS
$cshowList :: [CustomDataIdentifiersDetections] -> ShowS
show :: CustomDataIdentifiersDetections -> String
$cshow :: CustomDataIdentifiersDetections -> String
showsPrec :: Int -> CustomDataIdentifiersDetections -> ShowS
$cshowsPrec :: Int -> CustomDataIdentifiersDetections -> ShowS
Prelude.Show, (forall x.
 CustomDataIdentifiersDetections
 -> Rep CustomDataIdentifiersDetections x)
-> (forall x.
    Rep CustomDataIdentifiersDetections x
    -> CustomDataIdentifiersDetections)
-> Generic CustomDataIdentifiersDetections
forall x.
Rep CustomDataIdentifiersDetections x
-> CustomDataIdentifiersDetections
forall x.
CustomDataIdentifiersDetections
-> Rep CustomDataIdentifiersDetections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomDataIdentifiersDetections x
-> CustomDataIdentifiersDetections
$cfrom :: forall x.
CustomDataIdentifiersDetections
-> Rep CustomDataIdentifiersDetections x
Prelude.Generic)

-- |
-- Create a value of 'CustomDataIdentifiersDetections' 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:
--
-- 'occurrences', 'customDataIdentifiersDetections_occurrences' - Details about the sensitive data that was detected.
--
-- 'arn', 'customDataIdentifiersDetections_arn' - The ARN of the custom identifier that was used to detect the sensitive
-- data.
--
-- 'count', 'customDataIdentifiersDetections_count' - The total number of occurrences of sensitive data that were detected.
--
-- 'name', 'customDataIdentifiersDetections_name' - he name of the custom identifier that detected the sensitive data.
newCustomDataIdentifiersDetections ::
  CustomDataIdentifiersDetections
newCustomDataIdentifiersDetections :: CustomDataIdentifiersDetections
newCustomDataIdentifiersDetections =
  CustomDataIdentifiersDetections' :: Maybe Occurrences
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> CustomDataIdentifiersDetections
CustomDataIdentifiersDetections'
    { $sel:occurrences:CustomDataIdentifiersDetections' :: Maybe Occurrences
occurrences =
        Maybe Occurrences
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CustomDataIdentifiersDetections' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:count:CustomDataIdentifiersDetections' :: Maybe Integer
count = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CustomDataIdentifiersDetections' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Details about the sensitive data that was detected.
customDataIdentifiersDetections_occurrences :: Lens.Lens' CustomDataIdentifiersDetections (Prelude.Maybe Occurrences)
customDataIdentifiersDetections_occurrences :: (Maybe Occurrences -> f (Maybe Occurrences))
-> CustomDataIdentifiersDetections
-> f CustomDataIdentifiersDetections
customDataIdentifiersDetections_occurrences = (CustomDataIdentifiersDetections -> Maybe Occurrences)
-> (CustomDataIdentifiersDetections
    -> Maybe Occurrences -> CustomDataIdentifiersDetections)
-> Lens
     CustomDataIdentifiersDetections
     CustomDataIdentifiersDetections
     (Maybe Occurrences)
     (Maybe Occurrences)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDataIdentifiersDetections' {Maybe Occurrences
occurrences :: Maybe Occurrences
$sel:occurrences:CustomDataIdentifiersDetections' :: CustomDataIdentifiersDetections -> Maybe Occurrences
occurrences} -> Maybe Occurrences
occurrences) (\s :: CustomDataIdentifiersDetections
s@CustomDataIdentifiersDetections' {} Maybe Occurrences
a -> CustomDataIdentifiersDetections
s {$sel:occurrences:CustomDataIdentifiersDetections' :: Maybe Occurrences
occurrences = Maybe Occurrences
a} :: CustomDataIdentifiersDetections)

-- | The ARN of the custom identifier that was used to detect the sensitive
-- data.
customDataIdentifiersDetections_arn :: Lens.Lens' CustomDataIdentifiersDetections (Prelude.Maybe Prelude.Text)
customDataIdentifiersDetections_arn :: (Maybe Text -> f (Maybe Text))
-> CustomDataIdentifiersDetections
-> f CustomDataIdentifiersDetections
customDataIdentifiersDetections_arn = (CustomDataIdentifiersDetections -> Maybe Text)
-> (CustomDataIdentifiersDetections
    -> Maybe Text -> CustomDataIdentifiersDetections)
-> Lens
     CustomDataIdentifiersDetections
     CustomDataIdentifiersDetections
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDataIdentifiersDetections' {Maybe Text
arn :: Maybe Text
$sel:arn:CustomDataIdentifiersDetections' :: CustomDataIdentifiersDetections -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CustomDataIdentifiersDetections
s@CustomDataIdentifiersDetections' {} Maybe Text
a -> CustomDataIdentifiersDetections
s {$sel:arn:CustomDataIdentifiersDetections' :: Maybe Text
arn = Maybe Text
a} :: CustomDataIdentifiersDetections)

-- | The total number of occurrences of sensitive data that were detected.
customDataIdentifiersDetections_count :: Lens.Lens' CustomDataIdentifiersDetections (Prelude.Maybe Prelude.Integer)
customDataIdentifiersDetections_count :: (Maybe Integer -> f (Maybe Integer))
-> CustomDataIdentifiersDetections
-> f CustomDataIdentifiersDetections
customDataIdentifiersDetections_count = (CustomDataIdentifiersDetections -> Maybe Integer)
-> (CustomDataIdentifiersDetections
    -> Maybe Integer -> CustomDataIdentifiersDetections)
-> Lens
     CustomDataIdentifiersDetections
     CustomDataIdentifiersDetections
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDataIdentifiersDetections' {Maybe Integer
count :: Maybe Integer
$sel:count:CustomDataIdentifiersDetections' :: CustomDataIdentifiersDetections -> Maybe Integer
count} -> Maybe Integer
count) (\s :: CustomDataIdentifiersDetections
s@CustomDataIdentifiersDetections' {} Maybe Integer
a -> CustomDataIdentifiersDetections
s {$sel:count:CustomDataIdentifiersDetections' :: Maybe Integer
count = Maybe Integer
a} :: CustomDataIdentifiersDetections)

-- | he name of the custom identifier that detected the sensitive data.
customDataIdentifiersDetections_name :: Lens.Lens' CustomDataIdentifiersDetections (Prelude.Maybe Prelude.Text)
customDataIdentifiersDetections_name :: (Maybe Text -> f (Maybe Text))
-> CustomDataIdentifiersDetections
-> f CustomDataIdentifiersDetections
customDataIdentifiersDetections_name = (CustomDataIdentifiersDetections -> Maybe Text)
-> (CustomDataIdentifiersDetections
    -> Maybe Text -> CustomDataIdentifiersDetections)
-> Lens
     CustomDataIdentifiersDetections
     CustomDataIdentifiersDetections
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDataIdentifiersDetections' {Maybe Text
name :: Maybe Text
$sel:name:CustomDataIdentifiersDetections' :: CustomDataIdentifiersDetections -> Maybe Text
name} -> Maybe Text
name) (\s :: CustomDataIdentifiersDetections
s@CustomDataIdentifiersDetections' {} Maybe Text
a -> CustomDataIdentifiersDetections
s {$sel:name:CustomDataIdentifiersDetections' :: Maybe Text
name = Maybe Text
a} :: CustomDataIdentifiersDetections)

instance
  Core.FromJSON
    CustomDataIdentifiersDetections
  where
  parseJSON :: Value -> Parser CustomDataIdentifiersDetections
parseJSON =
    String
-> (Object -> Parser CustomDataIdentifiersDetections)
-> Value
-> Parser CustomDataIdentifiersDetections
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CustomDataIdentifiersDetections"
      ( \Object
x ->
          Maybe Occurrences
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> CustomDataIdentifiersDetections
CustomDataIdentifiersDetections'
            (Maybe Occurrences
 -> Maybe Text
 -> Maybe Integer
 -> Maybe Text
 -> CustomDataIdentifiersDetections)
-> Parser (Maybe Occurrences)
-> Parser
     (Maybe Text
      -> Maybe Integer -> Maybe Text -> CustomDataIdentifiersDetections)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Occurrences)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Occurrences")
            Parser
  (Maybe Text
   -> Maybe Integer -> Maybe Text -> CustomDataIdentifiersDetections)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer -> Maybe Text -> CustomDataIdentifiersDetections)
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
"Arn")
            Parser
  (Maybe Integer -> Maybe Text -> CustomDataIdentifiersDetections)
-> Parser (Maybe Integer)
-> Parser (Maybe Text -> CustomDataIdentifiersDetections)
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
"Count")
            Parser (Maybe Text -> CustomDataIdentifiersDetections)
-> Parser (Maybe Text) -> Parser CustomDataIdentifiersDetections
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
"Name")
      )

instance
  Prelude.Hashable
    CustomDataIdentifiersDetections

instance
  Prelude.NFData
    CustomDataIdentifiersDetections

instance Core.ToJSON CustomDataIdentifiersDetections where
  toJSON :: CustomDataIdentifiersDetections -> Value
toJSON CustomDataIdentifiersDetections' {Maybe Integer
Maybe Text
Maybe Occurrences
name :: Maybe Text
count :: Maybe Integer
arn :: Maybe Text
occurrences :: Maybe Occurrences
$sel:name:CustomDataIdentifiersDetections' :: CustomDataIdentifiersDetections -> Maybe Text
$sel:count:CustomDataIdentifiersDetections' :: CustomDataIdentifiersDetections -> Maybe Integer
$sel:arn:CustomDataIdentifiersDetections' :: CustomDataIdentifiersDetections -> Maybe Text
$sel:occurrences:CustomDataIdentifiersDetections' :: CustomDataIdentifiersDetections -> Maybe Occurrences
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Occurrences" Text -> Occurrences -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Occurrences -> Pair) -> Maybe Occurrences -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Occurrences
occurrences,
            (Text
"Arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
arn,
            (Text
"Count" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
count,
            (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name
          ]
      )