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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that represents the 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:/ 'newListenerTlsSdsCertificate' smart constructor.
data ListenerTlsSdsCertificate = ListenerTlsSdsCertificate'
  { -- | A reference to an object that represents the name of the secret
    -- requested from the Secret Discovery Service provider representing
    -- Transport Layer Security (TLS) materials like a certificate or
    -- certificate chain.
    ListenerTlsSdsCertificate -> Text
secretName :: Prelude.Text
  }
  deriving (ListenerTlsSdsCertificate -> ListenerTlsSdsCertificate -> Bool
(ListenerTlsSdsCertificate -> ListenerTlsSdsCertificate -> Bool)
-> (ListenerTlsSdsCertificate -> ListenerTlsSdsCertificate -> Bool)
-> Eq ListenerTlsSdsCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListenerTlsSdsCertificate -> ListenerTlsSdsCertificate -> Bool
$c/= :: ListenerTlsSdsCertificate -> ListenerTlsSdsCertificate -> Bool
== :: ListenerTlsSdsCertificate -> ListenerTlsSdsCertificate -> Bool
$c== :: ListenerTlsSdsCertificate -> ListenerTlsSdsCertificate -> Bool
Prelude.Eq, ReadPrec [ListenerTlsSdsCertificate]
ReadPrec ListenerTlsSdsCertificate
Int -> ReadS ListenerTlsSdsCertificate
ReadS [ListenerTlsSdsCertificate]
(Int -> ReadS ListenerTlsSdsCertificate)
-> ReadS [ListenerTlsSdsCertificate]
-> ReadPrec ListenerTlsSdsCertificate
-> ReadPrec [ListenerTlsSdsCertificate]
-> Read ListenerTlsSdsCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListenerTlsSdsCertificate]
$creadListPrec :: ReadPrec [ListenerTlsSdsCertificate]
readPrec :: ReadPrec ListenerTlsSdsCertificate
$creadPrec :: ReadPrec ListenerTlsSdsCertificate
readList :: ReadS [ListenerTlsSdsCertificate]
$creadList :: ReadS [ListenerTlsSdsCertificate]
readsPrec :: Int -> ReadS ListenerTlsSdsCertificate
$creadsPrec :: Int -> ReadS ListenerTlsSdsCertificate
Prelude.Read, Int -> ListenerTlsSdsCertificate -> ShowS
[ListenerTlsSdsCertificate] -> ShowS
ListenerTlsSdsCertificate -> String
(Int -> ListenerTlsSdsCertificate -> ShowS)
-> (ListenerTlsSdsCertificate -> String)
-> ([ListenerTlsSdsCertificate] -> ShowS)
-> Show ListenerTlsSdsCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListenerTlsSdsCertificate] -> ShowS
$cshowList :: [ListenerTlsSdsCertificate] -> ShowS
show :: ListenerTlsSdsCertificate -> String
$cshow :: ListenerTlsSdsCertificate -> String
showsPrec :: Int -> ListenerTlsSdsCertificate -> ShowS
$cshowsPrec :: Int -> ListenerTlsSdsCertificate -> ShowS
Prelude.Show, (forall x.
 ListenerTlsSdsCertificate -> Rep ListenerTlsSdsCertificate x)
-> (forall x.
    Rep ListenerTlsSdsCertificate x -> ListenerTlsSdsCertificate)
-> Generic ListenerTlsSdsCertificate
forall x.
Rep ListenerTlsSdsCertificate x -> ListenerTlsSdsCertificate
forall x.
ListenerTlsSdsCertificate -> Rep ListenerTlsSdsCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListenerTlsSdsCertificate x -> ListenerTlsSdsCertificate
$cfrom :: forall x.
ListenerTlsSdsCertificate -> Rep ListenerTlsSdsCertificate x
Prelude.Generic)

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

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

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

instance Prelude.Hashable ListenerTlsSdsCertificate

instance Prelude.NFData ListenerTlsSdsCertificate

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