{-# 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.CreateVoiceConnector
(
CreateVoiceConnector (..),
newCreateVoiceConnector,
createVoiceConnector_awsRegion,
createVoiceConnector_name,
createVoiceConnector_requireEncryption,
CreateVoiceConnectorResponse (..),
newCreateVoiceConnectorResponse,
createVoiceConnectorResponse_voiceConnector,
createVoiceConnectorResponse_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 CreateVoiceConnector = CreateVoiceConnector'
{
CreateVoiceConnector -> Maybe VoiceConnectorAwsRegion
awsRegion :: Prelude.Maybe VoiceConnectorAwsRegion,
CreateVoiceConnector -> Text
name :: Prelude.Text,
CreateVoiceConnector -> Bool
requireEncryption :: Prelude.Bool
}
deriving (CreateVoiceConnector -> CreateVoiceConnector -> Bool
(CreateVoiceConnector -> CreateVoiceConnector -> Bool)
-> (CreateVoiceConnector -> CreateVoiceConnector -> Bool)
-> Eq CreateVoiceConnector
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVoiceConnector -> CreateVoiceConnector -> Bool
$c/= :: CreateVoiceConnector -> CreateVoiceConnector -> Bool
== :: CreateVoiceConnector -> CreateVoiceConnector -> Bool
$c== :: CreateVoiceConnector -> CreateVoiceConnector -> Bool
Prelude.Eq, ReadPrec [CreateVoiceConnector]
ReadPrec CreateVoiceConnector
Int -> ReadS CreateVoiceConnector
ReadS [CreateVoiceConnector]
(Int -> ReadS CreateVoiceConnector)
-> ReadS [CreateVoiceConnector]
-> ReadPrec CreateVoiceConnector
-> ReadPrec [CreateVoiceConnector]
-> Read CreateVoiceConnector
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVoiceConnector]
$creadListPrec :: ReadPrec [CreateVoiceConnector]
readPrec :: ReadPrec CreateVoiceConnector
$creadPrec :: ReadPrec CreateVoiceConnector
readList :: ReadS [CreateVoiceConnector]
$creadList :: ReadS [CreateVoiceConnector]
readsPrec :: Int -> ReadS CreateVoiceConnector
$creadsPrec :: Int -> ReadS CreateVoiceConnector
Prelude.Read, Int -> CreateVoiceConnector -> ShowS
[CreateVoiceConnector] -> ShowS
CreateVoiceConnector -> String
(Int -> CreateVoiceConnector -> ShowS)
-> (CreateVoiceConnector -> String)
-> ([CreateVoiceConnector] -> ShowS)
-> Show CreateVoiceConnector
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVoiceConnector] -> ShowS
$cshowList :: [CreateVoiceConnector] -> ShowS
show :: CreateVoiceConnector -> String
$cshow :: CreateVoiceConnector -> String
showsPrec :: Int -> CreateVoiceConnector -> ShowS
$cshowsPrec :: Int -> CreateVoiceConnector -> ShowS
Prelude.Show, (forall x. CreateVoiceConnector -> Rep CreateVoiceConnector x)
-> (forall x. Rep CreateVoiceConnector x -> CreateVoiceConnector)
-> Generic CreateVoiceConnector
forall x. Rep CreateVoiceConnector x -> CreateVoiceConnector
forall x. CreateVoiceConnector -> Rep CreateVoiceConnector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateVoiceConnector x -> CreateVoiceConnector
$cfrom :: forall x. CreateVoiceConnector -> Rep CreateVoiceConnector x
Prelude.Generic)
newCreateVoiceConnector ::
Prelude.Text ->
Prelude.Bool ->
CreateVoiceConnector
newCreateVoiceConnector :: Text -> Bool -> CreateVoiceConnector
newCreateVoiceConnector Text
pName_ Bool
pRequireEncryption_ =
CreateVoiceConnector' :: Maybe VoiceConnectorAwsRegion
-> Text -> Bool -> CreateVoiceConnector
CreateVoiceConnector'
{ $sel:awsRegion:CreateVoiceConnector' :: Maybe VoiceConnectorAwsRegion
awsRegion = Maybe VoiceConnectorAwsRegion
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateVoiceConnector' :: Text
name = Text
pName_,
$sel:requireEncryption:CreateVoiceConnector' :: Bool
requireEncryption = Bool
pRequireEncryption_
}
createVoiceConnector_awsRegion :: Lens.Lens' CreateVoiceConnector (Prelude.Maybe VoiceConnectorAwsRegion)
createVoiceConnector_awsRegion :: (Maybe VoiceConnectorAwsRegion
-> f (Maybe VoiceConnectorAwsRegion))
-> CreateVoiceConnector -> f CreateVoiceConnector
createVoiceConnector_awsRegion = (CreateVoiceConnector -> Maybe VoiceConnectorAwsRegion)
-> (CreateVoiceConnector
-> Maybe VoiceConnectorAwsRegion -> CreateVoiceConnector)
-> Lens
CreateVoiceConnector
CreateVoiceConnector
(Maybe VoiceConnectorAwsRegion)
(Maybe VoiceConnectorAwsRegion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVoiceConnector' {Maybe VoiceConnectorAwsRegion
awsRegion :: Maybe VoiceConnectorAwsRegion
$sel:awsRegion:CreateVoiceConnector' :: CreateVoiceConnector -> Maybe VoiceConnectorAwsRegion
awsRegion} -> Maybe VoiceConnectorAwsRegion
awsRegion) (\s :: CreateVoiceConnector
s@CreateVoiceConnector' {} Maybe VoiceConnectorAwsRegion
a -> CreateVoiceConnector
s {$sel:awsRegion:CreateVoiceConnector' :: Maybe VoiceConnectorAwsRegion
awsRegion = Maybe VoiceConnectorAwsRegion
a} :: CreateVoiceConnector)
createVoiceConnector_name :: Lens.Lens' CreateVoiceConnector Prelude.Text
createVoiceConnector_name :: (Text -> f Text) -> CreateVoiceConnector -> f CreateVoiceConnector
createVoiceConnector_name = (CreateVoiceConnector -> Text)
-> (CreateVoiceConnector -> Text -> CreateVoiceConnector)
-> Lens CreateVoiceConnector CreateVoiceConnector Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVoiceConnector' {Text
name :: Text
$sel:name:CreateVoiceConnector' :: CreateVoiceConnector -> Text
name} -> Text
name) (\s :: CreateVoiceConnector
s@CreateVoiceConnector' {} Text
a -> CreateVoiceConnector
s {$sel:name:CreateVoiceConnector' :: Text
name = Text
a} :: CreateVoiceConnector)
createVoiceConnector_requireEncryption :: Lens.Lens' CreateVoiceConnector Prelude.Bool
createVoiceConnector_requireEncryption :: (Bool -> f Bool) -> CreateVoiceConnector -> f CreateVoiceConnector
createVoiceConnector_requireEncryption = (CreateVoiceConnector -> Bool)
-> (CreateVoiceConnector -> Bool -> CreateVoiceConnector)
-> Lens CreateVoiceConnector CreateVoiceConnector Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVoiceConnector' {Bool
requireEncryption :: Bool
$sel:requireEncryption:CreateVoiceConnector' :: CreateVoiceConnector -> Bool
requireEncryption} -> Bool
requireEncryption) (\s :: CreateVoiceConnector
s@CreateVoiceConnector' {} Bool
a -> CreateVoiceConnector
s {$sel:requireEncryption:CreateVoiceConnector' :: Bool
requireEncryption = Bool
a} :: CreateVoiceConnector)
instance Core.AWSRequest CreateVoiceConnector where
type
AWSResponse CreateVoiceConnector =
CreateVoiceConnectorResponse
request :: CreateVoiceConnector -> Request CreateVoiceConnector
request = Service -> CreateVoiceConnector -> Request CreateVoiceConnector
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateVoiceConnector
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateVoiceConnector)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateVoiceConnector))
-> Logger
-> Service
-> Proxy CreateVoiceConnector
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateVoiceConnector)))
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 VoiceConnector -> Int -> CreateVoiceConnectorResponse
CreateVoiceConnectorResponse'
(Maybe VoiceConnector -> Int -> CreateVoiceConnectorResponse)
-> Either String (Maybe VoiceConnector)
-> Either String (Int -> CreateVoiceConnectorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe VoiceConnector)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"VoiceConnector")
Either String (Int -> CreateVoiceConnectorResponse)
-> Either String Int -> Either String CreateVoiceConnectorResponse
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 CreateVoiceConnector
instance Prelude.NFData CreateVoiceConnector
instance Core.ToHeaders CreateVoiceConnector where
toHeaders :: CreateVoiceConnector -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateVoiceConnector -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreateVoiceConnector where
toJSON :: CreateVoiceConnector -> Value
toJSON CreateVoiceConnector' {Bool
Maybe VoiceConnectorAwsRegion
Text
requireEncryption :: Bool
name :: Text
awsRegion :: Maybe VoiceConnectorAwsRegion
$sel:requireEncryption:CreateVoiceConnector' :: CreateVoiceConnector -> Bool
$sel:name:CreateVoiceConnector' :: CreateVoiceConnector -> Text
$sel:awsRegion:CreateVoiceConnector' :: CreateVoiceConnector -> Maybe VoiceConnectorAwsRegion
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AwsRegion" Text -> VoiceConnectorAwsRegion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VoiceConnectorAwsRegion -> Pair)
-> Maybe VoiceConnectorAwsRegion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VoiceConnectorAwsRegion
awsRegion,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"RequireEncryption" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
requireEncryption)
]
)
instance Core.ToPath CreateVoiceConnector where
toPath :: CreateVoiceConnector -> ByteString
toPath = ByteString -> CreateVoiceConnector -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/voice-connectors"
instance Core.ToQuery CreateVoiceConnector where
toQuery :: CreateVoiceConnector -> QueryString
toQuery = QueryString -> CreateVoiceConnector -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateVoiceConnectorResponse = CreateVoiceConnectorResponse'
{
CreateVoiceConnectorResponse -> Maybe VoiceConnector
voiceConnector :: Prelude.Maybe VoiceConnector,
CreateVoiceConnectorResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateVoiceConnectorResponse
-> CreateVoiceConnectorResponse -> Bool
(CreateVoiceConnectorResponse
-> CreateVoiceConnectorResponse -> Bool)
-> (CreateVoiceConnectorResponse
-> CreateVoiceConnectorResponse -> Bool)
-> Eq CreateVoiceConnectorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVoiceConnectorResponse
-> CreateVoiceConnectorResponse -> Bool
$c/= :: CreateVoiceConnectorResponse
-> CreateVoiceConnectorResponse -> Bool
== :: CreateVoiceConnectorResponse
-> CreateVoiceConnectorResponse -> Bool
$c== :: CreateVoiceConnectorResponse
-> CreateVoiceConnectorResponse -> Bool
Prelude.Eq, ReadPrec [CreateVoiceConnectorResponse]
ReadPrec CreateVoiceConnectorResponse
Int -> ReadS CreateVoiceConnectorResponse
ReadS [CreateVoiceConnectorResponse]
(Int -> ReadS CreateVoiceConnectorResponse)
-> ReadS [CreateVoiceConnectorResponse]
-> ReadPrec CreateVoiceConnectorResponse
-> ReadPrec [CreateVoiceConnectorResponse]
-> Read CreateVoiceConnectorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVoiceConnectorResponse]
$creadListPrec :: ReadPrec [CreateVoiceConnectorResponse]
readPrec :: ReadPrec CreateVoiceConnectorResponse
$creadPrec :: ReadPrec CreateVoiceConnectorResponse
readList :: ReadS [CreateVoiceConnectorResponse]
$creadList :: ReadS [CreateVoiceConnectorResponse]
readsPrec :: Int -> ReadS CreateVoiceConnectorResponse
$creadsPrec :: Int -> ReadS CreateVoiceConnectorResponse
Prelude.Read, Int -> CreateVoiceConnectorResponse -> ShowS
[CreateVoiceConnectorResponse] -> ShowS
CreateVoiceConnectorResponse -> String
(Int -> CreateVoiceConnectorResponse -> ShowS)
-> (CreateVoiceConnectorResponse -> String)
-> ([CreateVoiceConnectorResponse] -> ShowS)
-> Show CreateVoiceConnectorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVoiceConnectorResponse] -> ShowS
$cshowList :: [CreateVoiceConnectorResponse] -> ShowS
show :: CreateVoiceConnectorResponse -> String
$cshow :: CreateVoiceConnectorResponse -> String
showsPrec :: Int -> CreateVoiceConnectorResponse -> ShowS
$cshowsPrec :: Int -> CreateVoiceConnectorResponse -> ShowS
Prelude.Show, (forall x.
CreateVoiceConnectorResponse -> Rep CreateVoiceConnectorResponse x)
-> (forall x.
Rep CreateVoiceConnectorResponse x -> CreateVoiceConnectorResponse)
-> Generic CreateVoiceConnectorResponse
forall x.
Rep CreateVoiceConnectorResponse x -> CreateVoiceConnectorResponse
forall x.
CreateVoiceConnectorResponse -> Rep CreateVoiceConnectorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateVoiceConnectorResponse x -> CreateVoiceConnectorResponse
$cfrom :: forall x.
CreateVoiceConnectorResponse -> Rep CreateVoiceConnectorResponse x
Prelude.Generic)
newCreateVoiceConnectorResponse ::
Prelude.Int ->
CreateVoiceConnectorResponse
newCreateVoiceConnectorResponse :: Int -> CreateVoiceConnectorResponse
newCreateVoiceConnectorResponse Int
pHttpStatus_ =
CreateVoiceConnectorResponse' :: Maybe VoiceConnector -> Int -> CreateVoiceConnectorResponse
CreateVoiceConnectorResponse'
{ $sel:voiceConnector:CreateVoiceConnectorResponse' :: Maybe VoiceConnector
voiceConnector =
Maybe VoiceConnector
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateVoiceConnectorResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createVoiceConnectorResponse_voiceConnector :: Lens.Lens' CreateVoiceConnectorResponse (Prelude.Maybe VoiceConnector)
createVoiceConnectorResponse_voiceConnector :: (Maybe VoiceConnector -> f (Maybe VoiceConnector))
-> CreateVoiceConnectorResponse -> f CreateVoiceConnectorResponse
createVoiceConnectorResponse_voiceConnector = (CreateVoiceConnectorResponse -> Maybe VoiceConnector)
-> (CreateVoiceConnectorResponse
-> Maybe VoiceConnector -> CreateVoiceConnectorResponse)
-> Lens
CreateVoiceConnectorResponse
CreateVoiceConnectorResponse
(Maybe VoiceConnector)
(Maybe VoiceConnector)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVoiceConnectorResponse' {Maybe VoiceConnector
voiceConnector :: Maybe VoiceConnector
$sel:voiceConnector:CreateVoiceConnectorResponse' :: CreateVoiceConnectorResponse -> Maybe VoiceConnector
voiceConnector} -> Maybe VoiceConnector
voiceConnector) (\s :: CreateVoiceConnectorResponse
s@CreateVoiceConnectorResponse' {} Maybe VoiceConnector
a -> CreateVoiceConnectorResponse
s {$sel:voiceConnector:CreateVoiceConnectorResponse' :: Maybe VoiceConnector
voiceConnector = Maybe VoiceConnector
a} :: CreateVoiceConnectorResponse)
createVoiceConnectorResponse_httpStatus :: Lens.Lens' CreateVoiceConnectorResponse Prelude.Int
createVoiceConnectorResponse_httpStatus :: (Int -> f Int)
-> CreateVoiceConnectorResponse -> f CreateVoiceConnectorResponse
createVoiceConnectorResponse_httpStatus = (CreateVoiceConnectorResponse -> Int)
-> (CreateVoiceConnectorResponse
-> Int -> CreateVoiceConnectorResponse)
-> Lens
CreateVoiceConnectorResponse CreateVoiceConnectorResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVoiceConnectorResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateVoiceConnectorResponse' :: CreateVoiceConnectorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateVoiceConnectorResponse
s@CreateVoiceConnectorResponse' {} Int
a -> CreateVoiceConnectorResponse
s {$sel:httpStatus:CreateVoiceConnectorResponse' :: Int
httpStatus = Int
a} :: CreateVoiceConnectorResponse)
instance Prelude.NFData CreateVoiceConnectorResponse