{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DMS.StartReplicationTask
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Starts the replication task.
--
-- For more information about DMS tasks, see
-- <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.html Working with Migration Tasks>
-- in the /Database Migration Service User Guide./
module Amazonka.DMS.StartReplicationTask
  ( -- * Creating a Request
    StartReplicationTask (..),
    newStartReplicationTask,

    -- * Request Lenses
    startReplicationTask_cdcStartPosition,
    startReplicationTask_cdcStartTime,
    startReplicationTask_cdcStopPosition,
    startReplicationTask_replicationTaskArn,
    startReplicationTask_startReplicationTaskType,

    -- * Destructuring the Response
    StartReplicationTaskResponse (..),
    newStartReplicationTaskResponse,

    -- * Response Lenses
    startReplicationTaskResponse_replicationTask,
    startReplicationTaskResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DMS.Types
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- |
--
-- /See:/ 'newStartReplicationTask' smart constructor.
data StartReplicationTask = StartReplicationTask'
  { -- | Indicates when you want a change data capture (CDC) operation to start.
    -- Use either CdcStartPosition or CdcStartTime to specify when you want a
    -- CDC operation to start. Specifying both values results in an error.
    --
    -- The value can be in date, checkpoint, or LSN\/SCN format.
    --
    -- Date Example: --cdc-start-position “2018-03-08T12:12:12”
    --
    -- Checkpoint Example: --cdc-start-position
    -- \"checkpoint:V1#27#mysql-bin-changelog.157832:1975:-1:2002:677883278264080:mysql-bin-changelog.157832:1876#0#0#*#0#93\"
    --
    -- LSN Example: --cdc-start-position “mysql-bin-changelog.000024:373”
    --
    -- When you use this task setting with a source PostgreSQL database, a
    -- logical replication slot should already be created and associated with
    -- the source endpoint. You can verify this by setting the @slotName@ extra
    -- connection attribute to the name of this logical replication slot. For
    -- more information, see
    -- <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.PostgreSQL.html#CHAP_Source.PostgreSQL.ConnectionAttrib Extra Connection Attributes When Using PostgreSQL as a Source for DMS>.
    StartReplicationTask -> Maybe Text
cdcStartPosition :: Prelude.Maybe Prelude.Text,
    -- | Indicates the start time for a change data capture (CDC) operation. Use
    -- either CdcStartTime or CdcStartPosition to specify when you want a CDC
    -- operation to start. Specifying both values results in an error.
    --
    -- Timestamp Example: --cdc-start-time “2018-03-08T12:12:12”
    StartReplicationTask -> Maybe POSIX
cdcStartTime :: Prelude.Maybe Data.POSIX,
    -- | Indicates when you want a change data capture (CDC) operation to stop.
    -- The value can be either server time or commit time.
    --
    -- Server time example: --cdc-stop-position
    -- “server_time:2018-02-09T12:12:12”
    --
    -- Commit time example: --cdc-stop-position “commit_time:
    -- 2018-02-09T12:12:12 “
    StartReplicationTask -> Maybe Text
cdcStopPosition :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the replication task to be started.
    StartReplicationTask -> Text
replicationTaskArn :: Prelude.Text,
    -- | The type of replication task to start.
    --
    -- When the migration type is @full-load@ or @full-load-and-cdc@, the only
    -- valid value for the first run of the task is @start-replication@. You
    -- use @reload-target@ to restart the task and @resume-processing@ to
    -- resume the task.
    --
    -- When the migration type is @cdc@, you use @start-replication@ to start
    -- or restart the task, and @resume-processing@ to resume the task.
    -- @reload-target@ is not a valid value for a task with migration type of
    -- @cdc@.
    StartReplicationTask -> StartReplicationTaskTypeValue
startReplicationTaskType :: StartReplicationTaskTypeValue
  }
  deriving (StartReplicationTask -> StartReplicationTask -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartReplicationTask -> StartReplicationTask -> Bool
$c/= :: StartReplicationTask -> StartReplicationTask -> Bool
== :: StartReplicationTask -> StartReplicationTask -> Bool
$c== :: StartReplicationTask -> StartReplicationTask -> Bool
Prelude.Eq, ReadPrec [StartReplicationTask]
ReadPrec StartReplicationTask
Int -> ReadS StartReplicationTask
ReadS [StartReplicationTask]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartReplicationTask]
$creadListPrec :: ReadPrec [StartReplicationTask]
readPrec :: ReadPrec StartReplicationTask
$creadPrec :: ReadPrec StartReplicationTask
readList :: ReadS [StartReplicationTask]
$creadList :: ReadS [StartReplicationTask]
readsPrec :: Int -> ReadS StartReplicationTask
$creadsPrec :: Int -> ReadS StartReplicationTask
Prelude.Read, Int -> StartReplicationTask -> ShowS
[StartReplicationTask] -> ShowS
StartReplicationTask -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartReplicationTask] -> ShowS
$cshowList :: [StartReplicationTask] -> ShowS
show :: StartReplicationTask -> String
$cshow :: StartReplicationTask -> String
showsPrec :: Int -> StartReplicationTask -> ShowS
$cshowsPrec :: Int -> StartReplicationTask -> ShowS
Prelude.Show, forall x. Rep StartReplicationTask x -> StartReplicationTask
forall x. StartReplicationTask -> Rep StartReplicationTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartReplicationTask x -> StartReplicationTask
$cfrom :: forall x. StartReplicationTask -> Rep StartReplicationTask x
Prelude.Generic)

-- |
-- Create a value of 'StartReplicationTask' 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:
--
-- 'cdcStartPosition', 'startReplicationTask_cdcStartPosition' - Indicates when you want a change data capture (CDC) operation to start.
-- Use either CdcStartPosition or CdcStartTime to specify when you want a
-- CDC operation to start. Specifying both values results in an error.
--
-- The value can be in date, checkpoint, or LSN\/SCN format.
--
-- Date Example: --cdc-start-position “2018-03-08T12:12:12”
--
-- Checkpoint Example: --cdc-start-position
-- \"checkpoint:V1#27#mysql-bin-changelog.157832:1975:-1:2002:677883278264080:mysql-bin-changelog.157832:1876#0#0#*#0#93\"
--
-- LSN Example: --cdc-start-position “mysql-bin-changelog.000024:373”
--
-- When you use this task setting with a source PostgreSQL database, a
-- logical replication slot should already be created and associated with
-- the source endpoint. You can verify this by setting the @slotName@ extra
-- connection attribute to the name of this logical replication slot. For
-- more information, see
-- <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.PostgreSQL.html#CHAP_Source.PostgreSQL.ConnectionAttrib Extra Connection Attributes When Using PostgreSQL as a Source for DMS>.
--
-- 'cdcStartTime', 'startReplicationTask_cdcStartTime' - Indicates the start time for a change data capture (CDC) operation. Use
-- either CdcStartTime or CdcStartPosition to specify when you want a CDC
-- operation to start. Specifying both values results in an error.
--
-- Timestamp Example: --cdc-start-time “2018-03-08T12:12:12”
--
-- 'cdcStopPosition', 'startReplicationTask_cdcStopPosition' - Indicates when you want a change data capture (CDC) operation to stop.
-- The value can be either server time or commit time.
--
-- Server time example: --cdc-stop-position
-- “server_time:2018-02-09T12:12:12”
--
-- Commit time example: --cdc-stop-position “commit_time:
-- 2018-02-09T12:12:12 “
--
-- 'replicationTaskArn', 'startReplicationTask_replicationTaskArn' - The Amazon Resource Name (ARN) of the replication task to be started.
--
-- 'startReplicationTaskType', 'startReplicationTask_startReplicationTaskType' - The type of replication task to start.
--
-- When the migration type is @full-load@ or @full-load-and-cdc@, the only
-- valid value for the first run of the task is @start-replication@. You
-- use @reload-target@ to restart the task and @resume-processing@ to
-- resume the task.
--
-- When the migration type is @cdc@, you use @start-replication@ to start
-- or restart the task, and @resume-processing@ to resume the task.
-- @reload-target@ is not a valid value for a task with migration type of
-- @cdc@.
newStartReplicationTask ::
  -- | 'replicationTaskArn'
  Prelude.Text ->
  -- | 'startReplicationTaskType'
  StartReplicationTaskTypeValue ->
  StartReplicationTask
newStartReplicationTask :: Text -> StartReplicationTaskTypeValue -> StartReplicationTask
newStartReplicationTask
  Text
pReplicationTaskArn_
  StartReplicationTaskTypeValue
pStartReplicationTaskType_ =
    StartReplicationTask'
      { $sel:cdcStartPosition:StartReplicationTask' :: Maybe Text
cdcStartPosition =
          forall a. Maybe a
Prelude.Nothing,
        $sel:cdcStartTime:StartReplicationTask' :: Maybe POSIX
cdcStartTime = forall a. Maybe a
Prelude.Nothing,
        $sel:cdcStopPosition:StartReplicationTask' :: Maybe Text
cdcStopPosition = forall a. Maybe a
Prelude.Nothing,
        $sel:replicationTaskArn:StartReplicationTask' :: Text
replicationTaskArn = Text
pReplicationTaskArn_,
        $sel:startReplicationTaskType:StartReplicationTask' :: StartReplicationTaskTypeValue
startReplicationTaskType =
          StartReplicationTaskTypeValue
pStartReplicationTaskType_
      }

-- | Indicates when you want a change data capture (CDC) operation to start.
-- Use either CdcStartPosition or CdcStartTime to specify when you want a
-- CDC operation to start. Specifying both values results in an error.
--
-- The value can be in date, checkpoint, or LSN\/SCN format.
--
-- Date Example: --cdc-start-position “2018-03-08T12:12:12”
--
-- Checkpoint Example: --cdc-start-position
-- \"checkpoint:V1#27#mysql-bin-changelog.157832:1975:-1:2002:677883278264080:mysql-bin-changelog.157832:1876#0#0#*#0#93\"
--
-- LSN Example: --cdc-start-position “mysql-bin-changelog.000024:373”
--
-- When you use this task setting with a source PostgreSQL database, a
-- logical replication slot should already be created and associated with
-- the source endpoint. You can verify this by setting the @slotName@ extra
-- connection attribute to the name of this logical replication slot. For
-- more information, see
-- <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.PostgreSQL.html#CHAP_Source.PostgreSQL.ConnectionAttrib Extra Connection Attributes When Using PostgreSQL as a Source for DMS>.
startReplicationTask_cdcStartPosition :: Lens.Lens' StartReplicationTask (Prelude.Maybe Prelude.Text)
startReplicationTask_cdcStartPosition :: Lens' StartReplicationTask (Maybe Text)
startReplicationTask_cdcStartPosition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplicationTask' {Maybe Text
cdcStartPosition :: Maybe Text
$sel:cdcStartPosition:StartReplicationTask' :: StartReplicationTask -> Maybe Text
cdcStartPosition} -> Maybe Text
cdcStartPosition) (\s :: StartReplicationTask
s@StartReplicationTask' {} Maybe Text
a -> StartReplicationTask
s {$sel:cdcStartPosition:StartReplicationTask' :: Maybe Text
cdcStartPosition = Maybe Text
a} :: StartReplicationTask)

-- | Indicates the start time for a change data capture (CDC) operation. Use
-- either CdcStartTime or CdcStartPosition to specify when you want a CDC
-- operation to start. Specifying both values results in an error.
--
-- Timestamp Example: --cdc-start-time “2018-03-08T12:12:12”
startReplicationTask_cdcStartTime :: Lens.Lens' StartReplicationTask (Prelude.Maybe Prelude.UTCTime)
startReplicationTask_cdcStartTime :: Lens' StartReplicationTask (Maybe UTCTime)
startReplicationTask_cdcStartTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplicationTask' {Maybe POSIX
cdcStartTime :: Maybe POSIX
$sel:cdcStartTime:StartReplicationTask' :: StartReplicationTask -> Maybe POSIX
cdcStartTime} -> Maybe POSIX
cdcStartTime) (\s :: StartReplicationTask
s@StartReplicationTask' {} Maybe POSIX
a -> StartReplicationTask
s {$sel:cdcStartTime:StartReplicationTask' :: Maybe POSIX
cdcStartTime = Maybe POSIX
a} :: StartReplicationTask) 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

-- | Indicates when you want a change data capture (CDC) operation to stop.
-- The value can be either server time or commit time.
--
-- Server time example: --cdc-stop-position
-- “server_time:2018-02-09T12:12:12”
--
-- Commit time example: --cdc-stop-position “commit_time:
-- 2018-02-09T12:12:12 “
startReplicationTask_cdcStopPosition :: Lens.Lens' StartReplicationTask (Prelude.Maybe Prelude.Text)
startReplicationTask_cdcStopPosition :: Lens' StartReplicationTask (Maybe Text)
startReplicationTask_cdcStopPosition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplicationTask' {Maybe Text
cdcStopPosition :: Maybe Text
$sel:cdcStopPosition:StartReplicationTask' :: StartReplicationTask -> Maybe Text
cdcStopPosition} -> Maybe Text
cdcStopPosition) (\s :: StartReplicationTask
s@StartReplicationTask' {} Maybe Text
a -> StartReplicationTask
s {$sel:cdcStopPosition:StartReplicationTask' :: Maybe Text
cdcStopPosition = Maybe Text
a} :: StartReplicationTask)

-- | The Amazon Resource Name (ARN) of the replication task to be started.
startReplicationTask_replicationTaskArn :: Lens.Lens' StartReplicationTask Prelude.Text
startReplicationTask_replicationTaskArn :: Lens' StartReplicationTask Text
startReplicationTask_replicationTaskArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplicationTask' {Text
replicationTaskArn :: Text
$sel:replicationTaskArn:StartReplicationTask' :: StartReplicationTask -> Text
replicationTaskArn} -> Text
replicationTaskArn) (\s :: StartReplicationTask
s@StartReplicationTask' {} Text
a -> StartReplicationTask
s {$sel:replicationTaskArn:StartReplicationTask' :: Text
replicationTaskArn = Text
a} :: StartReplicationTask)

-- | The type of replication task to start.
--
-- When the migration type is @full-load@ or @full-load-and-cdc@, the only
-- valid value for the first run of the task is @start-replication@. You
-- use @reload-target@ to restart the task and @resume-processing@ to
-- resume the task.
--
-- When the migration type is @cdc@, you use @start-replication@ to start
-- or restart the task, and @resume-processing@ to resume the task.
-- @reload-target@ is not a valid value for a task with migration type of
-- @cdc@.
startReplicationTask_startReplicationTaskType :: Lens.Lens' StartReplicationTask StartReplicationTaskTypeValue
startReplicationTask_startReplicationTaskType :: Lens' StartReplicationTask StartReplicationTaskTypeValue
startReplicationTask_startReplicationTaskType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplicationTask' {StartReplicationTaskTypeValue
startReplicationTaskType :: StartReplicationTaskTypeValue
$sel:startReplicationTaskType:StartReplicationTask' :: StartReplicationTask -> StartReplicationTaskTypeValue
startReplicationTaskType} -> StartReplicationTaskTypeValue
startReplicationTaskType) (\s :: StartReplicationTask
s@StartReplicationTask' {} StartReplicationTaskTypeValue
a -> StartReplicationTask
s {$sel:startReplicationTaskType:StartReplicationTask' :: StartReplicationTaskTypeValue
startReplicationTaskType = StartReplicationTaskTypeValue
a} :: StartReplicationTask)

instance Core.AWSRequest StartReplicationTask where
  type
    AWSResponse StartReplicationTask =
      StartReplicationTaskResponse
  request :: (Service -> Service)
-> StartReplicationTask -> Request StartReplicationTask
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartReplicationTask
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartReplicationTask)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ReplicationTask -> Int -> StartReplicationTaskResponse
StartReplicationTaskResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ReplicationTask")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StartReplicationTask where
  hashWithSalt :: Int -> StartReplicationTask -> Int
hashWithSalt Int
_salt StartReplicationTask' {Maybe Text
Maybe POSIX
Text
StartReplicationTaskTypeValue
startReplicationTaskType :: StartReplicationTaskTypeValue
replicationTaskArn :: Text
cdcStopPosition :: Maybe Text
cdcStartTime :: Maybe POSIX
cdcStartPosition :: Maybe Text
$sel:startReplicationTaskType:StartReplicationTask' :: StartReplicationTask -> StartReplicationTaskTypeValue
$sel:replicationTaskArn:StartReplicationTask' :: StartReplicationTask -> Text
$sel:cdcStopPosition:StartReplicationTask' :: StartReplicationTask -> Maybe Text
$sel:cdcStartTime:StartReplicationTask' :: StartReplicationTask -> Maybe POSIX
$sel:cdcStartPosition:StartReplicationTask' :: StartReplicationTask -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cdcStartPosition
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
cdcStartTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cdcStopPosition
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
replicationTaskArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StartReplicationTaskTypeValue
startReplicationTaskType

instance Prelude.NFData StartReplicationTask where
  rnf :: StartReplicationTask -> ()
rnf StartReplicationTask' {Maybe Text
Maybe POSIX
Text
StartReplicationTaskTypeValue
startReplicationTaskType :: StartReplicationTaskTypeValue
replicationTaskArn :: Text
cdcStopPosition :: Maybe Text
cdcStartTime :: Maybe POSIX
cdcStartPosition :: Maybe Text
$sel:startReplicationTaskType:StartReplicationTask' :: StartReplicationTask -> StartReplicationTaskTypeValue
$sel:replicationTaskArn:StartReplicationTask' :: StartReplicationTask -> Text
$sel:cdcStopPosition:StartReplicationTask' :: StartReplicationTask -> Maybe Text
$sel:cdcStartTime:StartReplicationTask' :: StartReplicationTask -> Maybe POSIX
$sel:cdcStartPosition:StartReplicationTask' :: StartReplicationTask -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cdcStartPosition
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
cdcStartTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cdcStopPosition
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
replicationTaskArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StartReplicationTaskTypeValue
startReplicationTaskType

instance Data.ToHeaders StartReplicationTask where
  toHeaders :: StartReplicationTask -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonDMSv20160101.StartReplicationTask" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON StartReplicationTask where
  toJSON :: StartReplicationTask -> Value
toJSON StartReplicationTask' {Maybe Text
Maybe POSIX
Text
StartReplicationTaskTypeValue
startReplicationTaskType :: StartReplicationTaskTypeValue
replicationTaskArn :: Text
cdcStopPosition :: Maybe Text
cdcStartTime :: Maybe POSIX
cdcStartPosition :: Maybe Text
$sel:startReplicationTaskType:StartReplicationTask' :: StartReplicationTask -> StartReplicationTaskTypeValue
$sel:replicationTaskArn:StartReplicationTask' :: StartReplicationTask -> Text
$sel:cdcStopPosition:StartReplicationTask' :: StartReplicationTask -> Maybe Text
$sel:cdcStartTime:StartReplicationTask' :: StartReplicationTask -> Maybe POSIX
$sel:cdcStartPosition:StartReplicationTask' :: StartReplicationTask -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CdcStartPosition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cdcStartPosition,
            (Key
"CdcStartTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
cdcStartTime,
            (Key
"CdcStopPosition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cdcStopPosition,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ReplicationTaskArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
replicationTaskArn),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"StartReplicationTaskType"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= StartReplicationTaskTypeValue
startReplicationTaskType
              )
          ]
      )

instance Data.ToPath StartReplicationTask where
  toPath :: StartReplicationTask -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery StartReplicationTask where
  toQuery :: StartReplicationTask -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- |
--
-- /See:/ 'newStartReplicationTaskResponse' smart constructor.
data StartReplicationTaskResponse = StartReplicationTaskResponse'
  { -- | The replication task started.
    StartReplicationTaskResponse -> Maybe ReplicationTask
replicationTask :: Prelude.Maybe ReplicationTask,
    -- | The response's http status code.
    StartReplicationTaskResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartReplicationTaskResponse
-> StartReplicationTaskResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartReplicationTaskResponse
-> StartReplicationTaskResponse -> Bool
$c/= :: StartReplicationTaskResponse
-> StartReplicationTaskResponse -> Bool
== :: StartReplicationTaskResponse
-> StartReplicationTaskResponse -> Bool
$c== :: StartReplicationTaskResponse
-> StartReplicationTaskResponse -> Bool
Prelude.Eq, ReadPrec [StartReplicationTaskResponse]
ReadPrec StartReplicationTaskResponse
Int -> ReadS StartReplicationTaskResponse
ReadS [StartReplicationTaskResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartReplicationTaskResponse]
$creadListPrec :: ReadPrec [StartReplicationTaskResponse]
readPrec :: ReadPrec StartReplicationTaskResponse
$creadPrec :: ReadPrec StartReplicationTaskResponse
readList :: ReadS [StartReplicationTaskResponse]
$creadList :: ReadS [StartReplicationTaskResponse]
readsPrec :: Int -> ReadS StartReplicationTaskResponse
$creadsPrec :: Int -> ReadS StartReplicationTaskResponse
Prelude.Read, Int -> StartReplicationTaskResponse -> ShowS
[StartReplicationTaskResponse] -> ShowS
StartReplicationTaskResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartReplicationTaskResponse] -> ShowS
$cshowList :: [StartReplicationTaskResponse] -> ShowS
show :: StartReplicationTaskResponse -> String
$cshow :: StartReplicationTaskResponse -> String
showsPrec :: Int -> StartReplicationTaskResponse -> ShowS
$cshowsPrec :: Int -> StartReplicationTaskResponse -> ShowS
Prelude.Show, forall x.
Rep StartReplicationTaskResponse x -> StartReplicationTaskResponse
forall x.
StartReplicationTaskResponse -> Rep StartReplicationTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartReplicationTaskResponse x -> StartReplicationTaskResponse
$cfrom :: forall x.
StartReplicationTaskResponse -> Rep StartReplicationTaskResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartReplicationTaskResponse' 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:
--
-- 'replicationTask', 'startReplicationTaskResponse_replicationTask' - The replication task started.
--
-- 'httpStatus', 'startReplicationTaskResponse_httpStatus' - The response's http status code.
newStartReplicationTaskResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartReplicationTaskResponse
newStartReplicationTaskResponse :: Int -> StartReplicationTaskResponse
newStartReplicationTaskResponse Int
pHttpStatus_ =
  StartReplicationTaskResponse'
    { $sel:replicationTask:StartReplicationTaskResponse' :: Maybe ReplicationTask
replicationTask =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartReplicationTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The replication task started.
startReplicationTaskResponse_replicationTask :: Lens.Lens' StartReplicationTaskResponse (Prelude.Maybe ReplicationTask)
startReplicationTaskResponse_replicationTask :: Lens' StartReplicationTaskResponse (Maybe ReplicationTask)
startReplicationTaskResponse_replicationTask = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplicationTaskResponse' {Maybe ReplicationTask
replicationTask :: Maybe ReplicationTask
$sel:replicationTask:StartReplicationTaskResponse' :: StartReplicationTaskResponse -> Maybe ReplicationTask
replicationTask} -> Maybe ReplicationTask
replicationTask) (\s :: StartReplicationTaskResponse
s@StartReplicationTaskResponse' {} Maybe ReplicationTask
a -> StartReplicationTaskResponse
s {$sel:replicationTask:StartReplicationTaskResponse' :: Maybe ReplicationTask
replicationTask = Maybe ReplicationTask
a} :: StartReplicationTaskResponse)

-- | The response's http status code.
startReplicationTaskResponse_httpStatus :: Lens.Lens' StartReplicationTaskResponse Prelude.Int
startReplicationTaskResponse_httpStatus :: Lens' StartReplicationTaskResponse Int
startReplicationTaskResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartReplicationTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartReplicationTaskResponse' :: StartReplicationTaskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartReplicationTaskResponse
s@StartReplicationTaskResponse' {} Int
a -> StartReplicationTaskResponse
s {$sel:httpStatus:StartReplicationTaskResponse' :: Int
httpStatus = Int
a} :: StartReplicationTaskResponse)

instance Prelude.NFData StartReplicationTaskResponse where
  rnf :: StartReplicationTaskResponse -> ()
rnf StartReplicationTaskResponse' {Int
Maybe ReplicationTask
httpStatus :: Int
replicationTask :: Maybe ReplicationTask
$sel:httpStatus:StartReplicationTaskResponse' :: StartReplicationTaskResponse -> Int
$sel:replicationTask:StartReplicationTaskResponse' :: StartReplicationTaskResponse -> Maybe ReplicationTask
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ReplicationTask
replicationTask
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus