{-# 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.IVS.Types.RecordingConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IVS.Types.RecordingConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IVS.Types.DestinationConfiguration
import Amazonka.IVS.Types.RecordingConfigurationState
import Amazonka.IVS.Types.ThumbnailConfiguration
import qualified Amazonka.Prelude as Prelude

-- | An object representing a configuration to record a channel stream.
--
-- /See:/ 'newRecordingConfiguration' smart constructor.
data RecordingConfiguration = RecordingConfiguration'
  { -- | Recording-configuration name. The value does not need to be unique.
    RecordingConfiguration -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | If a broadcast disconnects and then reconnects within the specified
    -- interval, the multiple streams will be considered a single broadcast and
    -- merged together. Default: 0.
    RecordingConfiguration -> Maybe Natural
recordingReconnectWindowSeconds :: Prelude.Maybe Prelude.Natural,
    -- | Array of 1-50 maps, each of the form @string:string (key:value)@. See
    -- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>
    -- for more information, including restrictions that apply to tags and
    -- \"Tag naming limits and requirements\"; Amazon IVS has no
    -- service-specific constraints beyond what is documented there.
    RecordingConfiguration -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A complex type that allows you to enable\/disable the recording of
    -- thumbnails for a live session and modify the interval at which
    -- thumbnails are generated for the live session.
    RecordingConfiguration -> Maybe ThumbnailConfiguration
thumbnailConfiguration :: Prelude.Maybe ThumbnailConfiguration,
    -- | Recording-configuration ARN.
    RecordingConfiguration -> Text
arn :: Prelude.Text,
    -- | A complex type that contains information about where recorded video will
    -- be stored.
    RecordingConfiguration -> DestinationConfiguration
destinationConfiguration :: DestinationConfiguration,
    -- | Indicates the current state of the recording configuration. When the
    -- state is @ACTIVE@, the configuration is ready for recording a channel
    -- stream.
    RecordingConfiguration -> RecordingConfigurationState
state :: RecordingConfigurationState
  }
  deriving (RecordingConfiguration -> RecordingConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecordingConfiguration -> RecordingConfiguration -> Bool
$c/= :: RecordingConfiguration -> RecordingConfiguration -> Bool
== :: RecordingConfiguration -> RecordingConfiguration -> Bool
$c== :: RecordingConfiguration -> RecordingConfiguration -> Bool
Prelude.Eq, ReadPrec [RecordingConfiguration]
ReadPrec RecordingConfiguration
Int -> ReadS RecordingConfiguration
ReadS [RecordingConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecordingConfiguration]
$creadListPrec :: ReadPrec [RecordingConfiguration]
readPrec :: ReadPrec RecordingConfiguration
$creadPrec :: ReadPrec RecordingConfiguration
readList :: ReadS [RecordingConfiguration]
$creadList :: ReadS [RecordingConfiguration]
readsPrec :: Int -> ReadS RecordingConfiguration
$creadsPrec :: Int -> ReadS RecordingConfiguration
Prelude.Read, Int -> RecordingConfiguration -> ShowS
[RecordingConfiguration] -> ShowS
RecordingConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecordingConfiguration] -> ShowS
$cshowList :: [RecordingConfiguration] -> ShowS
show :: RecordingConfiguration -> String
$cshow :: RecordingConfiguration -> String
showsPrec :: Int -> RecordingConfiguration -> ShowS
$cshowsPrec :: Int -> RecordingConfiguration -> ShowS
Prelude.Show, forall x. Rep RecordingConfiguration x -> RecordingConfiguration
forall x. RecordingConfiguration -> Rep RecordingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecordingConfiguration x -> RecordingConfiguration
$cfrom :: forall x. RecordingConfiguration -> Rep RecordingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'RecordingConfiguration' 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:
--
-- 'name', 'recordingConfiguration_name' - Recording-configuration name. The value does not need to be unique.
--
-- 'recordingReconnectWindowSeconds', 'recordingConfiguration_recordingReconnectWindowSeconds' - If a broadcast disconnects and then reconnects within the specified
-- interval, the multiple streams will be considered a single broadcast and
-- merged together. Default: 0.
--
-- 'tags', 'recordingConfiguration_tags' - Array of 1-50 maps, each of the form @string:string (key:value)@. See
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>
-- for more information, including restrictions that apply to tags and
-- \"Tag naming limits and requirements\"; Amazon IVS has no
-- service-specific constraints beyond what is documented there.
--
-- 'thumbnailConfiguration', 'recordingConfiguration_thumbnailConfiguration' - A complex type that allows you to enable\/disable the recording of
-- thumbnails for a live session and modify the interval at which
-- thumbnails are generated for the live session.
--
-- 'arn', 'recordingConfiguration_arn' - Recording-configuration ARN.
--
-- 'destinationConfiguration', 'recordingConfiguration_destinationConfiguration' - A complex type that contains information about where recorded video will
-- be stored.
--
-- 'state', 'recordingConfiguration_state' - Indicates the current state of the recording configuration. When the
-- state is @ACTIVE@, the configuration is ready for recording a channel
-- stream.
newRecordingConfiguration ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'destinationConfiguration'
  DestinationConfiguration ->
  -- | 'state'
  RecordingConfigurationState ->
  RecordingConfiguration
newRecordingConfiguration :: Text
-> DestinationConfiguration
-> RecordingConfigurationState
-> RecordingConfiguration
newRecordingConfiguration
  Text
pArn_
  DestinationConfiguration
pDestinationConfiguration_
  RecordingConfigurationState
pState_ =
    RecordingConfiguration'
      { $sel:name:RecordingConfiguration' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
        $sel:recordingReconnectWindowSeconds:RecordingConfiguration' :: Maybe Natural
recordingReconnectWindowSeconds = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:RecordingConfiguration' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:thumbnailConfiguration:RecordingConfiguration' :: Maybe ThumbnailConfiguration
thumbnailConfiguration = forall a. Maybe a
Prelude.Nothing,
        $sel:arn:RecordingConfiguration' :: Text
arn = Text
pArn_,
        $sel:destinationConfiguration:RecordingConfiguration' :: DestinationConfiguration
destinationConfiguration =
          DestinationConfiguration
pDestinationConfiguration_,
        $sel:state:RecordingConfiguration' :: RecordingConfigurationState
state = RecordingConfigurationState
pState_
      }

-- | Recording-configuration name. The value does not need to be unique.
recordingConfiguration_name :: Lens.Lens' RecordingConfiguration (Prelude.Maybe Prelude.Text)
recordingConfiguration_name :: Lens' RecordingConfiguration (Maybe Text)
recordingConfiguration_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordingConfiguration' {Maybe Text
name :: Maybe Text
$sel:name:RecordingConfiguration' :: RecordingConfiguration -> Maybe Text
name} -> Maybe Text
name) (\s :: RecordingConfiguration
s@RecordingConfiguration' {} Maybe Text
a -> RecordingConfiguration
s {$sel:name:RecordingConfiguration' :: Maybe Text
name = Maybe Text
a} :: RecordingConfiguration)

-- | If a broadcast disconnects and then reconnects within the specified
-- interval, the multiple streams will be considered a single broadcast and
-- merged together. Default: 0.
recordingConfiguration_recordingReconnectWindowSeconds :: Lens.Lens' RecordingConfiguration (Prelude.Maybe Prelude.Natural)
recordingConfiguration_recordingReconnectWindowSeconds :: Lens' RecordingConfiguration (Maybe Natural)
recordingConfiguration_recordingReconnectWindowSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordingConfiguration' {Maybe Natural
recordingReconnectWindowSeconds :: Maybe Natural
$sel:recordingReconnectWindowSeconds:RecordingConfiguration' :: RecordingConfiguration -> Maybe Natural
recordingReconnectWindowSeconds} -> Maybe Natural
recordingReconnectWindowSeconds) (\s :: RecordingConfiguration
s@RecordingConfiguration' {} Maybe Natural
a -> RecordingConfiguration
s {$sel:recordingReconnectWindowSeconds:RecordingConfiguration' :: Maybe Natural
recordingReconnectWindowSeconds = Maybe Natural
a} :: RecordingConfiguration)

-- | Array of 1-50 maps, each of the form @string:string (key:value)@. See
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>
-- for more information, including restrictions that apply to tags and
-- \"Tag naming limits and requirements\"; Amazon IVS has no
-- service-specific constraints beyond what is documented there.
recordingConfiguration_tags :: Lens.Lens' RecordingConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
recordingConfiguration_tags :: Lens' RecordingConfiguration (Maybe (HashMap Text Text))
recordingConfiguration_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordingConfiguration' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:RecordingConfiguration' :: RecordingConfiguration -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: RecordingConfiguration
s@RecordingConfiguration' {} Maybe (HashMap Text Text)
a -> RecordingConfiguration
s {$sel:tags:RecordingConfiguration' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: RecordingConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A complex type that allows you to enable\/disable the recording of
-- thumbnails for a live session and modify the interval at which
-- thumbnails are generated for the live session.
recordingConfiguration_thumbnailConfiguration :: Lens.Lens' RecordingConfiguration (Prelude.Maybe ThumbnailConfiguration)
recordingConfiguration_thumbnailConfiguration :: Lens' RecordingConfiguration (Maybe ThumbnailConfiguration)
recordingConfiguration_thumbnailConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordingConfiguration' {Maybe ThumbnailConfiguration
thumbnailConfiguration :: Maybe ThumbnailConfiguration
$sel:thumbnailConfiguration:RecordingConfiguration' :: RecordingConfiguration -> Maybe ThumbnailConfiguration
thumbnailConfiguration} -> Maybe ThumbnailConfiguration
thumbnailConfiguration) (\s :: RecordingConfiguration
s@RecordingConfiguration' {} Maybe ThumbnailConfiguration
a -> RecordingConfiguration
s {$sel:thumbnailConfiguration:RecordingConfiguration' :: Maybe ThumbnailConfiguration
thumbnailConfiguration = Maybe ThumbnailConfiguration
a} :: RecordingConfiguration)

-- | Recording-configuration ARN.
recordingConfiguration_arn :: Lens.Lens' RecordingConfiguration Prelude.Text
recordingConfiguration_arn :: Lens' RecordingConfiguration Text
recordingConfiguration_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordingConfiguration' {Text
arn :: Text
$sel:arn:RecordingConfiguration' :: RecordingConfiguration -> Text
arn} -> Text
arn) (\s :: RecordingConfiguration
s@RecordingConfiguration' {} Text
a -> RecordingConfiguration
s {$sel:arn:RecordingConfiguration' :: Text
arn = Text
a} :: RecordingConfiguration)

-- | A complex type that contains information about where recorded video will
-- be stored.
recordingConfiguration_destinationConfiguration :: Lens.Lens' RecordingConfiguration DestinationConfiguration
recordingConfiguration_destinationConfiguration :: Lens' RecordingConfiguration DestinationConfiguration
recordingConfiguration_destinationConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordingConfiguration' {DestinationConfiguration
destinationConfiguration :: DestinationConfiguration
$sel:destinationConfiguration:RecordingConfiguration' :: RecordingConfiguration -> DestinationConfiguration
destinationConfiguration} -> DestinationConfiguration
destinationConfiguration) (\s :: RecordingConfiguration
s@RecordingConfiguration' {} DestinationConfiguration
a -> RecordingConfiguration
s {$sel:destinationConfiguration:RecordingConfiguration' :: DestinationConfiguration
destinationConfiguration = DestinationConfiguration
a} :: RecordingConfiguration)

-- | Indicates the current state of the recording configuration. When the
-- state is @ACTIVE@, the configuration is ready for recording a channel
-- stream.
recordingConfiguration_state :: Lens.Lens' RecordingConfiguration RecordingConfigurationState
recordingConfiguration_state :: Lens' RecordingConfiguration RecordingConfigurationState
recordingConfiguration_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordingConfiguration' {RecordingConfigurationState
state :: RecordingConfigurationState
$sel:state:RecordingConfiguration' :: RecordingConfiguration -> RecordingConfigurationState
state} -> RecordingConfigurationState
state) (\s :: RecordingConfiguration
s@RecordingConfiguration' {} RecordingConfigurationState
a -> RecordingConfiguration
s {$sel:state:RecordingConfiguration' :: RecordingConfigurationState
state = RecordingConfigurationState
a} :: RecordingConfiguration)

instance Data.FromJSON RecordingConfiguration where
  parseJSON :: Value -> Parser RecordingConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecordingConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe Natural
-> Maybe (HashMap Text Text)
-> Maybe ThumbnailConfiguration
-> Text
-> DestinationConfiguration
-> RecordingConfigurationState
-> RecordingConfiguration
RecordingConfiguration'
            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
"name")
            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
"recordingReconnectWindowSeconds")
            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
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"thumbnailConfiguration")
            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
"arn")
            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
"destinationConfiguration")
            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
"state")
      )

instance Prelude.Hashable RecordingConfiguration where
  hashWithSalt :: Int -> RecordingConfiguration -> Int
hashWithSalt Int
_salt RecordingConfiguration' {Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe ThumbnailConfiguration
Text
RecordingConfigurationState
DestinationConfiguration
state :: RecordingConfigurationState
destinationConfiguration :: DestinationConfiguration
arn :: Text
thumbnailConfiguration :: Maybe ThumbnailConfiguration
tags :: Maybe (HashMap Text Text)
recordingReconnectWindowSeconds :: Maybe Natural
name :: Maybe Text
$sel:state:RecordingConfiguration' :: RecordingConfiguration -> RecordingConfigurationState
$sel:destinationConfiguration:RecordingConfiguration' :: RecordingConfiguration -> DestinationConfiguration
$sel:arn:RecordingConfiguration' :: RecordingConfiguration -> Text
$sel:thumbnailConfiguration:RecordingConfiguration' :: RecordingConfiguration -> Maybe ThumbnailConfiguration
$sel:tags:RecordingConfiguration' :: RecordingConfiguration -> Maybe (HashMap Text Text)
$sel:recordingReconnectWindowSeconds:RecordingConfiguration' :: RecordingConfiguration -> Maybe Natural
$sel:name:RecordingConfiguration' :: RecordingConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
recordingReconnectWindowSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ThumbnailConfiguration
thumbnailConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DestinationConfiguration
destinationConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RecordingConfigurationState
state

instance Prelude.NFData RecordingConfiguration where
  rnf :: RecordingConfiguration -> ()
rnf RecordingConfiguration' {Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe ThumbnailConfiguration
Text
RecordingConfigurationState
DestinationConfiguration
state :: RecordingConfigurationState
destinationConfiguration :: DestinationConfiguration
arn :: Text
thumbnailConfiguration :: Maybe ThumbnailConfiguration
tags :: Maybe (HashMap Text Text)
recordingReconnectWindowSeconds :: Maybe Natural
name :: Maybe Text
$sel:state:RecordingConfiguration' :: RecordingConfiguration -> RecordingConfigurationState
$sel:destinationConfiguration:RecordingConfiguration' :: RecordingConfiguration -> DestinationConfiguration
$sel:arn:RecordingConfiguration' :: RecordingConfiguration -> Text
$sel:thumbnailConfiguration:RecordingConfiguration' :: RecordingConfiguration -> Maybe ThumbnailConfiguration
$sel:tags:RecordingConfiguration' :: RecordingConfiguration -> Maybe (HashMap Text Text)
$sel:recordingReconnectWindowSeconds:RecordingConfiguration' :: RecordingConfiguration -> Maybe Natural
$sel:name:RecordingConfiguration' :: RecordingConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
recordingReconnectWindowSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ThumbnailConfiguration
thumbnailConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DestinationConfiguration
destinationConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RecordingConfigurationState
state