{-# 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.TlsValidationContextFileTrust
-- 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.TlsValidationContextFileTrust 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) validation
-- context trust for a local file.
--
-- /See:/ 'newTlsValidationContextFileTrust' smart constructor.
data TlsValidationContextFileTrust = TlsValidationContextFileTrust'
  { -- | The certificate trust chain for a certificate stored on the file system
    -- of the virtual node that the proxy is running on.
    TlsValidationContextFileTrust -> Text
certificateChain :: Prelude.Text
  }
  deriving (TlsValidationContextFileTrust
-> TlsValidationContextFileTrust -> Bool
(TlsValidationContextFileTrust
 -> TlsValidationContextFileTrust -> Bool)
-> (TlsValidationContextFileTrust
    -> TlsValidationContextFileTrust -> Bool)
-> Eq TlsValidationContextFileTrust
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TlsValidationContextFileTrust
-> TlsValidationContextFileTrust -> Bool
$c/= :: TlsValidationContextFileTrust
-> TlsValidationContextFileTrust -> Bool
== :: TlsValidationContextFileTrust
-> TlsValidationContextFileTrust -> Bool
$c== :: TlsValidationContextFileTrust
-> TlsValidationContextFileTrust -> Bool
Prelude.Eq, ReadPrec [TlsValidationContextFileTrust]
ReadPrec TlsValidationContextFileTrust
Int -> ReadS TlsValidationContextFileTrust
ReadS [TlsValidationContextFileTrust]
(Int -> ReadS TlsValidationContextFileTrust)
-> ReadS [TlsValidationContextFileTrust]
-> ReadPrec TlsValidationContextFileTrust
-> ReadPrec [TlsValidationContextFileTrust]
-> Read TlsValidationContextFileTrust
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TlsValidationContextFileTrust]
$creadListPrec :: ReadPrec [TlsValidationContextFileTrust]
readPrec :: ReadPrec TlsValidationContextFileTrust
$creadPrec :: ReadPrec TlsValidationContextFileTrust
readList :: ReadS [TlsValidationContextFileTrust]
$creadList :: ReadS [TlsValidationContextFileTrust]
readsPrec :: Int -> ReadS TlsValidationContextFileTrust
$creadsPrec :: Int -> ReadS TlsValidationContextFileTrust
Prelude.Read, Int -> TlsValidationContextFileTrust -> ShowS
[TlsValidationContextFileTrust] -> ShowS
TlsValidationContextFileTrust -> String
(Int -> TlsValidationContextFileTrust -> ShowS)
-> (TlsValidationContextFileTrust -> String)
-> ([TlsValidationContextFileTrust] -> ShowS)
-> Show TlsValidationContextFileTrust
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TlsValidationContextFileTrust] -> ShowS
$cshowList :: [TlsValidationContextFileTrust] -> ShowS
show :: TlsValidationContextFileTrust -> String
$cshow :: TlsValidationContextFileTrust -> String
showsPrec :: Int -> TlsValidationContextFileTrust -> ShowS
$cshowsPrec :: Int -> TlsValidationContextFileTrust -> ShowS
Prelude.Show, (forall x.
 TlsValidationContextFileTrust
 -> Rep TlsValidationContextFileTrust x)
-> (forall x.
    Rep TlsValidationContextFileTrust x
    -> TlsValidationContextFileTrust)
-> Generic TlsValidationContextFileTrust
forall x.
Rep TlsValidationContextFileTrust x
-> TlsValidationContextFileTrust
forall x.
TlsValidationContextFileTrust
-> Rep TlsValidationContextFileTrust x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TlsValidationContextFileTrust x
-> TlsValidationContextFileTrust
$cfrom :: forall x.
TlsValidationContextFileTrust
-> Rep TlsValidationContextFileTrust x
Prelude.Generic)

-- |
-- Create a value of 'TlsValidationContextFileTrust' 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:
--
-- 'certificateChain', 'tlsValidationContextFileTrust_certificateChain' - The certificate trust chain for a certificate stored on the file system
-- of the virtual node that the proxy is running on.
newTlsValidationContextFileTrust ::
  -- | 'certificateChain'
  Prelude.Text ->
  TlsValidationContextFileTrust
newTlsValidationContextFileTrust :: Text -> TlsValidationContextFileTrust
newTlsValidationContextFileTrust Text
pCertificateChain_ =
  TlsValidationContextFileTrust' :: Text -> TlsValidationContextFileTrust
TlsValidationContextFileTrust'
    { $sel:certificateChain:TlsValidationContextFileTrust' :: Text
certificateChain =
        Text
pCertificateChain_
    }

-- | The certificate trust chain for a certificate stored on the file system
-- of the virtual node that the proxy is running on.
tlsValidationContextFileTrust_certificateChain :: Lens.Lens' TlsValidationContextFileTrust Prelude.Text
tlsValidationContextFileTrust_certificateChain :: (Text -> f Text)
-> TlsValidationContextFileTrust -> f TlsValidationContextFileTrust
tlsValidationContextFileTrust_certificateChain = (TlsValidationContextFileTrust -> Text)
-> (TlsValidationContextFileTrust
    -> Text -> TlsValidationContextFileTrust)
-> Lens
     TlsValidationContextFileTrust
     TlsValidationContextFileTrust
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TlsValidationContextFileTrust' {Text
certificateChain :: Text
$sel:certificateChain:TlsValidationContextFileTrust' :: TlsValidationContextFileTrust -> Text
certificateChain} -> Text
certificateChain) (\s :: TlsValidationContextFileTrust
s@TlsValidationContextFileTrust' {} Text
a -> TlsValidationContextFileTrust
s {$sel:certificateChain:TlsValidationContextFileTrust' :: Text
certificateChain = Text
a} :: TlsValidationContextFileTrust)

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

instance
  Prelude.Hashable
    TlsValidationContextFileTrust

instance Prelude.NFData TlsValidationContextFileTrust

instance Core.ToJSON TlsValidationContextFileTrust where
  toJSON :: TlsValidationContextFileTrust -> Value
toJSON TlsValidationContextFileTrust' {Text
certificateChain :: Text
$sel:certificateChain:TlsValidationContextFileTrust' :: TlsValidationContextFileTrust -> 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
"certificateChain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateChain)
          ]
      )