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

import Amazonka.AppMesh.Types.VirtualGatewayListenerTlsFileCertificate
import Amazonka.AppMesh.Types.VirtualGatewayListenerTlsSdsCertificate
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that represents the virtual gateway\'s client\'s Transport
-- Layer Security (TLS) certificate.
--
-- /See:/ 'newVirtualGatewayClientTlsCertificate' smart constructor.
data VirtualGatewayClientTlsCertificate = VirtualGatewayClientTlsCertificate'
  { -- | A reference to an object that represents a virtual gateway\'s client\'s
    -- Secret Discovery Service certificate.
    VirtualGatewayClientTlsCertificate
-> Maybe VirtualGatewayListenerTlsSdsCertificate
sds :: Prelude.Maybe VirtualGatewayListenerTlsSdsCertificate,
    -- | An object that represents a local file certificate. The certificate must
    -- meet specific requirements and you must have proxy authorization
    -- enabled. For more information, see
    -- <https://docs.aws.amazon.com/app-mesh/latest/userguide/tls.html Transport Layer Security (TLS)>
    -- .
    VirtualGatewayClientTlsCertificate
-> Maybe VirtualGatewayListenerTlsFileCertificate
file :: Prelude.Maybe VirtualGatewayListenerTlsFileCertificate
  }
  deriving (VirtualGatewayClientTlsCertificate
-> VirtualGatewayClientTlsCertificate -> Bool
(VirtualGatewayClientTlsCertificate
 -> VirtualGatewayClientTlsCertificate -> Bool)
-> (VirtualGatewayClientTlsCertificate
    -> VirtualGatewayClientTlsCertificate -> Bool)
-> Eq VirtualGatewayClientTlsCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualGatewayClientTlsCertificate
-> VirtualGatewayClientTlsCertificate -> Bool
$c/= :: VirtualGatewayClientTlsCertificate
-> VirtualGatewayClientTlsCertificate -> Bool
== :: VirtualGatewayClientTlsCertificate
-> VirtualGatewayClientTlsCertificate -> Bool
$c== :: VirtualGatewayClientTlsCertificate
-> VirtualGatewayClientTlsCertificate -> Bool
Prelude.Eq, ReadPrec [VirtualGatewayClientTlsCertificate]
ReadPrec VirtualGatewayClientTlsCertificate
Int -> ReadS VirtualGatewayClientTlsCertificate
ReadS [VirtualGatewayClientTlsCertificate]
(Int -> ReadS VirtualGatewayClientTlsCertificate)
-> ReadS [VirtualGatewayClientTlsCertificate]
-> ReadPrec VirtualGatewayClientTlsCertificate
-> ReadPrec [VirtualGatewayClientTlsCertificate]
-> Read VirtualGatewayClientTlsCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualGatewayClientTlsCertificate]
$creadListPrec :: ReadPrec [VirtualGatewayClientTlsCertificate]
readPrec :: ReadPrec VirtualGatewayClientTlsCertificate
$creadPrec :: ReadPrec VirtualGatewayClientTlsCertificate
readList :: ReadS [VirtualGatewayClientTlsCertificate]
$creadList :: ReadS [VirtualGatewayClientTlsCertificate]
readsPrec :: Int -> ReadS VirtualGatewayClientTlsCertificate
$creadsPrec :: Int -> ReadS VirtualGatewayClientTlsCertificate
Prelude.Read, Int -> VirtualGatewayClientTlsCertificate -> ShowS
[VirtualGatewayClientTlsCertificate] -> ShowS
VirtualGatewayClientTlsCertificate -> String
(Int -> VirtualGatewayClientTlsCertificate -> ShowS)
-> (VirtualGatewayClientTlsCertificate -> String)
-> ([VirtualGatewayClientTlsCertificate] -> ShowS)
-> Show VirtualGatewayClientTlsCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualGatewayClientTlsCertificate] -> ShowS
$cshowList :: [VirtualGatewayClientTlsCertificate] -> ShowS
show :: VirtualGatewayClientTlsCertificate -> String
$cshow :: VirtualGatewayClientTlsCertificate -> String
showsPrec :: Int -> VirtualGatewayClientTlsCertificate -> ShowS
$cshowsPrec :: Int -> VirtualGatewayClientTlsCertificate -> ShowS
Prelude.Show, (forall x.
 VirtualGatewayClientTlsCertificate
 -> Rep VirtualGatewayClientTlsCertificate x)
-> (forall x.
    Rep VirtualGatewayClientTlsCertificate x
    -> VirtualGatewayClientTlsCertificate)
-> Generic VirtualGatewayClientTlsCertificate
forall x.
Rep VirtualGatewayClientTlsCertificate x
-> VirtualGatewayClientTlsCertificate
forall x.
VirtualGatewayClientTlsCertificate
-> Rep VirtualGatewayClientTlsCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VirtualGatewayClientTlsCertificate x
-> VirtualGatewayClientTlsCertificate
$cfrom :: forall x.
VirtualGatewayClientTlsCertificate
-> Rep VirtualGatewayClientTlsCertificate x
Prelude.Generic)

-- |
-- Create a value of 'VirtualGatewayClientTlsCertificate' 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:
--
-- 'sds', 'virtualGatewayClientTlsCertificate_sds' - A reference to an object that represents a virtual gateway\'s client\'s
-- Secret Discovery Service certificate.
--
-- 'file', 'virtualGatewayClientTlsCertificate_file' - An object that represents a local file certificate. The certificate must
-- meet specific requirements and you must have proxy authorization
-- enabled. For more information, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/tls.html Transport Layer Security (TLS)>
-- .
newVirtualGatewayClientTlsCertificate ::
  VirtualGatewayClientTlsCertificate
newVirtualGatewayClientTlsCertificate :: VirtualGatewayClientTlsCertificate
newVirtualGatewayClientTlsCertificate =
  VirtualGatewayClientTlsCertificate' :: Maybe VirtualGatewayListenerTlsSdsCertificate
-> Maybe VirtualGatewayListenerTlsFileCertificate
-> VirtualGatewayClientTlsCertificate
VirtualGatewayClientTlsCertificate'
    { $sel:sds:VirtualGatewayClientTlsCertificate' :: Maybe VirtualGatewayListenerTlsSdsCertificate
sds =
        Maybe VirtualGatewayListenerTlsSdsCertificate
forall a. Maybe a
Prelude.Nothing,
      $sel:file:VirtualGatewayClientTlsCertificate' :: Maybe VirtualGatewayListenerTlsFileCertificate
file = Maybe VirtualGatewayListenerTlsFileCertificate
forall a. Maybe a
Prelude.Nothing
    }

-- | A reference to an object that represents a virtual gateway\'s client\'s
-- Secret Discovery Service certificate.
virtualGatewayClientTlsCertificate_sds :: Lens.Lens' VirtualGatewayClientTlsCertificate (Prelude.Maybe VirtualGatewayListenerTlsSdsCertificate)
virtualGatewayClientTlsCertificate_sds :: (Maybe VirtualGatewayListenerTlsSdsCertificate
 -> f (Maybe VirtualGatewayListenerTlsSdsCertificate))
-> VirtualGatewayClientTlsCertificate
-> f VirtualGatewayClientTlsCertificate
virtualGatewayClientTlsCertificate_sds = (VirtualGatewayClientTlsCertificate
 -> Maybe VirtualGatewayListenerTlsSdsCertificate)
-> (VirtualGatewayClientTlsCertificate
    -> Maybe VirtualGatewayListenerTlsSdsCertificate
    -> VirtualGatewayClientTlsCertificate)
-> Lens
     VirtualGatewayClientTlsCertificate
     VirtualGatewayClientTlsCertificate
     (Maybe VirtualGatewayListenerTlsSdsCertificate)
     (Maybe VirtualGatewayListenerTlsSdsCertificate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayClientTlsCertificate' {Maybe VirtualGatewayListenerTlsSdsCertificate
sds :: Maybe VirtualGatewayListenerTlsSdsCertificate
$sel:sds:VirtualGatewayClientTlsCertificate' :: VirtualGatewayClientTlsCertificate
-> Maybe VirtualGatewayListenerTlsSdsCertificate
sds} -> Maybe VirtualGatewayListenerTlsSdsCertificate
sds) (\s :: VirtualGatewayClientTlsCertificate
s@VirtualGatewayClientTlsCertificate' {} Maybe VirtualGatewayListenerTlsSdsCertificate
a -> VirtualGatewayClientTlsCertificate
s {$sel:sds:VirtualGatewayClientTlsCertificate' :: Maybe VirtualGatewayListenerTlsSdsCertificate
sds = Maybe VirtualGatewayListenerTlsSdsCertificate
a} :: VirtualGatewayClientTlsCertificate)

-- | An object that represents a local file certificate. The certificate must
-- meet specific requirements and you must have proxy authorization
-- enabled. For more information, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/tls.html Transport Layer Security (TLS)>
-- .
virtualGatewayClientTlsCertificate_file :: Lens.Lens' VirtualGatewayClientTlsCertificate (Prelude.Maybe VirtualGatewayListenerTlsFileCertificate)
virtualGatewayClientTlsCertificate_file :: (Maybe VirtualGatewayListenerTlsFileCertificate
 -> f (Maybe VirtualGatewayListenerTlsFileCertificate))
-> VirtualGatewayClientTlsCertificate
-> f VirtualGatewayClientTlsCertificate
virtualGatewayClientTlsCertificate_file = (VirtualGatewayClientTlsCertificate
 -> Maybe VirtualGatewayListenerTlsFileCertificate)
-> (VirtualGatewayClientTlsCertificate
    -> Maybe VirtualGatewayListenerTlsFileCertificate
    -> VirtualGatewayClientTlsCertificate)
-> Lens
     VirtualGatewayClientTlsCertificate
     VirtualGatewayClientTlsCertificate
     (Maybe VirtualGatewayListenerTlsFileCertificate)
     (Maybe VirtualGatewayListenerTlsFileCertificate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayClientTlsCertificate' {Maybe VirtualGatewayListenerTlsFileCertificate
file :: Maybe VirtualGatewayListenerTlsFileCertificate
$sel:file:VirtualGatewayClientTlsCertificate' :: VirtualGatewayClientTlsCertificate
-> Maybe VirtualGatewayListenerTlsFileCertificate
file} -> Maybe VirtualGatewayListenerTlsFileCertificate
file) (\s :: VirtualGatewayClientTlsCertificate
s@VirtualGatewayClientTlsCertificate' {} Maybe VirtualGatewayListenerTlsFileCertificate
a -> VirtualGatewayClientTlsCertificate
s {$sel:file:VirtualGatewayClientTlsCertificate' :: Maybe VirtualGatewayListenerTlsFileCertificate
file = Maybe VirtualGatewayListenerTlsFileCertificate
a} :: VirtualGatewayClientTlsCertificate)

instance
  Core.FromJSON
    VirtualGatewayClientTlsCertificate
  where
  parseJSON :: Value -> Parser VirtualGatewayClientTlsCertificate
parseJSON =
    String
-> (Object -> Parser VirtualGatewayClientTlsCertificate)
-> Value
-> Parser VirtualGatewayClientTlsCertificate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualGatewayClientTlsCertificate"
      ( \Object
x ->
          Maybe VirtualGatewayListenerTlsSdsCertificate
-> Maybe VirtualGatewayListenerTlsFileCertificate
-> VirtualGatewayClientTlsCertificate
VirtualGatewayClientTlsCertificate'
            (Maybe VirtualGatewayListenerTlsSdsCertificate
 -> Maybe VirtualGatewayListenerTlsFileCertificate
 -> VirtualGatewayClientTlsCertificate)
-> Parser (Maybe VirtualGatewayListenerTlsSdsCertificate)
-> Parser
     (Maybe VirtualGatewayListenerTlsFileCertificate
      -> VirtualGatewayClientTlsCertificate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe VirtualGatewayListenerTlsSdsCertificate)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sds") Parser
  (Maybe VirtualGatewayListenerTlsFileCertificate
   -> VirtualGatewayClientTlsCertificate)
-> Parser (Maybe VirtualGatewayListenerTlsFileCertificate)
-> Parser VirtualGatewayClientTlsCertificate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe VirtualGatewayListenerTlsFileCertificate)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"file")
      )

instance
  Prelude.Hashable
    VirtualGatewayClientTlsCertificate

instance
  Prelude.NFData
    VirtualGatewayClientTlsCertificate

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