{-# 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.AppMesh.Types.VirtualNodeData
-- 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.AppMesh.Types.VirtualNodeData where

import Amazonka.AppMesh.Types.ResourceMetadata
import Amazonka.AppMesh.Types.VirtualNodeSpec
import Amazonka.AppMesh.Types.VirtualNodeStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that represents a virtual node returned by a describe
-- operation.
--
-- /See:/ 'newVirtualNodeData' smart constructor.
data VirtualNodeData = VirtualNodeData'
  { -- | The name of the service mesh that the virtual node resides in.
    VirtualNodeData -> Text
meshName :: Prelude.Text,
    -- | The associated metadata for the virtual node.
    VirtualNodeData -> ResourceMetadata
metadata :: ResourceMetadata,
    -- | The specifications of the virtual node.
    VirtualNodeData -> VirtualNodeSpec
spec :: VirtualNodeSpec,
    -- | The current status for the virtual node.
    VirtualNodeData -> VirtualNodeStatus
status :: VirtualNodeStatus,
    -- | The name of the virtual node.
    VirtualNodeData -> Text
virtualNodeName :: Prelude.Text
  }
  deriving (VirtualNodeData -> VirtualNodeData -> Bool
(VirtualNodeData -> VirtualNodeData -> Bool)
-> (VirtualNodeData -> VirtualNodeData -> Bool)
-> Eq VirtualNodeData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualNodeData -> VirtualNodeData -> Bool
$c/= :: VirtualNodeData -> VirtualNodeData -> Bool
== :: VirtualNodeData -> VirtualNodeData -> Bool
$c== :: VirtualNodeData -> VirtualNodeData -> Bool
Prelude.Eq, ReadPrec [VirtualNodeData]
ReadPrec VirtualNodeData
Int -> ReadS VirtualNodeData
ReadS [VirtualNodeData]
(Int -> ReadS VirtualNodeData)
-> ReadS [VirtualNodeData]
-> ReadPrec VirtualNodeData
-> ReadPrec [VirtualNodeData]
-> Read VirtualNodeData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualNodeData]
$creadListPrec :: ReadPrec [VirtualNodeData]
readPrec :: ReadPrec VirtualNodeData
$creadPrec :: ReadPrec VirtualNodeData
readList :: ReadS [VirtualNodeData]
$creadList :: ReadS [VirtualNodeData]
readsPrec :: Int -> ReadS VirtualNodeData
$creadsPrec :: Int -> ReadS VirtualNodeData
Prelude.Read, Int -> VirtualNodeData -> ShowS
[VirtualNodeData] -> ShowS
VirtualNodeData -> String
(Int -> VirtualNodeData -> ShowS)
-> (VirtualNodeData -> String)
-> ([VirtualNodeData] -> ShowS)
-> Show VirtualNodeData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualNodeData] -> ShowS
$cshowList :: [VirtualNodeData] -> ShowS
show :: VirtualNodeData -> String
$cshow :: VirtualNodeData -> String
showsPrec :: Int -> VirtualNodeData -> ShowS
$cshowsPrec :: Int -> VirtualNodeData -> ShowS
Prelude.Show, (forall x. VirtualNodeData -> Rep VirtualNodeData x)
-> (forall x. Rep VirtualNodeData x -> VirtualNodeData)
-> Generic VirtualNodeData
forall x. Rep VirtualNodeData x -> VirtualNodeData
forall x. VirtualNodeData -> Rep VirtualNodeData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VirtualNodeData x -> VirtualNodeData
$cfrom :: forall x. VirtualNodeData -> Rep VirtualNodeData x
Prelude.Generic)

-- |
-- Create a value of 'VirtualNodeData' 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:
--
-- 'meshName', 'virtualNodeData_meshName' - The name of the service mesh that the virtual node resides in.
--
-- 'metadata', 'virtualNodeData_metadata' - The associated metadata for the virtual node.
--
-- 'spec', 'virtualNodeData_spec' - The specifications of the virtual node.
--
-- 'status', 'virtualNodeData_status' - The current status for the virtual node.
--
-- 'virtualNodeName', 'virtualNodeData_virtualNodeName' - The name of the virtual node.
newVirtualNodeData ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'metadata'
  ResourceMetadata ->
  -- | 'spec'
  VirtualNodeSpec ->
  -- | 'status'
  VirtualNodeStatus ->
  -- | 'virtualNodeName'
  Prelude.Text ->
  VirtualNodeData
newVirtualNodeData :: Text
-> ResourceMetadata
-> VirtualNodeSpec
-> VirtualNodeStatus
-> Text
-> VirtualNodeData
newVirtualNodeData
  Text
pMeshName_
  ResourceMetadata
pMetadata_
  VirtualNodeSpec
pSpec_
  VirtualNodeStatus
pStatus_
  Text
pVirtualNodeName_ =
    VirtualNodeData' :: Text
-> ResourceMetadata
-> VirtualNodeSpec
-> VirtualNodeStatus
-> Text
-> VirtualNodeData
VirtualNodeData'
      { $sel:meshName:VirtualNodeData' :: Text
meshName = Text
pMeshName_,
        $sel:metadata:VirtualNodeData' :: ResourceMetadata
metadata = ResourceMetadata
pMetadata_,
        $sel:spec:VirtualNodeData' :: VirtualNodeSpec
spec = VirtualNodeSpec
pSpec_,
        $sel:status:VirtualNodeData' :: VirtualNodeStatus
status = VirtualNodeStatus
pStatus_,
        $sel:virtualNodeName:VirtualNodeData' :: Text
virtualNodeName = Text
pVirtualNodeName_
      }

-- | The name of the service mesh that the virtual node resides in.
virtualNodeData_meshName :: Lens.Lens' VirtualNodeData Prelude.Text
virtualNodeData_meshName :: (Text -> f Text) -> VirtualNodeData -> f VirtualNodeData
virtualNodeData_meshName = (VirtualNodeData -> Text)
-> (VirtualNodeData -> Text -> VirtualNodeData)
-> Lens VirtualNodeData VirtualNodeData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeData' {Text
meshName :: Text
$sel:meshName:VirtualNodeData' :: VirtualNodeData -> Text
meshName} -> Text
meshName) (\s :: VirtualNodeData
s@VirtualNodeData' {} Text
a -> VirtualNodeData
s {$sel:meshName:VirtualNodeData' :: Text
meshName = Text
a} :: VirtualNodeData)

-- | The associated metadata for the virtual node.
virtualNodeData_metadata :: Lens.Lens' VirtualNodeData ResourceMetadata
virtualNodeData_metadata :: (ResourceMetadata -> f ResourceMetadata)
-> VirtualNodeData -> f VirtualNodeData
virtualNodeData_metadata = (VirtualNodeData -> ResourceMetadata)
-> (VirtualNodeData -> ResourceMetadata -> VirtualNodeData)
-> Lens
     VirtualNodeData VirtualNodeData ResourceMetadata ResourceMetadata
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeData' {ResourceMetadata
metadata :: ResourceMetadata
$sel:metadata:VirtualNodeData' :: VirtualNodeData -> ResourceMetadata
metadata} -> ResourceMetadata
metadata) (\s :: VirtualNodeData
s@VirtualNodeData' {} ResourceMetadata
a -> VirtualNodeData
s {$sel:metadata:VirtualNodeData' :: ResourceMetadata
metadata = ResourceMetadata
a} :: VirtualNodeData)

-- | The specifications of the virtual node.
virtualNodeData_spec :: Lens.Lens' VirtualNodeData VirtualNodeSpec
virtualNodeData_spec :: (VirtualNodeSpec -> f VirtualNodeSpec)
-> VirtualNodeData -> f VirtualNodeData
virtualNodeData_spec = (VirtualNodeData -> VirtualNodeSpec)
-> (VirtualNodeData -> VirtualNodeSpec -> VirtualNodeData)
-> Lens
     VirtualNodeData VirtualNodeData VirtualNodeSpec VirtualNodeSpec
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeData' {VirtualNodeSpec
spec :: VirtualNodeSpec
$sel:spec:VirtualNodeData' :: VirtualNodeData -> VirtualNodeSpec
spec} -> VirtualNodeSpec
spec) (\s :: VirtualNodeData
s@VirtualNodeData' {} VirtualNodeSpec
a -> VirtualNodeData
s {$sel:spec:VirtualNodeData' :: VirtualNodeSpec
spec = VirtualNodeSpec
a} :: VirtualNodeData)

-- | The current status for the virtual node.
virtualNodeData_status :: Lens.Lens' VirtualNodeData VirtualNodeStatus
virtualNodeData_status :: (VirtualNodeStatus -> f VirtualNodeStatus)
-> VirtualNodeData -> f VirtualNodeData
virtualNodeData_status = (VirtualNodeData -> VirtualNodeStatus)
-> (VirtualNodeData -> VirtualNodeStatus -> VirtualNodeData)
-> Lens
     VirtualNodeData VirtualNodeData VirtualNodeStatus VirtualNodeStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeData' {VirtualNodeStatus
status :: VirtualNodeStatus
$sel:status:VirtualNodeData' :: VirtualNodeData -> VirtualNodeStatus
status} -> VirtualNodeStatus
status) (\s :: VirtualNodeData
s@VirtualNodeData' {} VirtualNodeStatus
a -> VirtualNodeData
s {$sel:status:VirtualNodeData' :: VirtualNodeStatus
status = VirtualNodeStatus
a} :: VirtualNodeData)

-- | The name of the virtual node.
virtualNodeData_virtualNodeName :: Lens.Lens' VirtualNodeData Prelude.Text
virtualNodeData_virtualNodeName :: (Text -> f Text) -> VirtualNodeData -> f VirtualNodeData
virtualNodeData_virtualNodeName = (VirtualNodeData -> Text)
-> (VirtualNodeData -> Text -> VirtualNodeData)
-> Lens VirtualNodeData VirtualNodeData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeData' {Text
virtualNodeName :: Text
$sel:virtualNodeName:VirtualNodeData' :: VirtualNodeData -> Text
virtualNodeName} -> Text
virtualNodeName) (\s :: VirtualNodeData
s@VirtualNodeData' {} Text
a -> VirtualNodeData
s {$sel:virtualNodeName:VirtualNodeData' :: Text
virtualNodeName = Text
a} :: VirtualNodeData)

instance Core.FromJSON VirtualNodeData where
  parseJSON :: Value -> Parser VirtualNodeData
parseJSON =
    String
-> (Object -> Parser VirtualNodeData)
-> Value
-> Parser VirtualNodeData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualNodeData"
      ( \Object
x ->
          Text
-> ResourceMetadata
-> VirtualNodeSpec
-> VirtualNodeStatus
-> Text
-> VirtualNodeData
VirtualNodeData'
            (Text
 -> ResourceMetadata
 -> VirtualNodeSpec
 -> VirtualNodeStatus
 -> Text
 -> VirtualNodeData)
-> Parser Text
-> Parser
     (ResourceMetadata
      -> VirtualNodeSpec -> VirtualNodeStatus -> Text -> VirtualNodeData)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"meshName")
            Parser
  (ResourceMetadata
   -> VirtualNodeSpec -> VirtualNodeStatus -> Text -> VirtualNodeData)
-> Parser ResourceMetadata
-> Parser
     (VirtualNodeSpec -> VirtualNodeStatus -> Text -> VirtualNodeData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ResourceMetadata
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"metadata")
            Parser
  (VirtualNodeSpec -> VirtualNodeStatus -> Text -> VirtualNodeData)
-> Parser VirtualNodeSpec
-> Parser (VirtualNodeStatus -> Text -> VirtualNodeData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser VirtualNodeSpec
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"spec")
            Parser (VirtualNodeStatus -> Text -> VirtualNodeData)
-> Parser VirtualNodeStatus -> Parser (Text -> VirtualNodeData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser VirtualNodeStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser (Text -> VirtualNodeData)
-> Parser Text -> Parser VirtualNodeData
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
"virtualNodeName")
      )

instance Prelude.Hashable VirtualNodeData

instance Prelude.NFData VirtualNodeData