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

import Amazonka.AppMesh.Types.VirtualGatewayClientPolicy
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that represents the default properties for a backend.
--
-- /See:/ 'newVirtualGatewayBackendDefaults' smart constructor.
data VirtualGatewayBackendDefaults = VirtualGatewayBackendDefaults'
  { -- | A reference to an object that represents a client policy.
    VirtualGatewayBackendDefaults -> Maybe VirtualGatewayClientPolicy
clientPolicy :: Prelude.Maybe VirtualGatewayClientPolicy
  }
  deriving (VirtualGatewayBackendDefaults
-> VirtualGatewayBackendDefaults -> Bool
(VirtualGatewayBackendDefaults
 -> VirtualGatewayBackendDefaults -> Bool)
-> (VirtualGatewayBackendDefaults
    -> VirtualGatewayBackendDefaults -> Bool)
-> Eq VirtualGatewayBackendDefaults
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualGatewayBackendDefaults
-> VirtualGatewayBackendDefaults -> Bool
$c/= :: VirtualGatewayBackendDefaults
-> VirtualGatewayBackendDefaults -> Bool
== :: VirtualGatewayBackendDefaults
-> VirtualGatewayBackendDefaults -> Bool
$c== :: VirtualGatewayBackendDefaults
-> VirtualGatewayBackendDefaults -> Bool
Prelude.Eq, ReadPrec [VirtualGatewayBackendDefaults]
ReadPrec VirtualGatewayBackendDefaults
Int -> ReadS VirtualGatewayBackendDefaults
ReadS [VirtualGatewayBackendDefaults]
(Int -> ReadS VirtualGatewayBackendDefaults)
-> ReadS [VirtualGatewayBackendDefaults]
-> ReadPrec VirtualGatewayBackendDefaults
-> ReadPrec [VirtualGatewayBackendDefaults]
-> Read VirtualGatewayBackendDefaults
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualGatewayBackendDefaults]
$creadListPrec :: ReadPrec [VirtualGatewayBackendDefaults]
readPrec :: ReadPrec VirtualGatewayBackendDefaults
$creadPrec :: ReadPrec VirtualGatewayBackendDefaults
readList :: ReadS [VirtualGatewayBackendDefaults]
$creadList :: ReadS [VirtualGatewayBackendDefaults]
readsPrec :: Int -> ReadS VirtualGatewayBackendDefaults
$creadsPrec :: Int -> ReadS VirtualGatewayBackendDefaults
Prelude.Read, Int -> VirtualGatewayBackendDefaults -> ShowS
[VirtualGatewayBackendDefaults] -> ShowS
VirtualGatewayBackendDefaults -> String
(Int -> VirtualGatewayBackendDefaults -> ShowS)
-> (VirtualGatewayBackendDefaults -> String)
-> ([VirtualGatewayBackendDefaults] -> ShowS)
-> Show VirtualGatewayBackendDefaults
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualGatewayBackendDefaults] -> ShowS
$cshowList :: [VirtualGatewayBackendDefaults] -> ShowS
show :: VirtualGatewayBackendDefaults -> String
$cshow :: VirtualGatewayBackendDefaults -> String
showsPrec :: Int -> VirtualGatewayBackendDefaults -> ShowS
$cshowsPrec :: Int -> VirtualGatewayBackendDefaults -> ShowS
Prelude.Show, (forall x.
 VirtualGatewayBackendDefaults
 -> Rep VirtualGatewayBackendDefaults x)
-> (forall x.
    Rep VirtualGatewayBackendDefaults x
    -> VirtualGatewayBackendDefaults)
-> Generic VirtualGatewayBackendDefaults
forall x.
Rep VirtualGatewayBackendDefaults x
-> VirtualGatewayBackendDefaults
forall x.
VirtualGatewayBackendDefaults
-> Rep VirtualGatewayBackendDefaults x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VirtualGatewayBackendDefaults x
-> VirtualGatewayBackendDefaults
$cfrom :: forall x.
VirtualGatewayBackendDefaults
-> Rep VirtualGatewayBackendDefaults x
Prelude.Generic)

-- |
-- Create a value of 'VirtualGatewayBackendDefaults' 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:
--
-- 'clientPolicy', 'virtualGatewayBackendDefaults_clientPolicy' - A reference to an object that represents a client policy.
newVirtualGatewayBackendDefaults ::
  VirtualGatewayBackendDefaults
newVirtualGatewayBackendDefaults :: VirtualGatewayBackendDefaults
newVirtualGatewayBackendDefaults =
  VirtualGatewayBackendDefaults' :: Maybe VirtualGatewayClientPolicy -> VirtualGatewayBackendDefaults
VirtualGatewayBackendDefaults'
    { $sel:clientPolicy:VirtualGatewayBackendDefaults' :: Maybe VirtualGatewayClientPolicy
clientPolicy =
        Maybe VirtualGatewayClientPolicy
forall a. Maybe a
Prelude.Nothing
    }

-- | A reference to an object that represents a client policy.
virtualGatewayBackendDefaults_clientPolicy :: Lens.Lens' VirtualGatewayBackendDefaults (Prelude.Maybe VirtualGatewayClientPolicy)
virtualGatewayBackendDefaults_clientPolicy :: (Maybe VirtualGatewayClientPolicy
 -> f (Maybe VirtualGatewayClientPolicy))
-> VirtualGatewayBackendDefaults -> f VirtualGatewayBackendDefaults
virtualGatewayBackendDefaults_clientPolicy = (VirtualGatewayBackendDefaults -> Maybe VirtualGatewayClientPolicy)
-> (VirtualGatewayBackendDefaults
    -> Maybe VirtualGatewayClientPolicy
    -> VirtualGatewayBackendDefaults)
-> Lens
     VirtualGatewayBackendDefaults
     VirtualGatewayBackendDefaults
     (Maybe VirtualGatewayClientPolicy)
     (Maybe VirtualGatewayClientPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayBackendDefaults' {Maybe VirtualGatewayClientPolicy
clientPolicy :: Maybe VirtualGatewayClientPolicy
$sel:clientPolicy:VirtualGatewayBackendDefaults' :: VirtualGatewayBackendDefaults -> Maybe VirtualGatewayClientPolicy
clientPolicy} -> Maybe VirtualGatewayClientPolicy
clientPolicy) (\s :: VirtualGatewayBackendDefaults
s@VirtualGatewayBackendDefaults' {} Maybe VirtualGatewayClientPolicy
a -> VirtualGatewayBackendDefaults
s {$sel:clientPolicy:VirtualGatewayBackendDefaults' :: Maybe VirtualGatewayClientPolicy
clientPolicy = Maybe VirtualGatewayClientPolicy
a} :: VirtualGatewayBackendDefaults)

instance Core.FromJSON VirtualGatewayBackendDefaults where
  parseJSON :: Value -> Parser VirtualGatewayBackendDefaults
parseJSON =
    String
-> (Object -> Parser VirtualGatewayBackendDefaults)
-> Value
-> Parser VirtualGatewayBackendDefaults
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualGatewayBackendDefaults"
      ( \Object
x ->
          Maybe VirtualGatewayClientPolicy -> VirtualGatewayBackendDefaults
VirtualGatewayBackendDefaults'
            (Maybe VirtualGatewayClientPolicy -> VirtualGatewayBackendDefaults)
-> Parser (Maybe VirtualGatewayClientPolicy)
-> Parser VirtualGatewayBackendDefaults
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe VirtualGatewayClientPolicy)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"clientPolicy")
      )

instance
  Prelude.Hashable
    VirtualGatewayBackendDefaults

instance Prelude.NFData VirtualGatewayBackendDefaults

instance Core.ToJSON VirtualGatewayBackendDefaults where
  toJSON :: VirtualGatewayBackendDefaults -> Value
toJSON VirtualGatewayBackendDefaults' {Maybe VirtualGatewayClientPolicy
clientPolicy :: Maybe VirtualGatewayClientPolicy
$sel:clientPolicy:VirtualGatewayBackendDefaults' :: VirtualGatewayBackendDefaults -> Maybe VirtualGatewayClientPolicy
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"clientPolicy" Text -> VirtualGatewayClientPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VirtualGatewayClientPolicy -> Pair)
-> Maybe VirtualGatewayClientPolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VirtualGatewayClientPolicy
clientPolicy]
      )