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

-- |
-- Create a value of 'VirtualGatewayTlsValidationContextFileTrust' 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', 'virtualGatewayTlsValidationContextFileTrust_certificateChain' - The certificate trust chain for a certificate stored on the file system
-- of the virtual node that the proxy is running on.
newVirtualGatewayTlsValidationContextFileTrust ::
  -- | 'certificateChain'
  Prelude.Text ->
  VirtualGatewayTlsValidationContextFileTrust
newVirtualGatewayTlsValidationContextFileTrust :: Text -> VirtualGatewayTlsValidationContextFileTrust
newVirtualGatewayTlsValidationContextFileTrust
  Text
pCertificateChain_ =
    VirtualGatewayTlsValidationContextFileTrust' :: Text -> VirtualGatewayTlsValidationContextFileTrust
VirtualGatewayTlsValidationContextFileTrust'
      { $sel:certificateChain:VirtualGatewayTlsValidationContextFileTrust' :: 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.
virtualGatewayTlsValidationContextFileTrust_certificateChain :: Lens.Lens' VirtualGatewayTlsValidationContextFileTrust Prelude.Text
virtualGatewayTlsValidationContextFileTrust_certificateChain :: (Text -> f Text)
-> VirtualGatewayTlsValidationContextFileTrust
-> f VirtualGatewayTlsValidationContextFileTrust
virtualGatewayTlsValidationContextFileTrust_certificateChain = (VirtualGatewayTlsValidationContextFileTrust -> Text)
-> (VirtualGatewayTlsValidationContextFileTrust
    -> Text -> VirtualGatewayTlsValidationContextFileTrust)
-> Lens
     VirtualGatewayTlsValidationContextFileTrust
     VirtualGatewayTlsValidationContextFileTrust
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayTlsValidationContextFileTrust' {Text
certificateChain :: Text
$sel:certificateChain:VirtualGatewayTlsValidationContextFileTrust' :: VirtualGatewayTlsValidationContextFileTrust -> Text
certificateChain} -> Text
certificateChain) (\s :: VirtualGatewayTlsValidationContextFileTrust
s@VirtualGatewayTlsValidationContextFileTrust' {} Text
a -> VirtualGatewayTlsValidationContextFileTrust
s {$sel:certificateChain:VirtualGatewayTlsValidationContextFileTrust' :: Text
certificateChain = Text
a} :: VirtualGatewayTlsValidationContextFileTrust)

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

instance
  Prelude.NFData
    VirtualGatewayTlsValidationContextFileTrust

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