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

import Amazonka.AppMesh.Types.SubjectAlternativeNameMatchers
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 subject alternative names secured by the
-- certificate.
--
-- /See:/ 'newSubjectAlternativeNames' smart constructor.
data SubjectAlternativeNames = SubjectAlternativeNames'
  { -- | An object that represents the criteria for determining a SANs match.
    SubjectAlternativeNames -> SubjectAlternativeNameMatchers
match :: SubjectAlternativeNameMatchers
  }
  deriving (SubjectAlternativeNames -> SubjectAlternativeNames -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubjectAlternativeNames -> SubjectAlternativeNames -> Bool
$c/= :: SubjectAlternativeNames -> SubjectAlternativeNames -> Bool
== :: SubjectAlternativeNames -> SubjectAlternativeNames -> Bool
$c== :: SubjectAlternativeNames -> SubjectAlternativeNames -> Bool
Prelude.Eq, ReadPrec [SubjectAlternativeNames]
ReadPrec SubjectAlternativeNames
Int -> ReadS SubjectAlternativeNames
ReadS [SubjectAlternativeNames]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubjectAlternativeNames]
$creadListPrec :: ReadPrec [SubjectAlternativeNames]
readPrec :: ReadPrec SubjectAlternativeNames
$creadPrec :: ReadPrec SubjectAlternativeNames
readList :: ReadS [SubjectAlternativeNames]
$creadList :: ReadS [SubjectAlternativeNames]
readsPrec :: Int -> ReadS SubjectAlternativeNames
$creadsPrec :: Int -> ReadS SubjectAlternativeNames
Prelude.Read, Int -> SubjectAlternativeNames -> ShowS
[SubjectAlternativeNames] -> ShowS
SubjectAlternativeNames -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubjectAlternativeNames] -> ShowS
$cshowList :: [SubjectAlternativeNames] -> ShowS
show :: SubjectAlternativeNames -> String
$cshow :: SubjectAlternativeNames -> String
showsPrec :: Int -> SubjectAlternativeNames -> ShowS
$cshowsPrec :: Int -> SubjectAlternativeNames -> ShowS
Prelude.Show, forall x. Rep SubjectAlternativeNames x -> SubjectAlternativeNames
forall x. SubjectAlternativeNames -> Rep SubjectAlternativeNames x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubjectAlternativeNames x -> SubjectAlternativeNames
$cfrom :: forall x. SubjectAlternativeNames -> Rep SubjectAlternativeNames x
Prelude.Generic)

-- |
-- Create a value of 'SubjectAlternativeNames' 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:
--
-- 'match', 'subjectAlternativeNames_match' - An object that represents the criteria for determining a SANs match.
newSubjectAlternativeNames ::
  -- | 'match'
  SubjectAlternativeNameMatchers ->
  SubjectAlternativeNames
newSubjectAlternativeNames :: SubjectAlternativeNameMatchers -> SubjectAlternativeNames
newSubjectAlternativeNames SubjectAlternativeNameMatchers
pMatch_ =
  SubjectAlternativeNames' {$sel:match:SubjectAlternativeNames' :: SubjectAlternativeNameMatchers
match = SubjectAlternativeNameMatchers
pMatch_}

-- | An object that represents the criteria for determining a SANs match.
subjectAlternativeNames_match :: Lens.Lens' SubjectAlternativeNames SubjectAlternativeNameMatchers
subjectAlternativeNames_match :: Lens' SubjectAlternativeNames SubjectAlternativeNameMatchers
subjectAlternativeNames_match = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubjectAlternativeNames' {SubjectAlternativeNameMatchers
match :: SubjectAlternativeNameMatchers
$sel:match:SubjectAlternativeNames' :: SubjectAlternativeNames -> SubjectAlternativeNameMatchers
match} -> SubjectAlternativeNameMatchers
match) (\s :: SubjectAlternativeNames
s@SubjectAlternativeNames' {} SubjectAlternativeNameMatchers
a -> SubjectAlternativeNames
s {$sel:match:SubjectAlternativeNames' :: SubjectAlternativeNameMatchers
match = SubjectAlternativeNameMatchers
a} :: SubjectAlternativeNames)

instance Data.FromJSON SubjectAlternativeNames where
  parseJSON :: Value -> Parser SubjectAlternativeNames
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SubjectAlternativeNames"
      ( \Object
x ->
          SubjectAlternativeNameMatchers -> SubjectAlternativeNames
SubjectAlternativeNames'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"match")
      )

instance Prelude.Hashable SubjectAlternativeNames where
  hashWithSalt :: Int -> SubjectAlternativeNames -> Int
hashWithSalt Int
_salt SubjectAlternativeNames' {SubjectAlternativeNameMatchers
match :: SubjectAlternativeNameMatchers
$sel:match:SubjectAlternativeNames' :: SubjectAlternativeNames -> SubjectAlternativeNameMatchers
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SubjectAlternativeNameMatchers
match

instance Prelude.NFData SubjectAlternativeNames where
  rnf :: SubjectAlternativeNames -> ()
rnf SubjectAlternativeNames' {SubjectAlternativeNameMatchers
match :: SubjectAlternativeNameMatchers
$sel:match:SubjectAlternativeNames' :: SubjectAlternativeNames -> SubjectAlternativeNameMatchers
..} = forall a. NFData a => a -> ()
Prelude.rnf SubjectAlternativeNameMatchers
match

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