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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHub.Types.ResourceAttribute
import Amazonka.MigrationHub.Types.Task
import qualified Amazonka.Prelude as Prelude

-- | Represents a migration task in a migration tool.
--
-- /See:/ 'newMigrationTask' smart constructor.
data MigrationTask = MigrationTask'
  { -- | Unique identifier that references the migration task. /Do not store
    -- personal data in this field./
    MigrationTask -> Maybe Text
migrationTaskName :: Prelude.Maybe Prelude.Text,
    -- | A name that identifies the vendor of the migration tool being used.
    MigrationTask -> Maybe Text
progressUpdateStream :: Prelude.Maybe Prelude.Text,
    -- | Information about the resource that is being migrated. This data will be
    -- used to map the task to a resource in the Application Discovery Service
    -- repository.
    MigrationTask -> Maybe [ResourceAttribute]
resourceAttributeList :: Prelude.Maybe [ResourceAttribute],
    -- | Task object encapsulating task information.
    MigrationTask -> Maybe Task
task :: Prelude.Maybe Task,
    -- | The timestamp when the task was gathered.
    MigrationTask -> Maybe POSIX
updateDateTime :: Prelude.Maybe Data.POSIX
  }
  deriving (MigrationTask -> MigrationTask -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MigrationTask -> MigrationTask -> Bool
$c/= :: MigrationTask -> MigrationTask -> Bool
== :: MigrationTask -> MigrationTask -> Bool
$c== :: MigrationTask -> MigrationTask -> Bool
Prelude.Eq, ReadPrec [MigrationTask]
ReadPrec MigrationTask
Int -> ReadS MigrationTask
ReadS [MigrationTask]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MigrationTask]
$creadListPrec :: ReadPrec [MigrationTask]
readPrec :: ReadPrec MigrationTask
$creadPrec :: ReadPrec MigrationTask
readList :: ReadS [MigrationTask]
$creadList :: ReadS [MigrationTask]
readsPrec :: Int -> ReadS MigrationTask
$creadsPrec :: Int -> ReadS MigrationTask
Prelude.Read, Int -> MigrationTask -> ShowS
[MigrationTask] -> ShowS
MigrationTask -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MigrationTask] -> ShowS
$cshowList :: [MigrationTask] -> ShowS
show :: MigrationTask -> String
$cshow :: MigrationTask -> String
showsPrec :: Int -> MigrationTask -> ShowS
$cshowsPrec :: Int -> MigrationTask -> ShowS
Prelude.Show, forall x. Rep MigrationTask x -> MigrationTask
forall x. MigrationTask -> Rep MigrationTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MigrationTask x -> MigrationTask
$cfrom :: forall x. MigrationTask -> Rep MigrationTask x
Prelude.Generic)

-- |
-- Create a value of 'MigrationTask' 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:
--
-- 'migrationTaskName', 'migrationTask_migrationTaskName' - Unique identifier that references the migration task. /Do not store
-- personal data in this field./
--
-- 'progressUpdateStream', 'migrationTask_progressUpdateStream' - A name that identifies the vendor of the migration tool being used.
--
-- 'resourceAttributeList', 'migrationTask_resourceAttributeList' - Information about the resource that is being migrated. This data will be
-- used to map the task to a resource in the Application Discovery Service
-- repository.
--
-- 'task', 'migrationTask_task' - Task object encapsulating task information.
--
-- 'updateDateTime', 'migrationTask_updateDateTime' - The timestamp when the task was gathered.
newMigrationTask ::
  MigrationTask
newMigrationTask :: MigrationTask
newMigrationTask =
  MigrationTask'
    { $sel:migrationTaskName:MigrationTask' :: Maybe Text
migrationTaskName = forall a. Maybe a
Prelude.Nothing,
      $sel:progressUpdateStream:MigrationTask' :: Maybe Text
progressUpdateStream = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceAttributeList:MigrationTask' :: Maybe [ResourceAttribute]
resourceAttributeList = forall a. Maybe a
Prelude.Nothing,
      $sel:task:MigrationTask' :: Maybe Task
task = forall a. Maybe a
Prelude.Nothing,
      $sel:updateDateTime:MigrationTask' :: Maybe POSIX
updateDateTime = forall a. Maybe a
Prelude.Nothing
    }

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

-- | A name that identifies the vendor of the migration tool being used.
migrationTask_progressUpdateStream :: Lens.Lens' MigrationTask (Prelude.Maybe Prelude.Text)
migrationTask_progressUpdateStream :: Lens' MigrationTask (Maybe Text)
migrationTask_progressUpdateStream = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationTask' {Maybe Text
progressUpdateStream :: Maybe Text
$sel:progressUpdateStream:MigrationTask' :: MigrationTask -> Maybe Text
progressUpdateStream} -> Maybe Text
progressUpdateStream) (\s :: MigrationTask
s@MigrationTask' {} Maybe Text
a -> MigrationTask
s {$sel:progressUpdateStream:MigrationTask' :: Maybe Text
progressUpdateStream = Maybe Text
a} :: MigrationTask)

-- | Information about the resource that is being migrated. This data will be
-- used to map the task to a resource in the Application Discovery Service
-- repository.
migrationTask_resourceAttributeList :: Lens.Lens' MigrationTask (Prelude.Maybe [ResourceAttribute])
migrationTask_resourceAttributeList :: Lens' MigrationTask (Maybe [ResourceAttribute])
migrationTask_resourceAttributeList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationTask' {Maybe [ResourceAttribute]
resourceAttributeList :: Maybe [ResourceAttribute]
$sel:resourceAttributeList:MigrationTask' :: MigrationTask -> Maybe [ResourceAttribute]
resourceAttributeList} -> Maybe [ResourceAttribute]
resourceAttributeList) (\s :: MigrationTask
s@MigrationTask' {} Maybe [ResourceAttribute]
a -> MigrationTask
s {$sel:resourceAttributeList:MigrationTask' :: Maybe [ResourceAttribute]
resourceAttributeList = Maybe [ResourceAttribute]
a} :: MigrationTask) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Task object encapsulating task information.
migrationTask_task :: Lens.Lens' MigrationTask (Prelude.Maybe Task)
migrationTask_task :: Lens' MigrationTask (Maybe Task)
migrationTask_task = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationTask' {Maybe Task
task :: Maybe Task
$sel:task:MigrationTask' :: MigrationTask -> Maybe Task
task} -> Maybe Task
task) (\s :: MigrationTask
s@MigrationTask' {} Maybe Task
a -> MigrationTask
s {$sel:task:MigrationTask' :: Maybe Task
task = Maybe Task
a} :: MigrationTask)

-- | The timestamp when the task was gathered.
migrationTask_updateDateTime :: Lens.Lens' MigrationTask (Prelude.Maybe Prelude.UTCTime)
migrationTask_updateDateTime :: Lens' MigrationTask (Maybe UTCTime)
migrationTask_updateDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationTask' {Maybe POSIX
updateDateTime :: Maybe POSIX
$sel:updateDateTime:MigrationTask' :: MigrationTask -> Maybe POSIX
updateDateTime} -> Maybe POSIX
updateDateTime) (\s :: MigrationTask
s@MigrationTask' {} Maybe POSIX
a -> MigrationTask
s {$sel:updateDateTime:MigrationTask' :: Maybe POSIX
updateDateTime = Maybe POSIX
a} :: MigrationTask) 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

instance Data.FromJSON MigrationTask where
  parseJSON :: Value -> Parser MigrationTask
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MigrationTask"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [ResourceAttribute]
-> Maybe Task
-> Maybe POSIX
-> MigrationTask
MigrationTask'
            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
"MigrationTaskName")
            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
"ProgressUpdateStream")
            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
"ResourceAttributeList"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"Task")
            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
"UpdateDateTime")
      )

instance Prelude.Hashable MigrationTask where
  hashWithSalt :: Int -> MigrationTask -> Int
hashWithSalt Int
_salt MigrationTask' {Maybe [ResourceAttribute]
Maybe Text
Maybe POSIX
Maybe Task
updateDateTime :: Maybe POSIX
task :: Maybe Task
resourceAttributeList :: Maybe [ResourceAttribute]
progressUpdateStream :: Maybe Text
migrationTaskName :: Maybe Text
$sel:updateDateTime:MigrationTask' :: MigrationTask -> Maybe POSIX
$sel:task:MigrationTask' :: MigrationTask -> Maybe Task
$sel:resourceAttributeList:MigrationTask' :: MigrationTask -> Maybe [ResourceAttribute]
$sel:progressUpdateStream:MigrationTask' :: MigrationTask -> Maybe Text
$sel:migrationTaskName:MigrationTask' :: MigrationTask -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
migrationTaskName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
progressUpdateStream
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ResourceAttribute]
resourceAttributeList
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Task
task
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
updateDateTime

instance Prelude.NFData MigrationTask where
  rnf :: MigrationTask -> ()
rnf MigrationTask' {Maybe [ResourceAttribute]
Maybe Text
Maybe POSIX
Maybe Task
updateDateTime :: Maybe POSIX
task :: Maybe Task
resourceAttributeList :: Maybe [ResourceAttribute]
progressUpdateStream :: Maybe Text
migrationTaskName :: Maybe Text
$sel:updateDateTime:MigrationTask' :: MigrationTask -> Maybe POSIX
$sel:task:MigrationTask' :: MigrationTask -> Maybe Task
$sel:resourceAttributeList:MigrationTask' :: MigrationTask -> Maybe [ResourceAttribute]
$sel:progressUpdateStream:MigrationTask' :: MigrationTask -> Maybe Text
$sel:migrationTaskName:MigrationTask' :: MigrationTask -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
migrationTaskName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
progressUpdateStream
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ResourceAttribute]
resourceAttributeList
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Task
task
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
updateDateTime