{-# 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 #-}
module Amazonka.PinpointEmail.GetDedicatedIp
(
GetDedicatedIp (..),
newGetDedicatedIp,
getDedicatedIp_ip,
GetDedicatedIpResponse (..),
newGetDedicatedIpResponse,
getDedicatedIpResponse_dedicatedIp,
getDedicatedIpResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.PinpointEmail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetDedicatedIp = GetDedicatedIp'
{
GetDedicatedIp -> Text
ip :: Prelude.Text
}
deriving (GetDedicatedIp -> GetDedicatedIp -> Bool
(GetDedicatedIp -> GetDedicatedIp -> Bool)
-> (GetDedicatedIp -> GetDedicatedIp -> Bool) -> Eq GetDedicatedIp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDedicatedIp -> GetDedicatedIp -> Bool
$c/= :: GetDedicatedIp -> GetDedicatedIp -> Bool
== :: GetDedicatedIp -> GetDedicatedIp -> Bool
$c== :: GetDedicatedIp -> GetDedicatedIp -> Bool
Prelude.Eq, ReadPrec [GetDedicatedIp]
ReadPrec GetDedicatedIp
Int -> ReadS GetDedicatedIp
ReadS [GetDedicatedIp]
(Int -> ReadS GetDedicatedIp)
-> ReadS [GetDedicatedIp]
-> ReadPrec GetDedicatedIp
-> ReadPrec [GetDedicatedIp]
-> Read GetDedicatedIp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDedicatedIp]
$creadListPrec :: ReadPrec [GetDedicatedIp]
readPrec :: ReadPrec GetDedicatedIp
$creadPrec :: ReadPrec GetDedicatedIp
readList :: ReadS [GetDedicatedIp]
$creadList :: ReadS [GetDedicatedIp]
readsPrec :: Int -> ReadS GetDedicatedIp
$creadsPrec :: Int -> ReadS GetDedicatedIp
Prelude.Read, Int -> GetDedicatedIp -> ShowS
[GetDedicatedIp] -> ShowS
GetDedicatedIp -> String
(Int -> GetDedicatedIp -> ShowS)
-> (GetDedicatedIp -> String)
-> ([GetDedicatedIp] -> ShowS)
-> Show GetDedicatedIp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDedicatedIp] -> ShowS
$cshowList :: [GetDedicatedIp] -> ShowS
show :: GetDedicatedIp -> String
$cshow :: GetDedicatedIp -> String
showsPrec :: Int -> GetDedicatedIp -> ShowS
$cshowsPrec :: Int -> GetDedicatedIp -> ShowS
Prelude.Show, (forall x. GetDedicatedIp -> Rep GetDedicatedIp x)
-> (forall x. Rep GetDedicatedIp x -> GetDedicatedIp)
-> Generic GetDedicatedIp
forall x. Rep GetDedicatedIp x -> GetDedicatedIp
forall x. GetDedicatedIp -> Rep GetDedicatedIp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDedicatedIp x -> GetDedicatedIp
$cfrom :: forall x. GetDedicatedIp -> Rep GetDedicatedIp x
Prelude.Generic)
newGetDedicatedIp ::
Prelude.Text ->
GetDedicatedIp
newGetDedicatedIp :: Text -> GetDedicatedIp
newGetDedicatedIp Text
pIp_ = GetDedicatedIp' :: Text -> GetDedicatedIp
GetDedicatedIp' {$sel:ip:GetDedicatedIp' :: Text
ip = Text
pIp_}
getDedicatedIp_ip :: Lens.Lens' GetDedicatedIp Prelude.Text
getDedicatedIp_ip :: (Text -> f Text) -> GetDedicatedIp -> f GetDedicatedIp
getDedicatedIp_ip = (GetDedicatedIp -> Text)
-> (GetDedicatedIp -> Text -> GetDedicatedIp)
-> Lens GetDedicatedIp GetDedicatedIp Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDedicatedIp' {Text
ip :: Text
$sel:ip:GetDedicatedIp' :: GetDedicatedIp -> Text
ip} -> Text
ip) (\s :: GetDedicatedIp
s@GetDedicatedIp' {} Text
a -> GetDedicatedIp
s {$sel:ip:GetDedicatedIp' :: Text
ip = Text
a} :: GetDedicatedIp)
instance Core.AWSRequest GetDedicatedIp where
type
AWSResponse GetDedicatedIp =
GetDedicatedIpResponse
request :: GetDedicatedIp -> Request GetDedicatedIp
request = Service -> GetDedicatedIp -> Request GetDedicatedIp
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetDedicatedIp
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDedicatedIp)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetDedicatedIp))
-> Logger
-> Service
-> Proxy GetDedicatedIp
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDedicatedIp)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe DedicatedIp -> Int -> GetDedicatedIpResponse
GetDedicatedIpResponse'
(Maybe DedicatedIp -> Int -> GetDedicatedIpResponse)
-> Either String (Maybe DedicatedIp)
-> Either String (Int -> GetDedicatedIpResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DedicatedIp)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DedicatedIp")
Either String (Int -> GetDedicatedIpResponse)
-> Either String Int -> Either String GetDedicatedIpResponse
forall (f :: * -> *) a b. Applicative f => 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 GetDedicatedIp
instance Prelude.NFData GetDedicatedIp
instance Core.ToHeaders GetDedicatedIp where
toHeaders :: GetDedicatedIp -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetDedicatedIp -> 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 GetDedicatedIp where
toPath :: GetDedicatedIp -> ByteString
toPath GetDedicatedIp' {Text
ip :: Text
$sel:ip:GetDedicatedIp' :: GetDedicatedIp -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/email/dedicated-ips/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
ip]
instance Core.ToQuery GetDedicatedIp where
toQuery :: GetDedicatedIp -> QueryString
toQuery = QueryString -> GetDedicatedIp -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetDedicatedIpResponse = GetDedicatedIpResponse'
{
GetDedicatedIpResponse -> Maybe DedicatedIp
dedicatedIp :: Prelude.Maybe DedicatedIp,
GetDedicatedIpResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDedicatedIpResponse -> GetDedicatedIpResponse -> Bool
(GetDedicatedIpResponse -> GetDedicatedIpResponse -> Bool)
-> (GetDedicatedIpResponse -> GetDedicatedIpResponse -> Bool)
-> Eq GetDedicatedIpResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDedicatedIpResponse -> GetDedicatedIpResponse -> Bool
$c/= :: GetDedicatedIpResponse -> GetDedicatedIpResponse -> Bool
== :: GetDedicatedIpResponse -> GetDedicatedIpResponse -> Bool
$c== :: GetDedicatedIpResponse -> GetDedicatedIpResponse -> Bool
Prelude.Eq, ReadPrec [GetDedicatedIpResponse]
ReadPrec GetDedicatedIpResponse
Int -> ReadS GetDedicatedIpResponse
ReadS [GetDedicatedIpResponse]
(Int -> ReadS GetDedicatedIpResponse)
-> ReadS [GetDedicatedIpResponse]
-> ReadPrec GetDedicatedIpResponse
-> ReadPrec [GetDedicatedIpResponse]
-> Read GetDedicatedIpResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDedicatedIpResponse]
$creadListPrec :: ReadPrec [GetDedicatedIpResponse]
readPrec :: ReadPrec GetDedicatedIpResponse
$creadPrec :: ReadPrec GetDedicatedIpResponse
readList :: ReadS [GetDedicatedIpResponse]
$creadList :: ReadS [GetDedicatedIpResponse]
readsPrec :: Int -> ReadS GetDedicatedIpResponse
$creadsPrec :: Int -> ReadS GetDedicatedIpResponse
Prelude.Read, Int -> GetDedicatedIpResponse -> ShowS
[GetDedicatedIpResponse] -> ShowS
GetDedicatedIpResponse -> String
(Int -> GetDedicatedIpResponse -> ShowS)
-> (GetDedicatedIpResponse -> String)
-> ([GetDedicatedIpResponse] -> ShowS)
-> Show GetDedicatedIpResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDedicatedIpResponse] -> ShowS
$cshowList :: [GetDedicatedIpResponse] -> ShowS
show :: GetDedicatedIpResponse -> String
$cshow :: GetDedicatedIpResponse -> String
showsPrec :: Int -> GetDedicatedIpResponse -> ShowS
$cshowsPrec :: Int -> GetDedicatedIpResponse -> ShowS
Prelude.Show, (forall x. GetDedicatedIpResponse -> Rep GetDedicatedIpResponse x)
-> (forall x.
Rep GetDedicatedIpResponse x -> GetDedicatedIpResponse)
-> Generic GetDedicatedIpResponse
forall x. Rep GetDedicatedIpResponse x -> GetDedicatedIpResponse
forall x. GetDedicatedIpResponse -> Rep GetDedicatedIpResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDedicatedIpResponse x -> GetDedicatedIpResponse
$cfrom :: forall x. GetDedicatedIpResponse -> Rep GetDedicatedIpResponse x
Prelude.Generic)
newGetDedicatedIpResponse ::
Prelude.Int ->
GetDedicatedIpResponse
newGetDedicatedIpResponse :: Int -> GetDedicatedIpResponse
newGetDedicatedIpResponse Int
pHttpStatus_ =
GetDedicatedIpResponse' :: Maybe DedicatedIp -> Int -> GetDedicatedIpResponse
GetDedicatedIpResponse'
{ $sel:dedicatedIp:GetDedicatedIpResponse' :: Maybe DedicatedIp
dedicatedIp =
Maybe DedicatedIp
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDedicatedIpResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDedicatedIpResponse_dedicatedIp :: Lens.Lens' GetDedicatedIpResponse (Prelude.Maybe DedicatedIp)
getDedicatedIpResponse_dedicatedIp :: (Maybe DedicatedIp -> f (Maybe DedicatedIp))
-> GetDedicatedIpResponse -> f GetDedicatedIpResponse
getDedicatedIpResponse_dedicatedIp = (GetDedicatedIpResponse -> Maybe DedicatedIp)
-> (GetDedicatedIpResponse
-> Maybe DedicatedIp -> GetDedicatedIpResponse)
-> Lens
GetDedicatedIpResponse
GetDedicatedIpResponse
(Maybe DedicatedIp)
(Maybe DedicatedIp)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDedicatedIpResponse' {Maybe DedicatedIp
dedicatedIp :: Maybe DedicatedIp
$sel:dedicatedIp:GetDedicatedIpResponse' :: GetDedicatedIpResponse -> Maybe DedicatedIp
dedicatedIp} -> Maybe DedicatedIp
dedicatedIp) (\s :: GetDedicatedIpResponse
s@GetDedicatedIpResponse' {} Maybe DedicatedIp
a -> GetDedicatedIpResponse
s {$sel:dedicatedIp:GetDedicatedIpResponse' :: Maybe DedicatedIp
dedicatedIp = Maybe DedicatedIp
a} :: GetDedicatedIpResponse)
getDedicatedIpResponse_httpStatus :: Lens.Lens' GetDedicatedIpResponse Prelude.Int
getDedicatedIpResponse_httpStatus :: (Int -> f Int)
-> GetDedicatedIpResponse -> f GetDedicatedIpResponse
getDedicatedIpResponse_httpStatus = (GetDedicatedIpResponse -> Int)
-> (GetDedicatedIpResponse -> Int -> GetDedicatedIpResponse)
-> Lens GetDedicatedIpResponse GetDedicatedIpResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDedicatedIpResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDedicatedIpResponse' :: GetDedicatedIpResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDedicatedIpResponse
s@GetDedicatedIpResponse' {} Int
a -> GetDedicatedIpResponse
s {$sel:httpStatus:GetDedicatedIpResponse' :: Int
httpStatus = Int
a} :: GetDedicatedIpResponse)
instance Prelude.NFData GetDedicatedIpResponse