{-# 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.DeleteDedicatedIpPool
-- 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 a dedicated IP pool.
module Amazonka.PinpointEmail.DeleteDedicatedIpPool
  ( -- * Creating a Request
    DeleteDedicatedIpPool (..),
    newDeleteDedicatedIpPool,

    -- * Request Lenses
    deleteDedicatedIpPool_poolName,

    -- * Destructuring the Response
    DeleteDedicatedIpPoolResponse (..),
    newDeleteDedicatedIpPoolResponse,

    -- * Response Lenses
    deleteDedicatedIpPoolResponse_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 dedicated IP pool.
--
-- /See:/ 'newDeleteDedicatedIpPool' smart constructor.
data DeleteDedicatedIpPool = DeleteDedicatedIpPool'
  { -- | The name of the dedicated IP pool that you want to delete.
    DeleteDedicatedIpPool -> Text
poolName :: Prelude.Text
  }
  deriving (DeleteDedicatedIpPool -> DeleteDedicatedIpPool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDedicatedIpPool -> DeleteDedicatedIpPool -> Bool
$c/= :: DeleteDedicatedIpPool -> DeleteDedicatedIpPool -> Bool
== :: DeleteDedicatedIpPool -> DeleteDedicatedIpPool -> Bool
$c== :: DeleteDedicatedIpPool -> DeleteDedicatedIpPool -> Bool
Prelude.Eq, ReadPrec [DeleteDedicatedIpPool]
ReadPrec DeleteDedicatedIpPool
Int -> ReadS DeleteDedicatedIpPool
ReadS [DeleteDedicatedIpPool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDedicatedIpPool]
$creadListPrec :: ReadPrec [DeleteDedicatedIpPool]
readPrec :: ReadPrec DeleteDedicatedIpPool
$creadPrec :: ReadPrec DeleteDedicatedIpPool
readList :: ReadS [DeleteDedicatedIpPool]
$creadList :: ReadS [DeleteDedicatedIpPool]
readsPrec :: Int -> ReadS DeleteDedicatedIpPool
$creadsPrec :: Int -> ReadS DeleteDedicatedIpPool
Prelude.Read, Int -> DeleteDedicatedIpPool -> ShowS
[DeleteDedicatedIpPool] -> ShowS
DeleteDedicatedIpPool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDedicatedIpPool] -> ShowS
$cshowList :: [DeleteDedicatedIpPool] -> ShowS
show :: DeleteDedicatedIpPool -> String
$cshow :: DeleteDedicatedIpPool -> String
showsPrec :: Int -> DeleteDedicatedIpPool -> ShowS
$cshowsPrec :: Int -> DeleteDedicatedIpPool -> ShowS
Prelude.Show, forall x. Rep DeleteDedicatedIpPool x -> DeleteDedicatedIpPool
forall x. DeleteDedicatedIpPool -> Rep DeleteDedicatedIpPool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDedicatedIpPool x -> DeleteDedicatedIpPool
$cfrom :: forall x. DeleteDedicatedIpPool -> Rep DeleteDedicatedIpPool x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDedicatedIpPool' 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:
--
-- 'poolName', 'deleteDedicatedIpPool_poolName' - The name of the dedicated IP pool that you want to delete.
newDeleteDedicatedIpPool ::
  -- | 'poolName'
  Prelude.Text ->
  DeleteDedicatedIpPool
newDeleteDedicatedIpPool :: Text -> DeleteDedicatedIpPool
newDeleteDedicatedIpPool Text
pPoolName_ =
  DeleteDedicatedIpPool' {$sel:poolName:DeleteDedicatedIpPool' :: Text
poolName = Text
pPoolName_}

-- | The name of the dedicated IP pool that you want to delete.
deleteDedicatedIpPool_poolName :: Lens.Lens' DeleteDedicatedIpPool Prelude.Text
deleteDedicatedIpPool_poolName :: Lens' DeleteDedicatedIpPool Text
deleteDedicatedIpPool_poolName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDedicatedIpPool' {Text
poolName :: Text
$sel:poolName:DeleteDedicatedIpPool' :: DeleteDedicatedIpPool -> Text
poolName} -> Text
poolName) (\s :: DeleteDedicatedIpPool
s@DeleteDedicatedIpPool' {} Text
a -> DeleteDedicatedIpPool
s {$sel:poolName:DeleteDedicatedIpPool' :: Text
poolName = Text
a} :: DeleteDedicatedIpPool)

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

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

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

instance Data.ToQuery DeleteDedicatedIpPool where
  toQuery :: DeleteDedicatedIpPool -> 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:/ 'newDeleteDedicatedIpPoolResponse' smart constructor.
data DeleteDedicatedIpPoolResponse = DeleteDedicatedIpPoolResponse'
  { -- | The response's http status code.
    DeleteDedicatedIpPoolResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteDedicatedIpPoolResponse
-> DeleteDedicatedIpPoolResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDedicatedIpPoolResponse
-> DeleteDedicatedIpPoolResponse -> Bool
$c/= :: DeleteDedicatedIpPoolResponse
-> DeleteDedicatedIpPoolResponse -> Bool
== :: DeleteDedicatedIpPoolResponse
-> DeleteDedicatedIpPoolResponse -> Bool
$c== :: DeleteDedicatedIpPoolResponse
-> DeleteDedicatedIpPoolResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDedicatedIpPoolResponse]
ReadPrec DeleteDedicatedIpPoolResponse
Int -> ReadS DeleteDedicatedIpPoolResponse
ReadS [DeleteDedicatedIpPoolResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDedicatedIpPoolResponse]
$creadListPrec :: ReadPrec [DeleteDedicatedIpPoolResponse]
readPrec :: ReadPrec DeleteDedicatedIpPoolResponse
$creadPrec :: ReadPrec DeleteDedicatedIpPoolResponse
readList :: ReadS [DeleteDedicatedIpPoolResponse]
$creadList :: ReadS [DeleteDedicatedIpPoolResponse]
readsPrec :: Int -> ReadS DeleteDedicatedIpPoolResponse
$creadsPrec :: Int -> ReadS DeleteDedicatedIpPoolResponse
Prelude.Read, Int -> DeleteDedicatedIpPoolResponse -> ShowS
[DeleteDedicatedIpPoolResponse] -> ShowS
DeleteDedicatedIpPoolResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDedicatedIpPoolResponse] -> ShowS
$cshowList :: [DeleteDedicatedIpPoolResponse] -> ShowS
show :: DeleteDedicatedIpPoolResponse -> String
$cshow :: DeleteDedicatedIpPoolResponse -> String
showsPrec :: Int -> DeleteDedicatedIpPoolResponse -> ShowS
$cshowsPrec :: Int -> DeleteDedicatedIpPoolResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteDedicatedIpPoolResponse x
-> DeleteDedicatedIpPoolResponse
forall x.
DeleteDedicatedIpPoolResponse
-> Rep DeleteDedicatedIpPoolResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDedicatedIpPoolResponse x
-> DeleteDedicatedIpPoolResponse
$cfrom :: forall x.
DeleteDedicatedIpPoolResponse
-> Rep DeleteDedicatedIpPoolResponse x
Prelude.Generic)

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

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

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