{-# 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.CreateSipMediaApplication
(
CreateSipMediaApplication (..),
newCreateSipMediaApplication,
createSipMediaApplication_awsRegion,
createSipMediaApplication_name,
createSipMediaApplication_endpoints,
CreateSipMediaApplicationResponse (..),
newCreateSipMediaApplicationResponse,
createSipMediaApplicationResponse_sipMediaApplication,
createSipMediaApplicationResponse_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 CreateSipMediaApplication = CreateSipMediaApplication'
{
CreateSipMediaApplication -> Text
awsRegion :: Prelude.Text,
CreateSipMediaApplication -> Text
name :: Prelude.Text,
CreateSipMediaApplication -> NonEmpty SipMediaApplicationEndpoint
endpoints :: Prelude.NonEmpty SipMediaApplicationEndpoint
}
deriving (CreateSipMediaApplication -> CreateSipMediaApplication -> Bool
(CreateSipMediaApplication -> CreateSipMediaApplication -> Bool)
-> (CreateSipMediaApplication -> CreateSipMediaApplication -> Bool)
-> Eq CreateSipMediaApplication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSipMediaApplication -> CreateSipMediaApplication -> Bool
$c/= :: CreateSipMediaApplication -> CreateSipMediaApplication -> Bool
== :: CreateSipMediaApplication -> CreateSipMediaApplication -> Bool
$c== :: CreateSipMediaApplication -> CreateSipMediaApplication -> Bool
Prelude.Eq, Int -> CreateSipMediaApplication -> ShowS
[CreateSipMediaApplication] -> ShowS
CreateSipMediaApplication -> String
(Int -> CreateSipMediaApplication -> ShowS)
-> (CreateSipMediaApplication -> String)
-> ([CreateSipMediaApplication] -> ShowS)
-> Show CreateSipMediaApplication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSipMediaApplication] -> ShowS
$cshowList :: [CreateSipMediaApplication] -> ShowS
show :: CreateSipMediaApplication -> String
$cshow :: CreateSipMediaApplication -> String
showsPrec :: Int -> CreateSipMediaApplication -> ShowS
$cshowsPrec :: Int -> CreateSipMediaApplication -> ShowS
Prelude.Show, (forall x.
CreateSipMediaApplication -> Rep CreateSipMediaApplication x)
-> (forall x.
Rep CreateSipMediaApplication x -> CreateSipMediaApplication)
-> Generic CreateSipMediaApplication
forall x.
Rep CreateSipMediaApplication x -> CreateSipMediaApplication
forall x.
CreateSipMediaApplication -> Rep CreateSipMediaApplication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSipMediaApplication x -> CreateSipMediaApplication
$cfrom :: forall x.
CreateSipMediaApplication -> Rep CreateSipMediaApplication x
Prelude.Generic)
newCreateSipMediaApplication ::
Prelude.Text ->
Prelude.Text ->
Prelude.NonEmpty SipMediaApplicationEndpoint ->
CreateSipMediaApplication
newCreateSipMediaApplication :: Text
-> Text
-> NonEmpty SipMediaApplicationEndpoint
-> CreateSipMediaApplication
newCreateSipMediaApplication
Text
pAwsRegion_
Text
pName_
NonEmpty SipMediaApplicationEndpoint
pEndpoints_ =
CreateSipMediaApplication' :: Text
-> Text
-> NonEmpty SipMediaApplicationEndpoint
-> CreateSipMediaApplication
CreateSipMediaApplication'
{ $sel:awsRegion:CreateSipMediaApplication' :: Text
awsRegion = Text
pAwsRegion_,
$sel:name:CreateSipMediaApplication' :: Text
name = Text
pName_,
$sel:endpoints:CreateSipMediaApplication' :: NonEmpty SipMediaApplicationEndpoint
endpoints = Tagged
(NonEmpty SipMediaApplicationEndpoint)
(Identity (NonEmpty SipMediaApplicationEndpoint))
-> Tagged
(NonEmpty SipMediaApplicationEndpoint)
(Identity (NonEmpty SipMediaApplicationEndpoint))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty SipMediaApplicationEndpoint)
(Identity (NonEmpty SipMediaApplicationEndpoint))
-> Tagged
(NonEmpty SipMediaApplicationEndpoint)
(Identity (NonEmpty SipMediaApplicationEndpoint)))
-> NonEmpty SipMediaApplicationEndpoint
-> NonEmpty SipMediaApplicationEndpoint
forall t b. AReview t b -> b -> t
Lens.# NonEmpty SipMediaApplicationEndpoint
pEndpoints_
}
createSipMediaApplication_awsRegion :: Lens.Lens' CreateSipMediaApplication Prelude.Text
createSipMediaApplication_awsRegion :: (Text -> f Text)
-> CreateSipMediaApplication -> f CreateSipMediaApplication
createSipMediaApplication_awsRegion = (CreateSipMediaApplication -> Text)
-> (CreateSipMediaApplication -> Text -> CreateSipMediaApplication)
-> Lens
CreateSipMediaApplication CreateSipMediaApplication Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSipMediaApplication' {Text
awsRegion :: Text
$sel:awsRegion:CreateSipMediaApplication' :: CreateSipMediaApplication -> Text
awsRegion} -> Text
awsRegion) (\s :: CreateSipMediaApplication
s@CreateSipMediaApplication' {} Text
a -> CreateSipMediaApplication
s {$sel:awsRegion:CreateSipMediaApplication' :: Text
awsRegion = Text
a} :: CreateSipMediaApplication)
createSipMediaApplication_name :: Lens.Lens' CreateSipMediaApplication Prelude.Text
createSipMediaApplication_name :: (Text -> f Text)
-> CreateSipMediaApplication -> f CreateSipMediaApplication
createSipMediaApplication_name = (CreateSipMediaApplication -> Text)
-> (CreateSipMediaApplication -> Text -> CreateSipMediaApplication)
-> Lens
CreateSipMediaApplication CreateSipMediaApplication Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSipMediaApplication' {Text
name :: Text
$sel:name:CreateSipMediaApplication' :: CreateSipMediaApplication -> Text
name} -> Text
name) (\s :: CreateSipMediaApplication
s@CreateSipMediaApplication' {} Text
a -> CreateSipMediaApplication
s {$sel:name:CreateSipMediaApplication' :: Text
name = Text
a} :: CreateSipMediaApplication)
createSipMediaApplication_endpoints :: Lens.Lens' CreateSipMediaApplication (Prelude.NonEmpty SipMediaApplicationEndpoint)
createSipMediaApplication_endpoints :: (NonEmpty SipMediaApplicationEndpoint
-> f (NonEmpty SipMediaApplicationEndpoint))
-> CreateSipMediaApplication -> f CreateSipMediaApplication
createSipMediaApplication_endpoints = (CreateSipMediaApplication -> NonEmpty SipMediaApplicationEndpoint)
-> (CreateSipMediaApplication
-> NonEmpty SipMediaApplicationEndpoint
-> CreateSipMediaApplication)
-> Lens
CreateSipMediaApplication
CreateSipMediaApplication
(NonEmpty SipMediaApplicationEndpoint)
(NonEmpty SipMediaApplicationEndpoint)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSipMediaApplication' {NonEmpty SipMediaApplicationEndpoint
endpoints :: NonEmpty SipMediaApplicationEndpoint
$sel:endpoints:CreateSipMediaApplication' :: CreateSipMediaApplication -> NonEmpty SipMediaApplicationEndpoint
endpoints} -> NonEmpty SipMediaApplicationEndpoint
endpoints) (\s :: CreateSipMediaApplication
s@CreateSipMediaApplication' {} NonEmpty SipMediaApplicationEndpoint
a -> CreateSipMediaApplication
s {$sel:endpoints:CreateSipMediaApplication' :: NonEmpty SipMediaApplicationEndpoint
endpoints = NonEmpty SipMediaApplicationEndpoint
a} :: CreateSipMediaApplication) ((NonEmpty SipMediaApplicationEndpoint
-> f (NonEmpty SipMediaApplicationEndpoint))
-> CreateSipMediaApplication -> f CreateSipMediaApplication)
-> ((NonEmpty SipMediaApplicationEndpoint
-> f (NonEmpty SipMediaApplicationEndpoint))
-> NonEmpty SipMediaApplicationEndpoint
-> f (NonEmpty SipMediaApplicationEndpoint))
-> (NonEmpty SipMediaApplicationEndpoint
-> f (NonEmpty SipMediaApplicationEndpoint))
-> CreateSipMediaApplication
-> f CreateSipMediaApplication
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty SipMediaApplicationEndpoint
-> f (NonEmpty SipMediaApplicationEndpoint))
-> NonEmpty SipMediaApplicationEndpoint
-> f (NonEmpty SipMediaApplicationEndpoint)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateSipMediaApplication where
type
AWSResponse CreateSipMediaApplication =
CreateSipMediaApplicationResponse
request :: CreateSipMediaApplication -> Request CreateSipMediaApplication
request = Service
-> CreateSipMediaApplication -> Request CreateSipMediaApplication
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateSipMediaApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSipMediaApplication)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateSipMediaApplication))
-> Logger
-> Service
-> Proxy CreateSipMediaApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSipMediaApplication)))
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 SipMediaApplication
-> Int -> CreateSipMediaApplicationResponse
CreateSipMediaApplicationResponse'
(Maybe SipMediaApplication
-> Int -> CreateSipMediaApplicationResponse)
-> Either String (Maybe SipMediaApplication)
-> Either String (Int -> CreateSipMediaApplicationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SipMediaApplication)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SipMediaApplication")
Either String (Int -> CreateSipMediaApplicationResponse)
-> Either String Int
-> Either String CreateSipMediaApplicationResponse
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 CreateSipMediaApplication
instance Prelude.NFData CreateSipMediaApplication
instance Core.ToHeaders CreateSipMediaApplication where
toHeaders :: CreateSipMediaApplication -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateSipMediaApplication -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreateSipMediaApplication where
toJSON :: CreateSipMediaApplication -> Value
toJSON CreateSipMediaApplication' {NonEmpty SipMediaApplicationEndpoint
Text
endpoints :: NonEmpty SipMediaApplicationEndpoint
name :: Text
awsRegion :: Text
$sel:endpoints:CreateSipMediaApplication' :: CreateSipMediaApplication -> NonEmpty SipMediaApplicationEndpoint
$sel:name:CreateSipMediaApplication' :: CreateSipMediaApplication -> Text
$sel:awsRegion:CreateSipMediaApplication' :: CreateSipMediaApplication -> 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
"AwsRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
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
"Endpoints" Text -> NonEmpty SipMediaApplicationEndpoint -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty SipMediaApplicationEndpoint
endpoints)
]
)
instance Core.ToPath CreateSipMediaApplication where
toPath :: CreateSipMediaApplication -> ByteString
toPath = ByteString -> CreateSipMediaApplication -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/sip-media-applications"
instance Core.ToQuery CreateSipMediaApplication where
toQuery :: CreateSipMediaApplication -> QueryString
toQuery = QueryString -> CreateSipMediaApplication -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateSipMediaApplicationResponse = CreateSipMediaApplicationResponse'
{
CreateSipMediaApplicationResponse -> Maybe SipMediaApplication
sipMediaApplication :: Prelude.Maybe SipMediaApplication,
CreateSipMediaApplicationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateSipMediaApplicationResponse
-> CreateSipMediaApplicationResponse -> Bool
(CreateSipMediaApplicationResponse
-> CreateSipMediaApplicationResponse -> Bool)
-> (CreateSipMediaApplicationResponse
-> CreateSipMediaApplicationResponse -> Bool)
-> Eq CreateSipMediaApplicationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSipMediaApplicationResponse
-> CreateSipMediaApplicationResponse -> Bool
$c/= :: CreateSipMediaApplicationResponse
-> CreateSipMediaApplicationResponse -> Bool
== :: CreateSipMediaApplicationResponse
-> CreateSipMediaApplicationResponse -> Bool
$c== :: CreateSipMediaApplicationResponse
-> CreateSipMediaApplicationResponse -> Bool
Prelude.Eq, Int -> CreateSipMediaApplicationResponse -> ShowS
[CreateSipMediaApplicationResponse] -> ShowS
CreateSipMediaApplicationResponse -> String
(Int -> CreateSipMediaApplicationResponse -> ShowS)
-> (CreateSipMediaApplicationResponse -> String)
-> ([CreateSipMediaApplicationResponse] -> ShowS)
-> Show CreateSipMediaApplicationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSipMediaApplicationResponse] -> ShowS
$cshowList :: [CreateSipMediaApplicationResponse] -> ShowS
show :: CreateSipMediaApplicationResponse -> String
$cshow :: CreateSipMediaApplicationResponse -> String
showsPrec :: Int -> CreateSipMediaApplicationResponse -> ShowS
$cshowsPrec :: Int -> CreateSipMediaApplicationResponse -> ShowS
Prelude.Show, (forall x.
CreateSipMediaApplicationResponse
-> Rep CreateSipMediaApplicationResponse x)
-> (forall x.
Rep CreateSipMediaApplicationResponse x
-> CreateSipMediaApplicationResponse)
-> Generic CreateSipMediaApplicationResponse
forall x.
Rep CreateSipMediaApplicationResponse x
-> CreateSipMediaApplicationResponse
forall x.
CreateSipMediaApplicationResponse
-> Rep CreateSipMediaApplicationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSipMediaApplicationResponse x
-> CreateSipMediaApplicationResponse
$cfrom :: forall x.
CreateSipMediaApplicationResponse
-> Rep CreateSipMediaApplicationResponse x
Prelude.Generic)
newCreateSipMediaApplicationResponse ::
Prelude.Int ->
CreateSipMediaApplicationResponse
newCreateSipMediaApplicationResponse :: Int -> CreateSipMediaApplicationResponse
newCreateSipMediaApplicationResponse Int
pHttpStatus_ =
CreateSipMediaApplicationResponse' :: Maybe SipMediaApplication
-> Int -> CreateSipMediaApplicationResponse
CreateSipMediaApplicationResponse'
{ $sel:sipMediaApplication:CreateSipMediaApplicationResponse' :: Maybe SipMediaApplication
sipMediaApplication =
Maybe SipMediaApplication
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateSipMediaApplicationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createSipMediaApplicationResponse_sipMediaApplication :: Lens.Lens' CreateSipMediaApplicationResponse (Prelude.Maybe SipMediaApplication)
createSipMediaApplicationResponse_sipMediaApplication :: (Maybe SipMediaApplication -> f (Maybe SipMediaApplication))
-> CreateSipMediaApplicationResponse
-> f CreateSipMediaApplicationResponse
createSipMediaApplicationResponse_sipMediaApplication = (CreateSipMediaApplicationResponse -> Maybe SipMediaApplication)
-> (CreateSipMediaApplicationResponse
-> Maybe SipMediaApplication -> CreateSipMediaApplicationResponse)
-> Lens
CreateSipMediaApplicationResponse
CreateSipMediaApplicationResponse
(Maybe SipMediaApplication)
(Maybe SipMediaApplication)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSipMediaApplicationResponse' {Maybe SipMediaApplication
sipMediaApplication :: Maybe SipMediaApplication
$sel:sipMediaApplication:CreateSipMediaApplicationResponse' :: CreateSipMediaApplicationResponse -> Maybe SipMediaApplication
sipMediaApplication} -> Maybe SipMediaApplication
sipMediaApplication) (\s :: CreateSipMediaApplicationResponse
s@CreateSipMediaApplicationResponse' {} Maybe SipMediaApplication
a -> CreateSipMediaApplicationResponse
s {$sel:sipMediaApplication:CreateSipMediaApplicationResponse' :: Maybe SipMediaApplication
sipMediaApplication = Maybe SipMediaApplication
a} :: CreateSipMediaApplicationResponse)
createSipMediaApplicationResponse_httpStatus :: Lens.Lens' CreateSipMediaApplicationResponse Prelude.Int
createSipMediaApplicationResponse_httpStatus :: (Int -> f Int)
-> CreateSipMediaApplicationResponse
-> f CreateSipMediaApplicationResponse
createSipMediaApplicationResponse_httpStatus = (CreateSipMediaApplicationResponse -> Int)
-> (CreateSipMediaApplicationResponse
-> Int -> CreateSipMediaApplicationResponse)
-> Lens
CreateSipMediaApplicationResponse
CreateSipMediaApplicationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSipMediaApplicationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSipMediaApplicationResponse' :: CreateSipMediaApplicationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSipMediaApplicationResponse
s@CreateSipMediaApplicationResponse' {} Int
a -> CreateSipMediaApplicationResponse
s {$sel:httpStatus:CreateSipMediaApplicationResponse' :: Int
httpStatus = Int
a} :: CreateSipMediaApplicationResponse)
instance
Prelude.NFData
CreateSipMediaApplicationResponse