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

import Amazonka.CertificateManagerPCA.Types.PolicyQualifierId
import Amazonka.CertificateManagerPCA.Types.Qualifier
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Modifies the @CertPolicyId@ of a @PolicyInformation@ object with a
-- qualifier. ACM Private CA supports the certification practice statement
-- (CPS) qualifier.
--
-- /See:/ 'newPolicyQualifierInfo' smart constructor.
data PolicyQualifierInfo = PolicyQualifierInfo'
  { -- | Identifies the qualifier modifying a @CertPolicyId@.
    PolicyQualifierInfo -> PolicyQualifierId
policyQualifierId :: PolicyQualifierId,
    -- | Defines the qualifier type. ACM Private CA supports the use of a URI for
    -- a CPS qualifier in this field.
    PolicyQualifierInfo -> Qualifier
qualifier :: Qualifier
  }
  deriving (PolicyQualifierInfo -> PolicyQualifierInfo -> Bool
(PolicyQualifierInfo -> PolicyQualifierInfo -> Bool)
-> (PolicyQualifierInfo -> PolicyQualifierInfo -> Bool)
-> Eq PolicyQualifierInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyQualifierInfo -> PolicyQualifierInfo -> Bool
$c/= :: PolicyQualifierInfo -> PolicyQualifierInfo -> Bool
== :: PolicyQualifierInfo -> PolicyQualifierInfo -> Bool
$c== :: PolicyQualifierInfo -> PolicyQualifierInfo -> Bool
Prelude.Eq, ReadPrec [PolicyQualifierInfo]
ReadPrec PolicyQualifierInfo
Int -> ReadS PolicyQualifierInfo
ReadS [PolicyQualifierInfo]
(Int -> ReadS PolicyQualifierInfo)
-> ReadS [PolicyQualifierInfo]
-> ReadPrec PolicyQualifierInfo
-> ReadPrec [PolicyQualifierInfo]
-> Read PolicyQualifierInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyQualifierInfo]
$creadListPrec :: ReadPrec [PolicyQualifierInfo]
readPrec :: ReadPrec PolicyQualifierInfo
$creadPrec :: ReadPrec PolicyQualifierInfo
readList :: ReadS [PolicyQualifierInfo]
$creadList :: ReadS [PolicyQualifierInfo]
readsPrec :: Int -> ReadS PolicyQualifierInfo
$creadsPrec :: Int -> ReadS PolicyQualifierInfo
Prelude.Read, Int -> PolicyQualifierInfo -> ShowS
[PolicyQualifierInfo] -> ShowS
PolicyQualifierInfo -> String
(Int -> PolicyQualifierInfo -> ShowS)
-> (PolicyQualifierInfo -> String)
-> ([PolicyQualifierInfo] -> ShowS)
-> Show PolicyQualifierInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyQualifierInfo] -> ShowS
$cshowList :: [PolicyQualifierInfo] -> ShowS
show :: PolicyQualifierInfo -> String
$cshow :: PolicyQualifierInfo -> String
showsPrec :: Int -> PolicyQualifierInfo -> ShowS
$cshowsPrec :: Int -> PolicyQualifierInfo -> ShowS
Prelude.Show, (forall x. PolicyQualifierInfo -> Rep PolicyQualifierInfo x)
-> (forall x. Rep PolicyQualifierInfo x -> PolicyQualifierInfo)
-> Generic PolicyQualifierInfo
forall x. Rep PolicyQualifierInfo x -> PolicyQualifierInfo
forall x. PolicyQualifierInfo -> Rep PolicyQualifierInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicyQualifierInfo x -> PolicyQualifierInfo
$cfrom :: forall x. PolicyQualifierInfo -> Rep PolicyQualifierInfo x
Prelude.Generic)

-- |
-- Create a value of 'PolicyQualifierInfo' 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:
--
-- 'policyQualifierId', 'policyQualifierInfo_policyQualifierId' - Identifies the qualifier modifying a @CertPolicyId@.
--
-- 'qualifier', 'policyQualifierInfo_qualifier' - Defines the qualifier type. ACM Private CA supports the use of a URI for
-- a CPS qualifier in this field.
newPolicyQualifierInfo ::
  -- | 'policyQualifierId'
  PolicyQualifierId ->
  -- | 'qualifier'
  Qualifier ->
  PolicyQualifierInfo
newPolicyQualifierInfo :: PolicyQualifierId -> Qualifier -> PolicyQualifierInfo
newPolicyQualifierInfo
  PolicyQualifierId
pPolicyQualifierId_
  Qualifier
pQualifier_ =
    PolicyQualifierInfo' :: PolicyQualifierId -> Qualifier -> PolicyQualifierInfo
PolicyQualifierInfo'
      { $sel:policyQualifierId:PolicyQualifierInfo' :: PolicyQualifierId
policyQualifierId =
          PolicyQualifierId
pPolicyQualifierId_,
        $sel:qualifier:PolicyQualifierInfo' :: Qualifier
qualifier = Qualifier
pQualifier_
      }

-- | Identifies the qualifier modifying a @CertPolicyId@.
policyQualifierInfo_policyQualifierId :: Lens.Lens' PolicyQualifierInfo PolicyQualifierId
policyQualifierInfo_policyQualifierId :: (PolicyQualifierId -> f PolicyQualifierId)
-> PolicyQualifierInfo -> f PolicyQualifierInfo
policyQualifierInfo_policyQualifierId = (PolicyQualifierInfo -> PolicyQualifierId)
-> (PolicyQualifierInfo
    -> PolicyQualifierId -> PolicyQualifierInfo)
-> Lens
     PolicyQualifierInfo
     PolicyQualifierInfo
     PolicyQualifierId
     PolicyQualifierId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyQualifierInfo' {PolicyQualifierId
policyQualifierId :: PolicyQualifierId
$sel:policyQualifierId:PolicyQualifierInfo' :: PolicyQualifierInfo -> PolicyQualifierId
policyQualifierId} -> PolicyQualifierId
policyQualifierId) (\s :: PolicyQualifierInfo
s@PolicyQualifierInfo' {} PolicyQualifierId
a -> PolicyQualifierInfo
s {$sel:policyQualifierId:PolicyQualifierInfo' :: PolicyQualifierId
policyQualifierId = PolicyQualifierId
a} :: PolicyQualifierInfo)

-- | Defines the qualifier type. ACM Private CA supports the use of a URI for
-- a CPS qualifier in this field.
policyQualifierInfo_qualifier :: Lens.Lens' PolicyQualifierInfo Qualifier
policyQualifierInfo_qualifier :: (Qualifier -> f Qualifier)
-> PolicyQualifierInfo -> f PolicyQualifierInfo
policyQualifierInfo_qualifier = (PolicyQualifierInfo -> Qualifier)
-> (PolicyQualifierInfo -> Qualifier -> PolicyQualifierInfo)
-> Lens PolicyQualifierInfo PolicyQualifierInfo Qualifier Qualifier
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyQualifierInfo' {Qualifier
qualifier :: Qualifier
$sel:qualifier:PolicyQualifierInfo' :: PolicyQualifierInfo -> Qualifier
qualifier} -> Qualifier
qualifier) (\s :: PolicyQualifierInfo
s@PolicyQualifierInfo' {} Qualifier
a -> PolicyQualifierInfo
s {$sel:qualifier:PolicyQualifierInfo' :: Qualifier
qualifier = Qualifier
a} :: PolicyQualifierInfo)

instance Prelude.Hashable PolicyQualifierInfo

instance Prelude.NFData PolicyQualifierInfo

instance Core.ToJSON PolicyQualifierInfo where
  toJSON :: PolicyQualifierInfo -> Value
toJSON PolicyQualifierInfo' {PolicyQualifierId
Qualifier
qualifier :: Qualifier
policyQualifierId :: PolicyQualifierId
$sel:qualifier:PolicyQualifierInfo' :: PolicyQualifierInfo -> Qualifier
$sel:policyQualifierId:PolicyQualifierInfo' :: PolicyQualifierInfo -> PolicyQualifierId
..} =
    [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
"PolicyQualifierId" Text -> PolicyQualifierId -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PolicyQualifierId
policyQualifierId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Qualifier" Text -> Qualifier -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Qualifier
qualifier)
          ]
      )