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

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

-- |
-- Create a value of 'TlsValidationContextTrust' 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', 'tlsValidationContextTrust_acm' - A reference to an object that represents a Transport Layer Security
-- (TLS) validation context trust for an Certificate Manager certificate.
--
-- 'sds', 'tlsValidationContextTrust_sds' - A reference to an object that represents a Transport Layer Security
-- (TLS) Secret Discovery Service validation context trust.
--
-- 'file', 'tlsValidationContextTrust_file' - An object that represents a Transport Layer Security (TLS) validation
-- context trust for a local file.
newTlsValidationContextTrust ::
  TlsValidationContextTrust
newTlsValidationContextTrust :: TlsValidationContextTrust
newTlsValidationContextTrust =
  TlsValidationContextTrust' :: Maybe TlsValidationContextAcmTrust
-> Maybe TlsValidationContextSdsTrust
-> Maybe TlsValidationContextFileTrust
-> TlsValidationContextTrust
TlsValidationContextTrust'
    { $sel:acm:TlsValidationContextTrust' :: Maybe TlsValidationContextAcmTrust
acm = Maybe TlsValidationContextAcmTrust
forall a. Maybe a
Prelude.Nothing,
      $sel:sds:TlsValidationContextTrust' :: Maybe TlsValidationContextSdsTrust
sds = Maybe TlsValidationContextSdsTrust
forall a. Maybe a
Prelude.Nothing,
      $sel:file:TlsValidationContextTrust' :: Maybe TlsValidationContextFileTrust
file = Maybe TlsValidationContextFileTrust
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.
tlsValidationContextTrust_acm :: Lens.Lens' TlsValidationContextTrust (Prelude.Maybe TlsValidationContextAcmTrust)
tlsValidationContextTrust_acm :: (Maybe TlsValidationContextAcmTrust
 -> f (Maybe TlsValidationContextAcmTrust))
-> TlsValidationContextTrust -> f TlsValidationContextTrust
tlsValidationContextTrust_acm = (TlsValidationContextTrust -> Maybe TlsValidationContextAcmTrust)
-> (TlsValidationContextTrust
    -> Maybe TlsValidationContextAcmTrust -> TlsValidationContextTrust)
-> Lens
     TlsValidationContextTrust
     TlsValidationContextTrust
     (Maybe TlsValidationContextAcmTrust)
     (Maybe TlsValidationContextAcmTrust)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TlsValidationContextTrust' {Maybe TlsValidationContextAcmTrust
acm :: Maybe TlsValidationContextAcmTrust
$sel:acm:TlsValidationContextTrust' :: TlsValidationContextTrust -> Maybe TlsValidationContextAcmTrust
acm} -> Maybe TlsValidationContextAcmTrust
acm) (\s :: TlsValidationContextTrust
s@TlsValidationContextTrust' {} Maybe TlsValidationContextAcmTrust
a -> TlsValidationContextTrust
s {$sel:acm:TlsValidationContextTrust' :: Maybe TlsValidationContextAcmTrust
acm = Maybe TlsValidationContextAcmTrust
a} :: TlsValidationContextTrust)

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

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

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

instance Prelude.Hashable TlsValidationContextTrust

instance Prelude.NFData TlsValidationContextTrust

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