{-# 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.KinesisVideo.Types.EdgeConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KinesisVideo.Types.DeletionConfig
import Amazonka.KinesisVideo.Types.RecorderConfig
import Amazonka.KinesisVideo.Types.UploaderConfig
import qualified Amazonka.Prelude as Prelude
data EdgeConfig = EdgeConfig'
{
EdgeConfig -> Maybe DeletionConfig
deletionConfig :: Prelude.Maybe DeletionConfig,
EdgeConfig -> Maybe UploaderConfig
uploaderConfig :: Prelude.Maybe UploaderConfig,
EdgeConfig -> Text
hubDeviceArn :: Prelude.Text,
EdgeConfig -> RecorderConfig
recorderConfig :: RecorderConfig
}
deriving (EdgeConfig -> EdgeConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EdgeConfig -> EdgeConfig -> Bool
$c/= :: EdgeConfig -> EdgeConfig -> Bool
== :: EdgeConfig -> EdgeConfig -> Bool
$c== :: EdgeConfig -> EdgeConfig -> Bool
Prelude.Eq, Int -> EdgeConfig -> ShowS
[EdgeConfig] -> ShowS
EdgeConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EdgeConfig] -> ShowS
$cshowList :: [EdgeConfig] -> ShowS
show :: EdgeConfig -> String
$cshow :: EdgeConfig -> String
showsPrec :: Int -> EdgeConfig -> ShowS
$cshowsPrec :: Int -> EdgeConfig -> ShowS
Prelude.Show, forall x. Rep EdgeConfig x -> EdgeConfig
forall x. EdgeConfig -> Rep EdgeConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EdgeConfig x -> EdgeConfig
$cfrom :: forall x. EdgeConfig -> Rep EdgeConfig x
Prelude.Generic)
newEdgeConfig ::
Prelude.Text ->
RecorderConfig ->
EdgeConfig
newEdgeConfig :: Text -> RecorderConfig -> EdgeConfig
newEdgeConfig Text
pHubDeviceArn_ RecorderConfig
pRecorderConfig_ =
EdgeConfig'
{ $sel:deletionConfig:EdgeConfig' :: Maybe DeletionConfig
deletionConfig = forall a. Maybe a
Prelude.Nothing,
$sel:uploaderConfig:EdgeConfig' :: Maybe UploaderConfig
uploaderConfig = forall a. Maybe a
Prelude.Nothing,
$sel:hubDeviceArn:EdgeConfig' :: Text
hubDeviceArn = Text
pHubDeviceArn_,
$sel:recorderConfig:EdgeConfig' :: RecorderConfig
recorderConfig = RecorderConfig
pRecorderConfig_
}
edgeConfig_deletionConfig :: Lens.Lens' EdgeConfig (Prelude.Maybe DeletionConfig)
edgeConfig_deletionConfig :: Lens' EdgeConfig (Maybe DeletionConfig)
edgeConfig_deletionConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeConfig' {Maybe DeletionConfig
deletionConfig :: Maybe DeletionConfig
$sel:deletionConfig:EdgeConfig' :: EdgeConfig -> Maybe DeletionConfig
deletionConfig} -> Maybe DeletionConfig
deletionConfig) (\s :: EdgeConfig
s@EdgeConfig' {} Maybe DeletionConfig
a -> EdgeConfig
s {$sel:deletionConfig:EdgeConfig' :: Maybe DeletionConfig
deletionConfig = Maybe DeletionConfig
a} :: EdgeConfig)
edgeConfig_uploaderConfig :: Lens.Lens' EdgeConfig (Prelude.Maybe UploaderConfig)
edgeConfig_uploaderConfig :: Lens' EdgeConfig (Maybe UploaderConfig)
edgeConfig_uploaderConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeConfig' {Maybe UploaderConfig
uploaderConfig :: Maybe UploaderConfig
$sel:uploaderConfig:EdgeConfig' :: EdgeConfig -> Maybe UploaderConfig
uploaderConfig} -> Maybe UploaderConfig
uploaderConfig) (\s :: EdgeConfig
s@EdgeConfig' {} Maybe UploaderConfig
a -> EdgeConfig
s {$sel:uploaderConfig:EdgeConfig' :: Maybe UploaderConfig
uploaderConfig = Maybe UploaderConfig
a} :: EdgeConfig)
edgeConfig_hubDeviceArn :: Lens.Lens' EdgeConfig Prelude.Text
edgeConfig_hubDeviceArn :: Lens' EdgeConfig Text
edgeConfig_hubDeviceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeConfig' {Text
hubDeviceArn :: Text
$sel:hubDeviceArn:EdgeConfig' :: EdgeConfig -> Text
hubDeviceArn} -> Text
hubDeviceArn) (\s :: EdgeConfig
s@EdgeConfig' {} Text
a -> EdgeConfig
s {$sel:hubDeviceArn:EdgeConfig' :: Text
hubDeviceArn = Text
a} :: EdgeConfig)
edgeConfig_recorderConfig :: Lens.Lens' EdgeConfig RecorderConfig
edgeConfig_recorderConfig :: Lens' EdgeConfig RecorderConfig
edgeConfig_recorderConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeConfig' {RecorderConfig
recorderConfig :: RecorderConfig
$sel:recorderConfig:EdgeConfig' :: EdgeConfig -> RecorderConfig
recorderConfig} -> RecorderConfig
recorderConfig) (\s :: EdgeConfig
s@EdgeConfig' {} RecorderConfig
a -> EdgeConfig
s {$sel:recorderConfig:EdgeConfig' :: RecorderConfig
recorderConfig = RecorderConfig
a} :: EdgeConfig)
instance Data.FromJSON EdgeConfig where
parseJSON :: Value -> Parser EdgeConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EdgeConfig"
( \Object
x ->
Maybe DeletionConfig
-> Maybe UploaderConfig -> Text -> RecorderConfig -> EdgeConfig
EdgeConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DeletionConfig")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"UploaderConfig")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"HubDeviceArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"RecorderConfig")
)
instance Prelude.Hashable EdgeConfig where
hashWithSalt :: Int -> EdgeConfig -> Int
hashWithSalt Int
_salt EdgeConfig' {Maybe DeletionConfig
Maybe UploaderConfig
Text
RecorderConfig
recorderConfig :: RecorderConfig
hubDeviceArn :: Text
uploaderConfig :: Maybe UploaderConfig
deletionConfig :: Maybe DeletionConfig
$sel:recorderConfig:EdgeConfig' :: EdgeConfig -> RecorderConfig
$sel:hubDeviceArn:EdgeConfig' :: EdgeConfig -> Text
$sel:uploaderConfig:EdgeConfig' :: EdgeConfig -> Maybe UploaderConfig
$sel:deletionConfig:EdgeConfig' :: EdgeConfig -> Maybe DeletionConfig
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeletionConfig
deletionConfig
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UploaderConfig
uploaderConfig
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
hubDeviceArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RecorderConfig
recorderConfig
instance Prelude.NFData EdgeConfig where
rnf :: EdgeConfig -> ()
rnf EdgeConfig' {Maybe DeletionConfig
Maybe UploaderConfig
Text
RecorderConfig
recorderConfig :: RecorderConfig
hubDeviceArn :: Text
uploaderConfig :: Maybe UploaderConfig
deletionConfig :: Maybe DeletionConfig
$sel:recorderConfig:EdgeConfig' :: EdgeConfig -> RecorderConfig
$sel:hubDeviceArn:EdgeConfig' :: EdgeConfig -> Text
$sel:uploaderConfig:EdgeConfig' :: EdgeConfig -> Maybe UploaderConfig
$sel:deletionConfig:EdgeConfig' :: EdgeConfig -> Maybe DeletionConfig
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe DeletionConfig
deletionConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UploaderConfig
uploaderConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
hubDeviceArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RecorderConfig
recorderConfig
instance Data.ToJSON EdgeConfig where
toJSON :: EdgeConfig -> Value
toJSON EdgeConfig' {Maybe DeletionConfig
Maybe UploaderConfig
Text
RecorderConfig
recorderConfig :: RecorderConfig
hubDeviceArn :: Text
uploaderConfig :: Maybe UploaderConfig
deletionConfig :: Maybe DeletionConfig
$sel:recorderConfig:EdgeConfig' :: EdgeConfig -> RecorderConfig
$sel:hubDeviceArn:EdgeConfig' :: EdgeConfig -> Text
$sel:uploaderConfig:EdgeConfig' :: EdgeConfig -> Maybe UploaderConfig
$sel:deletionConfig:EdgeConfig' :: EdgeConfig -> Maybe DeletionConfig
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DeletionConfig" 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 DeletionConfig
deletionConfig,
(Key
"UploaderConfig" 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 UploaderConfig
uploaderConfig,
forall a. a -> Maybe a
Prelude.Just (Key
"HubDeviceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
hubDeviceArn),
forall a. a -> Maybe a
Prelude.Just
(Key
"RecorderConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= RecorderConfig
recorderConfig)
]
)