{-# 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.FSx.Types.DataRepositoryTaskStatus
-- 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.FSx.Types.DataRepositoryTaskStatus 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

-- | Provides the task status showing a running total of the total number of
-- files to be processed, the number successfully processed, and the number
-- of files the task failed to process.
--
-- /See:/ 'newDataRepositoryTaskStatus' smart constructor.
data DataRepositoryTaskStatus = DataRepositoryTaskStatus'
  { -- | A running total of the number of files that the task failed to process.
    DataRepositoryTaskStatus -> Maybe Integer
failedCount :: Prelude.Maybe Prelude.Integer,
    -- | The time at which the task status was last updated.
    DataRepositoryTaskStatus -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Data.POSIX,
    -- | The total amount of data, in GiB, released by an Amazon File Cache
    -- AUTO_RELEASE_DATA task that automatically releases files from the cache.
    DataRepositoryTaskStatus -> Maybe Integer
releasedCapacity :: Prelude.Maybe Prelude.Integer,
    -- | A running total of the number of files that the task has successfully
    -- processed.
    DataRepositoryTaskStatus -> Maybe Integer
succeededCount :: Prelude.Maybe Prelude.Integer,
    -- | The total number of files that the task will process. While a task is
    -- executing, the sum of @SucceededCount@ plus @FailedCount@ may not equal
    -- @TotalCount@. When the task is complete, @TotalCount@ equals the sum of
    -- @SucceededCount@ plus @FailedCount@.
    DataRepositoryTaskStatus -> Maybe Integer
totalCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (DataRepositoryTaskStatus -> DataRepositoryTaskStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataRepositoryTaskStatus -> DataRepositoryTaskStatus -> Bool
$c/= :: DataRepositoryTaskStatus -> DataRepositoryTaskStatus -> Bool
== :: DataRepositoryTaskStatus -> DataRepositoryTaskStatus -> Bool
$c== :: DataRepositoryTaskStatus -> DataRepositoryTaskStatus -> Bool
Prelude.Eq, ReadPrec [DataRepositoryTaskStatus]
ReadPrec DataRepositoryTaskStatus
Int -> ReadS DataRepositoryTaskStatus
ReadS [DataRepositoryTaskStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataRepositoryTaskStatus]
$creadListPrec :: ReadPrec [DataRepositoryTaskStatus]
readPrec :: ReadPrec DataRepositoryTaskStatus
$creadPrec :: ReadPrec DataRepositoryTaskStatus
readList :: ReadS [DataRepositoryTaskStatus]
$creadList :: ReadS [DataRepositoryTaskStatus]
readsPrec :: Int -> ReadS DataRepositoryTaskStatus
$creadsPrec :: Int -> ReadS DataRepositoryTaskStatus
Prelude.Read, Int -> DataRepositoryTaskStatus -> ShowS
[DataRepositoryTaskStatus] -> ShowS
DataRepositoryTaskStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataRepositoryTaskStatus] -> ShowS
$cshowList :: [DataRepositoryTaskStatus] -> ShowS
show :: DataRepositoryTaskStatus -> String
$cshow :: DataRepositoryTaskStatus -> String
showsPrec :: Int -> DataRepositoryTaskStatus -> ShowS
$cshowsPrec :: Int -> DataRepositoryTaskStatus -> ShowS
Prelude.Show, forall x.
Rep DataRepositoryTaskStatus x -> DataRepositoryTaskStatus
forall x.
DataRepositoryTaskStatus -> Rep DataRepositoryTaskStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DataRepositoryTaskStatus x -> DataRepositoryTaskStatus
$cfrom :: forall x.
DataRepositoryTaskStatus -> Rep DataRepositoryTaskStatus x
Prelude.Generic)

-- |
-- Create a value of 'DataRepositoryTaskStatus' 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:
--
-- 'failedCount', 'dataRepositoryTaskStatus_failedCount' - A running total of the number of files that the task failed to process.
--
-- 'lastUpdatedTime', 'dataRepositoryTaskStatus_lastUpdatedTime' - The time at which the task status was last updated.
--
-- 'releasedCapacity', 'dataRepositoryTaskStatus_releasedCapacity' - The total amount of data, in GiB, released by an Amazon File Cache
-- AUTO_RELEASE_DATA task that automatically releases files from the cache.
--
-- 'succeededCount', 'dataRepositoryTaskStatus_succeededCount' - A running total of the number of files that the task has successfully
-- processed.
--
-- 'totalCount', 'dataRepositoryTaskStatus_totalCount' - The total number of files that the task will process. While a task is
-- executing, the sum of @SucceededCount@ plus @FailedCount@ may not equal
-- @TotalCount@. When the task is complete, @TotalCount@ equals the sum of
-- @SucceededCount@ plus @FailedCount@.
newDataRepositoryTaskStatus ::
  DataRepositoryTaskStatus
newDataRepositoryTaskStatus :: DataRepositoryTaskStatus
newDataRepositoryTaskStatus =
  DataRepositoryTaskStatus'
    { $sel:failedCount:DataRepositoryTaskStatus' :: Maybe Integer
failedCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:DataRepositoryTaskStatus' :: Maybe POSIX
lastUpdatedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:releasedCapacity:DataRepositoryTaskStatus' :: Maybe Integer
releasedCapacity = forall a. Maybe a
Prelude.Nothing,
      $sel:succeededCount:DataRepositoryTaskStatus' :: Maybe Integer
succeededCount = forall a. Maybe a
Prelude.Nothing,
      $sel:totalCount:DataRepositoryTaskStatus' :: Maybe Integer
totalCount = forall a. Maybe a
Prelude.Nothing
    }

-- | A running total of the number of files that the task failed to process.
dataRepositoryTaskStatus_failedCount :: Lens.Lens' DataRepositoryTaskStatus (Prelude.Maybe Prelude.Integer)
dataRepositoryTaskStatus_failedCount :: Lens' DataRepositoryTaskStatus (Maybe Integer)
dataRepositoryTaskStatus_failedCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataRepositoryTaskStatus' {Maybe Integer
failedCount :: Maybe Integer
$sel:failedCount:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
failedCount} -> Maybe Integer
failedCount) (\s :: DataRepositoryTaskStatus
s@DataRepositoryTaskStatus' {} Maybe Integer
a -> DataRepositoryTaskStatus
s {$sel:failedCount:DataRepositoryTaskStatus' :: Maybe Integer
failedCount = Maybe Integer
a} :: DataRepositoryTaskStatus)

-- | The time at which the task status was last updated.
dataRepositoryTaskStatus_lastUpdatedTime :: Lens.Lens' DataRepositoryTaskStatus (Prelude.Maybe Prelude.UTCTime)
dataRepositoryTaskStatus_lastUpdatedTime :: Lens' DataRepositoryTaskStatus (Maybe UTCTime)
dataRepositoryTaskStatus_lastUpdatedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataRepositoryTaskStatus' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: DataRepositoryTaskStatus
s@DataRepositoryTaskStatus' {} Maybe POSIX
a -> DataRepositoryTaskStatus
s {$sel:lastUpdatedTime:DataRepositoryTaskStatus' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: DataRepositoryTaskStatus) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The total amount of data, in GiB, released by an Amazon File Cache
-- AUTO_RELEASE_DATA task that automatically releases files from the cache.
dataRepositoryTaskStatus_releasedCapacity :: Lens.Lens' DataRepositoryTaskStatus (Prelude.Maybe Prelude.Integer)
dataRepositoryTaskStatus_releasedCapacity :: Lens' DataRepositoryTaskStatus (Maybe Integer)
dataRepositoryTaskStatus_releasedCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataRepositoryTaskStatus' {Maybe Integer
releasedCapacity :: Maybe Integer
$sel:releasedCapacity:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
releasedCapacity} -> Maybe Integer
releasedCapacity) (\s :: DataRepositoryTaskStatus
s@DataRepositoryTaskStatus' {} Maybe Integer
a -> DataRepositoryTaskStatus
s {$sel:releasedCapacity:DataRepositoryTaskStatus' :: Maybe Integer
releasedCapacity = Maybe Integer
a} :: DataRepositoryTaskStatus)

-- | A running total of the number of files that the task has successfully
-- processed.
dataRepositoryTaskStatus_succeededCount :: Lens.Lens' DataRepositoryTaskStatus (Prelude.Maybe Prelude.Integer)
dataRepositoryTaskStatus_succeededCount :: Lens' DataRepositoryTaskStatus (Maybe Integer)
dataRepositoryTaskStatus_succeededCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataRepositoryTaskStatus' {Maybe Integer
succeededCount :: Maybe Integer
$sel:succeededCount:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
succeededCount} -> Maybe Integer
succeededCount) (\s :: DataRepositoryTaskStatus
s@DataRepositoryTaskStatus' {} Maybe Integer
a -> DataRepositoryTaskStatus
s {$sel:succeededCount:DataRepositoryTaskStatus' :: Maybe Integer
succeededCount = Maybe Integer
a} :: DataRepositoryTaskStatus)

-- | The total number of files that the task will process. While a task is
-- executing, the sum of @SucceededCount@ plus @FailedCount@ may not equal
-- @TotalCount@. When the task is complete, @TotalCount@ equals the sum of
-- @SucceededCount@ plus @FailedCount@.
dataRepositoryTaskStatus_totalCount :: Lens.Lens' DataRepositoryTaskStatus (Prelude.Maybe Prelude.Integer)
dataRepositoryTaskStatus_totalCount :: Lens' DataRepositoryTaskStatus (Maybe Integer)
dataRepositoryTaskStatus_totalCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataRepositoryTaskStatus' {Maybe Integer
totalCount :: Maybe Integer
$sel:totalCount:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
totalCount} -> Maybe Integer
totalCount) (\s :: DataRepositoryTaskStatus
s@DataRepositoryTaskStatus' {} Maybe Integer
a -> DataRepositoryTaskStatus
s {$sel:totalCount:DataRepositoryTaskStatus' :: Maybe Integer
totalCount = Maybe Integer
a} :: DataRepositoryTaskStatus)

instance Data.FromJSON DataRepositoryTaskStatus where
  parseJSON :: Value -> Parser DataRepositoryTaskStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DataRepositoryTaskStatus"
      ( \Object
x ->
          Maybe Integer
-> Maybe POSIX
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> DataRepositoryTaskStatus
DataRepositoryTaskStatus'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FailedCount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastUpdatedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ReleasedCapacity")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SucceededCount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TotalCount")
      )

instance Prelude.Hashable DataRepositoryTaskStatus where
  hashWithSalt :: Int -> DataRepositoryTaskStatus -> Int
hashWithSalt Int
_salt DataRepositoryTaskStatus' {Maybe Integer
Maybe POSIX
totalCount :: Maybe Integer
succeededCount :: Maybe Integer
releasedCapacity :: Maybe Integer
lastUpdatedTime :: Maybe POSIX
failedCount :: Maybe Integer
$sel:totalCount:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
$sel:succeededCount:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
$sel:releasedCapacity:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
$sel:lastUpdatedTime:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe POSIX
$sel:failedCount:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
failedCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
releasedCapacity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
succeededCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
totalCount

instance Prelude.NFData DataRepositoryTaskStatus where
  rnf :: DataRepositoryTaskStatus -> ()
rnf DataRepositoryTaskStatus' {Maybe Integer
Maybe POSIX
totalCount :: Maybe Integer
succeededCount :: Maybe Integer
releasedCapacity :: Maybe Integer
lastUpdatedTime :: Maybe POSIX
failedCount :: Maybe Integer
$sel:totalCount:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
$sel:succeededCount:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
$sel:releasedCapacity:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
$sel:lastUpdatedTime:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe POSIX
$sel:failedCount:DataRepositoryTaskStatus' :: DataRepositoryTaskStatus -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
failedCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
releasedCapacity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
succeededCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
totalCount