{-# 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.SES.ListTemplates
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the email templates present in your Amazon SES account in the
-- current AWS Region.
--
-- You can execute this operation no more than once per second.
--
-- This operation returns paginated results.
module Amazonka.SES.ListTemplates
  ( -- * Creating a Request
    ListTemplates (..),
    newListTemplates,

    -- * Request Lenses
    listTemplates_maxItems,
    listTemplates_nextToken,

    -- * Destructuring the Response
    ListTemplatesResponse (..),
    newListTemplatesResponse,

    -- * Response Lenses
    listTemplatesResponse_nextToken,
    listTemplatesResponse_templatesMetadata,
    listTemplatesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SES.Types

-- | /See:/ 'newListTemplates' smart constructor.
data ListTemplates = ListTemplates'
  { -- | The maximum number of templates to return. This value must be at least 1
    -- and less than or equal to 10. If you do not specify a value, or if you
    -- specify a value less than 1 or greater than 10, the operation will
    -- return up to 10 results.
    ListTemplates -> Maybe Int
maxItems :: Prelude.Maybe Prelude.Int,
    -- | A token returned from a previous call to @ListTemplates@ to indicate the
    -- position in the list of email templates.
    ListTemplates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListTemplates -> ListTemplates -> Bool
(ListTemplates -> ListTemplates -> Bool)
-> (ListTemplates -> ListTemplates -> Bool) -> Eq ListTemplates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListTemplates -> ListTemplates -> Bool
== :: ListTemplates -> ListTemplates -> Bool
$c/= :: ListTemplates -> ListTemplates -> Bool
/= :: ListTemplates -> ListTemplates -> Bool
Prelude.Eq, ReadPrec [ListTemplates]
ReadPrec ListTemplates
Int -> ReadS ListTemplates
ReadS [ListTemplates]
(Int -> ReadS ListTemplates)
-> ReadS [ListTemplates]
-> ReadPrec ListTemplates
-> ReadPrec [ListTemplates]
-> Read ListTemplates
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ListTemplates
readsPrec :: Int -> ReadS ListTemplates
$creadList :: ReadS [ListTemplates]
readList :: ReadS [ListTemplates]
$creadPrec :: ReadPrec ListTemplates
readPrec :: ReadPrec ListTemplates
$creadListPrec :: ReadPrec [ListTemplates]
readListPrec :: ReadPrec [ListTemplates]
Prelude.Read, Int -> ListTemplates -> ShowS
[ListTemplates] -> ShowS
ListTemplates -> String
(Int -> ListTemplates -> ShowS)
-> (ListTemplates -> String)
-> ([ListTemplates] -> ShowS)
-> Show ListTemplates
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListTemplates -> ShowS
showsPrec :: Int -> ListTemplates -> ShowS
$cshow :: ListTemplates -> String
show :: ListTemplates -> String
$cshowList :: [ListTemplates] -> ShowS
showList :: [ListTemplates] -> ShowS
Prelude.Show, (forall x. ListTemplates -> Rep ListTemplates x)
-> (forall x. Rep ListTemplates x -> ListTemplates)
-> Generic ListTemplates
forall x. Rep ListTemplates x -> ListTemplates
forall x. ListTemplates -> Rep ListTemplates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListTemplates -> Rep ListTemplates x
from :: forall x. ListTemplates -> Rep ListTemplates x
$cto :: forall x. Rep ListTemplates x -> ListTemplates
to :: forall x. Rep ListTemplates x -> ListTemplates
Prelude.Generic)

-- |
-- Create a value of 'ListTemplates' 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:
--
-- 'maxItems', 'listTemplates_maxItems' - The maximum number of templates to return. This value must be at least 1
-- and less than or equal to 10. If you do not specify a value, or if you
-- specify a value less than 1 or greater than 10, the operation will
-- return up to 10 results.
--
-- 'nextToken', 'listTemplates_nextToken' - A token returned from a previous call to @ListTemplates@ to indicate the
-- position in the list of email templates.
newListTemplates ::
  ListTemplates
newListTemplates :: ListTemplates
newListTemplates =
  ListTemplates'
    { $sel:maxItems:ListTemplates' :: Maybe Int
maxItems = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTemplates' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of templates to return. This value must be at least 1
-- and less than or equal to 10. If you do not specify a value, or if you
-- specify a value less than 1 or greater than 10, the operation will
-- return up to 10 results.
listTemplates_maxItems :: Lens.Lens' ListTemplates (Prelude.Maybe Prelude.Int)
listTemplates_maxItems :: Lens' ListTemplates (Maybe Int)
listTemplates_maxItems = (ListTemplates -> Maybe Int)
-> (ListTemplates -> Maybe Int -> ListTemplates)
-> Lens' ListTemplates (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplates' {Maybe Int
$sel:maxItems:ListTemplates' :: ListTemplates -> Maybe Int
maxItems :: Maybe Int
maxItems} -> Maybe Int
maxItems) (\s :: ListTemplates
s@ListTemplates' {} Maybe Int
a -> ListTemplates
s {maxItems = a} :: ListTemplates)

-- | A token returned from a previous call to @ListTemplates@ to indicate the
-- position in the list of email templates.
listTemplates_nextToken :: Lens.Lens' ListTemplates (Prelude.Maybe Prelude.Text)
listTemplates_nextToken :: Lens' ListTemplates (Maybe Text)
listTemplates_nextToken = (ListTemplates -> Maybe Text)
-> (ListTemplates -> Maybe Text -> ListTemplates)
-> Lens' ListTemplates (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplates' {Maybe Text
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
nextToken :: Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTemplates
s@ListTemplates' {} Maybe Text
a -> ListTemplates
s {nextToken = a} :: ListTemplates)

instance Core.AWSPager ListTemplates where
  page :: ListTemplates -> AWSResponse ListTemplates -> Maybe ListTemplates
page ListTemplates
rq AWSResponse ListTemplates
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTemplates
ListTemplatesResponse
rs
            ListTemplatesResponse
-> Getting (First Text) ListTemplatesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTemplatesResponse
-> Const (First Text) ListTemplatesResponse
Lens' ListTemplatesResponse (Maybe Text)
listTemplatesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListTemplatesResponse
 -> Const (First Text) ListTemplatesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTemplatesResponse 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 (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
Lens._Just
        ) =
        Maybe ListTemplates
forall a. Maybe a
Prelude.Nothing
    | Maybe [TemplateMetadata] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTemplates
ListTemplatesResponse
rs
            ListTemplatesResponse
-> Getting
     (First [TemplateMetadata]) ListTemplatesResponse [TemplateMetadata]
-> Maybe [TemplateMetadata]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [TemplateMetadata]
 -> Const (First [TemplateMetadata]) (Maybe [TemplateMetadata]))
-> ListTemplatesResponse
-> Const (First [TemplateMetadata]) ListTemplatesResponse
Lens' ListTemplatesResponse (Maybe [TemplateMetadata])
listTemplatesResponse_templatesMetadata
            ((Maybe [TemplateMetadata]
  -> Const (First [TemplateMetadata]) (Maybe [TemplateMetadata]))
 -> ListTemplatesResponse
 -> Const (First [TemplateMetadata]) ListTemplatesResponse)
-> (([TemplateMetadata]
     -> Const (First [TemplateMetadata]) [TemplateMetadata])
    -> Maybe [TemplateMetadata]
    -> Const (First [TemplateMetadata]) (Maybe [TemplateMetadata]))
-> Getting
     (First [TemplateMetadata]) ListTemplatesResponse [TemplateMetadata]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TemplateMetadata]
 -> Const (First [TemplateMetadata]) [TemplateMetadata])
-> Maybe [TemplateMetadata]
-> Const (First [TemplateMetadata]) (Maybe [TemplateMetadata])
forall a b (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
Lens._Just
        ) =
        Maybe ListTemplates
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        ListTemplates -> Maybe ListTemplates
forall a. a -> Maybe a
Prelude.Just
          (ListTemplates -> Maybe ListTemplates)
-> ListTemplates -> Maybe ListTemplates
forall a b. (a -> b) -> a -> b
Prelude.$ ListTemplates
rq
          ListTemplates -> (ListTemplates -> ListTemplates) -> ListTemplates
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListTemplates -> Identity ListTemplates
Lens' ListTemplates (Maybe Text)
listTemplates_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListTemplates -> Identity ListTemplates)
-> Maybe Text -> ListTemplates -> ListTemplates
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTemplates
ListTemplatesResponse
rs
          ListTemplatesResponse
-> Getting (First Text) ListTemplatesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTemplatesResponse
-> Const (First Text) ListTemplatesResponse
Lens' ListTemplatesResponse (Maybe Text)
listTemplatesResponse_nextToken
          ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListTemplatesResponse
 -> Const (First Text) ListTemplatesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTemplatesResponse 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 (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p a (f b) -> p (Maybe a) (f (Maybe b))
Lens._Just

instance Core.AWSRequest ListTemplates where
  type
    AWSResponse ListTemplates =
      ListTemplatesResponse
  request :: (Service -> Service) -> ListTemplates -> Request ListTemplates
request Service -> Service
overrides =
    Service -> ListTemplates -> Request ListTemplates
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListTemplates
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTemplates)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListTemplates))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListTemplates
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTemplates)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ListTemplatesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe [TemplateMetadata] -> Int -> ListTemplatesResponse
ListTemplatesResponse'
            (Maybe Text
 -> Maybe [TemplateMetadata] -> Int -> ListTemplatesResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [TemplateMetadata] -> Int -> ListTemplatesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NextToken")
            Either
  String (Maybe [TemplateMetadata] -> Int -> ListTemplatesResponse)
-> Either String (Maybe [TemplateMetadata])
-> Either String (Int -> ListTemplatesResponse)
forall a b.
Either String (a -> b) -> Either String a -> Either String b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                            [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"TemplatesMetadata"
                            Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [TemplateMetadata]))
-> Either String (Maybe [TemplateMetadata])
forall a b.
Either String a -> (a -> Either String b) -> Either String b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [TemplateMetadata])
-> [Node] -> Either String (Maybe [TemplateMetadata])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [TemplateMetadata]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            Either String (Int -> ListTemplatesResponse)
-> Either String Int -> Either String ListTemplatesResponse
forall a b.
Either String (a -> b) -> Either String a -> Either String b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall a. a -> Either String a
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 ListTemplates where
  hashWithSalt :: Int -> ListTemplates -> Int
hashWithSalt Int
_salt ListTemplates' {Maybe Int
Maybe Text
$sel:maxItems:ListTemplates' :: ListTemplates -> Maybe Int
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
maxItems :: Maybe Int
nextToken :: Maybe Text
..} =
    Int
_salt
      Int -> Maybe Int -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxItems
      Int -> Maybe Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData ListTemplates where
  rnf :: ListTemplates -> ()
rnf ListTemplates' {Maybe Int
Maybe Text
$sel:maxItems:ListTemplates' :: ListTemplates -> Maybe Int
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
maxItems :: Maybe Int
nextToken :: Maybe Text
..} =
    Maybe Int -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxItems
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

instance Data.ToHeaders ListTemplates where
  toHeaders :: ListTemplates -> ResponseHeaders
toHeaders = ResponseHeaders -> ListTemplates -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery ListTemplates where
  toQuery :: ListTemplates -> QueryString
toQuery ListTemplates' {Maybe Int
Maybe Text
$sel:maxItems:ListTemplates' :: ListTemplates -> Maybe Int
$sel:nextToken:ListTemplates' :: ListTemplates -> Maybe Text
maxItems :: Maybe Int
nextToken :: Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListTemplates" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"MaxItems" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
maxItems,
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
      ]

-- | /See:/ 'newListTemplatesResponse' smart constructor.
data ListTemplatesResponse = ListTemplatesResponse'
  { -- | A token indicating that there are additional email templates available
    -- to be listed. Pass this token to a subsequent call to @ListTemplates@ to
    -- retrieve the next 50 email templates.
    ListTemplatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array the contains the name and creation time stamp for each template
    -- in your Amazon SES account.
    ListTemplatesResponse -> Maybe [TemplateMetadata]
templatesMetadata :: Prelude.Maybe [TemplateMetadata],
    -- | The response's http status code.
    ListTemplatesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListTemplatesResponse -> ListTemplatesResponse -> Bool
(ListTemplatesResponse -> ListTemplatesResponse -> Bool)
-> (ListTemplatesResponse -> ListTemplatesResponse -> Bool)
-> Eq ListTemplatesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListTemplatesResponse -> ListTemplatesResponse -> Bool
== :: ListTemplatesResponse -> ListTemplatesResponse -> Bool
$c/= :: ListTemplatesResponse -> ListTemplatesResponse -> Bool
/= :: ListTemplatesResponse -> ListTemplatesResponse -> Bool
Prelude.Eq, ReadPrec [ListTemplatesResponse]
ReadPrec ListTemplatesResponse
Int -> ReadS ListTemplatesResponse
ReadS [ListTemplatesResponse]
(Int -> ReadS ListTemplatesResponse)
-> ReadS [ListTemplatesResponse]
-> ReadPrec ListTemplatesResponse
-> ReadPrec [ListTemplatesResponse]
-> Read ListTemplatesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ListTemplatesResponse
readsPrec :: Int -> ReadS ListTemplatesResponse
$creadList :: ReadS [ListTemplatesResponse]
readList :: ReadS [ListTemplatesResponse]
$creadPrec :: ReadPrec ListTemplatesResponse
readPrec :: ReadPrec ListTemplatesResponse
$creadListPrec :: ReadPrec [ListTemplatesResponse]
readListPrec :: ReadPrec [ListTemplatesResponse]
Prelude.Read, Int -> ListTemplatesResponse -> ShowS
[ListTemplatesResponse] -> ShowS
ListTemplatesResponse -> String
(Int -> ListTemplatesResponse -> ShowS)
-> (ListTemplatesResponse -> String)
-> ([ListTemplatesResponse] -> ShowS)
-> Show ListTemplatesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListTemplatesResponse -> ShowS
showsPrec :: Int -> ListTemplatesResponse -> ShowS
$cshow :: ListTemplatesResponse -> String
show :: ListTemplatesResponse -> String
$cshowList :: [ListTemplatesResponse] -> ShowS
showList :: [ListTemplatesResponse] -> ShowS
Prelude.Show, (forall x. ListTemplatesResponse -> Rep ListTemplatesResponse x)
-> (forall x. Rep ListTemplatesResponse x -> ListTemplatesResponse)
-> Generic ListTemplatesResponse
forall x. Rep ListTemplatesResponse x -> ListTemplatesResponse
forall x. ListTemplatesResponse -> Rep ListTemplatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListTemplatesResponse -> Rep ListTemplatesResponse x
from :: forall x. ListTemplatesResponse -> Rep ListTemplatesResponse x
$cto :: forall x. Rep ListTemplatesResponse x -> ListTemplatesResponse
to :: forall x. Rep ListTemplatesResponse x -> ListTemplatesResponse
Prelude.Generic)

-- |
-- Create a value of 'ListTemplatesResponse' 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', 'listTemplatesResponse_nextToken' - A token indicating that there are additional email templates available
-- to be listed. Pass this token to a subsequent call to @ListTemplates@ to
-- retrieve the next 50 email templates.
--
-- 'templatesMetadata', 'listTemplatesResponse_templatesMetadata' - An array the contains the name and creation time stamp for each template
-- in your Amazon SES account.
--
-- 'httpStatus', 'listTemplatesResponse_httpStatus' - The response's http status code.
newListTemplatesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListTemplatesResponse
newListTemplatesResponse :: Int -> ListTemplatesResponse
newListTemplatesResponse Int
pHttpStatus_ =
  ListTemplatesResponse'
    { nextToken :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:templatesMetadata:ListTemplatesResponse' :: Maybe [TemplateMetadata]
templatesMetadata = Maybe [TemplateMetadata]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListTemplatesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A token indicating that there are additional email templates available
-- to be listed. Pass this token to a subsequent call to @ListTemplates@ to
-- retrieve the next 50 email templates.
listTemplatesResponse_nextToken :: Lens.Lens' ListTemplatesResponse (Prelude.Maybe Prelude.Text)
listTemplatesResponse_nextToken :: Lens' ListTemplatesResponse (Maybe Text)
listTemplatesResponse_nextToken = (ListTemplatesResponse -> Maybe Text)
-> (ListTemplatesResponse -> Maybe Text -> ListTemplatesResponse)
-> Lens' ListTemplatesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplatesResponse' {Maybe Text
nextToken :: ListTemplatesResponse -> Maybe Text
nextToken :: Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTemplatesResponse
s@ListTemplatesResponse' {} Maybe Text
a -> ListTemplatesResponse
s {nextToken = a} :: ListTemplatesResponse)

-- | An array the contains the name and creation time stamp for each template
-- in your Amazon SES account.
listTemplatesResponse_templatesMetadata :: Lens.Lens' ListTemplatesResponse (Prelude.Maybe [TemplateMetadata])
listTemplatesResponse_templatesMetadata :: Lens' ListTemplatesResponse (Maybe [TemplateMetadata])
listTemplatesResponse_templatesMetadata = (ListTemplatesResponse -> Maybe [TemplateMetadata])
-> (ListTemplatesResponse
    -> Maybe [TemplateMetadata] -> ListTemplatesResponse)
-> Lens' ListTemplatesResponse (Maybe [TemplateMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTemplatesResponse' {Maybe [TemplateMetadata]
$sel:templatesMetadata:ListTemplatesResponse' :: ListTemplatesResponse -> Maybe [TemplateMetadata]
templatesMetadata :: Maybe [TemplateMetadata]
templatesMetadata} -> Maybe [TemplateMetadata]
templatesMetadata) (\s :: ListTemplatesResponse
s@ListTemplatesResponse' {} Maybe [TemplateMetadata]
a -> ListTemplatesResponse
s {templatesMetadata = a} :: ListTemplatesResponse) ((Maybe [TemplateMetadata] -> f (Maybe [TemplateMetadata]))
 -> ListTemplatesResponse -> f ListTemplatesResponse)
-> ((Maybe [TemplateMetadata] -> f (Maybe [TemplateMetadata]))
    -> Maybe [TemplateMetadata] -> f (Maybe [TemplateMetadata]))
-> (Maybe [TemplateMetadata] -> f (Maybe [TemplateMetadata]))
-> ListTemplatesResponse
-> f ListTemplatesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [TemplateMetadata]
  [TemplateMetadata]
  [TemplateMetadata]
  [TemplateMetadata]
-> Iso
     (Maybe [TemplateMetadata])
     (Maybe [TemplateMetadata])
     (Maybe [TemplateMetadata])
     (Maybe [TemplateMetadata])
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
  [TemplateMetadata]
  [TemplateMetadata]
  [TemplateMetadata]
  [TemplateMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Iso
  [TemplateMetadata]
  [TemplateMetadata]
  [TemplateMetadata]
  [TemplateMetadata]
Lens.coerced

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

instance Prelude.NFData ListTemplatesResponse where
  rnf :: ListTemplatesResponse -> ()
rnf ListTemplatesResponse' {Int
Maybe [TemplateMetadata]
Maybe Text
nextToken :: ListTemplatesResponse -> Maybe Text
$sel:templatesMetadata:ListTemplatesResponse' :: ListTemplatesResponse -> Maybe [TemplateMetadata]
$sel:httpStatus:ListTemplatesResponse' :: ListTemplatesResponse -> Int
nextToken :: Maybe Text
templatesMetadata :: Maybe [TemplateMetadata]
httpStatus :: Int
..} =
    Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe [TemplateMetadata] -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe [TemplateMetadata]
templatesMetadata
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Int -> ()
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus