{-# 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.CustomDetection
-- 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.CustomDetection 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.Occurrences
import qualified Amazonka.Prelude as Prelude

-- | Provides information about a custom data identifier that produced a
-- sensitive data finding, and the sensitive data that it detected for the
-- finding.
--
-- /See:/ 'newCustomDetection' smart constructor.
data CustomDetection = CustomDetection'
  { -- | The Amazon Resource Name (ARN) of the custom data identifier.
    CustomDetection -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The total number of occurrences of the sensitive data that the custom
    -- data identifier detected.
    CustomDetection -> Maybe Integer
count :: Prelude.Maybe Prelude.Integer,
    -- | The name of the custom data identifier.
    CustomDetection -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The location of 1-15 occurrences of the sensitive data that the custom
    -- data identifier detected. A finding includes location data for a maximum
    -- of 15 occurrences of sensitive data.
    CustomDetection -> Maybe Occurrences
occurrences :: Prelude.Maybe Occurrences
  }
  deriving (CustomDetection -> CustomDetection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomDetection -> CustomDetection -> Bool
$c/= :: CustomDetection -> CustomDetection -> Bool
== :: CustomDetection -> CustomDetection -> Bool
$c== :: CustomDetection -> CustomDetection -> Bool
Prelude.Eq, ReadPrec [CustomDetection]
ReadPrec CustomDetection
Int -> ReadS CustomDetection
ReadS [CustomDetection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomDetection]
$creadListPrec :: ReadPrec [CustomDetection]
readPrec :: ReadPrec CustomDetection
$creadPrec :: ReadPrec CustomDetection
readList :: ReadS [CustomDetection]
$creadList :: ReadS [CustomDetection]
readsPrec :: Int -> ReadS CustomDetection
$creadsPrec :: Int -> ReadS CustomDetection
Prelude.Read, Int -> CustomDetection -> ShowS
[CustomDetection] -> ShowS
CustomDetection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomDetection] -> ShowS
$cshowList :: [CustomDetection] -> ShowS
show :: CustomDetection -> String
$cshow :: CustomDetection -> String
showsPrec :: Int -> CustomDetection -> ShowS
$cshowsPrec :: Int -> CustomDetection -> ShowS
Prelude.Show, forall x. Rep CustomDetection x -> CustomDetection
forall x. CustomDetection -> Rep CustomDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomDetection x -> CustomDetection
$cfrom :: forall x. CustomDetection -> Rep CustomDetection x
Prelude.Generic)

-- |
-- Create a value of 'CustomDetection' 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:
--
-- 'arn', 'customDetection_arn' - The Amazon Resource Name (ARN) of the custom data identifier.
--
-- 'count', 'customDetection_count' - The total number of occurrences of the sensitive data that the custom
-- data identifier detected.
--
-- 'name', 'customDetection_name' - The name of the custom data identifier.
--
-- 'occurrences', 'customDetection_occurrences' - The location of 1-15 occurrences of the sensitive data that the custom
-- data identifier detected. A finding includes location data for a maximum
-- of 15 occurrences of sensitive data.
newCustomDetection ::
  CustomDetection
newCustomDetection :: CustomDetection
newCustomDetection =
  CustomDetection'
    { $sel:arn:CustomDetection' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:count:CustomDetection' :: Maybe Integer
count = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CustomDetection' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:occurrences:CustomDetection' :: Maybe Occurrences
occurrences = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the custom data identifier.
customDetection_arn :: Lens.Lens' CustomDetection (Prelude.Maybe Prelude.Text)
customDetection_arn :: Lens' CustomDetection (Maybe Text)
customDetection_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDetection' {Maybe Text
arn :: Maybe Text
$sel:arn:CustomDetection' :: CustomDetection -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CustomDetection
s@CustomDetection' {} Maybe Text
a -> CustomDetection
s {$sel:arn:CustomDetection' :: Maybe Text
arn = Maybe Text
a} :: CustomDetection)

-- | The total number of occurrences of the sensitive data that the custom
-- data identifier detected.
customDetection_count :: Lens.Lens' CustomDetection (Prelude.Maybe Prelude.Integer)
customDetection_count :: Lens' CustomDetection (Maybe Integer)
customDetection_count = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDetection' {Maybe Integer
count :: Maybe Integer
$sel:count:CustomDetection' :: CustomDetection -> Maybe Integer
count} -> Maybe Integer
count) (\s :: CustomDetection
s@CustomDetection' {} Maybe Integer
a -> CustomDetection
s {$sel:count:CustomDetection' :: Maybe Integer
count = Maybe Integer
a} :: CustomDetection)

-- | The name of the custom data identifier.
customDetection_name :: Lens.Lens' CustomDetection (Prelude.Maybe Prelude.Text)
customDetection_name :: Lens' CustomDetection (Maybe Text)
customDetection_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDetection' {Maybe Text
name :: Maybe Text
$sel:name:CustomDetection' :: CustomDetection -> Maybe Text
name} -> Maybe Text
name) (\s :: CustomDetection
s@CustomDetection' {} Maybe Text
a -> CustomDetection
s {$sel:name:CustomDetection' :: Maybe Text
name = Maybe Text
a} :: CustomDetection)

-- | The location of 1-15 occurrences of the sensitive data that the custom
-- data identifier detected. A finding includes location data for a maximum
-- of 15 occurrences of sensitive data.
customDetection_occurrences :: Lens.Lens' CustomDetection (Prelude.Maybe Occurrences)
customDetection_occurrences :: Lens' CustomDetection (Maybe Occurrences)
customDetection_occurrences = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDetection' {Maybe Occurrences
occurrences :: Maybe Occurrences
$sel:occurrences:CustomDetection' :: CustomDetection -> Maybe Occurrences
occurrences} -> Maybe Occurrences
occurrences) (\s :: CustomDetection
s@CustomDetection' {} Maybe Occurrences
a -> CustomDetection
s {$sel:occurrences:CustomDetection' :: Maybe Occurrences
occurrences = Maybe Occurrences
a} :: CustomDetection)

instance Data.FromJSON CustomDetection where
  parseJSON :: Value -> Parser CustomDetection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomDetection"
      ( \Object
x ->
          Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Occurrences
-> CustomDetection
CustomDetection'
            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
"arn")
            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
"count")
            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
"name")
            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
"occurrences")
      )

instance Prelude.Hashable CustomDetection where
  hashWithSalt :: Int -> CustomDetection -> Int
hashWithSalt Int
_salt CustomDetection' {Maybe Integer
Maybe Text
Maybe Occurrences
occurrences :: Maybe Occurrences
name :: Maybe Text
count :: Maybe Integer
arn :: Maybe Text
$sel:occurrences:CustomDetection' :: CustomDetection -> Maybe Occurrences
$sel:name:CustomDetection' :: CustomDetection -> Maybe Text
$sel:count:CustomDetection' :: CustomDetection -> Maybe Integer
$sel:arn:CustomDetection' :: CustomDetection -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
count
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Occurrences
occurrences

instance Prelude.NFData CustomDetection where
  rnf :: CustomDetection -> ()
rnf CustomDetection' {Maybe Integer
Maybe Text
Maybe Occurrences
occurrences :: Maybe Occurrences
name :: Maybe Text
count :: Maybe Integer
arn :: Maybe Text
$sel:occurrences:CustomDetection' :: CustomDetection -> Maybe Occurrences
$sel:name:CustomDetection' :: CustomDetection -> Maybe Text
$sel:count:CustomDetection' :: CustomDetection -> Maybe Integer
$sel:arn:CustomDetection' :: CustomDetection -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
count
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Occurrences
occurrences