{-# 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.DescribeReplicationTasks
-- 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)
--
-- Returns information about replication tasks for your account in the
-- current region.
--
-- This operation returns paginated results.
module Amazonka.DMS.DescribeReplicationTasks
  ( -- * Creating a Request
    DescribeReplicationTasks (..),
    newDescribeReplicationTasks,

    -- * Request Lenses
    describeReplicationTasks_filters,
    describeReplicationTasks_withoutSettings,
    describeReplicationTasks_marker,
    describeReplicationTasks_maxRecords,

    -- * Destructuring the Response
    DescribeReplicationTasksResponse (..),
    newDescribeReplicationTasksResponse,

    -- * Response Lenses
    describeReplicationTasksResponse_replicationTasks,
    describeReplicationTasksResponse_marker,
    describeReplicationTasksResponse_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:/ 'newDescribeReplicationTasks' smart constructor.
data DescribeReplicationTasks = DescribeReplicationTasks'
  { -- | Filters applied to replication tasks.
    --
    -- Valid filter names: replication-task-arn | replication-task-id |
    -- migration-type | endpoint-arn | replication-instance-arn
    DescribeReplicationTasks -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | An option to set to avoid returning information about settings. Use this
    -- to reduce overhead when setting information is too large. To use this
    -- option, choose @true@; otherwise, choose @false@ (the default).
    DescribeReplicationTasks -> Maybe Bool
withoutSettings :: Prelude.Maybe Prelude.Bool,
    -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- marker, up to the value specified by @MaxRecords@.
    DescribeReplicationTasks -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of records to include in the response. If more
    -- records exist than the specified @MaxRecords@ value, a pagination token
    -- called a marker is included in the response so that the remaining
    -- results can be retrieved.
    --
    -- Default: 100
    --
    -- Constraints: Minimum 20, maximum 100.
    DescribeReplicationTasks -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeReplicationTasks -> DescribeReplicationTasks -> Bool
(DescribeReplicationTasks -> DescribeReplicationTasks -> Bool)
-> (DescribeReplicationTasks -> DescribeReplicationTasks -> Bool)
-> Eq DescribeReplicationTasks
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReplicationTasks -> DescribeReplicationTasks -> Bool
$c/= :: DescribeReplicationTasks -> DescribeReplicationTasks -> Bool
== :: DescribeReplicationTasks -> DescribeReplicationTasks -> Bool
$c== :: DescribeReplicationTasks -> DescribeReplicationTasks -> Bool
Prelude.Eq, ReadPrec [DescribeReplicationTasks]
ReadPrec DescribeReplicationTasks
Int -> ReadS DescribeReplicationTasks
ReadS [DescribeReplicationTasks]
(Int -> ReadS DescribeReplicationTasks)
-> ReadS [DescribeReplicationTasks]
-> ReadPrec DescribeReplicationTasks
-> ReadPrec [DescribeReplicationTasks]
-> Read DescribeReplicationTasks
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReplicationTasks]
$creadListPrec :: ReadPrec [DescribeReplicationTasks]
readPrec :: ReadPrec DescribeReplicationTasks
$creadPrec :: ReadPrec DescribeReplicationTasks
readList :: ReadS [DescribeReplicationTasks]
$creadList :: ReadS [DescribeReplicationTasks]
readsPrec :: Int -> ReadS DescribeReplicationTasks
$creadsPrec :: Int -> ReadS DescribeReplicationTasks
Prelude.Read, Int -> DescribeReplicationTasks -> ShowS
[DescribeReplicationTasks] -> ShowS
DescribeReplicationTasks -> String
(Int -> DescribeReplicationTasks -> ShowS)
-> (DescribeReplicationTasks -> String)
-> ([DescribeReplicationTasks] -> ShowS)
-> Show DescribeReplicationTasks
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReplicationTasks] -> ShowS
$cshowList :: [DescribeReplicationTasks] -> ShowS
show :: DescribeReplicationTasks -> String
$cshow :: DescribeReplicationTasks -> String
showsPrec :: Int -> DescribeReplicationTasks -> ShowS
$cshowsPrec :: Int -> DescribeReplicationTasks -> ShowS
Prelude.Show, (forall x.
 DescribeReplicationTasks -> Rep DescribeReplicationTasks x)
-> (forall x.
    Rep DescribeReplicationTasks x -> DescribeReplicationTasks)
-> Generic DescribeReplicationTasks
forall x.
Rep DescribeReplicationTasks x -> DescribeReplicationTasks
forall x.
DescribeReplicationTasks -> Rep DescribeReplicationTasks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReplicationTasks x -> DescribeReplicationTasks
$cfrom :: forall x.
DescribeReplicationTasks -> Rep DescribeReplicationTasks x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReplicationTasks' 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:
--
-- 'filters', 'describeReplicationTasks_filters' - Filters applied to replication tasks.
--
-- Valid filter names: replication-task-arn | replication-task-id |
-- migration-type | endpoint-arn | replication-instance-arn
--
-- 'withoutSettings', 'describeReplicationTasks_withoutSettings' - An option to set to avoid returning information about settings. Use this
-- to reduce overhead when setting information is too large. To use this
-- option, choose @true@; otherwise, choose @false@ (the default).
--
-- 'marker', 'describeReplicationTasks_marker' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
--
-- 'maxRecords', 'describeReplicationTasks_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- called a marker is included in the response so that the remaining
-- results can be retrieved.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 100.
newDescribeReplicationTasks ::
  DescribeReplicationTasks
newDescribeReplicationTasks :: DescribeReplicationTasks
newDescribeReplicationTasks =
  DescribeReplicationTasks' :: Maybe [Filter]
-> Maybe Bool
-> Maybe Text
-> Maybe Int
-> DescribeReplicationTasks
DescribeReplicationTasks'
    { $sel:filters:DescribeReplicationTasks' :: Maybe [Filter]
filters =
        Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:withoutSettings:DescribeReplicationTasks' :: Maybe Bool
withoutSettings = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeReplicationTasks' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeReplicationTasks' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Filters applied to replication tasks.
--
-- Valid filter names: replication-task-arn | replication-task-id |
-- migration-type | endpoint-arn | replication-instance-arn
describeReplicationTasks_filters :: Lens.Lens' DescribeReplicationTasks (Prelude.Maybe [Filter])
describeReplicationTasks_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeReplicationTasks -> f DescribeReplicationTasks
describeReplicationTasks_filters = (DescribeReplicationTasks -> Maybe [Filter])
-> (DescribeReplicationTasks
    -> Maybe [Filter] -> DescribeReplicationTasks)
-> Lens
     DescribeReplicationTasks
     DescribeReplicationTasks
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationTasks' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeReplicationTasks' :: DescribeReplicationTasks -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeReplicationTasks
s@DescribeReplicationTasks' {} Maybe [Filter]
a -> DescribeReplicationTasks
s {$sel:filters:DescribeReplicationTasks' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeReplicationTasks) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeReplicationTasks -> f DescribeReplicationTasks)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeReplicationTasks
-> f DescribeReplicationTasks
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An option to set to avoid returning information about settings. Use this
-- to reduce overhead when setting information is too large. To use this
-- option, choose @true@; otherwise, choose @false@ (the default).
describeReplicationTasks_withoutSettings :: Lens.Lens' DescribeReplicationTasks (Prelude.Maybe Prelude.Bool)
describeReplicationTasks_withoutSettings :: (Maybe Bool -> f (Maybe Bool))
-> DescribeReplicationTasks -> f DescribeReplicationTasks
describeReplicationTasks_withoutSettings = (DescribeReplicationTasks -> Maybe Bool)
-> (DescribeReplicationTasks
    -> Maybe Bool -> DescribeReplicationTasks)
-> Lens
     DescribeReplicationTasks
     DescribeReplicationTasks
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationTasks' {Maybe Bool
withoutSettings :: Maybe Bool
$sel:withoutSettings:DescribeReplicationTasks' :: DescribeReplicationTasks -> Maybe Bool
withoutSettings} -> Maybe Bool
withoutSettings) (\s :: DescribeReplicationTasks
s@DescribeReplicationTasks' {} Maybe Bool
a -> DescribeReplicationTasks
s {$sel:withoutSettings:DescribeReplicationTasks' :: Maybe Bool
withoutSettings = Maybe Bool
a} :: DescribeReplicationTasks)

-- | An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
describeReplicationTasks_marker :: Lens.Lens' DescribeReplicationTasks (Prelude.Maybe Prelude.Text)
describeReplicationTasks_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeReplicationTasks -> f DescribeReplicationTasks
describeReplicationTasks_marker = (DescribeReplicationTasks -> Maybe Text)
-> (DescribeReplicationTasks
    -> Maybe Text -> DescribeReplicationTasks)
-> Lens
     DescribeReplicationTasks
     DescribeReplicationTasks
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationTasks' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeReplicationTasks' :: DescribeReplicationTasks -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeReplicationTasks
s@DescribeReplicationTasks' {} Maybe Text
a -> DescribeReplicationTasks
s {$sel:marker:DescribeReplicationTasks' :: Maybe Text
marker = Maybe Text
a} :: DescribeReplicationTasks)

-- | The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- called a marker is included in the response so that the remaining
-- results can be retrieved.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 100.
describeReplicationTasks_maxRecords :: Lens.Lens' DescribeReplicationTasks (Prelude.Maybe Prelude.Int)
describeReplicationTasks_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeReplicationTasks -> f DescribeReplicationTasks
describeReplicationTasks_maxRecords = (DescribeReplicationTasks -> Maybe Int)
-> (DescribeReplicationTasks
    -> Maybe Int -> DescribeReplicationTasks)
-> Lens
     DescribeReplicationTasks
     DescribeReplicationTasks
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationTasks' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeReplicationTasks' :: DescribeReplicationTasks -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeReplicationTasks
s@DescribeReplicationTasks' {} Maybe Int
a -> DescribeReplicationTasks
s {$sel:maxRecords:DescribeReplicationTasks' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeReplicationTasks)

instance Core.AWSPager DescribeReplicationTasks where
  page :: DescribeReplicationTasks
-> AWSResponse DescribeReplicationTasks
-> Maybe DescribeReplicationTasks
page DescribeReplicationTasks
rq AWSResponse DescribeReplicationTasks
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeReplicationTasks
DescribeReplicationTasksResponse
rs
            DescribeReplicationTasksResponse
-> Getting (First Text) DescribeReplicationTasksResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeReplicationTasksResponse
-> Const (First Text) DescribeReplicationTasksResponse
Lens' DescribeReplicationTasksResponse (Maybe Text)
describeReplicationTasksResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeReplicationTasksResponse
 -> Const (First Text) DescribeReplicationTasksResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeReplicationTasksResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeReplicationTasks
forall a. Maybe a
Prelude.Nothing
    | Maybe [ReplicationTask] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeReplicationTasks
DescribeReplicationTasksResponse
rs
            DescribeReplicationTasksResponse
-> Getting
     (First [ReplicationTask])
     DescribeReplicationTasksResponse
     [ReplicationTask]
-> Maybe [ReplicationTask]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ReplicationTask]
 -> Const (First [ReplicationTask]) (Maybe [ReplicationTask]))
-> DescribeReplicationTasksResponse
-> Const (First [ReplicationTask]) DescribeReplicationTasksResponse
Lens' DescribeReplicationTasksResponse (Maybe [ReplicationTask])
describeReplicationTasksResponse_replicationTasks
              ((Maybe [ReplicationTask]
  -> Const (First [ReplicationTask]) (Maybe [ReplicationTask]))
 -> DescribeReplicationTasksResponse
 -> Const
      (First [ReplicationTask]) DescribeReplicationTasksResponse)
-> (([ReplicationTask]
     -> Const (First [ReplicationTask]) [ReplicationTask])
    -> Maybe [ReplicationTask]
    -> Const (First [ReplicationTask]) (Maybe [ReplicationTask]))
-> Getting
     (First [ReplicationTask])
     DescribeReplicationTasksResponse
     [ReplicationTask]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ReplicationTask]
 -> Const (First [ReplicationTask]) [ReplicationTask])
-> Maybe [ReplicationTask]
-> Const (First [ReplicationTask]) (Maybe [ReplicationTask])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeReplicationTasks
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeReplicationTasks -> Maybe DescribeReplicationTasks
forall a. a -> Maybe a
Prelude.Just (DescribeReplicationTasks -> Maybe DescribeReplicationTasks)
-> DescribeReplicationTasks -> Maybe DescribeReplicationTasks
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeReplicationTasks
rq
          DescribeReplicationTasks
-> (DescribeReplicationTasks -> DescribeReplicationTasks)
-> DescribeReplicationTasks
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeReplicationTasks -> Identity DescribeReplicationTasks
Lens
  DescribeReplicationTasks
  DescribeReplicationTasks
  (Maybe Text)
  (Maybe Text)
describeReplicationTasks_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeReplicationTasks -> Identity DescribeReplicationTasks)
-> Maybe Text
-> DescribeReplicationTasks
-> DescribeReplicationTasks
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeReplicationTasks
DescribeReplicationTasksResponse
rs
          DescribeReplicationTasksResponse
-> Getting (First Text) DescribeReplicationTasksResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeReplicationTasksResponse
-> Const (First Text) DescribeReplicationTasksResponse
Lens' DescribeReplicationTasksResponse (Maybe Text)
describeReplicationTasksResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeReplicationTasksResponse
 -> Const (First Text) DescribeReplicationTasksResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeReplicationTasksResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeReplicationTasks where
  type
    AWSResponse DescribeReplicationTasks =
      DescribeReplicationTasksResponse
  request :: DescribeReplicationTasks -> Request DescribeReplicationTasks
request = Service
-> DescribeReplicationTasks -> Request DescribeReplicationTasks
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeReplicationTasks
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeReplicationTasks)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeReplicationTasks))
-> Logger
-> Service
-> Proxy DescribeReplicationTasks
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeReplicationTasks)))
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]
-> Maybe Text -> Int -> DescribeReplicationTasksResponse
DescribeReplicationTasksResponse'
            (Maybe [ReplicationTask]
 -> Maybe Text -> Int -> DescribeReplicationTasksResponse)
-> Either String (Maybe [ReplicationTask])
-> Either
     String (Maybe Text -> Int -> DescribeReplicationTasksResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ReplicationTask]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReplicationTasks"
                            Either String (Maybe (Maybe [ReplicationTask]))
-> Maybe [ReplicationTask]
-> Either String (Maybe [ReplicationTask])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ReplicationTask]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Maybe Text -> Int -> DescribeReplicationTasksResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeReplicationTasksResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Marker")
            Either String (Int -> DescribeReplicationTasksResponse)
-> Either String Int
-> Either String DescribeReplicationTasksResponse
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 DescribeReplicationTasks

instance Prelude.NFData DescribeReplicationTasks

instance Core.ToHeaders DescribeReplicationTasks where
  toHeaders :: DescribeReplicationTasks -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeReplicationTasks -> 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.DescribeReplicationTasks" ::
                          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 DescribeReplicationTasks where
  toJSON :: DescribeReplicationTasks -> Value
toJSON DescribeReplicationTasks' {Maybe Bool
Maybe Int
Maybe [Filter]
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
withoutSettings :: Maybe Bool
filters :: Maybe [Filter]
$sel:maxRecords:DescribeReplicationTasks' :: DescribeReplicationTasks -> Maybe Int
$sel:marker:DescribeReplicationTasks' :: DescribeReplicationTasks -> Maybe Text
$sel:withoutSettings:DescribeReplicationTasks' :: DescribeReplicationTasks -> Maybe Bool
$sel:filters:DescribeReplicationTasks' :: DescribeReplicationTasks -> Maybe [Filter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (Text
"WithoutSettings" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
withoutSettings,
            (Text
"Marker" 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
marker,
            (Text
"MaxRecords" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxRecords
          ]
      )

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

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

-- |
--
-- /See:/ 'newDescribeReplicationTasksResponse' smart constructor.
data DescribeReplicationTasksResponse = DescribeReplicationTasksResponse'
  { -- | A description of the replication tasks.
    DescribeReplicationTasksResponse -> Maybe [ReplicationTask]
replicationTasks :: Prelude.Maybe [ReplicationTask],
    -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- marker, up to the value specified by @MaxRecords@.
    DescribeReplicationTasksResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeReplicationTasksResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeReplicationTasksResponse
-> DescribeReplicationTasksResponse -> Bool
(DescribeReplicationTasksResponse
 -> DescribeReplicationTasksResponse -> Bool)
-> (DescribeReplicationTasksResponse
    -> DescribeReplicationTasksResponse -> Bool)
-> Eq DescribeReplicationTasksResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReplicationTasksResponse
-> DescribeReplicationTasksResponse -> Bool
$c/= :: DescribeReplicationTasksResponse
-> DescribeReplicationTasksResponse -> Bool
== :: DescribeReplicationTasksResponse
-> DescribeReplicationTasksResponse -> Bool
$c== :: DescribeReplicationTasksResponse
-> DescribeReplicationTasksResponse -> Bool
Prelude.Eq, ReadPrec [DescribeReplicationTasksResponse]
ReadPrec DescribeReplicationTasksResponse
Int -> ReadS DescribeReplicationTasksResponse
ReadS [DescribeReplicationTasksResponse]
(Int -> ReadS DescribeReplicationTasksResponse)
-> ReadS [DescribeReplicationTasksResponse]
-> ReadPrec DescribeReplicationTasksResponse
-> ReadPrec [DescribeReplicationTasksResponse]
-> Read DescribeReplicationTasksResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReplicationTasksResponse]
$creadListPrec :: ReadPrec [DescribeReplicationTasksResponse]
readPrec :: ReadPrec DescribeReplicationTasksResponse
$creadPrec :: ReadPrec DescribeReplicationTasksResponse
readList :: ReadS [DescribeReplicationTasksResponse]
$creadList :: ReadS [DescribeReplicationTasksResponse]
readsPrec :: Int -> ReadS DescribeReplicationTasksResponse
$creadsPrec :: Int -> ReadS DescribeReplicationTasksResponse
Prelude.Read, Int -> DescribeReplicationTasksResponse -> ShowS
[DescribeReplicationTasksResponse] -> ShowS
DescribeReplicationTasksResponse -> String
(Int -> DescribeReplicationTasksResponse -> ShowS)
-> (DescribeReplicationTasksResponse -> String)
-> ([DescribeReplicationTasksResponse] -> ShowS)
-> Show DescribeReplicationTasksResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReplicationTasksResponse] -> ShowS
$cshowList :: [DescribeReplicationTasksResponse] -> ShowS
show :: DescribeReplicationTasksResponse -> String
$cshow :: DescribeReplicationTasksResponse -> String
showsPrec :: Int -> DescribeReplicationTasksResponse -> ShowS
$cshowsPrec :: Int -> DescribeReplicationTasksResponse -> ShowS
Prelude.Show, (forall x.
 DescribeReplicationTasksResponse
 -> Rep DescribeReplicationTasksResponse x)
-> (forall x.
    Rep DescribeReplicationTasksResponse x
    -> DescribeReplicationTasksResponse)
-> Generic DescribeReplicationTasksResponse
forall x.
Rep DescribeReplicationTasksResponse x
-> DescribeReplicationTasksResponse
forall x.
DescribeReplicationTasksResponse
-> Rep DescribeReplicationTasksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReplicationTasksResponse x
-> DescribeReplicationTasksResponse
$cfrom :: forall x.
DescribeReplicationTasksResponse
-> Rep DescribeReplicationTasksResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReplicationTasksResponse' 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:
--
-- 'replicationTasks', 'describeReplicationTasksResponse_replicationTasks' - A description of the replication tasks.
--
-- 'marker', 'describeReplicationTasksResponse_marker' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
--
-- 'httpStatus', 'describeReplicationTasksResponse_httpStatus' - The response's http status code.
newDescribeReplicationTasksResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeReplicationTasksResponse
newDescribeReplicationTasksResponse :: Int -> DescribeReplicationTasksResponse
newDescribeReplicationTasksResponse Int
pHttpStatus_ =
  DescribeReplicationTasksResponse' :: Maybe [ReplicationTask]
-> Maybe Text -> Int -> DescribeReplicationTasksResponse
DescribeReplicationTasksResponse'
    { $sel:replicationTasks:DescribeReplicationTasksResponse' :: Maybe [ReplicationTask]
replicationTasks =
        Maybe [ReplicationTask]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeReplicationTasksResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeReplicationTasksResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A description of the replication tasks.
describeReplicationTasksResponse_replicationTasks :: Lens.Lens' DescribeReplicationTasksResponse (Prelude.Maybe [ReplicationTask])
describeReplicationTasksResponse_replicationTasks :: (Maybe [ReplicationTask] -> f (Maybe [ReplicationTask]))
-> DescribeReplicationTasksResponse
-> f DescribeReplicationTasksResponse
describeReplicationTasksResponse_replicationTasks = (DescribeReplicationTasksResponse -> Maybe [ReplicationTask])
-> (DescribeReplicationTasksResponse
    -> Maybe [ReplicationTask] -> DescribeReplicationTasksResponse)
-> Lens' DescribeReplicationTasksResponse (Maybe [ReplicationTask])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationTasksResponse' {Maybe [ReplicationTask]
replicationTasks :: Maybe [ReplicationTask]
$sel:replicationTasks:DescribeReplicationTasksResponse' :: DescribeReplicationTasksResponse -> Maybe [ReplicationTask]
replicationTasks} -> Maybe [ReplicationTask]
replicationTasks) (\s :: DescribeReplicationTasksResponse
s@DescribeReplicationTasksResponse' {} Maybe [ReplicationTask]
a -> DescribeReplicationTasksResponse
s {$sel:replicationTasks:DescribeReplicationTasksResponse' :: Maybe [ReplicationTask]
replicationTasks = Maybe [ReplicationTask]
a} :: DescribeReplicationTasksResponse) ((Maybe [ReplicationTask] -> f (Maybe [ReplicationTask]))
 -> DescribeReplicationTasksResponse
 -> f DescribeReplicationTasksResponse)
-> ((Maybe [ReplicationTask] -> f (Maybe [ReplicationTask]))
    -> Maybe [ReplicationTask] -> f (Maybe [ReplicationTask]))
-> (Maybe [ReplicationTask] -> f (Maybe [ReplicationTask]))
-> DescribeReplicationTasksResponse
-> f DescribeReplicationTasksResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReplicationTask]
  [ReplicationTask]
  [ReplicationTask]
  [ReplicationTask]
-> Iso
     (Maybe [ReplicationTask])
     (Maybe [ReplicationTask])
     (Maybe [ReplicationTask])
     (Maybe [ReplicationTask])
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
  [ReplicationTask]
  [ReplicationTask]
  [ReplicationTask]
  [ReplicationTask]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
describeReplicationTasksResponse_marker :: Lens.Lens' DescribeReplicationTasksResponse (Prelude.Maybe Prelude.Text)
describeReplicationTasksResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeReplicationTasksResponse
-> f DescribeReplicationTasksResponse
describeReplicationTasksResponse_marker = (DescribeReplicationTasksResponse -> Maybe Text)
-> (DescribeReplicationTasksResponse
    -> Maybe Text -> DescribeReplicationTasksResponse)
-> Lens' DescribeReplicationTasksResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationTasksResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeReplicationTasksResponse' :: DescribeReplicationTasksResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeReplicationTasksResponse
s@DescribeReplicationTasksResponse' {} Maybe Text
a -> DescribeReplicationTasksResponse
s {$sel:marker:DescribeReplicationTasksResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeReplicationTasksResponse)

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

instance
  Prelude.NFData
    DescribeReplicationTasksResponse