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

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 listener\'s Secret
-- Discovery Service certificate.The proxy must be configured with a local
-- SDS provider via a Unix Domain Socket. See App
-- Mesh<https://docs.aws.amazon.com/app-mesh/latest/userguide/tls.html TLS documentation>
-- for more info.
--
-- /See:/ 'newVirtualGatewayListenerTlsSdsCertificate' smart constructor.
data VirtualGatewayListenerTlsSdsCertificate = VirtualGatewayListenerTlsSdsCertificate'
  { -- | A reference to an object that represents the name of the secret secret
    -- requested from the Secret Discovery Service provider representing
    -- Transport Layer Security (TLS) materials like a certificate or
    -- certificate chain.
    VirtualGatewayListenerTlsSdsCertificate -> Text
secretName :: Prelude.Text
  }
  deriving (VirtualGatewayListenerTlsSdsCertificate
-> VirtualGatewayListenerTlsSdsCertificate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualGatewayListenerTlsSdsCertificate
-> VirtualGatewayListenerTlsSdsCertificate -> Bool
$c/= :: VirtualGatewayListenerTlsSdsCertificate
-> VirtualGatewayListenerTlsSdsCertificate -> Bool
== :: VirtualGatewayListenerTlsSdsCertificate
-> VirtualGatewayListenerTlsSdsCertificate -> Bool
$c== :: VirtualGatewayListenerTlsSdsCertificate
-> VirtualGatewayListenerTlsSdsCertificate -> Bool
Prelude.Eq, ReadPrec [VirtualGatewayListenerTlsSdsCertificate]
ReadPrec VirtualGatewayListenerTlsSdsCertificate
Int -> ReadS VirtualGatewayListenerTlsSdsCertificate
ReadS [VirtualGatewayListenerTlsSdsCertificate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualGatewayListenerTlsSdsCertificate]
$creadListPrec :: ReadPrec [VirtualGatewayListenerTlsSdsCertificate]
readPrec :: ReadPrec VirtualGatewayListenerTlsSdsCertificate
$creadPrec :: ReadPrec VirtualGatewayListenerTlsSdsCertificate
readList :: ReadS [VirtualGatewayListenerTlsSdsCertificate]
$creadList :: ReadS [VirtualGatewayListenerTlsSdsCertificate]
readsPrec :: Int -> ReadS VirtualGatewayListenerTlsSdsCertificate
$creadsPrec :: Int -> ReadS VirtualGatewayListenerTlsSdsCertificate
Prelude.Read, Int -> VirtualGatewayListenerTlsSdsCertificate -> ShowS
[VirtualGatewayListenerTlsSdsCertificate] -> ShowS
VirtualGatewayListenerTlsSdsCertificate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualGatewayListenerTlsSdsCertificate] -> ShowS
$cshowList :: [VirtualGatewayListenerTlsSdsCertificate] -> ShowS
show :: VirtualGatewayListenerTlsSdsCertificate -> String
$cshow :: VirtualGatewayListenerTlsSdsCertificate -> String
showsPrec :: Int -> VirtualGatewayListenerTlsSdsCertificate -> ShowS
$cshowsPrec :: Int -> VirtualGatewayListenerTlsSdsCertificate -> ShowS
Prelude.Show, forall x.
Rep VirtualGatewayListenerTlsSdsCertificate x
-> VirtualGatewayListenerTlsSdsCertificate
forall x.
VirtualGatewayListenerTlsSdsCertificate
-> Rep VirtualGatewayListenerTlsSdsCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VirtualGatewayListenerTlsSdsCertificate x
-> VirtualGatewayListenerTlsSdsCertificate
$cfrom :: forall x.
VirtualGatewayListenerTlsSdsCertificate
-> Rep VirtualGatewayListenerTlsSdsCertificate x
Prelude.Generic)

-- |
-- Create a value of 'VirtualGatewayListenerTlsSdsCertificate' 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:
--
-- 'secretName', 'virtualGatewayListenerTlsSdsCertificate_secretName' - A reference to an object that represents the name of the secret secret
-- requested from the Secret Discovery Service provider representing
-- Transport Layer Security (TLS) materials like a certificate or
-- certificate chain.
newVirtualGatewayListenerTlsSdsCertificate ::
  -- | 'secretName'
  Prelude.Text ->
  VirtualGatewayListenerTlsSdsCertificate
newVirtualGatewayListenerTlsSdsCertificate :: Text -> VirtualGatewayListenerTlsSdsCertificate
newVirtualGatewayListenerTlsSdsCertificate
  Text
pSecretName_ =
    VirtualGatewayListenerTlsSdsCertificate'
      { $sel:secretName:VirtualGatewayListenerTlsSdsCertificate' :: Text
secretName =
          Text
pSecretName_
      }

-- | A reference to an object that represents the name of the secret secret
-- requested from the Secret Discovery Service provider representing
-- Transport Layer Security (TLS) materials like a certificate or
-- certificate chain.
virtualGatewayListenerTlsSdsCertificate_secretName :: Lens.Lens' VirtualGatewayListenerTlsSdsCertificate Prelude.Text
virtualGatewayListenerTlsSdsCertificate_secretName :: Lens' VirtualGatewayListenerTlsSdsCertificate Text
virtualGatewayListenerTlsSdsCertificate_secretName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayListenerTlsSdsCertificate' {Text
secretName :: Text
$sel:secretName:VirtualGatewayListenerTlsSdsCertificate' :: VirtualGatewayListenerTlsSdsCertificate -> Text
secretName} -> Text
secretName) (\s :: VirtualGatewayListenerTlsSdsCertificate
s@VirtualGatewayListenerTlsSdsCertificate' {} Text
a -> VirtualGatewayListenerTlsSdsCertificate
s {$sel:secretName:VirtualGatewayListenerTlsSdsCertificate' :: Text
secretName = Text
a} :: VirtualGatewayListenerTlsSdsCertificate)

instance
  Data.FromJSON
    VirtualGatewayListenerTlsSdsCertificate
  where
  parseJSON :: Value -> Parser VirtualGatewayListenerTlsSdsCertificate
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VirtualGatewayListenerTlsSdsCertificate"
      ( \Object
x ->
          Text -> VirtualGatewayListenerTlsSdsCertificate
VirtualGatewayListenerTlsSdsCertificate'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"secretName")
      )

instance
  Prelude.Hashable
    VirtualGatewayListenerTlsSdsCertificate
  where
  hashWithSalt :: Int -> VirtualGatewayListenerTlsSdsCertificate -> Int
hashWithSalt
    Int
_salt
    VirtualGatewayListenerTlsSdsCertificate' {Text
secretName :: Text
$sel:secretName:VirtualGatewayListenerTlsSdsCertificate' :: VirtualGatewayListenerTlsSdsCertificate -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
secretName

instance
  Prelude.NFData
    VirtualGatewayListenerTlsSdsCertificate
  where
  rnf :: VirtualGatewayListenerTlsSdsCertificate -> ()
rnf VirtualGatewayListenerTlsSdsCertificate' {Text
secretName :: Text
$sel:secretName:VirtualGatewayListenerTlsSdsCertificate' :: VirtualGatewayListenerTlsSdsCertificate -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
secretName

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