{-# 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-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)
--
-- 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_cdcStopPosition,
    startReplicationTask_cdcStartTime,
    startReplicationTask_replicationTaskArn,
    startReplicationTask_startReplicationTaskType,

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

    -- * Response Lenses
    startReplicationTaskResponse_replicationTask,
    startReplicationTaskResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DMS.Types
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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 Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the replication task to be started.
    StartReplicationTask -> Text
replicationTaskArn :: Prelude.Text,
    -- | A type of replication task.
    StartReplicationTask -> StartReplicationTaskTypeValue
startReplicationTaskType :: StartReplicationTaskTypeValue
  }
  deriving (StartReplicationTask -> StartReplicationTask -> Bool
(StartReplicationTask -> StartReplicationTask -> Bool)
-> (StartReplicationTask -> StartReplicationTask -> Bool)
-> Eq StartReplicationTask
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]
(Int -> ReadS StartReplicationTask)
-> ReadS [StartReplicationTask]
-> ReadPrec StartReplicationTask
-> ReadPrec [StartReplicationTask]
-> Read 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
(Int -> StartReplicationTask -> ShowS)
-> (StartReplicationTask -> String)
-> ([StartReplicationTask] -> ShowS)
-> Show StartReplicationTask
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. StartReplicationTask -> Rep StartReplicationTask x)
-> (forall x. Rep StartReplicationTask x -> StartReplicationTask)
-> Generic StartReplicationTask
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>.
--
-- '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 “
--
-- '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”
--
-- 'replicationTaskArn', 'startReplicationTask_replicationTaskArn' - The Amazon Resource Name (ARN) of the replication task to be started.
--
-- 'startReplicationTaskType', 'startReplicationTask_startReplicationTaskType' - A type of replication task.
newStartReplicationTask ::
  -- | 'replicationTaskArn'
  Prelude.Text ->
  -- | 'startReplicationTaskType'
  StartReplicationTaskTypeValue ->
  StartReplicationTask
newStartReplicationTask :: Text -> StartReplicationTaskTypeValue -> StartReplicationTask
newStartReplicationTask
  Text
pReplicationTaskArn_
  StartReplicationTaskTypeValue
pStartReplicationTaskType_ =
    StartReplicationTask' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Text
-> StartReplicationTaskTypeValue
-> StartReplicationTask
StartReplicationTask'
      { $sel:cdcStartPosition:StartReplicationTask' :: Maybe Text
cdcStartPosition =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:cdcStopPosition:StartReplicationTask' :: Maybe Text
cdcStopPosition = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:cdcStartTime:StartReplicationTask' :: Maybe POSIX
cdcStartTime = Maybe POSIX
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 :: (Maybe Text -> f (Maybe Text))
-> StartReplicationTask -> f StartReplicationTask
startReplicationTask_cdcStartPosition = (StartReplicationTask -> Maybe Text)
-> (StartReplicationTask -> Maybe Text -> StartReplicationTask)
-> Lens
     StartReplicationTask StartReplicationTask (Maybe Text) (Maybe Text)
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 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 :: (Maybe Text -> f (Maybe Text))
-> StartReplicationTask -> f StartReplicationTask
startReplicationTask_cdcStopPosition = (StartReplicationTask -> Maybe Text)
-> (StartReplicationTask -> Maybe Text -> StartReplicationTask)
-> Lens
     StartReplicationTask StartReplicationTask (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StartReplicationTask -> f StartReplicationTask
startReplicationTask_cdcStartTime = (StartReplicationTask -> Maybe POSIX)
-> (StartReplicationTask -> Maybe POSIX -> StartReplicationTask)
-> Lens
     StartReplicationTask
     StartReplicationTask
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> StartReplicationTask -> f StartReplicationTask)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StartReplicationTask
-> f StartReplicationTask
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

-- | The Amazon Resource Name (ARN) of the replication task to be started.
startReplicationTask_replicationTaskArn :: Lens.Lens' StartReplicationTask Prelude.Text
startReplicationTask_replicationTaskArn :: (Text -> f Text) -> StartReplicationTask -> f StartReplicationTask
startReplicationTask_replicationTaskArn = (StartReplicationTask -> Text)
-> (StartReplicationTask -> Text -> StartReplicationTask)
-> Lens StartReplicationTask StartReplicationTask Text Text
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)

-- | A type of replication task.
startReplicationTask_startReplicationTaskType :: Lens.Lens' StartReplicationTask StartReplicationTaskTypeValue
startReplicationTask_startReplicationTaskType :: (StartReplicationTaskTypeValue -> f StartReplicationTaskTypeValue)
-> StartReplicationTask -> f StartReplicationTask
startReplicationTask_startReplicationTaskType = (StartReplicationTask -> StartReplicationTaskTypeValue)
-> (StartReplicationTask
    -> StartReplicationTaskTypeValue -> StartReplicationTask)
-> Lens
     StartReplicationTask
     StartReplicationTask
     StartReplicationTaskTypeValue
     StartReplicationTaskTypeValue
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 :: StartReplicationTask -> Request StartReplicationTask
request = Service -> StartReplicationTask -> Request StartReplicationTask
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartReplicationTask
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartReplicationTask)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartReplicationTask))
-> Logger
-> Service
-> Proxy StartReplicationTask
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartReplicationTask)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ReplicationTask -> Int -> StartReplicationTaskResponse
StartReplicationTaskResponse'
            (Maybe ReplicationTask -> Int -> StartReplicationTaskResponse)
-> Either String (Maybe ReplicationTask)
-> Either String (Int -> StartReplicationTaskResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ReplicationTask)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReplicationTask")
            Either String (Int -> StartReplicationTaskResponse)
-> Either String Int -> Either String StartReplicationTaskResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StartReplicationTask

instance Prelude.NFData StartReplicationTask

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

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

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

instance Core.ToQuery StartReplicationTask where
  toQuery :: StartReplicationTask -> QueryString
toQuery = QueryString -> StartReplicationTask -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(StartReplicationTaskResponse
 -> StartReplicationTaskResponse -> Bool)
-> (StartReplicationTaskResponse
    -> StartReplicationTaskResponse -> Bool)
-> Eq StartReplicationTaskResponse
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]
(Int -> ReadS StartReplicationTaskResponse)
-> ReadS [StartReplicationTaskResponse]
-> ReadPrec StartReplicationTaskResponse
-> ReadPrec [StartReplicationTaskResponse]
-> Read 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
(Int -> StartReplicationTaskResponse -> ShowS)
-> (StartReplicationTaskResponse -> String)
-> ([StartReplicationTaskResponse] -> ShowS)
-> Show StartReplicationTaskResponse
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.
 StartReplicationTaskResponse -> Rep StartReplicationTaskResponse x)
-> (forall x.
    Rep StartReplicationTaskResponse x -> StartReplicationTaskResponse)
-> Generic StartReplicationTaskResponse
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' :: Maybe ReplicationTask -> Int -> StartReplicationTaskResponse
StartReplicationTaskResponse'
    { $sel:replicationTask:StartReplicationTaskResponse' :: Maybe ReplicationTask
replicationTask =
        Maybe 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 :: (Maybe ReplicationTask -> f (Maybe ReplicationTask))
-> StartReplicationTaskResponse -> f StartReplicationTaskResponse
startReplicationTaskResponse_replicationTask = (StartReplicationTaskResponse -> Maybe ReplicationTask)
-> (StartReplicationTaskResponse
    -> Maybe ReplicationTask -> StartReplicationTaskResponse)
-> Lens
     StartReplicationTaskResponse
     StartReplicationTaskResponse
     (Maybe ReplicationTask)
     (Maybe 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 :: (Int -> f Int)
-> StartReplicationTaskResponse -> f StartReplicationTaskResponse
startReplicationTaskResponse_httpStatus = (StartReplicationTaskResponse -> Int)
-> (StartReplicationTaskResponse
    -> Int -> StartReplicationTaskResponse)
-> Lens
     StartReplicationTaskResponse StartReplicationTaskResponse Int Int
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