{-# 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.GetDedicatedIpPool
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieve information about the dedicated pool.
module Amazonka.SESV2.GetDedicatedIpPool
  ( -- * Creating a Request
    GetDedicatedIpPool (..),
    newGetDedicatedIpPool,

    -- * Request Lenses
    getDedicatedIpPool_poolName,

    -- * Destructuring the Response
    GetDedicatedIpPoolResponse (..),
    newGetDedicatedIpPoolResponse,

    -- * Response Lenses
    getDedicatedIpPoolResponse_dedicatedIpPool,
    getDedicatedIpPoolResponse_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

-- | A request to obtain more information about a dedicated IP pool.
--
-- /See:/ 'newGetDedicatedIpPool' smart constructor.
data GetDedicatedIpPool = GetDedicatedIpPool'
  { -- | The name of the dedicated IP pool to retrieve.
    GetDedicatedIpPool -> Text
poolName :: Prelude.Text
  }
  deriving (GetDedicatedIpPool -> GetDedicatedIpPool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDedicatedIpPool -> GetDedicatedIpPool -> Bool
$c/= :: GetDedicatedIpPool -> GetDedicatedIpPool -> Bool
== :: GetDedicatedIpPool -> GetDedicatedIpPool -> Bool
$c== :: GetDedicatedIpPool -> GetDedicatedIpPool -> Bool
Prelude.Eq, ReadPrec [GetDedicatedIpPool]
ReadPrec GetDedicatedIpPool
Int -> ReadS GetDedicatedIpPool
ReadS [GetDedicatedIpPool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDedicatedIpPool]
$creadListPrec :: ReadPrec [GetDedicatedIpPool]
readPrec :: ReadPrec GetDedicatedIpPool
$creadPrec :: ReadPrec GetDedicatedIpPool
readList :: ReadS [GetDedicatedIpPool]
$creadList :: ReadS [GetDedicatedIpPool]
readsPrec :: Int -> ReadS GetDedicatedIpPool
$creadsPrec :: Int -> ReadS GetDedicatedIpPool
Prelude.Read, Int -> GetDedicatedIpPool -> ShowS
[GetDedicatedIpPool] -> ShowS
GetDedicatedIpPool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDedicatedIpPool] -> ShowS
$cshowList :: [GetDedicatedIpPool] -> ShowS
show :: GetDedicatedIpPool -> String
$cshow :: GetDedicatedIpPool -> String
showsPrec :: Int -> GetDedicatedIpPool -> ShowS
$cshowsPrec :: Int -> GetDedicatedIpPool -> ShowS
Prelude.Show, forall x. Rep GetDedicatedIpPool x -> GetDedicatedIpPool
forall x. GetDedicatedIpPool -> Rep GetDedicatedIpPool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDedicatedIpPool x -> GetDedicatedIpPool
$cfrom :: forall x. GetDedicatedIpPool -> Rep GetDedicatedIpPool x
Prelude.Generic)

-- |
-- Create a value of 'GetDedicatedIpPool' 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', 'getDedicatedIpPool_poolName' - The name of the dedicated IP pool to retrieve.
newGetDedicatedIpPool ::
  -- | 'poolName'
  Prelude.Text ->
  GetDedicatedIpPool
newGetDedicatedIpPool :: Text -> GetDedicatedIpPool
newGetDedicatedIpPool Text
pPoolName_ =
  GetDedicatedIpPool' {$sel:poolName:GetDedicatedIpPool' :: Text
poolName = Text
pPoolName_}

-- | The name of the dedicated IP pool to retrieve.
getDedicatedIpPool_poolName :: Lens.Lens' GetDedicatedIpPool Prelude.Text
getDedicatedIpPool_poolName :: Lens' GetDedicatedIpPool Text
getDedicatedIpPool_poolName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDedicatedIpPool' {Text
poolName :: Text
$sel:poolName:GetDedicatedIpPool' :: GetDedicatedIpPool -> Text
poolName} -> Text
poolName) (\s :: GetDedicatedIpPool
s@GetDedicatedIpPool' {} Text
a -> GetDedicatedIpPool
s {$sel:poolName:GetDedicatedIpPool' :: Text
poolName = Text
a} :: GetDedicatedIpPool)

instance Core.AWSRequest GetDedicatedIpPool where
  type
    AWSResponse GetDedicatedIpPool =
      GetDedicatedIpPoolResponse
  request :: (Service -> Service)
-> GetDedicatedIpPool -> Request GetDedicatedIpPool
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDedicatedIpPool
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetDedicatedIpPool)))
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 ->
          Maybe DedicatedIpPool -> Int -> GetDedicatedIpPoolResponse
GetDedicatedIpPoolResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DedicatedIpPool")
            forall (f :: * -> *) a b. Applicative f => 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 GetDedicatedIpPool where
  hashWithSalt :: Int -> GetDedicatedIpPool -> Int
hashWithSalt Int
_salt GetDedicatedIpPool' {Text
poolName :: Text
$sel:poolName:GetDedicatedIpPool' :: GetDedicatedIpPool -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
poolName

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

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

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

-- | The following element is returned by the service.
--
-- /See:/ 'newGetDedicatedIpPoolResponse' smart constructor.
data GetDedicatedIpPoolResponse = GetDedicatedIpPoolResponse'
  { -- | An object that contains information about a dedicated IP pool.
    GetDedicatedIpPoolResponse -> Maybe DedicatedIpPool
dedicatedIpPool :: Prelude.Maybe DedicatedIpPool,
    -- | The response's http status code.
    GetDedicatedIpPoolResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetDedicatedIpPoolResponse -> GetDedicatedIpPoolResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDedicatedIpPoolResponse -> GetDedicatedIpPoolResponse -> Bool
$c/= :: GetDedicatedIpPoolResponse -> GetDedicatedIpPoolResponse -> Bool
== :: GetDedicatedIpPoolResponse -> GetDedicatedIpPoolResponse -> Bool
$c== :: GetDedicatedIpPoolResponse -> GetDedicatedIpPoolResponse -> Bool
Prelude.Eq, ReadPrec [GetDedicatedIpPoolResponse]
ReadPrec GetDedicatedIpPoolResponse
Int -> ReadS GetDedicatedIpPoolResponse
ReadS [GetDedicatedIpPoolResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDedicatedIpPoolResponse]
$creadListPrec :: ReadPrec [GetDedicatedIpPoolResponse]
readPrec :: ReadPrec GetDedicatedIpPoolResponse
$creadPrec :: ReadPrec GetDedicatedIpPoolResponse
readList :: ReadS [GetDedicatedIpPoolResponse]
$creadList :: ReadS [GetDedicatedIpPoolResponse]
readsPrec :: Int -> ReadS GetDedicatedIpPoolResponse
$creadsPrec :: Int -> ReadS GetDedicatedIpPoolResponse
Prelude.Read, Int -> GetDedicatedIpPoolResponse -> ShowS
[GetDedicatedIpPoolResponse] -> ShowS
GetDedicatedIpPoolResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDedicatedIpPoolResponse] -> ShowS
$cshowList :: [GetDedicatedIpPoolResponse] -> ShowS
show :: GetDedicatedIpPoolResponse -> String
$cshow :: GetDedicatedIpPoolResponse -> String
showsPrec :: Int -> GetDedicatedIpPoolResponse -> ShowS
$cshowsPrec :: Int -> GetDedicatedIpPoolResponse -> ShowS
Prelude.Show, forall x.
Rep GetDedicatedIpPoolResponse x -> GetDedicatedIpPoolResponse
forall x.
GetDedicatedIpPoolResponse -> Rep GetDedicatedIpPoolResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDedicatedIpPoolResponse x -> GetDedicatedIpPoolResponse
$cfrom :: forall x.
GetDedicatedIpPoolResponse -> Rep GetDedicatedIpPoolResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetDedicatedIpPoolResponse' 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:
--
-- 'dedicatedIpPool', 'getDedicatedIpPoolResponse_dedicatedIpPool' - An object that contains information about a dedicated IP pool.
--
-- 'httpStatus', 'getDedicatedIpPoolResponse_httpStatus' - The response's http status code.
newGetDedicatedIpPoolResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDedicatedIpPoolResponse
newGetDedicatedIpPoolResponse :: Int -> GetDedicatedIpPoolResponse
newGetDedicatedIpPoolResponse Int
pHttpStatus_ =
  GetDedicatedIpPoolResponse'
    { $sel:dedicatedIpPool:GetDedicatedIpPoolResponse' :: Maybe DedicatedIpPool
dedicatedIpPool =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetDedicatedIpPoolResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object that contains information about a dedicated IP pool.
getDedicatedIpPoolResponse_dedicatedIpPool :: Lens.Lens' GetDedicatedIpPoolResponse (Prelude.Maybe DedicatedIpPool)
getDedicatedIpPoolResponse_dedicatedIpPool :: Lens' GetDedicatedIpPoolResponse (Maybe DedicatedIpPool)
getDedicatedIpPoolResponse_dedicatedIpPool = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDedicatedIpPoolResponse' {Maybe DedicatedIpPool
dedicatedIpPool :: Maybe DedicatedIpPool
$sel:dedicatedIpPool:GetDedicatedIpPoolResponse' :: GetDedicatedIpPoolResponse -> Maybe DedicatedIpPool
dedicatedIpPool} -> Maybe DedicatedIpPool
dedicatedIpPool) (\s :: GetDedicatedIpPoolResponse
s@GetDedicatedIpPoolResponse' {} Maybe DedicatedIpPool
a -> GetDedicatedIpPoolResponse
s {$sel:dedicatedIpPool:GetDedicatedIpPoolResponse' :: Maybe DedicatedIpPool
dedicatedIpPool = Maybe DedicatedIpPool
a} :: GetDedicatedIpPoolResponse)

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

instance Prelude.NFData GetDedicatedIpPoolResponse where
  rnf :: GetDedicatedIpPoolResponse -> ()
rnf GetDedicatedIpPoolResponse' {Int
Maybe DedicatedIpPool
httpStatus :: Int
dedicatedIpPool :: Maybe DedicatedIpPool
$sel:httpStatus:GetDedicatedIpPoolResponse' :: GetDedicatedIpPoolResponse -> Int
$sel:dedicatedIpPool:GetDedicatedIpPoolResponse' :: GetDedicatedIpPoolResponse -> Maybe DedicatedIpPool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DedicatedIpPool
dedicatedIpPool
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus