{-# 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.PutVoiceConnectorOrigination
(
PutVoiceConnectorOrigination (..),
newPutVoiceConnectorOrigination,
putVoiceConnectorOrigination_voiceConnectorId,
putVoiceConnectorOrigination_origination,
PutVoiceConnectorOriginationResponse (..),
newPutVoiceConnectorOriginationResponse,
putVoiceConnectorOriginationResponse_origination,
putVoiceConnectorOriginationResponse_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 PutVoiceConnectorOrigination = PutVoiceConnectorOrigination'
{
PutVoiceConnectorOrigination -> Text
voiceConnectorId :: Prelude.Text,
PutVoiceConnectorOrigination -> Origination
origination :: Origination
}
deriving (PutVoiceConnectorOrigination
-> PutVoiceConnectorOrigination -> Bool
(PutVoiceConnectorOrigination
-> PutVoiceConnectorOrigination -> Bool)
-> (PutVoiceConnectorOrigination
-> PutVoiceConnectorOrigination -> Bool)
-> Eq PutVoiceConnectorOrigination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutVoiceConnectorOrigination
-> PutVoiceConnectorOrigination -> Bool
$c/= :: PutVoiceConnectorOrigination
-> PutVoiceConnectorOrigination -> Bool
== :: PutVoiceConnectorOrigination
-> PutVoiceConnectorOrigination -> Bool
$c== :: PutVoiceConnectorOrigination
-> PutVoiceConnectorOrigination -> Bool
Prelude.Eq, ReadPrec [PutVoiceConnectorOrigination]
ReadPrec PutVoiceConnectorOrigination
Int -> ReadS PutVoiceConnectorOrigination
ReadS [PutVoiceConnectorOrigination]
(Int -> ReadS PutVoiceConnectorOrigination)
-> ReadS [PutVoiceConnectorOrigination]
-> ReadPrec PutVoiceConnectorOrigination
-> ReadPrec [PutVoiceConnectorOrigination]
-> Read PutVoiceConnectorOrigination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutVoiceConnectorOrigination]
$creadListPrec :: ReadPrec [PutVoiceConnectorOrigination]
readPrec :: ReadPrec PutVoiceConnectorOrigination
$creadPrec :: ReadPrec PutVoiceConnectorOrigination
readList :: ReadS [PutVoiceConnectorOrigination]
$creadList :: ReadS [PutVoiceConnectorOrigination]
readsPrec :: Int -> ReadS PutVoiceConnectorOrigination
$creadsPrec :: Int -> ReadS PutVoiceConnectorOrigination
Prelude.Read, Int -> PutVoiceConnectorOrigination -> ShowS
[PutVoiceConnectorOrigination] -> ShowS
PutVoiceConnectorOrigination -> String
(Int -> PutVoiceConnectorOrigination -> ShowS)
-> (PutVoiceConnectorOrigination -> String)
-> ([PutVoiceConnectorOrigination] -> ShowS)
-> Show PutVoiceConnectorOrigination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutVoiceConnectorOrigination] -> ShowS
$cshowList :: [PutVoiceConnectorOrigination] -> ShowS
show :: PutVoiceConnectorOrigination -> String
$cshow :: PutVoiceConnectorOrigination -> String
showsPrec :: Int -> PutVoiceConnectorOrigination -> ShowS
$cshowsPrec :: Int -> PutVoiceConnectorOrigination -> ShowS
Prelude.Show, (forall x.
PutVoiceConnectorOrigination -> Rep PutVoiceConnectorOrigination x)
-> (forall x.
Rep PutVoiceConnectorOrigination x -> PutVoiceConnectorOrigination)
-> Generic PutVoiceConnectorOrigination
forall x.
Rep PutVoiceConnectorOrigination x -> PutVoiceConnectorOrigination
forall x.
PutVoiceConnectorOrigination -> Rep PutVoiceConnectorOrigination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutVoiceConnectorOrigination x -> PutVoiceConnectorOrigination
$cfrom :: forall x.
PutVoiceConnectorOrigination -> Rep PutVoiceConnectorOrigination x
Prelude.Generic)
newPutVoiceConnectorOrigination ::
Prelude.Text ->
Origination ->
PutVoiceConnectorOrigination
newPutVoiceConnectorOrigination :: Text -> Origination -> PutVoiceConnectorOrigination
newPutVoiceConnectorOrigination
Text
pVoiceConnectorId_
Origination
pOrigination_ =
PutVoiceConnectorOrigination' :: Text -> Origination -> PutVoiceConnectorOrigination
PutVoiceConnectorOrigination'
{ $sel:voiceConnectorId:PutVoiceConnectorOrigination' :: Text
voiceConnectorId =
Text
pVoiceConnectorId_,
$sel:origination:PutVoiceConnectorOrigination' :: Origination
origination = Origination
pOrigination_
}
putVoiceConnectorOrigination_voiceConnectorId :: Lens.Lens' PutVoiceConnectorOrigination Prelude.Text
putVoiceConnectorOrigination_voiceConnectorId :: (Text -> f Text)
-> PutVoiceConnectorOrigination -> f PutVoiceConnectorOrigination
putVoiceConnectorOrigination_voiceConnectorId = (PutVoiceConnectorOrigination -> Text)
-> (PutVoiceConnectorOrigination
-> Text -> PutVoiceConnectorOrigination)
-> Lens
PutVoiceConnectorOrigination PutVoiceConnectorOrigination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutVoiceConnectorOrigination' {Text
voiceConnectorId :: Text
$sel:voiceConnectorId:PutVoiceConnectorOrigination' :: PutVoiceConnectorOrigination -> Text
voiceConnectorId} -> Text
voiceConnectorId) (\s :: PutVoiceConnectorOrigination
s@PutVoiceConnectorOrigination' {} Text
a -> PutVoiceConnectorOrigination
s {$sel:voiceConnectorId:PutVoiceConnectorOrigination' :: Text
voiceConnectorId = Text
a} :: PutVoiceConnectorOrigination)
putVoiceConnectorOrigination_origination :: Lens.Lens' PutVoiceConnectorOrigination Origination
putVoiceConnectorOrigination_origination :: (Origination -> f Origination)
-> PutVoiceConnectorOrigination -> f PutVoiceConnectorOrigination
putVoiceConnectorOrigination_origination = (PutVoiceConnectorOrigination -> Origination)
-> (PutVoiceConnectorOrigination
-> Origination -> PutVoiceConnectorOrigination)
-> Lens
PutVoiceConnectorOrigination
PutVoiceConnectorOrigination
Origination
Origination
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutVoiceConnectorOrigination' {Origination
origination :: Origination
$sel:origination:PutVoiceConnectorOrigination' :: PutVoiceConnectorOrigination -> Origination
origination} -> Origination
origination) (\s :: PutVoiceConnectorOrigination
s@PutVoiceConnectorOrigination' {} Origination
a -> PutVoiceConnectorOrigination
s {$sel:origination:PutVoiceConnectorOrigination' :: Origination
origination = Origination
a} :: PutVoiceConnectorOrigination)
instance Core.AWSRequest PutVoiceConnectorOrigination where
type
AWSResponse PutVoiceConnectorOrigination =
PutVoiceConnectorOriginationResponse
request :: PutVoiceConnectorOrigination
-> Request PutVoiceConnectorOrigination
request = Service
-> PutVoiceConnectorOrigination
-> Request PutVoiceConnectorOrigination
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutVoiceConnectorOrigination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutVoiceConnectorOrigination)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutVoiceConnectorOrigination))
-> Logger
-> Service
-> Proxy PutVoiceConnectorOrigination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutVoiceConnectorOrigination)))
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 Origination -> Int -> PutVoiceConnectorOriginationResponse
PutVoiceConnectorOriginationResponse'
(Maybe Origination -> Int -> PutVoiceConnectorOriginationResponse)
-> Either String (Maybe Origination)
-> Either String (Int -> PutVoiceConnectorOriginationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Origination)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Origination")
Either String (Int -> PutVoiceConnectorOriginationResponse)
-> Either String Int
-> Either String PutVoiceConnectorOriginationResponse
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
PutVoiceConnectorOrigination
instance Prelude.NFData PutVoiceConnectorOrigination
instance Core.ToHeaders PutVoiceConnectorOrigination where
toHeaders :: PutVoiceConnectorOrigination -> ResponseHeaders
toHeaders = ResponseHeaders -> PutVoiceConnectorOrigination -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON PutVoiceConnectorOrigination where
toJSON :: PutVoiceConnectorOrigination -> Value
toJSON PutVoiceConnectorOrigination' {Text
Origination
origination :: Origination
voiceConnectorId :: Text
$sel:origination:PutVoiceConnectorOrigination' :: PutVoiceConnectorOrigination -> Origination
$sel:voiceConnectorId:PutVoiceConnectorOrigination' :: PutVoiceConnectorOrigination -> Text
..} =
[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
"Origination" Text -> Origination -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Origination
origination)]
)
instance Core.ToPath PutVoiceConnectorOrigination where
toPath :: PutVoiceConnectorOrigination -> ByteString
toPath PutVoiceConnectorOrigination' {Text
Origination
origination :: Origination
voiceConnectorId :: Text
$sel:origination:PutVoiceConnectorOrigination' :: PutVoiceConnectorOrigination -> Origination
$sel:voiceConnectorId:PutVoiceConnectorOrigination' :: PutVoiceConnectorOrigination -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/voice-connectors/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
voiceConnectorId,
ByteString
"/origination"
]
instance Core.ToQuery PutVoiceConnectorOrigination where
toQuery :: PutVoiceConnectorOrigination -> QueryString
toQuery = QueryString -> PutVoiceConnectorOrigination -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutVoiceConnectorOriginationResponse = PutVoiceConnectorOriginationResponse'
{
PutVoiceConnectorOriginationResponse -> Maybe Origination
origination :: Prelude.Maybe Origination,
PutVoiceConnectorOriginationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutVoiceConnectorOriginationResponse
-> PutVoiceConnectorOriginationResponse -> Bool
(PutVoiceConnectorOriginationResponse
-> PutVoiceConnectorOriginationResponse -> Bool)
-> (PutVoiceConnectorOriginationResponse
-> PutVoiceConnectorOriginationResponse -> Bool)
-> Eq PutVoiceConnectorOriginationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutVoiceConnectorOriginationResponse
-> PutVoiceConnectorOriginationResponse -> Bool
$c/= :: PutVoiceConnectorOriginationResponse
-> PutVoiceConnectorOriginationResponse -> Bool
== :: PutVoiceConnectorOriginationResponse
-> PutVoiceConnectorOriginationResponse -> Bool
$c== :: PutVoiceConnectorOriginationResponse
-> PutVoiceConnectorOriginationResponse -> Bool
Prelude.Eq, ReadPrec [PutVoiceConnectorOriginationResponse]
ReadPrec PutVoiceConnectorOriginationResponse
Int -> ReadS PutVoiceConnectorOriginationResponse
ReadS [PutVoiceConnectorOriginationResponse]
(Int -> ReadS PutVoiceConnectorOriginationResponse)
-> ReadS [PutVoiceConnectorOriginationResponse]
-> ReadPrec PutVoiceConnectorOriginationResponse
-> ReadPrec [PutVoiceConnectorOriginationResponse]
-> Read PutVoiceConnectorOriginationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutVoiceConnectorOriginationResponse]
$creadListPrec :: ReadPrec [PutVoiceConnectorOriginationResponse]
readPrec :: ReadPrec PutVoiceConnectorOriginationResponse
$creadPrec :: ReadPrec PutVoiceConnectorOriginationResponse
readList :: ReadS [PutVoiceConnectorOriginationResponse]
$creadList :: ReadS [PutVoiceConnectorOriginationResponse]
readsPrec :: Int -> ReadS PutVoiceConnectorOriginationResponse
$creadsPrec :: Int -> ReadS PutVoiceConnectorOriginationResponse
Prelude.Read, Int -> PutVoiceConnectorOriginationResponse -> ShowS
[PutVoiceConnectorOriginationResponse] -> ShowS
PutVoiceConnectorOriginationResponse -> String
(Int -> PutVoiceConnectorOriginationResponse -> ShowS)
-> (PutVoiceConnectorOriginationResponse -> String)
-> ([PutVoiceConnectorOriginationResponse] -> ShowS)
-> Show PutVoiceConnectorOriginationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutVoiceConnectorOriginationResponse] -> ShowS
$cshowList :: [PutVoiceConnectorOriginationResponse] -> ShowS
show :: PutVoiceConnectorOriginationResponse -> String
$cshow :: PutVoiceConnectorOriginationResponse -> String
showsPrec :: Int -> PutVoiceConnectorOriginationResponse -> ShowS
$cshowsPrec :: Int -> PutVoiceConnectorOriginationResponse -> ShowS
Prelude.Show, (forall x.
PutVoiceConnectorOriginationResponse
-> Rep PutVoiceConnectorOriginationResponse x)
-> (forall x.
Rep PutVoiceConnectorOriginationResponse x
-> PutVoiceConnectorOriginationResponse)
-> Generic PutVoiceConnectorOriginationResponse
forall x.
Rep PutVoiceConnectorOriginationResponse x
-> PutVoiceConnectorOriginationResponse
forall x.
PutVoiceConnectorOriginationResponse
-> Rep PutVoiceConnectorOriginationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutVoiceConnectorOriginationResponse x
-> PutVoiceConnectorOriginationResponse
$cfrom :: forall x.
PutVoiceConnectorOriginationResponse
-> Rep PutVoiceConnectorOriginationResponse x
Prelude.Generic)
newPutVoiceConnectorOriginationResponse ::
Prelude.Int ->
PutVoiceConnectorOriginationResponse
newPutVoiceConnectorOriginationResponse :: Int -> PutVoiceConnectorOriginationResponse
newPutVoiceConnectorOriginationResponse Int
pHttpStatus_ =
PutVoiceConnectorOriginationResponse' :: Maybe Origination -> Int -> PutVoiceConnectorOriginationResponse
PutVoiceConnectorOriginationResponse'
{ $sel:origination:PutVoiceConnectorOriginationResponse' :: Maybe Origination
origination =
Maybe Origination
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutVoiceConnectorOriginationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putVoiceConnectorOriginationResponse_origination :: Lens.Lens' PutVoiceConnectorOriginationResponse (Prelude.Maybe Origination)
putVoiceConnectorOriginationResponse_origination :: (Maybe Origination -> f (Maybe Origination))
-> PutVoiceConnectorOriginationResponse
-> f PutVoiceConnectorOriginationResponse
putVoiceConnectorOriginationResponse_origination = (PutVoiceConnectorOriginationResponse -> Maybe Origination)
-> (PutVoiceConnectorOriginationResponse
-> Maybe Origination -> PutVoiceConnectorOriginationResponse)
-> Lens
PutVoiceConnectorOriginationResponse
PutVoiceConnectorOriginationResponse
(Maybe Origination)
(Maybe Origination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutVoiceConnectorOriginationResponse' {Maybe Origination
origination :: Maybe Origination
$sel:origination:PutVoiceConnectorOriginationResponse' :: PutVoiceConnectorOriginationResponse -> Maybe Origination
origination} -> Maybe Origination
origination) (\s :: PutVoiceConnectorOriginationResponse
s@PutVoiceConnectorOriginationResponse' {} Maybe Origination
a -> PutVoiceConnectorOriginationResponse
s {$sel:origination:PutVoiceConnectorOriginationResponse' :: Maybe Origination
origination = Maybe Origination
a} :: PutVoiceConnectorOriginationResponse)
putVoiceConnectorOriginationResponse_httpStatus :: Lens.Lens' PutVoiceConnectorOriginationResponse Prelude.Int
putVoiceConnectorOriginationResponse_httpStatus :: (Int -> f Int)
-> PutVoiceConnectorOriginationResponse
-> f PutVoiceConnectorOriginationResponse
putVoiceConnectorOriginationResponse_httpStatus = (PutVoiceConnectorOriginationResponse -> Int)
-> (PutVoiceConnectorOriginationResponse
-> Int -> PutVoiceConnectorOriginationResponse)
-> Lens
PutVoiceConnectorOriginationResponse
PutVoiceConnectorOriginationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutVoiceConnectorOriginationResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutVoiceConnectorOriginationResponse' :: PutVoiceConnectorOriginationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutVoiceConnectorOriginationResponse
s@PutVoiceConnectorOriginationResponse' {} Int
a -> PutVoiceConnectorOriginationResponse
s {$sel:httpStatus:PutVoiceConnectorOriginationResponse' :: Int
httpStatus = Int
a} :: PutVoiceConnectorOriginationResponse)
instance
Prelude.NFData
PutVoiceConnectorOriginationResponse