{-# 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.MGN.DescribeReplicationConfigurationTemplates
-- 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)
--
-- Lists all ReplicationConfigurationTemplates, filtered by Source Server
-- IDs.
--
-- This operation returns paginated results.
module Amazonka.MGN.DescribeReplicationConfigurationTemplates
  ( -- * Creating a Request
    DescribeReplicationConfigurationTemplates (..),
    newDescribeReplicationConfigurationTemplates,

    -- * Request Lenses
    describeReplicationConfigurationTemplates_nextToken,
    describeReplicationConfigurationTemplates_maxResults,
    describeReplicationConfigurationTemplates_replicationConfigurationTemplateIDs,

    -- * Destructuring the Response
    DescribeReplicationConfigurationTemplatesResponse (..),
    newDescribeReplicationConfigurationTemplatesResponse,

    -- * Response Lenses
    describeReplicationConfigurationTemplatesResponse_items,
    describeReplicationConfigurationTemplatesResponse_nextToken,
    describeReplicationConfigurationTemplatesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MGN.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeReplicationConfigurationTemplates' smart constructor.
data DescribeReplicationConfigurationTemplates = DescribeReplicationConfigurationTemplates'
  { -- | Request to describe Replication Configuration template by next token.
    DescribeReplicationConfigurationTemplates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Request to describe Replication Configuration template by max results.
    DescribeReplicationConfigurationTemplates -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Request to describe Replication Configuration template by template IDs.
    DescribeReplicationConfigurationTemplates -> [Text]
replicationConfigurationTemplateIDs :: [Prelude.Text]
  }
  deriving (DescribeReplicationConfigurationTemplates
-> DescribeReplicationConfigurationTemplates -> Bool
(DescribeReplicationConfigurationTemplates
 -> DescribeReplicationConfigurationTemplates -> Bool)
-> (DescribeReplicationConfigurationTemplates
    -> DescribeReplicationConfigurationTemplates -> Bool)
-> Eq DescribeReplicationConfigurationTemplates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReplicationConfigurationTemplates
-> DescribeReplicationConfigurationTemplates -> Bool
$c/= :: DescribeReplicationConfigurationTemplates
-> DescribeReplicationConfigurationTemplates -> Bool
== :: DescribeReplicationConfigurationTemplates
-> DescribeReplicationConfigurationTemplates -> Bool
$c== :: DescribeReplicationConfigurationTemplates
-> DescribeReplicationConfigurationTemplates -> Bool
Prelude.Eq, ReadPrec [DescribeReplicationConfigurationTemplates]
ReadPrec DescribeReplicationConfigurationTemplates
Int -> ReadS DescribeReplicationConfigurationTemplates
ReadS [DescribeReplicationConfigurationTemplates]
(Int -> ReadS DescribeReplicationConfigurationTemplates)
-> ReadS [DescribeReplicationConfigurationTemplates]
-> ReadPrec DescribeReplicationConfigurationTemplates
-> ReadPrec [DescribeReplicationConfigurationTemplates]
-> Read DescribeReplicationConfigurationTemplates
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReplicationConfigurationTemplates]
$creadListPrec :: ReadPrec [DescribeReplicationConfigurationTemplates]
readPrec :: ReadPrec DescribeReplicationConfigurationTemplates
$creadPrec :: ReadPrec DescribeReplicationConfigurationTemplates
readList :: ReadS [DescribeReplicationConfigurationTemplates]
$creadList :: ReadS [DescribeReplicationConfigurationTemplates]
readsPrec :: Int -> ReadS DescribeReplicationConfigurationTemplates
$creadsPrec :: Int -> ReadS DescribeReplicationConfigurationTemplates
Prelude.Read, Int -> DescribeReplicationConfigurationTemplates -> ShowS
[DescribeReplicationConfigurationTemplates] -> ShowS
DescribeReplicationConfigurationTemplates -> String
(Int -> DescribeReplicationConfigurationTemplates -> ShowS)
-> (DescribeReplicationConfigurationTemplates -> String)
-> ([DescribeReplicationConfigurationTemplates] -> ShowS)
-> Show DescribeReplicationConfigurationTemplates
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReplicationConfigurationTemplates] -> ShowS
$cshowList :: [DescribeReplicationConfigurationTemplates] -> ShowS
show :: DescribeReplicationConfigurationTemplates -> String
$cshow :: DescribeReplicationConfigurationTemplates -> String
showsPrec :: Int -> DescribeReplicationConfigurationTemplates -> ShowS
$cshowsPrec :: Int -> DescribeReplicationConfigurationTemplates -> ShowS
Prelude.Show, (forall x.
 DescribeReplicationConfigurationTemplates
 -> Rep DescribeReplicationConfigurationTemplates x)
-> (forall x.
    Rep DescribeReplicationConfigurationTemplates x
    -> DescribeReplicationConfigurationTemplates)
-> Generic DescribeReplicationConfigurationTemplates
forall x.
Rep DescribeReplicationConfigurationTemplates x
-> DescribeReplicationConfigurationTemplates
forall x.
DescribeReplicationConfigurationTemplates
-> Rep DescribeReplicationConfigurationTemplates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReplicationConfigurationTemplates x
-> DescribeReplicationConfigurationTemplates
$cfrom :: forall x.
DescribeReplicationConfigurationTemplates
-> Rep DescribeReplicationConfigurationTemplates x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReplicationConfigurationTemplates' 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:
--
-- 'nextToken', 'describeReplicationConfigurationTemplates_nextToken' - Request to describe Replication Configuration template by next token.
--
-- 'maxResults', 'describeReplicationConfigurationTemplates_maxResults' - Request to describe Replication Configuration template by max results.
--
-- 'replicationConfigurationTemplateIDs', 'describeReplicationConfigurationTemplates_replicationConfigurationTemplateIDs' - Request to describe Replication Configuration template by template IDs.
newDescribeReplicationConfigurationTemplates ::
  DescribeReplicationConfigurationTemplates
newDescribeReplicationConfigurationTemplates :: DescribeReplicationConfigurationTemplates
newDescribeReplicationConfigurationTemplates =
  DescribeReplicationConfigurationTemplates' :: Maybe Text
-> Maybe Natural
-> [Text]
-> DescribeReplicationConfigurationTemplates
DescribeReplicationConfigurationTemplates'
    { $sel:nextToken:DescribeReplicationConfigurationTemplates' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeReplicationConfigurationTemplates' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:replicationConfigurationTemplateIDs:DescribeReplicationConfigurationTemplates' :: [Text]
replicationConfigurationTemplateIDs =
        [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Request to describe Replication Configuration template by next token.
describeReplicationConfigurationTemplates_nextToken :: Lens.Lens' DescribeReplicationConfigurationTemplates (Prelude.Maybe Prelude.Text)
describeReplicationConfigurationTemplates_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeReplicationConfigurationTemplates
-> f DescribeReplicationConfigurationTemplates
describeReplicationConfigurationTemplates_nextToken = (DescribeReplicationConfigurationTemplates -> Maybe Text)
-> (DescribeReplicationConfigurationTemplates
    -> Maybe Text -> DescribeReplicationConfigurationTemplates)
-> Lens
     DescribeReplicationConfigurationTemplates
     DescribeReplicationConfigurationTemplates
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationConfigurationTemplates' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeReplicationConfigurationTemplates' :: DescribeReplicationConfigurationTemplates -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeReplicationConfigurationTemplates
s@DescribeReplicationConfigurationTemplates' {} Maybe Text
a -> DescribeReplicationConfigurationTemplates
s {$sel:nextToken:DescribeReplicationConfigurationTemplates' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeReplicationConfigurationTemplates)

-- | Request to describe Replication Configuration template by max results.
describeReplicationConfigurationTemplates_maxResults :: Lens.Lens' DescribeReplicationConfigurationTemplates (Prelude.Maybe Prelude.Natural)
describeReplicationConfigurationTemplates_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeReplicationConfigurationTemplates
-> f DescribeReplicationConfigurationTemplates
describeReplicationConfigurationTemplates_maxResults = (DescribeReplicationConfigurationTemplates -> Maybe Natural)
-> (DescribeReplicationConfigurationTemplates
    -> Maybe Natural -> DescribeReplicationConfigurationTemplates)
-> Lens
     DescribeReplicationConfigurationTemplates
     DescribeReplicationConfigurationTemplates
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationConfigurationTemplates' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeReplicationConfigurationTemplates' :: DescribeReplicationConfigurationTemplates -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeReplicationConfigurationTemplates
s@DescribeReplicationConfigurationTemplates' {} Maybe Natural
a -> DescribeReplicationConfigurationTemplates
s {$sel:maxResults:DescribeReplicationConfigurationTemplates' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeReplicationConfigurationTemplates)

-- | Request to describe Replication Configuration template by template IDs.
describeReplicationConfigurationTemplates_replicationConfigurationTemplateIDs :: Lens.Lens' DescribeReplicationConfigurationTemplates [Prelude.Text]
describeReplicationConfigurationTemplates_replicationConfigurationTemplateIDs :: ([Text] -> f [Text])
-> DescribeReplicationConfigurationTemplates
-> f DescribeReplicationConfigurationTemplates
describeReplicationConfigurationTemplates_replicationConfigurationTemplateIDs = (DescribeReplicationConfigurationTemplates -> [Text])
-> (DescribeReplicationConfigurationTemplates
    -> [Text] -> DescribeReplicationConfigurationTemplates)
-> Lens
     DescribeReplicationConfigurationTemplates
     DescribeReplicationConfigurationTemplates
     [Text]
     [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationConfigurationTemplates' {[Text]
replicationConfigurationTemplateIDs :: [Text]
$sel:replicationConfigurationTemplateIDs:DescribeReplicationConfigurationTemplates' :: DescribeReplicationConfigurationTemplates -> [Text]
replicationConfigurationTemplateIDs} -> [Text]
replicationConfigurationTemplateIDs) (\s :: DescribeReplicationConfigurationTemplates
s@DescribeReplicationConfigurationTemplates' {} [Text]
a -> DescribeReplicationConfigurationTemplates
s {$sel:replicationConfigurationTemplateIDs:DescribeReplicationConfigurationTemplates' :: [Text]
replicationConfigurationTemplateIDs = [Text]
a} :: DescribeReplicationConfigurationTemplates) (([Text] -> f [Text])
 -> DescribeReplicationConfigurationTemplates
 -> f DescribeReplicationConfigurationTemplates)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> DescribeReplicationConfigurationTemplates
-> f DescribeReplicationConfigurationTemplates
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeReplicationConfigurationTemplates

instance
  Core.ToHeaders
    DescribeReplicationConfigurationTemplates
  where
  toHeaders :: DescribeReplicationConfigurationTemplates -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeReplicationConfigurationTemplates -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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
    DescribeReplicationConfigurationTemplates
  where
  toJSON :: DescribeReplicationConfigurationTemplates -> Value
toJSON DescribeReplicationConfigurationTemplates' {[Text]
Maybe Natural
Maybe Text
replicationConfigurationTemplateIDs :: [Text]
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:replicationConfigurationTemplateIDs:DescribeReplicationConfigurationTemplates' :: DescribeReplicationConfigurationTemplates -> [Text]
$sel:maxResults:DescribeReplicationConfigurationTemplates' :: DescribeReplicationConfigurationTemplates -> Maybe Natural
$sel:nextToken:DescribeReplicationConfigurationTemplates' :: DescribeReplicationConfigurationTemplates -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"nextToken" 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
nextToken,
            (Text
"maxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"replicationConfigurationTemplateIDs"
                  Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
replicationConfigurationTemplateIDs
              )
          ]
      )

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

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

-- | /See:/ 'newDescribeReplicationConfigurationTemplatesResponse' smart constructor.
data DescribeReplicationConfigurationTemplatesResponse = DescribeReplicationConfigurationTemplatesResponse'
  { -- | Request to describe Replication Configuration template by items.
    DescribeReplicationConfigurationTemplatesResponse
-> Maybe [ReplicationConfigurationTemplate]
items :: Prelude.Maybe [ReplicationConfigurationTemplate],
    -- | Request to describe Replication Configuration template by next token.
    DescribeReplicationConfigurationTemplatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeReplicationConfigurationTemplatesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeReplicationConfigurationTemplatesResponse
-> DescribeReplicationConfigurationTemplatesResponse -> Bool
(DescribeReplicationConfigurationTemplatesResponse
 -> DescribeReplicationConfigurationTemplatesResponse -> Bool)
-> (DescribeReplicationConfigurationTemplatesResponse
    -> DescribeReplicationConfigurationTemplatesResponse -> Bool)
-> Eq DescribeReplicationConfigurationTemplatesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReplicationConfigurationTemplatesResponse
-> DescribeReplicationConfigurationTemplatesResponse -> Bool
$c/= :: DescribeReplicationConfigurationTemplatesResponse
-> DescribeReplicationConfigurationTemplatesResponse -> Bool
== :: DescribeReplicationConfigurationTemplatesResponse
-> DescribeReplicationConfigurationTemplatesResponse -> Bool
$c== :: DescribeReplicationConfigurationTemplatesResponse
-> DescribeReplicationConfigurationTemplatesResponse -> Bool
Prelude.Eq, Int -> DescribeReplicationConfigurationTemplatesResponse -> ShowS
[DescribeReplicationConfigurationTemplatesResponse] -> ShowS
DescribeReplicationConfigurationTemplatesResponse -> String
(Int -> DescribeReplicationConfigurationTemplatesResponse -> ShowS)
-> (DescribeReplicationConfigurationTemplatesResponse -> String)
-> ([DescribeReplicationConfigurationTemplatesResponse] -> ShowS)
-> Show DescribeReplicationConfigurationTemplatesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReplicationConfigurationTemplatesResponse] -> ShowS
$cshowList :: [DescribeReplicationConfigurationTemplatesResponse] -> ShowS
show :: DescribeReplicationConfigurationTemplatesResponse -> String
$cshow :: DescribeReplicationConfigurationTemplatesResponse -> String
showsPrec :: Int -> DescribeReplicationConfigurationTemplatesResponse -> ShowS
$cshowsPrec :: Int -> DescribeReplicationConfigurationTemplatesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeReplicationConfigurationTemplatesResponse
 -> Rep DescribeReplicationConfigurationTemplatesResponse x)
-> (forall x.
    Rep DescribeReplicationConfigurationTemplatesResponse x
    -> DescribeReplicationConfigurationTemplatesResponse)
-> Generic DescribeReplicationConfigurationTemplatesResponse
forall x.
Rep DescribeReplicationConfigurationTemplatesResponse x
-> DescribeReplicationConfigurationTemplatesResponse
forall x.
DescribeReplicationConfigurationTemplatesResponse
-> Rep DescribeReplicationConfigurationTemplatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReplicationConfigurationTemplatesResponse x
-> DescribeReplicationConfigurationTemplatesResponse
$cfrom :: forall x.
DescribeReplicationConfigurationTemplatesResponse
-> Rep DescribeReplicationConfigurationTemplatesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReplicationConfigurationTemplatesResponse' 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:
--
-- 'items', 'describeReplicationConfigurationTemplatesResponse_items' - Request to describe Replication Configuration template by items.
--
-- 'nextToken', 'describeReplicationConfigurationTemplatesResponse_nextToken' - Request to describe Replication Configuration template by next token.
--
-- 'httpStatus', 'describeReplicationConfigurationTemplatesResponse_httpStatus' - The response's http status code.
newDescribeReplicationConfigurationTemplatesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeReplicationConfigurationTemplatesResponse
newDescribeReplicationConfigurationTemplatesResponse :: Int -> DescribeReplicationConfigurationTemplatesResponse
newDescribeReplicationConfigurationTemplatesResponse
  Int
pHttpStatus_ =
    DescribeReplicationConfigurationTemplatesResponse' :: Maybe [ReplicationConfigurationTemplate]
-> Maybe Text
-> Int
-> DescribeReplicationConfigurationTemplatesResponse
DescribeReplicationConfigurationTemplatesResponse'
      { $sel:items:DescribeReplicationConfigurationTemplatesResponse' :: Maybe [ReplicationConfigurationTemplate]
items =
          Maybe [ReplicationConfigurationTemplate]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeReplicationConfigurationTemplatesResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeReplicationConfigurationTemplatesResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | Request to describe Replication Configuration template by items.
describeReplicationConfigurationTemplatesResponse_items :: Lens.Lens' DescribeReplicationConfigurationTemplatesResponse (Prelude.Maybe [ReplicationConfigurationTemplate])
describeReplicationConfigurationTemplatesResponse_items :: (Maybe [ReplicationConfigurationTemplate]
 -> f (Maybe [ReplicationConfigurationTemplate]))
-> DescribeReplicationConfigurationTemplatesResponse
-> f DescribeReplicationConfigurationTemplatesResponse
describeReplicationConfigurationTemplatesResponse_items = (DescribeReplicationConfigurationTemplatesResponse
 -> Maybe [ReplicationConfigurationTemplate])
-> (DescribeReplicationConfigurationTemplatesResponse
    -> Maybe [ReplicationConfigurationTemplate]
    -> DescribeReplicationConfigurationTemplatesResponse)
-> Lens'
     DescribeReplicationConfigurationTemplatesResponse
     (Maybe [ReplicationConfigurationTemplate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationConfigurationTemplatesResponse' {Maybe [ReplicationConfigurationTemplate]
items :: Maybe [ReplicationConfigurationTemplate]
$sel:items:DescribeReplicationConfigurationTemplatesResponse' :: DescribeReplicationConfigurationTemplatesResponse
-> Maybe [ReplicationConfigurationTemplate]
items} -> Maybe [ReplicationConfigurationTemplate]
items) (\s :: DescribeReplicationConfigurationTemplatesResponse
s@DescribeReplicationConfigurationTemplatesResponse' {} Maybe [ReplicationConfigurationTemplate]
a -> DescribeReplicationConfigurationTemplatesResponse
s {$sel:items:DescribeReplicationConfigurationTemplatesResponse' :: Maybe [ReplicationConfigurationTemplate]
items = Maybe [ReplicationConfigurationTemplate]
a} :: DescribeReplicationConfigurationTemplatesResponse) ((Maybe [ReplicationConfigurationTemplate]
  -> f (Maybe [ReplicationConfigurationTemplate]))
 -> DescribeReplicationConfigurationTemplatesResponse
 -> f DescribeReplicationConfigurationTemplatesResponse)
-> ((Maybe [ReplicationConfigurationTemplate]
     -> f (Maybe [ReplicationConfigurationTemplate]))
    -> Maybe [ReplicationConfigurationTemplate]
    -> f (Maybe [ReplicationConfigurationTemplate]))
-> (Maybe [ReplicationConfigurationTemplate]
    -> f (Maybe [ReplicationConfigurationTemplate]))
-> DescribeReplicationConfigurationTemplatesResponse
-> f DescribeReplicationConfigurationTemplatesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReplicationConfigurationTemplate]
  [ReplicationConfigurationTemplate]
  [ReplicationConfigurationTemplate]
  [ReplicationConfigurationTemplate]
-> Iso
     (Maybe [ReplicationConfigurationTemplate])
     (Maybe [ReplicationConfigurationTemplate])
     (Maybe [ReplicationConfigurationTemplate])
     (Maybe [ReplicationConfigurationTemplate])
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
  [ReplicationConfigurationTemplate]
  [ReplicationConfigurationTemplate]
  [ReplicationConfigurationTemplate]
  [ReplicationConfigurationTemplate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Request to describe Replication Configuration template by next token.
describeReplicationConfigurationTemplatesResponse_nextToken :: Lens.Lens' DescribeReplicationConfigurationTemplatesResponse (Prelude.Maybe Prelude.Text)
describeReplicationConfigurationTemplatesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeReplicationConfigurationTemplatesResponse
-> f DescribeReplicationConfigurationTemplatesResponse
describeReplicationConfigurationTemplatesResponse_nextToken = (DescribeReplicationConfigurationTemplatesResponse -> Maybe Text)
-> (DescribeReplicationConfigurationTemplatesResponse
    -> Maybe Text -> DescribeReplicationConfigurationTemplatesResponse)
-> Lens'
     DescribeReplicationConfigurationTemplatesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReplicationConfigurationTemplatesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeReplicationConfigurationTemplatesResponse' :: DescribeReplicationConfigurationTemplatesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeReplicationConfigurationTemplatesResponse
s@DescribeReplicationConfigurationTemplatesResponse' {} Maybe Text
a -> DescribeReplicationConfigurationTemplatesResponse
s {$sel:nextToken:DescribeReplicationConfigurationTemplatesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeReplicationConfigurationTemplatesResponse)

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

instance
  Prelude.NFData
    DescribeReplicationConfigurationTemplatesResponse