{-# 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-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.DefaultDetection where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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 total number of occurrences of the type of sensitive data that was
    -- detected.
    DefaultDetection -> Maybe Integer
count :: Prelude.Maybe Prelude.Integer,
    -- | 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
(DefaultDetection -> DefaultDetection -> Bool)
-> (DefaultDetection -> DefaultDetection -> Bool)
-> Eq DefaultDetection
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]
(Int -> ReadS DefaultDetection)
-> ReadS [DefaultDetection]
-> ReadPrec DefaultDetection
-> ReadPrec [DefaultDetection]
-> Read 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
(Int -> DefaultDetection -> ShowS)
-> (DefaultDetection -> String)
-> ([DefaultDetection] -> ShowS)
-> Show DefaultDetection
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. DefaultDetection -> Rep DefaultDetection x)
-> (forall x. Rep DefaultDetection x -> DefaultDetection)
-> Generic DefaultDetection
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:
--
-- '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.
--
-- 'count', 'defaultDetection_count' - The total number of occurrences of the type of sensitive data that was
-- detected.
--
-- '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' :: Maybe Occurrences
-> Maybe Integer -> Maybe Text -> DefaultDetection
DefaultDetection'
    { $sel:occurrences:DefaultDetection' :: Maybe Occurrences
occurrences = Maybe Occurrences
forall a. Maybe a
Prelude.Nothing,
      $sel:count:DefaultDetection' :: Maybe Integer
count = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:type':DefaultDetection' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Occurrences -> f (Maybe Occurrences))
-> DefaultDetection -> f DefaultDetection
defaultDetection_occurrences = (DefaultDetection -> Maybe Occurrences)
-> (DefaultDetection -> Maybe Occurrences -> DefaultDetection)
-> Lens
     DefaultDetection
     DefaultDetection
     (Maybe Occurrences)
     (Maybe 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 total number of occurrences of the type of sensitive data that was
-- detected.
defaultDetection_count :: Lens.Lens' DefaultDetection (Prelude.Maybe Prelude.Integer)
defaultDetection_count :: (Maybe Integer -> f (Maybe Integer))
-> DefaultDetection -> f DefaultDetection
defaultDetection_count = (DefaultDetection -> Maybe Integer)
-> (DefaultDetection -> Maybe Integer -> DefaultDetection)
-> Lens
     DefaultDetection DefaultDetection (Maybe Integer) (Maybe Integer)
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 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 :: (Maybe Text -> f (Maybe Text))
-> DefaultDetection -> f DefaultDetection
defaultDetection_type = (DefaultDetection -> Maybe Text)
-> (DefaultDetection -> Maybe Text -> DefaultDetection)
-> Lens DefaultDetection DefaultDetection (Maybe Text) (Maybe Text)
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 Core.FromJSON DefaultDetection where
  parseJSON :: Value -> Parser DefaultDetection
parseJSON =
    String
-> (Object -> Parser DefaultDetection)
-> Value
-> Parser DefaultDetection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DefaultDetection"
      ( \Object
x ->
          Maybe Occurrences
-> Maybe Integer -> Maybe Text -> DefaultDetection
DefaultDetection'
            (Maybe Occurrences
 -> Maybe Integer -> Maybe Text -> DefaultDetection)
-> Parser (Maybe Occurrences)
-> Parser (Maybe Integer -> Maybe Text -> DefaultDetection)
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 Integer -> Maybe Text -> DefaultDetection)
-> Parser (Maybe Integer)
-> Parser (Maybe Text -> DefaultDetection)
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 -> DefaultDetection)
-> Parser (Maybe Text) -> Parser DefaultDetection
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
"type")
      )

instance Prelude.Hashable DefaultDetection

instance Prelude.NFData DefaultDetection