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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MGN.Types.DataReplicationInitiationStep
import qualified Amazonka.Prelude as Prelude

-- | Data replication initiation.
--
-- /See:/ 'newDataReplicationInitiation' smart constructor.
data DataReplicationInitiation = DataReplicationInitiation'
  { -- | Request to query data initiation steps.
    DataReplicationInitiation -> Maybe [DataReplicationInitiationStep]
steps :: Prelude.Maybe [DataReplicationInitiationStep],
    -- | Request to query next data initiation date and time.
    DataReplicationInitiation -> Maybe Text
nextAttemptDateTime :: Prelude.Maybe Prelude.Text,
    -- | Request to query data initiation start date and time.
    DataReplicationInitiation -> Maybe Text
startDateTime :: Prelude.Maybe Prelude.Text
  }
  deriving (DataReplicationInitiation -> DataReplicationInitiation -> Bool
(DataReplicationInitiation -> DataReplicationInitiation -> Bool)
-> (DataReplicationInitiation -> DataReplicationInitiation -> Bool)
-> Eq DataReplicationInitiation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataReplicationInitiation -> DataReplicationInitiation -> Bool
$c/= :: DataReplicationInitiation -> DataReplicationInitiation -> Bool
== :: DataReplicationInitiation -> DataReplicationInitiation -> Bool
$c== :: DataReplicationInitiation -> DataReplicationInitiation -> Bool
Prelude.Eq, ReadPrec [DataReplicationInitiation]
ReadPrec DataReplicationInitiation
Int -> ReadS DataReplicationInitiation
ReadS [DataReplicationInitiation]
(Int -> ReadS DataReplicationInitiation)
-> ReadS [DataReplicationInitiation]
-> ReadPrec DataReplicationInitiation
-> ReadPrec [DataReplicationInitiation]
-> Read DataReplicationInitiation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataReplicationInitiation]
$creadListPrec :: ReadPrec [DataReplicationInitiation]
readPrec :: ReadPrec DataReplicationInitiation
$creadPrec :: ReadPrec DataReplicationInitiation
readList :: ReadS [DataReplicationInitiation]
$creadList :: ReadS [DataReplicationInitiation]
readsPrec :: Int -> ReadS DataReplicationInitiation
$creadsPrec :: Int -> ReadS DataReplicationInitiation
Prelude.Read, Int -> DataReplicationInitiation -> ShowS
[DataReplicationInitiation] -> ShowS
DataReplicationInitiation -> String
(Int -> DataReplicationInitiation -> ShowS)
-> (DataReplicationInitiation -> String)
-> ([DataReplicationInitiation] -> ShowS)
-> Show DataReplicationInitiation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataReplicationInitiation] -> ShowS
$cshowList :: [DataReplicationInitiation] -> ShowS
show :: DataReplicationInitiation -> String
$cshow :: DataReplicationInitiation -> String
showsPrec :: Int -> DataReplicationInitiation -> ShowS
$cshowsPrec :: Int -> DataReplicationInitiation -> ShowS
Prelude.Show, (forall x.
 DataReplicationInitiation -> Rep DataReplicationInitiation x)
-> (forall x.
    Rep DataReplicationInitiation x -> DataReplicationInitiation)
-> Generic DataReplicationInitiation
forall x.
Rep DataReplicationInitiation x -> DataReplicationInitiation
forall x.
DataReplicationInitiation -> Rep DataReplicationInitiation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DataReplicationInitiation x -> DataReplicationInitiation
$cfrom :: forall x.
DataReplicationInitiation -> Rep DataReplicationInitiation x
Prelude.Generic)

-- |
-- Create a value of 'DataReplicationInitiation' 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:
--
-- 'steps', 'dataReplicationInitiation_steps' - Request to query data initiation steps.
--
-- 'nextAttemptDateTime', 'dataReplicationInitiation_nextAttemptDateTime' - Request to query next data initiation date and time.
--
-- 'startDateTime', 'dataReplicationInitiation_startDateTime' - Request to query data initiation start date and time.
newDataReplicationInitiation ::
  DataReplicationInitiation
newDataReplicationInitiation :: DataReplicationInitiation
newDataReplicationInitiation =
  DataReplicationInitiation' :: Maybe [DataReplicationInitiationStep]
-> Maybe Text -> Maybe Text -> DataReplicationInitiation
DataReplicationInitiation'
    { $sel:steps:DataReplicationInitiation' :: Maybe [DataReplicationInitiationStep]
steps = Maybe [DataReplicationInitiationStep]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextAttemptDateTime:DataReplicationInitiation' :: Maybe Text
nextAttemptDateTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startDateTime:DataReplicationInitiation' :: Maybe Text
startDateTime = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Request to query data initiation steps.
dataReplicationInitiation_steps :: Lens.Lens' DataReplicationInitiation (Prelude.Maybe [DataReplicationInitiationStep])
dataReplicationInitiation_steps :: (Maybe [DataReplicationInitiationStep]
 -> f (Maybe [DataReplicationInitiationStep]))
-> DataReplicationInitiation -> f DataReplicationInitiation
dataReplicationInitiation_steps = (DataReplicationInitiation
 -> Maybe [DataReplicationInitiationStep])
-> (DataReplicationInitiation
    -> Maybe [DataReplicationInitiationStep]
    -> DataReplicationInitiation)
-> Lens
     DataReplicationInitiation
     DataReplicationInitiation
     (Maybe [DataReplicationInitiationStep])
     (Maybe [DataReplicationInitiationStep])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataReplicationInitiation' {Maybe [DataReplicationInitiationStep]
steps :: Maybe [DataReplicationInitiationStep]
$sel:steps:DataReplicationInitiation' :: DataReplicationInitiation -> Maybe [DataReplicationInitiationStep]
steps} -> Maybe [DataReplicationInitiationStep]
steps) (\s :: DataReplicationInitiation
s@DataReplicationInitiation' {} Maybe [DataReplicationInitiationStep]
a -> DataReplicationInitiation
s {$sel:steps:DataReplicationInitiation' :: Maybe [DataReplicationInitiationStep]
steps = Maybe [DataReplicationInitiationStep]
a} :: DataReplicationInitiation) ((Maybe [DataReplicationInitiationStep]
  -> f (Maybe [DataReplicationInitiationStep]))
 -> DataReplicationInitiation -> f DataReplicationInitiation)
-> ((Maybe [DataReplicationInitiationStep]
     -> f (Maybe [DataReplicationInitiationStep]))
    -> Maybe [DataReplicationInitiationStep]
    -> f (Maybe [DataReplicationInitiationStep]))
-> (Maybe [DataReplicationInitiationStep]
    -> f (Maybe [DataReplicationInitiationStep]))
-> DataReplicationInitiation
-> f DataReplicationInitiation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DataReplicationInitiationStep]
  [DataReplicationInitiationStep]
  [DataReplicationInitiationStep]
  [DataReplicationInitiationStep]
-> Iso
     (Maybe [DataReplicationInitiationStep])
     (Maybe [DataReplicationInitiationStep])
     (Maybe [DataReplicationInitiationStep])
     (Maybe [DataReplicationInitiationStep])
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
  [DataReplicationInitiationStep]
  [DataReplicationInitiationStep]
  [DataReplicationInitiationStep]
  [DataReplicationInitiationStep]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Request to query next data initiation date and time.
dataReplicationInitiation_nextAttemptDateTime :: Lens.Lens' DataReplicationInitiation (Prelude.Maybe Prelude.Text)
dataReplicationInitiation_nextAttemptDateTime :: (Maybe Text -> f (Maybe Text))
-> DataReplicationInitiation -> f DataReplicationInitiation
dataReplicationInitiation_nextAttemptDateTime = (DataReplicationInitiation -> Maybe Text)
-> (DataReplicationInitiation
    -> Maybe Text -> DataReplicationInitiation)
-> Lens
     DataReplicationInitiation
     DataReplicationInitiation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataReplicationInitiation' {Maybe Text
nextAttemptDateTime :: Maybe Text
$sel:nextAttemptDateTime:DataReplicationInitiation' :: DataReplicationInitiation -> Maybe Text
nextAttemptDateTime} -> Maybe Text
nextAttemptDateTime) (\s :: DataReplicationInitiation
s@DataReplicationInitiation' {} Maybe Text
a -> DataReplicationInitiation
s {$sel:nextAttemptDateTime:DataReplicationInitiation' :: Maybe Text
nextAttemptDateTime = Maybe Text
a} :: DataReplicationInitiation)

-- | Request to query data initiation start date and time.
dataReplicationInitiation_startDateTime :: Lens.Lens' DataReplicationInitiation (Prelude.Maybe Prelude.Text)
dataReplicationInitiation_startDateTime :: (Maybe Text -> f (Maybe Text))
-> DataReplicationInitiation -> f DataReplicationInitiation
dataReplicationInitiation_startDateTime = (DataReplicationInitiation -> Maybe Text)
-> (DataReplicationInitiation
    -> Maybe Text -> DataReplicationInitiation)
-> Lens
     DataReplicationInitiation
     DataReplicationInitiation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataReplicationInitiation' {Maybe Text
startDateTime :: Maybe Text
$sel:startDateTime:DataReplicationInitiation' :: DataReplicationInitiation -> Maybe Text
startDateTime} -> Maybe Text
startDateTime) (\s :: DataReplicationInitiation
s@DataReplicationInitiation' {} Maybe Text
a -> DataReplicationInitiation
s {$sel:startDateTime:DataReplicationInitiation' :: Maybe Text
startDateTime = Maybe Text
a} :: DataReplicationInitiation)

instance Core.FromJSON DataReplicationInitiation where
  parseJSON :: Value -> Parser DataReplicationInitiation
parseJSON =
    String
-> (Object -> Parser DataReplicationInitiation)
-> Value
-> Parser DataReplicationInitiation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DataReplicationInitiation"
      ( \Object
x ->
          Maybe [DataReplicationInitiationStep]
-> Maybe Text -> Maybe Text -> DataReplicationInitiation
DataReplicationInitiation'
            (Maybe [DataReplicationInitiationStep]
 -> Maybe Text -> Maybe Text -> DataReplicationInitiation)
-> Parser (Maybe [DataReplicationInitiationStep])
-> Parser (Maybe Text -> Maybe Text -> DataReplicationInitiation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe [DataReplicationInitiationStep]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"steps" Parser (Maybe (Maybe [DataReplicationInitiationStep]))
-> Maybe [DataReplicationInitiationStep]
-> Parser (Maybe [DataReplicationInitiationStep])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [DataReplicationInitiationStep]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Maybe Text -> DataReplicationInitiation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> DataReplicationInitiation)
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
"nextAttemptDateTime")
            Parser (Maybe Text -> DataReplicationInitiation)
-> Parser (Maybe Text) -> Parser DataReplicationInitiation
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
"startDateTime")
      )

instance Prelude.Hashable DataReplicationInitiation

instance Prelude.NFData DataReplicationInitiation