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

-- | Container for the stats details.
--
-- /See:/ 'newStats' smart constructor.
data Stats = Stats'
  { -- | The total number of uncompressed object bytes processed.
    Stats -> Maybe Integer
bytesProcessed :: Prelude.Maybe Prelude.Integer,
    -- | 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
  }
  deriving (Stats -> Stats -> Bool
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]
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
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. 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:
--
-- 'bytesProcessed', 'stats_bytesProcessed' - The total number of uncompressed object bytes processed.
--
-- 'bytesReturned', 'stats_bytesReturned' - The total number of bytes of records payload data returned.
--
-- 'bytesScanned', 'stats_bytesScanned' - The total number of object bytes scanned.
newStats ::
  Stats
newStats :: Stats
newStats =
  Stats'
    { $sel:bytesProcessed:Stats' :: Maybe Integer
bytesProcessed = forall a. Maybe a
Prelude.Nothing,
      $sel:bytesReturned:Stats' :: Maybe Integer
bytesReturned = forall a. Maybe a
Prelude.Nothing,
      $sel:bytesScanned:Stats' :: Maybe Integer
bytesScanned = forall a. Maybe a
Prelude.Nothing
    }

-- | The total number of uncompressed object bytes processed.
stats_bytesProcessed :: Lens.Lens' Stats (Prelude.Maybe Prelude.Integer)
stats_bytesProcessed :: Lens' Stats (Maybe Integer)
stats_bytesProcessed = 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)

-- | The total number of bytes of records payload data returned.
stats_bytesReturned :: Lens.Lens' Stats (Prelude.Maybe Prelude.Integer)
stats_bytesReturned :: Lens' Stats (Maybe Integer)
stats_bytesReturned = 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 :: Lens' Stats (Maybe Integer)
stats_bytesScanned = 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)

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

instance Prelude.Hashable Stats where
  hashWithSalt :: Int -> Stats -> Int
hashWithSalt Int
_salt Stats' {Maybe Integer
bytesScanned :: Maybe Integer
bytesReturned :: Maybe Integer
bytesProcessed :: Maybe Integer
$sel:bytesScanned:Stats' :: Stats -> Maybe Integer
$sel:bytesReturned:Stats' :: Stats -> Maybe Integer
$sel:bytesProcessed:Stats' :: Stats -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
bytesProcessed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
bytesReturned
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
bytesScanned

instance Prelude.NFData Stats where
  rnf :: Stats -> ()
rnf Stats' {Maybe Integer
bytesScanned :: Maybe Integer
bytesReturned :: Maybe Integer
bytesProcessed :: Maybe Integer
$sel:bytesScanned:Stats' :: Stats -> Maybe Integer
$sel:bytesReturned:Stats' :: Stats -> Maybe Integer
$sel:bytesProcessed:Stats' :: Stats -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
bytesProcessed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
bytesReturned
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
bytesScanned