{-# 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.AppFlow.Types.UpsolverS3OutputFormatConfig
-- 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.AppFlow.Types.UpsolverS3OutputFormatConfig where

import Amazonka.AppFlow.Types.AggregationConfig
import Amazonka.AppFlow.Types.FileType
import Amazonka.AppFlow.Types.PrefixConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The configuration that determines how Amazon AppFlow formats the flow
-- output data when Upsolver is used as the destination.
--
-- /See:/ 'newUpsolverS3OutputFormatConfig' smart constructor.
data UpsolverS3OutputFormatConfig = UpsolverS3OutputFormatConfig'
  { UpsolverS3OutputFormatConfig -> Maybe AggregationConfig
aggregationConfig :: Prelude.Maybe AggregationConfig,
    -- | Indicates the file type that Amazon AppFlow places in the Upsolver
    -- Amazon S3 bucket.
    UpsolverS3OutputFormatConfig -> Maybe FileType
fileType :: Prelude.Maybe FileType,
    UpsolverS3OutputFormatConfig -> PrefixConfig
prefixConfig :: PrefixConfig
  }
  deriving (UpsolverS3OutputFormatConfig
-> UpsolverS3OutputFormatConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpsolverS3OutputFormatConfig
-> UpsolverS3OutputFormatConfig -> Bool
$c/= :: UpsolverS3OutputFormatConfig
-> UpsolverS3OutputFormatConfig -> Bool
== :: UpsolverS3OutputFormatConfig
-> UpsolverS3OutputFormatConfig -> Bool
$c== :: UpsolverS3OutputFormatConfig
-> UpsolverS3OutputFormatConfig -> Bool
Prelude.Eq, ReadPrec [UpsolverS3OutputFormatConfig]
ReadPrec UpsolverS3OutputFormatConfig
Int -> ReadS UpsolverS3OutputFormatConfig
ReadS [UpsolverS3OutputFormatConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpsolverS3OutputFormatConfig]
$creadListPrec :: ReadPrec [UpsolverS3OutputFormatConfig]
readPrec :: ReadPrec UpsolverS3OutputFormatConfig
$creadPrec :: ReadPrec UpsolverS3OutputFormatConfig
readList :: ReadS [UpsolverS3OutputFormatConfig]
$creadList :: ReadS [UpsolverS3OutputFormatConfig]
readsPrec :: Int -> ReadS UpsolverS3OutputFormatConfig
$creadsPrec :: Int -> ReadS UpsolverS3OutputFormatConfig
Prelude.Read, Int -> UpsolverS3OutputFormatConfig -> ShowS
[UpsolverS3OutputFormatConfig] -> ShowS
UpsolverS3OutputFormatConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpsolverS3OutputFormatConfig] -> ShowS
$cshowList :: [UpsolverS3OutputFormatConfig] -> ShowS
show :: UpsolverS3OutputFormatConfig -> String
$cshow :: UpsolverS3OutputFormatConfig -> String
showsPrec :: Int -> UpsolverS3OutputFormatConfig -> ShowS
$cshowsPrec :: Int -> UpsolverS3OutputFormatConfig -> ShowS
Prelude.Show, forall x.
Rep UpsolverS3OutputFormatConfig x -> UpsolverS3OutputFormatConfig
forall x.
UpsolverS3OutputFormatConfig -> Rep UpsolverS3OutputFormatConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpsolverS3OutputFormatConfig x -> UpsolverS3OutputFormatConfig
$cfrom :: forall x.
UpsolverS3OutputFormatConfig -> Rep UpsolverS3OutputFormatConfig x
Prelude.Generic)

-- |
-- Create a value of 'UpsolverS3OutputFormatConfig' 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:
--
-- 'aggregationConfig', 'upsolverS3OutputFormatConfig_aggregationConfig' - Undocumented member.
--
-- 'fileType', 'upsolverS3OutputFormatConfig_fileType' - Indicates the file type that Amazon AppFlow places in the Upsolver
-- Amazon S3 bucket.
--
-- 'prefixConfig', 'upsolverS3OutputFormatConfig_prefixConfig' - Undocumented member.
newUpsolverS3OutputFormatConfig ::
  -- | 'prefixConfig'
  PrefixConfig ->
  UpsolverS3OutputFormatConfig
newUpsolverS3OutputFormatConfig :: PrefixConfig -> UpsolverS3OutputFormatConfig
newUpsolverS3OutputFormatConfig PrefixConfig
pPrefixConfig_ =
  UpsolverS3OutputFormatConfig'
    { $sel:aggregationConfig:UpsolverS3OutputFormatConfig' :: Maybe AggregationConfig
aggregationConfig =
        forall a. Maybe a
Prelude.Nothing,
      $sel:fileType:UpsolverS3OutputFormatConfig' :: Maybe FileType
fileType = forall a. Maybe a
Prelude.Nothing,
      $sel:prefixConfig:UpsolverS3OutputFormatConfig' :: PrefixConfig
prefixConfig = PrefixConfig
pPrefixConfig_
    }

-- | Undocumented member.
upsolverS3OutputFormatConfig_aggregationConfig :: Lens.Lens' UpsolverS3OutputFormatConfig (Prelude.Maybe AggregationConfig)
upsolverS3OutputFormatConfig_aggregationConfig :: Lens' UpsolverS3OutputFormatConfig (Maybe AggregationConfig)
upsolverS3OutputFormatConfig_aggregationConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpsolverS3OutputFormatConfig' {Maybe AggregationConfig
aggregationConfig :: Maybe AggregationConfig
$sel:aggregationConfig:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> Maybe AggregationConfig
aggregationConfig} -> Maybe AggregationConfig
aggregationConfig) (\s :: UpsolverS3OutputFormatConfig
s@UpsolverS3OutputFormatConfig' {} Maybe AggregationConfig
a -> UpsolverS3OutputFormatConfig
s {$sel:aggregationConfig:UpsolverS3OutputFormatConfig' :: Maybe AggregationConfig
aggregationConfig = Maybe AggregationConfig
a} :: UpsolverS3OutputFormatConfig)

-- | Indicates the file type that Amazon AppFlow places in the Upsolver
-- Amazon S3 bucket.
upsolverS3OutputFormatConfig_fileType :: Lens.Lens' UpsolverS3OutputFormatConfig (Prelude.Maybe FileType)
upsolverS3OutputFormatConfig_fileType :: Lens' UpsolverS3OutputFormatConfig (Maybe FileType)
upsolverS3OutputFormatConfig_fileType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpsolverS3OutputFormatConfig' {Maybe FileType
fileType :: Maybe FileType
$sel:fileType:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> Maybe FileType
fileType} -> Maybe FileType
fileType) (\s :: UpsolverS3OutputFormatConfig
s@UpsolverS3OutputFormatConfig' {} Maybe FileType
a -> UpsolverS3OutputFormatConfig
s {$sel:fileType:UpsolverS3OutputFormatConfig' :: Maybe FileType
fileType = Maybe FileType
a} :: UpsolverS3OutputFormatConfig)

-- | Undocumented member.
upsolverS3OutputFormatConfig_prefixConfig :: Lens.Lens' UpsolverS3OutputFormatConfig PrefixConfig
upsolverS3OutputFormatConfig_prefixConfig :: Lens' UpsolverS3OutputFormatConfig PrefixConfig
upsolverS3OutputFormatConfig_prefixConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpsolverS3OutputFormatConfig' {PrefixConfig
prefixConfig :: PrefixConfig
$sel:prefixConfig:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> PrefixConfig
prefixConfig} -> PrefixConfig
prefixConfig) (\s :: UpsolverS3OutputFormatConfig
s@UpsolverS3OutputFormatConfig' {} PrefixConfig
a -> UpsolverS3OutputFormatConfig
s {$sel:prefixConfig:UpsolverS3OutputFormatConfig' :: PrefixConfig
prefixConfig = PrefixConfig
a} :: UpsolverS3OutputFormatConfig)

instance Data.FromJSON UpsolverS3OutputFormatConfig where
  parseJSON :: Value -> Parser UpsolverS3OutputFormatConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UpsolverS3OutputFormatConfig"
      ( \Object
x ->
          Maybe AggregationConfig
-> Maybe FileType -> PrefixConfig -> UpsolverS3OutputFormatConfig
UpsolverS3OutputFormatConfig'
            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
"aggregationConfig")
            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
"fileType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"prefixConfig")
      )

instance
  Prelude.Hashable
    UpsolverS3OutputFormatConfig
  where
  hashWithSalt :: Int -> UpsolverS3OutputFormatConfig -> Int
hashWithSalt Int
_salt UpsolverS3OutputFormatConfig' {Maybe AggregationConfig
Maybe FileType
PrefixConfig
prefixConfig :: PrefixConfig
fileType :: Maybe FileType
aggregationConfig :: Maybe AggregationConfig
$sel:prefixConfig:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> PrefixConfig
$sel:fileType:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> Maybe FileType
$sel:aggregationConfig:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> Maybe AggregationConfig
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AggregationConfig
aggregationConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FileType
fileType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PrefixConfig
prefixConfig

instance Prelude.NFData UpsolverS3OutputFormatConfig where
  rnf :: UpsolverS3OutputFormatConfig -> ()
rnf UpsolverS3OutputFormatConfig' {Maybe AggregationConfig
Maybe FileType
PrefixConfig
prefixConfig :: PrefixConfig
fileType :: Maybe FileType
aggregationConfig :: Maybe AggregationConfig
$sel:prefixConfig:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> PrefixConfig
$sel:fileType:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> Maybe FileType
$sel:aggregationConfig:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> Maybe AggregationConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AggregationConfig
aggregationConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FileType
fileType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PrefixConfig
prefixConfig

instance Data.ToJSON UpsolverS3OutputFormatConfig where
  toJSON :: UpsolverS3OutputFormatConfig -> Value
toJSON UpsolverS3OutputFormatConfig' {Maybe AggregationConfig
Maybe FileType
PrefixConfig
prefixConfig :: PrefixConfig
fileType :: Maybe FileType
aggregationConfig :: Maybe AggregationConfig
$sel:prefixConfig:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> PrefixConfig
$sel:fileType:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> Maybe FileType
$sel:aggregationConfig:UpsolverS3OutputFormatConfig' :: UpsolverS3OutputFormatConfig -> Maybe AggregationConfig
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"aggregationConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AggregationConfig
aggregationConfig,
            (Key
"fileType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FileType
fileType,
            forall a. a -> Maybe a
Prelude.Just (Key
"prefixConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PrefixConfig
prefixConfig)
          ]
      )