{-# 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.Lens as Lens
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
(GetPhoneNumber -> GetPhoneNumber -> Bool)
-> (GetPhoneNumber -> GetPhoneNumber -> Bool) -> Eq GetPhoneNumber
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]
(Int -> ReadS GetPhoneNumber)
-> ReadS [GetPhoneNumber]
-> ReadPrec GetPhoneNumber
-> ReadPrec [GetPhoneNumber]
-> Read 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
(Int -> GetPhoneNumber -> ShowS)
-> (GetPhoneNumber -> String)
-> ([GetPhoneNumber] -> ShowS)
-> Show GetPhoneNumber
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. GetPhoneNumber -> Rep GetPhoneNumber x)
-> (forall x. Rep GetPhoneNumber x -> GetPhoneNumber)
-> Generic GetPhoneNumber
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' :: Text -> GetPhoneNumber
GetPhoneNumber' {$sel:phoneNumberId:GetPhoneNumber' :: Text
phoneNumberId = Text
pPhoneNumberId_}
getPhoneNumber_phoneNumberId :: Lens.Lens' GetPhoneNumber Prelude.Text
getPhoneNumber_phoneNumberId :: (Text -> f Text) -> GetPhoneNumber -> f GetPhoneNumber
getPhoneNumber_phoneNumberId = (GetPhoneNumber -> Text)
-> (GetPhoneNumber -> Text -> GetPhoneNumber)
-> Lens GetPhoneNumber GetPhoneNumber Text Text
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 :: GetPhoneNumber -> Request GetPhoneNumber
request = Service -> GetPhoneNumber -> Request GetPhoneNumber
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetPhoneNumber
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPhoneNumber)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetPhoneNumber))
-> Logger
-> Service
-> Proxy GetPhoneNumber
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPhoneNumber)))
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 PhoneNumber -> Int -> GetPhoneNumberResponse
GetPhoneNumberResponse'
(Maybe PhoneNumber -> Int -> GetPhoneNumberResponse)
-> Either String (Maybe PhoneNumber)
-> Either String (Int -> GetPhoneNumberResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe PhoneNumber)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PhoneNumber")
Either String (Int -> GetPhoneNumberResponse)
-> Either String Int -> Either String GetPhoneNumberResponse
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 GetPhoneNumber
instance Prelude.NFData GetPhoneNumber
instance Core.ToHeaders GetPhoneNumber where
toHeaders :: GetPhoneNumber -> ResponseHeaders
toHeaders = ResponseHeaders -> GetPhoneNumber -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetPhoneNumber where
toPath :: GetPhoneNumber -> ByteString
toPath GetPhoneNumber' {Text
phoneNumberId :: Text
$sel:phoneNumberId:GetPhoneNumber' :: GetPhoneNumber -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/phone-numbers/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
phoneNumberId]
instance Core.ToQuery GetPhoneNumber where
toQuery :: GetPhoneNumber -> QueryString
toQuery = QueryString -> GetPhoneNumber -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetPhoneNumberResponse -> GetPhoneNumberResponse -> Bool)
-> (GetPhoneNumberResponse -> GetPhoneNumberResponse -> Bool)
-> Eq GetPhoneNumberResponse
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
(Int -> GetPhoneNumberResponse -> ShowS)
-> (GetPhoneNumberResponse -> String)
-> ([GetPhoneNumberResponse] -> ShowS)
-> Show GetPhoneNumberResponse
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. GetPhoneNumberResponse -> Rep GetPhoneNumberResponse x)
-> (forall x.
Rep GetPhoneNumberResponse x -> GetPhoneNumberResponse)
-> Generic GetPhoneNumberResponse
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' :: Maybe PhoneNumber -> Int -> GetPhoneNumberResponse
GetPhoneNumberResponse'
{ $sel:phoneNumber:GetPhoneNumberResponse' :: Maybe PhoneNumber
phoneNumber =
Maybe PhoneNumber
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetPhoneNumberResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getPhoneNumberResponse_phoneNumber :: Lens.Lens' GetPhoneNumberResponse (Prelude.Maybe PhoneNumber)
getPhoneNumberResponse_phoneNumber :: (Maybe PhoneNumber -> f (Maybe PhoneNumber))
-> GetPhoneNumberResponse -> f GetPhoneNumberResponse
getPhoneNumberResponse_phoneNumber = (GetPhoneNumberResponse -> Maybe PhoneNumber)
-> (GetPhoneNumberResponse
-> Maybe PhoneNumber -> GetPhoneNumberResponse)
-> Lens
GetPhoneNumberResponse
GetPhoneNumberResponse
(Maybe PhoneNumber)
(Maybe 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 :: (Int -> f Int)
-> GetPhoneNumberResponse -> f GetPhoneNumberResponse
getPhoneNumberResponse_httpStatus = (GetPhoneNumberResponse -> Int)
-> (GetPhoneNumberResponse -> Int -> GetPhoneNumberResponse)
-> Lens GetPhoneNumberResponse GetPhoneNumberResponse Int Int
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