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

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

-- | The transport parameters that are associated with an outbound media
-- stream.
--
-- /See:/ 'newDestinationConfiguration' smart constructor.
data DestinationConfiguration = DestinationConfiguration'
  { -- | The IP address where contents of the media stream will be sent.
    DestinationConfiguration -> Text
destinationIp :: Prelude.Text,
    -- | The port to use when the content of the media stream is distributed to
    -- the output.
    DestinationConfiguration -> Int
destinationPort :: Prelude.Int,
    -- | The VPC interface that is used for the media stream associated with the
    -- output.
    DestinationConfiguration -> Interface
interface :: Interface,
    -- | The IP address that the receiver requires in order to establish a
    -- connection with the flow. This value is represented by the elastic
    -- network interface IP address of the VPC. This field applies only to
    -- outputs that use the CDI or ST 2110 JPEG XS protocol.
    DestinationConfiguration -> Text
outboundIp :: Prelude.Text
  }
  deriving (DestinationConfiguration -> DestinationConfiguration -> Bool
(DestinationConfiguration -> DestinationConfiguration -> Bool)
-> (DestinationConfiguration -> DestinationConfiguration -> Bool)
-> Eq DestinationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationConfiguration -> DestinationConfiguration -> Bool
$c/= :: DestinationConfiguration -> DestinationConfiguration -> Bool
== :: DestinationConfiguration -> DestinationConfiguration -> Bool
$c== :: DestinationConfiguration -> DestinationConfiguration -> Bool
Prelude.Eq, ReadPrec [DestinationConfiguration]
ReadPrec DestinationConfiguration
Int -> ReadS DestinationConfiguration
ReadS [DestinationConfiguration]
(Int -> ReadS DestinationConfiguration)
-> ReadS [DestinationConfiguration]
-> ReadPrec DestinationConfiguration
-> ReadPrec [DestinationConfiguration]
-> Read DestinationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationConfiguration]
$creadListPrec :: ReadPrec [DestinationConfiguration]
readPrec :: ReadPrec DestinationConfiguration
$creadPrec :: ReadPrec DestinationConfiguration
readList :: ReadS [DestinationConfiguration]
$creadList :: ReadS [DestinationConfiguration]
readsPrec :: Int -> ReadS DestinationConfiguration
$creadsPrec :: Int -> ReadS DestinationConfiguration
Prelude.Read, Int -> DestinationConfiguration -> ShowS
[DestinationConfiguration] -> ShowS
DestinationConfiguration -> String
(Int -> DestinationConfiguration -> ShowS)
-> (DestinationConfiguration -> String)
-> ([DestinationConfiguration] -> ShowS)
-> Show DestinationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationConfiguration] -> ShowS
$cshowList :: [DestinationConfiguration] -> ShowS
show :: DestinationConfiguration -> String
$cshow :: DestinationConfiguration -> String
showsPrec :: Int -> DestinationConfiguration -> ShowS
$cshowsPrec :: Int -> DestinationConfiguration -> ShowS
Prelude.Show, (forall x.
 DestinationConfiguration -> Rep DestinationConfiguration x)
-> (forall x.
    Rep DestinationConfiguration x -> DestinationConfiguration)
-> Generic DestinationConfiguration
forall x.
Rep DestinationConfiguration x -> DestinationConfiguration
forall x.
DestinationConfiguration -> Rep DestinationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DestinationConfiguration x -> DestinationConfiguration
$cfrom :: forall x.
DestinationConfiguration -> Rep DestinationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DestinationConfiguration' 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:
--
-- 'destinationIp', 'destinationConfiguration_destinationIp' - The IP address where contents of the media stream will be sent.
--
-- 'destinationPort', 'destinationConfiguration_destinationPort' - The port to use when the content of the media stream is distributed to
-- the output.
--
-- 'interface', 'destinationConfiguration_interface' - The VPC interface that is used for the media stream associated with the
-- output.
--
-- 'outboundIp', 'destinationConfiguration_outboundIp' - The IP address that the receiver requires in order to establish a
-- connection with the flow. This value is represented by the elastic
-- network interface IP address of the VPC. This field applies only to
-- outputs that use the CDI or ST 2110 JPEG XS protocol.
newDestinationConfiguration ::
  -- | 'destinationIp'
  Prelude.Text ->
  -- | 'destinationPort'
  Prelude.Int ->
  -- | 'interface'
  Interface ->
  -- | 'outboundIp'
  Prelude.Text ->
  DestinationConfiguration
newDestinationConfiguration :: Text -> Int -> Interface -> Text -> DestinationConfiguration
newDestinationConfiguration
  Text
pDestinationIp_
  Int
pDestinationPort_
  Interface
pInterface_
  Text
pOutboundIp_ =
    DestinationConfiguration' :: Text -> Int -> Interface -> Text -> DestinationConfiguration
DestinationConfiguration'
      { $sel:destinationIp:DestinationConfiguration' :: Text
destinationIp =
          Text
pDestinationIp_,
        $sel:destinationPort:DestinationConfiguration' :: Int
destinationPort = Int
pDestinationPort_,
        $sel:interface:DestinationConfiguration' :: Interface
interface = Interface
pInterface_,
        $sel:outboundIp:DestinationConfiguration' :: Text
outboundIp = Text
pOutboundIp_
      }

-- | The IP address where contents of the media stream will be sent.
destinationConfiguration_destinationIp :: Lens.Lens' DestinationConfiguration Prelude.Text
destinationConfiguration_destinationIp :: (Text -> f Text)
-> DestinationConfiguration -> f DestinationConfiguration
destinationConfiguration_destinationIp = (DestinationConfiguration -> Text)
-> (DestinationConfiguration -> Text -> DestinationConfiguration)
-> Lens DestinationConfiguration DestinationConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationConfiguration' {Text
destinationIp :: Text
$sel:destinationIp:DestinationConfiguration' :: DestinationConfiguration -> Text
destinationIp} -> Text
destinationIp) (\s :: DestinationConfiguration
s@DestinationConfiguration' {} Text
a -> DestinationConfiguration
s {$sel:destinationIp:DestinationConfiguration' :: Text
destinationIp = Text
a} :: DestinationConfiguration)

-- | The port to use when the content of the media stream is distributed to
-- the output.
destinationConfiguration_destinationPort :: Lens.Lens' DestinationConfiguration Prelude.Int
destinationConfiguration_destinationPort :: (Int -> f Int)
-> DestinationConfiguration -> f DestinationConfiguration
destinationConfiguration_destinationPort = (DestinationConfiguration -> Int)
-> (DestinationConfiguration -> Int -> DestinationConfiguration)
-> Lens DestinationConfiguration DestinationConfiguration Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationConfiguration' {Int
destinationPort :: Int
$sel:destinationPort:DestinationConfiguration' :: DestinationConfiguration -> Int
destinationPort} -> Int
destinationPort) (\s :: DestinationConfiguration
s@DestinationConfiguration' {} Int
a -> DestinationConfiguration
s {$sel:destinationPort:DestinationConfiguration' :: Int
destinationPort = Int
a} :: DestinationConfiguration)

-- | The VPC interface that is used for the media stream associated with the
-- output.
destinationConfiguration_interface :: Lens.Lens' DestinationConfiguration Interface
destinationConfiguration_interface :: (Interface -> f Interface)
-> DestinationConfiguration -> f DestinationConfiguration
destinationConfiguration_interface = (DestinationConfiguration -> Interface)
-> (DestinationConfiguration
    -> Interface -> DestinationConfiguration)
-> Lens
     DestinationConfiguration
     DestinationConfiguration
     Interface
     Interface
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationConfiguration' {Interface
interface :: Interface
$sel:interface:DestinationConfiguration' :: DestinationConfiguration -> Interface
interface} -> Interface
interface) (\s :: DestinationConfiguration
s@DestinationConfiguration' {} Interface
a -> DestinationConfiguration
s {$sel:interface:DestinationConfiguration' :: Interface
interface = Interface
a} :: DestinationConfiguration)

-- | The IP address that the receiver requires in order to establish a
-- connection with the flow. This value is represented by the elastic
-- network interface IP address of the VPC. This field applies only to
-- outputs that use the CDI or ST 2110 JPEG XS protocol.
destinationConfiguration_outboundIp :: Lens.Lens' DestinationConfiguration Prelude.Text
destinationConfiguration_outboundIp :: (Text -> f Text)
-> DestinationConfiguration -> f DestinationConfiguration
destinationConfiguration_outboundIp = (DestinationConfiguration -> Text)
-> (DestinationConfiguration -> Text -> DestinationConfiguration)
-> Lens DestinationConfiguration DestinationConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationConfiguration' {Text
outboundIp :: Text
$sel:outboundIp:DestinationConfiguration' :: DestinationConfiguration -> Text
outboundIp} -> Text
outboundIp) (\s :: DestinationConfiguration
s@DestinationConfiguration' {} Text
a -> DestinationConfiguration
s {$sel:outboundIp:DestinationConfiguration' :: Text
outboundIp = Text
a} :: DestinationConfiguration)

instance Core.FromJSON DestinationConfiguration where
  parseJSON :: Value -> Parser DestinationConfiguration
parseJSON =
    String
-> (Object -> Parser DestinationConfiguration)
-> Value
-> Parser DestinationConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DestinationConfiguration"
      ( \Object
x ->
          Text -> Int -> Interface -> Text -> DestinationConfiguration
DestinationConfiguration'
            (Text -> Int -> Interface -> Text -> DestinationConfiguration)
-> Parser Text
-> Parser (Int -> Interface -> Text -> DestinationConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"destinationIp")
            Parser (Int -> Interface -> Text -> DestinationConfiguration)
-> Parser Int
-> Parser (Interface -> Text -> DestinationConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"destinationPort")
            Parser (Interface -> Text -> DestinationConfiguration)
-> Parser Interface -> Parser (Text -> DestinationConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Interface
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"interface")
            Parser (Text -> DestinationConfiguration)
-> Parser Text -> Parser DestinationConfiguration
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
"outboundIp")
      )

instance Prelude.Hashable DestinationConfiguration

instance Prelude.NFData DestinationConfiguration