{-# 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.Pinpoint.DeleteVoiceTemplate
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a message template for messages that were sent through the voice
-- channel.
module Amazonka.Pinpoint.DeleteVoiceTemplate
  ( -- * Creating a Request
    DeleteVoiceTemplate (..),
    newDeleteVoiceTemplate,

    -- * Request Lenses
    deleteVoiceTemplate_version,
    deleteVoiceTemplate_templateName,

    -- * Destructuring the Response
    DeleteVoiceTemplateResponse (..),
    newDeleteVoiceTemplateResponse,

    -- * Response Lenses
    deleteVoiceTemplateResponse_httpStatus,
    deleteVoiceTemplateResponse_messageBody,
  )
where

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

-- | /See:/ 'newDeleteVoiceTemplate' smart constructor.
data DeleteVoiceTemplate = DeleteVoiceTemplate'
  { -- | The unique identifier for the version of the message template to update,
    -- retrieve information about, or delete. To retrieve identifiers and other
    -- information for all the versions of a template, use the Template
    -- Versions resource.
    --
    -- If specified, this value must match the identifier for an existing
    -- template version. If specified for an update operation, this value must
    -- match the identifier for the latest existing version of the template.
    -- This restriction helps ensure that race conditions don\'t occur.
    --
    -- If you don\'t specify a value for this parameter, Amazon Pinpoint does
    -- the following:
    --
    -- -   For a get operation, retrieves information about the active version
    --     of the template.
    --
    -- -   For an update operation, saves the updates to (overwrites) the
    --     latest existing version of the template, if the create-new-version
    --     parameter isn\'t used or is set to false.
    --
    -- -   For a delete operation, deletes the template, including all versions
    --     of the template.
    DeleteVoiceTemplate -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The name of the message template. A template name must start with an
    -- alphanumeric character and can contain a maximum of 128 characters. The
    -- characters can be alphanumeric characters, underscores (_), or hyphens
    -- (-). Template names are case sensitive.
    DeleteVoiceTemplate -> Text
templateName :: Prelude.Text
  }
  deriving (DeleteVoiceTemplate -> DeleteVoiceTemplate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVoiceTemplate -> DeleteVoiceTemplate -> Bool
$c/= :: DeleteVoiceTemplate -> DeleteVoiceTemplate -> Bool
== :: DeleteVoiceTemplate -> DeleteVoiceTemplate -> Bool
$c== :: DeleteVoiceTemplate -> DeleteVoiceTemplate -> Bool
Prelude.Eq, ReadPrec [DeleteVoiceTemplate]
ReadPrec DeleteVoiceTemplate
Int -> ReadS DeleteVoiceTemplate
ReadS [DeleteVoiceTemplate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVoiceTemplate]
$creadListPrec :: ReadPrec [DeleteVoiceTemplate]
readPrec :: ReadPrec DeleteVoiceTemplate
$creadPrec :: ReadPrec DeleteVoiceTemplate
readList :: ReadS [DeleteVoiceTemplate]
$creadList :: ReadS [DeleteVoiceTemplate]
readsPrec :: Int -> ReadS DeleteVoiceTemplate
$creadsPrec :: Int -> ReadS DeleteVoiceTemplate
Prelude.Read, Int -> DeleteVoiceTemplate -> ShowS
[DeleteVoiceTemplate] -> ShowS
DeleteVoiceTemplate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVoiceTemplate] -> ShowS
$cshowList :: [DeleteVoiceTemplate] -> ShowS
show :: DeleteVoiceTemplate -> String
$cshow :: DeleteVoiceTemplate -> String
showsPrec :: Int -> DeleteVoiceTemplate -> ShowS
$cshowsPrec :: Int -> DeleteVoiceTemplate -> ShowS
Prelude.Show, forall x. Rep DeleteVoiceTemplate x -> DeleteVoiceTemplate
forall x. DeleteVoiceTemplate -> Rep DeleteVoiceTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteVoiceTemplate x -> DeleteVoiceTemplate
$cfrom :: forall x. DeleteVoiceTemplate -> Rep DeleteVoiceTemplate x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVoiceTemplate' 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:
--
-- 'version', 'deleteVoiceTemplate_version' - The unique identifier for the version of the message template to update,
-- retrieve information about, or delete. To retrieve identifiers and other
-- information for all the versions of a template, use the Template
-- Versions resource.
--
-- If specified, this value must match the identifier for an existing
-- template version. If specified for an update operation, this value must
-- match the identifier for the latest existing version of the template.
-- This restriction helps ensure that race conditions don\'t occur.
--
-- If you don\'t specify a value for this parameter, Amazon Pinpoint does
-- the following:
--
-- -   For a get operation, retrieves information about the active version
--     of the template.
--
-- -   For an update operation, saves the updates to (overwrites) the
--     latest existing version of the template, if the create-new-version
--     parameter isn\'t used or is set to false.
--
-- -   For a delete operation, deletes the template, including all versions
--     of the template.
--
-- 'templateName', 'deleteVoiceTemplate_templateName' - The name of the message template. A template name must start with an
-- alphanumeric character and can contain a maximum of 128 characters. The
-- characters can be alphanumeric characters, underscores (_), or hyphens
-- (-). Template names are case sensitive.
newDeleteVoiceTemplate ::
  -- | 'templateName'
  Prelude.Text ->
  DeleteVoiceTemplate
newDeleteVoiceTemplate :: Text -> DeleteVoiceTemplate
newDeleteVoiceTemplate Text
pTemplateName_ =
  DeleteVoiceTemplate'
    { $sel:version:DeleteVoiceTemplate' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing,
      $sel:templateName:DeleteVoiceTemplate' :: Text
templateName = Text
pTemplateName_
    }

-- | The unique identifier for the version of the message template to update,
-- retrieve information about, or delete. To retrieve identifiers and other
-- information for all the versions of a template, use the Template
-- Versions resource.
--
-- If specified, this value must match the identifier for an existing
-- template version. If specified for an update operation, this value must
-- match the identifier for the latest existing version of the template.
-- This restriction helps ensure that race conditions don\'t occur.
--
-- If you don\'t specify a value for this parameter, Amazon Pinpoint does
-- the following:
--
-- -   For a get operation, retrieves information about the active version
--     of the template.
--
-- -   For an update operation, saves the updates to (overwrites) the
--     latest existing version of the template, if the create-new-version
--     parameter isn\'t used or is set to false.
--
-- -   For a delete operation, deletes the template, including all versions
--     of the template.
deleteVoiceTemplate_version :: Lens.Lens' DeleteVoiceTemplate (Prelude.Maybe Prelude.Text)
deleteVoiceTemplate_version :: Lens' DeleteVoiceTemplate (Maybe Text)
deleteVoiceTemplate_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVoiceTemplate' {Maybe Text
version :: Maybe Text
$sel:version:DeleteVoiceTemplate' :: DeleteVoiceTemplate -> Maybe Text
version} -> Maybe Text
version) (\s :: DeleteVoiceTemplate
s@DeleteVoiceTemplate' {} Maybe Text
a -> DeleteVoiceTemplate
s {$sel:version:DeleteVoiceTemplate' :: Maybe Text
version = Maybe Text
a} :: DeleteVoiceTemplate)

-- | The name of the message template. A template name must start with an
-- alphanumeric character and can contain a maximum of 128 characters. The
-- characters can be alphanumeric characters, underscores (_), or hyphens
-- (-). Template names are case sensitive.
deleteVoiceTemplate_templateName :: Lens.Lens' DeleteVoiceTemplate Prelude.Text
deleteVoiceTemplate_templateName :: Lens' DeleteVoiceTemplate Text
deleteVoiceTemplate_templateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVoiceTemplate' {Text
templateName :: Text
$sel:templateName:DeleteVoiceTemplate' :: DeleteVoiceTemplate -> Text
templateName} -> Text
templateName) (\s :: DeleteVoiceTemplate
s@DeleteVoiceTemplate' {} Text
a -> DeleteVoiceTemplate
s {$sel:templateName:DeleteVoiceTemplate' :: Text
templateName = Text
a} :: DeleteVoiceTemplate)

instance Core.AWSRequest DeleteVoiceTemplate where
  type
    AWSResponse DeleteVoiceTemplate =
      DeleteVoiceTemplateResponse
  request :: (Service -> Service)
-> DeleteVoiceTemplate -> Request DeleteVoiceTemplate
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteVoiceTemplate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteVoiceTemplate)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> MessageBody -> DeleteVoiceTemplateResponse
DeleteVoiceTemplateResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
      )

instance Prelude.Hashable DeleteVoiceTemplate where
  hashWithSalt :: Int -> DeleteVoiceTemplate -> Int
hashWithSalt Int
_salt DeleteVoiceTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:DeleteVoiceTemplate' :: DeleteVoiceTemplate -> Text
$sel:version:DeleteVoiceTemplate' :: DeleteVoiceTemplate -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
templateName

instance Prelude.NFData DeleteVoiceTemplate where
  rnf :: DeleteVoiceTemplate -> ()
rnf DeleteVoiceTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:DeleteVoiceTemplate' :: DeleteVoiceTemplate -> Text
$sel:version:DeleteVoiceTemplate' :: DeleteVoiceTemplate -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
templateName

instance Data.ToHeaders DeleteVoiceTemplate where
  toHeaders :: DeleteVoiceTemplate -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteVoiceTemplate where
  toPath :: DeleteVoiceTemplate -> ByteString
toPath DeleteVoiceTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:DeleteVoiceTemplate' :: DeleteVoiceTemplate -> Text
$sel:version:DeleteVoiceTemplate' :: DeleteVoiceTemplate -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/templates/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
templateName, ByteString
"/voice"]

instance Data.ToQuery DeleteVoiceTemplate where
  toQuery :: DeleteVoiceTemplate -> QueryString
toQuery DeleteVoiceTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:DeleteVoiceTemplate' :: DeleteVoiceTemplate -> Text
$sel:version:DeleteVoiceTemplate' :: DeleteVoiceTemplate -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"version" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
version]

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

-- |
-- Create a value of 'DeleteVoiceTemplateResponse' 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', 'deleteVoiceTemplateResponse_httpStatus' - The response's http status code.
--
-- 'messageBody', 'deleteVoiceTemplateResponse_messageBody' - Undocumented member.
newDeleteVoiceTemplateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'messageBody'
  MessageBody ->
  DeleteVoiceTemplateResponse
newDeleteVoiceTemplateResponse :: Int -> MessageBody -> DeleteVoiceTemplateResponse
newDeleteVoiceTemplateResponse
  Int
pHttpStatus_
  MessageBody
pMessageBody_ =
    DeleteVoiceTemplateResponse'
      { $sel:httpStatus:DeleteVoiceTemplateResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:messageBody:DeleteVoiceTemplateResponse' :: MessageBody
messageBody = MessageBody
pMessageBody_
      }

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

-- | Undocumented member.
deleteVoiceTemplateResponse_messageBody :: Lens.Lens' DeleteVoiceTemplateResponse MessageBody
deleteVoiceTemplateResponse_messageBody :: Lens' DeleteVoiceTemplateResponse MessageBody
deleteVoiceTemplateResponse_messageBody = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVoiceTemplateResponse' {MessageBody
messageBody :: MessageBody
$sel:messageBody:DeleteVoiceTemplateResponse' :: DeleteVoiceTemplateResponse -> MessageBody
messageBody} -> MessageBody
messageBody) (\s :: DeleteVoiceTemplateResponse
s@DeleteVoiceTemplateResponse' {} MessageBody
a -> DeleteVoiceTemplateResponse
s {$sel:messageBody:DeleteVoiceTemplateResponse' :: MessageBody
messageBody = MessageBody
a} :: DeleteVoiceTemplateResponse)

instance Prelude.NFData DeleteVoiceTemplateResponse where
  rnf :: DeleteVoiceTemplateResponse -> ()
rnf DeleteVoiceTemplateResponse' {Int
MessageBody
messageBody :: MessageBody
httpStatus :: Int
$sel:messageBody:DeleteVoiceTemplateResponse' :: DeleteVoiceTemplateResponse -> MessageBody
$sel:httpStatus:DeleteVoiceTemplateResponse' :: DeleteVoiceTemplateResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MessageBody
messageBody