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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types.NodeInputPort
import Amazonka.Panorama.Types.NodeOutputPort
import qualified Amazonka.Prelude as Prelude

-- | A node interface.
--
-- /See:/ 'newNodeInterface' smart constructor.
data NodeInterface = NodeInterface'
  { -- | The node interface\'s inputs.
    NodeInterface -> [NodeInputPort]
inputs :: [NodeInputPort],
    -- | The node interface\'s outputs.
    NodeInterface -> [NodeOutputPort]
outputs :: [NodeOutputPort]
  }
  deriving (NodeInterface -> NodeInterface -> Bool
(NodeInterface -> NodeInterface -> Bool)
-> (NodeInterface -> NodeInterface -> Bool) -> Eq NodeInterface
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeInterface -> NodeInterface -> Bool
$c/= :: NodeInterface -> NodeInterface -> Bool
== :: NodeInterface -> NodeInterface -> Bool
$c== :: NodeInterface -> NodeInterface -> Bool
Prelude.Eq, ReadPrec [NodeInterface]
ReadPrec NodeInterface
Int -> ReadS NodeInterface
ReadS [NodeInterface]
(Int -> ReadS NodeInterface)
-> ReadS [NodeInterface]
-> ReadPrec NodeInterface
-> ReadPrec [NodeInterface]
-> Read NodeInterface
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeInterface]
$creadListPrec :: ReadPrec [NodeInterface]
readPrec :: ReadPrec NodeInterface
$creadPrec :: ReadPrec NodeInterface
readList :: ReadS [NodeInterface]
$creadList :: ReadS [NodeInterface]
readsPrec :: Int -> ReadS NodeInterface
$creadsPrec :: Int -> ReadS NodeInterface
Prelude.Read, Int -> NodeInterface -> ShowS
[NodeInterface] -> ShowS
NodeInterface -> String
(Int -> NodeInterface -> ShowS)
-> (NodeInterface -> String)
-> ([NodeInterface] -> ShowS)
-> Show NodeInterface
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeInterface] -> ShowS
$cshowList :: [NodeInterface] -> ShowS
show :: NodeInterface -> String
$cshow :: NodeInterface -> String
showsPrec :: Int -> NodeInterface -> ShowS
$cshowsPrec :: Int -> NodeInterface -> ShowS
Prelude.Show, (forall x. NodeInterface -> Rep NodeInterface x)
-> (forall x. Rep NodeInterface x -> NodeInterface)
-> Generic NodeInterface
forall x. Rep NodeInterface x -> NodeInterface
forall x. NodeInterface -> Rep NodeInterface x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeInterface x -> NodeInterface
$cfrom :: forall x. NodeInterface -> Rep NodeInterface x
Prelude.Generic)

-- |
-- Create a value of 'NodeInterface' 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:
--
-- 'inputs', 'nodeInterface_inputs' - The node interface\'s inputs.
--
-- 'outputs', 'nodeInterface_outputs' - The node interface\'s outputs.
newNodeInterface ::
  NodeInterface
newNodeInterface :: NodeInterface
newNodeInterface =
  NodeInterface' :: [NodeInputPort] -> [NodeOutputPort] -> NodeInterface
NodeInterface'
    { $sel:inputs:NodeInterface' :: [NodeInputPort]
inputs = [NodeInputPort]
forall a. Monoid a => a
Prelude.mempty,
      $sel:outputs:NodeInterface' :: [NodeOutputPort]
outputs = [NodeOutputPort]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The node interface\'s inputs.
nodeInterface_inputs :: Lens.Lens' NodeInterface [NodeInputPort]
nodeInterface_inputs :: ([NodeInputPort] -> f [NodeInputPort])
-> NodeInterface -> f NodeInterface
nodeInterface_inputs = (NodeInterface -> [NodeInputPort])
-> (NodeInterface -> [NodeInputPort] -> NodeInterface)
-> Lens NodeInterface NodeInterface [NodeInputPort] [NodeInputPort]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInterface' {[NodeInputPort]
inputs :: [NodeInputPort]
$sel:inputs:NodeInterface' :: NodeInterface -> [NodeInputPort]
inputs} -> [NodeInputPort]
inputs) (\s :: NodeInterface
s@NodeInterface' {} [NodeInputPort]
a -> NodeInterface
s {$sel:inputs:NodeInterface' :: [NodeInputPort]
inputs = [NodeInputPort]
a} :: NodeInterface) (([NodeInputPort] -> f [NodeInputPort])
 -> NodeInterface -> f NodeInterface)
-> (([NodeInputPort] -> f [NodeInputPort])
    -> [NodeInputPort] -> f [NodeInputPort])
-> ([NodeInputPort] -> f [NodeInputPort])
-> NodeInterface
-> f NodeInterface
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([NodeInputPort] -> f [NodeInputPort])
-> [NodeInputPort] -> f [NodeInputPort]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The node interface\'s outputs.
nodeInterface_outputs :: Lens.Lens' NodeInterface [NodeOutputPort]
nodeInterface_outputs :: ([NodeOutputPort] -> f [NodeOutputPort])
-> NodeInterface -> f NodeInterface
nodeInterface_outputs = (NodeInterface -> [NodeOutputPort])
-> (NodeInterface -> [NodeOutputPort] -> NodeInterface)
-> Lens
     NodeInterface NodeInterface [NodeOutputPort] [NodeOutputPort]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInterface' {[NodeOutputPort]
outputs :: [NodeOutputPort]
$sel:outputs:NodeInterface' :: NodeInterface -> [NodeOutputPort]
outputs} -> [NodeOutputPort]
outputs) (\s :: NodeInterface
s@NodeInterface' {} [NodeOutputPort]
a -> NodeInterface
s {$sel:outputs:NodeInterface' :: [NodeOutputPort]
outputs = [NodeOutputPort]
a} :: NodeInterface) (([NodeOutputPort] -> f [NodeOutputPort])
 -> NodeInterface -> f NodeInterface)
-> (([NodeOutputPort] -> f [NodeOutputPort])
    -> [NodeOutputPort] -> f [NodeOutputPort])
-> ([NodeOutputPort] -> f [NodeOutputPort])
-> NodeInterface
-> f NodeInterface
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([NodeOutputPort] -> f [NodeOutputPort])
-> [NodeOutputPort] -> f [NodeOutputPort]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON NodeInterface where
  parseJSON :: Value -> Parser NodeInterface
parseJSON =
    String
-> (Object -> Parser NodeInterface)
-> Value
-> Parser NodeInterface
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodeInterface"
      ( \Object
x ->
          [NodeInputPort] -> [NodeOutputPort] -> NodeInterface
NodeInterface'
            ([NodeInputPort] -> [NodeOutputPort] -> NodeInterface)
-> Parser [NodeInputPort]
-> Parser ([NodeOutputPort] -> NodeInterface)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe [NodeInputPort])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Inputs" Parser (Maybe [NodeInputPort])
-> [NodeInputPort] -> Parser [NodeInputPort]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [NodeInputPort]
forall a. Monoid a => a
Prelude.mempty)
            Parser ([NodeOutputPort] -> NodeInterface)
-> Parser [NodeOutputPort] -> Parser NodeInterface
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [NodeOutputPort])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Outputs" Parser (Maybe [NodeOutputPort])
-> [NodeOutputPort] -> Parser [NodeOutputPort]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [NodeOutputPort]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable NodeInterface

instance Prelude.NFData NodeInterface