{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.S3.Types.RecordsEvent where

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
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 Data.Base64
  }
  deriving (RecordsEvent -> RecordsEvent -> Bool
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]
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
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. 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' {$sel:payload:RecordsEvent' :: Maybe Base64
payload = 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 :: Lens' RecordsEvent (Maybe ByteString)
recordsEvent_payload = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 Iso' Base64 ByteString
Data._Base64

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

instance Prelude.Hashable RecordsEvent where
  hashWithSalt :: Int -> RecordsEvent -> Int
hashWithSalt Int
_salt RecordsEvent' {Maybe Base64
payload :: Maybe Base64
$sel:payload:RecordsEvent' :: RecordsEvent -> Maybe Base64
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Base64
payload

instance Prelude.NFData RecordsEvent where
  rnf :: RecordsEvent -> ()
rnf RecordsEvent' {Maybe Base64
payload :: Maybe Base64
$sel:payload:RecordsEvent' :: RecordsEvent -> Maybe Base64
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Base64
payload