{-# 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.AddMediaStreamRequest
-- 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.AddMediaStreamRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types.MediaStreamAttributesRequest
import Amazonka.MediaConnect.Types.MediaStreamType
import qualified Amazonka.Prelude as Prelude

-- | The media stream that you want to add to the flow.
--
-- /See:/ 'newAddMediaStreamRequest' smart constructor.
data AddMediaStreamRequest = AddMediaStreamRequest'
  { -- | The resolution of the video.
    AddMediaStreamRequest -> Maybe Text
videoFormat :: Prelude.Maybe Prelude.Text,
    -- | The attributes that you want to assign to the new media stream.
    AddMediaStreamRequest -> Maybe MediaStreamAttributesRequest
attributes :: Prelude.Maybe MediaStreamAttributesRequest,
    -- | The sample rate (in Hz) for the stream. If the media stream type is
    -- video or ancillary data, set this value to 90000. If the media stream
    -- type is audio, set this value to either 48000 or 96000.
    AddMediaStreamRequest -> Maybe Int
clockRate :: Prelude.Maybe Prelude.Int,
    -- | A description that can help you quickly identify what your media stream
    -- is used for.
    AddMediaStreamRequest -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The type of media stream.
    AddMediaStreamRequest -> MediaStreamType
mediaStreamType :: MediaStreamType,
    -- | A unique identifier for the media stream.
    AddMediaStreamRequest -> Int
mediaStreamId :: Prelude.Int,
    -- | A name that helps you distinguish one media stream from another.
    AddMediaStreamRequest -> Text
mediaStreamName :: Prelude.Text
  }
  deriving (AddMediaStreamRequest -> AddMediaStreamRequest -> Bool
(AddMediaStreamRequest -> AddMediaStreamRequest -> Bool)
-> (AddMediaStreamRequest -> AddMediaStreamRequest -> Bool)
-> Eq AddMediaStreamRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddMediaStreamRequest -> AddMediaStreamRequest -> Bool
$c/= :: AddMediaStreamRequest -> AddMediaStreamRequest -> Bool
== :: AddMediaStreamRequest -> AddMediaStreamRequest -> Bool
$c== :: AddMediaStreamRequest -> AddMediaStreamRequest -> Bool
Prelude.Eq, ReadPrec [AddMediaStreamRequest]
ReadPrec AddMediaStreamRequest
Int -> ReadS AddMediaStreamRequest
ReadS [AddMediaStreamRequest]
(Int -> ReadS AddMediaStreamRequest)
-> ReadS [AddMediaStreamRequest]
-> ReadPrec AddMediaStreamRequest
-> ReadPrec [AddMediaStreamRequest]
-> Read AddMediaStreamRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddMediaStreamRequest]
$creadListPrec :: ReadPrec [AddMediaStreamRequest]
readPrec :: ReadPrec AddMediaStreamRequest
$creadPrec :: ReadPrec AddMediaStreamRequest
readList :: ReadS [AddMediaStreamRequest]
$creadList :: ReadS [AddMediaStreamRequest]
readsPrec :: Int -> ReadS AddMediaStreamRequest
$creadsPrec :: Int -> ReadS AddMediaStreamRequest
Prelude.Read, Int -> AddMediaStreamRequest -> ShowS
[AddMediaStreamRequest] -> ShowS
AddMediaStreamRequest -> String
(Int -> AddMediaStreamRequest -> ShowS)
-> (AddMediaStreamRequest -> String)
-> ([AddMediaStreamRequest] -> ShowS)
-> Show AddMediaStreamRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddMediaStreamRequest] -> ShowS
$cshowList :: [AddMediaStreamRequest] -> ShowS
show :: AddMediaStreamRequest -> String
$cshow :: AddMediaStreamRequest -> String
showsPrec :: Int -> AddMediaStreamRequest -> ShowS
$cshowsPrec :: Int -> AddMediaStreamRequest -> ShowS
Prelude.Show, (forall x. AddMediaStreamRequest -> Rep AddMediaStreamRequest x)
-> (forall x. Rep AddMediaStreamRequest x -> AddMediaStreamRequest)
-> Generic AddMediaStreamRequest
forall x. Rep AddMediaStreamRequest x -> AddMediaStreamRequest
forall x. AddMediaStreamRequest -> Rep AddMediaStreamRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddMediaStreamRequest x -> AddMediaStreamRequest
$cfrom :: forall x. AddMediaStreamRequest -> Rep AddMediaStreamRequest x
Prelude.Generic)

-- |
-- Create a value of 'AddMediaStreamRequest' 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:
--
-- 'videoFormat', 'addMediaStreamRequest_videoFormat' - The resolution of the video.
--
-- 'attributes', 'addMediaStreamRequest_attributes' - The attributes that you want to assign to the new media stream.
--
-- 'clockRate', 'addMediaStreamRequest_clockRate' - The sample rate (in Hz) for the stream. If the media stream type is
-- video or ancillary data, set this value to 90000. If the media stream
-- type is audio, set this value to either 48000 or 96000.
--
-- 'description', 'addMediaStreamRequest_description' - A description that can help you quickly identify what your media stream
-- is used for.
--
-- 'mediaStreamType', 'addMediaStreamRequest_mediaStreamType' - The type of media stream.
--
-- 'mediaStreamId', 'addMediaStreamRequest_mediaStreamId' - A unique identifier for the media stream.
--
-- 'mediaStreamName', 'addMediaStreamRequest_mediaStreamName' - A name that helps you distinguish one media stream from another.
newAddMediaStreamRequest ::
  -- | 'mediaStreamType'
  MediaStreamType ->
  -- | 'mediaStreamId'
  Prelude.Int ->
  -- | 'mediaStreamName'
  Prelude.Text ->
  AddMediaStreamRequest
newAddMediaStreamRequest :: MediaStreamType -> Int -> Text -> AddMediaStreamRequest
newAddMediaStreamRequest
  MediaStreamType
pMediaStreamType_
  Int
pMediaStreamId_
  Text
pMediaStreamName_ =
    AddMediaStreamRequest' :: Maybe Text
-> Maybe MediaStreamAttributesRequest
-> Maybe Int
-> Maybe Text
-> MediaStreamType
-> Int
-> Text
-> AddMediaStreamRequest
AddMediaStreamRequest'
      { $sel:videoFormat:AddMediaStreamRequest' :: Maybe Text
videoFormat =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:attributes:AddMediaStreamRequest' :: Maybe MediaStreamAttributesRequest
attributes = Maybe MediaStreamAttributesRequest
forall a. Maybe a
Prelude.Nothing,
        $sel:clockRate:AddMediaStreamRequest' :: Maybe Int
clockRate = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:description:AddMediaStreamRequest' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:mediaStreamType:AddMediaStreamRequest' :: MediaStreamType
mediaStreamType = MediaStreamType
pMediaStreamType_,
        $sel:mediaStreamId:AddMediaStreamRequest' :: Int
mediaStreamId = Int
pMediaStreamId_,
        $sel:mediaStreamName:AddMediaStreamRequest' :: Text
mediaStreamName = Text
pMediaStreamName_
      }

-- | The resolution of the video.
addMediaStreamRequest_videoFormat :: Lens.Lens' AddMediaStreamRequest (Prelude.Maybe Prelude.Text)
addMediaStreamRequest_videoFormat :: (Maybe Text -> f (Maybe Text))
-> AddMediaStreamRequest -> f AddMediaStreamRequest
addMediaStreamRequest_videoFormat = (AddMediaStreamRequest -> Maybe Text)
-> (AddMediaStreamRequest -> Maybe Text -> AddMediaStreamRequest)
-> Lens
     AddMediaStreamRequest
     AddMediaStreamRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddMediaStreamRequest' {Maybe Text
videoFormat :: Maybe Text
$sel:videoFormat:AddMediaStreamRequest' :: AddMediaStreamRequest -> Maybe Text
videoFormat} -> Maybe Text
videoFormat) (\s :: AddMediaStreamRequest
s@AddMediaStreamRequest' {} Maybe Text
a -> AddMediaStreamRequest
s {$sel:videoFormat:AddMediaStreamRequest' :: Maybe Text
videoFormat = Maybe Text
a} :: AddMediaStreamRequest)

-- | The attributes that you want to assign to the new media stream.
addMediaStreamRequest_attributes :: Lens.Lens' AddMediaStreamRequest (Prelude.Maybe MediaStreamAttributesRequest)
addMediaStreamRequest_attributes :: (Maybe MediaStreamAttributesRequest
 -> f (Maybe MediaStreamAttributesRequest))
-> AddMediaStreamRequest -> f AddMediaStreamRequest
addMediaStreamRequest_attributes = (AddMediaStreamRequest -> Maybe MediaStreamAttributesRequest)
-> (AddMediaStreamRequest
    -> Maybe MediaStreamAttributesRequest -> AddMediaStreamRequest)
-> Lens
     AddMediaStreamRequest
     AddMediaStreamRequest
     (Maybe MediaStreamAttributesRequest)
     (Maybe MediaStreamAttributesRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddMediaStreamRequest' {Maybe MediaStreamAttributesRequest
attributes :: Maybe MediaStreamAttributesRequest
$sel:attributes:AddMediaStreamRequest' :: AddMediaStreamRequest -> Maybe MediaStreamAttributesRequest
attributes} -> Maybe MediaStreamAttributesRequest
attributes) (\s :: AddMediaStreamRequest
s@AddMediaStreamRequest' {} Maybe MediaStreamAttributesRequest
a -> AddMediaStreamRequest
s {$sel:attributes:AddMediaStreamRequest' :: Maybe MediaStreamAttributesRequest
attributes = Maybe MediaStreamAttributesRequest
a} :: AddMediaStreamRequest)

-- | The sample rate (in Hz) for the stream. If the media stream type is
-- video or ancillary data, set this value to 90000. If the media stream
-- type is audio, set this value to either 48000 or 96000.
addMediaStreamRequest_clockRate :: Lens.Lens' AddMediaStreamRequest (Prelude.Maybe Prelude.Int)
addMediaStreamRequest_clockRate :: (Maybe Int -> f (Maybe Int))
-> AddMediaStreamRequest -> f AddMediaStreamRequest
addMediaStreamRequest_clockRate = (AddMediaStreamRequest -> Maybe Int)
-> (AddMediaStreamRequest -> Maybe Int -> AddMediaStreamRequest)
-> Lens
     AddMediaStreamRequest AddMediaStreamRequest (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddMediaStreamRequest' {Maybe Int
clockRate :: Maybe Int
$sel:clockRate:AddMediaStreamRequest' :: AddMediaStreamRequest -> Maybe Int
clockRate} -> Maybe Int
clockRate) (\s :: AddMediaStreamRequest
s@AddMediaStreamRequest' {} Maybe Int
a -> AddMediaStreamRequest
s {$sel:clockRate:AddMediaStreamRequest' :: Maybe Int
clockRate = Maybe Int
a} :: AddMediaStreamRequest)

-- | A description that can help you quickly identify what your media stream
-- is used for.
addMediaStreamRequest_description :: Lens.Lens' AddMediaStreamRequest (Prelude.Maybe Prelude.Text)
addMediaStreamRequest_description :: (Maybe Text -> f (Maybe Text))
-> AddMediaStreamRequest -> f AddMediaStreamRequest
addMediaStreamRequest_description = (AddMediaStreamRequest -> Maybe Text)
-> (AddMediaStreamRequest -> Maybe Text -> AddMediaStreamRequest)
-> Lens
     AddMediaStreamRequest
     AddMediaStreamRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddMediaStreamRequest' {Maybe Text
description :: Maybe Text
$sel:description:AddMediaStreamRequest' :: AddMediaStreamRequest -> Maybe Text
description} -> Maybe Text
description) (\s :: AddMediaStreamRequest
s@AddMediaStreamRequest' {} Maybe Text
a -> AddMediaStreamRequest
s {$sel:description:AddMediaStreamRequest' :: Maybe Text
description = Maybe Text
a} :: AddMediaStreamRequest)

-- | The type of media stream.
addMediaStreamRequest_mediaStreamType :: Lens.Lens' AddMediaStreamRequest MediaStreamType
addMediaStreamRequest_mediaStreamType :: (MediaStreamType -> f MediaStreamType)
-> AddMediaStreamRequest -> f AddMediaStreamRequest
addMediaStreamRequest_mediaStreamType = (AddMediaStreamRequest -> MediaStreamType)
-> (AddMediaStreamRequest
    -> MediaStreamType -> AddMediaStreamRequest)
-> Lens
     AddMediaStreamRequest
     AddMediaStreamRequest
     MediaStreamType
     MediaStreamType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddMediaStreamRequest' {MediaStreamType
mediaStreamType :: MediaStreamType
$sel:mediaStreamType:AddMediaStreamRequest' :: AddMediaStreamRequest -> MediaStreamType
mediaStreamType} -> MediaStreamType
mediaStreamType) (\s :: AddMediaStreamRequest
s@AddMediaStreamRequest' {} MediaStreamType
a -> AddMediaStreamRequest
s {$sel:mediaStreamType:AddMediaStreamRequest' :: MediaStreamType
mediaStreamType = MediaStreamType
a} :: AddMediaStreamRequest)

-- | A unique identifier for the media stream.
addMediaStreamRequest_mediaStreamId :: Lens.Lens' AddMediaStreamRequest Prelude.Int
addMediaStreamRequest_mediaStreamId :: (Int -> f Int) -> AddMediaStreamRequest -> f AddMediaStreamRequest
addMediaStreamRequest_mediaStreamId = (AddMediaStreamRequest -> Int)
-> (AddMediaStreamRequest -> Int -> AddMediaStreamRequest)
-> Lens AddMediaStreamRequest AddMediaStreamRequest Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddMediaStreamRequest' {Int
mediaStreamId :: Int
$sel:mediaStreamId:AddMediaStreamRequest' :: AddMediaStreamRequest -> Int
mediaStreamId} -> Int
mediaStreamId) (\s :: AddMediaStreamRequest
s@AddMediaStreamRequest' {} Int
a -> AddMediaStreamRequest
s {$sel:mediaStreamId:AddMediaStreamRequest' :: Int
mediaStreamId = Int
a} :: AddMediaStreamRequest)

-- | A name that helps you distinguish one media stream from another.
addMediaStreamRequest_mediaStreamName :: Lens.Lens' AddMediaStreamRequest Prelude.Text
addMediaStreamRequest_mediaStreamName :: (Text -> f Text)
-> AddMediaStreamRequest -> f AddMediaStreamRequest
addMediaStreamRequest_mediaStreamName = (AddMediaStreamRequest -> Text)
-> (AddMediaStreamRequest -> Text -> AddMediaStreamRequest)
-> Lens AddMediaStreamRequest AddMediaStreamRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddMediaStreamRequest' {Text
mediaStreamName :: Text
$sel:mediaStreamName:AddMediaStreamRequest' :: AddMediaStreamRequest -> Text
mediaStreamName} -> Text
mediaStreamName) (\s :: AddMediaStreamRequest
s@AddMediaStreamRequest' {} Text
a -> AddMediaStreamRequest
s {$sel:mediaStreamName:AddMediaStreamRequest' :: Text
mediaStreamName = Text
a} :: AddMediaStreamRequest)

instance Prelude.Hashable AddMediaStreamRequest

instance Prelude.NFData AddMediaStreamRequest

instance Core.ToJSON AddMediaStreamRequest where
  toJSON :: AddMediaStreamRequest -> Value
toJSON AddMediaStreamRequest' {Int
Maybe Int
Maybe Text
Maybe MediaStreamAttributesRequest
Text
MediaStreamType
mediaStreamName :: Text
mediaStreamId :: Int
mediaStreamType :: MediaStreamType
description :: Maybe Text
clockRate :: Maybe Int
attributes :: Maybe MediaStreamAttributesRequest
videoFormat :: Maybe Text
$sel:mediaStreamName:AddMediaStreamRequest' :: AddMediaStreamRequest -> Text
$sel:mediaStreamId:AddMediaStreamRequest' :: AddMediaStreamRequest -> Int
$sel:mediaStreamType:AddMediaStreamRequest' :: AddMediaStreamRequest -> MediaStreamType
$sel:description:AddMediaStreamRequest' :: AddMediaStreamRequest -> Maybe Text
$sel:clockRate:AddMediaStreamRequest' :: AddMediaStreamRequest -> Maybe Int
$sel:attributes:AddMediaStreamRequest' :: AddMediaStreamRequest -> Maybe MediaStreamAttributesRequest
$sel:videoFormat:AddMediaStreamRequest' :: AddMediaStreamRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"videoFormat" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
videoFormat,
            (Text
"attributes" Text -> MediaStreamAttributesRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MediaStreamAttributesRequest -> Pair)
-> Maybe MediaStreamAttributesRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MediaStreamAttributesRequest
attributes,
            (Text
"clockRate" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
clockRate,
            (Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"mediaStreamType" Text -> MediaStreamType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MediaStreamType
mediaStreamType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"mediaStreamId" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
mediaStreamId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"mediaStreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
mediaStreamName)
          ]
      )