{-# 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.SESV2.DeleteContactList
-- 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 contact list and all of the contacts on that list.
module Amazonka.SESV2.DeleteContactList
  ( -- * Creating a Request
    DeleteContactList (..),
    newDeleteContactList,

    -- * Request Lenses
    deleteContactList_contactListName,

    -- * Destructuring the Response
    DeleteContactListResponse (..),
    newDeleteContactListResponse,

    -- * Response Lenses
    deleteContactListResponse_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.SESV2.Types

-- | /See:/ 'newDeleteContactList' smart constructor.
data DeleteContactList = DeleteContactList'
  { -- | The name of the contact list.
    DeleteContactList -> Text
contactListName :: Prelude.Text
  }
  deriving (DeleteContactList -> DeleteContactList -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteContactList -> DeleteContactList -> Bool
$c/= :: DeleteContactList -> DeleteContactList -> Bool
== :: DeleteContactList -> DeleteContactList -> Bool
$c== :: DeleteContactList -> DeleteContactList -> Bool
Prelude.Eq, ReadPrec [DeleteContactList]
ReadPrec DeleteContactList
Int -> ReadS DeleteContactList
ReadS [DeleteContactList]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteContactList]
$creadListPrec :: ReadPrec [DeleteContactList]
readPrec :: ReadPrec DeleteContactList
$creadPrec :: ReadPrec DeleteContactList
readList :: ReadS [DeleteContactList]
$creadList :: ReadS [DeleteContactList]
readsPrec :: Int -> ReadS DeleteContactList
$creadsPrec :: Int -> ReadS DeleteContactList
Prelude.Read, Int -> DeleteContactList -> ShowS
[DeleteContactList] -> ShowS
DeleteContactList -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteContactList] -> ShowS
$cshowList :: [DeleteContactList] -> ShowS
show :: DeleteContactList -> String
$cshow :: DeleteContactList -> String
showsPrec :: Int -> DeleteContactList -> ShowS
$cshowsPrec :: Int -> DeleteContactList -> ShowS
Prelude.Show, forall x. Rep DeleteContactList x -> DeleteContactList
forall x. DeleteContactList -> Rep DeleteContactList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteContactList x -> DeleteContactList
$cfrom :: forall x. DeleteContactList -> Rep DeleteContactList x
Prelude.Generic)

-- |
-- Create a value of 'DeleteContactList' 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:
--
-- 'contactListName', 'deleteContactList_contactListName' - The name of the contact list.
newDeleteContactList ::
  -- | 'contactListName'
  Prelude.Text ->
  DeleteContactList
newDeleteContactList :: Text -> DeleteContactList
newDeleteContactList Text
pContactListName_ =
  DeleteContactList'
    { $sel:contactListName:DeleteContactList' :: Text
contactListName =
        Text
pContactListName_
    }

-- | The name of the contact list.
deleteContactList_contactListName :: Lens.Lens' DeleteContactList Prelude.Text
deleteContactList_contactListName :: Lens' DeleteContactList Text
deleteContactList_contactListName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteContactList' {Text
contactListName :: Text
$sel:contactListName:DeleteContactList' :: DeleteContactList -> Text
contactListName} -> Text
contactListName) (\s :: DeleteContactList
s@DeleteContactList' {} Text
a -> DeleteContactList
s {$sel:contactListName:DeleteContactList' :: Text
contactListName = Text
a} :: DeleteContactList)

instance Core.AWSRequest DeleteContactList where
  type
    AWSResponse DeleteContactList =
      DeleteContactListResponse
  request :: (Service -> Service)
-> DeleteContactList -> Request DeleteContactList
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 DeleteContactList
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContactList)))
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 -> DeleteContactListResponse
DeleteContactListResponse'
            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 DeleteContactList where
  hashWithSalt :: Int -> DeleteContactList -> Int
hashWithSalt Int
_salt DeleteContactList' {Text
contactListName :: Text
$sel:contactListName:DeleteContactList' :: DeleteContactList -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactListName

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

instance Data.ToHeaders DeleteContactList where
  toHeaders :: DeleteContactList -> 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 DeleteContactList where
  toPath :: DeleteContactList -> ByteString
toPath DeleteContactList' {Text
contactListName :: Text
$sel:contactListName:DeleteContactList' :: DeleteContactList -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v2/email/contact-lists/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
contactListName
      ]

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

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

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

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

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