{-# 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.CertificateManagerPCA.Types.ApiPassthrough
-- 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.CertificateManagerPCA.Types.ApiPassthrough where

import Amazonka.CertificateManagerPCA.Types.ASN1Subject
import Amazonka.CertificateManagerPCA.Types.Extensions
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

-- | Contains X.509 certificate information to be placed in an issued
-- certificate. An @APIPassthrough@ or @APICSRPassthrough@ template variant
-- must be selected, or else this parameter is ignored.
--
-- If conflicting or duplicate certificate information is supplied from
-- other sources, Amazon Web Services Private CA applies
-- <https://docs.aws.amazon.com/privateca/latest/userguide/UsingTemplates.html#template-order-of-operations order of operation rules>
-- to determine what information is used.
--
-- /See:/ 'newApiPassthrough' smart constructor.
data ApiPassthrough = ApiPassthrough'
  { -- | Specifies X.509 extension information for a certificate.
    ApiPassthrough -> Maybe Extensions
extensions :: Prelude.Maybe Extensions,
    ApiPassthrough -> Maybe ASN1Subject
subject :: Prelude.Maybe ASN1Subject
  }
  deriving (ApiPassthrough -> ApiPassthrough -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApiPassthrough -> ApiPassthrough -> Bool
$c/= :: ApiPassthrough -> ApiPassthrough -> Bool
== :: ApiPassthrough -> ApiPassthrough -> Bool
$c== :: ApiPassthrough -> ApiPassthrough -> Bool
Prelude.Eq, ReadPrec [ApiPassthrough]
ReadPrec ApiPassthrough
Int -> ReadS ApiPassthrough
ReadS [ApiPassthrough]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApiPassthrough]
$creadListPrec :: ReadPrec [ApiPassthrough]
readPrec :: ReadPrec ApiPassthrough
$creadPrec :: ReadPrec ApiPassthrough
readList :: ReadS [ApiPassthrough]
$creadList :: ReadS [ApiPassthrough]
readsPrec :: Int -> ReadS ApiPassthrough
$creadsPrec :: Int -> ReadS ApiPassthrough
Prelude.Read, Int -> ApiPassthrough -> ShowS
[ApiPassthrough] -> ShowS
ApiPassthrough -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApiPassthrough] -> ShowS
$cshowList :: [ApiPassthrough] -> ShowS
show :: ApiPassthrough -> String
$cshow :: ApiPassthrough -> String
showsPrec :: Int -> ApiPassthrough -> ShowS
$cshowsPrec :: Int -> ApiPassthrough -> ShowS
Prelude.Show, forall x. Rep ApiPassthrough x -> ApiPassthrough
forall x. ApiPassthrough -> Rep ApiPassthrough x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApiPassthrough x -> ApiPassthrough
$cfrom :: forall x. ApiPassthrough -> Rep ApiPassthrough x
Prelude.Generic)

-- |
-- Create a value of 'ApiPassthrough' 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:
--
-- 'extensions', 'apiPassthrough_extensions' - Specifies X.509 extension information for a certificate.
--
-- 'subject', 'apiPassthrough_subject' - Undocumented member.
newApiPassthrough ::
  ApiPassthrough
newApiPassthrough :: ApiPassthrough
newApiPassthrough =
  ApiPassthrough'
    { $sel:extensions:ApiPassthrough' :: Maybe Extensions
extensions = forall a. Maybe a
Prelude.Nothing,
      $sel:subject:ApiPassthrough' :: Maybe ASN1Subject
subject = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies X.509 extension information for a certificate.
apiPassthrough_extensions :: Lens.Lens' ApiPassthrough (Prelude.Maybe Extensions)
apiPassthrough_extensions :: Lens' ApiPassthrough (Maybe Extensions)
apiPassthrough_extensions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApiPassthrough' {Maybe Extensions
extensions :: Maybe Extensions
$sel:extensions:ApiPassthrough' :: ApiPassthrough -> Maybe Extensions
extensions} -> Maybe Extensions
extensions) (\s :: ApiPassthrough
s@ApiPassthrough' {} Maybe Extensions
a -> ApiPassthrough
s {$sel:extensions:ApiPassthrough' :: Maybe Extensions
extensions = Maybe Extensions
a} :: ApiPassthrough)

-- | Undocumented member.
apiPassthrough_subject :: Lens.Lens' ApiPassthrough (Prelude.Maybe ASN1Subject)
apiPassthrough_subject :: Lens' ApiPassthrough (Maybe ASN1Subject)
apiPassthrough_subject = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApiPassthrough' {Maybe ASN1Subject
subject :: Maybe ASN1Subject
$sel:subject:ApiPassthrough' :: ApiPassthrough -> Maybe ASN1Subject
subject} -> Maybe ASN1Subject
subject) (\s :: ApiPassthrough
s@ApiPassthrough' {} Maybe ASN1Subject
a -> ApiPassthrough
s {$sel:subject:ApiPassthrough' :: Maybe ASN1Subject
subject = Maybe ASN1Subject
a} :: ApiPassthrough)

instance Prelude.Hashable ApiPassthrough where
  hashWithSalt :: Int -> ApiPassthrough -> Int
hashWithSalt Int
_salt ApiPassthrough' {Maybe ASN1Subject
Maybe Extensions
subject :: Maybe ASN1Subject
extensions :: Maybe Extensions
$sel:subject:ApiPassthrough' :: ApiPassthrough -> Maybe ASN1Subject
$sel:extensions:ApiPassthrough' :: ApiPassthrough -> Maybe Extensions
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Extensions
extensions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ASN1Subject
subject

instance Prelude.NFData ApiPassthrough where
  rnf :: ApiPassthrough -> ()
rnf ApiPassthrough' {Maybe ASN1Subject
Maybe Extensions
subject :: Maybe ASN1Subject
extensions :: Maybe Extensions
$sel:subject:ApiPassthrough' :: ApiPassthrough -> Maybe ASN1Subject
$sel:extensions:ApiPassthrough' :: ApiPassthrough -> Maybe Extensions
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Extensions
extensions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ASN1Subject
subject

instance Data.ToJSON ApiPassthrough where
  toJSON :: ApiPassthrough -> Value
toJSON ApiPassthrough' {Maybe ASN1Subject
Maybe Extensions
subject :: Maybe ASN1Subject
extensions :: Maybe Extensions
$sel:subject:ApiPassthrough' :: ApiPassthrough -> Maybe ASN1Subject
$sel:extensions:ApiPassthrough' :: ApiPassthrough -> Maybe Extensions
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Extensions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Extensions
extensions,
            (Key
"Subject" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ASN1Subject
subject
          ]
      )