{-# 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.ModifyReplicationTask
-- 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)
--
-- Modifies the specified replication task.
--
-- You can\'t modify the task endpoints. The task must be stopped before
-- you can modify it.
--
-- 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.ModifyReplicationTask
  ( -- * Creating a Request
    ModifyReplicationTask (..),
    newModifyReplicationTask,

    -- * Request Lenses
    modifyReplicationTask_replicationTaskSettings,
    modifyReplicationTask_replicationTaskIdentifier,
    modifyReplicationTask_cdcStartPosition,
    modifyReplicationTask_tableMappings,
    modifyReplicationTask_migrationType,
    modifyReplicationTask_taskData,
    modifyReplicationTask_cdcStopPosition,
    modifyReplicationTask_cdcStartTime,
    modifyReplicationTask_replicationTaskArn,

    -- * Destructuring the Response
    ModifyReplicationTaskResponse (..),
    newModifyReplicationTaskResponse,

    -- * Response Lenses
    modifyReplicationTaskResponse_replicationTask,
    modifyReplicationTaskResponse_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:/ 'newModifyReplicationTask' smart constructor.
data ModifyReplicationTask = ModifyReplicationTask'
  { -- | JSON file that contains settings for the task, such as task metadata
    -- settings.
    ModifyReplicationTask -> Maybe Text
replicationTaskSettings :: Prelude.Maybe Prelude.Text,
    -- | The replication task identifier.
    --
    -- Constraints:
    --
    -- -   Must contain 1-255 alphanumeric characters or hyphens.
    --
    -- -   First character must be a letter.
    --
    -- -   Cannot end with a hyphen or contain two consecutive hyphens.
    ModifyReplicationTask -> Maybe Text
replicationTaskIdentifier :: Prelude.Maybe Prelude.Text,
    -- | 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>.
    ModifyReplicationTask -> Maybe Text
cdcStartPosition :: Prelude.Maybe Prelude.Text,
    -- | When using the CLI or boto3, provide the path of the JSON file that
    -- contains the table mappings. Precede the path with @file:\/\/@. For
    -- example, @--table-mappings file:\/\/mappingfile.json@. When working with
    -- the DMS API, provide the JSON as the parameter value.
    ModifyReplicationTask -> Maybe Text
tableMappings :: Prelude.Maybe Prelude.Text,
    -- | The migration type. Valid values: @full-load@ | @cdc@ |
    -- @full-load-and-cdc@
    ModifyReplicationTask -> Maybe MigrationTypeValue
migrationType :: Prelude.Maybe MigrationTypeValue,
    -- | Supplemental information that the task requires to migrate the data for
    -- certain source and target endpoints. For more information, see
    -- <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.TaskData.html Specifying Supplemental Data for Task Settings>
    -- in the /Database Migration Service User Guide./
    ModifyReplicationTask -> Maybe Text
taskData :: 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 “
    ModifyReplicationTask -> 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”
    ModifyReplicationTask -> Maybe POSIX
cdcStartTime :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the replication task.
    ModifyReplicationTask -> Text
replicationTaskArn :: Prelude.Text
  }
  deriving (ModifyReplicationTask -> ModifyReplicationTask -> Bool
(ModifyReplicationTask -> ModifyReplicationTask -> Bool)
-> (ModifyReplicationTask -> ModifyReplicationTask -> Bool)
-> Eq ModifyReplicationTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyReplicationTask -> ModifyReplicationTask -> Bool
$c/= :: ModifyReplicationTask -> ModifyReplicationTask -> Bool
== :: ModifyReplicationTask -> ModifyReplicationTask -> Bool
$c== :: ModifyReplicationTask -> ModifyReplicationTask -> Bool
Prelude.Eq, ReadPrec [ModifyReplicationTask]
ReadPrec ModifyReplicationTask
Int -> ReadS ModifyReplicationTask
ReadS [ModifyReplicationTask]
(Int -> ReadS ModifyReplicationTask)
-> ReadS [ModifyReplicationTask]
-> ReadPrec ModifyReplicationTask
-> ReadPrec [ModifyReplicationTask]
-> Read ModifyReplicationTask
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyReplicationTask]
$creadListPrec :: ReadPrec [ModifyReplicationTask]
readPrec :: ReadPrec ModifyReplicationTask
$creadPrec :: ReadPrec ModifyReplicationTask
readList :: ReadS [ModifyReplicationTask]
$creadList :: ReadS [ModifyReplicationTask]
readsPrec :: Int -> ReadS ModifyReplicationTask
$creadsPrec :: Int -> ReadS ModifyReplicationTask
Prelude.Read, Int -> ModifyReplicationTask -> ShowS
[ModifyReplicationTask] -> ShowS
ModifyReplicationTask -> String
(Int -> ModifyReplicationTask -> ShowS)
-> (ModifyReplicationTask -> String)
-> ([ModifyReplicationTask] -> ShowS)
-> Show ModifyReplicationTask
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyReplicationTask] -> ShowS
$cshowList :: [ModifyReplicationTask] -> ShowS
show :: ModifyReplicationTask -> String
$cshow :: ModifyReplicationTask -> String
showsPrec :: Int -> ModifyReplicationTask -> ShowS
$cshowsPrec :: Int -> ModifyReplicationTask -> ShowS
Prelude.Show, (forall x. ModifyReplicationTask -> Rep ModifyReplicationTask x)
-> (forall x. Rep ModifyReplicationTask x -> ModifyReplicationTask)
-> Generic ModifyReplicationTask
forall x. Rep ModifyReplicationTask x -> ModifyReplicationTask
forall x. ModifyReplicationTask -> Rep ModifyReplicationTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyReplicationTask x -> ModifyReplicationTask
$cfrom :: forall x. ModifyReplicationTask -> Rep ModifyReplicationTask x
Prelude.Generic)

-- |
-- Create a value of 'ModifyReplicationTask' 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:
--
-- 'replicationTaskSettings', 'modifyReplicationTask_replicationTaskSettings' - JSON file that contains settings for the task, such as task metadata
-- settings.
--
-- 'replicationTaskIdentifier', 'modifyReplicationTask_replicationTaskIdentifier' - The replication task identifier.
--
-- Constraints:
--
-- -   Must contain 1-255 alphanumeric characters or hyphens.
--
-- -   First character must be a letter.
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens.
--
-- 'cdcStartPosition', 'modifyReplicationTask_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>.
--
-- 'tableMappings', 'modifyReplicationTask_tableMappings' - When using the CLI or boto3, provide the path of the JSON file that
-- contains the table mappings. Precede the path with @file:\/\/@. For
-- example, @--table-mappings file:\/\/mappingfile.json@. When working with
-- the DMS API, provide the JSON as the parameter value.
--
-- 'migrationType', 'modifyReplicationTask_migrationType' - The migration type. Valid values: @full-load@ | @cdc@ |
-- @full-load-and-cdc@
--
-- 'taskData', 'modifyReplicationTask_taskData' - Supplemental information that the task requires to migrate the data for
-- certain source and target endpoints. For more information, see
-- <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.TaskData.html Specifying Supplemental Data for Task Settings>
-- in the /Database Migration Service User Guide./
--
-- 'cdcStopPosition', 'modifyReplicationTask_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', 'modifyReplicationTask_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', 'modifyReplicationTask_replicationTaskArn' - The Amazon Resource Name (ARN) of the replication task.
newModifyReplicationTask ::
  -- | 'replicationTaskArn'
  Prelude.Text ->
  ModifyReplicationTask
newModifyReplicationTask :: Text -> ModifyReplicationTask
newModifyReplicationTask Text
pReplicationTaskArn_ =
  ModifyReplicationTask' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MigrationTypeValue
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Text
-> ModifyReplicationTask
ModifyReplicationTask'
    { $sel:replicationTaskSettings:ModifyReplicationTask' :: Maybe Text
replicationTaskSettings =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:replicationTaskIdentifier:ModifyReplicationTask' :: Maybe Text
replicationTaskIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cdcStartPosition:ModifyReplicationTask' :: Maybe Text
cdcStartPosition = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tableMappings:ModifyReplicationTask' :: Maybe Text
tableMappings = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:migrationType:ModifyReplicationTask' :: Maybe MigrationTypeValue
migrationType = Maybe MigrationTypeValue
forall a. Maybe a
Prelude.Nothing,
      $sel:taskData:ModifyReplicationTask' :: Maybe Text
taskData = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cdcStopPosition:ModifyReplicationTask' :: Maybe Text
cdcStopPosition = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cdcStartTime:ModifyReplicationTask' :: Maybe POSIX
cdcStartTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:replicationTaskArn:ModifyReplicationTask' :: Text
replicationTaskArn = Text
pReplicationTaskArn_
    }

-- | JSON file that contains settings for the task, such as task metadata
-- settings.
modifyReplicationTask_replicationTaskSettings :: Lens.Lens' ModifyReplicationTask (Prelude.Maybe Prelude.Text)
modifyReplicationTask_replicationTaskSettings :: (Maybe Text -> f (Maybe Text))
-> ModifyReplicationTask -> f ModifyReplicationTask
modifyReplicationTask_replicationTaskSettings = (ModifyReplicationTask -> Maybe Text)
-> (ModifyReplicationTask -> Maybe Text -> ModifyReplicationTask)
-> Lens
     ModifyReplicationTask
     ModifyReplicationTask
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationTask' {Maybe Text
replicationTaskSettings :: Maybe Text
$sel:replicationTaskSettings:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
replicationTaskSettings} -> Maybe Text
replicationTaskSettings) (\s :: ModifyReplicationTask
s@ModifyReplicationTask' {} Maybe Text
a -> ModifyReplicationTask
s {$sel:replicationTaskSettings:ModifyReplicationTask' :: Maybe Text
replicationTaskSettings = Maybe Text
a} :: ModifyReplicationTask)

-- | The replication task identifier.
--
-- Constraints:
--
-- -   Must contain 1-255 alphanumeric characters or hyphens.
--
-- -   First character must be a letter.
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens.
modifyReplicationTask_replicationTaskIdentifier :: Lens.Lens' ModifyReplicationTask (Prelude.Maybe Prelude.Text)
modifyReplicationTask_replicationTaskIdentifier :: (Maybe Text -> f (Maybe Text))
-> ModifyReplicationTask -> f ModifyReplicationTask
modifyReplicationTask_replicationTaskIdentifier = (ModifyReplicationTask -> Maybe Text)
-> (ModifyReplicationTask -> Maybe Text -> ModifyReplicationTask)
-> Lens
     ModifyReplicationTask
     ModifyReplicationTask
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationTask' {Maybe Text
replicationTaskIdentifier :: Maybe Text
$sel:replicationTaskIdentifier:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
replicationTaskIdentifier} -> Maybe Text
replicationTaskIdentifier) (\s :: ModifyReplicationTask
s@ModifyReplicationTask' {} Maybe Text
a -> ModifyReplicationTask
s {$sel:replicationTaskIdentifier:ModifyReplicationTask' :: Maybe Text
replicationTaskIdentifier = Maybe Text
a} :: ModifyReplicationTask)

-- | 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>.
modifyReplicationTask_cdcStartPosition :: Lens.Lens' ModifyReplicationTask (Prelude.Maybe Prelude.Text)
modifyReplicationTask_cdcStartPosition :: (Maybe Text -> f (Maybe Text))
-> ModifyReplicationTask -> f ModifyReplicationTask
modifyReplicationTask_cdcStartPosition = (ModifyReplicationTask -> Maybe Text)
-> (ModifyReplicationTask -> Maybe Text -> ModifyReplicationTask)
-> Lens
     ModifyReplicationTask
     ModifyReplicationTask
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationTask' {Maybe Text
cdcStartPosition :: Maybe Text
$sel:cdcStartPosition:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
cdcStartPosition} -> Maybe Text
cdcStartPosition) (\s :: ModifyReplicationTask
s@ModifyReplicationTask' {} Maybe Text
a -> ModifyReplicationTask
s {$sel:cdcStartPosition:ModifyReplicationTask' :: Maybe Text
cdcStartPosition = Maybe Text
a} :: ModifyReplicationTask)

-- | When using the CLI or boto3, provide the path of the JSON file that
-- contains the table mappings. Precede the path with @file:\/\/@. For
-- example, @--table-mappings file:\/\/mappingfile.json@. When working with
-- the DMS API, provide the JSON as the parameter value.
modifyReplicationTask_tableMappings :: Lens.Lens' ModifyReplicationTask (Prelude.Maybe Prelude.Text)
modifyReplicationTask_tableMappings :: (Maybe Text -> f (Maybe Text))
-> ModifyReplicationTask -> f ModifyReplicationTask
modifyReplicationTask_tableMappings = (ModifyReplicationTask -> Maybe Text)
-> (ModifyReplicationTask -> Maybe Text -> ModifyReplicationTask)
-> Lens
     ModifyReplicationTask
     ModifyReplicationTask
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationTask' {Maybe Text
tableMappings :: Maybe Text
$sel:tableMappings:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
tableMappings} -> Maybe Text
tableMappings) (\s :: ModifyReplicationTask
s@ModifyReplicationTask' {} Maybe Text
a -> ModifyReplicationTask
s {$sel:tableMappings:ModifyReplicationTask' :: Maybe Text
tableMappings = Maybe Text
a} :: ModifyReplicationTask)

-- | The migration type. Valid values: @full-load@ | @cdc@ |
-- @full-load-and-cdc@
modifyReplicationTask_migrationType :: Lens.Lens' ModifyReplicationTask (Prelude.Maybe MigrationTypeValue)
modifyReplicationTask_migrationType :: (Maybe MigrationTypeValue -> f (Maybe MigrationTypeValue))
-> ModifyReplicationTask -> f ModifyReplicationTask
modifyReplicationTask_migrationType = (ModifyReplicationTask -> Maybe MigrationTypeValue)
-> (ModifyReplicationTask
    -> Maybe MigrationTypeValue -> ModifyReplicationTask)
-> Lens
     ModifyReplicationTask
     ModifyReplicationTask
     (Maybe MigrationTypeValue)
     (Maybe MigrationTypeValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationTask' {Maybe MigrationTypeValue
migrationType :: Maybe MigrationTypeValue
$sel:migrationType:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe MigrationTypeValue
migrationType} -> Maybe MigrationTypeValue
migrationType) (\s :: ModifyReplicationTask
s@ModifyReplicationTask' {} Maybe MigrationTypeValue
a -> ModifyReplicationTask
s {$sel:migrationType:ModifyReplicationTask' :: Maybe MigrationTypeValue
migrationType = Maybe MigrationTypeValue
a} :: ModifyReplicationTask)

-- | Supplemental information that the task requires to migrate the data for
-- certain source and target endpoints. For more information, see
-- <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.TaskData.html Specifying Supplemental Data for Task Settings>
-- in the /Database Migration Service User Guide./
modifyReplicationTask_taskData :: Lens.Lens' ModifyReplicationTask (Prelude.Maybe Prelude.Text)
modifyReplicationTask_taskData :: (Maybe Text -> f (Maybe Text))
-> ModifyReplicationTask -> f ModifyReplicationTask
modifyReplicationTask_taskData = (ModifyReplicationTask -> Maybe Text)
-> (ModifyReplicationTask -> Maybe Text -> ModifyReplicationTask)
-> Lens
     ModifyReplicationTask
     ModifyReplicationTask
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationTask' {Maybe Text
taskData :: Maybe Text
$sel:taskData:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
taskData} -> Maybe Text
taskData) (\s :: ModifyReplicationTask
s@ModifyReplicationTask' {} Maybe Text
a -> ModifyReplicationTask
s {$sel:taskData:ModifyReplicationTask' :: Maybe Text
taskData = Maybe Text
a} :: ModifyReplicationTask)

-- | 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 “
modifyReplicationTask_cdcStopPosition :: Lens.Lens' ModifyReplicationTask (Prelude.Maybe Prelude.Text)
modifyReplicationTask_cdcStopPosition :: (Maybe Text -> f (Maybe Text))
-> ModifyReplicationTask -> f ModifyReplicationTask
modifyReplicationTask_cdcStopPosition = (ModifyReplicationTask -> Maybe Text)
-> (ModifyReplicationTask -> Maybe Text -> ModifyReplicationTask)
-> Lens
     ModifyReplicationTask
     ModifyReplicationTask
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationTask' {Maybe Text
cdcStopPosition :: Maybe Text
$sel:cdcStopPosition:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
cdcStopPosition} -> Maybe Text
cdcStopPosition) (\s :: ModifyReplicationTask
s@ModifyReplicationTask' {} Maybe Text
a -> ModifyReplicationTask
s {$sel:cdcStopPosition:ModifyReplicationTask' :: Maybe Text
cdcStopPosition = Maybe Text
a} :: ModifyReplicationTask)

-- | 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”
modifyReplicationTask_cdcStartTime :: Lens.Lens' ModifyReplicationTask (Prelude.Maybe Prelude.UTCTime)
modifyReplicationTask_cdcStartTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ModifyReplicationTask -> f ModifyReplicationTask
modifyReplicationTask_cdcStartTime = (ModifyReplicationTask -> Maybe POSIX)
-> (ModifyReplicationTask -> Maybe POSIX -> ModifyReplicationTask)
-> Lens
     ModifyReplicationTask
     ModifyReplicationTask
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationTask' {Maybe POSIX
cdcStartTime :: Maybe POSIX
$sel:cdcStartTime:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe POSIX
cdcStartTime} -> Maybe POSIX
cdcStartTime) (\s :: ModifyReplicationTask
s@ModifyReplicationTask' {} Maybe POSIX
a -> ModifyReplicationTask
s {$sel:cdcStartTime:ModifyReplicationTask' :: Maybe POSIX
cdcStartTime = Maybe POSIX
a} :: ModifyReplicationTask) ((Maybe POSIX -> f (Maybe POSIX))
 -> ModifyReplicationTask -> f ModifyReplicationTask)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ModifyReplicationTask
-> f ModifyReplicationTask
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.
modifyReplicationTask_replicationTaskArn :: Lens.Lens' ModifyReplicationTask Prelude.Text
modifyReplicationTask_replicationTaskArn :: (Text -> f Text)
-> ModifyReplicationTask -> f ModifyReplicationTask
modifyReplicationTask_replicationTaskArn = (ModifyReplicationTask -> Text)
-> (ModifyReplicationTask -> Text -> ModifyReplicationTask)
-> Lens ModifyReplicationTask ModifyReplicationTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationTask' {Text
replicationTaskArn :: Text
$sel:replicationTaskArn:ModifyReplicationTask' :: ModifyReplicationTask -> Text
replicationTaskArn} -> Text
replicationTaskArn) (\s :: ModifyReplicationTask
s@ModifyReplicationTask' {} Text
a -> ModifyReplicationTask
s {$sel:replicationTaskArn:ModifyReplicationTask' :: Text
replicationTaskArn = Text
a} :: ModifyReplicationTask)

instance Core.AWSRequest ModifyReplicationTask where
  type
    AWSResponse ModifyReplicationTask =
      ModifyReplicationTaskResponse
  request :: ModifyReplicationTask -> Request ModifyReplicationTask
request = Service -> ModifyReplicationTask -> Request ModifyReplicationTask
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ModifyReplicationTask
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyReplicationTask)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ModifyReplicationTask))
-> Logger
-> Service
-> Proxy ModifyReplicationTask
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyReplicationTask)))
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 -> ModifyReplicationTaskResponse
ModifyReplicationTaskResponse'
            (Maybe ReplicationTask -> Int -> ModifyReplicationTaskResponse)
-> Either String (Maybe ReplicationTask)
-> Either String (Int -> ModifyReplicationTaskResponse)
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 -> ModifyReplicationTaskResponse)
-> Either String Int -> Either String ModifyReplicationTaskResponse
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 ModifyReplicationTask

instance Prelude.NFData ModifyReplicationTask

instance Core.ToHeaders ModifyReplicationTask where
  toHeaders :: ModifyReplicationTask -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ModifyReplicationTask -> 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.ModifyReplicationTask" ::
                          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 ModifyReplicationTask where
  toJSON :: ModifyReplicationTask -> Value
toJSON ModifyReplicationTask' {Maybe Text
Maybe POSIX
Maybe MigrationTypeValue
Text
replicationTaskArn :: Text
cdcStartTime :: Maybe POSIX
cdcStopPosition :: Maybe Text
taskData :: Maybe Text
migrationType :: Maybe MigrationTypeValue
tableMappings :: Maybe Text
cdcStartPosition :: Maybe Text
replicationTaskIdentifier :: Maybe Text
replicationTaskSettings :: Maybe Text
$sel:replicationTaskArn:ModifyReplicationTask' :: ModifyReplicationTask -> Text
$sel:cdcStartTime:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe POSIX
$sel:cdcStopPosition:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
$sel:taskData:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
$sel:migrationType:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe MigrationTypeValue
$sel:tableMappings:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
$sel:cdcStartPosition:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
$sel:replicationTaskIdentifier:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
$sel:replicationTaskSettings:ModifyReplicationTask' :: ModifyReplicationTask -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ReplicationTaskSettings" 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
replicationTaskSettings,
            (Text
"ReplicationTaskIdentifier" 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
replicationTaskIdentifier,
            (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
"TableMappings" 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
tableMappings,
            (Text
"MigrationType" Text -> MigrationTypeValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MigrationTypeValue -> Pair)
-> Maybe MigrationTypeValue -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MigrationTypeValue
migrationType,
            (Text
"TaskData" 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
taskData,
            (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)
          ]
      )

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

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

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

-- |
-- Create a value of 'ModifyReplicationTaskResponse' 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', 'modifyReplicationTaskResponse_replicationTask' - The replication task that was modified.
--
-- 'httpStatus', 'modifyReplicationTaskResponse_httpStatus' - The response's http status code.
newModifyReplicationTaskResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ModifyReplicationTaskResponse
newModifyReplicationTaskResponse :: Int -> ModifyReplicationTaskResponse
newModifyReplicationTaskResponse Int
pHttpStatus_ =
  ModifyReplicationTaskResponse' :: Maybe ReplicationTask -> Int -> ModifyReplicationTaskResponse
ModifyReplicationTaskResponse'
    { $sel:replicationTask:ModifyReplicationTaskResponse' :: Maybe ReplicationTask
replicationTask =
        Maybe ReplicationTask
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ModifyReplicationTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The replication task that was modified.
modifyReplicationTaskResponse_replicationTask :: Lens.Lens' ModifyReplicationTaskResponse (Prelude.Maybe ReplicationTask)
modifyReplicationTaskResponse_replicationTask :: (Maybe ReplicationTask -> f (Maybe ReplicationTask))
-> ModifyReplicationTaskResponse -> f ModifyReplicationTaskResponse
modifyReplicationTaskResponse_replicationTask = (ModifyReplicationTaskResponse -> Maybe ReplicationTask)
-> (ModifyReplicationTaskResponse
    -> Maybe ReplicationTask -> ModifyReplicationTaskResponse)
-> Lens
     ModifyReplicationTaskResponse
     ModifyReplicationTaskResponse
     (Maybe ReplicationTask)
     (Maybe ReplicationTask)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationTaskResponse' {Maybe ReplicationTask
replicationTask :: Maybe ReplicationTask
$sel:replicationTask:ModifyReplicationTaskResponse' :: ModifyReplicationTaskResponse -> Maybe ReplicationTask
replicationTask} -> Maybe ReplicationTask
replicationTask) (\s :: ModifyReplicationTaskResponse
s@ModifyReplicationTaskResponse' {} Maybe ReplicationTask
a -> ModifyReplicationTaskResponse
s {$sel:replicationTask:ModifyReplicationTaskResponse' :: Maybe ReplicationTask
replicationTask = Maybe ReplicationTask
a} :: ModifyReplicationTaskResponse)

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

instance Prelude.NFData ModifyReplicationTaskResponse