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

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

-- | Provides details about sensitive data that was detected on a resource.
--
-- /See:/ 'newDataClassificationDetails' smart constructor.
data DataClassificationDetails = DataClassificationDetails'
  { -- | The path to the folder or file that contains the sensitive data.
    DataClassificationDetails -> Maybe Text
detailedResultsLocation :: Prelude.Maybe Prelude.Text,
    -- | The details about the sensitive data that was detected on the resource.
    DataClassificationDetails -> Maybe ClassificationResult
result :: Prelude.Maybe ClassificationResult
  }
  deriving (DataClassificationDetails -> DataClassificationDetails -> Bool
(DataClassificationDetails -> DataClassificationDetails -> Bool)
-> (DataClassificationDetails -> DataClassificationDetails -> Bool)
-> Eq DataClassificationDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataClassificationDetails -> DataClassificationDetails -> Bool
$c/= :: DataClassificationDetails -> DataClassificationDetails -> Bool
== :: DataClassificationDetails -> DataClassificationDetails -> Bool
$c== :: DataClassificationDetails -> DataClassificationDetails -> Bool
Prelude.Eq, ReadPrec [DataClassificationDetails]
ReadPrec DataClassificationDetails
Int -> ReadS DataClassificationDetails
ReadS [DataClassificationDetails]
(Int -> ReadS DataClassificationDetails)
-> ReadS [DataClassificationDetails]
-> ReadPrec DataClassificationDetails
-> ReadPrec [DataClassificationDetails]
-> Read DataClassificationDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataClassificationDetails]
$creadListPrec :: ReadPrec [DataClassificationDetails]
readPrec :: ReadPrec DataClassificationDetails
$creadPrec :: ReadPrec DataClassificationDetails
readList :: ReadS [DataClassificationDetails]
$creadList :: ReadS [DataClassificationDetails]
readsPrec :: Int -> ReadS DataClassificationDetails
$creadsPrec :: Int -> ReadS DataClassificationDetails
Prelude.Read, Int -> DataClassificationDetails -> ShowS
[DataClassificationDetails] -> ShowS
DataClassificationDetails -> String
(Int -> DataClassificationDetails -> ShowS)
-> (DataClassificationDetails -> String)
-> ([DataClassificationDetails] -> ShowS)
-> Show DataClassificationDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataClassificationDetails] -> ShowS
$cshowList :: [DataClassificationDetails] -> ShowS
show :: DataClassificationDetails -> String
$cshow :: DataClassificationDetails -> String
showsPrec :: Int -> DataClassificationDetails -> ShowS
$cshowsPrec :: Int -> DataClassificationDetails -> ShowS
Prelude.Show, (forall x.
 DataClassificationDetails -> Rep DataClassificationDetails x)
-> (forall x.
    Rep DataClassificationDetails x -> DataClassificationDetails)
-> Generic DataClassificationDetails
forall x.
Rep DataClassificationDetails x -> DataClassificationDetails
forall x.
DataClassificationDetails -> Rep DataClassificationDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DataClassificationDetails x -> DataClassificationDetails
$cfrom :: forall x.
DataClassificationDetails -> Rep DataClassificationDetails x
Prelude.Generic)

-- |
-- Create a value of 'DataClassificationDetails' 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:
--
-- 'detailedResultsLocation', 'dataClassificationDetails_detailedResultsLocation' - The path to the folder or file that contains the sensitive data.
--
-- 'result', 'dataClassificationDetails_result' - The details about the sensitive data that was detected on the resource.
newDataClassificationDetails ::
  DataClassificationDetails
newDataClassificationDetails :: DataClassificationDetails
newDataClassificationDetails =
  DataClassificationDetails' :: Maybe Text
-> Maybe ClassificationResult -> DataClassificationDetails
DataClassificationDetails'
    { $sel:detailedResultsLocation:DataClassificationDetails' :: Maybe Text
detailedResultsLocation =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:result:DataClassificationDetails' :: Maybe ClassificationResult
result = Maybe ClassificationResult
forall a. Maybe a
Prelude.Nothing
    }

-- | The path to the folder or file that contains the sensitive data.
dataClassificationDetails_detailedResultsLocation :: Lens.Lens' DataClassificationDetails (Prelude.Maybe Prelude.Text)
dataClassificationDetails_detailedResultsLocation :: (Maybe Text -> f (Maybe Text))
-> DataClassificationDetails -> f DataClassificationDetails
dataClassificationDetails_detailedResultsLocation = (DataClassificationDetails -> Maybe Text)
-> (DataClassificationDetails
    -> Maybe Text -> DataClassificationDetails)
-> Lens
     DataClassificationDetails
     DataClassificationDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataClassificationDetails' {Maybe Text
detailedResultsLocation :: Maybe Text
$sel:detailedResultsLocation:DataClassificationDetails' :: DataClassificationDetails -> Maybe Text
detailedResultsLocation} -> Maybe Text
detailedResultsLocation) (\s :: DataClassificationDetails
s@DataClassificationDetails' {} Maybe Text
a -> DataClassificationDetails
s {$sel:detailedResultsLocation:DataClassificationDetails' :: Maybe Text
detailedResultsLocation = Maybe Text
a} :: DataClassificationDetails)

-- | The details about the sensitive data that was detected on the resource.
dataClassificationDetails_result :: Lens.Lens' DataClassificationDetails (Prelude.Maybe ClassificationResult)
dataClassificationDetails_result :: (Maybe ClassificationResult -> f (Maybe ClassificationResult))
-> DataClassificationDetails -> f DataClassificationDetails
dataClassificationDetails_result = (DataClassificationDetails -> Maybe ClassificationResult)
-> (DataClassificationDetails
    -> Maybe ClassificationResult -> DataClassificationDetails)
-> Lens
     DataClassificationDetails
     DataClassificationDetails
     (Maybe ClassificationResult)
     (Maybe ClassificationResult)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataClassificationDetails' {Maybe ClassificationResult
result :: Maybe ClassificationResult
$sel:result:DataClassificationDetails' :: DataClassificationDetails -> Maybe ClassificationResult
result} -> Maybe ClassificationResult
result) (\s :: DataClassificationDetails
s@DataClassificationDetails' {} Maybe ClassificationResult
a -> DataClassificationDetails
s {$sel:result:DataClassificationDetails' :: Maybe ClassificationResult
result = Maybe ClassificationResult
a} :: DataClassificationDetails)

instance Core.FromJSON DataClassificationDetails where
  parseJSON :: Value -> Parser DataClassificationDetails
parseJSON =
    String
-> (Object -> Parser DataClassificationDetails)
-> Value
-> Parser DataClassificationDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DataClassificationDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe ClassificationResult -> DataClassificationDetails
DataClassificationDetails'
            (Maybe Text
 -> Maybe ClassificationResult -> DataClassificationDetails)
-> Parser (Maybe Text)
-> Parser (Maybe ClassificationResult -> DataClassificationDetails)
forall (f :: * -> *) a b. Functor 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
"DetailedResultsLocation")
            Parser (Maybe ClassificationResult -> DataClassificationDetails)
-> Parser (Maybe ClassificationResult)
-> Parser DataClassificationDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ClassificationResult)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Result")
      )

instance Prelude.Hashable DataClassificationDetails

instance Prelude.NFData DataClassificationDetails

instance Core.ToJSON DataClassificationDetails where
  toJSON :: DataClassificationDetails -> Value
toJSON DataClassificationDetails' {Maybe Text
Maybe ClassificationResult
result :: Maybe ClassificationResult
detailedResultsLocation :: Maybe Text
$sel:result:DataClassificationDetails' :: DataClassificationDetails -> Maybe ClassificationResult
$sel:detailedResultsLocation:DataClassificationDetails' :: DataClassificationDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DetailedResultsLocation" 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
detailedResultsLocation,
            (Text
"Result" Text -> ClassificationResult -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ClassificationResult -> Pair)
-> Maybe ClassificationResult -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ClassificationResult
result
          ]
      )