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

import Amazonka.AppMesh.Types.ResourceMetadata
import Amazonka.AppMesh.Types.VirtualRouterSpec
import Amazonka.AppMesh.Types.VirtualRouterStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'VirtualRouterData' 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', 'virtualRouterData_meshName' - The name of the service mesh that the virtual router resides in.
--
-- 'metadata', 'virtualRouterData_metadata' - The associated metadata for the virtual router.
--
-- 'spec', 'virtualRouterData_spec' - The specifications of the virtual router.
--
-- 'status', 'virtualRouterData_status' - The current status of the virtual router.
--
-- 'virtualRouterName', 'virtualRouterData_virtualRouterName' - The name of the virtual router.
newVirtualRouterData ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'metadata'
  ResourceMetadata ->
  -- | 'spec'
  VirtualRouterSpec ->
  -- | 'status'
  VirtualRouterStatus ->
  -- | 'virtualRouterName'
  Prelude.Text ->
  VirtualRouterData
newVirtualRouterData :: Text
-> ResourceMetadata
-> VirtualRouterSpec
-> VirtualRouterStatus
-> Text
-> VirtualRouterData
newVirtualRouterData
  Text
pMeshName_
  ResourceMetadata
pMetadata_
  VirtualRouterSpec
pSpec_
  VirtualRouterStatus
pStatus_
  Text
pVirtualRouterName_ =
    VirtualRouterData' :: Text
-> ResourceMetadata
-> VirtualRouterSpec
-> VirtualRouterStatus
-> Text
-> VirtualRouterData
VirtualRouterData'
      { $sel:meshName:VirtualRouterData' :: Text
meshName = Text
pMeshName_,
        $sel:metadata:VirtualRouterData' :: ResourceMetadata
metadata = ResourceMetadata
pMetadata_,
        $sel:spec:VirtualRouterData' :: VirtualRouterSpec
spec = VirtualRouterSpec
pSpec_,
        $sel:status:VirtualRouterData' :: VirtualRouterStatus
status = VirtualRouterStatus
pStatus_,
        $sel:virtualRouterName:VirtualRouterData' :: Text
virtualRouterName = Text
pVirtualRouterName_
      }

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

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

-- | The specifications of the virtual router.
virtualRouterData_spec :: Lens.Lens' VirtualRouterData VirtualRouterSpec
virtualRouterData_spec :: (VirtualRouterSpec -> f VirtualRouterSpec)
-> VirtualRouterData -> f VirtualRouterData
virtualRouterData_spec = (VirtualRouterData -> VirtualRouterSpec)
-> (VirtualRouterData -> VirtualRouterSpec -> VirtualRouterData)
-> Lens
     VirtualRouterData
     VirtualRouterData
     VirtualRouterSpec
     VirtualRouterSpec
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualRouterData' {VirtualRouterSpec
spec :: VirtualRouterSpec
$sel:spec:VirtualRouterData' :: VirtualRouterData -> VirtualRouterSpec
spec} -> VirtualRouterSpec
spec) (\s :: VirtualRouterData
s@VirtualRouterData' {} VirtualRouterSpec
a -> VirtualRouterData
s {$sel:spec:VirtualRouterData' :: VirtualRouterSpec
spec = VirtualRouterSpec
a} :: VirtualRouterData)

-- | The current status of the virtual router.
virtualRouterData_status :: Lens.Lens' VirtualRouterData VirtualRouterStatus
virtualRouterData_status :: (VirtualRouterStatus -> f VirtualRouterStatus)
-> VirtualRouterData -> f VirtualRouterData
virtualRouterData_status = (VirtualRouterData -> VirtualRouterStatus)
-> (VirtualRouterData -> VirtualRouterStatus -> VirtualRouterData)
-> Lens
     VirtualRouterData
     VirtualRouterData
     VirtualRouterStatus
     VirtualRouterStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualRouterData' {VirtualRouterStatus
status :: VirtualRouterStatus
$sel:status:VirtualRouterData' :: VirtualRouterData -> VirtualRouterStatus
status} -> VirtualRouterStatus
status) (\s :: VirtualRouterData
s@VirtualRouterData' {} VirtualRouterStatus
a -> VirtualRouterData
s {$sel:status:VirtualRouterData' :: VirtualRouterStatus
status = VirtualRouterStatus
a} :: VirtualRouterData)

-- | The name of the virtual router.
virtualRouterData_virtualRouterName :: Lens.Lens' VirtualRouterData Prelude.Text
virtualRouterData_virtualRouterName :: (Text -> f Text) -> VirtualRouterData -> f VirtualRouterData
virtualRouterData_virtualRouterName = (VirtualRouterData -> Text)
-> (VirtualRouterData -> Text -> VirtualRouterData)
-> Lens VirtualRouterData VirtualRouterData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualRouterData' {Text
virtualRouterName :: Text
$sel:virtualRouterName:VirtualRouterData' :: VirtualRouterData -> Text
virtualRouterName} -> Text
virtualRouterName) (\s :: VirtualRouterData
s@VirtualRouterData' {} Text
a -> VirtualRouterData
s {$sel:virtualRouterName:VirtualRouterData' :: Text
virtualRouterName = Text
a} :: VirtualRouterData)

instance Core.FromJSON VirtualRouterData where
  parseJSON :: Value -> Parser VirtualRouterData
parseJSON =
    String
-> (Object -> Parser VirtualRouterData)
-> Value
-> Parser VirtualRouterData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualRouterData"
      ( \Object
x ->
          Text
-> ResourceMetadata
-> VirtualRouterSpec
-> VirtualRouterStatus
-> Text
-> VirtualRouterData
VirtualRouterData'
            (Text
 -> ResourceMetadata
 -> VirtualRouterSpec
 -> VirtualRouterStatus
 -> Text
 -> VirtualRouterData)
-> Parser Text
-> Parser
     (ResourceMetadata
      -> VirtualRouterSpec
      -> VirtualRouterStatus
      -> Text
      -> VirtualRouterData)
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
   -> VirtualRouterSpec
   -> VirtualRouterStatus
   -> Text
   -> VirtualRouterData)
-> Parser ResourceMetadata
-> Parser
     (VirtualRouterSpec
      -> VirtualRouterStatus -> Text -> VirtualRouterData)
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
  (VirtualRouterSpec
   -> VirtualRouterStatus -> Text -> VirtualRouterData)
-> Parser VirtualRouterSpec
-> Parser (VirtualRouterStatus -> Text -> VirtualRouterData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser VirtualRouterSpec
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"spec")
            Parser (VirtualRouterStatus -> Text -> VirtualRouterData)
-> Parser VirtualRouterStatus -> Parser (Text -> VirtualRouterData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser VirtualRouterStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser (Text -> VirtualRouterData)
-> Parser Text -> Parser VirtualRouterData
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
"virtualRouterName")
      )

instance Prelude.Hashable VirtualRouterData

instance Prelude.NFData VirtualRouterData