{-# 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-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.IVS.Types.RecordingConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.IVS.Types.DestinationConfiguration
import Amazonka.IVS.Types.RecordingConfigurationState
import qualified Amazonka.Lens as Lens
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,
    -- | Array of 1-50 maps, each of the form @string:string (key:value)@.
    RecordingConfiguration -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | 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
(RecordingConfiguration -> RecordingConfiguration -> Bool)
-> (RecordingConfiguration -> RecordingConfiguration -> Bool)
-> Eq RecordingConfiguration
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]
(Int -> ReadS RecordingConfiguration)
-> ReadS [RecordingConfiguration]
-> ReadPrec RecordingConfiguration
-> ReadPrec [RecordingConfiguration]
-> Read 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
(Int -> RecordingConfiguration -> ShowS)
-> (RecordingConfiguration -> String)
-> ([RecordingConfiguration] -> ShowS)
-> Show RecordingConfiguration
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. RecordingConfiguration -> Rep RecordingConfiguration x)
-> (forall x.
    Rep RecordingConfiguration x -> RecordingConfiguration)
-> Generic RecordingConfiguration
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.
--
-- 'tags', 'recordingConfiguration_tags' - Array of 1-50 maps, each of the form @string:string (key:value)@.
--
-- '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' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> DestinationConfiguration
-> RecordingConfigurationState
-> RecordingConfiguration
RecordingConfiguration'
      { $sel:name:RecordingConfiguration' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:RecordingConfiguration' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
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 :: (Maybe Text -> f (Maybe Text))
-> RecordingConfiguration -> f RecordingConfiguration
recordingConfiguration_name = (RecordingConfiguration -> Maybe Text)
-> (RecordingConfiguration -> Maybe Text -> RecordingConfiguration)
-> Lens
     RecordingConfiguration
     RecordingConfiguration
     (Maybe Text)
     (Maybe Text)
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)

-- | Array of 1-50 maps, each of the form @string:string (key:value)@.
recordingConfiguration_tags :: Lens.Lens' RecordingConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
recordingConfiguration_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> RecordingConfiguration -> f RecordingConfiguration
recordingConfiguration_tags = (RecordingConfiguration -> Maybe (HashMap Text Text))
-> (RecordingConfiguration
    -> Maybe (HashMap Text Text) -> RecordingConfiguration)
-> Lens
     RecordingConfiguration
     RecordingConfiguration
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> RecordingConfiguration -> f RecordingConfiguration)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> RecordingConfiguration
-> f RecordingConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Recording-configuration ARN.
recordingConfiguration_arn :: Lens.Lens' RecordingConfiguration Prelude.Text
recordingConfiguration_arn :: (Text -> f Text)
-> RecordingConfiguration -> f RecordingConfiguration
recordingConfiguration_arn = (RecordingConfiguration -> Text)
-> (RecordingConfiguration -> Text -> RecordingConfiguration)
-> Lens RecordingConfiguration RecordingConfiguration Text Text
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 :: (DestinationConfiguration -> f DestinationConfiguration)
-> RecordingConfiguration -> f RecordingConfiguration
recordingConfiguration_destinationConfiguration = (RecordingConfiguration -> DestinationConfiguration)
-> (RecordingConfiguration
    -> DestinationConfiguration -> RecordingConfiguration)
-> Lens
     RecordingConfiguration
     RecordingConfiguration
     DestinationConfiguration
     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 :: (RecordingConfigurationState -> f RecordingConfigurationState)
-> RecordingConfiguration -> f RecordingConfiguration
recordingConfiguration_state = (RecordingConfiguration -> RecordingConfigurationState)
-> (RecordingConfiguration
    -> RecordingConfigurationState -> RecordingConfiguration)
-> Lens
     RecordingConfiguration
     RecordingConfiguration
     RecordingConfigurationState
     RecordingConfigurationState
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 Core.FromJSON RecordingConfiguration where
  parseJSON :: Value -> Parser RecordingConfiguration
parseJSON =
    String
-> (Object -> Parser RecordingConfiguration)
-> Value
-> Parser RecordingConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RecordingConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> DestinationConfiguration
-> RecordingConfigurationState
-> RecordingConfiguration
RecordingConfiguration'
            (Maybe Text
 -> Maybe (HashMap Text Text)
 -> Text
 -> DestinationConfiguration
 -> RecordingConfigurationState
 -> RecordingConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Text
      -> DestinationConfiguration
      -> RecordingConfigurationState
      -> RecordingConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser
  (Maybe (HashMap Text Text)
   -> Text
   -> DestinationConfiguration
   -> RecordingConfigurationState
   -> RecordingConfiguration)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Text
      -> DestinationConfiguration
      -> RecordingConfigurationState
      -> RecordingConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Text
   -> DestinationConfiguration
   -> RecordingConfigurationState
   -> RecordingConfiguration)
-> Parser Text
-> Parser
     (DestinationConfiguration
      -> RecordingConfigurationState -> RecordingConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"arn")
            Parser
  (DestinationConfiguration
   -> RecordingConfigurationState -> RecordingConfiguration)
-> Parser DestinationConfiguration
-> Parser (RecordingConfigurationState -> RecordingConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DestinationConfiguration
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"destinationConfiguration")
            Parser (RecordingConfigurationState -> RecordingConfiguration)
-> Parser RecordingConfigurationState
-> Parser RecordingConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RecordingConfigurationState
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"state")
      )

instance Prelude.Hashable RecordingConfiguration

instance Prelude.NFData RecordingConfiguration