{-# 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.Chime.GetPhoneNumber
(
GetPhoneNumber (..),
newGetPhoneNumber,
getPhoneNumber_phoneNumberId,
GetPhoneNumberResponse (..),
newGetPhoneNumberResponse,
getPhoneNumberResponse_phoneNumber,
getPhoneNumberResponse_httpStatus,
)
where
import Amazonka.Chime.Types
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
data GetPhoneNumber = GetPhoneNumber'
{
GetPhoneNumber -> Text
phoneNumberId :: Prelude.Text
}
deriving (GetPhoneNumber -> GetPhoneNumber -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPhoneNumber -> GetPhoneNumber -> Bool
$c/= :: GetPhoneNumber -> GetPhoneNumber -> Bool
== :: GetPhoneNumber -> GetPhoneNumber -> Bool
$c== :: GetPhoneNumber -> GetPhoneNumber -> Bool
Prelude.Eq, ReadPrec [GetPhoneNumber]
ReadPrec GetPhoneNumber
Int -> ReadS GetPhoneNumber
ReadS [GetPhoneNumber]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPhoneNumber]
$creadListPrec :: ReadPrec [GetPhoneNumber]
readPrec :: ReadPrec GetPhoneNumber
$creadPrec :: ReadPrec GetPhoneNumber
readList :: ReadS [GetPhoneNumber]
$creadList :: ReadS [GetPhoneNumber]
readsPrec :: Int -> ReadS GetPhoneNumber
$creadsPrec :: Int -> ReadS GetPhoneNumber
Prelude.Read, Int -> GetPhoneNumber -> ShowS
[GetPhoneNumber] -> ShowS
GetPhoneNumber -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPhoneNumber] -> ShowS
$cshowList :: [GetPhoneNumber] -> ShowS
show :: GetPhoneNumber -> String
$cshow :: GetPhoneNumber -> String
showsPrec :: Int -> GetPhoneNumber -> ShowS
$cshowsPrec :: Int -> GetPhoneNumber -> ShowS
Prelude.Show, forall x. Rep GetPhoneNumber x -> GetPhoneNumber
forall x. GetPhoneNumber -> Rep GetPhoneNumber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPhoneNumber x -> GetPhoneNumber
$cfrom :: forall x. GetPhoneNumber -> Rep GetPhoneNumber x
Prelude.Generic)
newGetPhoneNumber ::
Prelude.Text ->
GetPhoneNumber
newGetPhoneNumber :: Text -> GetPhoneNumber
newGetPhoneNumber Text
pPhoneNumberId_ =
GetPhoneNumber' {$sel:phoneNumberId:GetPhoneNumber' :: Text
phoneNumberId = Text
pPhoneNumberId_}
getPhoneNumber_phoneNumberId :: Lens.Lens' GetPhoneNumber Prelude.Text
getPhoneNumber_phoneNumberId :: Lens' GetPhoneNumber Text
getPhoneNumber_phoneNumberId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPhoneNumber' {Text
phoneNumberId :: Text
$sel:phoneNumberId:GetPhoneNumber' :: GetPhoneNumber -> Text
phoneNumberId} -> Text
phoneNumberId) (\s :: GetPhoneNumber
s@GetPhoneNumber' {} Text
a -> GetPhoneNumber
s {$sel:phoneNumberId:GetPhoneNumber' :: Text
phoneNumberId = Text
a} :: GetPhoneNumber)
instance Core.AWSRequest GetPhoneNumber where
type
AWSResponse GetPhoneNumber =
GetPhoneNumberResponse
request :: (Service -> Service) -> GetPhoneNumber -> Request GetPhoneNumber
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 GetPhoneNumber
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPhoneNumber)))
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 PhoneNumber -> Int -> GetPhoneNumberResponse
GetPhoneNumberResponse'
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
"PhoneNumber")
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 GetPhoneNumber where
hashWithSalt :: Int -> GetPhoneNumber -> Int
hashWithSalt Int
_salt GetPhoneNumber' {Text
phoneNumberId :: Text
$sel:phoneNumberId:GetPhoneNumber' :: GetPhoneNumber -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
phoneNumberId
instance Prelude.NFData GetPhoneNumber where
rnf :: GetPhoneNumber -> ()
rnf GetPhoneNumber' {Text
phoneNumberId :: Text
$sel:phoneNumberId:GetPhoneNumber' :: GetPhoneNumber -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
phoneNumberId
instance Data.ToHeaders GetPhoneNumber where
toHeaders :: GetPhoneNumber -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetPhoneNumber where
toPath :: GetPhoneNumber -> ByteString
toPath GetPhoneNumber' {Text
phoneNumberId :: Text
$sel:phoneNumberId:GetPhoneNumber' :: GetPhoneNumber -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/phone-numbers/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
phoneNumberId]
instance Data.ToQuery GetPhoneNumber where
toQuery :: GetPhoneNumber -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetPhoneNumberResponse = GetPhoneNumberResponse'
{
GetPhoneNumberResponse -> Maybe PhoneNumber
phoneNumber :: Prelude.Maybe PhoneNumber,
GetPhoneNumberResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetPhoneNumberResponse -> GetPhoneNumberResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPhoneNumberResponse -> GetPhoneNumberResponse -> Bool
$c/= :: GetPhoneNumberResponse -> GetPhoneNumberResponse -> Bool
== :: GetPhoneNumberResponse -> GetPhoneNumberResponse -> Bool
$c== :: GetPhoneNumberResponse -> GetPhoneNumberResponse -> Bool
Prelude.Eq, Int -> GetPhoneNumberResponse -> ShowS
[GetPhoneNumberResponse] -> ShowS
GetPhoneNumberResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPhoneNumberResponse] -> ShowS
$cshowList :: [GetPhoneNumberResponse] -> ShowS
show :: GetPhoneNumberResponse -> String
$cshow :: GetPhoneNumberResponse -> String
showsPrec :: Int -> GetPhoneNumberResponse -> ShowS
$cshowsPrec :: Int -> GetPhoneNumberResponse -> ShowS
Prelude.Show, forall x. Rep GetPhoneNumberResponse x -> GetPhoneNumberResponse
forall x. GetPhoneNumberResponse -> Rep GetPhoneNumberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPhoneNumberResponse x -> GetPhoneNumberResponse
$cfrom :: forall x. GetPhoneNumberResponse -> Rep GetPhoneNumberResponse x
Prelude.Generic)
newGetPhoneNumberResponse ::
Prelude.Int ->
GetPhoneNumberResponse
newGetPhoneNumberResponse :: Int -> GetPhoneNumberResponse
newGetPhoneNumberResponse Int
pHttpStatus_ =
GetPhoneNumberResponse'
{ $sel:phoneNumber:GetPhoneNumberResponse' :: Maybe PhoneNumber
phoneNumber =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetPhoneNumberResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getPhoneNumberResponse_phoneNumber :: Lens.Lens' GetPhoneNumberResponse (Prelude.Maybe PhoneNumber)
getPhoneNumberResponse_phoneNumber :: Lens' GetPhoneNumberResponse (Maybe PhoneNumber)
getPhoneNumberResponse_phoneNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPhoneNumberResponse' {Maybe PhoneNumber
phoneNumber :: Maybe PhoneNumber
$sel:phoneNumber:GetPhoneNumberResponse' :: GetPhoneNumberResponse -> Maybe PhoneNumber
phoneNumber} -> Maybe PhoneNumber
phoneNumber) (\s :: GetPhoneNumberResponse
s@GetPhoneNumberResponse' {} Maybe PhoneNumber
a -> GetPhoneNumberResponse
s {$sel:phoneNumber:GetPhoneNumberResponse' :: Maybe PhoneNumber
phoneNumber = Maybe PhoneNumber
a} :: GetPhoneNumberResponse)
getPhoneNumberResponse_httpStatus :: Lens.Lens' GetPhoneNumberResponse Prelude.Int
getPhoneNumberResponse_httpStatus :: Lens' GetPhoneNumberResponse Int
getPhoneNumberResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPhoneNumberResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPhoneNumberResponse' :: GetPhoneNumberResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPhoneNumberResponse
s@GetPhoneNumberResponse' {} Int
a -> GetPhoneNumberResponse
s {$sel:httpStatus:GetPhoneNumberResponse' :: Int
httpStatus = Int
a} :: GetPhoneNumberResponse)
instance Prelude.NFData GetPhoneNumberResponse where
rnf :: GetPhoneNumberResponse -> ()
rnf GetPhoneNumberResponse' {Int
Maybe PhoneNumber
httpStatus :: Int
phoneNumber :: Maybe PhoneNumber
$sel:httpStatus:GetPhoneNumberResponse' :: GetPhoneNumberResponse -> Int
$sel:phoneNumber:GetPhoneNumberResponse' :: GetPhoneNumberResponse -> Maybe PhoneNumber
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe PhoneNumber
phoneNumber
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus