{-# 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.StatsEvent
-- 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.StatsEvent 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.Stats

-- | Container for the Stats Event.
--
-- /See:/ 'newStatsEvent' smart constructor.
data StatsEvent = StatsEvent'
  { -- | The Stats event details.
    StatsEvent -> Maybe Stats
details :: Prelude.Maybe Stats
  }
  deriving (StatsEvent -> StatsEvent -> Bool
(StatsEvent -> StatsEvent -> Bool)
-> (StatsEvent -> StatsEvent -> Bool) -> Eq StatsEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StatsEvent -> StatsEvent -> Bool
$c/= :: StatsEvent -> StatsEvent -> Bool
== :: StatsEvent -> StatsEvent -> Bool
$c== :: StatsEvent -> StatsEvent -> Bool
Prelude.Eq, ReadPrec [StatsEvent]
ReadPrec StatsEvent
Int -> ReadS StatsEvent
ReadS [StatsEvent]
(Int -> ReadS StatsEvent)
-> ReadS [StatsEvent]
-> ReadPrec StatsEvent
-> ReadPrec [StatsEvent]
-> Read StatsEvent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StatsEvent]
$creadListPrec :: ReadPrec [StatsEvent]
readPrec :: ReadPrec StatsEvent
$creadPrec :: ReadPrec StatsEvent
readList :: ReadS [StatsEvent]
$creadList :: ReadS [StatsEvent]
readsPrec :: Int -> ReadS StatsEvent
$creadsPrec :: Int -> ReadS StatsEvent
Prelude.Read, Int -> StatsEvent -> ShowS
[StatsEvent] -> ShowS
StatsEvent -> String
(Int -> StatsEvent -> ShowS)
-> (StatsEvent -> String)
-> ([StatsEvent] -> ShowS)
-> Show StatsEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StatsEvent] -> ShowS
$cshowList :: [StatsEvent] -> ShowS
show :: StatsEvent -> String
$cshow :: StatsEvent -> String
showsPrec :: Int -> StatsEvent -> ShowS
$cshowsPrec :: Int -> StatsEvent -> ShowS
Prelude.Show, (forall x. StatsEvent -> Rep StatsEvent x)
-> (forall x. Rep StatsEvent x -> StatsEvent) -> Generic StatsEvent
forall x. Rep StatsEvent x -> StatsEvent
forall x. StatsEvent -> Rep StatsEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StatsEvent x -> StatsEvent
$cfrom :: forall x. StatsEvent -> Rep StatsEvent x
Prelude.Generic)

-- |
-- Create a value of 'StatsEvent' 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', 'statsEvent_details' - The Stats event details.
newStatsEvent ::
  StatsEvent
newStatsEvent :: StatsEvent
newStatsEvent =
  StatsEvent' :: Maybe Stats -> StatsEvent
StatsEvent' {$sel:details:StatsEvent' :: Maybe Stats
details = Maybe Stats
forall a. Maybe a
Prelude.Nothing}

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

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

instance Prelude.Hashable StatsEvent

instance Prelude.NFData StatsEvent