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

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

-- | This data type contains information about progress of an operation.
--
-- /See:/ 'newProgress' smart constructor.
data Progress = Progress'
  { -- | The current number of bytes of records payload data returned.
    Progress -> Maybe Integer
bytesReturned :: Prelude.Maybe Prelude.Integer,
    -- | The current number of object bytes scanned.
    Progress -> Maybe Integer
bytesScanned :: Prelude.Maybe Prelude.Integer,
    -- | The current number of uncompressed object bytes processed.
    Progress -> Maybe Integer
bytesProcessed :: Prelude.Maybe Prelude.Integer
  }
  deriving (Progress -> Progress -> Bool
(Progress -> Progress -> Bool)
-> (Progress -> Progress -> Bool) -> Eq Progress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Progress -> Progress -> Bool
$c/= :: Progress -> Progress -> Bool
== :: Progress -> Progress -> Bool
$c== :: Progress -> Progress -> Bool
Prelude.Eq, ReadPrec [Progress]
ReadPrec Progress
Int -> ReadS Progress
ReadS [Progress]
(Int -> ReadS Progress)
-> ReadS [Progress]
-> ReadPrec Progress
-> ReadPrec [Progress]
-> Read Progress
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Progress]
$creadListPrec :: ReadPrec [Progress]
readPrec :: ReadPrec Progress
$creadPrec :: ReadPrec Progress
readList :: ReadS [Progress]
$creadList :: ReadS [Progress]
readsPrec :: Int -> ReadS Progress
$creadsPrec :: Int -> ReadS Progress
Prelude.Read, Int -> Progress -> ShowS
[Progress] -> ShowS
Progress -> String
(Int -> Progress -> ShowS)
-> (Progress -> String) -> ([Progress] -> ShowS) -> Show Progress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Progress] -> ShowS
$cshowList :: [Progress] -> ShowS
show :: Progress -> String
$cshow :: Progress -> String
showsPrec :: Int -> Progress -> ShowS
$cshowsPrec :: Int -> Progress -> ShowS
Prelude.Show, (forall x. Progress -> Rep Progress x)
-> (forall x. Rep Progress x -> Progress) -> Generic Progress
forall x. Rep Progress x -> Progress
forall x. Progress -> Rep Progress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Progress x -> Progress
$cfrom :: forall x. Progress -> Rep Progress x
Prelude.Generic)

-- |
-- Create a value of 'Progress' 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', 'progress_bytesReturned' - The current number of bytes of records payload data returned.
--
-- 'bytesScanned', 'progress_bytesScanned' - The current number of object bytes scanned.
--
-- 'bytesProcessed', 'progress_bytesProcessed' - The current number of uncompressed object bytes processed.
newProgress ::
  Progress
newProgress :: Progress
newProgress =
  Progress' :: Maybe Integer -> Maybe Integer -> Maybe Integer -> Progress
Progress'
    { $sel:bytesReturned:Progress' :: Maybe Integer
bytesReturned = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:bytesScanned:Progress' :: Maybe Integer
bytesScanned = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:bytesProcessed:Progress' :: Maybe Integer
bytesProcessed = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

instance Core.FromXML Progress where
  parseXML :: [Node] -> Either String Progress
parseXML [Node]
x =
    Maybe Integer -> Maybe Integer -> Maybe Integer -> Progress
Progress'
      (Maybe Integer -> Maybe Integer -> Maybe Integer -> Progress)
-> Either String (Maybe Integer)
-> Either String (Maybe Integer -> Maybe Integer -> Progress)
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 -> Progress)
-> Either String (Maybe Integer)
-> Either String (Maybe Integer -> Progress)
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 -> Progress)
-> Either String (Maybe Integer) -> Either String Progress
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 Progress

instance Prelude.NFData Progress