{-# 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.SubjectAlternativeNameMatchers
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppMesh.Types.SubjectAlternativeNameMatchers where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | An object that represents the methods by which a subject alternative
-- name on a peer Transport Layer Security (TLS) certificate can be
-- matched.
--
-- /See:/ 'newSubjectAlternativeNameMatchers' smart constructor.
data SubjectAlternativeNameMatchers = SubjectAlternativeNameMatchers'
  { -- | The values sent must match the specified values exactly.
    SubjectAlternativeNameMatchers -> [Text]
exact :: [Prelude.Text]
  }
  deriving (SubjectAlternativeNameMatchers
-> SubjectAlternativeNameMatchers -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubjectAlternativeNameMatchers
-> SubjectAlternativeNameMatchers -> Bool
$c/= :: SubjectAlternativeNameMatchers
-> SubjectAlternativeNameMatchers -> Bool
== :: SubjectAlternativeNameMatchers
-> SubjectAlternativeNameMatchers -> Bool
$c== :: SubjectAlternativeNameMatchers
-> SubjectAlternativeNameMatchers -> Bool
Prelude.Eq, ReadPrec [SubjectAlternativeNameMatchers]
ReadPrec SubjectAlternativeNameMatchers
Int -> ReadS SubjectAlternativeNameMatchers
ReadS [SubjectAlternativeNameMatchers]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubjectAlternativeNameMatchers]
$creadListPrec :: ReadPrec [SubjectAlternativeNameMatchers]
readPrec :: ReadPrec SubjectAlternativeNameMatchers
$creadPrec :: ReadPrec SubjectAlternativeNameMatchers
readList :: ReadS [SubjectAlternativeNameMatchers]
$creadList :: ReadS [SubjectAlternativeNameMatchers]
readsPrec :: Int -> ReadS SubjectAlternativeNameMatchers
$creadsPrec :: Int -> ReadS SubjectAlternativeNameMatchers
Prelude.Read, Int -> SubjectAlternativeNameMatchers -> ShowS
[SubjectAlternativeNameMatchers] -> ShowS
SubjectAlternativeNameMatchers -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubjectAlternativeNameMatchers] -> ShowS
$cshowList :: [SubjectAlternativeNameMatchers] -> ShowS
show :: SubjectAlternativeNameMatchers -> String
$cshow :: SubjectAlternativeNameMatchers -> String
showsPrec :: Int -> SubjectAlternativeNameMatchers -> ShowS
$cshowsPrec :: Int -> SubjectAlternativeNameMatchers -> ShowS
Prelude.Show, forall x.
Rep SubjectAlternativeNameMatchers x
-> SubjectAlternativeNameMatchers
forall x.
SubjectAlternativeNameMatchers
-> Rep SubjectAlternativeNameMatchers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SubjectAlternativeNameMatchers x
-> SubjectAlternativeNameMatchers
$cfrom :: forall x.
SubjectAlternativeNameMatchers
-> Rep SubjectAlternativeNameMatchers x
Prelude.Generic)

-- |
-- Create a value of 'SubjectAlternativeNameMatchers' 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:
--
-- 'exact', 'subjectAlternativeNameMatchers_exact' - The values sent must match the specified values exactly.
newSubjectAlternativeNameMatchers ::
  SubjectAlternativeNameMatchers
newSubjectAlternativeNameMatchers :: SubjectAlternativeNameMatchers
newSubjectAlternativeNameMatchers =
  SubjectAlternativeNameMatchers'
    { $sel:exact:SubjectAlternativeNameMatchers' :: [Text]
exact =
        forall a. Monoid a => a
Prelude.mempty
    }

-- | The values sent must match the specified values exactly.
subjectAlternativeNameMatchers_exact :: Lens.Lens' SubjectAlternativeNameMatchers [Prelude.Text]
subjectAlternativeNameMatchers_exact :: Lens' SubjectAlternativeNameMatchers [Text]
subjectAlternativeNameMatchers_exact = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubjectAlternativeNameMatchers' {[Text]
exact :: [Text]
$sel:exact:SubjectAlternativeNameMatchers' :: SubjectAlternativeNameMatchers -> [Text]
exact} -> [Text]
exact) (\s :: SubjectAlternativeNameMatchers
s@SubjectAlternativeNameMatchers' {} [Text]
a -> SubjectAlternativeNameMatchers
s {$sel:exact:SubjectAlternativeNameMatchers' :: [Text]
exact = [Text]
a} :: SubjectAlternativeNameMatchers) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON SubjectAlternativeNameMatchers where
  parseJSON :: Value -> Parser SubjectAlternativeNameMatchers
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SubjectAlternativeNameMatchers"
      ( \Object
x ->
          [Text] -> SubjectAlternativeNameMatchers
SubjectAlternativeNameMatchers'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"exact" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    SubjectAlternativeNameMatchers
  where
  hashWithSalt :: Int -> SubjectAlternativeNameMatchers -> Int
hashWithSalt
    Int
_salt
    SubjectAlternativeNameMatchers' {[Text]
exact :: [Text]
$sel:exact:SubjectAlternativeNameMatchers' :: SubjectAlternativeNameMatchers -> [Text]
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
exact

instance
  Prelude.NFData
    SubjectAlternativeNameMatchers
  where
  rnf :: SubjectAlternativeNameMatchers -> ()
rnf SubjectAlternativeNameMatchers' {[Text]
exact :: [Text]
$sel:exact:SubjectAlternativeNameMatchers' :: SubjectAlternativeNameMatchers -> [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [Text]
exact

instance Data.ToJSON SubjectAlternativeNameMatchers where
  toJSON :: SubjectAlternativeNameMatchers -> Value
toJSON SubjectAlternativeNameMatchers' {[Text]
exact :: [Text]
$sel:exact:SubjectAlternativeNameMatchers' :: SubjectAlternativeNameMatchers -> [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"exact" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
exact)]
      )