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

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

-- | The transport parameters that you want to associate with an outbound
-- media stream.
--
-- /See:/ 'newDestinationConfigurationRequest' smart constructor.
data DestinationConfigurationRequest = DestinationConfigurationRequest'
  { -- | The IP address where you want MediaConnect to send contents of the media
    -- stream.
    DestinationConfigurationRequest -> Text
destinationIp :: Prelude.Text,
    -- | The port that you want MediaConnect to use when it distributes the media
    -- stream to the output.
    DestinationConfigurationRequest -> Int
destinationPort :: Prelude.Int,
    -- | The VPC interface that you want to use for the media stream associated
    -- with the output.
    DestinationConfigurationRequest -> InterfaceRequest
interface :: InterfaceRequest
  }
  deriving (DestinationConfigurationRequest
-> DestinationConfigurationRequest -> Bool
(DestinationConfigurationRequest
 -> DestinationConfigurationRequest -> Bool)
-> (DestinationConfigurationRequest
    -> DestinationConfigurationRequest -> Bool)
-> Eq DestinationConfigurationRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationConfigurationRequest
-> DestinationConfigurationRequest -> Bool
$c/= :: DestinationConfigurationRequest
-> DestinationConfigurationRequest -> Bool
== :: DestinationConfigurationRequest
-> DestinationConfigurationRequest -> Bool
$c== :: DestinationConfigurationRequest
-> DestinationConfigurationRequest -> Bool
Prelude.Eq, ReadPrec [DestinationConfigurationRequest]
ReadPrec DestinationConfigurationRequest
Int -> ReadS DestinationConfigurationRequest
ReadS [DestinationConfigurationRequest]
(Int -> ReadS DestinationConfigurationRequest)
-> ReadS [DestinationConfigurationRequest]
-> ReadPrec DestinationConfigurationRequest
-> ReadPrec [DestinationConfigurationRequest]
-> Read DestinationConfigurationRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationConfigurationRequest]
$creadListPrec :: ReadPrec [DestinationConfigurationRequest]
readPrec :: ReadPrec DestinationConfigurationRequest
$creadPrec :: ReadPrec DestinationConfigurationRequest
readList :: ReadS [DestinationConfigurationRequest]
$creadList :: ReadS [DestinationConfigurationRequest]
readsPrec :: Int -> ReadS DestinationConfigurationRequest
$creadsPrec :: Int -> ReadS DestinationConfigurationRequest
Prelude.Read, Int -> DestinationConfigurationRequest -> ShowS
[DestinationConfigurationRequest] -> ShowS
DestinationConfigurationRequest -> String
(Int -> DestinationConfigurationRequest -> ShowS)
-> (DestinationConfigurationRequest -> String)
-> ([DestinationConfigurationRequest] -> ShowS)
-> Show DestinationConfigurationRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationConfigurationRequest] -> ShowS
$cshowList :: [DestinationConfigurationRequest] -> ShowS
show :: DestinationConfigurationRequest -> String
$cshow :: DestinationConfigurationRequest -> String
showsPrec :: Int -> DestinationConfigurationRequest -> ShowS
$cshowsPrec :: Int -> DestinationConfigurationRequest -> ShowS
Prelude.Show, (forall x.
 DestinationConfigurationRequest
 -> Rep DestinationConfigurationRequest x)
-> (forall x.
    Rep DestinationConfigurationRequest x
    -> DestinationConfigurationRequest)
-> Generic DestinationConfigurationRequest
forall x.
Rep DestinationConfigurationRequest x
-> DestinationConfigurationRequest
forall x.
DestinationConfigurationRequest
-> Rep DestinationConfigurationRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DestinationConfigurationRequest x
-> DestinationConfigurationRequest
$cfrom :: forall x.
DestinationConfigurationRequest
-> Rep DestinationConfigurationRequest x
Prelude.Generic)

-- |
-- Create a value of 'DestinationConfigurationRequest' 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', 'destinationConfigurationRequest_destinationIp' - The IP address where you want MediaConnect to send contents of the media
-- stream.
--
-- 'destinationPort', 'destinationConfigurationRequest_destinationPort' - The port that you want MediaConnect to use when it distributes the media
-- stream to the output.
--
-- 'interface', 'destinationConfigurationRequest_interface' - The VPC interface that you want to use for the media stream associated
-- with the output.
newDestinationConfigurationRequest ::
  -- | 'destinationIp'
  Prelude.Text ->
  -- | 'destinationPort'
  Prelude.Int ->
  -- | 'interface'
  InterfaceRequest ->
  DestinationConfigurationRequest
newDestinationConfigurationRequest :: Text -> Int -> InterfaceRequest -> DestinationConfigurationRequest
newDestinationConfigurationRequest
  Text
pDestinationIp_
  Int
pDestinationPort_
  InterfaceRequest
pInterface_ =
    DestinationConfigurationRequest' :: Text -> Int -> InterfaceRequest -> DestinationConfigurationRequest
DestinationConfigurationRequest'
      { $sel:destinationIp:DestinationConfigurationRequest' :: Text
destinationIp =
          Text
pDestinationIp_,
        $sel:destinationPort:DestinationConfigurationRequest' :: Int
destinationPort = Int
pDestinationPort_,
        $sel:interface:DestinationConfigurationRequest' :: InterfaceRequest
interface = InterfaceRequest
pInterface_
      }

-- | The IP address where you want MediaConnect to send contents of the media
-- stream.
destinationConfigurationRequest_destinationIp :: Lens.Lens' DestinationConfigurationRequest Prelude.Text
destinationConfigurationRequest_destinationIp :: (Text -> f Text)
-> DestinationConfigurationRequest
-> f DestinationConfigurationRequest
destinationConfigurationRequest_destinationIp = (DestinationConfigurationRequest -> Text)
-> (DestinationConfigurationRequest
    -> Text -> DestinationConfigurationRequest)
-> Lens
     DestinationConfigurationRequest
     DestinationConfigurationRequest
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationConfigurationRequest' {Text
destinationIp :: Text
$sel:destinationIp:DestinationConfigurationRequest' :: DestinationConfigurationRequest -> Text
destinationIp} -> Text
destinationIp) (\s :: DestinationConfigurationRequest
s@DestinationConfigurationRequest' {} Text
a -> DestinationConfigurationRequest
s {$sel:destinationIp:DestinationConfigurationRequest' :: Text
destinationIp = Text
a} :: DestinationConfigurationRequest)

-- | The port that you want MediaConnect to use when it distributes the media
-- stream to the output.
destinationConfigurationRequest_destinationPort :: Lens.Lens' DestinationConfigurationRequest Prelude.Int
destinationConfigurationRequest_destinationPort :: (Int -> f Int)
-> DestinationConfigurationRequest
-> f DestinationConfigurationRequest
destinationConfigurationRequest_destinationPort = (DestinationConfigurationRequest -> Int)
-> (DestinationConfigurationRequest
    -> Int -> DestinationConfigurationRequest)
-> Lens
     DestinationConfigurationRequest
     DestinationConfigurationRequest
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationConfigurationRequest' {Int
destinationPort :: Int
$sel:destinationPort:DestinationConfigurationRequest' :: DestinationConfigurationRequest -> Int
destinationPort} -> Int
destinationPort) (\s :: DestinationConfigurationRequest
s@DestinationConfigurationRequest' {} Int
a -> DestinationConfigurationRequest
s {$sel:destinationPort:DestinationConfigurationRequest' :: Int
destinationPort = Int
a} :: DestinationConfigurationRequest)

-- | The VPC interface that you want to use for the media stream associated
-- with the output.
destinationConfigurationRequest_interface :: Lens.Lens' DestinationConfigurationRequest InterfaceRequest
destinationConfigurationRequest_interface :: (InterfaceRequest -> f InterfaceRequest)
-> DestinationConfigurationRequest
-> f DestinationConfigurationRequest
destinationConfigurationRequest_interface = (DestinationConfigurationRequest -> InterfaceRequest)
-> (DestinationConfigurationRequest
    -> InterfaceRequest -> DestinationConfigurationRequest)
-> Lens
     DestinationConfigurationRequest
     DestinationConfigurationRequest
     InterfaceRequest
     InterfaceRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationConfigurationRequest' {InterfaceRequest
interface :: InterfaceRequest
$sel:interface:DestinationConfigurationRequest' :: DestinationConfigurationRequest -> InterfaceRequest
interface} -> InterfaceRequest
interface) (\s :: DestinationConfigurationRequest
s@DestinationConfigurationRequest' {} InterfaceRequest
a -> DestinationConfigurationRequest
s {$sel:interface:DestinationConfigurationRequest' :: InterfaceRequest
interface = InterfaceRequest
a} :: DestinationConfigurationRequest)

instance
  Prelude.Hashable
    DestinationConfigurationRequest

instance
  Prelude.NFData
    DestinationConfigurationRequest

instance Core.ToJSON DestinationConfigurationRequest where
  toJSON :: DestinationConfigurationRequest -> Value
toJSON DestinationConfigurationRequest' {Int
Text
InterfaceRequest
interface :: InterfaceRequest
destinationPort :: Int
destinationIp :: Text
$sel:interface:DestinationConfigurationRequest' :: DestinationConfigurationRequest -> InterfaceRequest
$sel:destinationPort:DestinationConfigurationRequest' :: DestinationConfigurationRequest -> Int
$sel:destinationIp:DestinationConfigurationRequest' :: DestinationConfigurationRequest -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"destinationIp" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationIp),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"destinationPort" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
destinationPort),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"interface" Text -> InterfaceRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= InterfaceRequest
interface)
          ]
      )