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

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

-- | Defines one or more purposes for which the key contained in the
-- certificate can be used. Default value for each option is false.
--
-- /See:/ 'newKeyUsage' smart constructor.
data KeyUsage = KeyUsage'
  { -- | Key can be used to decipher data.
    KeyUsage -> Maybe Bool
dataEncipherment :: Prelude.Maybe Prelude.Bool,
    -- | Key can be used only to encipher data.
    KeyUsage -> Maybe Bool
encipherOnly :: Prelude.Maybe Prelude.Bool,
    -- | Key can be used for non-repudiation.
    KeyUsage -> Maybe Bool
nonRepudiation :: Prelude.Maybe Prelude.Bool,
    -- | Key can be used to sign CRLs.
    KeyUsage -> Maybe Bool
cRLSign :: Prelude.Maybe Prelude.Bool,
    -- | Key can be used for digital signing.
    KeyUsage -> Maybe Bool
digitalSignature :: Prelude.Maybe Prelude.Bool,
    -- | Key can be used to sign certificates.
    KeyUsage -> Maybe Bool
keyCertSign :: Prelude.Maybe Prelude.Bool,
    -- | Key can be used only to decipher data.
    KeyUsage -> Maybe Bool
decipherOnly :: Prelude.Maybe Prelude.Bool,
    -- | Key can be used to encipher data.
    KeyUsage -> Maybe Bool
keyEncipherment :: Prelude.Maybe Prelude.Bool,
    -- | Key can be used in a key-agreement protocol.
    KeyUsage -> Maybe Bool
keyAgreement :: Prelude.Maybe Prelude.Bool
  }
  deriving (KeyUsage -> KeyUsage -> Bool
(KeyUsage -> KeyUsage -> Bool)
-> (KeyUsage -> KeyUsage -> Bool) -> Eq KeyUsage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyUsage -> KeyUsage -> Bool
$c/= :: KeyUsage -> KeyUsage -> Bool
== :: KeyUsage -> KeyUsage -> Bool
$c== :: KeyUsage -> KeyUsage -> Bool
Prelude.Eq, ReadPrec [KeyUsage]
ReadPrec KeyUsage
Int -> ReadS KeyUsage
ReadS [KeyUsage]
(Int -> ReadS KeyUsage)
-> ReadS [KeyUsage]
-> ReadPrec KeyUsage
-> ReadPrec [KeyUsage]
-> Read KeyUsage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KeyUsage]
$creadListPrec :: ReadPrec [KeyUsage]
readPrec :: ReadPrec KeyUsage
$creadPrec :: ReadPrec KeyUsage
readList :: ReadS [KeyUsage]
$creadList :: ReadS [KeyUsage]
readsPrec :: Int -> ReadS KeyUsage
$creadsPrec :: Int -> ReadS KeyUsage
Prelude.Read, Int -> KeyUsage -> ShowS
[KeyUsage] -> ShowS
KeyUsage -> String
(Int -> KeyUsage -> ShowS)
-> (KeyUsage -> String) -> ([KeyUsage] -> ShowS) -> Show KeyUsage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyUsage] -> ShowS
$cshowList :: [KeyUsage] -> ShowS
show :: KeyUsage -> String
$cshow :: KeyUsage -> String
showsPrec :: Int -> KeyUsage -> ShowS
$cshowsPrec :: Int -> KeyUsage -> ShowS
Prelude.Show, (forall x. KeyUsage -> Rep KeyUsage x)
-> (forall x. Rep KeyUsage x -> KeyUsage) -> Generic KeyUsage
forall x. Rep KeyUsage x -> KeyUsage
forall x. KeyUsage -> Rep KeyUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeyUsage x -> KeyUsage
$cfrom :: forall x. KeyUsage -> Rep KeyUsage x
Prelude.Generic)

-- |
-- Create a value of 'KeyUsage' 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:
--
-- 'dataEncipherment', 'keyUsage_dataEncipherment' - Key can be used to decipher data.
--
-- 'encipherOnly', 'keyUsage_encipherOnly' - Key can be used only to encipher data.
--
-- 'nonRepudiation', 'keyUsage_nonRepudiation' - Key can be used for non-repudiation.
--
-- 'cRLSign', 'keyUsage_cRLSign' - Key can be used to sign CRLs.
--
-- 'digitalSignature', 'keyUsage_digitalSignature' - Key can be used for digital signing.
--
-- 'keyCertSign', 'keyUsage_keyCertSign' - Key can be used to sign certificates.
--
-- 'decipherOnly', 'keyUsage_decipherOnly' - Key can be used only to decipher data.
--
-- 'keyEncipherment', 'keyUsage_keyEncipherment' - Key can be used to encipher data.
--
-- 'keyAgreement', 'keyUsage_keyAgreement' - Key can be used in a key-agreement protocol.
newKeyUsage ::
  KeyUsage
newKeyUsage :: KeyUsage
newKeyUsage =
  KeyUsage' :: Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> KeyUsage
KeyUsage'
    { $sel:dataEncipherment:KeyUsage' :: Maybe Bool
dataEncipherment = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:encipherOnly:KeyUsage' :: Maybe Bool
encipherOnly = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:nonRepudiation:KeyUsage' :: Maybe Bool
nonRepudiation = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cRLSign:KeyUsage' :: Maybe Bool
cRLSign = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:digitalSignature:KeyUsage' :: Maybe Bool
digitalSignature = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:keyCertSign:KeyUsage' :: Maybe Bool
keyCertSign = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:decipherOnly:KeyUsage' :: Maybe Bool
decipherOnly = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:keyEncipherment:KeyUsage' :: Maybe Bool
keyEncipherment = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:keyAgreement:KeyUsage' :: Maybe Bool
keyAgreement = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Key can be used to decipher data.
keyUsage_dataEncipherment :: Lens.Lens' KeyUsage (Prelude.Maybe Prelude.Bool)
keyUsage_dataEncipherment :: (Maybe Bool -> f (Maybe Bool)) -> KeyUsage -> f KeyUsage
keyUsage_dataEncipherment = (KeyUsage -> Maybe Bool)
-> (KeyUsage -> Maybe Bool -> KeyUsage)
-> Lens KeyUsage KeyUsage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyUsage' {Maybe Bool
dataEncipherment :: Maybe Bool
$sel:dataEncipherment:KeyUsage' :: KeyUsage -> Maybe Bool
dataEncipherment} -> Maybe Bool
dataEncipherment) (\s :: KeyUsage
s@KeyUsage' {} Maybe Bool
a -> KeyUsage
s {$sel:dataEncipherment:KeyUsage' :: Maybe Bool
dataEncipherment = Maybe Bool
a} :: KeyUsage)

-- | Key can be used only to encipher data.
keyUsage_encipherOnly :: Lens.Lens' KeyUsage (Prelude.Maybe Prelude.Bool)
keyUsage_encipherOnly :: (Maybe Bool -> f (Maybe Bool)) -> KeyUsage -> f KeyUsage
keyUsage_encipherOnly = (KeyUsage -> Maybe Bool)
-> (KeyUsage -> Maybe Bool -> KeyUsage)
-> Lens KeyUsage KeyUsage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyUsage' {Maybe Bool
encipherOnly :: Maybe Bool
$sel:encipherOnly:KeyUsage' :: KeyUsage -> Maybe Bool
encipherOnly} -> Maybe Bool
encipherOnly) (\s :: KeyUsage
s@KeyUsage' {} Maybe Bool
a -> KeyUsage
s {$sel:encipherOnly:KeyUsage' :: Maybe Bool
encipherOnly = Maybe Bool
a} :: KeyUsage)

-- | Key can be used for non-repudiation.
keyUsage_nonRepudiation :: Lens.Lens' KeyUsage (Prelude.Maybe Prelude.Bool)
keyUsage_nonRepudiation :: (Maybe Bool -> f (Maybe Bool)) -> KeyUsage -> f KeyUsage
keyUsage_nonRepudiation = (KeyUsage -> Maybe Bool)
-> (KeyUsage -> Maybe Bool -> KeyUsage)
-> Lens KeyUsage KeyUsage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyUsage' {Maybe Bool
nonRepudiation :: Maybe Bool
$sel:nonRepudiation:KeyUsage' :: KeyUsage -> Maybe Bool
nonRepudiation} -> Maybe Bool
nonRepudiation) (\s :: KeyUsage
s@KeyUsage' {} Maybe Bool
a -> KeyUsage
s {$sel:nonRepudiation:KeyUsage' :: Maybe Bool
nonRepudiation = Maybe Bool
a} :: KeyUsage)

-- | Key can be used to sign CRLs.
keyUsage_cRLSign :: Lens.Lens' KeyUsage (Prelude.Maybe Prelude.Bool)
keyUsage_cRLSign :: (Maybe Bool -> f (Maybe Bool)) -> KeyUsage -> f KeyUsage
keyUsage_cRLSign = (KeyUsage -> Maybe Bool)
-> (KeyUsage -> Maybe Bool -> KeyUsage)
-> Lens KeyUsage KeyUsage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyUsage' {Maybe Bool
cRLSign :: Maybe Bool
$sel:cRLSign:KeyUsage' :: KeyUsage -> Maybe Bool
cRLSign} -> Maybe Bool
cRLSign) (\s :: KeyUsage
s@KeyUsage' {} Maybe Bool
a -> KeyUsage
s {$sel:cRLSign:KeyUsage' :: Maybe Bool
cRLSign = Maybe Bool
a} :: KeyUsage)

-- | Key can be used for digital signing.
keyUsage_digitalSignature :: Lens.Lens' KeyUsage (Prelude.Maybe Prelude.Bool)
keyUsage_digitalSignature :: (Maybe Bool -> f (Maybe Bool)) -> KeyUsage -> f KeyUsage
keyUsage_digitalSignature = (KeyUsage -> Maybe Bool)
-> (KeyUsage -> Maybe Bool -> KeyUsage)
-> Lens KeyUsage KeyUsage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyUsage' {Maybe Bool
digitalSignature :: Maybe Bool
$sel:digitalSignature:KeyUsage' :: KeyUsage -> Maybe Bool
digitalSignature} -> Maybe Bool
digitalSignature) (\s :: KeyUsage
s@KeyUsage' {} Maybe Bool
a -> KeyUsage
s {$sel:digitalSignature:KeyUsage' :: Maybe Bool
digitalSignature = Maybe Bool
a} :: KeyUsage)

-- | Key can be used to sign certificates.
keyUsage_keyCertSign :: Lens.Lens' KeyUsage (Prelude.Maybe Prelude.Bool)
keyUsage_keyCertSign :: (Maybe Bool -> f (Maybe Bool)) -> KeyUsage -> f KeyUsage
keyUsage_keyCertSign = (KeyUsage -> Maybe Bool)
-> (KeyUsage -> Maybe Bool -> KeyUsage)
-> Lens KeyUsage KeyUsage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyUsage' {Maybe Bool
keyCertSign :: Maybe Bool
$sel:keyCertSign:KeyUsage' :: KeyUsage -> Maybe Bool
keyCertSign} -> Maybe Bool
keyCertSign) (\s :: KeyUsage
s@KeyUsage' {} Maybe Bool
a -> KeyUsage
s {$sel:keyCertSign:KeyUsage' :: Maybe Bool
keyCertSign = Maybe Bool
a} :: KeyUsage)

-- | Key can be used only to decipher data.
keyUsage_decipherOnly :: Lens.Lens' KeyUsage (Prelude.Maybe Prelude.Bool)
keyUsage_decipherOnly :: (Maybe Bool -> f (Maybe Bool)) -> KeyUsage -> f KeyUsage
keyUsage_decipherOnly = (KeyUsage -> Maybe Bool)
-> (KeyUsage -> Maybe Bool -> KeyUsage)
-> Lens KeyUsage KeyUsage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyUsage' {Maybe Bool
decipherOnly :: Maybe Bool
$sel:decipherOnly:KeyUsage' :: KeyUsage -> Maybe Bool
decipherOnly} -> Maybe Bool
decipherOnly) (\s :: KeyUsage
s@KeyUsage' {} Maybe Bool
a -> KeyUsage
s {$sel:decipherOnly:KeyUsage' :: Maybe Bool
decipherOnly = Maybe Bool
a} :: KeyUsage)

-- | Key can be used to encipher data.
keyUsage_keyEncipherment :: Lens.Lens' KeyUsage (Prelude.Maybe Prelude.Bool)
keyUsage_keyEncipherment :: (Maybe Bool -> f (Maybe Bool)) -> KeyUsage -> f KeyUsage
keyUsage_keyEncipherment = (KeyUsage -> Maybe Bool)
-> (KeyUsage -> Maybe Bool -> KeyUsage)
-> Lens KeyUsage KeyUsage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyUsage' {Maybe Bool
keyEncipherment :: Maybe Bool
$sel:keyEncipherment:KeyUsage' :: KeyUsage -> Maybe Bool
keyEncipherment} -> Maybe Bool
keyEncipherment) (\s :: KeyUsage
s@KeyUsage' {} Maybe Bool
a -> KeyUsage
s {$sel:keyEncipherment:KeyUsage' :: Maybe Bool
keyEncipherment = Maybe Bool
a} :: KeyUsage)

-- | Key can be used in a key-agreement protocol.
keyUsage_keyAgreement :: Lens.Lens' KeyUsage (Prelude.Maybe Prelude.Bool)
keyUsage_keyAgreement :: (Maybe Bool -> f (Maybe Bool)) -> KeyUsage -> f KeyUsage
keyUsage_keyAgreement = (KeyUsage -> Maybe Bool)
-> (KeyUsage -> Maybe Bool -> KeyUsage)
-> Lens KeyUsage KeyUsage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyUsage' {Maybe Bool
keyAgreement :: Maybe Bool
$sel:keyAgreement:KeyUsage' :: KeyUsage -> Maybe Bool
keyAgreement} -> Maybe Bool
keyAgreement) (\s :: KeyUsage
s@KeyUsage' {} Maybe Bool
a -> KeyUsage
s {$sel:keyAgreement:KeyUsage' :: Maybe Bool
keyAgreement = Maybe Bool
a} :: KeyUsage)

instance Core.FromJSON KeyUsage where
  parseJSON :: Value -> Parser KeyUsage
parseJSON =
    String -> (Object -> Parser KeyUsage) -> Value -> Parser KeyUsage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"KeyUsage"
      ( \Object
x ->
          Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> KeyUsage
KeyUsage'
            (Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> KeyUsage)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> KeyUsage)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataEncipherment")
            Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> KeyUsage)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> KeyUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EncipherOnly")
            Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> KeyUsage)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> KeyUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NonRepudiation")
            Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> KeyUsage)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> KeyUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CRLSign")
            Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> KeyUsage)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> KeyUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DigitalSignature")
            Parser
  (Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> KeyUsage)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> Maybe Bool -> Maybe Bool -> KeyUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KeyCertSign")
            Parser (Maybe Bool -> Maybe Bool -> Maybe Bool -> KeyUsage)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> Maybe Bool -> KeyUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DecipherOnly")
            Parser (Maybe Bool -> Maybe Bool -> KeyUsage)
-> Parser (Maybe Bool) -> Parser (Maybe Bool -> KeyUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KeyEncipherment")
            Parser (Maybe Bool -> KeyUsage)
-> Parser (Maybe Bool) -> Parser KeyUsage
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KeyAgreement")
      )

instance Prelude.Hashable KeyUsage

instance Prelude.NFData KeyUsage

instance Core.ToJSON KeyUsage where
  toJSON :: KeyUsage -> Value
toJSON KeyUsage' {Maybe Bool
keyAgreement :: Maybe Bool
keyEncipherment :: Maybe Bool
decipherOnly :: Maybe Bool
keyCertSign :: Maybe Bool
digitalSignature :: Maybe Bool
cRLSign :: Maybe Bool
nonRepudiation :: Maybe Bool
encipherOnly :: Maybe Bool
dataEncipherment :: Maybe Bool
$sel:keyAgreement:KeyUsage' :: KeyUsage -> Maybe Bool
$sel:keyEncipherment:KeyUsage' :: KeyUsage -> Maybe Bool
$sel:decipherOnly:KeyUsage' :: KeyUsage -> Maybe Bool
$sel:keyCertSign:KeyUsage' :: KeyUsage -> Maybe Bool
$sel:digitalSignature:KeyUsage' :: KeyUsage -> Maybe Bool
$sel:cRLSign:KeyUsage' :: KeyUsage -> Maybe Bool
$sel:nonRepudiation:KeyUsage' :: KeyUsage -> Maybe Bool
$sel:encipherOnly:KeyUsage' :: KeyUsage -> Maybe Bool
$sel:dataEncipherment:KeyUsage' :: KeyUsage -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DataEncipherment" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
dataEncipherment,
            (Text
"EncipherOnly" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
encipherOnly,
            (Text
"NonRepudiation" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
nonRepudiation,
            (Text
"CRLSign" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
cRLSign,
            (Text
"DigitalSignature" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
digitalSignature,
            (Text
"KeyCertSign" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
keyCertSign,
            (Text
"DecipherOnly" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
decipherOnly,
            (Text
"KeyEncipherment" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
keyEncipherment,
            (Text
"KeyAgreement" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
keyAgreement
          ]
      )