{-# 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.TlsValidationContextAcmTrust
-- 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.TlsValidationContextAcmTrust 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 an Certificate Manager certificate.
--
-- /See:/ 'newTlsValidationContextAcmTrust' smart constructor.
data TlsValidationContextAcmTrust = TlsValidationContextAcmTrust'
  { -- | One or more ACM Amazon Resource Name (ARN)s.
    TlsValidationContextAcmTrust -> NonEmpty Text
certificateAuthorityArns :: Prelude.NonEmpty Prelude.Text
  }
  deriving (TlsValidationContextAcmTrust
-> TlsValidationContextAcmTrust -> Bool
(TlsValidationContextAcmTrust
 -> TlsValidationContextAcmTrust -> Bool)
-> (TlsValidationContextAcmTrust
    -> TlsValidationContextAcmTrust -> Bool)
-> Eq TlsValidationContextAcmTrust
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TlsValidationContextAcmTrust
-> TlsValidationContextAcmTrust -> Bool
$c/= :: TlsValidationContextAcmTrust
-> TlsValidationContextAcmTrust -> Bool
== :: TlsValidationContextAcmTrust
-> TlsValidationContextAcmTrust -> Bool
$c== :: TlsValidationContextAcmTrust
-> TlsValidationContextAcmTrust -> Bool
Prelude.Eq, ReadPrec [TlsValidationContextAcmTrust]
ReadPrec TlsValidationContextAcmTrust
Int -> ReadS TlsValidationContextAcmTrust
ReadS [TlsValidationContextAcmTrust]
(Int -> ReadS TlsValidationContextAcmTrust)
-> ReadS [TlsValidationContextAcmTrust]
-> ReadPrec TlsValidationContextAcmTrust
-> ReadPrec [TlsValidationContextAcmTrust]
-> Read TlsValidationContextAcmTrust
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TlsValidationContextAcmTrust]
$creadListPrec :: ReadPrec [TlsValidationContextAcmTrust]
readPrec :: ReadPrec TlsValidationContextAcmTrust
$creadPrec :: ReadPrec TlsValidationContextAcmTrust
readList :: ReadS [TlsValidationContextAcmTrust]
$creadList :: ReadS [TlsValidationContextAcmTrust]
readsPrec :: Int -> ReadS TlsValidationContextAcmTrust
$creadsPrec :: Int -> ReadS TlsValidationContextAcmTrust
Prelude.Read, Int -> TlsValidationContextAcmTrust -> ShowS
[TlsValidationContextAcmTrust] -> ShowS
TlsValidationContextAcmTrust -> String
(Int -> TlsValidationContextAcmTrust -> ShowS)
-> (TlsValidationContextAcmTrust -> String)
-> ([TlsValidationContextAcmTrust] -> ShowS)
-> Show TlsValidationContextAcmTrust
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TlsValidationContextAcmTrust] -> ShowS
$cshowList :: [TlsValidationContextAcmTrust] -> ShowS
show :: TlsValidationContextAcmTrust -> String
$cshow :: TlsValidationContextAcmTrust -> String
showsPrec :: Int -> TlsValidationContextAcmTrust -> ShowS
$cshowsPrec :: Int -> TlsValidationContextAcmTrust -> ShowS
Prelude.Show, (forall x.
 TlsValidationContextAcmTrust -> Rep TlsValidationContextAcmTrust x)
-> (forall x.
    Rep TlsValidationContextAcmTrust x -> TlsValidationContextAcmTrust)
-> Generic TlsValidationContextAcmTrust
forall x.
Rep TlsValidationContextAcmTrust x -> TlsValidationContextAcmTrust
forall x.
TlsValidationContextAcmTrust -> Rep TlsValidationContextAcmTrust x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TlsValidationContextAcmTrust x -> TlsValidationContextAcmTrust
$cfrom :: forall x.
TlsValidationContextAcmTrust -> Rep TlsValidationContextAcmTrust x
Prelude.Generic)

-- |
-- Create a value of 'TlsValidationContextAcmTrust' 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:
--
-- 'certificateAuthorityArns', 'tlsValidationContextAcmTrust_certificateAuthorityArns' - One or more ACM Amazon Resource Name (ARN)s.
newTlsValidationContextAcmTrust ::
  -- | 'certificateAuthorityArns'
  Prelude.NonEmpty Prelude.Text ->
  TlsValidationContextAcmTrust
newTlsValidationContextAcmTrust :: NonEmpty Text -> TlsValidationContextAcmTrust
newTlsValidationContextAcmTrust
  NonEmpty Text
pCertificateAuthorityArns_ =
    TlsValidationContextAcmTrust' :: NonEmpty Text -> TlsValidationContextAcmTrust
TlsValidationContextAcmTrust'
      { $sel:certificateAuthorityArns:TlsValidationContextAcmTrust' :: NonEmpty Text
certificateAuthorityArns =
          Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
            (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pCertificateAuthorityArns_
      }

-- | One or more ACM Amazon Resource Name (ARN)s.
tlsValidationContextAcmTrust_certificateAuthorityArns :: Lens.Lens' TlsValidationContextAcmTrust (Prelude.NonEmpty Prelude.Text)
tlsValidationContextAcmTrust_certificateAuthorityArns :: (NonEmpty Text -> f (NonEmpty Text))
-> TlsValidationContextAcmTrust -> f TlsValidationContextAcmTrust
tlsValidationContextAcmTrust_certificateAuthorityArns = (TlsValidationContextAcmTrust -> NonEmpty Text)
-> (TlsValidationContextAcmTrust
    -> NonEmpty Text -> TlsValidationContextAcmTrust)
-> Lens
     TlsValidationContextAcmTrust
     TlsValidationContextAcmTrust
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TlsValidationContextAcmTrust' {NonEmpty Text
certificateAuthorityArns :: NonEmpty Text
$sel:certificateAuthorityArns:TlsValidationContextAcmTrust' :: TlsValidationContextAcmTrust -> NonEmpty Text
certificateAuthorityArns} -> NonEmpty Text
certificateAuthorityArns) (\s :: TlsValidationContextAcmTrust
s@TlsValidationContextAcmTrust' {} NonEmpty Text
a -> TlsValidationContextAcmTrust
s {$sel:certificateAuthorityArns:TlsValidationContextAcmTrust' :: NonEmpty Text
certificateAuthorityArns = NonEmpty Text
a} :: TlsValidationContextAcmTrust) ((NonEmpty Text -> f (NonEmpty Text))
 -> TlsValidationContextAcmTrust -> f TlsValidationContextAcmTrust)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> TlsValidationContextAcmTrust
-> f TlsValidationContextAcmTrust
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON TlsValidationContextAcmTrust where
  parseJSON :: Value -> Parser TlsValidationContextAcmTrust
parseJSON =
    String
-> (Object -> Parser TlsValidationContextAcmTrust)
-> Value
-> Parser TlsValidationContextAcmTrust
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TlsValidationContextAcmTrust"
      ( \Object
x ->
          NonEmpty Text -> TlsValidationContextAcmTrust
TlsValidationContextAcmTrust'
            (NonEmpty Text -> TlsValidationContextAcmTrust)
-> Parser (NonEmpty Text) -> Parser TlsValidationContextAcmTrust
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"certificateAuthorityArns")
      )

instance
  Prelude.Hashable
    TlsValidationContextAcmTrust

instance Prelude.NFData TlsValidationContextAcmTrust

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