{-# 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.DescribeReplicationInstances
-- 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 instances for your account in the
-- current region.
--
-- This operation returns paginated results.
module Amazonka.DMS.DescribeReplicationInstances
  ( -- * Creating a Request
    DescribeReplicationInstances (..),
    newDescribeReplicationInstances,

    -- * Request Lenses
    describeReplicationInstances_filters,
    describeReplicationInstances_marker,
    describeReplicationInstances_maxRecords,

    -- * Destructuring the Response
    DescribeReplicationInstancesResponse (..),
    newDescribeReplicationInstancesResponse,

    -- * Response Lenses
    describeReplicationInstancesResponse_marker,
    describeReplicationInstancesResponse_replicationInstances,
    describeReplicationInstancesResponse_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:/ 'newDescribeReplicationInstances' smart constructor.
data DescribeReplicationInstances = DescribeReplicationInstances'
  { -- | Filters applied to replication instances.
    --
    -- Valid filter names: replication-instance-arn | replication-instance-id |
    -- replication-instance-class | engine-version
    DescribeReplicationInstances -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | 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@.
    DescribeReplicationInstances -> 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.
    DescribeReplicationInstances -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeReplicationInstances
-> DescribeReplicationInstances -> Bool
(DescribeReplicationInstances
 -> DescribeReplicationInstances -> Bool)
-> (DescribeReplicationInstances
    -> DescribeReplicationInstances -> Bool)
-> Eq DescribeReplicationInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReplicationInstances
-> DescribeReplicationInstances -> Bool
$c/= :: DescribeReplicationInstances
-> DescribeReplicationInstances -> Bool
== :: DescribeReplicationInstances
-> DescribeReplicationInstances -> Bool
$c== :: DescribeReplicationInstances
-> DescribeReplicationInstances -> Bool
Prelude.Eq, ReadPrec [DescribeReplicationInstances]
ReadPrec DescribeReplicationInstances
Int -> ReadS DescribeReplicationInstances
ReadS [DescribeReplicationInstances]
(Int -> ReadS DescribeReplicationInstances)
-> ReadS [DescribeReplicationInstances]
-> ReadPrec DescribeReplicationInstances
-> ReadPrec [DescribeReplicationInstances]
-> Read DescribeReplicationInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReplicationInstances]
$creadListPrec :: ReadPrec [DescribeReplicationInstances]
readPrec :: ReadPrec DescribeReplicationInstances
$creadPrec :: ReadPrec DescribeReplicationInstances
readList :: ReadS [DescribeReplicationInstances]
$creadList :: ReadS [DescribeReplicationInstances]
readsPrec :: Int -> ReadS DescribeReplicationInstances
$creadsPrec :: Int -> ReadS DescribeReplicationInstances
Prelude.Read, Int -> DescribeReplicationInstances -> ShowS
[DescribeReplicationInstances] -> ShowS
DescribeReplicationInstances -> String
(Int -> DescribeReplicationInstances -> ShowS)
-> (DescribeReplicationInstances -> String)
-> ([DescribeReplicationInstances] -> ShowS)
-> Show DescribeReplicationInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReplicationInstances] -> ShowS
$cshowList :: [DescribeReplicationInstances] -> ShowS
show :: DescribeReplicationInstances -> String
$cshow :: DescribeReplicationInstances -> String
showsPrec :: Int -> DescribeReplicationInstances -> ShowS
$cshowsPrec :: Int -> DescribeReplicationInstances -> ShowS
Prelude.Show, (forall x.
 DescribeReplicationInstances -> Rep DescribeReplicationInstances x)
-> (forall x.
    Rep DescribeReplicationInstances x -> DescribeReplicationInstances)
-> Generic DescribeReplicationInstances
forall x.
Rep DescribeReplicationInstances x -> DescribeReplicationInstances
forall x.
DescribeReplicationInstances -> Rep DescribeReplicationInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReplicationInstances x -> DescribeReplicationInstances
$cfrom :: forall x.
DescribeReplicationInstances -> Rep DescribeReplicationInstances x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReplicationInstances' 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', 'describeReplicationInstances_filters' - Filters applied to replication instances.
--
-- Valid filter names: replication-instance-arn | replication-instance-id |
-- replication-instance-class | engine-version
--
-- 'marker', 'describeReplicationInstances_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', 'describeReplicationInstances_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.
newDescribeReplicationInstances ::
  DescribeReplicationInstances
newDescribeReplicationInstances :: DescribeReplicationInstances
newDescribeReplicationInstances =
  DescribeReplicationInstances' :: Maybe [Filter]
-> Maybe Text -> Maybe Int -> DescribeReplicationInstances
DescribeReplicationInstances'
    { $sel:filters:DescribeReplicationInstances' :: Maybe [Filter]
filters =
        Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeReplicationInstances' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeReplicationInstances' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Filters applied to replication instances.
--
-- Valid filter names: replication-instance-arn | replication-instance-id |
-- replication-instance-class | engine-version
describeReplicationInstances_filters :: Lens.Lens' DescribeReplicationInstances (Prelude.Maybe [Filter])
describeReplicationInstances_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeReplicationInstances -> f DescribeReplicationInstances
describeReplicationInstances_filters = (DescribeReplicationInstances -> Maybe [Filter])
-> (DescribeReplicationInstances
    -> Maybe [Filter] -> DescribeReplicationInstances)
-> Lens
     DescribeReplicationInstances
     DescribeReplicationInstances
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationInstances' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeReplicationInstances' :: DescribeReplicationInstances -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeReplicationInstances
s@DescribeReplicationInstances' {} Maybe [Filter]
a -> DescribeReplicationInstances
s {$sel:filters:DescribeReplicationInstances' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeReplicationInstances) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeReplicationInstances -> f DescribeReplicationInstances)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeReplicationInstances
-> f DescribeReplicationInstances
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 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@.
describeReplicationInstances_marker :: Lens.Lens' DescribeReplicationInstances (Prelude.Maybe Prelude.Text)
describeReplicationInstances_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeReplicationInstances -> f DescribeReplicationInstances
describeReplicationInstances_marker = (DescribeReplicationInstances -> Maybe Text)
-> (DescribeReplicationInstances
    -> Maybe Text -> DescribeReplicationInstances)
-> Lens
     DescribeReplicationInstances
     DescribeReplicationInstances
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationInstances' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeReplicationInstances' :: DescribeReplicationInstances -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeReplicationInstances
s@DescribeReplicationInstances' {} Maybe Text
a -> DescribeReplicationInstances
s {$sel:marker:DescribeReplicationInstances' :: Maybe Text
marker = Maybe Text
a} :: DescribeReplicationInstances)

-- | 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.
describeReplicationInstances_maxRecords :: Lens.Lens' DescribeReplicationInstances (Prelude.Maybe Prelude.Int)
describeReplicationInstances_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeReplicationInstances -> f DescribeReplicationInstances
describeReplicationInstances_maxRecords = (DescribeReplicationInstances -> Maybe Int)
-> (DescribeReplicationInstances
    -> Maybe Int -> DescribeReplicationInstances)
-> Lens
     DescribeReplicationInstances
     DescribeReplicationInstances
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationInstances' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeReplicationInstances' :: DescribeReplicationInstances -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeReplicationInstances
s@DescribeReplicationInstances' {} Maybe Int
a -> DescribeReplicationInstances
s {$sel:maxRecords:DescribeReplicationInstances' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeReplicationInstances)

instance Core.AWSPager DescribeReplicationInstances where
  page :: DescribeReplicationInstances
-> AWSResponse DescribeReplicationInstances
-> Maybe DescribeReplicationInstances
page DescribeReplicationInstances
rq AWSResponse DescribeReplicationInstances
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeReplicationInstances
DescribeReplicationInstancesResponse
rs
            DescribeReplicationInstancesResponse
-> Getting (First Text) DescribeReplicationInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeReplicationInstancesResponse
-> Const (First Text) DescribeReplicationInstancesResponse
Lens' DescribeReplicationInstancesResponse (Maybe Text)
describeReplicationInstancesResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeReplicationInstancesResponse
 -> Const (First Text) DescribeReplicationInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeReplicationInstancesResponse 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 DescribeReplicationInstances
forall a. Maybe a
Prelude.Nothing
    | Maybe [ReplicationInstance] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeReplicationInstances
DescribeReplicationInstancesResponse
rs
            DescribeReplicationInstancesResponse
-> Getting
     (First [ReplicationInstance])
     DescribeReplicationInstancesResponse
     [ReplicationInstance]
-> Maybe [ReplicationInstance]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ReplicationInstance]
 -> Const
      (First [ReplicationInstance]) (Maybe [ReplicationInstance]))
-> DescribeReplicationInstancesResponse
-> Const
     (First [ReplicationInstance]) DescribeReplicationInstancesResponse
Lens'
  DescribeReplicationInstancesResponse (Maybe [ReplicationInstance])
describeReplicationInstancesResponse_replicationInstances
              ((Maybe [ReplicationInstance]
  -> Const
       (First [ReplicationInstance]) (Maybe [ReplicationInstance]))
 -> DescribeReplicationInstancesResponse
 -> Const
      (First [ReplicationInstance]) DescribeReplicationInstancesResponse)
-> (([ReplicationInstance]
     -> Const (First [ReplicationInstance]) [ReplicationInstance])
    -> Maybe [ReplicationInstance]
    -> Const
         (First [ReplicationInstance]) (Maybe [ReplicationInstance]))
-> Getting
     (First [ReplicationInstance])
     DescribeReplicationInstancesResponse
     [ReplicationInstance]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ReplicationInstance]
 -> Const (First [ReplicationInstance]) [ReplicationInstance])
-> Maybe [ReplicationInstance]
-> Const
     (First [ReplicationInstance]) (Maybe [ReplicationInstance])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeReplicationInstances
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeReplicationInstances -> Maybe DescribeReplicationInstances
forall a. a -> Maybe a
Prelude.Just (DescribeReplicationInstances
 -> Maybe DescribeReplicationInstances)
-> DescribeReplicationInstances
-> Maybe DescribeReplicationInstances
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeReplicationInstances
rq
          DescribeReplicationInstances
-> (DescribeReplicationInstances -> DescribeReplicationInstances)
-> DescribeReplicationInstances
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeReplicationInstances
-> Identity DescribeReplicationInstances
Lens
  DescribeReplicationInstances
  DescribeReplicationInstances
  (Maybe Text)
  (Maybe Text)
describeReplicationInstances_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeReplicationInstances
 -> Identity DescribeReplicationInstances)
-> Maybe Text
-> DescribeReplicationInstances
-> DescribeReplicationInstances
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeReplicationInstances
DescribeReplicationInstancesResponse
rs
          DescribeReplicationInstancesResponse
-> Getting (First Text) DescribeReplicationInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeReplicationInstancesResponse
-> Const (First Text) DescribeReplicationInstancesResponse
Lens' DescribeReplicationInstancesResponse (Maybe Text)
describeReplicationInstancesResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeReplicationInstancesResponse
 -> Const (First Text) DescribeReplicationInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeReplicationInstancesResponse 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 DescribeReplicationInstances where
  type
    AWSResponse DescribeReplicationInstances =
      DescribeReplicationInstancesResponse
  request :: DescribeReplicationInstances
-> Request DescribeReplicationInstances
request = Service
-> DescribeReplicationInstances
-> Request DescribeReplicationInstances
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeReplicationInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeReplicationInstances)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeReplicationInstances))
-> Logger
-> Service
-> Proxy DescribeReplicationInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeReplicationInstances)))
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 Text
-> Maybe [ReplicationInstance]
-> Int
-> DescribeReplicationInstancesResponse
DescribeReplicationInstancesResponse'
            (Maybe Text
 -> Maybe [ReplicationInstance]
 -> Int
 -> DescribeReplicationInstancesResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ReplicationInstance]
      -> Int -> DescribeReplicationInstancesResponse)
forall (f :: * -> *) a b. Functor 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
  (Maybe [ReplicationInstance]
   -> Int -> DescribeReplicationInstancesResponse)
-> Either String (Maybe [ReplicationInstance])
-> Either String (Int -> DescribeReplicationInstancesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [ReplicationInstance]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReplicationInstances"
                            Either String (Maybe (Maybe [ReplicationInstance]))
-> Maybe [ReplicationInstance]
-> Either String (Maybe [ReplicationInstance])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ReplicationInstance]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> DescribeReplicationInstancesResponse)
-> Either String Int
-> Either String DescribeReplicationInstancesResponse
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
    DescribeReplicationInstances

instance Prelude.NFData DescribeReplicationInstances

instance Core.ToHeaders DescribeReplicationInstances where
  toHeaders :: DescribeReplicationInstances -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeReplicationInstances -> 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.DescribeReplicationInstances" ::
                          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 DescribeReplicationInstances where
  toJSON :: DescribeReplicationInstances -> Value
toJSON DescribeReplicationInstances' {Maybe Int
Maybe [Filter]
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
filters :: Maybe [Filter]
$sel:maxRecords:DescribeReplicationInstances' :: DescribeReplicationInstances -> Maybe Int
$sel:marker:DescribeReplicationInstances' :: DescribeReplicationInstances -> Maybe Text
$sel:filters:DescribeReplicationInstances' :: DescribeReplicationInstances -> 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
"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 DescribeReplicationInstances where
  toPath :: DescribeReplicationInstances -> ByteString
toPath = ByteString -> DescribeReplicationInstances -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- |
--
-- /See:/ 'newDescribeReplicationInstancesResponse' smart constructor.
data DescribeReplicationInstancesResponse = DescribeReplicationInstancesResponse'
  { -- | 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@.
    DescribeReplicationInstancesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The replication instances described.
    DescribeReplicationInstancesResponse -> Maybe [ReplicationInstance]
replicationInstances :: Prelude.Maybe [ReplicationInstance],
    -- | The response's http status code.
    DescribeReplicationInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeReplicationInstancesResponse
-> DescribeReplicationInstancesResponse -> Bool
(DescribeReplicationInstancesResponse
 -> DescribeReplicationInstancesResponse -> Bool)
-> (DescribeReplicationInstancesResponse
    -> DescribeReplicationInstancesResponse -> Bool)
-> Eq DescribeReplicationInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReplicationInstancesResponse
-> DescribeReplicationInstancesResponse -> Bool
$c/= :: DescribeReplicationInstancesResponse
-> DescribeReplicationInstancesResponse -> Bool
== :: DescribeReplicationInstancesResponse
-> DescribeReplicationInstancesResponse -> Bool
$c== :: DescribeReplicationInstancesResponse
-> DescribeReplicationInstancesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeReplicationInstancesResponse]
ReadPrec DescribeReplicationInstancesResponse
Int -> ReadS DescribeReplicationInstancesResponse
ReadS [DescribeReplicationInstancesResponse]
(Int -> ReadS DescribeReplicationInstancesResponse)
-> ReadS [DescribeReplicationInstancesResponse]
-> ReadPrec DescribeReplicationInstancesResponse
-> ReadPrec [DescribeReplicationInstancesResponse]
-> Read DescribeReplicationInstancesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReplicationInstancesResponse]
$creadListPrec :: ReadPrec [DescribeReplicationInstancesResponse]
readPrec :: ReadPrec DescribeReplicationInstancesResponse
$creadPrec :: ReadPrec DescribeReplicationInstancesResponse
readList :: ReadS [DescribeReplicationInstancesResponse]
$creadList :: ReadS [DescribeReplicationInstancesResponse]
readsPrec :: Int -> ReadS DescribeReplicationInstancesResponse
$creadsPrec :: Int -> ReadS DescribeReplicationInstancesResponse
Prelude.Read, Int -> DescribeReplicationInstancesResponse -> ShowS
[DescribeReplicationInstancesResponse] -> ShowS
DescribeReplicationInstancesResponse -> String
(Int -> DescribeReplicationInstancesResponse -> ShowS)
-> (DescribeReplicationInstancesResponse -> String)
-> ([DescribeReplicationInstancesResponse] -> ShowS)
-> Show DescribeReplicationInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReplicationInstancesResponse] -> ShowS
$cshowList :: [DescribeReplicationInstancesResponse] -> ShowS
show :: DescribeReplicationInstancesResponse -> String
$cshow :: DescribeReplicationInstancesResponse -> String
showsPrec :: Int -> DescribeReplicationInstancesResponse -> ShowS
$cshowsPrec :: Int -> DescribeReplicationInstancesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeReplicationInstancesResponse
 -> Rep DescribeReplicationInstancesResponse x)
-> (forall x.
    Rep DescribeReplicationInstancesResponse x
    -> DescribeReplicationInstancesResponse)
-> Generic DescribeReplicationInstancesResponse
forall x.
Rep DescribeReplicationInstancesResponse x
-> DescribeReplicationInstancesResponse
forall x.
DescribeReplicationInstancesResponse
-> Rep DescribeReplicationInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReplicationInstancesResponse x
-> DescribeReplicationInstancesResponse
$cfrom :: forall x.
DescribeReplicationInstancesResponse
-> Rep DescribeReplicationInstancesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReplicationInstancesResponse' 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:
--
-- 'marker', 'describeReplicationInstancesResponse_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@.
--
-- 'replicationInstances', 'describeReplicationInstancesResponse_replicationInstances' - The replication instances described.
--
-- 'httpStatus', 'describeReplicationInstancesResponse_httpStatus' - The response's http status code.
newDescribeReplicationInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeReplicationInstancesResponse
newDescribeReplicationInstancesResponse :: Int -> DescribeReplicationInstancesResponse
newDescribeReplicationInstancesResponse Int
pHttpStatus_ =
  DescribeReplicationInstancesResponse' :: Maybe Text
-> Maybe [ReplicationInstance]
-> Int
-> DescribeReplicationInstancesResponse
DescribeReplicationInstancesResponse'
    { $sel:marker:DescribeReplicationInstancesResponse' :: Maybe Text
marker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:replicationInstances:DescribeReplicationInstancesResponse' :: Maybe [ReplicationInstance]
replicationInstances =
        Maybe [ReplicationInstance]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeReplicationInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The replication instances described.
describeReplicationInstancesResponse_replicationInstances :: Lens.Lens' DescribeReplicationInstancesResponse (Prelude.Maybe [ReplicationInstance])
describeReplicationInstancesResponse_replicationInstances :: (Maybe [ReplicationInstance] -> f (Maybe [ReplicationInstance]))
-> DescribeReplicationInstancesResponse
-> f DescribeReplicationInstancesResponse
describeReplicationInstancesResponse_replicationInstances = (DescribeReplicationInstancesResponse
 -> Maybe [ReplicationInstance])
-> (DescribeReplicationInstancesResponse
    -> Maybe [ReplicationInstance]
    -> DescribeReplicationInstancesResponse)
-> Lens'
     DescribeReplicationInstancesResponse (Maybe [ReplicationInstance])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationInstancesResponse' {Maybe [ReplicationInstance]
replicationInstances :: Maybe [ReplicationInstance]
$sel:replicationInstances:DescribeReplicationInstancesResponse' :: DescribeReplicationInstancesResponse -> Maybe [ReplicationInstance]
replicationInstances} -> Maybe [ReplicationInstance]
replicationInstances) (\s :: DescribeReplicationInstancesResponse
s@DescribeReplicationInstancesResponse' {} Maybe [ReplicationInstance]
a -> DescribeReplicationInstancesResponse
s {$sel:replicationInstances:DescribeReplicationInstancesResponse' :: Maybe [ReplicationInstance]
replicationInstances = Maybe [ReplicationInstance]
a} :: DescribeReplicationInstancesResponse) ((Maybe [ReplicationInstance] -> f (Maybe [ReplicationInstance]))
 -> DescribeReplicationInstancesResponse
 -> f DescribeReplicationInstancesResponse)
-> ((Maybe [ReplicationInstance]
     -> f (Maybe [ReplicationInstance]))
    -> Maybe [ReplicationInstance] -> f (Maybe [ReplicationInstance]))
-> (Maybe [ReplicationInstance] -> f (Maybe [ReplicationInstance]))
-> DescribeReplicationInstancesResponse
-> f DescribeReplicationInstancesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReplicationInstance]
  [ReplicationInstance]
  [ReplicationInstance]
  [ReplicationInstance]
-> Iso
     (Maybe [ReplicationInstance])
     (Maybe [ReplicationInstance])
     (Maybe [ReplicationInstance])
     (Maybe [ReplicationInstance])
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
  [ReplicationInstance]
  [ReplicationInstance]
  [ReplicationInstance]
  [ReplicationInstance]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeReplicationInstancesResponse