{-# 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.Kafka.Types.NodeInfo
-- 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.Kafka.Types.NodeInfo where

import qualified Amazonka.Core as Core
import Amazonka.Kafka.Types.BrokerNodeInfo
import Amazonka.Kafka.Types.NodeType
import Amazonka.Kafka.Types.ZookeeperNodeInfo
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The node information object.
--
-- /See:/ 'newNodeInfo' smart constructor.
data NodeInfo = NodeInfo'
  { -- | The start time.
    NodeInfo -> Maybe Text
addedToClusterTime :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the node.
    NodeInfo -> Maybe Text
nodeARN :: Prelude.Maybe Prelude.Text,
    -- | The ZookeeperNodeInfo.
    NodeInfo -> Maybe ZookeeperNodeInfo
zookeeperNodeInfo :: Prelude.Maybe ZookeeperNodeInfo,
    -- | The instance type.
    NodeInfo -> Maybe Text
instanceType :: Prelude.Maybe Prelude.Text,
    -- | The broker node info.
    NodeInfo -> Maybe BrokerNodeInfo
brokerNodeInfo :: Prelude.Maybe BrokerNodeInfo,
    -- | The node type.
    NodeInfo -> Maybe NodeType
nodeType :: Prelude.Maybe NodeType
  }
  deriving (NodeInfo -> NodeInfo -> Bool
(NodeInfo -> NodeInfo -> Bool)
-> (NodeInfo -> NodeInfo -> Bool) -> Eq NodeInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeInfo -> NodeInfo -> Bool
$c/= :: NodeInfo -> NodeInfo -> Bool
== :: NodeInfo -> NodeInfo -> Bool
$c== :: NodeInfo -> NodeInfo -> Bool
Prelude.Eq, ReadPrec [NodeInfo]
ReadPrec NodeInfo
Int -> ReadS NodeInfo
ReadS [NodeInfo]
(Int -> ReadS NodeInfo)
-> ReadS [NodeInfo]
-> ReadPrec NodeInfo
-> ReadPrec [NodeInfo]
-> Read NodeInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeInfo]
$creadListPrec :: ReadPrec [NodeInfo]
readPrec :: ReadPrec NodeInfo
$creadPrec :: ReadPrec NodeInfo
readList :: ReadS [NodeInfo]
$creadList :: ReadS [NodeInfo]
readsPrec :: Int -> ReadS NodeInfo
$creadsPrec :: Int -> ReadS NodeInfo
Prelude.Read, Int -> NodeInfo -> ShowS
[NodeInfo] -> ShowS
NodeInfo -> String
(Int -> NodeInfo -> ShowS)
-> (NodeInfo -> String) -> ([NodeInfo] -> ShowS) -> Show NodeInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeInfo] -> ShowS
$cshowList :: [NodeInfo] -> ShowS
show :: NodeInfo -> String
$cshow :: NodeInfo -> String
showsPrec :: Int -> NodeInfo -> ShowS
$cshowsPrec :: Int -> NodeInfo -> ShowS
Prelude.Show, (forall x. NodeInfo -> Rep NodeInfo x)
-> (forall x. Rep NodeInfo x -> NodeInfo) -> Generic NodeInfo
forall x. Rep NodeInfo x -> NodeInfo
forall x. NodeInfo -> Rep NodeInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeInfo x -> NodeInfo
$cfrom :: forall x. NodeInfo -> Rep NodeInfo x
Prelude.Generic)

-- |
-- Create a value of 'NodeInfo' 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:
--
-- 'addedToClusterTime', 'nodeInfo_addedToClusterTime' - The start time.
--
-- 'nodeARN', 'nodeInfo_nodeARN' - The Amazon Resource Name (ARN) of the node.
--
-- 'zookeeperNodeInfo', 'nodeInfo_zookeeperNodeInfo' - The ZookeeperNodeInfo.
--
-- 'instanceType', 'nodeInfo_instanceType' - The instance type.
--
-- 'brokerNodeInfo', 'nodeInfo_brokerNodeInfo' - The broker node info.
--
-- 'nodeType', 'nodeInfo_nodeType' - The node type.
newNodeInfo ::
  NodeInfo
newNodeInfo :: NodeInfo
newNodeInfo =
  NodeInfo' :: Maybe Text
-> Maybe Text
-> Maybe ZookeeperNodeInfo
-> Maybe Text
-> Maybe BrokerNodeInfo
-> Maybe NodeType
-> NodeInfo
NodeInfo'
    { $sel:addedToClusterTime:NodeInfo' :: Maybe Text
addedToClusterTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeARN:NodeInfo' :: Maybe Text
nodeARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:zookeeperNodeInfo:NodeInfo' :: Maybe ZookeeperNodeInfo
zookeeperNodeInfo = Maybe ZookeeperNodeInfo
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:NodeInfo' :: Maybe Text
instanceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:brokerNodeInfo:NodeInfo' :: Maybe BrokerNodeInfo
brokerNodeInfo = Maybe BrokerNodeInfo
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeType:NodeInfo' :: Maybe NodeType
nodeType = Maybe NodeType
forall a. Maybe a
Prelude.Nothing
    }

-- | The start time.
nodeInfo_addedToClusterTime :: Lens.Lens' NodeInfo (Prelude.Maybe Prelude.Text)
nodeInfo_addedToClusterTime :: (Maybe Text -> f (Maybe Text)) -> NodeInfo -> f NodeInfo
nodeInfo_addedToClusterTime = (NodeInfo -> Maybe Text)
-> (NodeInfo -> Maybe Text -> NodeInfo)
-> Lens NodeInfo NodeInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInfo' {Maybe Text
addedToClusterTime :: Maybe Text
$sel:addedToClusterTime:NodeInfo' :: NodeInfo -> Maybe Text
addedToClusterTime} -> Maybe Text
addedToClusterTime) (\s :: NodeInfo
s@NodeInfo' {} Maybe Text
a -> NodeInfo
s {$sel:addedToClusterTime:NodeInfo' :: Maybe Text
addedToClusterTime = Maybe Text
a} :: NodeInfo)

-- | The Amazon Resource Name (ARN) of the node.
nodeInfo_nodeARN :: Lens.Lens' NodeInfo (Prelude.Maybe Prelude.Text)
nodeInfo_nodeARN :: (Maybe Text -> f (Maybe Text)) -> NodeInfo -> f NodeInfo
nodeInfo_nodeARN = (NodeInfo -> Maybe Text)
-> (NodeInfo -> Maybe Text -> NodeInfo)
-> Lens NodeInfo NodeInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInfo' {Maybe Text
nodeARN :: Maybe Text
$sel:nodeARN:NodeInfo' :: NodeInfo -> Maybe Text
nodeARN} -> Maybe Text
nodeARN) (\s :: NodeInfo
s@NodeInfo' {} Maybe Text
a -> NodeInfo
s {$sel:nodeARN:NodeInfo' :: Maybe Text
nodeARN = Maybe Text
a} :: NodeInfo)

-- | The ZookeeperNodeInfo.
nodeInfo_zookeeperNodeInfo :: Lens.Lens' NodeInfo (Prelude.Maybe ZookeeperNodeInfo)
nodeInfo_zookeeperNodeInfo :: (Maybe ZookeeperNodeInfo -> f (Maybe ZookeeperNodeInfo))
-> NodeInfo -> f NodeInfo
nodeInfo_zookeeperNodeInfo = (NodeInfo -> Maybe ZookeeperNodeInfo)
-> (NodeInfo -> Maybe ZookeeperNodeInfo -> NodeInfo)
-> Lens
     NodeInfo
     NodeInfo
     (Maybe ZookeeperNodeInfo)
     (Maybe ZookeeperNodeInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInfo' {Maybe ZookeeperNodeInfo
zookeeperNodeInfo :: Maybe ZookeeperNodeInfo
$sel:zookeeperNodeInfo:NodeInfo' :: NodeInfo -> Maybe ZookeeperNodeInfo
zookeeperNodeInfo} -> Maybe ZookeeperNodeInfo
zookeeperNodeInfo) (\s :: NodeInfo
s@NodeInfo' {} Maybe ZookeeperNodeInfo
a -> NodeInfo
s {$sel:zookeeperNodeInfo:NodeInfo' :: Maybe ZookeeperNodeInfo
zookeeperNodeInfo = Maybe ZookeeperNodeInfo
a} :: NodeInfo)

-- | The instance type.
nodeInfo_instanceType :: Lens.Lens' NodeInfo (Prelude.Maybe Prelude.Text)
nodeInfo_instanceType :: (Maybe Text -> f (Maybe Text)) -> NodeInfo -> f NodeInfo
nodeInfo_instanceType = (NodeInfo -> Maybe Text)
-> (NodeInfo -> Maybe Text -> NodeInfo)
-> Lens NodeInfo NodeInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInfo' {Maybe Text
instanceType :: Maybe Text
$sel:instanceType:NodeInfo' :: NodeInfo -> Maybe Text
instanceType} -> Maybe Text
instanceType) (\s :: NodeInfo
s@NodeInfo' {} Maybe Text
a -> NodeInfo
s {$sel:instanceType:NodeInfo' :: Maybe Text
instanceType = Maybe Text
a} :: NodeInfo)

-- | The broker node info.
nodeInfo_brokerNodeInfo :: Lens.Lens' NodeInfo (Prelude.Maybe BrokerNodeInfo)
nodeInfo_brokerNodeInfo :: (Maybe BrokerNodeInfo -> f (Maybe BrokerNodeInfo))
-> NodeInfo -> f NodeInfo
nodeInfo_brokerNodeInfo = (NodeInfo -> Maybe BrokerNodeInfo)
-> (NodeInfo -> Maybe BrokerNodeInfo -> NodeInfo)
-> Lens
     NodeInfo NodeInfo (Maybe BrokerNodeInfo) (Maybe BrokerNodeInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInfo' {Maybe BrokerNodeInfo
brokerNodeInfo :: Maybe BrokerNodeInfo
$sel:brokerNodeInfo:NodeInfo' :: NodeInfo -> Maybe BrokerNodeInfo
brokerNodeInfo} -> Maybe BrokerNodeInfo
brokerNodeInfo) (\s :: NodeInfo
s@NodeInfo' {} Maybe BrokerNodeInfo
a -> NodeInfo
s {$sel:brokerNodeInfo:NodeInfo' :: Maybe BrokerNodeInfo
brokerNodeInfo = Maybe BrokerNodeInfo
a} :: NodeInfo)

-- | The node type.
nodeInfo_nodeType :: Lens.Lens' NodeInfo (Prelude.Maybe NodeType)
nodeInfo_nodeType :: (Maybe NodeType -> f (Maybe NodeType)) -> NodeInfo -> f NodeInfo
nodeInfo_nodeType = (NodeInfo -> Maybe NodeType)
-> (NodeInfo -> Maybe NodeType -> NodeInfo)
-> Lens NodeInfo NodeInfo (Maybe NodeType) (Maybe NodeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInfo' {Maybe NodeType
nodeType :: Maybe NodeType
$sel:nodeType:NodeInfo' :: NodeInfo -> Maybe NodeType
nodeType} -> Maybe NodeType
nodeType) (\s :: NodeInfo
s@NodeInfo' {} Maybe NodeType
a -> NodeInfo
s {$sel:nodeType:NodeInfo' :: Maybe NodeType
nodeType = Maybe NodeType
a} :: NodeInfo)

instance Core.FromJSON NodeInfo where
  parseJSON :: Value -> Parser NodeInfo
parseJSON =
    String -> (Object -> Parser NodeInfo) -> Value -> Parser NodeInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodeInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ZookeeperNodeInfo
-> Maybe Text
-> Maybe BrokerNodeInfo
-> Maybe NodeType
-> NodeInfo
NodeInfo'
            (Maybe Text
 -> Maybe Text
 -> Maybe ZookeeperNodeInfo
 -> Maybe Text
 -> Maybe BrokerNodeInfo
 -> Maybe NodeType
 -> NodeInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ZookeeperNodeInfo
      -> Maybe Text
      -> Maybe BrokerNodeInfo
      -> Maybe NodeType
      -> NodeInfo)
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
"addedToClusterTime")
            Parser
  (Maybe Text
   -> Maybe ZookeeperNodeInfo
   -> Maybe Text
   -> Maybe BrokerNodeInfo
   -> Maybe NodeType
   -> NodeInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe ZookeeperNodeInfo
      -> Maybe Text
      -> Maybe BrokerNodeInfo
      -> Maybe NodeType
      -> NodeInfo)
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
"nodeARN")
            Parser
  (Maybe ZookeeperNodeInfo
   -> Maybe Text
   -> Maybe BrokerNodeInfo
   -> Maybe NodeType
   -> NodeInfo)
-> Parser (Maybe ZookeeperNodeInfo)
-> Parser
     (Maybe Text -> Maybe BrokerNodeInfo -> Maybe NodeType -> NodeInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ZookeeperNodeInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"zookeeperNodeInfo")
            Parser
  (Maybe Text -> Maybe BrokerNodeInfo -> Maybe NodeType -> NodeInfo)
-> Parser (Maybe Text)
-> Parser (Maybe BrokerNodeInfo -> Maybe NodeType -> NodeInfo)
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
"instanceType")
            Parser (Maybe BrokerNodeInfo -> Maybe NodeType -> NodeInfo)
-> Parser (Maybe BrokerNodeInfo)
-> Parser (Maybe NodeType -> NodeInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BrokerNodeInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"brokerNodeInfo")
            Parser (Maybe NodeType -> NodeInfo)
-> Parser (Maybe NodeType) -> Parser NodeInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NodeType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"nodeType")
      )

instance Prelude.Hashable NodeInfo

instance Prelude.NFData NodeInfo