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

import Amazonka.AppMesh.Types.VirtualGatewayTlsValidationContextAcmTrust
import Amazonka.AppMesh.Types.VirtualGatewayTlsValidationContextFileTrust
import Amazonka.AppMesh.Types.VirtualGatewayTlsValidationContextSdsTrust
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.
--
-- /See:/ 'newVirtualGatewayTlsValidationContextTrust' smart constructor.
data VirtualGatewayTlsValidationContextTrust = VirtualGatewayTlsValidationContextTrust'
  { -- | A reference to an object that represents a Transport Layer Security
    -- (TLS) validation context trust for an Certificate Manager certificate.
    VirtualGatewayTlsValidationContextTrust
-> Maybe VirtualGatewayTlsValidationContextAcmTrust
acm :: Prelude.Maybe VirtualGatewayTlsValidationContextAcmTrust,
    -- | A reference to an object that represents a virtual gateway\'s Transport
    -- Layer Security (TLS) Secret Discovery Service validation context trust.
    VirtualGatewayTlsValidationContextTrust
-> Maybe VirtualGatewayTlsValidationContextSdsTrust
sds :: Prelude.Maybe VirtualGatewayTlsValidationContextSdsTrust,
    -- | An object that represents a Transport Layer Security (TLS) validation
    -- context trust for a local file.
    VirtualGatewayTlsValidationContextTrust
-> Maybe VirtualGatewayTlsValidationContextFileTrust
file :: Prelude.Maybe VirtualGatewayTlsValidationContextFileTrust
  }
  deriving (VirtualGatewayTlsValidationContextTrust
-> VirtualGatewayTlsValidationContextTrust -> Bool
(VirtualGatewayTlsValidationContextTrust
 -> VirtualGatewayTlsValidationContextTrust -> Bool)
-> (VirtualGatewayTlsValidationContextTrust
    -> VirtualGatewayTlsValidationContextTrust -> Bool)
-> Eq VirtualGatewayTlsValidationContextTrust
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualGatewayTlsValidationContextTrust
-> VirtualGatewayTlsValidationContextTrust -> Bool
$c/= :: VirtualGatewayTlsValidationContextTrust
-> VirtualGatewayTlsValidationContextTrust -> Bool
== :: VirtualGatewayTlsValidationContextTrust
-> VirtualGatewayTlsValidationContextTrust -> Bool
$c== :: VirtualGatewayTlsValidationContextTrust
-> VirtualGatewayTlsValidationContextTrust -> Bool
Prelude.Eq, ReadPrec [VirtualGatewayTlsValidationContextTrust]
ReadPrec VirtualGatewayTlsValidationContextTrust
Int -> ReadS VirtualGatewayTlsValidationContextTrust
ReadS [VirtualGatewayTlsValidationContextTrust]
(Int -> ReadS VirtualGatewayTlsValidationContextTrust)
-> ReadS [VirtualGatewayTlsValidationContextTrust]
-> ReadPrec VirtualGatewayTlsValidationContextTrust
-> ReadPrec [VirtualGatewayTlsValidationContextTrust]
-> Read VirtualGatewayTlsValidationContextTrust
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualGatewayTlsValidationContextTrust]
$creadListPrec :: ReadPrec [VirtualGatewayTlsValidationContextTrust]
readPrec :: ReadPrec VirtualGatewayTlsValidationContextTrust
$creadPrec :: ReadPrec VirtualGatewayTlsValidationContextTrust
readList :: ReadS [VirtualGatewayTlsValidationContextTrust]
$creadList :: ReadS [VirtualGatewayTlsValidationContextTrust]
readsPrec :: Int -> ReadS VirtualGatewayTlsValidationContextTrust
$creadsPrec :: Int -> ReadS VirtualGatewayTlsValidationContextTrust
Prelude.Read, Int -> VirtualGatewayTlsValidationContextTrust -> ShowS
[VirtualGatewayTlsValidationContextTrust] -> ShowS
VirtualGatewayTlsValidationContextTrust -> String
(Int -> VirtualGatewayTlsValidationContextTrust -> ShowS)
-> (VirtualGatewayTlsValidationContextTrust -> String)
-> ([VirtualGatewayTlsValidationContextTrust] -> ShowS)
-> Show VirtualGatewayTlsValidationContextTrust
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualGatewayTlsValidationContextTrust] -> ShowS
$cshowList :: [VirtualGatewayTlsValidationContextTrust] -> ShowS
show :: VirtualGatewayTlsValidationContextTrust -> String
$cshow :: VirtualGatewayTlsValidationContextTrust -> String
showsPrec :: Int -> VirtualGatewayTlsValidationContextTrust -> ShowS
$cshowsPrec :: Int -> VirtualGatewayTlsValidationContextTrust -> ShowS
Prelude.Show, (forall x.
 VirtualGatewayTlsValidationContextTrust
 -> Rep VirtualGatewayTlsValidationContextTrust x)
-> (forall x.
    Rep VirtualGatewayTlsValidationContextTrust x
    -> VirtualGatewayTlsValidationContextTrust)
-> Generic VirtualGatewayTlsValidationContextTrust
forall x.
Rep VirtualGatewayTlsValidationContextTrust x
-> VirtualGatewayTlsValidationContextTrust
forall x.
VirtualGatewayTlsValidationContextTrust
-> Rep VirtualGatewayTlsValidationContextTrust x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VirtualGatewayTlsValidationContextTrust x
-> VirtualGatewayTlsValidationContextTrust
$cfrom :: forall x.
VirtualGatewayTlsValidationContextTrust
-> Rep VirtualGatewayTlsValidationContextTrust x
Prelude.Generic)

-- |
-- Create a value of 'VirtualGatewayTlsValidationContextTrust' 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:
--
-- 'acm', 'virtualGatewayTlsValidationContextTrust_acm' - A reference to an object that represents a Transport Layer Security
-- (TLS) validation context trust for an Certificate Manager certificate.
--
-- 'sds', 'virtualGatewayTlsValidationContextTrust_sds' - A reference to an object that represents a virtual gateway\'s Transport
-- Layer Security (TLS) Secret Discovery Service validation context trust.
--
-- 'file', 'virtualGatewayTlsValidationContextTrust_file' - An object that represents a Transport Layer Security (TLS) validation
-- context trust for a local file.
newVirtualGatewayTlsValidationContextTrust ::
  VirtualGatewayTlsValidationContextTrust
newVirtualGatewayTlsValidationContextTrust :: VirtualGatewayTlsValidationContextTrust
newVirtualGatewayTlsValidationContextTrust =
  VirtualGatewayTlsValidationContextTrust' :: Maybe VirtualGatewayTlsValidationContextAcmTrust
-> Maybe VirtualGatewayTlsValidationContextSdsTrust
-> Maybe VirtualGatewayTlsValidationContextFileTrust
-> VirtualGatewayTlsValidationContextTrust
VirtualGatewayTlsValidationContextTrust'
    { $sel:acm:VirtualGatewayTlsValidationContextTrust' :: Maybe VirtualGatewayTlsValidationContextAcmTrust
acm =
        Maybe VirtualGatewayTlsValidationContextAcmTrust
forall a. Maybe a
Prelude.Nothing,
      $sel:sds:VirtualGatewayTlsValidationContextTrust' :: Maybe VirtualGatewayTlsValidationContextSdsTrust
sds = Maybe VirtualGatewayTlsValidationContextSdsTrust
forall a. Maybe a
Prelude.Nothing,
      $sel:file:VirtualGatewayTlsValidationContextTrust' :: Maybe VirtualGatewayTlsValidationContextFileTrust
file = Maybe VirtualGatewayTlsValidationContextFileTrust
forall a. Maybe a
Prelude.Nothing
    }

-- | A reference to an object that represents a Transport Layer Security
-- (TLS) validation context trust for an Certificate Manager certificate.
virtualGatewayTlsValidationContextTrust_acm :: Lens.Lens' VirtualGatewayTlsValidationContextTrust (Prelude.Maybe VirtualGatewayTlsValidationContextAcmTrust)
virtualGatewayTlsValidationContextTrust_acm :: (Maybe VirtualGatewayTlsValidationContextAcmTrust
 -> f (Maybe VirtualGatewayTlsValidationContextAcmTrust))
-> VirtualGatewayTlsValidationContextTrust
-> f VirtualGatewayTlsValidationContextTrust
virtualGatewayTlsValidationContextTrust_acm = (VirtualGatewayTlsValidationContextTrust
 -> Maybe VirtualGatewayTlsValidationContextAcmTrust)
-> (VirtualGatewayTlsValidationContextTrust
    -> Maybe VirtualGatewayTlsValidationContextAcmTrust
    -> VirtualGatewayTlsValidationContextTrust)
-> Lens
     VirtualGatewayTlsValidationContextTrust
     VirtualGatewayTlsValidationContextTrust
     (Maybe VirtualGatewayTlsValidationContextAcmTrust)
     (Maybe VirtualGatewayTlsValidationContextAcmTrust)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayTlsValidationContextTrust' {Maybe VirtualGatewayTlsValidationContextAcmTrust
acm :: Maybe VirtualGatewayTlsValidationContextAcmTrust
$sel:acm:VirtualGatewayTlsValidationContextTrust' :: VirtualGatewayTlsValidationContextTrust
-> Maybe VirtualGatewayTlsValidationContextAcmTrust
acm} -> Maybe VirtualGatewayTlsValidationContextAcmTrust
acm) (\s :: VirtualGatewayTlsValidationContextTrust
s@VirtualGatewayTlsValidationContextTrust' {} Maybe VirtualGatewayTlsValidationContextAcmTrust
a -> VirtualGatewayTlsValidationContextTrust
s {$sel:acm:VirtualGatewayTlsValidationContextTrust' :: Maybe VirtualGatewayTlsValidationContextAcmTrust
acm = Maybe VirtualGatewayTlsValidationContextAcmTrust
a} :: VirtualGatewayTlsValidationContextTrust)

-- | A reference to an object that represents a virtual gateway\'s Transport
-- Layer Security (TLS) Secret Discovery Service validation context trust.
virtualGatewayTlsValidationContextTrust_sds :: Lens.Lens' VirtualGatewayTlsValidationContextTrust (Prelude.Maybe VirtualGatewayTlsValidationContextSdsTrust)
virtualGatewayTlsValidationContextTrust_sds :: (Maybe VirtualGatewayTlsValidationContextSdsTrust
 -> f (Maybe VirtualGatewayTlsValidationContextSdsTrust))
-> VirtualGatewayTlsValidationContextTrust
-> f VirtualGatewayTlsValidationContextTrust
virtualGatewayTlsValidationContextTrust_sds = (VirtualGatewayTlsValidationContextTrust
 -> Maybe VirtualGatewayTlsValidationContextSdsTrust)
-> (VirtualGatewayTlsValidationContextTrust
    -> Maybe VirtualGatewayTlsValidationContextSdsTrust
    -> VirtualGatewayTlsValidationContextTrust)
-> Lens
     VirtualGatewayTlsValidationContextTrust
     VirtualGatewayTlsValidationContextTrust
     (Maybe VirtualGatewayTlsValidationContextSdsTrust)
     (Maybe VirtualGatewayTlsValidationContextSdsTrust)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayTlsValidationContextTrust' {Maybe VirtualGatewayTlsValidationContextSdsTrust
sds :: Maybe VirtualGatewayTlsValidationContextSdsTrust
$sel:sds:VirtualGatewayTlsValidationContextTrust' :: VirtualGatewayTlsValidationContextTrust
-> Maybe VirtualGatewayTlsValidationContextSdsTrust
sds} -> Maybe VirtualGatewayTlsValidationContextSdsTrust
sds) (\s :: VirtualGatewayTlsValidationContextTrust
s@VirtualGatewayTlsValidationContextTrust' {} Maybe VirtualGatewayTlsValidationContextSdsTrust
a -> VirtualGatewayTlsValidationContextTrust
s {$sel:sds:VirtualGatewayTlsValidationContextTrust' :: Maybe VirtualGatewayTlsValidationContextSdsTrust
sds = Maybe VirtualGatewayTlsValidationContextSdsTrust
a} :: VirtualGatewayTlsValidationContextTrust)

-- | An object that represents a Transport Layer Security (TLS) validation
-- context trust for a local file.
virtualGatewayTlsValidationContextTrust_file :: Lens.Lens' VirtualGatewayTlsValidationContextTrust (Prelude.Maybe VirtualGatewayTlsValidationContextFileTrust)
virtualGatewayTlsValidationContextTrust_file :: (Maybe VirtualGatewayTlsValidationContextFileTrust
 -> f (Maybe VirtualGatewayTlsValidationContextFileTrust))
-> VirtualGatewayTlsValidationContextTrust
-> f VirtualGatewayTlsValidationContextTrust
virtualGatewayTlsValidationContextTrust_file = (VirtualGatewayTlsValidationContextTrust
 -> Maybe VirtualGatewayTlsValidationContextFileTrust)
-> (VirtualGatewayTlsValidationContextTrust
    -> Maybe VirtualGatewayTlsValidationContextFileTrust
    -> VirtualGatewayTlsValidationContextTrust)
-> Lens
     VirtualGatewayTlsValidationContextTrust
     VirtualGatewayTlsValidationContextTrust
     (Maybe VirtualGatewayTlsValidationContextFileTrust)
     (Maybe VirtualGatewayTlsValidationContextFileTrust)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayTlsValidationContextTrust' {Maybe VirtualGatewayTlsValidationContextFileTrust
file :: Maybe VirtualGatewayTlsValidationContextFileTrust
$sel:file:VirtualGatewayTlsValidationContextTrust' :: VirtualGatewayTlsValidationContextTrust
-> Maybe VirtualGatewayTlsValidationContextFileTrust
file} -> Maybe VirtualGatewayTlsValidationContextFileTrust
file) (\s :: VirtualGatewayTlsValidationContextTrust
s@VirtualGatewayTlsValidationContextTrust' {} Maybe VirtualGatewayTlsValidationContextFileTrust
a -> VirtualGatewayTlsValidationContextTrust
s {$sel:file:VirtualGatewayTlsValidationContextTrust' :: Maybe VirtualGatewayTlsValidationContextFileTrust
file = Maybe VirtualGatewayTlsValidationContextFileTrust
a} :: VirtualGatewayTlsValidationContextTrust)

instance
  Core.FromJSON
    VirtualGatewayTlsValidationContextTrust
  where
  parseJSON :: Value -> Parser VirtualGatewayTlsValidationContextTrust
parseJSON =
    String
-> (Object -> Parser VirtualGatewayTlsValidationContextTrust)
-> Value
-> Parser VirtualGatewayTlsValidationContextTrust
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualGatewayTlsValidationContextTrust"
      ( \Object
x ->
          Maybe VirtualGatewayTlsValidationContextAcmTrust
-> Maybe VirtualGatewayTlsValidationContextSdsTrust
-> Maybe VirtualGatewayTlsValidationContextFileTrust
-> VirtualGatewayTlsValidationContextTrust
VirtualGatewayTlsValidationContextTrust'
            (Maybe VirtualGatewayTlsValidationContextAcmTrust
 -> Maybe VirtualGatewayTlsValidationContextSdsTrust
 -> Maybe VirtualGatewayTlsValidationContextFileTrust
 -> VirtualGatewayTlsValidationContextTrust)
-> Parser (Maybe VirtualGatewayTlsValidationContextAcmTrust)
-> Parser
     (Maybe VirtualGatewayTlsValidationContextSdsTrust
      -> Maybe VirtualGatewayTlsValidationContextFileTrust
      -> VirtualGatewayTlsValidationContextTrust)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser (Maybe VirtualGatewayTlsValidationContextAcmTrust)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"acm")
            Parser
  (Maybe VirtualGatewayTlsValidationContextSdsTrust
   -> Maybe VirtualGatewayTlsValidationContextFileTrust
   -> VirtualGatewayTlsValidationContextTrust)
-> Parser (Maybe VirtualGatewayTlsValidationContextSdsTrust)
-> Parser
     (Maybe VirtualGatewayTlsValidationContextFileTrust
      -> VirtualGatewayTlsValidationContextTrust)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser (Maybe VirtualGatewayTlsValidationContextSdsTrust)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sds")
            Parser
  (Maybe VirtualGatewayTlsValidationContextFileTrust
   -> VirtualGatewayTlsValidationContextTrust)
-> Parser (Maybe VirtualGatewayTlsValidationContextFileTrust)
-> Parser VirtualGatewayTlsValidationContextTrust
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser (Maybe VirtualGatewayTlsValidationContextFileTrust)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"file")
      )

instance
  Prelude.Hashable
    VirtualGatewayTlsValidationContextTrust

instance
  Prelude.NFData
    VirtualGatewayTlsValidationContextTrust

instance
  Core.ToJSON
    VirtualGatewayTlsValidationContextTrust
  where
  toJSON :: VirtualGatewayTlsValidationContextTrust -> Value
toJSON VirtualGatewayTlsValidationContextTrust' {Maybe VirtualGatewayTlsValidationContextAcmTrust
Maybe VirtualGatewayTlsValidationContextFileTrust
Maybe VirtualGatewayTlsValidationContextSdsTrust
file :: Maybe VirtualGatewayTlsValidationContextFileTrust
sds :: Maybe VirtualGatewayTlsValidationContextSdsTrust
acm :: Maybe VirtualGatewayTlsValidationContextAcmTrust
$sel:file:VirtualGatewayTlsValidationContextTrust' :: VirtualGatewayTlsValidationContextTrust
-> Maybe VirtualGatewayTlsValidationContextFileTrust
$sel:sds:VirtualGatewayTlsValidationContextTrust' :: VirtualGatewayTlsValidationContextTrust
-> Maybe VirtualGatewayTlsValidationContextSdsTrust
$sel:acm:VirtualGatewayTlsValidationContextTrust' :: VirtualGatewayTlsValidationContextTrust
-> Maybe VirtualGatewayTlsValidationContextAcmTrust
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"acm" Text -> VirtualGatewayTlsValidationContextAcmTrust -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VirtualGatewayTlsValidationContextAcmTrust -> Pair)
-> Maybe VirtualGatewayTlsValidationContextAcmTrust -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VirtualGatewayTlsValidationContextAcmTrust
acm,
            (Text
"sds" Text -> VirtualGatewayTlsValidationContextSdsTrust -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VirtualGatewayTlsValidationContextSdsTrust -> Pair)
-> Maybe VirtualGatewayTlsValidationContextSdsTrust -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VirtualGatewayTlsValidationContextSdsTrust
sds,
            (Text
"file" Text -> VirtualGatewayTlsValidationContextFileTrust -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VirtualGatewayTlsValidationContextFileTrust -> Pair)
-> Maybe VirtualGatewayTlsValidationContextFileTrust -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VirtualGatewayTlsValidationContextFileTrust
file
          ]
      )