{-# 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.PinpointEmail.DeleteConfigurationSet
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete an existing configuration set.
--
-- In Amazon Pinpoint, /configuration sets/ are groups of rules that you
-- can apply to the emails you send. You apply a configuration set to an
-- email by including a reference to the configuration set in the headers
-- of the email. When you apply a configuration set to an email, all of the
-- rules in that configuration set are applied to the email.
module Amazonka.PinpointEmail.DeleteConfigurationSet
  ( -- * Creating a Request
    DeleteConfigurationSet (..),
    newDeleteConfigurationSet,

    -- * Request Lenses
    deleteConfigurationSet_configurationSetName,

    -- * Destructuring the Response
    DeleteConfigurationSetResponse (..),
    newDeleteConfigurationSetResponse,

    -- * Response Lenses
    deleteConfigurationSetResponse_httpStatus,
  )
where

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

-- | A request to delete a configuration set.
--
-- /See:/ 'newDeleteConfigurationSet' smart constructor.
data DeleteConfigurationSet = DeleteConfigurationSet'
  { -- | The name of the configuration set that you want to delete.
    DeleteConfigurationSet -> Text
configurationSetName :: Prelude.Text
  }
  deriving (DeleteConfigurationSet -> DeleteConfigurationSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConfigurationSet -> DeleteConfigurationSet -> Bool
$c/= :: DeleteConfigurationSet -> DeleteConfigurationSet -> Bool
== :: DeleteConfigurationSet -> DeleteConfigurationSet -> Bool
$c== :: DeleteConfigurationSet -> DeleteConfigurationSet -> Bool
Prelude.Eq, ReadPrec [DeleteConfigurationSet]
ReadPrec DeleteConfigurationSet
Int -> ReadS DeleteConfigurationSet
ReadS [DeleteConfigurationSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConfigurationSet]
$creadListPrec :: ReadPrec [DeleteConfigurationSet]
readPrec :: ReadPrec DeleteConfigurationSet
$creadPrec :: ReadPrec DeleteConfigurationSet
readList :: ReadS [DeleteConfigurationSet]
$creadList :: ReadS [DeleteConfigurationSet]
readsPrec :: Int -> ReadS DeleteConfigurationSet
$creadsPrec :: Int -> ReadS DeleteConfigurationSet
Prelude.Read, Int -> DeleteConfigurationSet -> ShowS
[DeleteConfigurationSet] -> ShowS
DeleteConfigurationSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConfigurationSet] -> ShowS
$cshowList :: [DeleteConfigurationSet] -> ShowS
show :: DeleteConfigurationSet -> String
$cshow :: DeleteConfigurationSet -> String
showsPrec :: Int -> DeleteConfigurationSet -> ShowS
$cshowsPrec :: Int -> DeleteConfigurationSet -> ShowS
Prelude.Show, forall x. Rep DeleteConfigurationSet x -> DeleteConfigurationSet
forall x. DeleteConfigurationSet -> Rep DeleteConfigurationSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteConfigurationSet x -> DeleteConfigurationSet
$cfrom :: forall x. DeleteConfigurationSet -> Rep DeleteConfigurationSet x
Prelude.Generic)

-- |
-- Create a value of 'DeleteConfigurationSet' 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:
--
-- 'configurationSetName', 'deleteConfigurationSet_configurationSetName' - The name of the configuration set that you want to delete.
newDeleteConfigurationSet ::
  -- | 'configurationSetName'
  Prelude.Text ->
  DeleteConfigurationSet
newDeleteConfigurationSet :: Text -> DeleteConfigurationSet
newDeleteConfigurationSet Text
pConfigurationSetName_ =
  DeleteConfigurationSet'
    { $sel:configurationSetName:DeleteConfigurationSet' :: Text
configurationSetName =
        Text
pConfigurationSetName_
    }

-- | The name of the configuration set that you want to delete.
deleteConfigurationSet_configurationSetName :: Lens.Lens' DeleteConfigurationSet Prelude.Text
deleteConfigurationSet_configurationSetName :: Lens' DeleteConfigurationSet Text
deleteConfigurationSet_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConfigurationSet' {Text
configurationSetName :: Text
$sel:configurationSetName:DeleteConfigurationSet' :: DeleteConfigurationSet -> Text
configurationSetName} -> Text
configurationSetName) (\s :: DeleteConfigurationSet
s@DeleteConfigurationSet' {} Text
a -> DeleteConfigurationSet
s {$sel:configurationSetName:DeleteConfigurationSet' :: Text
configurationSetName = Text
a} :: DeleteConfigurationSet)

instance Core.AWSRequest DeleteConfigurationSet where
  type
    AWSResponse DeleteConfigurationSet =
      DeleteConfigurationSetResponse
  request :: (Service -> Service)
-> DeleteConfigurationSet -> Request DeleteConfigurationSet
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 DeleteConfigurationSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteConfigurationSet)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteConfigurationSetResponse
DeleteConfigurationSetResponse'
            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))
      )

instance Prelude.Hashable DeleteConfigurationSet where
  hashWithSalt :: Int -> DeleteConfigurationSet -> Int
hashWithSalt Int
_salt DeleteConfigurationSet' {Text
configurationSetName :: Text
$sel:configurationSetName:DeleteConfigurationSet' :: DeleteConfigurationSet -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
configurationSetName

instance Prelude.NFData DeleteConfigurationSet where
  rnf :: DeleteConfigurationSet -> ()
rnf DeleteConfigurationSet' {Text
configurationSetName :: Text
$sel:configurationSetName:DeleteConfigurationSet' :: DeleteConfigurationSet -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
configurationSetName

instance Data.ToHeaders DeleteConfigurationSet where
  toHeaders :: DeleteConfigurationSet -> 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 DeleteConfigurationSet where
  toPath :: DeleteConfigurationSet -> ByteString
toPath DeleteConfigurationSet' {Text
configurationSetName :: Text
$sel:configurationSetName:DeleteConfigurationSet' :: DeleteConfigurationSet -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/email/configuration-sets/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
configurationSetName
      ]

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

-- | An HTTP 200 response if the request succeeds, or an error message if the
-- request fails.
--
-- /See:/ 'newDeleteConfigurationSetResponse' smart constructor.
data DeleteConfigurationSetResponse = DeleteConfigurationSetResponse'
  { -- | The response's http status code.
    DeleteConfigurationSetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteConfigurationSetResponse
-> DeleteConfigurationSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConfigurationSetResponse
-> DeleteConfigurationSetResponse -> Bool
$c/= :: DeleteConfigurationSetResponse
-> DeleteConfigurationSetResponse -> Bool
== :: DeleteConfigurationSetResponse
-> DeleteConfigurationSetResponse -> Bool
$c== :: DeleteConfigurationSetResponse
-> DeleteConfigurationSetResponse -> Bool
Prelude.Eq, ReadPrec [DeleteConfigurationSetResponse]
ReadPrec DeleteConfigurationSetResponse
Int -> ReadS DeleteConfigurationSetResponse
ReadS [DeleteConfigurationSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConfigurationSetResponse]
$creadListPrec :: ReadPrec [DeleteConfigurationSetResponse]
readPrec :: ReadPrec DeleteConfigurationSetResponse
$creadPrec :: ReadPrec DeleteConfigurationSetResponse
readList :: ReadS [DeleteConfigurationSetResponse]
$creadList :: ReadS [DeleteConfigurationSetResponse]
readsPrec :: Int -> ReadS DeleteConfigurationSetResponse
$creadsPrec :: Int -> ReadS DeleteConfigurationSetResponse
Prelude.Read, Int -> DeleteConfigurationSetResponse -> ShowS
[DeleteConfigurationSetResponse] -> ShowS
DeleteConfigurationSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConfigurationSetResponse] -> ShowS
$cshowList :: [DeleteConfigurationSetResponse] -> ShowS
show :: DeleteConfigurationSetResponse -> String
$cshow :: DeleteConfigurationSetResponse -> String
showsPrec :: Int -> DeleteConfigurationSetResponse -> ShowS
$cshowsPrec :: Int -> DeleteConfigurationSetResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteConfigurationSetResponse x
-> DeleteConfigurationSetResponse
forall x.
DeleteConfigurationSetResponse
-> Rep DeleteConfigurationSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteConfigurationSetResponse x
-> DeleteConfigurationSetResponse
$cfrom :: forall x.
DeleteConfigurationSetResponse
-> Rep DeleteConfigurationSetResponse x
Prelude.Generic)

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

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

instance
  Prelude.NFData
    DeleteConfigurationSetResponse
  where
  rnf :: DeleteConfigurationSetResponse -> ()
rnf DeleteConfigurationSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteConfigurationSetResponse' :: DeleteConfigurationSetResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus