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

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 service provider.
--
-- /See:/ 'newVirtualNodeServiceProvider' smart constructor.
data VirtualNodeServiceProvider = VirtualNodeServiceProvider'
  { -- | The name of the virtual node that is acting as a service provider.
    VirtualNodeServiceProvider -> Text
virtualNodeName :: Prelude.Text
  }
  deriving (VirtualNodeServiceProvider -> VirtualNodeServiceProvider -> Bool
(VirtualNodeServiceProvider -> VirtualNodeServiceProvider -> Bool)
-> (VirtualNodeServiceProvider
    -> VirtualNodeServiceProvider -> Bool)
-> Eq VirtualNodeServiceProvider
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualNodeServiceProvider -> VirtualNodeServiceProvider -> Bool
$c/= :: VirtualNodeServiceProvider -> VirtualNodeServiceProvider -> Bool
== :: VirtualNodeServiceProvider -> VirtualNodeServiceProvider -> Bool
$c== :: VirtualNodeServiceProvider -> VirtualNodeServiceProvider -> Bool
Prelude.Eq, ReadPrec [VirtualNodeServiceProvider]
ReadPrec VirtualNodeServiceProvider
Int -> ReadS VirtualNodeServiceProvider
ReadS [VirtualNodeServiceProvider]
(Int -> ReadS VirtualNodeServiceProvider)
-> ReadS [VirtualNodeServiceProvider]
-> ReadPrec VirtualNodeServiceProvider
-> ReadPrec [VirtualNodeServiceProvider]
-> Read VirtualNodeServiceProvider
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualNodeServiceProvider]
$creadListPrec :: ReadPrec [VirtualNodeServiceProvider]
readPrec :: ReadPrec VirtualNodeServiceProvider
$creadPrec :: ReadPrec VirtualNodeServiceProvider
readList :: ReadS [VirtualNodeServiceProvider]
$creadList :: ReadS [VirtualNodeServiceProvider]
readsPrec :: Int -> ReadS VirtualNodeServiceProvider
$creadsPrec :: Int -> ReadS VirtualNodeServiceProvider
Prelude.Read, Int -> VirtualNodeServiceProvider -> ShowS
[VirtualNodeServiceProvider] -> ShowS
VirtualNodeServiceProvider -> String
(Int -> VirtualNodeServiceProvider -> ShowS)
-> (VirtualNodeServiceProvider -> String)
-> ([VirtualNodeServiceProvider] -> ShowS)
-> Show VirtualNodeServiceProvider
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualNodeServiceProvider] -> ShowS
$cshowList :: [VirtualNodeServiceProvider] -> ShowS
show :: VirtualNodeServiceProvider -> String
$cshow :: VirtualNodeServiceProvider -> String
showsPrec :: Int -> VirtualNodeServiceProvider -> ShowS
$cshowsPrec :: Int -> VirtualNodeServiceProvider -> ShowS
Prelude.Show, (forall x.
 VirtualNodeServiceProvider -> Rep VirtualNodeServiceProvider x)
-> (forall x.
    Rep VirtualNodeServiceProvider x -> VirtualNodeServiceProvider)
-> Generic VirtualNodeServiceProvider
forall x.
Rep VirtualNodeServiceProvider x -> VirtualNodeServiceProvider
forall x.
VirtualNodeServiceProvider -> Rep VirtualNodeServiceProvider x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VirtualNodeServiceProvider x -> VirtualNodeServiceProvider
$cfrom :: forall x.
VirtualNodeServiceProvider -> Rep VirtualNodeServiceProvider x
Prelude.Generic)

-- |
-- Create a value of 'VirtualNodeServiceProvider' 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:
--
-- 'virtualNodeName', 'virtualNodeServiceProvider_virtualNodeName' - The name of the virtual node that is acting as a service provider.
newVirtualNodeServiceProvider ::
  -- | 'virtualNodeName'
  Prelude.Text ->
  VirtualNodeServiceProvider
newVirtualNodeServiceProvider :: Text -> VirtualNodeServiceProvider
newVirtualNodeServiceProvider Text
pVirtualNodeName_ =
  VirtualNodeServiceProvider' :: Text -> VirtualNodeServiceProvider
VirtualNodeServiceProvider'
    { $sel:virtualNodeName:VirtualNodeServiceProvider' :: Text
virtualNodeName =
        Text
pVirtualNodeName_
    }

-- | The name of the virtual node that is acting as a service provider.
virtualNodeServiceProvider_virtualNodeName :: Lens.Lens' VirtualNodeServiceProvider Prelude.Text
virtualNodeServiceProvider_virtualNodeName :: (Text -> f Text)
-> VirtualNodeServiceProvider -> f VirtualNodeServiceProvider
virtualNodeServiceProvider_virtualNodeName = (VirtualNodeServiceProvider -> Text)
-> (VirtualNodeServiceProvider
    -> Text -> VirtualNodeServiceProvider)
-> Lens
     VirtualNodeServiceProvider VirtualNodeServiceProvider Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeServiceProvider' {Text
virtualNodeName :: Text
$sel:virtualNodeName:VirtualNodeServiceProvider' :: VirtualNodeServiceProvider -> Text
virtualNodeName} -> Text
virtualNodeName) (\s :: VirtualNodeServiceProvider
s@VirtualNodeServiceProvider' {} Text
a -> VirtualNodeServiceProvider
s {$sel:virtualNodeName:VirtualNodeServiceProvider' :: Text
virtualNodeName = Text
a} :: VirtualNodeServiceProvider)

instance Core.FromJSON VirtualNodeServiceProvider where
  parseJSON :: Value -> Parser VirtualNodeServiceProvider
parseJSON =
    String
-> (Object -> Parser VirtualNodeServiceProvider)
-> Value
-> Parser VirtualNodeServiceProvider
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualNodeServiceProvider"
      ( \Object
x ->
          Text -> VirtualNodeServiceProvider
VirtualNodeServiceProvider'
            (Text -> VirtualNodeServiceProvider)
-> Parser Text -> Parser VirtualNodeServiceProvider
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
"virtualNodeName")
      )

instance Prelude.Hashable VirtualNodeServiceProvider

instance Prelude.NFData VirtualNodeServiceProvider

instance Core.ToJSON VirtualNodeServiceProvider where
  toJSON :: VirtualNodeServiceProvider -> Value
toJSON VirtualNodeServiceProvider' {Text
virtualNodeName :: Text
$sel:virtualNodeName:VirtualNodeServiceProvider' :: VirtualNodeServiceProvider -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"virtualNodeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
virtualNodeName)
          ]
      )