{-# 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.DeleteTemplate
-- 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)
--
-- Deletes an email template.
--
-- You can execute this operation no more than once per second.
module Amazonka.SES.DeleteTemplate
  ( -- * Creating a Request
    DeleteTemplate (..),
    newDeleteTemplate,

    -- * Request Lenses
    deleteTemplate_templateName,

    -- * Destructuring the Response
    DeleteTemplateResponse (..),
    newDeleteTemplateResponse,

    -- * Response Lenses
    deleteTemplateResponse_httpStatus,
  )
where

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

-- | Represents a request to delete an email template. For more information,
-- see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-personalized-email-api.html Amazon SES Developer Guide>.
--
-- /See:/ 'newDeleteTemplate' smart constructor.
data DeleteTemplate = DeleteTemplate'
  { -- | The name of the template to be deleted.
    DeleteTemplate -> Text
templateName :: Prelude.Text
  }
  deriving (DeleteTemplate -> DeleteTemplate -> Bool
(DeleteTemplate -> DeleteTemplate -> Bool)
-> (DeleteTemplate -> DeleteTemplate -> Bool) -> Eq DeleteTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTemplate -> DeleteTemplate -> Bool
$c/= :: DeleteTemplate -> DeleteTemplate -> Bool
== :: DeleteTemplate -> DeleteTemplate -> Bool
$c== :: DeleteTemplate -> DeleteTemplate -> Bool
Prelude.Eq, ReadPrec [DeleteTemplate]
ReadPrec DeleteTemplate
Int -> ReadS DeleteTemplate
ReadS [DeleteTemplate]
(Int -> ReadS DeleteTemplate)
-> ReadS [DeleteTemplate]
-> ReadPrec DeleteTemplate
-> ReadPrec [DeleteTemplate]
-> Read DeleteTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTemplate]
$creadListPrec :: ReadPrec [DeleteTemplate]
readPrec :: ReadPrec DeleteTemplate
$creadPrec :: ReadPrec DeleteTemplate
readList :: ReadS [DeleteTemplate]
$creadList :: ReadS [DeleteTemplate]
readsPrec :: Int -> ReadS DeleteTemplate
$creadsPrec :: Int -> ReadS DeleteTemplate
Prelude.Read, Int -> DeleteTemplate -> ShowS
[DeleteTemplate] -> ShowS
DeleteTemplate -> String
(Int -> DeleteTemplate -> ShowS)
-> (DeleteTemplate -> String)
-> ([DeleteTemplate] -> ShowS)
-> Show DeleteTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTemplate] -> ShowS
$cshowList :: [DeleteTemplate] -> ShowS
show :: DeleteTemplate -> String
$cshow :: DeleteTemplate -> String
showsPrec :: Int -> DeleteTemplate -> ShowS
$cshowsPrec :: Int -> DeleteTemplate -> ShowS
Prelude.Show, (forall x. DeleteTemplate -> Rep DeleteTemplate x)
-> (forall x. Rep DeleteTemplate x -> DeleteTemplate)
-> Generic DeleteTemplate
forall x. Rep DeleteTemplate x -> DeleteTemplate
forall x. DeleteTemplate -> Rep DeleteTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTemplate x -> DeleteTemplate
$cfrom :: forall x. DeleteTemplate -> Rep DeleteTemplate x
Prelude.Generic)

-- |
-- Create a value of 'DeleteTemplate' 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:
--
-- 'templateName', 'deleteTemplate_templateName' - The name of the template to be deleted.
newDeleteTemplate ::
  -- | 'templateName'
  Prelude.Text ->
  DeleteTemplate
newDeleteTemplate :: Text -> DeleteTemplate
newDeleteTemplate Text
pTemplateName_ =
  DeleteTemplate' :: Text -> DeleteTemplate
DeleteTemplate' {$sel:templateName:DeleteTemplate' :: Text
templateName = Text
pTemplateName_}

-- | The name of the template to be deleted.
deleteTemplate_templateName :: Lens.Lens' DeleteTemplate Prelude.Text
deleteTemplate_templateName :: (Text -> f Text) -> DeleteTemplate -> f DeleteTemplate
deleteTemplate_templateName = (DeleteTemplate -> Text)
-> (DeleteTemplate -> Text -> DeleteTemplate)
-> Lens DeleteTemplate DeleteTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTemplate' {Text
templateName :: Text
$sel:templateName:DeleteTemplate' :: DeleteTemplate -> Text
templateName} -> Text
templateName) (\s :: DeleteTemplate
s@DeleteTemplate' {} Text
a -> DeleteTemplate
s {$sel:templateName:DeleteTemplate' :: Text
templateName = Text
a} :: DeleteTemplate)

instance Core.AWSRequest DeleteTemplate where
  type
    AWSResponse DeleteTemplate =
      DeleteTemplateResponse
  request :: DeleteTemplate -> Request DeleteTemplate
request = Service -> DeleteTemplate -> Request DeleteTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTemplate)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteTemplate))
-> Logger
-> Service
-> Proxy DeleteTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTemplate)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeleteTemplateResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeleteTemplateResponse
DeleteTemplateResponse'
            (Int -> DeleteTemplateResponse)
-> Either String Int -> Either String DeleteTemplateResponse
forall (f :: * -> *) a b. Functor 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 DeleteTemplate

instance Prelude.NFData DeleteTemplate

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

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

instance Core.ToQuery DeleteTemplate where
  toQuery :: DeleteTemplate -> QueryString
toQuery DeleteTemplate' {Text
templateName :: Text
$sel:templateName:DeleteTemplate' :: DeleteTemplate -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteTemplate" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"TemplateName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
templateName
      ]

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

-- |
-- Create a value of 'DeleteTemplateResponse' 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:
--
-- 'httpStatus', 'deleteTemplateResponse_httpStatus' - The response's http status code.
newDeleteTemplateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteTemplateResponse
newDeleteTemplateResponse :: Int -> DeleteTemplateResponse
newDeleteTemplateResponse Int
pHttpStatus_ =
  DeleteTemplateResponse' :: Int -> DeleteTemplateResponse
DeleteTemplateResponse' {$sel:httpStatus:DeleteTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteTemplateResponse