{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Connect.Types.KinesisVideoStreamConfig
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Connect.Types.KinesisVideoStreamConfig where

import Amazonka.Connect.Types.EncryptionConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Configuration information of a Kinesis video stream.
--
-- /See:/ 'newKinesisVideoStreamConfig' smart constructor.
data KinesisVideoStreamConfig = KinesisVideoStreamConfig'
  { -- | The prefix of the video stream.
    KinesisVideoStreamConfig -> Text
prefix :: Prelude.Text,
    -- | The number of hours data is retained in the stream. Kinesis Video
    -- Streams retains the data in a data store that is associated with the
    -- stream.
    --
    -- The default value is 0, indicating that the stream does not persist
    -- data.
    KinesisVideoStreamConfig -> Natural
retentionPeriodHours :: Prelude.Natural,
    -- | The encryption configuration.
    KinesisVideoStreamConfig -> EncryptionConfig
encryptionConfig :: EncryptionConfig
  }
  deriving (KinesisVideoStreamConfig -> KinesisVideoStreamConfig -> Bool
(KinesisVideoStreamConfig -> KinesisVideoStreamConfig -> Bool)
-> (KinesisVideoStreamConfig -> KinesisVideoStreamConfig -> Bool)
-> Eq KinesisVideoStreamConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KinesisVideoStreamConfig -> KinesisVideoStreamConfig -> Bool
$c/= :: KinesisVideoStreamConfig -> KinesisVideoStreamConfig -> Bool
== :: KinesisVideoStreamConfig -> KinesisVideoStreamConfig -> Bool
$c== :: KinesisVideoStreamConfig -> KinesisVideoStreamConfig -> Bool
Prelude.Eq, ReadPrec [KinesisVideoStreamConfig]
ReadPrec KinesisVideoStreamConfig
Int -> ReadS KinesisVideoStreamConfig
ReadS [KinesisVideoStreamConfig]
(Int -> ReadS KinesisVideoStreamConfig)
-> ReadS [KinesisVideoStreamConfig]
-> ReadPrec KinesisVideoStreamConfig
-> ReadPrec [KinesisVideoStreamConfig]
-> Read KinesisVideoStreamConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KinesisVideoStreamConfig]
$creadListPrec :: ReadPrec [KinesisVideoStreamConfig]
readPrec :: ReadPrec KinesisVideoStreamConfig
$creadPrec :: ReadPrec KinesisVideoStreamConfig
readList :: ReadS [KinesisVideoStreamConfig]
$creadList :: ReadS [KinesisVideoStreamConfig]
readsPrec :: Int -> ReadS KinesisVideoStreamConfig
$creadsPrec :: Int -> ReadS KinesisVideoStreamConfig
Prelude.Read, Int -> KinesisVideoStreamConfig -> ShowS
[KinesisVideoStreamConfig] -> ShowS
KinesisVideoStreamConfig -> String
(Int -> KinesisVideoStreamConfig -> ShowS)
-> (KinesisVideoStreamConfig -> String)
-> ([KinesisVideoStreamConfig] -> ShowS)
-> Show KinesisVideoStreamConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KinesisVideoStreamConfig] -> ShowS
$cshowList :: [KinesisVideoStreamConfig] -> ShowS
show :: KinesisVideoStreamConfig -> String
$cshow :: KinesisVideoStreamConfig -> String
showsPrec :: Int -> KinesisVideoStreamConfig -> ShowS
$cshowsPrec :: Int -> KinesisVideoStreamConfig -> ShowS
Prelude.Show, (forall x.
 KinesisVideoStreamConfig -> Rep KinesisVideoStreamConfig x)
-> (forall x.
    Rep KinesisVideoStreamConfig x -> KinesisVideoStreamConfig)
-> Generic KinesisVideoStreamConfig
forall x.
Rep KinesisVideoStreamConfig x -> KinesisVideoStreamConfig
forall x.
KinesisVideoStreamConfig -> Rep KinesisVideoStreamConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep KinesisVideoStreamConfig x -> KinesisVideoStreamConfig
$cfrom :: forall x.
KinesisVideoStreamConfig -> Rep KinesisVideoStreamConfig x
Prelude.Generic)

-- |
-- Create a value of 'KinesisVideoStreamConfig' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'prefix', 'kinesisVideoStreamConfig_prefix' - The prefix of the video stream.
--
-- 'retentionPeriodHours', 'kinesisVideoStreamConfig_retentionPeriodHours' - The number of hours data is retained in the stream. Kinesis Video
-- Streams retains the data in a data store that is associated with the
-- stream.
--
-- The default value is 0, indicating that the stream does not persist
-- data.
--
-- 'encryptionConfig', 'kinesisVideoStreamConfig_encryptionConfig' - The encryption configuration.
newKinesisVideoStreamConfig ::
  -- | 'prefix'
  Prelude.Text ->
  -- | 'retentionPeriodHours'
  Prelude.Natural ->
  -- | 'encryptionConfig'
  EncryptionConfig ->
  KinesisVideoStreamConfig
newKinesisVideoStreamConfig :: Text -> Natural -> EncryptionConfig -> KinesisVideoStreamConfig
newKinesisVideoStreamConfig
  Text
pPrefix_
  Natural
pRetentionPeriodHours_
  EncryptionConfig
pEncryptionConfig_ =
    KinesisVideoStreamConfig' :: Text -> Natural -> EncryptionConfig -> KinesisVideoStreamConfig
KinesisVideoStreamConfig'
      { $sel:prefix:KinesisVideoStreamConfig' :: Text
prefix = Text
pPrefix_,
        $sel:retentionPeriodHours:KinesisVideoStreamConfig' :: Natural
retentionPeriodHours = Natural
pRetentionPeriodHours_,
        $sel:encryptionConfig:KinesisVideoStreamConfig' :: EncryptionConfig
encryptionConfig = EncryptionConfig
pEncryptionConfig_
      }

-- | The prefix of the video stream.
kinesisVideoStreamConfig_prefix :: Lens.Lens' KinesisVideoStreamConfig Prelude.Text
kinesisVideoStreamConfig_prefix :: (Text -> f Text)
-> KinesisVideoStreamConfig -> f KinesisVideoStreamConfig
kinesisVideoStreamConfig_prefix = (KinesisVideoStreamConfig -> Text)
-> (KinesisVideoStreamConfig -> Text -> KinesisVideoStreamConfig)
-> Lens KinesisVideoStreamConfig KinesisVideoStreamConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisVideoStreamConfig' {Text
prefix :: Text
$sel:prefix:KinesisVideoStreamConfig' :: KinesisVideoStreamConfig -> Text
prefix} -> Text
prefix) (\s :: KinesisVideoStreamConfig
s@KinesisVideoStreamConfig' {} Text
a -> KinesisVideoStreamConfig
s {$sel:prefix:KinesisVideoStreamConfig' :: Text
prefix = Text
a} :: KinesisVideoStreamConfig)

-- | The number of hours data is retained in the stream. Kinesis Video
-- Streams retains the data in a data store that is associated with the
-- stream.
--
-- The default value is 0, indicating that the stream does not persist
-- data.
kinesisVideoStreamConfig_retentionPeriodHours :: Lens.Lens' KinesisVideoStreamConfig Prelude.Natural
kinesisVideoStreamConfig_retentionPeriodHours :: (Natural -> f Natural)
-> KinesisVideoStreamConfig -> f KinesisVideoStreamConfig
kinesisVideoStreamConfig_retentionPeriodHours = (KinesisVideoStreamConfig -> Natural)
-> (KinesisVideoStreamConfig
    -> Natural -> KinesisVideoStreamConfig)
-> Lens
     KinesisVideoStreamConfig KinesisVideoStreamConfig Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisVideoStreamConfig' {Natural
retentionPeriodHours :: Natural
$sel:retentionPeriodHours:KinesisVideoStreamConfig' :: KinesisVideoStreamConfig -> Natural
retentionPeriodHours} -> Natural
retentionPeriodHours) (\s :: KinesisVideoStreamConfig
s@KinesisVideoStreamConfig' {} Natural
a -> KinesisVideoStreamConfig
s {$sel:retentionPeriodHours:KinesisVideoStreamConfig' :: Natural
retentionPeriodHours = Natural
a} :: KinesisVideoStreamConfig)

-- | The encryption configuration.
kinesisVideoStreamConfig_encryptionConfig :: Lens.Lens' KinesisVideoStreamConfig EncryptionConfig
kinesisVideoStreamConfig_encryptionConfig :: (EncryptionConfig -> f EncryptionConfig)
-> KinesisVideoStreamConfig -> f KinesisVideoStreamConfig
kinesisVideoStreamConfig_encryptionConfig = (KinesisVideoStreamConfig -> EncryptionConfig)
-> (KinesisVideoStreamConfig
    -> EncryptionConfig -> KinesisVideoStreamConfig)
-> Lens
     KinesisVideoStreamConfig
     KinesisVideoStreamConfig
     EncryptionConfig
     EncryptionConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisVideoStreamConfig' {EncryptionConfig
encryptionConfig :: EncryptionConfig
$sel:encryptionConfig:KinesisVideoStreamConfig' :: KinesisVideoStreamConfig -> EncryptionConfig
encryptionConfig} -> EncryptionConfig
encryptionConfig) (\s :: KinesisVideoStreamConfig
s@KinesisVideoStreamConfig' {} EncryptionConfig
a -> KinesisVideoStreamConfig
s {$sel:encryptionConfig:KinesisVideoStreamConfig' :: EncryptionConfig
encryptionConfig = EncryptionConfig
a} :: KinesisVideoStreamConfig)

instance Core.FromJSON KinesisVideoStreamConfig where
  parseJSON :: Value -> Parser KinesisVideoStreamConfig
parseJSON =
    String
-> (Object -> Parser KinesisVideoStreamConfig)
-> Value
-> Parser KinesisVideoStreamConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"KinesisVideoStreamConfig"
      ( \Object
x ->
          Text -> Natural -> EncryptionConfig -> KinesisVideoStreamConfig
KinesisVideoStreamConfig'
            (Text -> Natural -> EncryptionConfig -> KinesisVideoStreamConfig)
-> Parser Text
-> Parser (Natural -> EncryptionConfig -> KinesisVideoStreamConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Prefix")
            Parser (Natural -> EncryptionConfig -> KinesisVideoStreamConfig)
-> Parser Natural
-> Parser (EncryptionConfig -> KinesisVideoStreamConfig)
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
"RetentionPeriodHours")
            Parser (EncryptionConfig -> KinesisVideoStreamConfig)
-> Parser EncryptionConfig -> Parser KinesisVideoStreamConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser EncryptionConfig
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EncryptionConfig")
      )

instance Prelude.Hashable KinesisVideoStreamConfig

instance Prelude.NFData KinesisVideoStreamConfig

instance Core.ToJSON KinesisVideoStreamConfig where
  toJSON :: KinesisVideoStreamConfig -> Value
toJSON KinesisVideoStreamConfig' {Natural
Text
EncryptionConfig
encryptionConfig :: EncryptionConfig
retentionPeriodHours :: Natural
prefix :: Text
$sel:encryptionConfig:KinesisVideoStreamConfig' :: KinesisVideoStreamConfig -> EncryptionConfig
$sel:retentionPeriodHours:KinesisVideoStreamConfig' :: KinesisVideoStreamConfig -> Natural
$sel:prefix:KinesisVideoStreamConfig' :: KinesisVideoStreamConfig -> 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
"Prefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
prefix),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"RetentionPeriodHours"
                  Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
retentionPeriodHours
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"EncryptionConfig" Text -> EncryptionConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= EncryptionConfig
encryptionConfig)
          ]
      )