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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types.Protocol
import qualified Amazonka.Prelude as Prelude

-- | Attributes related to the transport stream that are used in a source or
-- output.
--
-- /See:/ 'newTransport' smart constructor.
data Transport = Transport'
  { -- | The maximum latency in milliseconds. This parameter applies only to
    -- RIST-based and Zixi-based streams.
    Transport -> Maybe Int
maxLatency :: Prelude.Maybe Prelude.Int,
    -- | The size of the buffer (in milliseconds) to use to sync incoming source
    -- data.
    Transport -> Maybe Int
maxSyncBuffer :: Prelude.Maybe Prelude.Int,
    -- | The range of IP addresses that should be allowed to initiate output
    -- requests to this flow. These IP addresses should be in the form of a
    -- Classless Inter-Domain Routing (CIDR) block; for example, 10.0.0.0\/16.
    Transport -> Maybe [Text]
cidrAllowList :: Prelude.Maybe [Prelude.Text],
    -- | The smoothing latency in milliseconds for RIST, RTP, and RTP-FEC
    -- streams.
    Transport -> Maybe Int
smoothingLatency :: Prelude.Maybe Prelude.Int,
    -- | The minimum latency in milliseconds for SRT-based streams. In streams
    -- that use the SRT protocol, this value that you set on your MediaConnect
    -- source or output represents the minimal potential latency of that
    -- connection. The latency of the stream is set to the highest number
    -- between the sender’s minimum latency and the receiver’s minimum latency.
    Transport -> Maybe Int
minLatency :: Prelude.Maybe Prelude.Int,
    -- | The smoothing max bitrate for RIST, RTP, and RTP-FEC streams.
    Transport -> Maybe Int
maxBitrate :: Prelude.Maybe Prelude.Int,
    -- | The stream ID that you want to use for this transport. This parameter
    -- applies only to Zixi-based streams.
    Transport -> Maybe Text
streamId :: Prelude.Maybe Prelude.Text,
    -- | The remote ID for the Zixi-pull stream.
    Transport -> Maybe Text
remoteId :: Prelude.Maybe Prelude.Text,
    -- | The protocol that is used by the source or output.
    Transport -> Protocol
protocol :: Protocol
  }
  deriving (Transport -> Transport -> Bool
(Transport -> Transport -> Bool)
-> (Transport -> Transport -> Bool) -> Eq Transport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Transport -> Transport -> Bool
$c/= :: Transport -> Transport -> Bool
== :: Transport -> Transport -> Bool
$c== :: Transport -> Transport -> Bool
Prelude.Eq, ReadPrec [Transport]
ReadPrec Transport
Int -> ReadS Transport
ReadS [Transport]
(Int -> ReadS Transport)
-> ReadS [Transport]
-> ReadPrec Transport
-> ReadPrec [Transport]
-> Read Transport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Transport]
$creadListPrec :: ReadPrec [Transport]
readPrec :: ReadPrec Transport
$creadPrec :: ReadPrec Transport
readList :: ReadS [Transport]
$creadList :: ReadS [Transport]
readsPrec :: Int -> ReadS Transport
$creadsPrec :: Int -> ReadS Transport
Prelude.Read, Int -> Transport -> ShowS
[Transport] -> ShowS
Transport -> String
(Int -> Transport -> ShowS)
-> (Transport -> String)
-> ([Transport] -> ShowS)
-> Show Transport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Transport] -> ShowS
$cshowList :: [Transport] -> ShowS
show :: Transport -> String
$cshow :: Transport -> String
showsPrec :: Int -> Transport -> ShowS
$cshowsPrec :: Int -> Transport -> ShowS
Prelude.Show, (forall x. Transport -> Rep Transport x)
-> (forall x. Rep Transport x -> Transport) -> Generic Transport
forall x. Rep Transport x -> Transport
forall x. Transport -> Rep Transport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Transport x -> Transport
$cfrom :: forall x. Transport -> Rep Transport x
Prelude.Generic)

-- |
-- Create a value of 'Transport' 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:
--
-- 'maxLatency', 'transport_maxLatency' - The maximum latency in milliseconds. This parameter applies only to
-- RIST-based and Zixi-based streams.
--
-- 'maxSyncBuffer', 'transport_maxSyncBuffer' - The size of the buffer (in milliseconds) to use to sync incoming source
-- data.
--
-- 'cidrAllowList', 'transport_cidrAllowList' - The range of IP addresses that should be allowed to initiate output
-- requests to this flow. These IP addresses should be in the form of a
-- Classless Inter-Domain Routing (CIDR) block; for example, 10.0.0.0\/16.
--
-- 'smoothingLatency', 'transport_smoothingLatency' - The smoothing latency in milliseconds for RIST, RTP, and RTP-FEC
-- streams.
--
-- 'minLatency', 'transport_minLatency' - The minimum latency in milliseconds for SRT-based streams. In streams
-- that use the SRT protocol, this value that you set on your MediaConnect
-- source or output represents the minimal potential latency of that
-- connection. The latency of the stream is set to the highest number
-- between the sender’s minimum latency and the receiver’s minimum latency.
--
-- 'maxBitrate', 'transport_maxBitrate' - The smoothing max bitrate for RIST, RTP, and RTP-FEC streams.
--
-- 'streamId', 'transport_streamId' - The stream ID that you want to use for this transport. This parameter
-- applies only to Zixi-based streams.
--
-- 'remoteId', 'transport_remoteId' - The remote ID for the Zixi-pull stream.
--
-- 'protocol', 'transport_protocol' - The protocol that is used by the source or output.
newTransport ::
  -- | 'protocol'
  Protocol ->
  Transport
newTransport :: Protocol -> Transport
newTransport Protocol
pProtocol_ =
  Transport' :: Maybe Int
-> Maybe Int
-> Maybe [Text]
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Protocol
-> Transport
Transport'
    { $sel:maxLatency:Transport' :: Maybe Int
maxLatency = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:maxSyncBuffer:Transport' :: Maybe Int
maxSyncBuffer = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:cidrAllowList:Transport' :: Maybe [Text]
cidrAllowList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:smoothingLatency:Transport' :: Maybe Int
smoothingLatency = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:minLatency:Transport' :: Maybe Int
minLatency = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:maxBitrate:Transport' :: Maybe Int
maxBitrate = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:streamId:Transport' :: Maybe Text
streamId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:remoteId:Transport' :: Maybe Text
remoteId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:protocol:Transport' :: Protocol
protocol = Protocol
pProtocol_
    }

-- | The maximum latency in milliseconds. This parameter applies only to
-- RIST-based and Zixi-based streams.
transport_maxLatency :: Lens.Lens' Transport (Prelude.Maybe Prelude.Int)
transport_maxLatency :: (Maybe Int -> f (Maybe Int)) -> Transport -> f Transport
transport_maxLatency = (Transport -> Maybe Int)
-> (Transport -> Maybe Int -> Transport)
-> Lens Transport Transport (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transport' {Maybe Int
maxLatency :: Maybe Int
$sel:maxLatency:Transport' :: Transport -> Maybe Int
maxLatency} -> Maybe Int
maxLatency) (\s :: Transport
s@Transport' {} Maybe Int
a -> Transport
s {$sel:maxLatency:Transport' :: Maybe Int
maxLatency = Maybe Int
a} :: Transport)

-- | The size of the buffer (in milliseconds) to use to sync incoming source
-- data.
transport_maxSyncBuffer :: Lens.Lens' Transport (Prelude.Maybe Prelude.Int)
transport_maxSyncBuffer :: (Maybe Int -> f (Maybe Int)) -> Transport -> f Transport
transport_maxSyncBuffer = (Transport -> Maybe Int)
-> (Transport -> Maybe Int -> Transport)
-> Lens Transport Transport (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transport' {Maybe Int
maxSyncBuffer :: Maybe Int
$sel:maxSyncBuffer:Transport' :: Transport -> Maybe Int
maxSyncBuffer} -> Maybe Int
maxSyncBuffer) (\s :: Transport
s@Transport' {} Maybe Int
a -> Transport
s {$sel:maxSyncBuffer:Transport' :: Maybe Int
maxSyncBuffer = Maybe Int
a} :: Transport)

-- | The range of IP addresses that should be allowed to initiate output
-- requests to this flow. These IP addresses should be in the form of a
-- Classless Inter-Domain Routing (CIDR) block; for example, 10.0.0.0\/16.
transport_cidrAllowList :: Lens.Lens' Transport (Prelude.Maybe [Prelude.Text])
transport_cidrAllowList :: (Maybe [Text] -> f (Maybe [Text])) -> Transport -> f Transport
transport_cidrAllowList = (Transport -> Maybe [Text])
-> (Transport -> Maybe [Text] -> Transport)
-> Lens Transport Transport (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transport' {Maybe [Text]
cidrAllowList :: Maybe [Text]
$sel:cidrAllowList:Transport' :: Transport -> Maybe [Text]
cidrAllowList} -> Maybe [Text]
cidrAllowList) (\s :: Transport
s@Transport' {} Maybe [Text]
a -> Transport
s {$sel:cidrAllowList:Transport' :: Maybe [Text]
cidrAllowList = Maybe [Text]
a} :: Transport) ((Maybe [Text] -> f (Maybe [Text])) -> Transport -> f Transport)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Transport
-> f Transport
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The smoothing latency in milliseconds for RIST, RTP, and RTP-FEC
-- streams.
transport_smoothingLatency :: Lens.Lens' Transport (Prelude.Maybe Prelude.Int)
transport_smoothingLatency :: (Maybe Int -> f (Maybe Int)) -> Transport -> f Transport
transport_smoothingLatency = (Transport -> Maybe Int)
-> (Transport -> Maybe Int -> Transport)
-> Lens Transport Transport (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transport' {Maybe Int
smoothingLatency :: Maybe Int
$sel:smoothingLatency:Transport' :: Transport -> Maybe Int
smoothingLatency} -> Maybe Int
smoothingLatency) (\s :: Transport
s@Transport' {} Maybe Int
a -> Transport
s {$sel:smoothingLatency:Transport' :: Maybe Int
smoothingLatency = Maybe Int
a} :: Transport)

-- | The minimum latency in milliseconds for SRT-based streams. In streams
-- that use the SRT protocol, this value that you set on your MediaConnect
-- source or output represents the minimal potential latency of that
-- connection. The latency of the stream is set to the highest number
-- between the sender’s minimum latency and the receiver’s minimum latency.
transport_minLatency :: Lens.Lens' Transport (Prelude.Maybe Prelude.Int)
transport_minLatency :: (Maybe Int -> f (Maybe Int)) -> Transport -> f Transport
transport_minLatency = (Transport -> Maybe Int)
-> (Transport -> Maybe Int -> Transport)
-> Lens Transport Transport (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transport' {Maybe Int
minLatency :: Maybe Int
$sel:minLatency:Transport' :: Transport -> Maybe Int
minLatency} -> Maybe Int
minLatency) (\s :: Transport
s@Transport' {} Maybe Int
a -> Transport
s {$sel:minLatency:Transport' :: Maybe Int
minLatency = Maybe Int
a} :: Transport)

-- | The smoothing max bitrate for RIST, RTP, and RTP-FEC streams.
transport_maxBitrate :: Lens.Lens' Transport (Prelude.Maybe Prelude.Int)
transport_maxBitrate :: (Maybe Int -> f (Maybe Int)) -> Transport -> f Transport
transport_maxBitrate = (Transport -> Maybe Int)
-> (Transport -> Maybe Int -> Transport)
-> Lens Transport Transport (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transport' {Maybe Int
maxBitrate :: Maybe Int
$sel:maxBitrate:Transport' :: Transport -> Maybe Int
maxBitrate} -> Maybe Int
maxBitrate) (\s :: Transport
s@Transport' {} Maybe Int
a -> Transport
s {$sel:maxBitrate:Transport' :: Maybe Int
maxBitrate = Maybe Int
a} :: Transport)

-- | The stream ID that you want to use for this transport. This parameter
-- applies only to Zixi-based streams.
transport_streamId :: Lens.Lens' Transport (Prelude.Maybe Prelude.Text)
transport_streamId :: (Maybe Text -> f (Maybe Text)) -> Transport -> f Transport
transport_streamId = (Transport -> Maybe Text)
-> (Transport -> Maybe Text -> Transport)
-> Lens Transport Transport (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transport' {Maybe Text
streamId :: Maybe Text
$sel:streamId:Transport' :: Transport -> Maybe Text
streamId} -> Maybe Text
streamId) (\s :: Transport
s@Transport' {} Maybe Text
a -> Transport
s {$sel:streamId:Transport' :: Maybe Text
streamId = Maybe Text
a} :: Transport)

-- | The remote ID for the Zixi-pull stream.
transport_remoteId :: Lens.Lens' Transport (Prelude.Maybe Prelude.Text)
transport_remoteId :: (Maybe Text -> f (Maybe Text)) -> Transport -> f Transport
transport_remoteId = (Transport -> Maybe Text)
-> (Transport -> Maybe Text -> Transport)
-> Lens Transport Transport (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transport' {Maybe Text
remoteId :: Maybe Text
$sel:remoteId:Transport' :: Transport -> Maybe Text
remoteId} -> Maybe Text
remoteId) (\s :: Transport
s@Transport' {} Maybe Text
a -> Transport
s {$sel:remoteId:Transport' :: Maybe Text
remoteId = Maybe Text
a} :: Transport)

-- | The protocol that is used by the source or output.
transport_protocol :: Lens.Lens' Transport Protocol
transport_protocol :: (Protocol -> f Protocol) -> Transport -> f Transport
transport_protocol = (Transport -> Protocol)
-> (Transport -> Protocol -> Transport)
-> Lens Transport Transport Protocol Protocol
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transport' {Protocol
protocol :: Protocol
$sel:protocol:Transport' :: Transport -> Protocol
protocol} -> Protocol
protocol) (\s :: Transport
s@Transport' {} Protocol
a -> Transport
s {$sel:protocol:Transport' :: Protocol
protocol = Protocol
a} :: Transport)

instance Core.FromJSON Transport where
  parseJSON :: Value -> Parser Transport
parseJSON =
    String -> (Object -> Parser Transport) -> Value -> Parser Transport
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Transport"
      ( \Object
x ->
          Maybe Int
-> Maybe Int
-> Maybe [Text]
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Protocol
-> Transport
Transport'
            (Maybe Int
 -> Maybe Int
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Protocol
 -> Transport)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Protocol
      -> Transport)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"maxLatency")
            Parser
  (Maybe Int
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Protocol
   -> Transport)
-> Parser (Maybe Int)
-> Parser
     (Maybe [Text]
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Protocol
      -> Transport)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"maxSyncBuffer")
            Parser
  (Maybe [Text]
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Protocol
   -> Transport)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Protocol
      -> Transport)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cidrAllowList" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Protocol
   -> Transport)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int -> Maybe Text -> Maybe Text -> Protocol -> Transport)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"smoothingLatency")
            Parser
  (Maybe Int
   -> Maybe Int -> Maybe Text -> Maybe Text -> Protocol -> Transport)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int -> Maybe Text -> Maybe Text -> Protocol -> Transport)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"minLatency")
            Parser
  (Maybe Int -> Maybe Text -> Maybe Text -> Protocol -> Transport)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Text -> Protocol -> Transport)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"maxBitrate")
            Parser (Maybe Text -> Maybe Text -> Protocol -> Transport)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Protocol -> Transport)
forall (f :: * -> *) a b. Applicative f => 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
"streamId")
            Parser (Maybe Text -> Protocol -> Transport)
-> Parser (Maybe Text) -> Parser (Protocol -> Transport)
forall (f :: * -> *) a b. Applicative f => 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
"remoteId")
            Parser (Protocol -> Transport)
-> Parser Protocol -> Parser Transport
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Protocol
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"protocol")
      )

instance Prelude.Hashable Transport

instance Prelude.NFData Transport