{-# 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.ProgressEvent
-- 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.ProgressEvent 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.Progress

-- | This data type contains information about the progress event of an
-- operation.
--
-- /See:/ 'newProgressEvent' smart constructor.
data ProgressEvent = ProgressEvent'
  { -- | The Progress event details.
    ProgressEvent -> Maybe Progress
details :: Prelude.Maybe Progress
  }
  deriving (ProgressEvent -> ProgressEvent -> Bool
(ProgressEvent -> ProgressEvent -> Bool)
-> (ProgressEvent -> ProgressEvent -> Bool) -> Eq ProgressEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProgressEvent -> ProgressEvent -> Bool
$c/= :: ProgressEvent -> ProgressEvent -> Bool
== :: ProgressEvent -> ProgressEvent -> Bool
$c== :: ProgressEvent -> ProgressEvent -> Bool
Prelude.Eq, ReadPrec [ProgressEvent]
ReadPrec ProgressEvent
Int -> ReadS ProgressEvent
ReadS [ProgressEvent]
(Int -> ReadS ProgressEvent)
-> ReadS [ProgressEvent]
-> ReadPrec ProgressEvent
-> ReadPrec [ProgressEvent]
-> Read ProgressEvent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProgressEvent]
$creadListPrec :: ReadPrec [ProgressEvent]
readPrec :: ReadPrec ProgressEvent
$creadPrec :: ReadPrec ProgressEvent
readList :: ReadS [ProgressEvent]
$creadList :: ReadS [ProgressEvent]
readsPrec :: Int -> ReadS ProgressEvent
$creadsPrec :: Int -> ReadS ProgressEvent
Prelude.Read, Int -> ProgressEvent -> ShowS
[ProgressEvent] -> ShowS
ProgressEvent -> String
(Int -> ProgressEvent -> ShowS)
-> (ProgressEvent -> String)
-> ([ProgressEvent] -> ShowS)
-> Show ProgressEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProgressEvent] -> ShowS
$cshowList :: [ProgressEvent] -> ShowS
show :: ProgressEvent -> String
$cshow :: ProgressEvent -> String
showsPrec :: Int -> ProgressEvent -> ShowS
$cshowsPrec :: Int -> ProgressEvent -> ShowS
Prelude.Show, (forall x. ProgressEvent -> Rep ProgressEvent x)
-> (forall x. Rep ProgressEvent x -> ProgressEvent)
-> Generic ProgressEvent
forall x. Rep ProgressEvent x -> ProgressEvent
forall x. ProgressEvent -> Rep ProgressEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProgressEvent x -> ProgressEvent
$cfrom :: forall x. ProgressEvent -> Rep ProgressEvent x
Prelude.Generic)

-- |
-- Create a value of 'ProgressEvent' 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:
--
-- 'details', 'progressEvent_details' - The Progress event details.
newProgressEvent ::
  ProgressEvent
newProgressEvent :: ProgressEvent
newProgressEvent =
  ProgressEvent' :: Maybe Progress -> ProgressEvent
ProgressEvent' {$sel:details:ProgressEvent' :: Maybe Progress
details = Maybe Progress
forall a. Maybe a
Prelude.Nothing}

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

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

instance Prelude.Hashable ProgressEvent

instance Prelude.NFData ProgressEvent