{-# 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.MGN.Types.LifeCycle
-- 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.MGN.Types.LifeCycle where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MGN.Types.LifeCycleLastCutover
import Amazonka.MGN.Types.LifeCycleLastTest
import Amazonka.MGN.Types.LifeCycleState
import qualified Amazonka.Prelude as Prelude

-- | Lifecycle.
--
-- /See:/ 'newLifeCycle' smart constructor.
data LifeCycle = LifeCycle'
  { -- | Lifecycle last Test.
    LifeCycle -> Maybe LifeCycleLastTest
lastTest :: Prelude.Maybe LifeCycleLastTest,
    -- | Lifecycle state.
    LifeCycle -> Maybe LifeCycleState
state :: Prelude.Maybe LifeCycleState,
    -- | Lifecycle elapsed time and duration.
    LifeCycle -> Maybe Text
elapsedReplicationDuration :: Prelude.Maybe Prelude.Text,
    -- | Lifecycle last seen date and time.
    LifeCycle -> Maybe Text
lastSeenByServiceDateTime :: Prelude.Maybe Prelude.Text,
    -- | Lifecycle added to service data and time.
    LifeCycle -> Maybe Text
addedToServiceDateTime :: Prelude.Maybe Prelude.Text,
    -- | Lifecycle last Cutover.
    LifeCycle -> Maybe LifeCycleLastCutover
lastCutover :: Prelude.Maybe LifeCycleLastCutover,
    -- | Lifecycle replication initiation date and time.
    LifeCycle -> Maybe Text
firstByteDateTime :: Prelude.Maybe Prelude.Text
  }
  deriving (LifeCycle -> LifeCycle -> Bool
(LifeCycle -> LifeCycle -> Bool)
-> (LifeCycle -> LifeCycle -> Bool) -> Eq LifeCycle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LifeCycle -> LifeCycle -> Bool
$c/= :: LifeCycle -> LifeCycle -> Bool
== :: LifeCycle -> LifeCycle -> Bool
$c== :: LifeCycle -> LifeCycle -> Bool
Prelude.Eq, ReadPrec [LifeCycle]
ReadPrec LifeCycle
Int -> ReadS LifeCycle
ReadS [LifeCycle]
(Int -> ReadS LifeCycle)
-> ReadS [LifeCycle]
-> ReadPrec LifeCycle
-> ReadPrec [LifeCycle]
-> Read LifeCycle
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LifeCycle]
$creadListPrec :: ReadPrec [LifeCycle]
readPrec :: ReadPrec LifeCycle
$creadPrec :: ReadPrec LifeCycle
readList :: ReadS [LifeCycle]
$creadList :: ReadS [LifeCycle]
readsPrec :: Int -> ReadS LifeCycle
$creadsPrec :: Int -> ReadS LifeCycle
Prelude.Read, Int -> LifeCycle -> ShowS
[LifeCycle] -> ShowS
LifeCycle -> String
(Int -> LifeCycle -> ShowS)
-> (LifeCycle -> String)
-> ([LifeCycle] -> ShowS)
-> Show LifeCycle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LifeCycle] -> ShowS
$cshowList :: [LifeCycle] -> ShowS
show :: LifeCycle -> String
$cshow :: LifeCycle -> String
showsPrec :: Int -> LifeCycle -> ShowS
$cshowsPrec :: Int -> LifeCycle -> ShowS
Prelude.Show, (forall x. LifeCycle -> Rep LifeCycle x)
-> (forall x. Rep LifeCycle x -> LifeCycle) -> Generic LifeCycle
forall x. Rep LifeCycle x -> LifeCycle
forall x. LifeCycle -> Rep LifeCycle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LifeCycle x -> LifeCycle
$cfrom :: forall x. LifeCycle -> Rep LifeCycle x
Prelude.Generic)

-- |
-- Create a value of 'LifeCycle' 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:
--
-- 'lastTest', 'lifeCycle_lastTest' - Lifecycle last Test.
--
-- 'state', 'lifeCycle_state' - Lifecycle state.
--
-- 'elapsedReplicationDuration', 'lifeCycle_elapsedReplicationDuration' - Lifecycle elapsed time and duration.
--
-- 'lastSeenByServiceDateTime', 'lifeCycle_lastSeenByServiceDateTime' - Lifecycle last seen date and time.
--
-- 'addedToServiceDateTime', 'lifeCycle_addedToServiceDateTime' - Lifecycle added to service data and time.
--
-- 'lastCutover', 'lifeCycle_lastCutover' - Lifecycle last Cutover.
--
-- 'firstByteDateTime', 'lifeCycle_firstByteDateTime' - Lifecycle replication initiation date and time.
newLifeCycle ::
  LifeCycle
newLifeCycle :: LifeCycle
newLifeCycle =
  LifeCycle' :: Maybe LifeCycleLastTest
-> Maybe LifeCycleState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe LifeCycleLastCutover
-> Maybe Text
-> LifeCycle
LifeCycle'
    { $sel:lastTest:LifeCycle' :: Maybe LifeCycleLastTest
lastTest = Maybe LifeCycleLastTest
forall a. Maybe a
Prelude.Nothing,
      $sel:state:LifeCycle' :: Maybe LifeCycleState
state = Maybe LifeCycleState
forall a. Maybe a
Prelude.Nothing,
      $sel:elapsedReplicationDuration:LifeCycle' :: Maybe Text
elapsedReplicationDuration = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastSeenByServiceDateTime:LifeCycle' :: Maybe Text
lastSeenByServiceDateTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:addedToServiceDateTime:LifeCycle' :: Maybe Text
addedToServiceDateTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastCutover:LifeCycle' :: Maybe LifeCycleLastCutover
lastCutover = Maybe LifeCycleLastCutover
forall a. Maybe a
Prelude.Nothing,
      $sel:firstByteDateTime:LifeCycle' :: Maybe Text
firstByteDateTime = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Lifecycle last Test.
lifeCycle_lastTest :: Lens.Lens' LifeCycle (Prelude.Maybe LifeCycleLastTest)
lifeCycle_lastTest :: (Maybe LifeCycleLastTest -> f (Maybe LifeCycleLastTest))
-> LifeCycle -> f LifeCycle
lifeCycle_lastTest = (LifeCycle -> Maybe LifeCycleLastTest)
-> (LifeCycle -> Maybe LifeCycleLastTest -> LifeCycle)
-> Lens
     LifeCycle
     LifeCycle
     (Maybe LifeCycleLastTest)
     (Maybe LifeCycleLastTest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifeCycle' {Maybe LifeCycleLastTest
lastTest :: Maybe LifeCycleLastTest
$sel:lastTest:LifeCycle' :: LifeCycle -> Maybe LifeCycleLastTest
lastTest} -> Maybe LifeCycleLastTest
lastTest) (\s :: LifeCycle
s@LifeCycle' {} Maybe LifeCycleLastTest
a -> LifeCycle
s {$sel:lastTest:LifeCycle' :: Maybe LifeCycleLastTest
lastTest = Maybe LifeCycleLastTest
a} :: LifeCycle)

-- | Lifecycle state.
lifeCycle_state :: Lens.Lens' LifeCycle (Prelude.Maybe LifeCycleState)
lifeCycle_state :: (Maybe LifeCycleState -> f (Maybe LifeCycleState))
-> LifeCycle -> f LifeCycle
lifeCycle_state = (LifeCycle -> Maybe LifeCycleState)
-> (LifeCycle -> Maybe LifeCycleState -> LifeCycle)
-> Lens
     LifeCycle LifeCycle (Maybe LifeCycleState) (Maybe LifeCycleState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifeCycle' {Maybe LifeCycleState
state :: Maybe LifeCycleState
$sel:state:LifeCycle' :: LifeCycle -> Maybe LifeCycleState
state} -> Maybe LifeCycleState
state) (\s :: LifeCycle
s@LifeCycle' {} Maybe LifeCycleState
a -> LifeCycle
s {$sel:state:LifeCycle' :: Maybe LifeCycleState
state = Maybe LifeCycleState
a} :: LifeCycle)

-- | Lifecycle elapsed time and duration.
lifeCycle_elapsedReplicationDuration :: Lens.Lens' LifeCycle (Prelude.Maybe Prelude.Text)
lifeCycle_elapsedReplicationDuration :: (Maybe Text -> f (Maybe Text)) -> LifeCycle -> f LifeCycle
lifeCycle_elapsedReplicationDuration = (LifeCycle -> Maybe Text)
-> (LifeCycle -> Maybe Text -> LifeCycle)
-> Lens LifeCycle LifeCycle (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifeCycle' {Maybe Text
elapsedReplicationDuration :: Maybe Text
$sel:elapsedReplicationDuration:LifeCycle' :: LifeCycle -> Maybe Text
elapsedReplicationDuration} -> Maybe Text
elapsedReplicationDuration) (\s :: LifeCycle
s@LifeCycle' {} Maybe Text
a -> LifeCycle
s {$sel:elapsedReplicationDuration:LifeCycle' :: Maybe Text
elapsedReplicationDuration = Maybe Text
a} :: LifeCycle)

-- | Lifecycle last seen date and time.
lifeCycle_lastSeenByServiceDateTime :: Lens.Lens' LifeCycle (Prelude.Maybe Prelude.Text)
lifeCycle_lastSeenByServiceDateTime :: (Maybe Text -> f (Maybe Text)) -> LifeCycle -> f LifeCycle
lifeCycle_lastSeenByServiceDateTime = (LifeCycle -> Maybe Text)
-> (LifeCycle -> Maybe Text -> LifeCycle)
-> Lens LifeCycle LifeCycle (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifeCycle' {Maybe Text
lastSeenByServiceDateTime :: Maybe Text
$sel:lastSeenByServiceDateTime:LifeCycle' :: LifeCycle -> Maybe Text
lastSeenByServiceDateTime} -> Maybe Text
lastSeenByServiceDateTime) (\s :: LifeCycle
s@LifeCycle' {} Maybe Text
a -> LifeCycle
s {$sel:lastSeenByServiceDateTime:LifeCycle' :: Maybe Text
lastSeenByServiceDateTime = Maybe Text
a} :: LifeCycle)

-- | Lifecycle added to service data and time.
lifeCycle_addedToServiceDateTime :: Lens.Lens' LifeCycle (Prelude.Maybe Prelude.Text)
lifeCycle_addedToServiceDateTime :: (Maybe Text -> f (Maybe Text)) -> LifeCycle -> f LifeCycle
lifeCycle_addedToServiceDateTime = (LifeCycle -> Maybe Text)
-> (LifeCycle -> Maybe Text -> LifeCycle)
-> Lens LifeCycle LifeCycle (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifeCycle' {Maybe Text
addedToServiceDateTime :: Maybe Text
$sel:addedToServiceDateTime:LifeCycle' :: LifeCycle -> Maybe Text
addedToServiceDateTime} -> Maybe Text
addedToServiceDateTime) (\s :: LifeCycle
s@LifeCycle' {} Maybe Text
a -> LifeCycle
s {$sel:addedToServiceDateTime:LifeCycle' :: Maybe Text
addedToServiceDateTime = Maybe Text
a} :: LifeCycle)

-- | Lifecycle last Cutover.
lifeCycle_lastCutover :: Lens.Lens' LifeCycle (Prelude.Maybe LifeCycleLastCutover)
lifeCycle_lastCutover :: (Maybe LifeCycleLastCutover -> f (Maybe LifeCycleLastCutover))
-> LifeCycle -> f LifeCycle
lifeCycle_lastCutover = (LifeCycle -> Maybe LifeCycleLastCutover)
-> (LifeCycle -> Maybe LifeCycleLastCutover -> LifeCycle)
-> Lens
     LifeCycle
     LifeCycle
     (Maybe LifeCycleLastCutover)
     (Maybe LifeCycleLastCutover)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifeCycle' {Maybe LifeCycleLastCutover
lastCutover :: Maybe LifeCycleLastCutover
$sel:lastCutover:LifeCycle' :: LifeCycle -> Maybe LifeCycleLastCutover
lastCutover} -> Maybe LifeCycleLastCutover
lastCutover) (\s :: LifeCycle
s@LifeCycle' {} Maybe LifeCycleLastCutover
a -> LifeCycle
s {$sel:lastCutover:LifeCycle' :: Maybe LifeCycleLastCutover
lastCutover = Maybe LifeCycleLastCutover
a} :: LifeCycle)

-- | Lifecycle replication initiation date and time.
lifeCycle_firstByteDateTime :: Lens.Lens' LifeCycle (Prelude.Maybe Prelude.Text)
lifeCycle_firstByteDateTime :: (Maybe Text -> f (Maybe Text)) -> LifeCycle -> f LifeCycle
lifeCycle_firstByteDateTime = (LifeCycle -> Maybe Text)
-> (LifeCycle -> Maybe Text -> LifeCycle)
-> Lens LifeCycle LifeCycle (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifeCycle' {Maybe Text
firstByteDateTime :: Maybe Text
$sel:firstByteDateTime:LifeCycle' :: LifeCycle -> Maybe Text
firstByteDateTime} -> Maybe Text
firstByteDateTime) (\s :: LifeCycle
s@LifeCycle' {} Maybe Text
a -> LifeCycle
s {$sel:firstByteDateTime:LifeCycle' :: Maybe Text
firstByteDateTime = Maybe Text
a} :: LifeCycle)

instance Core.FromJSON LifeCycle where
  parseJSON :: Value -> Parser LifeCycle
parseJSON =
    String -> (Object -> Parser LifeCycle) -> Value -> Parser LifeCycle
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LifeCycle"
      ( \Object
x ->
          Maybe LifeCycleLastTest
-> Maybe LifeCycleState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe LifeCycleLastCutover
-> Maybe Text
-> LifeCycle
LifeCycle'
            (Maybe LifeCycleLastTest
 -> Maybe LifeCycleState
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe LifeCycleLastCutover
 -> Maybe Text
 -> LifeCycle)
-> Parser (Maybe LifeCycleLastTest)
-> Parser
     (Maybe LifeCycleState
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe LifeCycleLastCutover
      -> Maybe Text
      -> LifeCycle)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LifeCycleLastTest)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastTest")
            Parser
  (Maybe LifeCycleState
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe LifeCycleLastCutover
   -> Maybe Text
   -> LifeCycle)
-> Parser (Maybe LifeCycleState)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe LifeCycleLastCutover
      -> Maybe Text
      -> LifeCycle)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LifeCycleState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe LifeCycleLastCutover
   -> Maybe Text
   -> LifeCycle)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe LifeCycleLastCutover
      -> Maybe Text
      -> LifeCycle)
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
"elapsedReplicationDuration")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe LifeCycleLastCutover
   -> Maybe Text
   -> LifeCycle)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe LifeCycleLastCutover -> Maybe Text -> LifeCycle)
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
"lastSeenByServiceDateTime")
            Parser
  (Maybe Text
   -> Maybe LifeCycleLastCutover -> Maybe Text -> LifeCycle)
-> Parser (Maybe Text)
-> Parser (Maybe LifeCycleLastCutover -> Maybe Text -> LifeCycle)
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
"addedToServiceDateTime")
            Parser (Maybe LifeCycleLastCutover -> Maybe Text -> LifeCycle)
-> Parser (Maybe LifeCycleLastCutover)
-> Parser (Maybe Text -> LifeCycle)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LifeCycleLastCutover)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastCutover")
            Parser (Maybe Text -> LifeCycle)
-> Parser (Maybe Text) -> Parser LifeCycle
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
"firstByteDateTime")
      )

instance Prelude.Hashable LifeCycle

instance Prelude.NFData LifeCycle