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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.S3Destination
import qualified Amazonka.Prelude as Prelude

-- | Specifies where to store data classification results, and the encryption
-- settings to use when storing results in that location. Currently, you
-- can store classification results only in an S3 bucket.
--
-- /See:/ 'newClassificationExportConfiguration' smart constructor.
data ClassificationExportConfiguration = ClassificationExportConfiguration'
  { -- | The S3 bucket to store data classification results in, and the
    -- encryption settings to use when storing results in that bucket.
    ClassificationExportConfiguration -> Maybe S3Destination
s3Destination :: Prelude.Maybe S3Destination
  }
  deriving (ClassificationExportConfiguration
-> ClassificationExportConfiguration -> Bool
(ClassificationExportConfiguration
 -> ClassificationExportConfiguration -> Bool)
-> (ClassificationExportConfiguration
    -> ClassificationExportConfiguration -> Bool)
-> Eq ClassificationExportConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClassificationExportConfiguration
-> ClassificationExportConfiguration -> Bool
$c/= :: ClassificationExportConfiguration
-> ClassificationExportConfiguration -> Bool
== :: ClassificationExportConfiguration
-> ClassificationExportConfiguration -> Bool
$c== :: ClassificationExportConfiguration
-> ClassificationExportConfiguration -> Bool
Prelude.Eq, ReadPrec [ClassificationExportConfiguration]
ReadPrec ClassificationExportConfiguration
Int -> ReadS ClassificationExportConfiguration
ReadS [ClassificationExportConfiguration]
(Int -> ReadS ClassificationExportConfiguration)
-> ReadS [ClassificationExportConfiguration]
-> ReadPrec ClassificationExportConfiguration
-> ReadPrec [ClassificationExportConfiguration]
-> Read ClassificationExportConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClassificationExportConfiguration]
$creadListPrec :: ReadPrec [ClassificationExportConfiguration]
readPrec :: ReadPrec ClassificationExportConfiguration
$creadPrec :: ReadPrec ClassificationExportConfiguration
readList :: ReadS [ClassificationExportConfiguration]
$creadList :: ReadS [ClassificationExportConfiguration]
readsPrec :: Int -> ReadS ClassificationExportConfiguration
$creadsPrec :: Int -> ReadS ClassificationExportConfiguration
Prelude.Read, Int -> ClassificationExportConfiguration -> ShowS
[ClassificationExportConfiguration] -> ShowS
ClassificationExportConfiguration -> String
(Int -> ClassificationExportConfiguration -> ShowS)
-> (ClassificationExportConfiguration -> String)
-> ([ClassificationExportConfiguration] -> ShowS)
-> Show ClassificationExportConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClassificationExportConfiguration] -> ShowS
$cshowList :: [ClassificationExportConfiguration] -> ShowS
show :: ClassificationExportConfiguration -> String
$cshow :: ClassificationExportConfiguration -> String
showsPrec :: Int -> ClassificationExportConfiguration -> ShowS
$cshowsPrec :: Int -> ClassificationExportConfiguration -> ShowS
Prelude.Show, (forall x.
 ClassificationExportConfiguration
 -> Rep ClassificationExportConfiguration x)
-> (forall x.
    Rep ClassificationExportConfiguration x
    -> ClassificationExportConfiguration)
-> Generic ClassificationExportConfiguration
forall x.
Rep ClassificationExportConfiguration x
-> ClassificationExportConfiguration
forall x.
ClassificationExportConfiguration
-> Rep ClassificationExportConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ClassificationExportConfiguration x
-> ClassificationExportConfiguration
$cfrom :: forall x.
ClassificationExportConfiguration
-> Rep ClassificationExportConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ClassificationExportConfiguration' 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:
--
-- 's3Destination', 'classificationExportConfiguration_s3Destination' - The S3 bucket to store data classification results in, and the
-- encryption settings to use when storing results in that bucket.
newClassificationExportConfiguration ::
  ClassificationExportConfiguration
newClassificationExportConfiguration :: ClassificationExportConfiguration
newClassificationExportConfiguration =
  ClassificationExportConfiguration' :: Maybe S3Destination -> ClassificationExportConfiguration
ClassificationExportConfiguration'
    { $sel:s3Destination:ClassificationExportConfiguration' :: Maybe S3Destination
s3Destination =
        Maybe S3Destination
forall a. Maybe a
Prelude.Nothing
    }

-- | The S3 bucket to store data classification results in, and the
-- encryption settings to use when storing results in that bucket.
classificationExportConfiguration_s3Destination :: Lens.Lens' ClassificationExportConfiguration (Prelude.Maybe S3Destination)
classificationExportConfiguration_s3Destination :: (Maybe S3Destination -> f (Maybe S3Destination))
-> ClassificationExportConfiguration
-> f ClassificationExportConfiguration
classificationExportConfiguration_s3Destination = (ClassificationExportConfiguration -> Maybe S3Destination)
-> (ClassificationExportConfiguration
    -> Maybe S3Destination -> ClassificationExportConfiguration)
-> Lens
     ClassificationExportConfiguration
     ClassificationExportConfiguration
     (Maybe S3Destination)
     (Maybe S3Destination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationExportConfiguration' {Maybe S3Destination
s3Destination :: Maybe S3Destination
$sel:s3Destination:ClassificationExportConfiguration' :: ClassificationExportConfiguration -> Maybe S3Destination
s3Destination} -> Maybe S3Destination
s3Destination) (\s :: ClassificationExportConfiguration
s@ClassificationExportConfiguration' {} Maybe S3Destination
a -> ClassificationExportConfiguration
s {$sel:s3Destination:ClassificationExportConfiguration' :: Maybe S3Destination
s3Destination = Maybe S3Destination
a} :: ClassificationExportConfiguration)

instance
  Core.FromJSON
    ClassificationExportConfiguration
  where
  parseJSON :: Value -> Parser ClassificationExportConfiguration
parseJSON =
    String
-> (Object -> Parser ClassificationExportConfiguration)
-> Value
-> Parser ClassificationExportConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ClassificationExportConfiguration"
      ( \Object
x ->
          Maybe S3Destination -> ClassificationExportConfiguration
ClassificationExportConfiguration'
            (Maybe S3Destination -> ClassificationExportConfiguration)
-> Parser (Maybe S3Destination)
-> Parser ClassificationExportConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe S3Destination)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3Destination")
      )

instance
  Prelude.Hashable
    ClassificationExportConfiguration

instance
  Prelude.NFData
    ClassificationExportConfiguration

instance
  Core.ToJSON
    ClassificationExportConfiguration
  where
  toJSON :: ClassificationExportConfiguration -> Value
toJSON ClassificationExportConfiguration' {Maybe S3Destination
s3Destination :: Maybe S3Destination
$sel:s3Destination:ClassificationExportConfiguration' :: ClassificationExportConfiguration -> Maybe S3Destination
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"s3Destination" Text -> S3Destination -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (S3Destination -> Pair) -> Maybe S3Destination -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3Destination
s3Destination
          ]
      )