{-# 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.S3.Types.JSONOutput
-- 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.S3.Types.JSONOutput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal

-- | Specifies JSON as request\'s output serialization format.
--
-- /See:/ 'newJSONOutput' smart constructor.
data JSONOutput = JSONOutput'
  { -- | The value used to separate individual records in the output. If no value
    -- is specified, Amazon S3 uses a newline character (\'\\n\').
    JSONOutput -> Maybe Text
recordDelimiter :: Prelude.Maybe Prelude.Text
  }
  deriving (JSONOutput -> JSONOutput -> Bool
(JSONOutput -> JSONOutput -> Bool)
-> (JSONOutput -> JSONOutput -> Bool) -> Eq JSONOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JSONOutput -> JSONOutput -> Bool
$c/= :: JSONOutput -> JSONOutput -> Bool
== :: JSONOutput -> JSONOutput -> Bool
$c== :: JSONOutput -> JSONOutput -> Bool
Prelude.Eq, ReadPrec [JSONOutput]
ReadPrec JSONOutput
Int -> ReadS JSONOutput
ReadS [JSONOutput]
(Int -> ReadS JSONOutput)
-> ReadS [JSONOutput]
-> ReadPrec JSONOutput
-> ReadPrec [JSONOutput]
-> Read JSONOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JSONOutput]
$creadListPrec :: ReadPrec [JSONOutput]
readPrec :: ReadPrec JSONOutput
$creadPrec :: ReadPrec JSONOutput
readList :: ReadS [JSONOutput]
$creadList :: ReadS [JSONOutput]
readsPrec :: Int -> ReadS JSONOutput
$creadsPrec :: Int -> ReadS JSONOutput
Prelude.Read, Int -> JSONOutput -> ShowS
[JSONOutput] -> ShowS
JSONOutput -> String
(Int -> JSONOutput -> ShowS)
-> (JSONOutput -> String)
-> ([JSONOutput] -> ShowS)
-> Show JSONOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JSONOutput] -> ShowS
$cshowList :: [JSONOutput] -> ShowS
show :: JSONOutput -> String
$cshow :: JSONOutput -> String
showsPrec :: Int -> JSONOutput -> ShowS
$cshowsPrec :: Int -> JSONOutput -> ShowS
Prelude.Show, (forall x. JSONOutput -> Rep JSONOutput x)
-> (forall x. Rep JSONOutput x -> JSONOutput) -> Generic JSONOutput
forall x. Rep JSONOutput x -> JSONOutput
forall x. JSONOutput -> Rep JSONOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JSONOutput x -> JSONOutput
$cfrom :: forall x. JSONOutput -> Rep JSONOutput x
Prelude.Generic)

-- |
-- Create a value of 'JSONOutput' 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:
--
-- 'recordDelimiter', 'jSONOutput_recordDelimiter' - The value used to separate individual records in the output. If no value
-- is specified, Amazon S3 uses a newline character (\'\\n\').
newJSONOutput ::
  JSONOutput
newJSONOutput :: JSONOutput
newJSONOutput =
  JSONOutput' :: Maybe Text -> JSONOutput
JSONOutput' {$sel:recordDelimiter:JSONOutput' :: Maybe Text
recordDelimiter = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The value used to separate individual records in the output. If no value
-- is specified, Amazon S3 uses a newline character (\'\\n\').
jSONOutput_recordDelimiter :: Lens.Lens' JSONOutput (Prelude.Maybe Prelude.Text)
jSONOutput_recordDelimiter :: (Maybe Text -> f (Maybe Text)) -> JSONOutput -> f JSONOutput
jSONOutput_recordDelimiter = (JSONOutput -> Maybe Text)
-> (JSONOutput -> Maybe Text -> JSONOutput)
-> Lens JSONOutput JSONOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JSONOutput' {Maybe Text
recordDelimiter :: Maybe Text
$sel:recordDelimiter:JSONOutput' :: JSONOutput -> Maybe Text
recordDelimiter} -> Maybe Text
recordDelimiter) (\s :: JSONOutput
s@JSONOutput' {} Maybe Text
a -> JSONOutput
s {$sel:recordDelimiter:JSONOutput' :: Maybe Text
recordDelimiter = Maybe Text
a} :: JSONOutput)

instance Prelude.Hashable JSONOutput

instance Prelude.NFData JSONOutput

instance Core.ToXML JSONOutput where
  toXML :: JSONOutput -> XML
toXML JSONOutput' {Maybe Text
recordDelimiter :: Maybe Text
$sel:recordDelimiter:JSONOutput' :: JSONOutput -> Maybe Text
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [Name
"RecordDelimiter" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
recordDelimiter]