{-# 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.MediaConnect.Types.MediaStreamOutputConfiguration
-- 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.MediaConnect.Types.MediaStreamOutputConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types.DestinationConfiguration
import Amazonka.MediaConnect.Types.EncodingName
import Amazonka.MediaConnect.Types.EncodingParameters
import qualified Amazonka.Prelude as Prelude

-- | The media stream that is associated with the output, and the parameters
-- for that association.
--
-- /See:/ 'newMediaStreamOutputConfiguration' smart constructor.
data MediaStreamOutputConfiguration = MediaStreamOutputConfiguration'
  { -- | The transport parameters that are associated with each outbound media
    -- stream.
    MediaStreamOutputConfiguration -> Maybe [DestinationConfiguration]
destinationConfigurations :: Prelude.Maybe [DestinationConfiguration],
    -- | Encoding parameters
    MediaStreamOutputConfiguration -> Maybe EncodingParameters
encodingParameters :: Prelude.Maybe EncodingParameters,
    -- | The name of the media stream.
    MediaStreamOutputConfiguration -> Text
mediaStreamName :: Prelude.Text,
    -- | The format that was used to encode the data. For ancillary data streams,
    -- set the encoding name to smpte291. For audio streams, set the encoding
    -- name to pcm. For video, 2110 streams, set the encoding name to raw. For
    -- video, JPEG XS streams, set the encoding name to jxsv.
    MediaStreamOutputConfiguration -> EncodingName
encodingName :: EncodingName
  }
  deriving (MediaStreamOutputConfiguration
-> MediaStreamOutputConfiguration -> Bool
(MediaStreamOutputConfiguration
 -> MediaStreamOutputConfiguration -> Bool)
-> (MediaStreamOutputConfiguration
    -> MediaStreamOutputConfiguration -> Bool)
-> Eq MediaStreamOutputConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MediaStreamOutputConfiguration
-> MediaStreamOutputConfiguration -> Bool
$c/= :: MediaStreamOutputConfiguration
-> MediaStreamOutputConfiguration -> Bool
== :: MediaStreamOutputConfiguration
-> MediaStreamOutputConfiguration -> Bool
$c== :: MediaStreamOutputConfiguration
-> MediaStreamOutputConfiguration -> Bool
Prelude.Eq, ReadPrec [MediaStreamOutputConfiguration]
ReadPrec MediaStreamOutputConfiguration
Int -> ReadS MediaStreamOutputConfiguration
ReadS [MediaStreamOutputConfiguration]
(Int -> ReadS MediaStreamOutputConfiguration)
-> ReadS [MediaStreamOutputConfiguration]
-> ReadPrec MediaStreamOutputConfiguration
-> ReadPrec [MediaStreamOutputConfiguration]
-> Read MediaStreamOutputConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MediaStreamOutputConfiguration]
$creadListPrec :: ReadPrec [MediaStreamOutputConfiguration]
readPrec :: ReadPrec MediaStreamOutputConfiguration
$creadPrec :: ReadPrec MediaStreamOutputConfiguration
readList :: ReadS [MediaStreamOutputConfiguration]
$creadList :: ReadS [MediaStreamOutputConfiguration]
readsPrec :: Int -> ReadS MediaStreamOutputConfiguration
$creadsPrec :: Int -> ReadS MediaStreamOutputConfiguration
Prelude.Read, Int -> MediaStreamOutputConfiguration -> ShowS
[MediaStreamOutputConfiguration] -> ShowS
MediaStreamOutputConfiguration -> String
(Int -> MediaStreamOutputConfiguration -> ShowS)
-> (MediaStreamOutputConfiguration -> String)
-> ([MediaStreamOutputConfiguration] -> ShowS)
-> Show MediaStreamOutputConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MediaStreamOutputConfiguration] -> ShowS
$cshowList :: [MediaStreamOutputConfiguration] -> ShowS
show :: MediaStreamOutputConfiguration -> String
$cshow :: MediaStreamOutputConfiguration -> String
showsPrec :: Int -> MediaStreamOutputConfiguration -> ShowS
$cshowsPrec :: Int -> MediaStreamOutputConfiguration -> ShowS
Prelude.Show, (forall x.
 MediaStreamOutputConfiguration
 -> Rep MediaStreamOutputConfiguration x)
-> (forall x.
    Rep MediaStreamOutputConfiguration x
    -> MediaStreamOutputConfiguration)
-> Generic MediaStreamOutputConfiguration
forall x.
Rep MediaStreamOutputConfiguration x
-> MediaStreamOutputConfiguration
forall x.
MediaStreamOutputConfiguration
-> Rep MediaStreamOutputConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MediaStreamOutputConfiguration x
-> MediaStreamOutputConfiguration
$cfrom :: forall x.
MediaStreamOutputConfiguration
-> Rep MediaStreamOutputConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'MediaStreamOutputConfiguration' 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:
--
-- 'destinationConfigurations', 'mediaStreamOutputConfiguration_destinationConfigurations' - The transport parameters that are associated with each outbound media
-- stream.
--
-- 'encodingParameters', 'mediaStreamOutputConfiguration_encodingParameters' - Encoding parameters
--
-- 'mediaStreamName', 'mediaStreamOutputConfiguration_mediaStreamName' - The name of the media stream.
--
-- 'encodingName', 'mediaStreamOutputConfiguration_encodingName' - The format that was used to encode the data. For ancillary data streams,
-- set the encoding name to smpte291. For audio streams, set the encoding
-- name to pcm. For video, 2110 streams, set the encoding name to raw. For
-- video, JPEG XS streams, set the encoding name to jxsv.
newMediaStreamOutputConfiguration ::
  -- | 'mediaStreamName'
  Prelude.Text ->
  -- | 'encodingName'
  EncodingName ->
  MediaStreamOutputConfiguration
newMediaStreamOutputConfiguration :: Text -> EncodingName -> MediaStreamOutputConfiguration
newMediaStreamOutputConfiguration
  Text
pMediaStreamName_
  EncodingName
pEncodingName_ =
    MediaStreamOutputConfiguration' :: Maybe [DestinationConfiguration]
-> Maybe EncodingParameters
-> Text
-> EncodingName
-> MediaStreamOutputConfiguration
MediaStreamOutputConfiguration'
      { $sel:destinationConfigurations:MediaStreamOutputConfiguration' :: Maybe [DestinationConfiguration]
destinationConfigurations =
          Maybe [DestinationConfiguration]
forall a. Maybe a
Prelude.Nothing,
        $sel:encodingParameters:MediaStreamOutputConfiguration' :: Maybe EncodingParameters
encodingParameters = Maybe EncodingParameters
forall a. Maybe a
Prelude.Nothing,
        $sel:mediaStreamName:MediaStreamOutputConfiguration' :: Text
mediaStreamName = Text
pMediaStreamName_,
        $sel:encodingName:MediaStreamOutputConfiguration' :: EncodingName
encodingName = EncodingName
pEncodingName_
      }

-- | The transport parameters that are associated with each outbound media
-- stream.
mediaStreamOutputConfiguration_destinationConfigurations :: Lens.Lens' MediaStreamOutputConfiguration (Prelude.Maybe [DestinationConfiguration])
mediaStreamOutputConfiguration_destinationConfigurations :: (Maybe [DestinationConfiguration]
 -> f (Maybe [DestinationConfiguration]))
-> MediaStreamOutputConfiguration
-> f MediaStreamOutputConfiguration
mediaStreamOutputConfiguration_destinationConfigurations = (MediaStreamOutputConfiguration
 -> Maybe [DestinationConfiguration])
-> (MediaStreamOutputConfiguration
    -> Maybe [DestinationConfiguration]
    -> MediaStreamOutputConfiguration)
-> Lens
     MediaStreamOutputConfiguration
     MediaStreamOutputConfiguration
     (Maybe [DestinationConfiguration])
     (Maybe [DestinationConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaStreamOutputConfiguration' {Maybe [DestinationConfiguration]
destinationConfigurations :: Maybe [DestinationConfiguration]
$sel:destinationConfigurations:MediaStreamOutputConfiguration' :: MediaStreamOutputConfiguration -> Maybe [DestinationConfiguration]
destinationConfigurations} -> Maybe [DestinationConfiguration]
destinationConfigurations) (\s :: MediaStreamOutputConfiguration
s@MediaStreamOutputConfiguration' {} Maybe [DestinationConfiguration]
a -> MediaStreamOutputConfiguration
s {$sel:destinationConfigurations:MediaStreamOutputConfiguration' :: Maybe [DestinationConfiguration]
destinationConfigurations = Maybe [DestinationConfiguration]
a} :: MediaStreamOutputConfiguration) ((Maybe [DestinationConfiguration]
  -> f (Maybe [DestinationConfiguration]))
 -> MediaStreamOutputConfiguration
 -> f MediaStreamOutputConfiguration)
-> ((Maybe [DestinationConfiguration]
     -> f (Maybe [DestinationConfiguration]))
    -> Maybe [DestinationConfiguration]
    -> f (Maybe [DestinationConfiguration]))
-> (Maybe [DestinationConfiguration]
    -> f (Maybe [DestinationConfiguration]))
-> MediaStreamOutputConfiguration
-> f MediaStreamOutputConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DestinationConfiguration]
  [DestinationConfiguration]
  [DestinationConfiguration]
  [DestinationConfiguration]
-> Iso
     (Maybe [DestinationConfiguration])
     (Maybe [DestinationConfiguration])
     (Maybe [DestinationConfiguration])
     (Maybe [DestinationConfiguration])
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
  [DestinationConfiguration]
  [DestinationConfiguration]
  [DestinationConfiguration]
  [DestinationConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Encoding parameters
mediaStreamOutputConfiguration_encodingParameters :: Lens.Lens' MediaStreamOutputConfiguration (Prelude.Maybe EncodingParameters)
mediaStreamOutputConfiguration_encodingParameters :: (Maybe EncodingParameters -> f (Maybe EncodingParameters))
-> MediaStreamOutputConfiguration
-> f MediaStreamOutputConfiguration
mediaStreamOutputConfiguration_encodingParameters = (MediaStreamOutputConfiguration -> Maybe EncodingParameters)
-> (MediaStreamOutputConfiguration
    -> Maybe EncodingParameters -> MediaStreamOutputConfiguration)
-> Lens
     MediaStreamOutputConfiguration
     MediaStreamOutputConfiguration
     (Maybe EncodingParameters)
     (Maybe EncodingParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaStreamOutputConfiguration' {Maybe EncodingParameters
encodingParameters :: Maybe EncodingParameters
$sel:encodingParameters:MediaStreamOutputConfiguration' :: MediaStreamOutputConfiguration -> Maybe EncodingParameters
encodingParameters} -> Maybe EncodingParameters
encodingParameters) (\s :: MediaStreamOutputConfiguration
s@MediaStreamOutputConfiguration' {} Maybe EncodingParameters
a -> MediaStreamOutputConfiguration
s {$sel:encodingParameters:MediaStreamOutputConfiguration' :: Maybe EncodingParameters
encodingParameters = Maybe EncodingParameters
a} :: MediaStreamOutputConfiguration)

-- | The name of the media stream.
mediaStreamOutputConfiguration_mediaStreamName :: Lens.Lens' MediaStreamOutputConfiguration Prelude.Text
mediaStreamOutputConfiguration_mediaStreamName :: (Text -> f Text)
-> MediaStreamOutputConfiguration
-> f MediaStreamOutputConfiguration
mediaStreamOutputConfiguration_mediaStreamName = (MediaStreamOutputConfiguration -> Text)
-> (MediaStreamOutputConfiguration
    -> Text -> MediaStreamOutputConfiguration)
-> Lens
     MediaStreamOutputConfiguration
     MediaStreamOutputConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaStreamOutputConfiguration' {Text
mediaStreamName :: Text
$sel:mediaStreamName:MediaStreamOutputConfiguration' :: MediaStreamOutputConfiguration -> Text
mediaStreamName} -> Text
mediaStreamName) (\s :: MediaStreamOutputConfiguration
s@MediaStreamOutputConfiguration' {} Text
a -> MediaStreamOutputConfiguration
s {$sel:mediaStreamName:MediaStreamOutputConfiguration' :: Text
mediaStreamName = Text
a} :: MediaStreamOutputConfiguration)

-- | The format that was used to encode the data. For ancillary data streams,
-- set the encoding name to smpte291. For audio streams, set the encoding
-- name to pcm. For video, 2110 streams, set the encoding name to raw. For
-- video, JPEG XS streams, set the encoding name to jxsv.
mediaStreamOutputConfiguration_encodingName :: Lens.Lens' MediaStreamOutputConfiguration EncodingName
mediaStreamOutputConfiguration_encodingName :: (EncodingName -> f EncodingName)
-> MediaStreamOutputConfiguration
-> f MediaStreamOutputConfiguration
mediaStreamOutputConfiguration_encodingName = (MediaStreamOutputConfiguration -> EncodingName)
-> (MediaStreamOutputConfiguration
    -> EncodingName -> MediaStreamOutputConfiguration)
-> Lens
     MediaStreamOutputConfiguration
     MediaStreamOutputConfiguration
     EncodingName
     EncodingName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaStreamOutputConfiguration' {EncodingName
encodingName :: EncodingName
$sel:encodingName:MediaStreamOutputConfiguration' :: MediaStreamOutputConfiguration -> EncodingName
encodingName} -> EncodingName
encodingName) (\s :: MediaStreamOutputConfiguration
s@MediaStreamOutputConfiguration' {} EncodingName
a -> MediaStreamOutputConfiguration
s {$sel:encodingName:MediaStreamOutputConfiguration' :: EncodingName
encodingName = EncodingName
a} :: MediaStreamOutputConfiguration)

instance Core.FromJSON MediaStreamOutputConfiguration where
  parseJSON :: Value -> Parser MediaStreamOutputConfiguration
parseJSON =
    String
-> (Object -> Parser MediaStreamOutputConfiguration)
-> Value
-> Parser MediaStreamOutputConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MediaStreamOutputConfiguration"
      ( \Object
x ->
          Maybe [DestinationConfiguration]
-> Maybe EncodingParameters
-> Text
-> EncodingName
-> MediaStreamOutputConfiguration
MediaStreamOutputConfiguration'
            (Maybe [DestinationConfiguration]
 -> Maybe EncodingParameters
 -> Text
 -> EncodingName
 -> MediaStreamOutputConfiguration)
-> Parser (Maybe [DestinationConfiguration])
-> Parser
     (Maybe EncodingParameters
      -> Text -> EncodingName -> MediaStreamOutputConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [DestinationConfiguration]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"destinationConfigurations"
                            Parser (Maybe (Maybe [DestinationConfiguration]))
-> Maybe [DestinationConfiguration]
-> Parser (Maybe [DestinationConfiguration])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [DestinationConfiguration]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe EncodingParameters
   -> Text -> EncodingName -> MediaStreamOutputConfiguration)
-> Parser (Maybe EncodingParameters)
-> Parser (Text -> EncodingName -> MediaStreamOutputConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EncodingParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"encodingParameters")
            Parser (Text -> EncodingName -> MediaStreamOutputConfiguration)
-> Parser Text
-> Parser (EncodingName -> MediaStreamOutputConfiguration)
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
"mediaStreamName")
            Parser (EncodingName -> MediaStreamOutputConfiguration)
-> Parser EncodingName -> Parser MediaStreamOutputConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser EncodingName
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"encodingName")
      )

instance
  Prelude.Hashable
    MediaStreamOutputConfiguration

instance
  Prelude.NFData
    MediaStreamOutputConfiguration