{-# 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.RestorePhoneNumber
(
RestorePhoneNumber (..),
newRestorePhoneNumber,
restorePhoneNumber_phoneNumberId,
RestorePhoneNumberResponse (..),
newRestorePhoneNumberResponse,
restorePhoneNumberResponse_phoneNumber,
restorePhoneNumberResponse_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 RestorePhoneNumber = RestorePhoneNumber'
{
RestorePhoneNumber -> Text
phoneNumberId :: Prelude.Text
}
deriving (RestorePhoneNumber -> RestorePhoneNumber -> Bool
(RestorePhoneNumber -> RestorePhoneNumber -> Bool)
-> (RestorePhoneNumber -> RestorePhoneNumber -> Bool)
-> Eq RestorePhoneNumber
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestorePhoneNumber -> RestorePhoneNumber -> Bool
$c/= :: RestorePhoneNumber -> RestorePhoneNumber -> Bool
== :: RestorePhoneNumber -> RestorePhoneNumber -> Bool
$c== :: RestorePhoneNumber -> RestorePhoneNumber -> Bool
Prelude.Eq, ReadPrec [RestorePhoneNumber]
ReadPrec RestorePhoneNumber
Int -> ReadS RestorePhoneNumber
ReadS [RestorePhoneNumber]
(Int -> ReadS RestorePhoneNumber)
-> ReadS [RestorePhoneNumber]
-> ReadPrec RestorePhoneNumber
-> ReadPrec [RestorePhoneNumber]
-> Read RestorePhoneNumber
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestorePhoneNumber]
$creadListPrec :: ReadPrec [RestorePhoneNumber]
readPrec :: ReadPrec RestorePhoneNumber
$creadPrec :: ReadPrec RestorePhoneNumber
readList :: ReadS [RestorePhoneNumber]
$creadList :: ReadS [RestorePhoneNumber]
readsPrec :: Int -> ReadS RestorePhoneNumber
$creadsPrec :: Int -> ReadS RestorePhoneNumber
Prelude.Read, Int -> RestorePhoneNumber -> ShowS
[RestorePhoneNumber] -> ShowS
RestorePhoneNumber -> String
(Int -> RestorePhoneNumber -> ShowS)
-> (RestorePhoneNumber -> String)
-> ([RestorePhoneNumber] -> ShowS)
-> Show RestorePhoneNumber
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestorePhoneNumber] -> ShowS
$cshowList :: [RestorePhoneNumber] -> ShowS
show :: RestorePhoneNumber -> String
$cshow :: RestorePhoneNumber -> String
showsPrec :: Int -> RestorePhoneNumber -> ShowS
$cshowsPrec :: Int -> RestorePhoneNumber -> ShowS
Prelude.Show, (forall x. RestorePhoneNumber -> Rep RestorePhoneNumber x)
-> (forall x. Rep RestorePhoneNumber x -> RestorePhoneNumber)
-> Generic RestorePhoneNumber
forall x. Rep RestorePhoneNumber x -> RestorePhoneNumber
forall x. RestorePhoneNumber -> Rep RestorePhoneNumber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RestorePhoneNumber x -> RestorePhoneNumber
$cfrom :: forall x. RestorePhoneNumber -> Rep RestorePhoneNumber x
Prelude.Generic)
newRestorePhoneNumber ::
Prelude.Text ->
RestorePhoneNumber
newRestorePhoneNumber :: Text -> RestorePhoneNumber
newRestorePhoneNumber Text
pPhoneNumberId_ =
RestorePhoneNumber' :: Text -> RestorePhoneNumber
RestorePhoneNumber'
{ $sel:phoneNumberId:RestorePhoneNumber' :: Text
phoneNumberId =
Text
pPhoneNumberId_
}
restorePhoneNumber_phoneNumberId :: Lens.Lens' RestorePhoneNumber Prelude.Text
restorePhoneNumber_phoneNumberId :: (Text -> f Text) -> RestorePhoneNumber -> f RestorePhoneNumber
restorePhoneNumber_phoneNumberId = (RestorePhoneNumber -> Text)
-> (RestorePhoneNumber -> Text -> RestorePhoneNumber)
-> Lens RestorePhoneNumber RestorePhoneNumber Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestorePhoneNumber' {Text
phoneNumberId :: Text
$sel:phoneNumberId:RestorePhoneNumber' :: RestorePhoneNumber -> Text
phoneNumberId} -> Text
phoneNumberId) (\s :: RestorePhoneNumber
s@RestorePhoneNumber' {} Text
a -> RestorePhoneNumber
s {$sel:phoneNumberId:RestorePhoneNumber' :: Text
phoneNumberId = Text
a} :: RestorePhoneNumber)
instance Core.AWSRequest RestorePhoneNumber where
type
AWSResponse RestorePhoneNumber =
RestorePhoneNumberResponse
request :: RestorePhoneNumber -> Request RestorePhoneNumber
request = Service -> RestorePhoneNumber -> Request RestorePhoneNumber
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RestorePhoneNumber
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RestorePhoneNumber)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RestorePhoneNumber))
-> Logger
-> Service
-> Proxy RestorePhoneNumber
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RestorePhoneNumber)))
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 -> RestorePhoneNumberResponse
RestorePhoneNumberResponse'
(Maybe PhoneNumber -> Int -> RestorePhoneNumberResponse)
-> Either String (Maybe PhoneNumber)
-> Either String (Int -> RestorePhoneNumberResponse)
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 -> RestorePhoneNumberResponse)
-> Either String Int -> Either String RestorePhoneNumberResponse
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 RestorePhoneNumber
instance Prelude.NFData RestorePhoneNumber
instance Core.ToHeaders RestorePhoneNumber where
toHeaders :: RestorePhoneNumber -> ResponseHeaders
toHeaders = ResponseHeaders -> RestorePhoneNumber -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON RestorePhoneNumber where
toJSON :: RestorePhoneNumber -> Value
toJSON = Value -> RestorePhoneNumber -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath RestorePhoneNumber where
toPath :: RestorePhoneNumber -> ByteString
toPath RestorePhoneNumber' {Text
phoneNumberId :: Text
$sel:phoneNumberId:RestorePhoneNumber' :: RestorePhoneNumber -> 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 RestorePhoneNumber where
toQuery :: RestorePhoneNumber -> QueryString
toQuery =
QueryString -> RestorePhoneNumber -> QueryString
forall a b. a -> b -> a
Prelude.const
([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=restore"])
data RestorePhoneNumberResponse = RestorePhoneNumberResponse'
{
RestorePhoneNumberResponse -> Maybe PhoneNumber
phoneNumber :: Prelude.Maybe PhoneNumber,
RestorePhoneNumberResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RestorePhoneNumberResponse -> RestorePhoneNumberResponse -> Bool
(RestorePhoneNumberResponse -> RestorePhoneNumberResponse -> Bool)
-> (RestorePhoneNumberResponse
-> RestorePhoneNumberResponse -> Bool)
-> Eq RestorePhoneNumberResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestorePhoneNumberResponse -> RestorePhoneNumberResponse -> Bool
$c/= :: RestorePhoneNumberResponse -> RestorePhoneNumberResponse -> Bool
== :: RestorePhoneNumberResponse -> RestorePhoneNumberResponse -> Bool
$c== :: RestorePhoneNumberResponse -> RestorePhoneNumberResponse -> Bool
Prelude.Eq, Int -> RestorePhoneNumberResponse -> ShowS
[RestorePhoneNumberResponse] -> ShowS
RestorePhoneNumberResponse -> String
(Int -> RestorePhoneNumberResponse -> ShowS)
-> (RestorePhoneNumberResponse -> String)
-> ([RestorePhoneNumberResponse] -> ShowS)
-> Show RestorePhoneNumberResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestorePhoneNumberResponse] -> ShowS
$cshowList :: [RestorePhoneNumberResponse] -> ShowS
show :: RestorePhoneNumberResponse -> String
$cshow :: RestorePhoneNumberResponse -> String
showsPrec :: Int -> RestorePhoneNumberResponse -> ShowS
$cshowsPrec :: Int -> RestorePhoneNumberResponse -> ShowS
Prelude.Show, (forall x.
RestorePhoneNumberResponse -> Rep RestorePhoneNumberResponse x)
-> (forall x.
Rep RestorePhoneNumberResponse x -> RestorePhoneNumberResponse)
-> Generic RestorePhoneNumberResponse
forall x.
Rep RestorePhoneNumberResponse x -> RestorePhoneNumberResponse
forall x.
RestorePhoneNumberResponse -> Rep RestorePhoneNumberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RestorePhoneNumberResponse x -> RestorePhoneNumberResponse
$cfrom :: forall x.
RestorePhoneNumberResponse -> Rep RestorePhoneNumberResponse x
Prelude.Generic)
newRestorePhoneNumberResponse ::
Prelude.Int ->
RestorePhoneNumberResponse
newRestorePhoneNumberResponse :: Int -> RestorePhoneNumberResponse
newRestorePhoneNumberResponse Int
pHttpStatus_ =
RestorePhoneNumberResponse' :: Maybe PhoneNumber -> Int -> RestorePhoneNumberResponse
RestorePhoneNumberResponse'
{ $sel:phoneNumber:RestorePhoneNumberResponse' :: Maybe PhoneNumber
phoneNumber =
Maybe PhoneNumber
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RestorePhoneNumberResponse' :: Int
httpStatus = Int
pHttpStatus_
}
restorePhoneNumberResponse_phoneNumber :: Lens.Lens' RestorePhoneNumberResponse (Prelude.Maybe PhoneNumber)
restorePhoneNumberResponse_phoneNumber :: (Maybe PhoneNumber -> f (Maybe PhoneNumber))
-> RestorePhoneNumberResponse -> f RestorePhoneNumberResponse
restorePhoneNumberResponse_phoneNumber = (RestorePhoneNumberResponse -> Maybe PhoneNumber)
-> (RestorePhoneNumberResponse
-> Maybe PhoneNumber -> RestorePhoneNumberResponse)
-> Lens
RestorePhoneNumberResponse
RestorePhoneNumberResponse
(Maybe PhoneNumber)
(Maybe PhoneNumber)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestorePhoneNumberResponse' {Maybe PhoneNumber
phoneNumber :: Maybe PhoneNumber
$sel:phoneNumber:RestorePhoneNumberResponse' :: RestorePhoneNumberResponse -> Maybe PhoneNumber
phoneNumber} -> Maybe PhoneNumber
phoneNumber) (\s :: RestorePhoneNumberResponse
s@RestorePhoneNumberResponse' {} Maybe PhoneNumber
a -> RestorePhoneNumberResponse
s {$sel:phoneNumber:RestorePhoneNumberResponse' :: Maybe PhoneNumber
phoneNumber = Maybe PhoneNumber
a} :: RestorePhoneNumberResponse)
restorePhoneNumberResponse_httpStatus :: Lens.Lens' RestorePhoneNumberResponse Prelude.Int
restorePhoneNumberResponse_httpStatus :: (Int -> f Int)
-> RestorePhoneNumberResponse -> f RestorePhoneNumberResponse
restorePhoneNumberResponse_httpStatus = (RestorePhoneNumberResponse -> Int)
-> (RestorePhoneNumberResponse
-> Int -> RestorePhoneNumberResponse)
-> Lens
RestorePhoneNumberResponse RestorePhoneNumberResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestorePhoneNumberResponse' {Int
httpStatus :: Int
$sel:httpStatus:RestorePhoneNumberResponse' :: RestorePhoneNumberResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RestorePhoneNumberResponse
s@RestorePhoneNumberResponse' {} Int
a -> RestorePhoneNumberResponse
s {$sel:httpStatus:RestorePhoneNumberResponse' :: Int
httpStatus = Int
a} :: RestorePhoneNumberResponse)
instance Prelude.NFData RestorePhoneNumberResponse