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

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

-- | Container for the stats details.
--
-- /See:/ 'newStats' smart constructor.
data Stats = Stats'
  { -- | The total number of bytes of records payload data returned.
    Stats -> Maybe Integer
bytesReturned :: Prelude.Maybe Prelude.Integer,
    -- | The total number of object bytes scanned.
    Stats -> Maybe Integer
bytesScanned :: Prelude.Maybe Prelude.Integer,
    -- | The total number of uncompressed object bytes processed.
    Stats -> Maybe Integer
bytesProcessed :: Prelude.Maybe Prelude.Integer
  }
  deriving (Stats -> Stats -> Bool
(Stats -> Stats -> Bool) -> (Stats -> Stats -> Bool) -> Eq Stats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Stats -> Stats -> Bool
$c/= :: Stats -> Stats -> Bool
== :: Stats -> Stats -> Bool
$c== :: Stats -> Stats -> Bool
Prelude.Eq, ReadPrec [Stats]
ReadPrec Stats
Int -> ReadS Stats
ReadS [Stats]
(Int -> ReadS Stats)
-> ReadS [Stats]
-> ReadPrec Stats
-> ReadPrec [Stats]
-> Read Stats
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Stats]
$creadListPrec :: ReadPrec [Stats]
readPrec :: ReadPrec Stats
$creadPrec :: ReadPrec Stats
readList :: ReadS [Stats]
$creadList :: ReadS [Stats]
readsPrec :: Int -> ReadS Stats
$creadsPrec :: Int -> ReadS Stats
Prelude.Read, Int -> Stats -> ShowS
[Stats] -> ShowS
Stats -> String
(Int -> Stats -> ShowS)
-> (Stats -> String) -> ([Stats] -> ShowS) -> Show Stats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Stats] -> ShowS
$cshowList :: [Stats] -> ShowS
show :: Stats -> String
$cshow :: Stats -> String
showsPrec :: Int -> Stats -> ShowS
$cshowsPrec :: Int -> Stats -> ShowS
Prelude.Show, (forall x. Stats -> Rep Stats x)
-> (forall x. Rep Stats x -> Stats) -> Generic Stats
forall x. Rep Stats x -> Stats
forall x. Stats -> Rep Stats x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Stats x -> Stats
$cfrom :: forall x. Stats -> Rep Stats x
Prelude.Generic)

-- |
-- Create a value of 'Stats' 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:
--
-- 'bytesReturned', 'stats_bytesReturned' - The total number of bytes of records payload data returned.
--
-- 'bytesScanned', 'stats_bytesScanned' - The total number of object bytes scanned.
--
-- 'bytesProcessed', 'stats_bytesProcessed' - The total number of uncompressed object bytes processed.
newStats ::
  Stats
newStats :: Stats
newStats =
  Stats' :: Maybe Integer -> Maybe Integer -> Maybe Integer -> Stats
Stats'
    { $sel:bytesReturned:Stats' :: Maybe Integer
bytesReturned = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:bytesScanned:Stats' :: Maybe Integer
bytesScanned = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:bytesProcessed:Stats' :: Maybe Integer
bytesProcessed = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The total number of bytes of records payload data returned.
stats_bytesReturned :: Lens.Lens' Stats (Prelude.Maybe Prelude.Integer)
stats_bytesReturned :: (Maybe Integer -> f (Maybe Integer)) -> Stats -> f Stats
stats_bytesReturned = (Stats -> Maybe Integer)
-> (Stats -> Maybe Integer -> Stats)
-> Lens Stats Stats (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Stats' {Maybe Integer
bytesReturned :: Maybe Integer
$sel:bytesReturned:Stats' :: Stats -> Maybe Integer
bytesReturned} -> Maybe Integer
bytesReturned) (\s :: Stats
s@Stats' {} Maybe Integer
a -> Stats
s {$sel:bytesReturned:Stats' :: Maybe Integer
bytesReturned = Maybe Integer
a} :: Stats)

-- | The total number of object bytes scanned.
stats_bytesScanned :: Lens.Lens' Stats (Prelude.Maybe Prelude.Integer)
stats_bytesScanned :: (Maybe Integer -> f (Maybe Integer)) -> Stats -> f Stats
stats_bytesScanned = (Stats -> Maybe Integer)
-> (Stats -> Maybe Integer -> Stats)
-> Lens Stats Stats (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Stats' {Maybe Integer
bytesScanned :: Maybe Integer
$sel:bytesScanned:Stats' :: Stats -> Maybe Integer
bytesScanned} -> Maybe Integer
bytesScanned) (\s :: Stats
s@Stats' {} Maybe Integer
a -> Stats
s {$sel:bytesScanned:Stats' :: Maybe Integer
bytesScanned = Maybe Integer
a} :: Stats)

-- | The total number of uncompressed object bytes processed.
stats_bytesProcessed :: Lens.Lens' Stats (Prelude.Maybe Prelude.Integer)
stats_bytesProcessed :: (Maybe Integer -> f (Maybe Integer)) -> Stats -> f Stats
stats_bytesProcessed = (Stats -> Maybe Integer)
-> (Stats -> Maybe Integer -> Stats)
-> Lens Stats Stats (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Stats' {Maybe Integer
bytesProcessed :: Maybe Integer
$sel:bytesProcessed:Stats' :: Stats -> Maybe Integer
bytesProcessed} -> Maybe Integer
bytesProcessed) (\s :: Stats
s@Stats' {} Maybe Integer
a -> Stats
s {$sel:bytesProcessed:Stats' :: Maybe Integer
bytesProcessed = Maybe Integer
a} :: Stats)

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

instance Prelude.Hashable Stats

instance Prelude.NFData Stats