{-# 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.DefaultDetection
-- 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.DefaultDetection 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 type of sensitive data that was detected by
-- a managed data identifier and produced a sensitive data finding.
--
-- /See:/ 'newDefaultDetection' smart constructor.
data DefaultDetection = DefaultDetection'
  { -- | The total number of occurrences of the type of sensitive data that was
    -- detected.
    DefaultDetection -> Maybe Integer
count :: Prelude.Maybe Prelude.Integer,
    -- | The location of 1-15 occurrences of the sensitive data that was
    -- detected. A finding includes location data for a maximum of 15
    -- occurrences of sensitive data.
    DefaultDetection -> Maybe Occurrences
occurrences :: Prelude.Maybe Occurrences,
    -- | The type of sensitive data that was detected. For example,
    -- AWS_CREDENTIALS, PHONE_NUMBER, or ADDRESS.
    DefaultDetection -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (DefaultDetection -> DefaultDetection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefaultDetection -> DefaultDetection -> Bool
$c/= :: DefaultDetection -> DefaultDetection -> Bool
== :: DefaultDetection -> DefaultDetection -> Bool
$c== :: DefaultDetection -> DefaultDetection -> Bool
Prelude.Eq, ReadPrec [DefaultDetection]
ReadPrec DefaultDetection
Int -> ReadS DefaultDetection
ReadS [DefaultDetection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefaultDetection]
$creadListPrec :: ReadPrec [DefaultDetection]
readPrec :: ReadPrec DefaultDetection
$creadPrec :: ReadPrec DefaultDetection
readList :: ReadS [DefaultDetection]
$creadList :: ReadS [DefaultDetection]
readsPrec :: Int -> ReadS DefaultDetection
$creadsPrec :: Int -> ReadS DefaultDetection
Prelude.Read, Int -> DefaultDetection -> ShowS
[DefaultDetection] -> ShowS
DefaultDetection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefaultDetection] -> ShowS
$cshowList :: [DefaultDetection] -> ShowS
show :: DefaultDetection -> String
$cshow :: DefaultDetection -> String
showsPrec :: Int -> DefaultDetection -> ShowS
$cshowsPrec :: Int -> DefaultDetection -> ShowS
Prelude.Show, forall x. Rep DefaultDetection x -> DefaultDetection
forall x. DefaultDetection -> Rep DefaultDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DefaultDetection x -> DefaultDetection
$cfrom :: forall x. DefaultDetection -> Rep DefaultDetection x
Prelude.Generic)

-- |
-- Create a value of 'DefaultDetection' 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:
--
-- 'count', 'defaultDetection_count' - The total number of occurrences of the type of sensitive data that was
-- detected.
--
-- 'occurrences', 'defaultDetection_occurrences' - The location of 1-15 occurrences of the sensitive data that was
-- detected. A finding includes location data for a maximum of 15
-- occurrences of sensitive data.
--
-- 'type'', 'defaultDetection_type' - The type of sensitive data that was detected. For example,
-- AWS_CREDENTIALS, PHONE_NUMBER, or ADDRESS.
newDefaultDetection ::
  DefaultDetection
newDefaultDetection :: DefaultDetection
newDefaultDetection =
  DefaultDetection'
    { $sel:count:DefaultDetection' :: Maybe Integer
count = forall a. Maybe a
Prelude.Nothing,
      $sel:occurrences:DefaultDetection' :: Maybe Occurrences
occurrences = forall a. Maybe a
Prelude.Nothing,
      $sel:type':DefaultDetection' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | The type of sensitive data that was detected. For example,
-- AWS_CREDENTIALS, PHONE_NUMBER, or ADDRESS.
defaultDetection_type :: Lens.Lens' DefaultDetection (Prelude.Maybe Prelude.Text)
defaultDetection_type :: Lens' DefaultDetection (Maybe Text)
defaultDetection_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultDetection' {Maybe Text
type' :: Maybe Text
$sel:type':DefaultDetection' :: DefaultDetection -> Maybe Text
type'} -> Maybe Text
type') (\s :: DefaultDetection
s@DefaultDetection' {} Maybe Text
a -> DefaultDetection
s {$sel:type':DefaultDetection' :: Maybe Text
type' = Maybe Text
a} :: DefaultDetection)

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

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

instance Prelude.NFData DefaultDetection where
  rnf :: DefaultDetection -> ()
rnf DefaultDetection' {Maybe Integer
Maybe Text
Maybe Occurrences
type' :: Maybe Text
occurrences :: Maybe Occurrences
count :: Maybe Integer
$sel:type':DefaultDetection' :: DefaultDetection -> Maybe Text
$sel:occurrences:DefaultDetection' :: DefaultDetection -> Maybe Occurrences
$sel:count:DefaultDetection' :: DefaultDetection -> Maybe Integer
..} =
    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 Occurrences
occurrences
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'