{-# 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.MigrationHub.Types.MigrationTaskSummary
-- 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.MigrationHub.Types.MigrationTaskSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MigrationHub.Types.MigrationStatus
import qualified Amazonka.Prelude as Prelude

-- | MigrationTaskSummary includes @MigrationTaskName@, @ProgressPercent@,
-- @ProgressUpdateStream@, @Status@, and @UpdateDateTime@ for each task.
--
-- /See:/ 'newMigrationTaskSummary' smart constructor.
data MigrationTaskSummary = MigrationTaskSummary'
  { -- | Status of the task.
    MigrationTaskSummary -> Maybe MigrationStatus
status :: Prelude.Maybe MigrationStatus,
    -- | The timestamp when the task was gathered.
    MigrationTaskSummary -> Maybe POSIX
updateDateTime :: Prelude.Maybe Core.POSIX,
    -- | Indication of the percentage completion of the task.
    MigrationTaskSummary -> Maybe Natural
progressPercent :: Prelude.Maybe Prelude.Natural,
    -- | Detail information of what is being done within the overall status
    -- state.
    MigrationTaskSummary -> Maybe Text
statusDetail :: Prelude.Maybe Prelude.Text,
    -- | An AWS resource used for access control. It should uniquely identify the
    -- migration tool as it is used for all updates made by the tool.
    MigrationTaskSummary -> Maybe Text
progressUpdateStream :: Prelude.Maybe Prelude.Text,
    -- | Unique identifier that references the migration task. /Do not store
    -- personal data in this field./
    MigrationTaskSummary -> Maybe Text
migrationTaskName :: Prelude.Maybe Prelude.Text
  }
  deriving (MigrationTaskSummary -> MigrationTaskSummary -> Bool
(MigrationTaskSummary -> MigrationTaskSummary -> Bool)
-> (MigrationTaskSummary -> MigrationTaskSummary -> Bool)
-> Eq MigrationTaskSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MigrationTaskSummary -> MigrationTaskSummary -> Bool
$c/= :: MigrationTaskSummary -> MigrationTaskSummary -> Bool
== :: MigrationTaskSummary -> MigrationTaskSummary -> Bool
$c== :: MigrationTaskSummary -> MigrationTaskSummary -> Bool
Prelude.Eq, ReadPrec [MigrationTaskSummary]
ReadPrec MigrationTaskSummary
Int -> ReadS MigrationTaskSummary
ReadS [MigrationTaskSummary]
(Int -> ReadS MigrationTaskSummary)
-> ReadS [MigrationTaskSummary]
-> ReadPrec MigrationTaskSummary
-> ReadPrec [MigrationTaskSummary]
-> Read MigrationTaskSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MigrationTaskSummary]
$creadListPrec :: ReadPrec [MigrationTaskSummary]
readPrec :: ReadPrec MigrationTaskSummary
$creadPrec :: ReadPrec MigrationTaskSummary
readList :: ReadS [MigrationTaskSummary]
$creadList :: ReadS [MigrationTaskSummary]
readsPrec :: Int -> ReadS MigrationTaskSummary
$creadsPrec :: Int -> ReadS MigrationTaskSummary
Prelude.Read, Int -> MigrationTaskSummary -> ShowS
[MigrationTaskSummary] -> ShowS
MigrationTaskSummary -> String
(Int -> MigrationTaskSummary -> ShowS)
-> (MigrationTaskSummary -> String)
-> ([MigrationTaskSummary] -> ShowS)
-> Show MigrationTaskSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MigrationTaskSummary] -> ShowS
$cshowList :: [MigrationTaskSummary] -> ShowS
show :: MigrationTaskSummary -> String
$cshow :: MigrationTaskSummary -> String
showsPrec :: Int -> MigrationTaskSummary -> ShowS
$cshowsPrec :: Int -> MigrationTaskSummary -> ShowS
Prelude.Show, (forall x. MigrationTaskSummary -> Rep MigrationTaskSummary x)
-> (forall x. Rep MigrationTaskSummary x -> MigrationTaskSummary)
-> Generic MigrationTaskSummary
forall x. Rep MigrationTaskSummary x -> MigrationTaskSummary
forall x. MigrationTaskSummary -> Rep MigrationTaskSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MigrationTaskSummary x -> MigrationTaskSummary
$cfrom :: forall x. MigrationTaskSummary -> Rep MigrationTaskSummary x
Prelude.Generic)

-- |
-- Create a value of 'MigrationTaskSummary' 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:
--
-- 'status', 'migrationTaskSummary_status' - Status of the task.
--
-- 'updateDateTime', 'migrationTaskSummary_updateDateTime' - The timestamp when the task was gathered.
--
-- 'progressPercent', 'migrationTaskSummary_progressPercent' - Indication of the percentage completion of the task.
--
-- 'statusDetail', 'migrationTaskSummary_statusDetail' - Detail information of what is being done within the overall status
-- state.
--
-- 'progressUpdateStream', 'migrationTaskSummary_progressUpdateStream' - An AWS resource used for access control. It should uniquely identify the
-- migration tool as it is used for all updates made by the tool.
--
-- 'migrationTaskName', 'migrationTaskSummary_migrationTaskName' - Unique identifier that references the migration task. /Do not store
-- personal data in this field./
newMigrationTaskSummary ::
  MigrationTaskSummary
newMigrationTaskSummary :: MigrationTaskSummary
newMigrationTaskSummary =
  MigrationTaskSummary' :: Maybe MigrationStatus
-> Maybe POSIX
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> MigrationTaskSummary
MigrationTaskSummary'
    { $sel:status:MigrationTaskSummary' :: Maybe MigrationStatus
status = Maybe MigrationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:updateDateTime:MigrationTaskSummary' :: Maybe POSIX
updateDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:progressPercent:MigrationTaskSummary' :: Maybe Natural
progressPercent = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:statusDetail:MigrationTaskSummary' :: Maybe Text
statusDetail = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:progressUpdateStream:MigrationTaskSummary' :: Maybe Text
progressUpdateStream = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:migrationTaskName:MigrationTaskSummary' :: Maybe Text
migrationTaskName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Status of the task.
migrationTaskSummary_status :: Lens.Lens' MigrationTaskSummary (Prelude.Maybe MigrationStatus)
migrationTaskSummary_status :: (Maybe MigrationStatus -> f (Maybe MigrationStatus))
-> MigrationTaskSummary -> f MigrationTaskSummary
migrationTaskSummary_status = (MigrationTaskSummary -> Maybe MigrationStatus)
-> (MigrationTaskSummary
    -> Maybe MigrationStatus -> MigrationTaskSummary)
-> Lens
     MigrationTaskSummary
     MigrationTaskSummary
     (Maybe MigrationStatus)
     (Maybe MigrationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationTaskSummary' {Maybe MigrationStatus
status :: Maybe MigrationStatus
$sel:status:MigrationTaskSummary' :: MigrationTaskSummary -> Maybe MigrationStatus
status} -> Maybe MigrationStatus
status) (\s :: MigrationTaskSummary
s@MigrationTaskSummary' {} Maybe MigrationStatus
a -> MigrationTaskSummary
s {$sel:status:MigrationTaskSummary' :: Maybe MigrationStatus
status = Maybe MigrationStatus
a} :: MigrationTaskSummary)

-- | The timestamp when the task was gathered.
migrationTaskSummary_updateDateTime :: Lens.Lens' MigrationTaskSummary (Prelude.Maybe Prelude.UTCTime)
migrationTaskSummary_updateDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> MigrationTaskSummary -> f MigrationTaskSummary
migrationTaskSummary_updateDateTime = (MigrationTaskSummary -> Maybe POSIX)
-> (MigrationTaskSummary -> Maybe POSIX -> MigrationTaskSummary)
-> Lens
     MigrationTaskSummary
     MigrationTaskSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationTaskSummary' {Maybe POSIX
updateDateTime :: Maybe POSIX
$sel:updateDateTime:MigrationTaskSummary' :: MigrationTaskSummary -> Maybe POSIX
updateDateTime} -> Maybe POSIX
updateDateTime) (\s :: MigrationTaskSummary
s@MigrationTaskSummary' {} Maybe POSIX
a -> MigrationTaskSummary
s {$sel:updateDateTime:MigrationTaskSummary' :: Maybe POSIX
updateDateTime = Maybe POSIX
a} :: MigrationTaskSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> MigrationTaskSummary -> f MigrationTaskSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> MigrationTaskSummary
-> f MigrationTaskSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Indication of the percentage completion of the task.
migrationTaskSummary_progressPercent :: Lens.Lens' MigrationTaskSummary (Prelude.Maybe Prelude.Natural)
migrationTaskSummary_progressPercent :: (Maybe Natural -> f (Maybe Natural))
-> MigrationTaskSummary -> f MigrationTaskSummary
migrationTaskSummary_progressPercent = (MigrationTaskSummary -> Maybe Natural)
-> (MigrationTaskSummary -> Maybe Natural -> MigrationTaskSummary)
-> Lens
     MigrationTaskSummary
     MigrationTaskSummary
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationTaskSummary' {Maybe Natural
progressPercent :: Maybe Natural
$sel:progressPercent:MigrationTaskSummary' :: MigrationTaskSummary -> Maybe Natural
progressPercent} -> Maybe Natural
progressPercent) (\s :: MigrationTaskSummary
s@MigrationTaskSummary' {} Maybe Natural
a -> MigrationTaskSummary
s {$sel:progressPercent:MigrationTaskSummary' :: Maybe Natural
progressPercent = Maybe Natural
a} :: MigrationTaskSummary)

-- | Detail information of what is being done within the overall status
-- state.
migrationTaskSummary_statusDetail :: Lens.Lens' MigrationTaskSummary (Prelude.Maybe Prelude.Text)
migrationTaskSummary_statusDetail :: (Maybe Text -> f (Maybe Text))
-> MigrationTaskSummary -> f MigrationTaskSummary
migrationTaskSummary_statusDetail = (MigrationTaskSummary -> Maybe Text)
-> (MigrationTaskSummary -> Maybe Text -> MigrationTaskSummary)
-> Lens
     MigrationTaskSummary MigrationTaskSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationTaskSummary' {Maybe Text
statusDetail :: Maybe Text
$sel:statusDetail:MigrationTaskSummary' :: MigrationTaskSummary -> Maybe Text
statusDetail} -> Maybe Text
statusDetail) (\s :: MigrationTaskSummary
s@MigrationTaskSummary' {} Maybe Text
a -> MigrationTaskSummary
s {$sel:statusDetail:MigrationTaskSummary' :: Maybe Text
statusDetail = Maybe Text
a} :: MigrationTaskSummary)

-- | An AWS resource used for access control. It should uniquely identify the
-- migration tool as it is used for all updates made by the tool.
migrationTaskSummary_progressUpdateStream :: Lens.Lens' MigrationTaskSummary (Prelude.Maybe Prelude.Text)
migrationTaskSummary_progressUpdateStream :: (Maybe Text -> f (Maybe Text))
-> MigrationTaskSummary -> f MigrationTaskSummary
migrationTaskSummary_progressUpdateStream = (MigrationTaskSummary -> Maybe Text)
-> (MigrationTaskSummary -> Maybe Text -> MigrationTaskSummary)
-> Lens
     MigrationTaskSummary MigrationTaskSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationTaskSummary' {Maybe Text
progressUpdateStream :: Maybe Text
$sel:progressUpdateStream:MigrationTaskSummary' :: MigrationTaskSummary -> Maybe Text
progressUpdateStream} -> Maybe Text
progressUpdateStream) (\s :: MigrationTaskSummary
s@MigrationTaskSummary' {} Maybe Text
a -> MigrationTaskSummary
s {$sel:progressUpdateStream:MigrationTaskSummary' :: Maybe Text
progressUpdateStream = Maybe Text
a} :: MigrationTaskSummary)

-- | Unique identifier that references the migration task. /Do not store
-- personal data in this field./
migrationTaskSummary_migrationTaskName :: Lens.Lens' MigrationTaskSummary (Prelude.Maybe Prelude.Text)
migrationTaskSummary_migrationTaskName :: (Maybe Text -> f (Maybe Text))
-> MigrationTaskSummary -> f MigrationTaskSummary
migrationTaskSummary_migrationTaskName = (MigrationTaskSummary -> Maybe Text)
-> (MigrationTaskSummary -> Maybe Text -> MigrationTaskSummary)
-> Lens
     MigrationTaskSummary MigrationTaskSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationTaskSummary' {Maybe Text
migrationTaskName :: Maybe Text
$sel:migrationTaskName:MigrationTaskSummary' :: MigrationTaskSummary -> Maybe Text
migrationTaskName} -> Maybe Text
migrationTaskName) (\s :: MigrationTaskSummary
s@MigrationTaskSummary' {} Maybe Text
a -> MigrationTaskSummary
s {$sel:migrationTaskName:MigrationTaskSummary' :: Maybe Text
migrationTaskName = Maybe Text
a} :: MigrationTaskSummary)

instance Core.FromJSON MigrationTaskSummary where
  parseJSON :: Value -> Parser MigrationTaskSummary
parseJSON =
    String
-> (Object -> Parser MigrationTaskSummary)
-> Value
-> Parser MigrationTaskSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MigrationTaskSummary"
      ( \Object
x ->
          Maybe MigrationStatus
-> Maybe POSIX
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> MigrationTaskSummary
MigrationTaskSummary'
            (Maybe MigrationStatus
 -> Maybe POSIX
 -> Maybe Natural
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> MigrationTaskSummary)
-> Parser (Maybe MigrationStatus)
-> Parser
     (Maybe POSIX
      -> Maybe Natural
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> MigrationTaskSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MigrationStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe POSIX
   -> Maybe Natural
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> MigrationTaskSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Natural
      -> Maybe Text -> Maybe Text -> Maybe Text -> MigrationTaskSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdateDateTime")
            Parser
  (Maybe Natural
   -> Maybe Text -> Maybe Text -> Maybe Text -> MigrationTaskSummary)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> MigrationTaskSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProgressPercent")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> MigrationTaskSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> MigrationTaskSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusDetail")
            Parser (Maybe Text -> Maybe Text -> MigrationTaskSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> MigrationTaskSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProgressUpdateStream")
            Parser (Maybe Text -> MigrationTaskSummary)
-> Parser (Maybe Text) -> Parser MigrationTaskSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MigrationTaskName")
      )

instance Prelude.Hashable MigrationTaskSummary

instance Prelude.NFData MigrationTaskSummary