{-# 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.CreatePhoneNumberOrder
(
CreatePhoneNumberOrder (..),
newCreatePhoneNumberOrder,
createPhoneNumberOrder_productType,
createPhoneNumberOrder_e164PhoneNumbers,
CreatePhoneNumberOrderResponse (..),
newCreatePhoneNumberOrderResponse,
createPhoneNumberOrderResponse_phoneNumberOrder,
createPhoneNumberOrderResponse_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 CreatePhoneNumberOrder = CreatePhoneNumberOrder'
{
CreatePhoneNumberOrder -> PhoneNumberProductType
productType :: PhoneNumberProductType,
CreatePhoneNumberOrder -> [Sensitive Text]
e164PhoneNumbers :: [Core.Sensitive Prelude.Text]
}
deriving (CreatePhoneNumberOrder -> CreatePhoneNumberOrder -> Bool
(CreatePhoneNumberOrder -> CreatePhoneNumberOrder -> Bool)
-> (CreatePhoneNumberOrder -> CreatePhoneNumberOrder -> Bool)
-> Eq CreatePhoneNumberOrder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePhoneNumberOrder -> CreatePhoneNumberOrder -> Bool
$c/= :: CreatePhoneNumberOrder -> CreatePhoneNumberOrder -> Bool
== :: CreatePhoneNumberOrder -> CreatePhoneNumberOrder -> Bool
$c== :: CreatePhoneNumberOrder -> CreatePhoneNumberOrder -> Bool
Prelude.Eq, Int -> CreatePhoneNumberOrder -> ShowS
[CreatePhoneNumberOrder] -> ShowS
CreatePhoneNumberOrder -> String
(Int -> CreatePhoneNumberOrder -> ShowS)
-> (CreatePhoneNumberOrder -> String)
-> ([CreatePhoneNumberOrder] -> ShowS)
-> Show CreatePhoneNumberOrder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePhoneNumberOrder] -> ShowS
$cshowList :: [CreatePhoneNumberOrder] -> ShowS
show :: CreatePhoneNumberOrder -> String
$cshow :: CreatePhoneNumberOrder -> String
showsPrec :: Int -> CreatePhoneNumberOrder -> ShowS
$cshowsPrec :: Int -> CreatePhoneNumberOrder -> ShowS
Prelude.Show, (forall x. CreatePhoneNumberOrder -> Rep CreatePhoneNumberOrder x)
-> (forall x.
Rep CreatePhoneNumberOrder x -> CreatePhoneNumberOrder)
-> Generic CreatePhoneNumberOrder
forall x. Rep CreatePhoneNumberOrder x -> CreatePhoneNumberOrder
forall x. CreatePhoneNumberOrder -> Rep CreatePhoneNumberOrder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePhoneNumberOrder x -> CreatePhoneNumberOrder
$cfrom :: forall x. CreatePhoneNumberOrder -> Rep CreatePhoneNumberOrder x
Prelude.Generic)
newCreatePhoneNumberOrder ::
PhoneNumberProductType ->
CreatePhoneNumberOrder
newCreatePhoneNumberOrder :: PhoneNumberProductType -> CreatePhoneNumberOrder
newCreatePhoneNumberOrder PhoneNumberProductType
pProductType_ =
CreatePhoneNumberOrder' :: PhoneNumberProductType
-> [Sensitive Text] -> CreatePhoneNumberOrder
CreatePhoneNumberOrder'
{ $sel:productType:CreatePhoneNumberOrder' :: PhoneNumberProductType
productType =
PhoneNumberProductType
pProductType_,
$sel:e164PhoneNumbers:CreatePhoneNumberOrder' :: [Sensitive Text]
e164PhoneNumbers = [Sensitive Text]
forall a. Monoid a => a
Prelude.mempty
}
createPhoneNumberOrder_productType :: Lens.Lens' CreatePhoneNumberOrder PhoneNumberProductType
createPhoneNumberOrder_productType :: (PhoneNumberProductType -> f PhoneNumberProductType)
-> CreatePhoneNumberOrder -> f CreatePhoneNumberOrder
createPhoneNumberOrder_productType = (CreatePhoneNumberOrder -> PhoneNumberProductType)
-> (CreatePhoneNumberOrder
-> PhoneNumberProductType -> CreatePhoneNumberOrder)
-> Lens
CreatePhoneNumberOrder
CreatePhoneNumberOrder
PhoneNumberProductType
PhoneNumberProductType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePhoneNumberOrder' {PhoneNumberProductType
productType :: PhoneNumberProductType
$sel:productType:CreatePhoneNumberOrder' :: CreatePhoneNumberOrder -> PhoneNumberProductType
productType} -> PhoneNumberProductType
productType) (\s :: CreatePhoneNumberOrder
s@CreatePhoneNumberOrder' {} PhoneNumberProductType
a -> CreatePhoneNumberOrder
s {$sel:productType:CreatePhoneNumberOrder' :: PhoneNumberProductType
productType = PhoneNumberProductType
a} :: CreatePhoneNumberOrder)
createPhoneNumberOrder_e164PhoneNumbers :: Lens.Lens' CreatePhoneNumberOrder [Prelude.Text]
createPhoneNumberOrder_e164PhoneNumbers :: ([Text] -> f [Text])
-> CreatePhoneNumberOrder -> f CreatePhoneNumberOrder
createPhoneNumberOrder_e164PhoneNumbers = (CreatePhoneNumberOrder -> [Sensitive Text])
-> (CreatePhoneNumberOrder
-> [Sensitive Text] -> CreatePhoneNumberOrder)
-> Lens
CreatePhoneNumberOrder
CreatePhoneNumberOrder
[Sensitive Text]
[Sensitive Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePhoneNumberOrder' {[Sensitive Text]
e164PhoneNumbers :: [Sensitive Text]
$sel:e164PhoneNumbers:CreatePhoneNumberOrder' :: CreatePhoneNumberOrder -> [Sensitive Text]
e164PhoneNumbers} -> [Sensitive Text]
e164PhoneNumbers) (\s :: CreatePhoneNumberOrder
s@CreatePhoneNumberOrder' {} [Sensitive Text]
a -> CreatePhoneNumberOrder
s {$sel:e164PhoneNumbers:CreatePhoneNumberOrder' :: [Sensitive Text]
e164PhoneNumbers = [Sensitive Text]
a} :: CreatePhoneNumberOrder) (([Sensitive Text] -> f [Sensitive Text])
-> CreatePhoneNumberOrder -> f CreatePhoneNumberOrder)
-> (([Text] -> f [Text]) -> [Sensitive Text] -> f [Sensitive Text])
-> ([Text] -> f [Text])
-> CreatePhoneNumberOrder
-> f CreatePhoneNumberOrder
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Sensitive Text] -> f [Sensitive Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreatePhoneNumberOrder where
type
AWSResponse CreatePhoneNumberOrder =
CreatePhoneNumberOrderResponse
request :: CreatePhoneNumberOrder -> Request CreatePhoneNumberOrder
request = Service -> CreatePhoneNumberOrder -> Request CreatePhoneNumberOrder
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreatePhoneNumberOrder
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePhoneNumberOrder)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreatePhoneNumberOrder))
-> Logger
-> Service
-> Proxy CreatePhoneNumberOrder
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePhoneNumberOrder)))
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 PhoneNumberOrder -> Int -> CreatePhoneNumberOrderResponse
CreatePhoneNumberOrderResponse'
(Maybe PhoneNumberOrder -> Int -> CreatePhoneNumberOrderResponse)
-> Either String (Maybe PhoneNumberOrder)
-> Either String (Int -> CreatePhoneNumberOrderResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe PhoneNumberOrder)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PhoneNumberOrder")
Either String (Int -> CreatePhoneNumberOrderResponse)
-> Either String Int
-> Either String CreatePhoneNumberOrderResponse
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 CreatePhoneNumberOrder
instance Prelude.NFData CreatePhoneNumberOrder
instance Core.ToHeaders CreatePhoneNumberOrder where
toHeaders :: CreatePhoneNumberOrder -> ResponseHeaders
toHeaders = ResponseHeaders -> CreatePhoneNumberOrder -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreatePhoneNumberOrder where
toJSON :: CreatePhoneNumberOrder -> Value
toJSON CreatePhoneNumberOrder' {[Sensitive Text]
PhoneNumberProductType
e164PhoneNumbers :: [Sensitive Text]
productType :: PhoneNumberProductType
$sel:e164PhoneNumbers:CreatePhoneNumberOrder' :: CreatePhoneNumberOrder -> [Sensitive Text]
$sel:productType:CreatePhoneNumberOrder' :: CreatePhoneNumberOrder -> PhoneNumberProductType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProductType" Text -> PhoneNumberProductType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PhoneNumberProductType
productType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"E164PhoneNumbers" Text -> [Sensitive Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Sensitive Text]
e164PhoneNumbers)
]
)
instance Core.ToPath CreatePhoneNumberOrder where
toPath :: CreatePhoneNumberOrder -> ByteString
toPath = ByteString -> CreatePhoneNumberOrder -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/phone-number-orders"
instance Core.ToQuery CreatePhoneNumberOrder where
toQuery :: CreatePhoneNumberOrder -> QueryString
toQuery = QueryString -> CreatePhoneNumberOrder -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreatePhoneNumberOrderResponse = CreatePhoneNumberOrderResponse'
{
CreatePhoneNumberOrderResponse -> Maybe PhoneNumberOrder
phoneNumberOrder :: Prelude.Maybe PhoneNumberOrder,
CreatePhoneNumberOrderResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePhoneNumberOrderResponse
-> CreatePhoneNumberOrderResponse -> Bool
(CreatePhoneNumberOrderResponse
-> CreatePhoneNumberOrderResponse -> Bool)
-> (CreatePhoneNumberOrderResponse
-> CreatePhoneNumberOrderResponse -> Bool)
-> Eq CreatePhoneNumberOrderResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePhoneNumberOrderResponse
-> CreatePhoneNumberOrderResponse -> Bool
$c/= :: CreatePhoneNumberOrderResponse
-> CreatePhoneNumberOrderResponse -> Bool
== :: CreatePhoneNumberOrderResponse
-> CreatePhoneNumberOrderResponse -> Bool
$c== :: CreatePhoneNumberOrderResponse
-> CreatePhoneNumberOrderResponse -> Bool
Prelude.Eq, Int -> CreatePhoneNumberOrderResponse -> ShowS
[CreatePhoneNumberOrderResponse] -> ShowS
CreatePhoneNumberOrderResponse -> String
(Int -> CreatePhoneNumberOrderResponse -> ShowS)
-> (CreatePhoneNumberOrderResponse -> String)
-> ([CreatePhoneNumberOrderResponse] -> ShowS)
-> Show CreatePhoneNumberOrderResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePhoneNumberOrderResponse] -> ShowS
$cshowList :: [CreatePhoneNumberOrderResponse] -> ShowS
show :: CreatePhoneNumberOrderResponse -> String
$cshow :: CreatePhoneNumberOrderResponse -> String
showsPrec :: Int -> CreatePhoneNumberOrderResponse -> ShowS
$cshowsPrec :: Int -> CreatePhoneNumberOrderResponse -> ShowS
Prelude.Show, (forall x.
CreatePhoneNumberOrderResponse
-> Rep CreatePhoneNumberOrderResponse x)
-> (forall x.
Rep CreatePhoneNumberOrderResponse x
-> CreatePhoneNumberOrderResponse)
-> Generic CreatePhoneNumberOrderResponse
forall x.
Rep CreatePhoneNumberOrderResponse x
-> CreatePhoneNumberOrderResponse
forall x.
CreatePhoneNumberOrderResponse
-> Rep CreatePhoneNumberOrderResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePhoneNumberOrderResponse x
-> CreatePhoneNumberOrderResponse
$cfrom :: forall x.
CreatePhoneNumberOrderResponse
-> Rep CreatePhoneNumberOrderResponse x
Prelude.Generic)
newCreatePhoneNumberOrderResponse ::
Prelude.Int ->
CreatePhoneNumberOrderResponse
newCreatePhoneNumberOrderResponse :: Int -> CreatePhoneNumberOrderResponse
newCreatePhoneNumberOrderResponse Int
pHttpStatus_ =
CreatePhoneNumberOrderResponse' :: Maybe PhoneNumberOrder -> Int -> CreatePhoneNumberOrderResponse
CreatePhoneNumberOrderResponse'
{ $sel:phoneNumberOrder:CreatePhoneNumberOrderResponse' :: Maybe PhoneNumberOrder
phoneNumberOrder =
Maybe PhoneNumberOrder
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreatePhoneNumberOrderResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createPhoneNumberOrderResponse_phoneNumberOrder :: Lens.Lens' CreatePhoneNumberOrderResponse (Prelude.Maybe PhoneNumberOrder)
createPhoneNumberOrderResponse_phoneNumberOrder :: (Maybe PhoneNumberOrder -> f (Maybe PhoneNumberOrder))
-> CreatePhoneNumberOrderResponse
-> f CreatePhoneNumberOrderResponse
createPhoneNumberOrderResponse_phoneNumberOrder = (CreatePhoneNumberOrderResponse -> Maybe PhoneNumberOrder)
-> (CreatePhoneNumberOrderResponse
-> Maybe PhoneNumberOrder -> CreatePhoneNumberOrderResponse)
-> Lens
CreatePhoneNumberOrderResponse
CreatePhoneNumberOrderResponse
(Maybe PhoneNumberOrder)
(Maybe PhoneNumberOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePhoneNumberOrderResponse' {Maybe PhoneNumberOrder
phoneNumberOrder :: Maybe PhoneNumberOrder
$sel:phoneNumberOrder:CreatePhoneNumberOrderResponse' :: CreatePhoneNumberOrderResponse -> Maybe PhoneNumberOrder
phoneNumberOrder} -> Maybe PhoneNumberOrder
phoneNumberOrder) (\s :: CreatePhoneNumberOrderResponse
s@CreatePhoneNumberOrderResponse' {} Maybe PhoneNumberOrder
a -> CreatePhoneNumberOrderResponse
s {$sel:phoneNumberOrder:CreatePhoneNumberOrderResponse' :: Maybe PhoneNumberOrder
phoneNumberOrder = Maybe PhoneNumberOrder
a} :: CreatePhoneNumberOrderResponse)
createPhoneNumberOrderResponse_httpStatus :: Lens.Lens' CreatePhoneNumberOrderResponse Prelude.Int
createPhoneNumberOrderResponse_httpStatus :: (Int -> f Int)
-> CreatePhoneNumberOrderResponse
-> f CreatePhoneNumberOrderResponse
createPhoneNumberOrderResponse_httpStatus = (CreatePhoneNumberOrderResponse -> Int)
-> (CreatePhoneNumberOrderResponse
-> Int -> CreatePhoneNumberOrderResponse)
-> Lens
CreatePhoneNumberOrderResponse
CreatePhoneNumberOrderResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePhoneNumberOrderResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePhoneNumberOrderResponse' :: CreatePhoneNumberOrderResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePhoneNumberOrderResponse
s@CreatePhoneNumberOrderResponse' {} Int
a -> CreatePhoneNumberOrderResponse
s {$sel:httpStatus:CreatePhoneNumberOrderResponse' :: Int
httpStatus = Int
a} :: CreatePhoneNumberOrderResponse)
instance
Prelude.NFData
CreatePhoneNumberOrderResponse