{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Panorama.Types.NodeInstance where

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

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

-- | The node\'s ID.
nodeInstance_nodeId :: Lens.Lens' NodeInstance (Prelude.Maybe Prelude.Text)
nodeInstance_nodeId :: Lens' NodeInstance (Maybe Text)
nodeInstance_nodeId = 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 name.
nodeInstance_nodeName :: Lens.Lens' NodeInstance (Prelude.Maybe Prelude.Text)
nodeInstance_nodeName :: Lens' NodeInstance (Maybe Text)
nodeInstance_nodeName = 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 instance\'s package name.
nodeInstance_packageName :: Lens.Lens' NodeInstance (Prelude.Maybe Prelude.Text)
nodeInstance_packageName :: Lens' NodeInstance (Maybe Text)
nodeInstance_packageName = 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 patch version.
nodeInstance_packagePatchVersion :: Lens.Lens' NodeInstance (Prelude.Maybe Prelude.Text)
nodeInstance_packagePatchVersion :: Lens' NodeInstance (Maybe Text)
nodeInstance_packagePatchVersion = 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 package version.
nodeInstance_packageVersion :: Lens.Lens' NodeInstance (Prelude.Maybe Prelude.Text)
nodeInstance_packageVersion :: Lens' NodeInstance (Maybe Text)
nodeInstance_packageVersion = 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 current status.
nodeInstance_currentStatus :: Lens.Lens' NodeInstance NodeInstanceStatus
nodeInstance_currentStatus :: Lens' NodeInstance NodeInstanceStatus
nodeInstance_currentStatus = 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)

-- | The instance\'s ID.
nodeInstance_nodeInstanceId :: Lens.Lens' NodeInstance Prelude.Text
nodeInstance_nodeInstanceId :: Lens' NodeInstance Text
nodeInstance_nodeInstanceId = 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)

instance Data.FromJSON NodeInstance where
  parseJSON :: Value -> Parser NodeInstance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NodeInstance"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> NodeInstanceStatus
-> Text
-> NodeInstance
NodeInstance'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"NodeId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"NodeName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PackageName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PackagePatchVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PackageVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"CurrentStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"NodeInstanceId")
      )

instance Prelude.Hashable NodeInstance where
  hashWithSalt :: Int -> NodeInstance -> Int
hashWithSalt Int
_salt NodeInstance' {Maybe Text
Text
NodeInstanceStatus
nodeInstanceId :: Text
currentStatus :: NodeInstanceStatus
packageVersion :: Maybe Text
packagePatchVersion :: Maybe Text
packageName :: Maybe Text
nodeName :: Maybe Text
nodeId :: Maybe Text
$sel:nodeInstanceId:NodeInstance' :: NodeInstance -> Text
$sel:currentStatus:NodeInstance' :: NodeInstance -> NodeInstanceStatus
$sel:packageVersion:NodeInstance' :: NodeInstance -> Maybe Text
$sel:packagePatchVersion:NodeInstance' :: NodeInstance -> Maybe Text
$sel:packageName:NodeInstance' :: NodeInstance -> Maybe Text
$sel:nodeName:NodeInstance' :: NodeInstance -> Maybe Text
$sel:nodeId:NodeInstance' :: NodeInstance -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nodeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nodeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
packageName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
packagePatchVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
packageVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NodeInstanceStatus
currentStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
nodeInstanceId

instance Prelude.NFData NodeInstance where
  rnf :: NodeInstance -> ()
rnf NodeInstance' {Maybe Text
Text
NodeInstanceStatus
nodeInstanceId :: Text
currentStatus :: NodeInstanceStatus
packageVersion :: Maybe Text
packagePatchVersion :: Maybe Text
packageName :: Maybe Text
nodeName :: Maybe Text
nodeId :: Maybe Text
$sel:nodeInstanceId:NodeInstance' :: NodeInstance -> Text
$sel:currentStatus:NodeInstance' :: NodeInstance -> NodeInstanceStatus
$sel:packageVersion:NodeInstance' :: NodeInstance -> Maybe Text
$sel:packagePatchVersion:NodeInstance' :: NodeInstance -> Maybe Text
$sel:packageName:NodeInstance' :: NodeInstance -> Maybe Text
$sel:nodeName:NodeInstance' :: NodeInstance -> Maybe Text
$sel:nodeId:NodeInstance' :: NodeInstance -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nodeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nodeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
packageName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
packagePatchVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
packageVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NodeInstanceStatus
currentStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
nodeInstanceId