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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.ContinuationEvent
import Amazonka.S3.Types.EndEvent
import Amazonka.S3.Types.ProgressEvent
import Amazonka.S3.Types.RecordsEvent
import Amazonka.S3.Types.StatsEvent

-- | The container for selecting objects from a content event stream.
--
-- /See:/ 'newSelectObjectContentEventStream' smart constructor.
data SelectObjectContentEventStream = SelectObjectContentEventStream'
  { -- | The Progress Event.
    SelectObjectContentEventStream -> Maybe ProgressEvent
progress :: Prelude.Maybe ProgressEvent,
    -- | The Records Event.
    SelectObjectContentEventStream -> Maybe RecordsEvent
records :: Prelude.Maybe RecordsEvent,
    -- | The Continuation Event.
    SelectObjectContentEventStream -> Maybe ContinuationEvent
cont :: Prelude.Maybe ContinuationEvent,
    -- | The Stats Event.
    SelectObjectContentEventStream -> Maybe StatsEvent
stats :: Prelude.Maybe StatsEvent,
    -- | The End Event.
    SelectObjectContentEventStream -> Maybe EndEvent
end :: Prelude.Maybe EndEvent
  }
  deriving (SelectObjectContentEventStream
-> SelectObjectContentEventStream -> Bool
(SelectObjectContentEventStream
 -> SelectObjectContentEventStream -> Bool)
-> (SelectObjectContentEventStream
    -> SelectObjectContentEventStream -> Bool)
-> Eq SelectObjectContentEventStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectObjectContentEventStream
-> SelectObjectContentEventStream -> Bool
$c/= :: SelectObjectContentEventStream
-> SelectObjectContentEventStream -> Bool
== :: SelectObjectContentEventStream
-> SelectObjectContentEventStream -> Bool
$c== :: SelectObjectContentEventStream
-> SelectObjectContentEventStream -> Bool
Prelude.Eq, ReadPrec [SelectObjectContentEventStream]
ReadPrec SelectObjectContentEventStream
Int -> ReadS SelectObjectContentEventStream
ReadS [SelectObjectContentEventStream]
(Int -> ReadS SelectObjectContentEventStream)
-> ReadS [SelectObjectContentEventStream]
-> ReadPrec SelectObjectContentEventStream
-> ReadPrec [SelectObjectContentEventStream]
-> Read SelectObjectContentEventStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelectObjectContentEventStream]
$creadListPrec :: ReadPrec [SelectObjectContentEventStream]
readPrec :: ReadPrec SelectObjectContentEventStream
$creadPrec :: ReadPrec SelectObjectContentEventStream
readList :: ReadS [SelectObjectContentEventStream]
$creadList :: ReadS [SelectObjectContentEventStream]
readsPrec :: Int -> ReadS SelectObjectContentEventStream
$creadsPrec :: Int -> ReadS SelectObjectContentEventStream
Prelude.Read, Int -> SelectObjectContentEventStream -> ShowS
[SelectObjectContentEventStream] -> ShowS
SelectObjectContentEventStream -> String
(Int -> SelectObjectContentEventStream -> ShowS)
-> (SelectObjectContentEventStream -> String)
-> ([SelectObjectContentEventStream] -> ShowS)
-> Show SelectObjectContentEventStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectObjectContentEventStream] -> ShowS
$cshowList :: [SelectObjectContentEventStream] -> ShowS
show :: SelectObjectContentEventStream -> String
$cshow :: SelectObjectContentEventStream -> String
showsPrec :: Int -> SelectObjectContentEventStream -> ShowS
$cshowsPrec :: Int -> SelectObjectContentEventStream -> ShowS
Prelude.Show, (forall x.
 SelectObjectContentEventStream
 -> Rep SelectObjectContentEventStream x)
-> (forall x.
    Rep SelectObjectContentEventStream x
    -> SelectObjectContentEventStream)
-> Generic SelectObjectContentEventStream
forall x.
Rep SelectObjectContentEventStream x
-> SelectObjectContentEventStream
forall x.
SelectObjectContentEventStream
-> Rep SelectObjectContentEventStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SelectObjectContentEventStream x
-> SelectObjectContentEventStream
$cfrom :: forall x.
SelectObjectContentEventStream
-> Rep SelectObjectContentEventStream x
Prelude.Generic)

-- |
-- Create a value of 'SelectObjectContentEventStream' 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:
--
-- 'progress', 'selectObjectContentEventStream_progress' - The Progress Event.
--
-- 'records', 'selectObjectContentEventStream_records' - The Records Event.
--
-- 'cont', 'selectObjectContentEventStream_cont' - The Continuation Event.
--
-- 'stats', 'selectObjectContentEventStream_stats' - The Stats Event.
--
-- 'end', 'selectObjectContentEventStream_end' - The End Event.
newSelectObjectContentEventStream ::
  SelectObjectContentEventStream
newSelectObjectContentEventStream :: SelectObjectContentEventStream
newSelectObjectContentEventStream =
  SelectObjectContentEventStream' :: Maybe ProgressEvent
-> Maybe RecordsEvent
-> Maybe ContinuationEvent
-> Maybe StatsEvent
-> Maybe EndEvent
-> SelectObjectContentEventStream
SelectObjectContentEventStream'
    { $sel:progress:SelectObjectContentEventStream' :: Maybe ProgressEvent
progress =
        Maybe ProgressEvent
forall a. Maybe a
Prelude.Nothing,
      $sel:records:SelectObjectContentEventStream' :: Maybe RecordsEvent
records = Maybe RecordsEvent
forall a. Maybe a
Prelude.Nothing,
      $sel:cont:SelectObjectContentEventStream' :: Maybe ContinuationEvent
cont = Maybe ContinuationEvent
forall a. Maybe a
Prelude.Nothing,
      $sel:stats:SelectObjectContentEventStream' :: Maybe StatsEvent
stats = Maybe StatsEvent
forall a. Maybe a
Prelude.Nothing,
      $sel:end:SelectObjectContentEventStream' :: Maybe EndEvent
end = Maybe EndEvent
forall a. Maybe a
Prelude.Nothing
    }

-- | The Progress Event.
selectObjectContentEventStream_progress :: Lens.Lens' SelectObjectContentEventStream (Prelude.Maybe ProgressEvent)
selectObjectContentEventStream_progress :: (Maybe ProgressEvent -> f (Maybe ProgressEvent))
-> SelectObjectContentEventStream
-> f SelectObjectContentEventStream
selectObjectContentEventStream_progress = (SelectObjectContentEventStream -> Maybe ProgressEvent)
-> (SelectObjectContentEventStream
    -> Maybe ProgressEvent -> SelectObjectContentEventStream)
-> Lens
     SelectObjectContentEventStream
     SelectObjectContentEventStream
     (Maybe ProgressEvent)
     (Maybe ProgressEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectObjectContentEventStream' {Maybe ProgressEvent
progress :: Maybe ProgressEvent
$sel:progress:SelectObjectContentEventStream' :: SelectObjectContentEventStream -> Maybe ProgressEvent
progress} -> Maybe ProgressEvent
progress) (\s :: SelectObjectContentEventStream
s@SelectObjectContentEventStream' {} Maybe ProgressEvent
a -> SelectObjectContentEventStream
s {$sel:progress:SelectObjectContentEventStream' :: Maybe ProgressEvent
progress = Maybe ProgressEvent
a} :: SelectObjectContentEventStream)

-- | The Records Event.
selectObjectContentEventStream_records :: Lens.Lens' SelectObjectContentEventStream (Prelude.Maybe RecordsEvent)
selectObjectContentEventStream_records :: (Maybe RecordsEvent -> f (Maybe RecordsEvent))
-> SelectObjectContentEventStream
-> f SelectObjectContentEventStream
selectObjectContentEventStream_records = (SelectObjectContentEventStream -> Maybe RecordsEvent)
-> (SelectObjectContentEventStream
    -> Maybe RecordsEvent -> SelectObjectContentEventStream)
-> Lens
     SelectObjectContentEventStream
     SelectObjectContentEventStream
     (Maybe RecordsEvent)
     (Maybe RecordsEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectObjectContentEventStream' {Maybe RecordsEvent
records :: Maybe RecordsEvent
$sel:records:SelectObjectContentEventStream' :: SelectObjectContentEventStream -> Maybe RecordsEvent
records} -> Maybe RecordsEvent
records) (\s :: SelectObjectContentEventStream
s@SelectObjectContentEventStream' {} Maybe RecordsEvent
a -> SelectObjectContentEventStream
s {$sel:records:SelectObjectContentEventStream' :: Maybe RecordsEvent
records = Maybe RecordsEvent
a} :: SelectObjectContentEventStream)

-- | The Continuation Event.
selectObjectContentEventStream_cont :: Lens.Lens' SelectObjectContentEventStream (Prelude.Maybe ContinuationEvent)
selectObjectContentEventStream_cont :: (Maybe ContinuationEvent -> f (Maybe ContinuationEvent))
-> SelectObjectContentEventStream
-> f SelectObjectContentEventStream
selectObjectContentEventStream_cont = (SelectObjectContentEventStream -> Maybe ContinuationEvent)
-> (SelectObjectContentEventStream
    -> Maybe ContinuationEvent -> SelectObjectContentEventStream)
-> Lens
     SelectObjectContentEventStream
     SelectObjectContentEventStream
     (Maybe ContinuationEvent)
     (Maybe ContinuationEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectObjectContentEventStream' {Maybe ContinuationEvent
cont :: Maybe ContinuationEvent
$sel:cont:SelectObjectContentEventStream' :: SelectObjectContentEventStream -> Maybe ContinuationEvent
cont} -> Maybe ContinuationEvent
cont) (\s :: SelectObjectContentEventStream
s@SelectObjectContentEventStream' {} Maybe ContinuationEvent
a -> SelectObjectContentEventStream
s {$sel:cont:SelectObjectContentEventStream' :: Maybe ContinuationEvent
cont = Maybe ContinuationEvent
a} :: SelectObjectContentEventStream)

-- | The Stats Event.
selectObjectContentEventStream_stats :: Lens.Lens' SelectObjectContentEventStream (Prelude.Maybe StatsEvent)
selectObjectContentEventStream_stats :: (Maybe StatsEvent -> f (Maybe StatsEvent))
-> SelectObjectContentEventStream
-> f SelectObjectContentEventStream
selectObjectContentEventStream_stats = (SelectObjectContentEventStream -> Maybe StatsEvent)
-> (SelectObjectContentEventStream
    -> Maybe StatsEvent -> SelectObjectContentEventStream)
-> Lens
     SelectObjectContentEventStream
     SelectObjectContentEventStream
     (Maybe StatsEvent)
     (Maybe StatsEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectObjectContentEventStream' {Maybe StatsEvent
stats :: Maybe StatsEvent
$sel:stats:SelectObjectContentEventStream' :: SelectObjectContentEventStream -> Maybe StatsEvent
stats} -> Maybe StatsEvent
stats) (\s :: SelectObjectContentEventStream
s@SelectObjectContentEventStream' {} Maybe StatsEvent
a -> SelectObjectContentEventStream
s {$sel:stats:SelectObjectContentEventStream' :: Maybe StatsEvent
stats = Maybe StatsEvent
a} :: SelectObjectContentEventStream)

-- | The End Event.
selectObjectContentEventStream_end :: Lens.Lens' SelectObjectContentEventStream (Prelude.Maybe EndEvent)
selectObjectContentEventStream_end :: (Maybe EndEvent -> f (Maybe EndEvent))
-> SelectObjectContentEventStream
-> f SelectObjectContentEventStream
selectObjectContentEventStream_end = (SelectObjectContentEventStream -> Maybe EndEvent)
-> (SelectObjectContentEventStream
    -> Maybe EndEvent -> SelectObjectContentEventStream)
-> Lens
     SelectObjectContentEventStream
     SelectObjectContentEventStream
     (Maybe EndEvent)
     (Maybe EndEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectObjectContentEventStream' {Maybe EndEvent
end :: Maybe EndEvent
$sel:end:SelectObjectContentEventStream' :: SelectObjectContentEventStream -> Maybe EndEvent
end} -> Maybe EndEvent
end) (\s :: SelectObjectContentEventStream
s@SelectObjectContentEventStream' {} Maybe EndEvent
a -> SelectObjectContentEventStream
s {$sel:end:SelectObjectContentEventStream' :: Maybe EndEvent
end = Maybe EndEvent
a} :: SelectObjectContentEventStream)

instance Core.FromXML SelectObjectContentEventStream where
  parseXML :: [Node] -> Either String SelectObjectContentEventStream
parseXML [Node]
x =
    Maybe ProgressEvent
-> Maybe RecordsEvent
-> Maybe ContinuationEvent
-> Maybe StatsEvent
-> Maybe EndEvent
-> SelectObjectContentEventStream
SelectObjectContentEventStream'
      (Maybe ProgressEvent
 -> Maybe RecordsEvent
 -> Maybe ContinuationEvent
 -> Maybe StatsEvent
 -> Maybe EndEvent
 -> SelectObjectContentEventStream)
-> Either String (Maybe ProgressEvent)
-> Either
     String
     (Maybe RecordsEvent
      -> Maybe ContinuationEvent
      -> Maybe StatsEvent
      -> Maybe EndEvent
      -> SelectObjectContentEventStream)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ProgressEvent)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Progress")
      Either
  String
  (Maybe RecordsEvent
   -> Maybe ContinuationEvent
   -> Maybe StatsEvent
   -> Maybe EndEvent
   -> SelectObjectContentEventStream)
-> Either String (Maybe RecordsEvent)
-> Either
     String
     (Maybe ContinuationEvent
      -> Maybe StatsEvent
      -> Maybe EndEvent
      -> SelectObjectContentEventStream)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe RecordsEvent)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Records")
      Either
  String
  (Maybe ContinuationEvent
   -> Maybe StatsEvent
   -> Maybe EndEvent
   -> SelectObjectContentEventStream)
-> Either String (Maybe ContinuationEvent)
-> Either
     String
     (Maybe StatsEvent
      -> Maybe EndEvent -> SelectObjectContentEventStream)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ContinuationEvent)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Cont")
      Either
  String
  (Maybe StatsEvent
   -> Maybe EndEvent -> SelectObjectContentEventStream)
-> Either String (Maybe StatsEvent)
-> Either String (Maybe EndEvent -> SelectObjectContentEventStream)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe StatsEvent)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Stats")
      Either String (Maybe EndEvent -> SelectObjectContentEventStream)
-> Either String (Maybe EndEvent)
-> Either String SelectObjectContentEventStream
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe EndEvent)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"End")

instance
  Prelude.Hashable
    SelectObjectContentEventStream

instance
  Prelude.NFData
    SelectObjectContentEventStream