{-# 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.Chime.Types.StreamingConfiguration where
import Amazonka.Chime.Types.StreamingNotificationTarget
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data StreamingConfiguration = StreamingConfiguration'
{
StreamingConfiguration -> Maybe Bool
disabled :: Prelude.Maybe Prelude.Bool,
StreamingConfiguration
-> Maybe (NonEmpty StreamingNotificationTarget)
streamingNotificationTargets :: Prelude.Maybe (Prelude.NonEmpty StreamingNotificationTarget),
StreamingConfiguration -> Natural
dataRetentionInHours :: Prelude.Natural
}
deriving (StreamingConfiguration -> StreamingConfiguration -> Bool
(StreamingConfiguration -> StreamingConfiguration -> Bool)
-> (StreamingConfiguration -> StreamingConfiguration -> Bool)
-> Eq StreamingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamingConfiguration -> StreamingConfiguration -> Bool
$c/= :: StreamingConfiguration -> StreamingConfiguration -> Bool
== :: StreamingConfiguration -> StreamingConfiguration -> Bool
$c== :: StreamingConfiguration -> StreamingConfiguration -> Bool
Prelude.Eq, ReadPrec [StreamingConfiguration]
ReadPrec StreamingConfiguration
Int -> ReadS StreamingConfiguration
ReadS [StreamingConfiguration]
(Int -> ReadS StreamingConfiguration)
-> ReadS [StreamingConfiguration]
-> ReadPrec StreamingConfiguration
-> ReadPrec [StreamingConfiguration]
-> Read StreamingConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamingConfiguration]
$creadListPrec :: ReadPrec [StreamingConfiguration]
readPrec :: ReadPrec StreamingConfiguration
$creadPrec :: ReadPrec StreamingConfiguration
readList :: ReadS [StreamingConfiguration]
$creadList :: ReadS [StreamingConfiguration]
readsPrec :: Int -> ReadS StreamingConfiguration
$creadsPrec :: Int -> ReadS StreamingConfiguration
Prelude.Read, Int -> StreamingConfiguration -> ShowS
[StreamingConfiguration] -> ShowS
StreamingConfiguration -> String
(Int -> StreamingConfiguration -> ShowS)
-> (StreamingConfiguration -> String)
-> ([StreamingConfiguration] -> ShowS)
-> Show StreamingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamingConfiguration] -> ShowS
$cshowList :: [StreamingConfiguration] -> ShowS
show :: StreamingConfiguration -> String
$cshow :: StreamingConfiguration -> String
showsPrec :: Int -> StreamingConfiguration -> ShowS
$cshowsPrec :: Int -> StreamingConfiguration -> ShowS
Prelude.Show, (forall x. StreamingConfiguration -> Rep StreamingConfiguration x)
-> (forall x.
Rep StreamingConfiguration x -> StreamingConfiguration)
-> Generic StreamingConfiguration
forall x. Rep StreamingConfiguration x -> StreamingConfiguration
forall x. StreamingConfiguration -> Rep StreamingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamingConfiguration x -> StreamingConfiguration
$cfrom :: forall x. StreamingConfiguration -> Rep StreamingConfiguration x
Prelude.Generic)
newStreamingConfiguration ::
Prelude.Natural ->
StreamingConfiguration
newStreamingConfiguration :: Natural -> StreamingConfiguration
newStreamingConfiguration Natural
pDataRetentionInHours_ =
StreamingConfiguration' :: Maybe Bool
-> Maybe (NonEmpty StreamingNotificationTarget)
-> Natural
-> StreamingConfiguration
StreamingConfiguration'
{ $sel:disabled:StreamingConfiguration' :: Maybe Bool
disabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:streamingNotificationTargets:StreamingConfiguration' :: Maybe (NonEmpty StreamingNotificationTarget)
streamingNotificationTargets = Maybe (NonEmpty StreamingNotificationTarget)
forall a. Maybe a
Prelude.Nothing,
$sel:dataRetentionInHours:StreamingConfiguration' :: Natural
dataRetentionInHours = Natural
pDataRetentionInHours_
}
streamingConfiguration_disabled :: Lens.Lens' StreamingConfiguration (Prelude.Maybe Prelude.Bool)
streamingConfiguration_disabled :: (Maybe Bool -> f (Maybe Bool))
-> StreamingConfiguration -> f StreamingConfiguration
streamingConfiguration_disabled = (StreamingConfiguration -> Maybe Bool)
-> (StreamingConfiguration -> Maybe Bool -> StreamingConfiguration)
-> Lens
StreamingConfiguration
StreamingConfiguration
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingConfiguration' {Maybe Bool
disabled :: Maybe Bool
$sel:disabled:StreamingConfiguration' :: StreamingConfiguration -> Maybe Bool
disabled} -> Maybe Bool
disabled) (\s :: StreamingConfiguration
s@StreamingConfiguration' {} Maybe Bool
a -> StreamingConfiguration
s {$sel:disabled:StreamingConfiguration' :: Maybe Bool
disabled = Maybe Bool
a} :: StreamingConfiguration)
streamingConfiguration_streamingNotificationTargets :: Lens.Lens' StreamingConfiguration (Prelude.Maybe (Prelude.NonEmpty StreamingNotificationTarget))
streamingConfiguration_streamingNotificationTargets :: (Maybe (NonEmpty StreamingNotificationTarget)
-> f (Maybe (NonEmpty StreamingNotificationTarget)))
-> StreamingConfiguration -> f StreamingConfiguration
streamingConfiguration_streamingNotificationTargets = (StreamingConfiguration
-> Maybe (NonEmpty StreamingNotificationTarget))
-> (StreamingConfiguration
-> Maybe (NonEmpty StreamingNotificationTarget)
-> StreamingConfiguration)
-> Lens
StreamingConfiguration
StreamingConfiguration
(Maybe (NonEmpty StreamingNotificationTarget))
(Maybe (NonEmpty StreamingNotificationTarget))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingConfiguration' {Maybe (NonEmpty StreamingNotificationTarget)
streamingNotificationTargets :: Maybe (NonEmpty StreamingNotificationTarget)
$sel:streamingNotificationTargets:StreamingConfiguration' :: StreamingConfiguration
-> Maybe (NonEmpty StreamingNotificationTarget)
streamingNotificationTargets} -> Maybe (NonEmpty StreamingNotificationTarget)
streamingNotificationTargets) (\s :: StreamingConfiguration
s@StreamingConfiguration' {} Maybe (NonEmpty StreamingNotificationTarget)
a -> StreamingConfiguration
s {$sel:streamingNotificationTargets:StreamingConfiguration' :: Maybe (NonEmpty StreamingNotificationTarget)
streamingNotificationTargets = Maybe (NonEmpty StreamingNotificationTarget)
a} :: StreamingConfiguration) ((Maybe (NonEmpty StreamingNotificationTarget)
-> f (Maybe (NonEmpty StreamingNotificationTarget)))
-> StreamingConfiguration -> f StreamingConfiguration)
-> ((Maybe (NonEmpty StreamingNotificationTarget)
-> f (Maybe (NonEmpty StreamingNotificationTarget)))
-> Maybe (NonEmpty StreamingNotificationTarget)
-> f (Maybe (NonEmpty StreamingNotificationTarget)))
-> (Maybe (NonEmpty StreamingNotificationTarget)
-> f (Maybe (NonEmpty StreamingNotificationTarget)))
-> StreamingConfiguration
-> f StreamingConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty StreamingNotificationTarget)
(NonEmpty StreamingNotificationTarget)
(NonEmpty StreamingNotificationTarget)
(NonEmpty StreamingNotificationTarget)
-> Iso
(Maybe (NonEmpty StreamingNotificationTarget))
(Maybe (NonEmpty StreamingNotificationTarget))
(Maybe (NonEmpty StreamingNotificationTarget))
(Maybe (NonEmpty StreamingNotificationTarget))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty StreamingNotificationTarget)
(NonEmpty StreamingNotificationTarget)
(NonEmpty StreamingNotificationTarget)
(NonEmpty StreamingNotificationTarget)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
streamingConfiguration_dataRetentionInHours :: Lens.Lens' StreamingConfiguration Prelude.Natural
streamingConfiguration_dataRetentionInHours :: (Natural -> f Natural)
-> StreamingConfiguration -> f StreamingConfiguration
streamingConfiguration_dataRetentionInHours = (StreamingConfiguration -> Natural)
-> (StreamingConfiguration -> Natural -> StreamingConfiguration)
-> Lens
StreamingConfiguration StreamingConfiguration Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingConfiguration' {Natural
dataRetentionInHours :: Natural
$sel:dataRetentionInHours:StreamingConfiguration' :: StreamingConfiguration -> Natural
dataRetentionInHours} -> Natural
dataRetentionInHours) (\s :: StreamingConfiguration
s@StreamingConfiguration' {} Natural
a -> StreamingConfiguration
s {$sel:dataRetentionInHours:StreamingConfiguration' :: Natural
dataRetentionInHours = Natural
a} :: StreamingConfiguration)
instance Core.FromJSON StreamingConfiguration where
parseJSON :: Value -> Parser StreamingConfiguration
parseJSON =
String
-> (Object -> Parser StreamingConfiguration)
-> Value
-> Parser StreamingConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"StreamingConfiguration"
( \Object
x ->
Maybe Bool
-> Maybe (NonEmpty StreamingNotificationTarget)
-> Natural
-> StreamingConfiguration
StreamingConfiguration'
(Maybe Bool
-> Maybe (NonEmpty StreamingNotificationTarget)
-> Natural
-> StreamingConfiguration)
-> Parser (Maybe Bool)
-> Parser
(Maybe (NonEmpty StreamingNotificationTarget)
-> Natural -> StreamingConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Disabled")
Parser
(Maybe (NonEmpty StreamingNotificationTarget)
-> Natural -> StreamingConfiguration)
-> Parser (Maybe (NonEmpty StreamingNotificationTarget))
-> Parser (Natural -> StreamingConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (NonEmpty StreamingNotificationTarget))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StreamingNotificationTargets")
Parser (Natural -> StreamingConfiguration)
-> Parser Natural -> Parser StreamingConfiguration
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
"DataRetentionInHours")
)
instance Prelude.Hashable StreamingConfiguration
instance Prelude.NFData StreamingConfiguration
instance Core.ToJSON StreamingConfiguration where
toJSON :: StreamingConfiguration -> Value
toJSON StreamingConfiguration' {Natural
Maybe Bool
Maybe (NonEmpty StreamingNotificationTarget)
dataRetentionInHours :: Natural
streamingNotificationTargets :: Maybe (NonEmpty StreamingNotificationTarget)
disabled :: Maybe Bool
$sel:dataRetentionInHours:StreamingConfiguration' :: StreamingConfiguration -> Natural
$sel:streamingNotificationTargets:StreamingConfiguration' :: StreamingConfiguration
-> Maybe (NonEmpty StreamingNotificationTarget)
$sel:disabled:StreamingConfiguration' :: StreamingConfiguration -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Disabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
disabled,
(Text
"StreamingNotificationTargets" Text -> NonEmpty StreamingNotificationTarget -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty StreamingNotificationTarget -> Pair)
-> Maybe (NonEmpty StreamingNotificationTarget) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty StreamingNotificationTarget)
streamingNotificationTargets,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"DataRetentionInHours"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
dataRetentionInHours
)
]
)