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

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

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

-- |
-- Create a value of 'TlsValidationContextSdsTrust' 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', 'tlsValidationContextSdsTrust_secretName' - A reference to an object that represents the name of the secret for a
-- Transport Layer Security (TLS) Secret Discovery Service validation
-- context trust.
newTlsValidationContextSdsTrust ::
  -- | 'secretName'
  Prelude.Text ->
  TlsValidationContextSdsTrust
newTlsValidationContextSdsTrust :: Text -> TlsValidationContextSdsTrust
newTlsValidationContextSdsTrust Text
pSecretName_ =
  TlsValidationContextSdsTrust' :: Text -> TlsValidationContextSdsTrust
TlsValidationContextSdsTrust'
    { $sel:secretName:TlsValidationContextSdsTrust' :: Text
secretName =
        Text
pSecretName_
    }

-- | A reference to an object that represents the name of the secret for a
-- Transport Layer Security (TLS) Secret Discovery Service validation
-- context trust.
tlsValidationContextSdsTrust_secretName :: Lens.Lens' TlsValidationContextSdsTrust Prelude.Text
tlsValidationContextSdsTrust_secretName :: (Text -> f Text)
-> TlsValidationContextSdsTrust -> f TlsValidationContextSdsTrust
tlsValidationContextSdsTrust_secretName = (TlsValidationContextSdsTrust -> Text)
-> (TlsValidationContextSdsTrust
    -> Text -> TlsValidationContextSdsTrust)
-> Lens
     TlsValidationContextSdsTrust TlsValidationContextSdsTrust Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TlsValidationContextSdsTrust' {Text
secretName :: Text
$sel:secretName:TlsValidationContextSdsTrust' :: TlsValidationContextSdsTrust -> Text
secretName} -> Text
secretName) (\s :: TlsValidationContextSdsTrust
s@TlsValidationContextSdsTrust' {} Text
a -> TlsValidationContextSdsTrust
s {$sel:secretName:TlsValidationContextSdsTrust' :: Text
secretName = Text
a} :: TlsValidationContextSdsTrust)

instance Core.FromJSON TlsValidationContextSdsTrust where
  parseJSON :: Value -> Parser TlsValidationContextSdsTrust
parseJSON =
    String
-> (Object -> Parser TlsValidationContextSdsTrust)
-> Value
-> Parser TlsValidationContextSdsTrust
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TlsValidationContextSdsTrust"
      ( \Object
x ->
          Text -> TlsValidationContextSdsTrust
TlsValidationContextSdsTrust'
            (Text -> TlsValidationContextSdsTrust)
-> Parser Text -> Parser TlsValidationContextSdsTrust
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
    TlsValidationContextSdsTrust

instance Prelude.NFData TlsValidationContextSdsTrust

instance Core.ToJSON TlsValidationContextSdsTrust where
  toJSON :: TlsValidationContextSdsTrust -> Value
toJSON TlsValidationContextSdsTrust' {Text
secretName :: Text
$sel:secretName:TlsValidationContextSdsTrust' :: TlsValidationContextSdsTrust -> 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)]
      )