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

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

-- | A node instance.
--
-- /See:/ 'newNodeInstance' smart constructor.
data NodeInstance = NodeInstance'
  { -- | The instance\'s package name.
    NodeInstance -> Maybe Text
packageName :: Prelude.Maybe Prelude.Text,
    -- | The instance\'s package version.
    NodeInstance -> Maybe Text
packageVersion :: Prelude.Maybe Prelude.Text,
    -- | The instance\'s package patch version.
    NodeInstance -> Maybe Text
packagePatchVersion :: Prelude.Maybe Prelude.Text,
    -- | The instance\'s name.
    NodeInstance -> Maybe Text
nodeName :: Prelude.Maybe Prelude.Text,
    -- | The node\'s ID.
    NodeInstance -> Maybe Text
nodeId :: Prelude.Maybe Prelude.Text,
    -- | The instance\'s ID.
    NodeInstance -> Text
nodeInstanceId :: Prelude.Text,
    -- | The instance\'s current status.
    NodeInstance -> NodeInstanceStatus
currentStatus :: NodeInstanceStatus
  }
  deriving (NodeInstance -> NodeInstance -> Bool
(NodeInstance -> NodeInstance -> Bool)
-> (NodeInstance -> NodeInstance -> Bool) -> Eq NodeInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeInstance -> NodeInstance -> Bool
$c/= :: NodeInstance -> NodeInstance -> Bool
== :: NodeInstance -> NodeInstance -> Bool
$c== :: NodeInstance -> NodeInstance -> Bool
Prelude.Eq, ReadPrec [NodeInstance]
ReadPrec NodeInstance
Int -> ReadS NodeInstance
ReadS [NodeInstance]
(Int -> ReadS NodeInstance)
-> ReadS [NodeInstance]
-> ReadPrec NodeInstance
-> ReadPrec [NodeInstance]
-> Read NodeInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeInstance]
$creadListPrec :: ReadPrec [NodeInstance]
readPrec :: ReadPrec NodeInstance
$creadPrec :: ReadPrec NodeInstance
readList :: ReadS [NodeInstance]
$creadList :: ReadS [NodeInstance]
readsPrec :: Int -> ReadS NodeInstance
$creadsPrec :: Int -> ReadS NodeInstance
Prelude.Read, Int -> NodeInstance -> ShowS
[NodeInstance] -> ShowS
NodeInstance -> String
(Int -> NodeInstance -> ShowS)
-> (NodeInstance -> String)
-> ([NodeInstance] -> ShowS)
-> Show NodeInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeInstance] -> ShowS
$cshowList :: [NodeInstance] -> ShowS
show :: NodeInstance -> String
$cshow :: NodeInstance -> String
showsPrec :: Int -> NodeInstance -> ShowS
$cshowsPrec :: Int -> NodeInstance -> ShowS
Prelude.Show, (forall x. NodeInstance -> Rep NodeInstance x)
-> (forall x. Rep NodeInstance x -> NodeInstance)
-> Generic NodeInstance
forall x. Rep NodeInstance x -> NodeInstance
forall x. NodeInstance -> Rep NodeInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeInstance x -> NodeInstance
$cfrom :: forall x. NodeInstance -> Rep NodeInstance x
Prelude.Generic)

-- |
-- Create a value of 'NodeInstance' 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:
--
-- 'packageName', 'nodeInstance_packageName' - The instance\'s package name.
--
-- 'packageVersion', 'nodeInstance_packageVersion' - The instance\'s package version.
--
-- 'packagePatchVersion', 'nodeInstance_packagePatchVersion' - The instance\'s package patch version.
--
-- 'nodeName', 'nodeInstance_nodeName' - The instance\'s name.
--
-- 'nodeId', 'nodeInstance_nodeId' - The node\'s ID.
--
-- 'nodeInstanceId', 'nodeInstance_nodeInstanceId' - The instance\'s ID.
--
-- 'currentStatus', 'nodeInstance_currentStatus' - The instance\'s current status.
newNodeInstance ::
  -- | 'nodeInstanceId'
  Prelude.Text ->
  -- | 'currentStatus'
  NodeInstanceStatus ->
  NodeInstance
newNodeInstance :: Text -> NodeInstanceStatus -> NodeInstance
newNodeInstance Text
pNodeInstanceId_ NodeInstanceStatus
pCurrentStatus_ =
  NodeInstance' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> NodeInstanceStatus
-> NodeInstance
NodeInstance'
    { $sel:packageName:NodeInstance' :: Maybe Text
packageName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:packageVersion:NodeInstance' :: Maybe Text
packageVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:packagePatchVersion:NodeInstance' :: Maybe Text
packagePatchVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeName:NodeInstance' :: Maybe Text
nodeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeId:NodeInstance' :: Maybe Text
nodeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeInstanceId:NodeInstance' :: Text
nodeInstanceId = Text
pNodeInstanceId_,
      $sel:currentStatus:NodeInstance' :: NodeInstanceStatus
currentStatus = NodeInstanceStatus
pCurrentStatus_
    }

-- | The instance\'s package name.
nodeInstance_packageName :: Lens.Lens' NodeInstance (Prelude.Maybe Prelude.Text)
nodeInstance_packageName :: (Maybe Text -> f (Maybe Text)) -> NodeInstance -> f NodeInstance
nodeInstance_packageName = (NodeInstance -> Maybe Text)
-> (NodeInstance -> Maybe Text -> NodeInstance)
-> Lens NodeInstance NodeInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInstance' {Maybe Text
packageName :: Maybe Text
$sel:packageName:NodeInstance' :: NodeInstance -> Maybe Text
packageName} -> Maybe Text
packageName) (\s :: NodeInstance
s@NodeInstance' {} Maybe Text
a -> NodeInstance
s {$sel:packageName:NodeInstance' :: Maybe Text
packageName = Maybe Text
a} :: NodeInstance)

-- | The instance\'s package version.
nodeInstance_packageVersion :: Lens.Lens' NodeInstance (Prelude.Maybe Prelude.Text)
nodeInstance_packageVersion :: (Maybe Text -> f (Maybe Text)) -> NodeInstance -> f NodeInstance
nodeInstance_packageVersion = (NodeInstance -> Maybe Text)
-> (NodeInstance -> Maybe Text -> NodeInstance)
-> Lens NodeInstance NodeInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInstance' {Maybe Text
packageVersion :: Maybe Text
$sel:packageVersion:NodeInstance' :: NodeInstance -> Maybe Text
packageVersion} -> Maybe Text
packageVersion) (\s :: NodeInstance
s@NodeInstance' {} Maybe Text
a -> NodeInstance
s {$sel:packageVersion:NodeInstance' :: Maybe Text
packageVersion = Maybe Text
a} :: NodeInstance)

-- | The instance\'s package patch version.
nodeInstance_packagePatchVersion :: Lens.Lens' NodeInstance (Prelude.Maybe Prelude.Text)
nodeInstance_packagePatchVersion :: (Maybe Text -> f (Maybe Text)) -> NodeInstance -> f NodeInstance
nodeInstance_packagePatchVersion = (NodeInstance -> Maybe Text)
-> (NodeInstance -> Maybe Text -> NodeInstance)
-> Lens NodeInstance NodeInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInstance' {Maybe Text
packagePatchVersion :: Maybe Text
$sel:packagePatchVersion:NodeInstance' :: NodeInstance -> Maybe Text
packagePatchVersion} -> Maybe Text
packagePatchVersion) (\s :: NodeInstance
s@NodeInstance' {} Maybe Text
a -> NodeInstance
s {$sel:packagePatchVersion:NodeInstance' :: Maybe Text
packagePatchVersion = Maybe Text
a} :: NodeInstance)

-- | The instance\'s name.
nodeInstance_nodeName :: Lens.Lens' NodeInstance (Prelude.Maybe Prelude.Text)
nodeInstance_nodeName :: (Maybe Text -> f (Maybe Text)) -> NodeInstance -> f NodeInstance
nodeInstance_nodeName = (NodeInstance -> Maybe Text)
-> (NodeInstance -> Maybe Text -> NodeInstance)
-> Lens NodeInstance NodeInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInstance' {Maybe Text
nodeName :: Maybe Text
$sel:nodeName:NodeInstance' :: NodeInstance -> Maybe Text
nodeName} -> Maybe Text
nodeName) (\s :: NodeInstance
s@NodeInstance' {} Maybe Text
a -> NodeInstance
s {$sel:nodeName:NodeInstance' :: Maybe Text
nodeName = Maybe Text
a} :: NodeInstance)

-- | The node\'s ID.
nodeInstance_nodeId :: Lens.Lens' NodeInstance (Prelude.Maybe Prelude.Text)
nodeInstance_nodeId :: (Maybe Text -> f (Maybe Text)) -> NodeInstance -> f NodeInstance
nodeInstance_nodeId = (NodeInstance -> Maybe Text)
-> (NodeInstance -> Maybe Text -> NodeInstance)
-> Lens NodeInstance NodeInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInstance' {Maybe Text
nodeId :: Maybe Text
$sel:nodeId:NodeInstance' :: NodeInstance -> Maybe Text
nodeId} -> Maybe Text
nodeId) (\s :: NodeInstance
s@NodeInstance' {} Maybe Text
a -> NodeInstance
s {$sel:nodeId:NodeInstance' :: Maybe Text
nodeId = Maybe Text
a} :: NodeInstance)

-- | The instance\'s ID.
nodeInstance_nodeInstanceId :: Lens.Lens' NodeInstance Prelude.Text
nodeInstance_nodeInstanceId :: (Text -> f Text) -> NodeInstance -> f NodeInstance
nodeInstance_nodeInstanceId = (NodeInstance -> Text)
-> (NodeInstance -> Text -> NodeInstance)
-> Lens NodeInstance NodeInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInstance' {Text
nodeInstanceId :: Text
$sel:nodeInstanceId:NodeInstance' :: NodeInstance -> Text
nodeInstanceId} -> Text
nodeInstanceId) (\s :: NodeInstance
s@NodeInstance' {} Text
a -> NodeInstance
s {$sel:nodeInstanceId:NodeInstance' :: Text
nodeInstanceId = Text
a} :: NodeInstance)

-- | The instance\'s current status.
nodeInstance_currentStatus :: Lens.Lens' NodeInstance NodeInstanceStatus
nodeInstance_currentStatus :: (NodeInstanceStatus -> f NodeInstanceStatus)
-> NodeInstance -> f NodeInstance
nodeInstance_currentStatus = (NodeInstance -> NodeInstanceStatus)
-> (NodeInstance -> NodeInstanceStatus -> NodeInstance)
-> Lens
     NodeInstance NodeInstance NodeInstanceStatus NodeInstanceStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeInstance' {NodeInstanceStatus
currentStatus :: NodeInstanceStatus
$sel:currentStatus:NodeInstance' :: NodeInstance -> NodeInstanceStatus
currentStatus} -> NodeInstanceStatus
currentStatus) (\s :: NodeInstance
s@NodeInstance' {} NodeInstanceStatus
a -> NodeInstance
s {$sel:currentStatus:NodeInstance' :: NodeInstanceStatus
currentStatus = NodeInstanceStatus
a} :: NodeInstance)

instance Core.FromJSON NodeInstance where
  parseJSON :: Value -> Parser NodeInstance
parseJSON =
    String
-> (Object -> Parser NodeInstance) -> Value -> Parser NodeInstance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodeInstance"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> NodeInstanceStatus
-> NodeInstance
NodeInstance'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> NodeInstanceStatus
 -> NodeInstance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> NodeInstanceStatus
      -> NodeInstance)
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
"PackageName")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> NodeInstanceStatus
   -> NodeInstance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> NodeInstanceStatus
      -> NodeInstance)
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
"PackageVersion")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> NodeInstanceStatus
   -> NodeInstance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Text -> NodeInstanceStatus -> NodeInstance)
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
"PackagePatchVersion")
            Parser
  (Maybe Text
   -> Maybe Text -> Text -> NodeInstanceStatus -> NodeInstance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Text -> NodeInstanceStatus -> NodeInstance)
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
"NodeName")
            Parser (Maybe Text -> Text -> NodeInstanceStatus -> NodeInstance)
-> Parser (Maybe Text)
-> Parser (Text -> NodeInstanceStatus -> NodeInstance)
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
"NodeId")
            Parser (Text -> NodeInstanceStatus -> NodeInstance)
-> Parser Text -> Parser (NodeInstanceStatus -> NodeInstance)
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
"NodeInstanceId")
            Parser (NodeInstanceStatus -> NodeInstance)
-> Parser NodeInstanceStatus -> Parser NodeInstance
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser NodeInstanceStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CurrentStatus")
      )

instance Prelude.Hashable NodeInstance

instance Prelude.NFData NodeInstance