{-# 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.Panorama.Types.NodeInputPort
-- 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.Panorama.Types.NodeInputPort where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types.PortType
import qualified Amazonka.Prelude as Prelude

-- | A node input port.
--
-- /See:/ 'newNodeInputPort' smart constructor.
data NodeInputPort = NodeInputPort'
  { -- | The input port\'s max connections.
    NodeInputPort -> Maybe Int
maxConnections :: Prelude.Maybe Prelude.Int,
    -- | The input port\'s name.
    NodeInputPort -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The input port\'s default value.
    NodeInputPort -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text,
    -- | The input port\'s type.
    NodeInputPort -> Maybe PortType
type' :: Prelude.Maybe PortType,
    -- | The input port\'s description.
    NodeInputPort -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (NodeInputPort -> NodeInputPort -> Bool
(NodeInputPort -> NodeInputPort -> Bool)
-> (NodeInputPort -> NodeInputPort -> Bool) -> Eq NodeInputPort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeInputPort -> NodeInputPort -> Bool
$c/= :: NodeInputPort -> NodeInputPort -> Bool
== :: NodeInputPort -> NodeInputPort -> Bool
$c== :: NodeInputPort -> NodeInputPort -> Bool
Prelude.Eq, ReadPrec [NodeInputPort]
ReadPrec NodeInputPort
Int -> ReadS NodeInputPort
ReadS [NodeInputPort]
(Int -> ReadS NodeInputPort)
-> ReadS [NodeInputPort]
-> ReadPrec NodeInputPort
-> ReadPrec [NodeInputPort]
-> Read NodeInputPort
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeInputPort]
$creadListPrec :: ReadPrec [NodeInputPort]
readPrec :: ReadPrec NodeInputPort
$creadPrec :: ReadPrec NodeInputPort
readList :: ReadS [NodeInputPort]
$creadList :: ReadS [NodeInputPort]
readsPrec :: Int -> ReadS NodeInputPort
$creadsPrec :: Int -> ReadS NodeInputPort
Prelude.Read, Int -> NodeInputPort -> ShowS
[NodeInputPort] -> ShowS
NodeInputPort -> String
(Int -> NodeInputPort -> ShowS)
-> (NodeInputPort -> String)
-> ([NodeInputPort] -> ShowS)
-> Show NodeInputPort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeInputPort] -> ShowS
$cshowList :: [NodeInputPort] -> ShowS
show :: NodeInputPort -> String
$cshow :: NodeInputPort -> String
showsPrec :: Int -> NodeInputPort -> ShowS
$cshowsPrec :: Int -> NodeInputPort -> ShowS
Prelude.Show, (forall x. NodeInputPort -> Rep NodeInputPort x)
-> (forall x. Rep NodeInputPort x -> NodeInputPort)
-> Generic NodeInputPort
forall x. Rep NodeInputPort x -> NodeInputPort
forall x. NodeInputPort -> Rep NodeInputPort x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeInputPort x -> NodeInputPort
$cfrom :: forall x. NodeInputPort -> Rep NodeInputPort x
Prelude.Generic)

-- |
-- Create a value of 'NodeInputPort' 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:
--
-- 'maxConnections', 'nodeInputPort_maxConnections' - The input port\'s max connections.
--
-- 'name', 'nodeInputPort_name' - The input port\'s name.
--
-- 'defaultValue', 'nodeInputPort_defaultValue' - The input port\'s default value.
--
-- 'type'', 'nodeInputPort_type' - The input port\'s type.
--
-- 'description', 'nodeInputPort_description' - The input port\'s description.
newNodeInputPort ::
  NodeInputPort
newNodeInputPort :: NodeInputPort
newNodeInputPort =
  NodeInputPort' :: Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe PortType
-> Maybe Text
-> NodeInputPort
NodeInputPort'
    { $sel:maxConnections:NodeInputPort' :: Maybe Int
maxConnections = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:name:NodeInputPort' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultValue:NodeInputPort' :: Maybe Text
defaultValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':NodeInputPort' :: Maybe PortType
type' = Maybe PortType
forall a. Maybe a
Prelude.Nothing,
      $sel:description:NodeInputPort' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The input port\'s max connections.
nodeInputPort_maxConnections :: Lens.Lens' NodeInputPort (Prelude.Maybe Prelude.Int)
nodeInputPort_maxConnections :: (Maybe Int -> f (Maybe Int)) -> NodeInputPort -> f NodeInputPort
nodeInputPort_maxConnections = (NodeInputPort -> Maybe Int)
-> (NodeInputPort -> Maybe Int -> NodeInputPort)
-> Lens NodeInputPort NodeInputPort (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInputPort' {Maybe Int
maxConnections :: Maybe Int
$sel:maxConnections:NodeInputPort' :: NodeInputPort -> Maybe Int
maxConnections} -> Maybe Int
maxConnections) (\s :: NodeInputPort
s@NodeInputPort' {} Maybe Int
a -> NodeInputPort
s {$sel:maxConnections:NodeInputPort' :: Maybe Int
maxConnections = Maybe Int
a} :: NodeInputPort)

-- | The input port\'s name.
nodeInputPort_name :: Lens.Lens' NodeInputPort (Prelude.Maybe Prelude.Text)
nodeInputPort_name :: (Maybe Text -> f (Maybe Text)) -> NodeInputPort -> f NodeInputPort
nodeInputPort_name = (NodeInputPort -> Maybe Text)
-> (NodeInputPort -> Maybe Text -> NodeInputPort)
-> Lens NodeInputPort NodeInputPort (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInputPort' {Maybe Text
name :: Maybe Text
$sel:name:NodeInputPort' :: NodeInputPort -> Maybe Text
name} -> Maybe Text
name) (\s :: NodeInputPort
s@NodeInputPort' {} Maybe Text
a -> NodeInputPort
s {$sel:name:NodeInputPort' :: Maybe Text
name = Maybe Text
a} :: NodeInputPort)

-- | The input port\'s default value.
nodeInputPort_defaultValue :: Lens.Lens' NodeInputPort (Prelude.Maybe Prelude.Text)
nodeInputPort_defaultValue :: (Maybe Text -> f (Maybe Text)) -> NodeInputPort -> f NodeInputPort
nodeInputPort_defaultValue = (NodeInputPort -> Maybe Text)
-> (NodeInputPort -> Maybe Text -> NodeInputPort)
-> Lens NodeInputPort NodeInputPort (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInputPort' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:NodeInputPort' :: NodeInputPort -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: NodeInputPort
s@NodeInputPort' {} Maybe Text
a -> NodeInputPort
s {$sel:defaultValue:NodeInputPort' :: Maybe Text
defaultValue = Maybe Text
a} :: NodeInputPort)

-- | The input port\'s type.
nodeInputPort_type :: Lens.Lens' NodeInputPort (Prelude.Maybe PortType)
nodeInputPort_type :: (Maybe PortType -> f (Maybe PortType))
-> NodeInputPort -> f NodeInputPort
nodeInputPort_type = (NodeInputPort -> Maybe PortType)
-> (NodeInputPort -> Maybe PortType -> NodeInputPort)
-> Lens
     NodeInputPort NodeInputPort (Maybe PortType) (Maybe PortType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInputPort' {Maybe PortType
type' :: Maybe PortType
$sel:type':NodeInputPort' :: NodeInputPort -> Maybe PortType
type'} -> Maybe PortType
type') (\s :: NodeInputPort
s@NodeInputPort' {} Maybe PortType
a -> NodeInputPort
s {$sel:type':NodeInputPort' :: Maybe PortType
type' = Maybe PortType
a} :: NodeInputPort)

-- | The input port\'s description.
nodeInputPort_description :: Lens.Lens' NodeInputPort (Prelude.Maybe Prelude.Text)
nodeInputPort_description :: (Maybe Text -> f (Maybe Text)) -> NodeInputPort -> f NodeInputPort
nodeInputPort_description = (NodeInputPort -> Maybe Text)
-> (NodeInputPort -> Maybe Text -> NodeInputPort)
-> Lens NodeInputPort NodeInputPort (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInputPort' {Maybe Text
description :: Maybe Text
$sel:description:NodeInputPort' :: NodeInputPort -> Maybe Text
description} -> Maybe Text
description) (\s :: NodeInputPort
s@NodeInputPort' {} Maybe Text
a -> NodeInputPort
s {$sel:description:NodeInputPort' :: Maybe Text
description = Maybe Text
a} :: NodeInputPort)

instance Core.FromJSON NodeInputPort where
  parseJSON :: Value -> Parser NodeInputPort
parseJSON =
    String
-> (Object -> Parser NodeInputPort)
-> Value
-> Parser NodeInputPort
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodeInputPort"
      ( \Object
x ->
          Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe PortType
-> Maybe Text
-> NodeInputPort
NodeInputPort'
            (Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe PortType
 -> Maybe Text
 -> NodeInputPort)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe PortType -> Maybe Text -> NodeInputPort)
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
"MaxConnections")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe PortType -> Maybe Text -> NodeInputPort)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe PortType -> Maybe Text -> NodeInputPort)
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
"Name")
            Parser
  (Maybe Text -> Maybe PortType -> Maybe Text -> NodeInputPort)
-> Parser (Maybe Text)
-> Parser (Maybe PortType -> Maybe Text -> NodeInputPort)
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
"DefaultValue")
            Parser (Maybe PortType -> Maybe Text -> NodeInputPort)
-> Parser (Maybe PortType) -> Parser (Maybe Text -> NodeInputPort)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PortType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser (Maybe Text -> NodeInputPort)
-> Parser (Maybe Text) -> Parser NodeInputPort
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
"Description")
      )

instance Prelude.Hashable NodeInputPort

instance Prelude.NFData NodeInputPort