{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaConnect.Types.DestinationConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
      { $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 :: Lens' DestinationConfiguration Text
destinationConfiguration_destinationIp = 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 :: Lens' DestinationConfiguration Int
destinationConfiguration_destinationPort = 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 :: Lens' DestinationConfiguration Interface
destinationConfiguration_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 :: Lens' DestinationConfiguration Text
destinationConfiguration_outboundIp = 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 Data.FromJSON DestinationConfiguration where
  parseJSON :: Value -> Parser DestinationConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DestinationConfiguration"
      ( \Object
x ->
          Text -> Int -> Interface -> Text -> DestinationConfiguration
DestinationConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"destinationIp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"destinationPort")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"interface")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"outboundIp")
      )

instance Prelude.Hashable DestinationConfiguration where
  hashWithSalt :: Int -> DestinationConfiguration -> Int
hashWithSalt Int
_salt DestinationConfiguration' {Int
Text
Interface
outboundIp :: Text
interface :: Interface
destinationPort :: Int
destinationIp :: Text
$sel:outboundIp:DestinationConfiguration' :: DestinationConfiguration -> Text
$sel:interface:DestinationConfiguration' :: DestinationConfiguration -> Interface
$sel:destinationPort:DestinationConfiguration' :: DestinationConfiguration -> Int
$sel:destinationIp:DestinationConfiguration' :: DestinationConfiguration -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destinationIp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
destinationPort
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Interface
interface
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
outboundIp

instance Prelude.NFData DestinationConfiguration where
  rnf :: DestinationConfiguration -> ()
rnf DestinationConfiguration' {Int
Text
Interface
outboundIp :: Text
interface :: Interface
destinationPort :: Int
destinationIp :: Text
$sel:outboundIp:DestinationConfiguration' :: DestinationConfiguration -> Text
$sel:interface:DestinationConfiguration' :: DestinationConfiguration -> Interface
$sel:destinationPort:DestinationConfiguration' :: DestinationConfiguration -> Int
$sel:destinationIp:DestinationConfiguration' :: DestinationConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
destinationIp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
destinationPort
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Interface
interface
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
outboundIp