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

-- | Provides information about a type of sensitive data that Amazon Macie
-- found in an S3 bucket while performing automated sensitive data
-- discovery for the bucket. The information also specifies the custom data
-- identifier or managed data identifier that detected the data. This
-- information is available only if automated sensitive data discovery is
-- currently enabled for your account.
--
-- /See:/ 'newDetection' smart constructor.
data Detection = Detection'
  { -- | If the sensitive data was detected by a custom data identifier, the
    -- Amazon Resource Name (ARN) of the custom data identifier that detected
    -- the data. Otherwise, this value is null.
    Detection -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The total number of occurrences of the sensitive data.
    Detection -> Maybe Integer
count :: Prelude.Maybe Prelude.Integer,
    -- | The unique identifier for the custom data identifier or managed data
    -- identifier that detected the sensitive data. For additional details
    -- about a specified managed data identifier, see
    -- <https://docs.aws.amazon.com/macie/latest/user/managed-data-identifiers.html Using managed data identifiers>
    -- in the /Amazon Macie User Guide/.
    Detection -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of the custom data identifier or managed data identifier that
    -- detected the sensitive data. For a managed data identifier, this value
    -- is the same as the unique identifier (id).
    Detection -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether occurrences of this type of sensitive data are
    -- excluded (true) or included (false) in the bucket\'s sensitivity score.
    Detection -> Maybe Bool
suppressed :: Prelude.Maybe Prelude.Bool,
    -- | The type of data identifier that detected the sensitive data. Possible
    -- values are: CUSTOM, for a custom data identifier; and, MANAGED, for a
    -- managed data identifier.
    Detection -> Maybe DataIdentifierType
type' :: Prelude.Maybe DataIdentifierType
  }
  deriving (Detection -> Detection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Detection -> Detection -> Bool
$c/= :: Detection -> Detection -> Bool
== :: Detection -> Detection -> Bool
$c== :: Detection -> Detection -> Bool
Prelude.Eq, ReadPrec [Detection]
ReadPrec Detection
Int -> ReadS Detection
ReadS [Detection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Detection]
$creadListPrec :: ReadPrec [Detection]
readPrec :: ReadPrec Detection
$creadPrec :: ReadPrec Detection
readList :: ReadS [Detection]
$creadList :: ReadS [Detection]
readsPrec :: Int -> ReadS Detection
$creadsPrec :: Int -> ReadS Detection
Prelude.Read, Int -> Detection -> ShowS
[Detection] -> ShowS
Detection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Detection] -> ShowS
$cshowList :: [Detection] -> ShowS
show :: Detection -> String
$cshow :: Detection -> String
showsPrec :: Int -> Detection -> ShowS
$cshowsPrec :: Int -> Detection -> ShowS
Prelude.Show, forall x. Rep Detection x -> Detection
forall x. Detection -> Rep Detection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Detection x -> Detection
$cfrom :: forall x. Detection -> Rep Detection x
Prelude.Generic)

-- |
-- Create a value of 'Detection' 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', 'detection_arn' - If the sensitive data was detected by a custom data identifier, the
-- Amazon Resource Name (ARN) of the custom data identifier that detected
-- the data. Otherwise, this value is null.
--
-- 'count', 'detection_count' - The total number of occurrences of the sensitive data.
--
-- 'id', 'detection_id' - The unique identifier for the custom data identifier or managed data
-- identifier that detected the sensitive data. For additional details
-- about a specified managed data identifier, see
-- <https://docs.aws.amazon.com/macie/latest/user/managed-data-identifiers.html Using managed data identifiers>
-- in the /Amazon Macie User Guide/.
--
-- 'name', 'detection_name' - The name of the custom data identifier or managed data identifier that
-- detected the sensitive data. For a managed data identifier, this value
-- is the same as the unique identifier (id).
--
-- 'suppressed', 'detection_suppressed' - Specifies whether occurrences of this type of sensitive data are
-- excluded (true) or included (false) in the bucket\'s sensitivity score.
--
-- 'type'', 'detection_type' - The type of data identifier that detected the sensitive data. Possible
-- values are: CUSTOM, for a custom data identifier; and, MANAGED, for a
-- managed data identifier.
newDetection ::
  Detection
newDetection :: Detection
newDetection =
  Detection'
    { $sel:arn:Detection' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:count:Detection' :: Maybe Integer
count = forall a. Maybe a
Prelude.Nothing,
      $sel:id:Detection' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Detection' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:suppressed:Detection' :: Maybe Bool
suppressed = forall a. Maybe a
Prelude.Nothing,
      $sel:type':Detection' :: Maybe DataIdentifierType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | If the sensitive data was detected by a custom data identifier, the
-- Amazon Resource Name (ARN) of the custom data identifier that detected
-- the data. Otherwise, this value is null.
detection_arn :: Lens.Lens' Detection (Prelude.Maybe Prelude.Text)
detection_arn :: Lens' Detection (Maybe Text)
detection_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Detection' {Maybe Text
arn :: Maybe Text
$sel:arn:Detection' :: Detection -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Detection
s@Detection' {} Maybe Text
a -> Detection
s {$sel:arn:Detection' :: Maybe Text
arn = Maybe Text
a} :: Detection)

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

-- | The unique identifier for the custom data identifier or managed data
-- identifier that detected the sensitive data. For additional details
-- about a specified managed data identifier, see
-- <https://docs.aws.amazon.com/macie/latest/user/managed-data-identifiers.html Using managed data identifiers>
-- in the /Amazon Macie User Guide/.
detection_id :: Lens.Lens' Detection (Prelude.Maybe Prelude.Text)
detection_id :: Lens' Detection (Maybe Text)
detection_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Detection' {Maybe Text
id :: Maybe Text
$sel:id:Detection' :: Detection -> Maybe Text
id} -> Maybe Text
id) (\s :: Detection
s@Detection' {} Maybe Text
a -> Detection
s {$sel:id:Detection' :: Maybe Text
id = Maybe Text
a} :: Detection)

-- | The name of the custom data identifier or managed data identifier that
-- detected the sensitive data. For a managed data identifier, this value
-- is the same as the unique identifier (id).
detection_name :: Lens.Lens' Detection (Prelude.Maybe Prelude.Text)
detection_name :: Lens' Detection (Maybe Text)
detection_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Detection' {Maybe Text
name :: Maybe Text
$sel:name:Detection' :: Detection -> Maybe Text
name} -> Maybe Text
name) (\s :: Detection
s@Detection' {} Maybe Text
a -> Detection
s {$sel:name:Detection' :: Maybe Text
name = Maybe Text
a} :: Detection)

-- | Specifies whether occurrences of this type of sensitive data are
-- excluded (true) or included (false) in the bucket\'s sensitivity score.
detection_suppressed :: Lens.Lens' Detection (Prelude.Maybe Prelude.Bool)
detection_suppressed :: Lens' Detection (Maybe Bool)
detection_suppressed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Detection' {Maybe Bool
suppressed :: Maybe Bool
$sel:suppressed:Detection' :: Detection -> Maybe Bool
suppressed} -> Maybe Bool
suppressed) (\s :: Detection
s@Detection' {} Maybe Bool
a -> Detection
s {$sel:suppressed:Detection' :: Maybe Bool
suppressed = Maybe Bool
a} :: Detection)

-- | The type of data identifier that detected the sensitive data. Possible
-- values are: CUSTOM, for a custom data identifier; and, MANAGED, for a
-- managed data identifier.
detection_type :: Lens.Lens' Detection (Prelude.Maybe DataIdentifierType)
detection_type :: Lens' Detection (Maybe DataIdentifierType)
detection_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Detection' {Maybe DataIdentifierType
type' :: Maybe DataIdentifierType
$sel:type':Detection' :: Detection -> Maybe DataIdentifierType
type'} -> Maybe DataIdentifierType
type') (\s :: Detection
s@Detection' {} Maybe DataIdentifierType
a -> Detection
s {$sel:type':Detection' :: Maybe DataIdentifierType
type' = Maybe DataIdentifierType
a} :: Detection)

instance Data.FromJSON Detection where
  parseJSON :: Value -> Parser Detection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Detection"
      ( \Object
x ->
          Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe DataIdentifierType
-> Detection
Detection'
            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
"id")
            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
"suppressed")
            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 Detection where
  hashWithSalt :: Int -> Detection -> Int
hashWithSalt Int
_salt Detection' {Maybe Bool
Maybe Integer
Maybe Text
Maybe DataIdentifierType
type' :: Maybe DataIdentifierType
suppressed :: Maybe Bool
name :: Maybe Text
id :: Maybe Text
count :: Maybe Integer
arn :: Maybe Text
$sel:type':Detection' :: Detection -> Maybe DataIdentifierType
$sel:suppressed:Detection' :: Detection -> Maybe Bool
$sel:name:Detection' :: Detection -> Maybe Text
$sel:id:Detection' :: Detection -> Maybe Text
$sel:count:Detection' :: Detection -> Maybe Integer
$sel:arn:Detection' :: Detection -> 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
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
suppressed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataIdentifierType
type'

instance Prelude.NFData Detection where
  rnf :: Detection -> ()
rnf Detection' {Maybe Bool
Maybe Integer
Maybe Text
Maybe DataIdentifierType
type' :: Maybe DataIdentifierType
suppressed :: Maybe Bool
name :: Maybe Text
id :: Maybe Text
count :: Maybe Integer
arn :: Maybe Text
$sel:type':Detection' :: Detection -> Maybe DataIdentifierType
$sel:suppressed:Detection' :: Detection -> Maybe Bool
$sel:name:Detection' :: Detection -> Maybe Text
$sel:id:Detection' :: Detection -> Maybe Text
$sel:count:Detection' :: Detection -> Maybe Integer
$sel:arn:Detection' :: Detection -> 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
id
      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 Bool
suppressed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataIdentifierType
type'