{-# 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.InputConfiguration
-- 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.InputConfiguration 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 incoming media
-- stream.
--
-- /See:/ 'newInputConfiguration' smart constructor.
data InputConfiguration = InputConfiguration'
  { -- | The port that the flow listens on for an incoming media stream.
    InputConfiguration -> Int
inputPort :: Prelude.Int,
    -- | The IP address that the flow listens on for incoming content for a media
    -- stream.
    InputConfiguration -> Text
inputIp :: Prelude.Text,
    -- | The VPC interface where the media stream comes in from.
    InputConfiguration -> Interface
interface :: Interface
  }
  deriving (InputConfiguration -> InputConfiguration -> Bool
(InputConfiguration -> InputConfiguration -> Bool)
-> (InputConfiguration -> InputConfiguration -> Bool)
-> Eq InputConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputConfiguration -> InputConfiguration -> Bool
$c/= :: InputConfiguration -> InputConfiguration -> Bool
== :: InputConfiguration -> InputConfiguration -> Bool
$c== :: InputConfiguration -> InputConfiguration -> Bool
Prelude.Eq, ReadPrec [InputConfiguration]
ReadPrec InputConfiguration
Int -> ReadS InputConfiguration
ReadS [InputConfiguration]
(Int -> ReadS InputConfiguration)
-> ReadS [InputConfiguration]
-> ReadPrec InputConfiguration
-> ReadPrec [InputConfiguration]
-> Read InputConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputConfiguration]
$creadListPrec :: ReadPrec [InputConfiguration]
readPrec :: ReadPrec InputConfiguration
$creadPrec :: ReadPrec InputConfiguration
readList :: ReadS [InputConfiguration]
$creadList :: ReadS [InputConfiguration]
readsPrec :: Int -> ReadS InputConfiguration
$creadsPrec :: Int -> ReadS InputConfiguration
Prelude.Read, Int -> InputConfiguration -> ShowS
[InputConfiguration] -> ShowS
InputConfiguration -> String
(Int -> InputConfiguration -> ShowS)
-> (InputConfiguration -> String)
-> ([InputConfiguration] -> ShowS)
-> Show InputConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputConfiguration] -> ShowS
$cshowList :: [InputConfiguration] -> ShowS
show :: InputConfiguration -> String
$cshow :: InputConfiguration -> String
showsPrec :: Int -> InputConfiguration -> ShowS
$cshowsPrec :: Int -> InputConfiguration -> ShowS
Prelude.Show, (forall x. InputConfiguration -> Rep InputConfiguration x)
-> (forall x. Rep InputConfiguration x -> InputConfiguration)
-> Generic InputConfiguration
forall x. Rep InputConfiguration x -> InputConfiguration
forall x. InputConfiguration -> Rep InputConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputConfiguration x -> InputConfiguration
$cfrom :: forall x. InputConfiguration -> Rep InputConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'InputConfiguration' 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:
--
-- 'inputPort', 'inputConfiguration_inputPort' - The port that the flow listens on for an incoming media stream.
--
-- 'inputIp', 'inputConfiguration_inputIp' - The IP address that the flow listens on for incoming content for a media
-- stream.
--
-- 'interface', 'inputConfiguration_interface' - The VPC interface where the media stream comes in from.
newInputConfiguration ::
  -- | 'inputPort'
  Prelude.Int ->
  -- | 'inputIp'
  Prelude.Text ->
  -- | 'interface'
  Interface ->
  InputConfiguration
newInputConfiguration :: Int -> Text -> Interface -> InputConfiguration
newInputConfiguration
  Int
pInputPort_
  Text
pInputIp_
  Interface
pInterface_ =
    InputConfiguration' :: Int -> Text -> Interface -> InputConfiguration
InputConfiguration'
      { $sel:inputPort:InputConfiguration' :: Int
inputPort = Int
pInputPort_,
        $sel:inputIp:InputConfiguration' :: Text
inputIp = Text
pInputIp_,
        $sel:interface:InputConfiguration' :: Interface
interface = Interface
pInterface_
      }

-- | The port that the flow listens on for an incoming media stream.
inputConfiguration_inputPort :: Lens.Lens' InputConfiguration Prelude.Int
inputConfiguration_inputPort :: (Int -> f Int) -> InputConfiguration -> f InputConfiguration
inputConfiguration_inputPort = (InputConfiguration -> Int)
-> (InputConfiguration -> Int -> InputConfiguration)
-> Lens InputConfiguration InputConfiguration Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputConfiguration' {Int
inputPort :: Int
$sel:inputPort:InputConfiguration' :: InputConfiguration -> Int
inputPort} -> Int
inputPort) (\s :: InputConfiguration
s@InputConfiguration' {} Int
a -> InputConfiguration
s {$sel:inputPort:InputConfiguration' :: Int
inputPort = Int
a} :: InputConfiguration)

-- | The IP address that the flow listens on for incoming content for a media
-- stream.
inputConfiguration_inputIp :: Lens.Lens' InputConfiguration Prelude.Text
inputConfiguration_inputIp :: (Text -> f Text) -> InputConfiguration -> f InputConfiguration
inputConfiguration_inputIp = (InputConfiguration -> Text)
-> (InputConfiguration -> Text -> InputConfiguration)
-> Lens InputConfiguration InputConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputConfiguration' {Text
inputIp :: Text
$sel:inputIp:InputConfiguration' :: InputConfiguration -> Text
inputIp} -> Text
inputIp) (\s :: InputConfiguration
s@InputConfiguration' {} Text
a -> InputConfiguration
s {$sel:inputIp:InputConfiguration' :: Text
inputIp = Text
a} :: InputConfiguration)

-- | The VPC interface where the media stream comes in from.
inputConfiguration_interface :: Lens.Lens' InputConfiguration Interface
inputConfiguration_interface :: (Interface -> f Interface)
-> InputConfiguration -> f InputConfiguration
inputConfiguration_interface = (InputConfiguration -> Interface)
-> (InputConfiguration -> Interface -> InputConfiguration)
-> Lens InputConfiguration InputConfiguration Interface Interface
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputConfiguration' {Interface
interface :: Interface
$sel:interface:InputConfiguration' :: InputConfiguration -> Interface
interface} -> Interface
interface) (\s :: InputConfiguration
s@InputConfiguration' {} Interface
a -> InputConfiguration
s {$sel:interface:InputConfiguration' :: Interface
interface = Interface
a} :: InputConfiguration)

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

instance Prelude.Hashable InputConfiguration

instance Prelude.NFData InputConfiguration