{-# 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-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 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.Lens as Lens
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
(DeleteContactList -> DeleteContactList -> Bool)
-> (DeleteContactList -> DeleteContactList -> Bool)
-> Eq DeleteContactList
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]
(Int -> ReadS DeleteContactList)
-> ReadS [DeleteContactList]
-> ReadPrec DeleteContactList
-> ReadPrec [DeleteContactList]
-> Read 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
(Int -> DeleteContactList -> ShowS)
-> (DeleteContactList -> String)
-> ([DeleteContactList] -> ShowS)
-> Show DeleteContactList
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. DeleteContactList -> Rep DeleteContactList x)
-> (forall x. Rep DeleteContactList x -> DeleteContactList)
-> Generic DeleteContactList
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' :: Text -> DeleteContactList
DeleteContactList'
    { $sel:contactListName:DeleteContactList' :: Text
contactListName =
        Text
pContactListName_
    }

-- | The name of the contact list.
deleteContactList_contactListName :: Lens.Lens' DeleteContactList Prelude.Text
deleteContactList_contactListName :: (Text -> f Text) -> DeleteContactList -> f DeleteContactList
deleteContactList_contactListName = (DeleteContactList -> Text)
-> (DeleteContactList -> Text -> DeleteContactList)
-> Lens DeleteContactList DeleteContactList Text Text
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 :: DeleteContactList -> Request DeleteContactList
request = Service -> DeleteContactList -> Request DeleteContactList
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteContactList
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContactList)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteContactList))
-> Logger
-> Service
-> Proxy DeleteContactList
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContactList)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteContactListResponse
DeleteContactListResponse'
            (Int -> DeleteContactListResponse)
-> Either String Int -> Either String DeleteContactListResponse
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 DeleteContactList

instance Prelude.NFData DeleteContactList

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

instance Core.ToPath DeleteContactList where
  toPath :: DeleteContactList -> ByteString
toPath DeleteContactList' {Text
contactListName :: Text
$sel:contactListName:DeleteContactList' :: DeleteContactList -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v2/email/contact-lists/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
contactListName
      ]

instance Core.ToQuery DeleteContactList where
  toQuery :: DeleteContactList -> QueryString
toQuery = QueryString -> DeleteContactList -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteContactListResponse -> DeleteContactListResponse -> Bool)
-> (DeleteContactListResponse -> DeleteContactListResponse -> Bool)
-> Eq DeleteContactListResponse
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]
(Int -> ReadS DeleteContactListResponse)
-> ReadS [DeleteContactListResponse]
-> ReadPrec DeleteContactListResponse
-> ReadPrec [DeleteContactListResponse]
-> Read 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
(Int -> DeleteContactListResponse -> ShowS)
-> (DeleteContactListResponse -> String)
-> ([DeleteContactListResponse] -> ShowS)
-> Show DeleteContactListResponse
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.
 DeleteContactListResponse -> Rep DeleteContactListResponse x)
-> (forall x.
    Rep DeleteContactListResponse x -> DeleteContactListResponse)
-> Generic DeleteContactListResponse
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' :: Int -> DeleteContactListResponse
DeleteContactListResponse'
    { $sel:httpStatus:DeleteContactListResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteContactListResponse_httpStatus :: Lens.Lens' DeleteContactListResponse Prelude.Int
deleteContactListResponse_httpStatus :: (Int -> f Int)
-> DeleteContactListResponse -> f DeleteContactListResponse
deleteContactListResponse_httpStatus = (DeleteContactListResponse -> Int)
-> (DeleteContactListResponse -> Int -> DeleteContactListResponse)
-> Lens DeleteContactListResponse DeleteContactListResponse Int Int
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