{-# 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.NodeOutputPort
-- 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.NodeOutputPort 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 output port.
--
-- /See:/ 'newNodeOutputPort' smart constructor.
data NodeOutputPort = NodeOutputPort'
  { -- | The output port\'s name.
    NodeOutputPort -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The output port\'s type.
    NodeOutputPort -> Maybe PortType
type' :: Prelude.Maybe PortType,
    -- | The output port\'s description.
    NodeOutputPort -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (NodeOutputPort -> NodeOutputPort -> Bool
(NodeOutputPort -> NodeOutputPort -> Bool)
-> (NodeOutputPort -> NodeOutputPort -> Bool) -> Eq NodeOutputPort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeOutputPort -> NodeOutputPort -> Bool
$c/= :: NodeOutputPort -> NodeOutputPort -> Bool
== :: NodeOutputPort -> NodeOutputPort -> Bool
$c== :: NodeOutputPort -> NodeOutputPort -> Bool
Prelude.Eq, ReadPrec [NodeOutputPort]
ReadPrec NodeOutputPort
Int -> ReadS NodeOutputPort
ReadS [NodeOutputPort]
(Int -> ReadS NodeOutputPort)
-> ReadS [NodeOutputPort]
-> ReadPrec NodeOutputPort
-> ReadPrec [NodeOutputPort]
-> Read NodeOutputPort
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeOutputPort]
$creadListPrec :: ReadPrec [NodeOutputPort]
readPrec :: ReadPrec NodeOutputPort
$creadPrec :: ReadPrec NodeOutputPort
readList :: ReadS [NodeOutputPort]
$creadList :: ReadS [NodeOutputPort]
readsPrec :: Int -> ReadS NodeOutputPort
$creadsPrec :: Int -> ReadS NodeOutputPort
Prelude.Read, Int -> NodeOutputPort -> ShowS
[NodeOutputPort] -> ShowS
NodeOutputPort -> String
(Int -> NodeOutputPort -> ShowS)
-> (NodeOutputPort -> String)
-> ([NodeOutputPort] -> ShowS)
-> Show NodeOutputPort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeOutputPort] -> ShowS
$cshowList :: [NodeOutputPort] -> ShowS
show :: NodeOutputPort -> String
$cshow :: NodeOutputPort -> String
showsPrec :: Int -> NodeOutputPort -> ShowS
$cshowsPrec :: Int -> NodeOutputPort -> ShowS
Prelude.Show, (forall x. NodeOutputPort -> Rep NodeOutputPort x)
-> (forall x. Rep NodeOutputPort x -> NodeOutputPort)
-> Generic NodeOutputPort
forall x. Rep NodeOutputPort x -> NodeOutputPort
forall x. NodeOutputPort -> Rep NodeOutputPort x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeOutputPort x -> NodeOutputPort
$cfrom :: forall x. NodeOutputPort -> Rep NodeOutputPort x
Prelude.Generic)

-- |
-- Create a value of 'NodeOutputPort' 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:
--
-- 'name', 'nodeOutputPort_name' - The output port\'s name.
--
-- 'type'', 'nodeOutputPort_type' - The output port\'s type.
--
-- 'description', 'nodeOutputPort_description' - The output port\'s description.
newNodeOutputPort ::
  NodeOutputPort
newNodeOutputPort :: NodeOutputPort
newNodeOutputPort =
  NodeOutputPort' :: Maybe Text -> Maybe PortType -> Maybe Text -> NodeOutputPort
NodeOutputPort'
    { $sel:name:NodeOutputPort' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':NodeOutputPort' :: Maybe PortType
type' = Maybe PortType
forall a. Maybe a
Prelude.Nothing,
      $sel:description:NodeOutputPort' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

instance Core.FromJSON NodeOutputPort where
  parseJSON :: Value -> Parser NodeOutputPort
parseJSON =
    String
-> (Object -> Parser NodeOutputPort)
-> Value
-> Parser NodeOutputPort
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodeOutputPort"
      ( \Object
x ->
          Maybe Text -> Maybe PortType -> Maybe Text -> NodeOutputPort
NodeOutputPort'
            (Maybe Text -> Maybe PortType -> Maybe Text -> NodeOutputPort)
-> Parser (Maybe Text)
-> Parser (Maybe PortType -> Maybe Text -> NodeOutputPort)
forall (f :: * -> *) a b. Functor 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 PortType -> Maybe Text -> NodeOutputPort)
-> Parser (Maybe PortType) -> Parser (Maybe Text -> NodeOutputPort)
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 -> NodeOutputPort)
-> Parser (Maybe Text) -> Parser NodeOutputPort
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 NodeOutputPort

instance Prelude.NFData NodeOutputPort