{-# 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.DataExchange.Types.AutoExportRevisionToS3RequestDetails
-- 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.DataExchange.Types.AutoExportRevisionToS3RequestDetails where

import qualified Amazonka.Core as Core
import Amazonka.DataExchange.Types.AutoExportRevisionDestinationEntry
import Amazonka.DataExchange.Types.ExportServerSideEncryption
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details of the operation to be performed by the job.
--
-- /See:/ 'newAutoExportRevisionToS3RequestDetails' smart constructor.
data AutoExportRevisionToS3RequestDetails = AutoExportRevisionToS3RequestDetails'
  { -- | Encryption configuration for the auto export job.
    AutoExportRevisionToS3RequestDetails
-> Maybe ExportServerSideEncryption
encryption :: Prelude.Maybe ExportServerSideEncryption,
    -- | A revision destination is the Amazon S3 bucket folder destination to
    -- where the export will be sent.
    AutoExportRevisionToS3RequestDetails
-> AutoExportRevisionDestinationEntry
revisionDestination :: AutoExportRevisionDestinationEntry
  }
  deriving (AutoExportRevisionToS3RequestDetails
-> AutoExportRevisionToS3RequestDetails -> Bool
(AutoExportRevisionToS3RequestDetails
 -> AutoExportRevisionToS3RequestDetails -> Bool)
-> (AutoExportRevisionToS3RequestDetails
    -> AutoExportRevisionToS3RequestDetails -> Bool)
-> Eq AutoExportRevisionToS3RequestDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoExportRevisionToS3RequestDetails
-> AutoExportRevisionToS3RequestDetails -> Bool
$c/= :: AutoExportRevisionToS3RequestDetails
-> AutoExportRevisionToS3RequestDetails -> Bool
== :: AutoExportRevisionToS3RequestDetails
-> AutoExportRevisionToS3RequestDetails -> Bool
$c== :: AutoExportRevisionToS3RequestDetails
-> AutoExportRevisionToS3RequestDetails -> Bool
Prelude.Eq, ReadPrec [AutoExportRevisionToS3RequestDetails]
ReadPrec AutoExportRevisionToS3RequestDetails
Int -> ReadS AutoExportRevisionToS3RequestDetails
ReadS [AutoExportRevisionToS3RequestDetails]
(Int -> ReadS AutoExportRevisionToS3RequestDetails)
-> ReadS [AutoExportRevisionToS3RequestDetails]
-> ReadPrec AutoExportRevisionToS3RequestDetails
-> ReadPrec [AutoExportRevisionToS3RequestDetails]
-> Read AutoExportRevisionToS3RequestDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoExportRevisionToS3RequestDetails]
$creadListPrec :: ReadPrec [AutoExportRevisionToS3RequestDetails]
readPrec :: ReadPrec AutoExportRevisionToS3RequestDetails
$creadPrec :: ReadPrec AutoExportRevisionToS3RequestDetails
readList :: ReadS [AutoExportRevisionToS3RequestDetails]
$creadList :: ReadS [AutoExportRevisionToS3RequestDetails]
readsPrec :: Int -> ReadS AutoExportRevisionToS3RequestDetails
$creadsPrec :: Int -> ReadS AutoExportRevisionToS3RequestDetails
Prelude.Read, Int -> AutoExportRevisionToS3RequestDetails -> ShowS
[AutoExportRevisionToS3RequestDetails] -> ShowS
AutoExportRevisionToS3RequestDetails -> String
(Int -> AutoExportRevisionToS3RequestDetails -> ShowS)
-> (AutoExportRevisionToS3RequestDetails -> String)
-> ([AutoExportRevisionToS3RequestDetails] -> ShowS)
-> Show AutoExportRevisionToS3RequestDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoExportRevisionToS3RequestDetails] -> ShowS
$cshowList :: [AutoExportRevisionToS3RequestDetails] -> ShowS
show :: AutoExportRevisionToS3RequestDetails -> String
$cshow :: AutoExportRevisionToS3RequestDetails -> String
showsPrec :: Int -> AutoExportRevisionToS3RequestDetails -> ShowS
$cshowsPrec :: Int -> AutoExportRevisionToS3RequestDetails -> ShowS
Prelude.Show, (forall x.
 AutoExportRevisionToS3RequestDetails
 -> Rep AutoExportRevisionToS3RequestDetails x)
-> (forall x.
    Rep AutoExportRevisionToS3RequestDetails x
    -> AutoExportRevisionToS3RequestDetails)
-> Generic AutoExportRevisionToS3RequestDetails
forall x.
Rep AutoExportRevisionToS3RequestDetails x
-> AutoExportRevisionToS3RequestDetails
forall x.
AutoExportRevisionToS3RequestDetails
-> Rep AutoExportRevisionToS3RequestDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutoExportRevisionToS3RequestDetails x
-> AutoExportRevisionToS3RequestDetails
$cfrom :: forall x.
AutoExportRevisionToS3RequestDetails
-> Rep AutoExportRevisionToS3RequestDetails x
Prelude.Generic)

-- |
-- Create a value of 'AutoExportRevisionToS3RequestDetails' 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:
--
-- 'encryption', 'autoExportRevisionToS3RequestDetails_encryption' - Encryption configuration for the auto export job.
--
-- 'revisionDestination', 'autoExportRevisionToS3RequestDetails_revisionDestination' - A revision destination is the Amazon S3 bucket folder destination to
-- where the export will be sent.
newAutoExportRevisionToS3RequestDetails ::
  -- | 'revisionDestination'
  AutoExportRevisionDestinationEntry ->
  AutoExportRevisionToS3RequestDetails
newAutoExportRevisionToS3RequestDetails :: AutoExportRevisionDestinationEntry
-> AutoExportRevisionToS3RequestDetails
newAutoExportRevisionToS3RequestDetails
  AutoExportRevisionDestinationEntry
pRevisionDestination_ =
    AutoExportRevisionToS3RequestDetails' :: Maybe ExportServerSideEncryption
-> AutoExportRevisionDestinationEntry
-> AutoExportRevisionToS3RequestDetails
AutoExportRevisionToS3RequestDetails'
      { $sel:encryption:AutoExportRevisionToS3RequestDetails' :: Maybe ExportServerSideEncryption
encryption =
          Maybe ExportServerSideEncryption
forall a. Maybe a
Prelude.Nothing,
        $sel:revisionDestination:AutoExportRevisionToS3RequestDetails' :: AutoExportRevisionDestinationEntry
revisionDestination =
          AutoExportRevisionDestinationEntry
pRevisionDestination_
      }

-- | Encryption configuration for the auto export job.
autoExportRevisionToS3RequestDetails_encryption :: Lens.Lens' AutoExportRevisionToS3RequestDetails (Prelude.Maybe ExportServerSideEncryption)
autoExportRevisionToS3RequestDetails_encryption :: (Maybe ExportServerSideEncryption
 -> f (Maybe ExportServerSideEncryption))
-> AutoExportRevisionToS3RequestDetails
-> f AutoExportRevisionToS3RequestDetails
autoExportRevisionToS3RequestDetails_encryption = (AutoExportRevisionToS3RequestDetails
 -> Maybe ExportServerSideEncryption)
-> (AutoExportRevisionToS3RequestDetails
    -> Maybe ExportServerSideEncryption
    -> AutoExportRevisionToS3RequestDetails)
-> Lens
     AutoExportRevisionToS3RequestDetails
     AutoExportRevisionToS3RequestDetails
     (Maybe ExportServerSideEncryption)
     (Maybe ExportServerSideEncryption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoExportRevisionToS3RequestDetails' {Maybe ExportServerSideEncryption
encryption :: Maybe ExportServerSideEncryption
$sel:encryption:AutoExportRevisionToS3RequestDetails' :: AutoExportRevisionToS3RequestDetails
-> Maybe ExportServerSideEncryption
encryption} -> Maybe ExportServerSideEncryption
encryption) (\s :: AutoExportRevisionToS3RequestDetails
s@AutoExportRevisionToS3RequestDetails' {} Maybe ExportServerSideEncryption
a -> AutoExportRevisionToS3RequestDetails
s {$sel:encryption:AutoExportRevisionToS3RequestDetails' :: Maybe ExportServerSideEncryption
encryption = Maybe ExportServerSideEncryption
a} :: AutoExportRevisionToS3RequestDetails)

-- | A revision destination is the Amazon S3 bucket folder destination to
-- where the export will be sent.
autoExportRevisionToS3RequestDetails_revisionDestination :: Lens.Lens' AutoExportRevisionToS3RequestDetails AutoExportRevisionDestinationEntry
autoExportRevisionToS3RequestDetails_revisionDestination :: (AutoExportRevisionDestinationEntry
 -> f AutoExportRevisionDestinationEntry)
-> AutoExportRevisionToS3RequestDetails
-> f AutoExportRevisionToS3RequestDetails
autoExportRevisionToS3RequestDetails_revisionDestination = (AutoExportRevisionToS3RequestDetails
 -> AutoExportRevisionDestinationEntry)
-> (AutoExportRevisionToS3RequestDetails
    -> AutoExportRevisionDestinationEntry
    -> AutoExportRevisionToS3RequestDetails)
-> Lens
     AutoExportRevisionToS3RequestDetails
     AutoExportRevisionToS3RequestDetails
     AutoExportRevisionDestinationEntry
     AutoExportRevisionDestinationEntry
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoExportRevisionToS3RequestDetails' {AutoExportRevisionDestinationEntry
revisionDestination :: AutoExportRevisionDestinationEntry
$sel:revisionDestination:AutoExportRevisionToS3RequestDetails' :: AutoExportRevisionToS3RequestDetails
-> AutoExportRevisionDestinationEntry
revisionDestination} -> AutoExportRevisionDestinationEntry
revisionDestination) (\s :: AutoExportRevisionToS3RequestDetails
s@AutoExportRevisionToS3RequestDetails' {} AutoExportRevisionDestinationEntry
a -> AutoExportRevisionToS3RequestDetails
s {$sel:revisionDestination:AutoExportRevisionToS3RequestDetails' :: AutoExportRevisionDestinationEntry
revisionDestination = AutoExportRevisionDestinationEntry
a} :: AutoExportRevisionToS3RequestDetails)

instance
  Core.FromJSON
    AutoExportRevisionToS3RequestDetails
  where
  parseJSON :: Value -> Parser AutoExportRevisionToS3RequestDetails
parseJSON =
    String
-> (Object -> Parser AutoExportRevisionToS3RequestDetails)
-> Value
-> Parser AutoExportRevisionToS3RequestDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutoExportRevisionToS3RequestDetails"
      ( \Object
x ->
          Maybe ExportServerSideEncryption
-> AutoExportRevisionDestinationEntry
-> AutoExportRevisionToS3RequestDetails
AutoExportRevisionToS3RequestDetails'
            (Maybe ExportServerSideEncryption
 -> AutoExportRevisionDestinationEntry
 -> AutoExportRevisionToS3RequestDetails)
-> Parser (Maybe ExportServerSideEncryption)
-> Parser
     (AutoExportRevisionDestinationEntry
      -> AutoExportRevisionToS3RequestDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ExportServerSideEncryption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Encryption")
            Parser
  (AutoExportRevisionDestinationEntry
   -> AutoExportRevisionToS3RequestDetails)
-> Parser AutoExportRevisionDestinationEntry
-> Parser AutoExportRevisionToS3RequestDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AutoExportRevisionDestinationEntry
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RevisionDestination")
      )

instance
  Prelude.Hashable
    AutoExportRevisionToS3RequestDetails

instance
  Prelude.NFData
    AutoExportRevisionToS3RequestDetails

instance
  Core.ToJSON
    AutoExportRevisionToS3RequestDetails
  where
  toJSON :: AutoExportRevisionToS3RequestDetails -> Value
toJSON AutoExportRevisionToS3RequestDetails' {Maybe ExportServerSideEncryption
AutoExportRevisionDestinationEntry
revisionDestination :: AutoExportRevisionDestinationEntry
encryption :: Maybe ExportServerSideEncryption
$sel:revisionDestination:AutoExportRevisionToS3RequestDetails' :: AutoExportRevisionToS3RequestDetails
-> AutoExportRevisionDestinationEntry
$sel:encryption:AutoExportRevisionToS3RequestDetails' :: AutoExportRevisionToS3RequestDetails
-> Maybe ExportServerSideEncryption
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Encryption" Text -> ExportServerSideEncryption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ExportServerSideEncryption -> Pair)
-> Maybe ExportServerSideEncryption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ExportServerSideEncryption
encryption,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"RevisionDestination" Text -> AutoExportRevisionDestinationEntry -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AutoExportRevisionDestinationEntry
revisionDestination)
          ]
      )