{-# 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.Firehose.Types.OutputFormatConfiguration
-- 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.Firehose.Types.OutputFormatConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Firehose.Types.Serializer
import qualified Amazonka.Prelude as Prelude

-- | Specifies the serializer that you want Kinesis Data Firehose to use to
-- convert the format of your data before it writes it to Amazon S3. This
-- parameter is required if @Enabled@ is set to true.
--
-- /See:/ 'newOutputFormatConfiguration' smart constructor.
data OutputFormatConfiguration = OutputFormatConfiguration'
  { -- | Specifies which serializer to use. You can choose either the ORC SerDe
    -- or the Parquet SerDe. If both are non-null, the server rejects the
    -- request.
    OutputFormatConfiguration -> Maybe Serializer
serializer :: Prelude.Maybe Serializer
  }
  deriving (OutputFormatConfiguration -> OutputFormatConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputFormatConfiguration -> OutputFormatConfiguration -> Bool
$c/= :: OutputFormatConfiguration -> OutputFormatConfiguration -> Bool
== :: OutputFormatConfiguration -> OutputFormatConfiguration -> Bool
$c== :: OutputFormatConfiguration -> OutputFormatConfiguration -> Bool
Prelude.Eq, ReadPrec [OutputFormatConfiguration]
ReadPrec OutputFormatConfiguration
Int -> ReadS OutputFormatConfiguration
ReadS [OutputFormatConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputFormatConfiguration]
$creadListPrec :: ReadPrec [OutputFormatConfiguration]
readPrec :: ReadPrec OutputFormatConfiguration
$creadPrec :: ReadPrec OutputFormatConfiguration
readList :: ReadS [OutputFormatConfiguration]
$creadList :: ReadS [OutputFormatConfiguration]
readsPrec :: Int -> ReadS OutputFormatConfiguration
$creadsPrec :: Int -> ReadS OutputFormatConfiguration
Prelude.Read, Int -> OutputFormatConfiguration -> ShowS
[OutputFormatConfiguration] -> ShowS
OutputFormatConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputFormatConfiguration] -> ShowS
$cshowList :: [OutputFormatConfiguration] -> ShowS
show :: OutputFormatConfiguration -> String
$cshow :: OutputFormatConfiguration -> String
showsPrec :: Int -> OutputFormatConfiguration -> ShowS
$cshowsPrec :: Int -> OutputFormatConfiguration -> ShowS
Prelude.Show, forall x.
Rep OutputFormatConfiguration x -> OutputFormatConfiguration
forall x.
OutputFormatConfiguration -> Rep OutputFormatConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OutputFormatConfiguration x -> OutputFormatConfiguration
$cfrom :: forall x.
OutputFormatConfiguration -> Rep OutputFormatConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'OutputFormatConfiguration' 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:
--
-- 'serializer', 'outputFormatConfiguration_serializer' - Specifies which serializer to use. You can choose either the ORC SerDe
-- or the Parquet SerDe. If both are non-null, the server rejects the
-- request.
newOutputFormatConfiguration ::
  OutputFormatConfiguration
newOutputFormatConfiguration :: OutputFormatConfiguration
newOutputFormatConfiguration =
  OutputFormatConfiguration'
    { $sel:serializer:OutputFormatConfiguration' :: Maybe Serializer
serializer =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies which serializer to use. You can choose either the ORC SerDe
-- or the Parquet SerDe. If both are non-null, the server rejects the
-- request.
outputFormatConfiguration_serializer :: Lens.Lens' OutputFormatConfiguration (Prelude.Maybe Serializer)
outputFormatConfiguration_serializer :: Lens' OutputFormatConfiguration (Maybe Serializer)
outputFormatConfiguration_serializer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputFormatConfiguration' {Maybe Serializer
serializer :: Maybe Serializer
$sel:serializer:OutputFormatConfiguration' :: OutputFormatConfiguration -> Maybe Serializer
serializer} -> Maybe Serializer
serializer) (\s :: OutputFormatConfiguration
s@OutputFormatConfiguration' {} Maybe Serializer
a -> OutputFormatConfiguration
s {$sel:serializer:OutputFormatConfiguration' :: Maybe Serializer
serializer = Maybe Serializer
a} :: OutputFormatConfiguration)

instance Data.FromJSON OutputFormatConfiguration where
  parseJSON :: Value -> Parser OutputFormatConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutputFormatConfiguration"
      ( \Object
x ->
          Maybe Serializer -> OutputFormatConfiguration
OutputFormatConfiguration'
            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
"Serializer")
      )

instance Prelude.Hashable OutputFormatConfiguration where
  hashWithSalt :: Int -> OutputFormatConfiguration -> Int
hashWithSalt Int
_salt OutputFormatConfiguration' {Maybe Serializer
serializer :: Maybe Serializer
$sel:serializer:OutputFormatConfiguration' :: OutputFormatConfiguration -> Maybe Serializer
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Serializer
serializer

instance Prelude.NFData OutputFormatConfiguration where
  rnf :: OutputFormatConfiguration -> ()
rnf OutputFormatConfiguration' {Maybe Serializer
serializer :: Maybe Serializer
$sel:serializer:OutputFormatConfiguration' :: OutputFormatConfiguration -> Maybe Serializer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Serializer
serializer

instance Data.ToJSON OutputFormatConfiguration where
  toJSON :: OutputFormatConfiguration -> Value
toJSON OutputFormatConfiguration' {Maybe Serializer
serializer :: Maybe Serializer
$sel:serializer:OutputFormatConfiguration' :: OutputFormatConfiguration -> Maybe Serializer
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Serializer" 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 Serializer
serializer]
      )