{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Connect.Types.MediaConcurrency where
import Amazonka.Connect.Types.Channel
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data MediaConcurrency = MediaConcurrency'
{
MediaConcurrency -> Channel
channel :: Channel,
MediaConcurrency -> Natural
concurrency :: Prelude.Natural
}
deriving (MediaConcurrency -> MediaConcurrency -> Bool
(MediaConcurrency -> MediaConcurrency -> Bool)
-> (MediaConcurrency -> MediaConcurrency -> Bool)
-> Eq MediaConcurrency
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MediaConcurrency -> MediaConcurrency -> Bool
$c/= :: MediaConcurrency -> MediaConcurrency -> Bool
== :: MediaConcurrency -> MediaConcurrency -> Bool
$c== :: MediaConcurrency -> MediaConcurrency -> Bool
Prelude.Eq, ReadPrec [MediaConcurrency]
ReadPrec MediaConcurrency
Int -> ReadS MediaConcurrency
ReadS [MediaConcurrency]
(Int -> ReadS MediaConcurrency)
-> ReadS [MediaConcurrency]
-> ReadPrec MediaConcurrency
-> ReadPrec [MediaConcurrency]
-> Read MediaConcurrency
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MediaConcurrency]
$creadListPrec :: ReadPrec [MediaConcurrency]
readPrec :: ReadPrec MediaConcurrency
$creadPrec :: ReadPrec MediaConcurrency
readList :: ReadS [MediaConcurrency]
$creadList :: ReadS [MediaConcurrency]
readsPrec :: Int -> ReadS MediaConcurrency
$creadsPrec :: Int -> ReadS MediaConcurrency
Prelude.Read, Int -> MediaConcurrency -> ShowS
[MediaConcurrency] -> ShowS
MediaConcurrency -> String
(Int -> MediaConcurrency -> ShowS)
-> (MediaConcurrency -> String)
-> ([MediaConcurrency] -> ShowS)
-> Show MediaConcurrency
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MediaConcurrency] -> ShowS
$cshowList :: [MediaConcurrency] -> ShowS
show :: MediaConcurrency -> String
$cshow :: MediaConcurrency -> String
showsPrec :: Int -> MediaConcurrency -> ShowS
$cshowsPrec :: Int -> MediaConcurrency -> ShowS
Prelude.Show, (forall x. MediaConcurrency -> Rep MediaConcurrency x)
-> (forall x. Rep MediaConcurrency x -> MediaConcurrency)
-> Generic MediaConcurrency
forall x. Rep MediaConcurrency x -> MediaConcurrency
forall x. MediaConcurrency -> Rep MediaConcurrency x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MediaConcurrency x -> MediaConcurrency
$cfrom :: forall x. MediaConcurrency -> Rep MediaConcurrency x
Prelude.Generic)
newMediaConcurrency ::
Channel ->
Prelude.Natural ->
MediaConcurrency
newMediaConcurrency :: Channel -> Natural -> MediaConcurrency
newMediaConcurrency Channel
pChannel_ Natural
pConcurrency_ =
MediaConcurrency' :: Channel -> Natural -> MediaConcurrency
MediaConcurrency'
{ $sel:channel:MediaConcurrency' :: Channel
channel = Channel
pChannel_,
$sel:concurrency:MediaConcurrency' :: Natural
concurrency = Natural
pConcurrency_
}
mediaConcurrency_channel :: Lens.Lens' MediaConcurrency Channel
mediaConcurrency_channel :: (Channel -> f Channel) -> MediaConcurrency -> f MediaConcurrency
mediaConcurrency_channel = (MediaConcurrency -> Channel)
-> (MediaConcurrency -> Channel -> MediaConcurrency)
-> Lens MediaConcurrency MediaConcurrency Channel Channel
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaConcurrency' {Channel
channel :: Channel
$sel:channel:MediaConcurrency' :: MediaConcurrency -> Channel
channel} -> Channel
channel) (\s :: MediaConcurrency
s@MediaConcurrency' {} Channel
a -> MediaConcurrency
s {$sel:channel:MediaConcurrency' :: Channel
channel = Channel
a} :: MediaConcurrency)
mediaConcurrency_concurrency :: Lens.Lens' MediaConcurrency Prelude.Natural
mediaConcurrency_concurrency :: (Natural -> f Natural) -> MediaConcurrency -> f MediaConcurrency
mediaConcurrency_concurrency = (MediaConcurrency -> Natural)
-> (MediaConcurrency -> Natural -> MediaConcurrency)
-> Lens MediaConcurrency MediaConcurrency Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaConcurrency' {Natural
concurrency :: Natural
$sel:concurrency:MediaConcurrency' :: MediaConcurrency -> Natural
concurrency} -> Natural
concurrency) (\s :: MediaConcurrency
s@MediaConcurrency' {} Natural
a -> MediaConcurrency
s {$sel:concurrency:MediaConcurrency' :: Natural
concurrency = Natural
a} :: MediaConcurrency)
instance Core.FromJSON MediaConcurrency where
parseJSON :: Value -> Parser MediaConcurrency
parseJSON =
String
-> (Object -> Parser MediaConcurrency)
-> Value
-> Parser MediaConcurrency
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"MediaConcurrency"
( \Object
x ->
Channel -> Natural -> MediaConcurrency
MediaConcurrency'
(Channel -> Natural -> MediaConcurrency)
-> Parser Channel -> Parser (Natural -> MediaConcurrency)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Channel
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Channel")
Parser (Natural -> MediaConcurrency)
-> Parser Natural -> Parser MediaConcurrency
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Concurrency")
)
instance Prelude.Hashable MediaConcurrency
instance Prelude.NFData MediaConcurrency
instance Core.ToJSON MediaConcurrency where
toJSON :: MediaConcurrency -> Value
toJSON MediaConcurrency' {Natural
Channel
concurrency :: Natural
channel :: Channel
$sel:concurrency:MediaConcurrency' :: MediaConcurrency -> Natural
$sel:channel:MediaConcurrency' :: MediaConcurrency -> Channel
..} =
[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
"Channel" Text -> Channel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Channel
channel),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Concurrency" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
concurrency)
]
)