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

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

-- | The container for the records event.
--
-- /See:/ 'newRecordsEvent' smart constructor.
data RecordsEvent = RecordsEvent'
  { -- | The byte array of partial, one or more result records.
    RecordsEvent -> Maybe Base64
payload :: Prelude.Maybe Core.Base64
  }
  deriving (RecordsEvent -> RecordsEvent -> Bool
(RecordsEvent -> RecordsEvent -> Bool)
-> (RecordsEvent -> RecordsEvent -> Bool) -> Eq RecordsEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecordsEvent -> RecordsEvent -> Bool
$c/= :: RecordsEvent -> RecordsEvent -> Bool
== :: RecordsEvent -> RecordsEvent -> Bool
$c== :: RecordsEvent -> RecordsEvent -> Bool
Prelude.Eq, ReadPrec [RecordsEvent]
ReadPrec RecordsEvent
Int -> ReadS RecordsEvent
ReadS [RecordsEvent]
(Int -> ReadS RecordsEvent)
-> ReadS [RecordsEvent]
-> ReadPrec RecordsEvent
-> ReadPrec [RecordsEvent]
-> Read RecordsEvent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecordsEvent]
$creadListPrec :: ReadPrec [RecordsEvent]
readPrec :: ReadPrec RecordsEvent
$creadPrec :: ReadPrec RecordsEvent
readList :: ReadS [RecordsEvent]
$creadList :: ReadS [RecordsEvent]
readsPrec :: Int -> ReadS RecordsEvent
$creadsPrec :: Int -> ReadS RecordsEvent
Prelude.Read, Int -> RecordsEvent -> ShowS
[RecordsEvent] -> ShowS
RecordsEvent -> String
(Int -> RecordsEvent -> ShowS)
-> (RecordsEvent -> String)
-> ([RecordsEvent] -> ShowS)
-> Show RecordsEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecordsEvent] -> ShowS
$cshowList :: [RecordsEvent] -> ShowS
show :: RecordsEvent -> String
$cshow :: RecordsEvent -> String
showsPrec :: Int -> RecordsEvent -> ShowS
$cshowsPrec :: Int -> RecordsEvent -> ShowS
Prelude.Show, (forall x. RecordsEvent -> Rep RecordsEvent x)
-> (forall x. Rep RecordsEvent x -> RecordsEvent)
-> Generic RecordsEvent
forall x. Rep RecordsEvent x -> RecordsEvent
forall x. RecordsEvent -> Rep RecordsEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecordsEvent x -> RecordsEvent
$cfrom :: forall x. RecordsEvent -> Rep RecordsEvent x
Prelude.Generic)

-- |
-- Create a value of 'RecordsEvent' 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:
--
-- 'payload', 'recordsEvent_payload' - The byte array of partial, one or more result records.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
newRecordsEvent ::
  RecordsEvent
newRecordsEvent :: RecordsEvent
newRecordsEvent =
  RecordsEvent' :: Maybe Base64 -> RecordsEvent
RecordsEvent' {$sel:payload:RecordsEvent' :: Maybe Base64
payload = Maybe Base64
forall a. Maybe a
Prelude.Nothing}

-- | The byte array of partial, one or more result records.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
recordsEvent_payload :: Lens.Lens' RecordsEvent (Prelude.Maybe Prelude.ByteString)
recordsEvent_payload :: (Maybe ByteString -> f (Maybe ByteString))
-> RecordsEvent -> f RecordsEvent
recordsEvent_payload = (RecordsEvent -> Maybe Base64)
-> (RecordsEvent -> Maybe Base64 -> RecordsEvent)
-> Lens RecordsEvent RecordsEvent (Maybe Base64) (Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordsEvent' {Maybe Base64
payload :: Maybe Base64
$sel:payload:RecordsEvent' :: RecordsEvent -> Maybe Base64
payload} -> Maybe Base64
payload) (\s :: RecordsEvent
s@RecordsEvent' {} Maybe Base64
a -> RecordsEvent
s {$sel:payload:RecordsEvent' :: Maybe Base64
payload = Maybe Base64
a} :: RecordsEvent) ((Maybe Base64 -> f (Maybe Base64))
 -> RecordsEvent -> f RecordsEvent)
-> ((Maybe ByteString -> f (Maybe ByteString))
    -> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> RecordsEvent
-> f RecordsEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
     (Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64

instance Core.FromXML RecordsEvent where
  parseXML :: [Node] -> Either String RecordsEvent
parseXML [Node]
x =
    Maybe Base64 -> RecordsEvent
RecordsEvent' (Maybe Base64 -> RecordsEvent)
-> Either String (Maybe Base64) -> Either String RecordsEvent
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Base64)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Payload")

instance Prelude.Hashable RecordsEvent

instance Prelude.NFData RecordsEvent