{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | 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,
    -- | A reference to an object that represents a virtual gateway\'s client\'s
    -- Secret Discovery Service certificate.
    VirtualGatewayClientTlsCertificate
-> Maybe VirtualGatewayListenerTlsSdsCertificate
sds :: Prelude.Maybe VirtualGatewayListenerTlsSdsCertificate
  }
  deriving (VirtualGatewayClientTlsCertificate
-> VirtualGatewayClientTlsCertificate -> Bool
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]
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
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.
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:
--
-- '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)>
-- .
--
-- 'sds', 'virtualGatewayClientTlsCertificate_sds' - A reference to an object that represents a virtual gateway\'s client\'s
-- Secret Discovery Service certificate.
newVirtualGatewayClientTlsCertificate ::
  VirtualGatewayClientTlsCertificate
newVirtualGatewayClientTlsCertificate :: VirtualGatewayClientTlsCertificate
newVirtualGatewayClientTlsCertificate =
  VirtualGatewayClientTlsCertificate'
    { $sel:file:VirtualGatewayClientTlsCertificate' :: Maybe VirtualGatewayListenerTlsFileCertificate
file =
        forall a. Maybe a
Prelude.Nothing,
      $sel:sds:VirtualGatewayClientTlsCertificate' :: Maybe VirtualGatewayListenerTlsSdsCertificate
sds = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens'
  VirtualGatewayClientTlsCertificate
  (Maybe VirtualGatewayListenerTlsFileCertificate)
virtualGatewayClientTlsCertificate_file = 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)

-- | 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 :: Lens'
  VirtualGatewayClientTlsCertificate
  (Maybe VirtualGatewayListenerTlsSdsCertificate)
virtualGatewayClientTlsCertificate_sds = 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)

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

instance
  Prelude.Hashable
    VirtualGatewayClientTlsCertificate
  where
  hashWithSalt :: Int -> VirtualGatewayClientTlsCertificate -> Int
hashWithSalt
    Int
_salt
    VirtualGatewayClientTlsCertificate' {Maybe VirtualGatewayListenerTlsFileCertificate
Maybe VirtualGatewayListenerTlsSdsCertificate
sds :: Maybe VirtualGatewayListenerTlsSdsCertificate
file :: Maybe VirtualGatewayListenerTlsFileCertificate
$sel:sds:VirtualGatewayClientTlsCertificate' :: VirtualGatewayClientTlsCertificate
-> Maybe VirtualGatewayListenerTlsSdsCertificate
$sel:file:VirtualGatewayClientTlsCertificate' :: VirtualGatewayClientTlsCertificate
-> Maybe VirtualGatewayListenerTlsFileCertificate
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VirtualGatewayListenerTlsFileCertificate
file
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VirtualGatewayListenerTlsSdsCertificate
sds

instance
  Prelude.NFData
    VirtualGatewayClientTlsCertificate
  where
  rnf :: VirtualGatewayClientTlsCertificate -> ()
rnf VirtualGatewayClientTlsCertificate' {Maybe VirtualGatewayListenerTlsFileCertificate
Maybe VirtualGatewayListenerTlsSdsCertificate
sds :: Maybe VirtualGatewayListenerTlsSdsCertificate
file :: Maybe VirtualGatewayListenerTlsFileCertificate
$sel:sds:VirtualGatewayClientTlsCertificate' :: VirtualGatewayClientTlsCertificate
-> Maybe VirtualGatewayListenerTlsSdsCertificate
$sel:file:VirtualGatewayClientTlsCertificate' :: VirtualGatewayClientTlsCertificate
-> Maybe VirtualGatewayListenerTlsFileCertificate
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe VirtualGatewayListenerTlsFileCertificate
file seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VirtualGatewayListenerTlsSdsCertificate
sds

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