{-# 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.ChimeSdkVoice.CreateVoiceConnector
(
CreateVoiceConnector (..),
newCreateVoiceConnector,
createVoiceConnector_awsRegion,
createVoiceConnector_name,
createVoiceConnector_requireEncryption,
CreateVoiceConnectorResponse (..),
newCreateVoiceConnectorResponse,
createVoiceConnectorResponse_voiceConnector,
createVoiceConnectorResponse_httpStatus,
)
where
import Amazonka.ChimeSdkVoice.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:awsRegion:CreateVoiceConnector' :: Maybe VoiceConnectorAwsRegion
awsRegion = 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 :: Lens' CreateVoiceConnector (Maybe VoiceConnectorAwsRegion)
createVoiceConnector_awsRegion = 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 :: Lens' CreateVoiceConnector Text
createVoiceConnector_name = 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 :: Lens' CreateVoiceConnector Bool
createVoiceConnector_requireEncryption = 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 :: (Service -> Service)
-> CreateVoiceConnector -> Request CreateVoiceConnector
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateVoiceConnector
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateVoiceConnector)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe VoiceConnector -> Int -> CreateVoiceConnectorResponse
CreateVoiceConnectorResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"VoiceConnector")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateVoiceConnector where
hashWithSalt :: Int -> CreateVoiceConnector -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VoiceConnectorAwsRegion
awsRegion
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
requireEncryption
instance Prelude.NFData CreateVoiceConnector where
rnf :: CreateVoiceConnector -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe VoiceConnectorAwsRegion
awsRegion
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
requireEncryption
instance Data.ToHeaders CreateVoiceConnector where
toHeaders :: CreateVoiceConnector -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AwsRegion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VoiceConnectorAwsRegion
awsRegion,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just
(Key
"RequireEncryption" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
requireEncryption)
]
)
instance Data.ToPath CreateVoiceConnector where
toPath :: CreateVoiceConnector -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/voice-connectors"
instance Data.ToQuery CreateVoiceConnector where
toQuery :: CreateVoiceConnector -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:voiceConnector:CreateVoiceConnectorResponse' :: Maybe VoiceConnector
voiceConnector =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateVoiceConnectorResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createVoiceConnectorResponse_voiceConnector :: Lens.Lens' CreateVoiceConnectorResponse (Prelude.Maybe VoiceConnector)
createVoiceConnectorResponse_voiceConnector :: Lens' CreateVoiceConnectorResponse (Maybe VoiceConnector)
createVoiceConnectorResponse_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 :: Lens' CreateVoiceConnectorResponse Int
createVoiceConnectorResponse_httpStatus = 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 where
rnf :: CreateVoiceConnectorResponse -> ()
rnf CreateVoiceConnectorResponse' {Int
Maybe VoiceConnector
httpStatus :: Int
voiceConnector :: Maybe VoiceConnector
$sel:httpStatus:CreateVoiceConnectorResponse' :: CreateVoiceConnectorResponse -> Int
$sel:voiceConnector:CreateVoiceConnectorResponse' :: CreateVoiceConnectorResponse -> Maybe VoiceConnector
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe VoiceConnector
voiceConnector
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus