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

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

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

-- |
-- Create a value of 'VirtualGatewayClientPolicy' 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:
--
-- 'tls', 'virtualGatewayClientPolicy_tls' - A reference to an object that represents a Transport Layer Security
-- (TLS) client policy.
newVirtualGatewayClientPolicy ::
  VirtualGatewayClientPolicy
newVirtualGatewayClientPolicy :: VirtualGatewayClientPolicy
newVirtualGatewayClientPolicy =
  VirtualGatewayClientPolicy' :: Maybe VirtualGatewayClientPolicyTls -> VirtualGatewayClientPolicy
VirtualGatewayClientPolicy' {$sel:tls:VirtualGatewayClientPolicy' :: Maybe VirtualGatewayClientPolicyTls
tls = Maybe VirtualGatewayClientPolicyTls
forall a. Maybe a
Prelude.Nothing}

-- | A reference to an object that represents a Transport Layer Security
-- (TLS) client policy.
virtualGatewayClientPolicy_tls :: Lens.Lens' VirtualGatewayClientPolicy (Prelude.Maybe VirtualGatewayClientPolicyTls)
virtualGatewayClientPolicy_tls :: (Maybe VirtualGatewayClientPolicyTls
 -> f (Maybe VirtualGatewayClientPolicyTls))
-> VirtualGatewayClientPolicy -> f VirtualGatewayClientPolicy
virtualGatewayClientPolicy_tls = (VirtualGatewayClientPolicy -> Maybe VirtualGatewayClientPolicyTls)
-> (VirtualGatewayClientPolicy
    -> Maybe VirtualGatewayClientPolicyTls
    -> VirtualGatewayClientPolicy)
-> Lens
     VirtualGatewayClientPolicy
     VirtualGatewayClientPolicy
     (Maybe VirtualGatewayClientPolicyTls)
     (Maybe VirtualGatewayClientPolicyTls)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayClientPolicy' {Maybe VirtualGatewayClientPolicyTls
tls :: Maybe VirtualGatewayClientPolicyTls
$sel:tls:VirtualGatewayClientPolicy' :: VirtualGatewayClientPolicy -> Maybe VirtualGatewayClientPolicyTls
tls} -> Maybe VirtualGatewayClientPolicyTls
tls) (\s :: VirtualGatewayClientPolicy
s@VirtualGatewayClientPolicy' {} Maybe VirtualGatewayClientPolicyTls
a -> VirtualGatewayClientPolicy
s {$sel:tls:VirtualGatewayClientPolicy' :: Maybe VirtualGatewayClientPolicyTls
tls = Maybe VirtualGatewayClientPolicyTls
a} :: VirtualGatewayClientPolicy)

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

instance Prelude.Hashable VirtualGatewayClientPolicy

instance Prelude.NFData VirtualGatewayClientPolicy

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