{-# 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.SecurityHub.Types.AwsCertificateManagerCertificateKeyUsage
-- 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.SecurityHub.Types.AwsCertificateManagerCertificateKeyUsage where

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

-- | Contains information about a key usage X.509 v3 extension object.
--
-- /See:/ 'newAwsCertificateManagerCertificateKeyUsage' smart constructor.
data AwsCertificateManagerCertificateKeyUsage = AwsCertificateManagerCertificateKeyUsage'
  { -- | The key usage extension name.
    AwsCertificateManagerCertificateKeyUsage -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsCertificateManagerCertificateKeyUsage
-> AwsCertificateManagerCertificateKeyUsage -> Bool
(AwsCertificateManagerCertificateKeyUsage
 -> AwsCertificateManagerCertificateKeyUsage -> Bool)
-> (AwsCertificateManagerCertificateKeyUsage
    -> AwsCertificateManagerCertificateKeyUsage -> Bool)
-> Eq AwsCertificateManagerCertificateKeyUsage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCertificateManagerCertificateKeyUsage
-> AwsCertificateManagerCertificateKeyUsage -> Bool
$c/= :: AwsCertificateManagerCertificateKeyUsage
-> AwsCertificateManagerCertificateKeyUsage -> Bool
== :: AwsCertificateManagerCertificateKeyUsage
-> AwsCertificateManagerCertificateKeyUsage -> Bool
$c== :: AwsCertificateManagerCertificateKeyUsage
-> AwsCertificateManagerCertificateKeyUsage -> Bool
Prelude.Eq, ReadPrec [AwsCertificateManagerCertificateKeyUsage]
ReadPrec AwsCertificateManagerCertificateKeyUsage
Int -> ReadS AwsCertificateManagerCertificateKeyUsage
ReadS [AwsCertificateManagerCertificateKeyUsage]
(Int -> ReadS AwsCertificateManagerCertificateKeyUsage)
-> ReadS [AwsCertificateManagerCertificateKeyUsage]
-> ReadPrec AwsCertificateManagerCertificateKeyUsage
-> ReadPrec [AwsCertificateManagerCertificateKeyUsage]
-> Read AwsCertificateManagerCertificateKeyUsage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCertificateManagerCertificateKeyUsage]
$creadListPrec :: ReadPrec [AwsCertificateManagerCertificateKeyUsage]
readPrec :: ReadPrec AwsCertificateManagerCertificateKeyUsage
$creadPrec :: ReadPrec AwsCertificateManagerCertificateKeyUsage
readList :: ReadS [AwsCertificateManagerCertificateKeyUsage]
$creadList :: ReadS [AwsCertificateManagerCertificateKeyUsage]
readsPrec :: Int -> ReadS AwsCertificateManagerCertificateKeyUsage
$creadsPrec :: Int -> ReadS AwsCertificateManagerCertificateKeyUsage
Prelude.Read, Int -> AwsCertificateManagerCertificateKeyUsage -> ShowS
[AwsCertificateManagerCertificateKeyUsage] -> ShowS
AwsCertificateManagerCertificateKeyUsage -> String
(Int -> AwsCertificateManagerCertificateKeyUsage -> ShowS)
-> (AwsCertificateManagerCertificateKeyUsage -> String)
-> ([AwsCertificateManagerCertificateKeyUsage] -> ShowS)
-> Show AwsCertificateManagerCertificateKeyUsage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCertificateManagerCertificateKeyUsage] -> ShowS
$cshowList :: [AwsCertificateManagerCertificateKeyUsage] -> ShowS
show :: AwsCertificateManagerCertificateKeyUsage -> String
$cshow :: AwsCertificateManagerCertificateKeyUsage -> String
showsPrec :: Int -> AwsCertificateManagerCertificateKeyUsage -> ShowS
$cshowsPrec :: Int -> AwsCertificateManagerCertificateKeyUsage -> ShowS
Prelude.Show, (forall x.
 AwsCertificateManagerCertificateKeyUsage
 -> Rep AwsCertificateManagerCertificateKeyUsage x)
-> (forall x.
    Rep AwsCertificateManagerCertificateKeyUsage x
    -> AwsCertificateManagerCertificateKeyUsage)
-> Generic AwsCertificateManagerCertificateKeyUsage
forall x.
Rep AwsCertificateManagerCertificateKeyUsage x
-> AwsCertificateManagerCertificateKeyUsage
forall x.
AwsCertificateManagerCertificateKeyUsage
-> Rep AwsCertificateManagerCertificateKeyUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCertificateManagerCertificateKeyUsage x
-> AwsCertificateManagerCertificateKeyUsage
$cfrom :: forall x.
AwsCertificateManagerCertificateKeyUsage
-> Rep AwsCertificateManagerCertificateKeyUsage x
Prelude.Generic)

-- |
-- Create a value of 'AwsCertificateManagerCertificateKeyUsage' 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:
--
-- 'name', 'awsCertificateManagerCertificateKeyUsage_name' - The key usage extension name.
newAwsCertificateManagerCertificateKeyUsage ::
  AwsCertificateManagerCertificateKeyUsage
newAwsCertificateManagerCertificateKeyUsage :: AwsCertificateManagerCertificateKeyUsage
newAwsCertificateManagerCertificateKeyUsage =
  AwsCertificateManagerCertificateKeyUsage' :: Maybe Text -> AwsCertificateManagerCertificateKeyUsage
AwsCertificateManagerCertificateKeyUsage'
    { $sel:name:AwsCertificateManagerCertificateKeyUsage' :: Maybe Text
name =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The key usage extension name.
awsCertificateManagerCertificateKeyUsage_name :: Lens.Lens' AwsCertificateManagerCertificateKeyUsage (Prelude.Maybe Prelude.Text)
awsCertificateManagerCertificateKeyUsage_name :: (Maybe Text -> f (Maybe Text))
-> AwsCertificateManagerCertificateKeyUsage
-> f AwsCertificateManagerCertificateKeyUsage
awsCertificateManagerCertificateKeyUsage_name = (AwsCertificateManagerCertificateKeyUsage -> Maybe Text)
-> (AwsCertificateManagerCertificateKeyUsage
    -> Maybe Text -> AwsCertificateManagerCertificateKeyUsage)
-> Lens
     AwsCertificateManagerCertificateKeyUsage
     AwsCertificateManagerCertificateKeyUsage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCertificateManagerCertificateKeyUsage' {Maybe Text
name :: Maybe Text
$sel:name:AwsCertificateManagerCertificateKeyUsage' :: AwsCertificateManagerCertificateKeyUsage -> Maybe Text
name} -> Maybe Text
name) (\s :: AwsCertificateManagerCertificateKeyUsage
s@AwsCertificateManagerCertificateKeyUsage' {} Maybe Text
a -> AwsCertificateManagerCertificateKeyUsage
s {$sel:name:AwsCertificateManagerCertificateKeyUsage' :: Maybe Text
name = Maybe Text
a} :: AwsCertificateManagerCertificateKeyUsage)

instance
  Core.FromJSON
    AwsCertificateManagerCertificateKeyUsage
  where
  parseJSON :: Value -> Parser AwsCertificateManagerCertificateKeyUsage
parseJSON =
    String
-> (Object -> Parser AwsCertificateManagerCertificateKeyUsage)
-> Value
-> Parser AwsCertificateManagerCertificateKeyUsage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsCertificateManagerCertificateKeyUsage"
      ( \Object
x ->
          Maybe Text -> AwsCertificateManagerCertificateKeyUsage
AwsCertificateManagerCertificateKeyUsage'
            (Maybe Text -> AwsCertificateManagerCertificateKeyUsage)
-> Parser (Maybe Text)
-> Parser AwsCertificateManagerCertificateKeyUsage
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
      )

instance
  Prelude.Hashable
    AwsCertificateManagerCertificateKeyUsage

instance
  Prelude.NFData
    AwsCertificateManagerCertificateKeyUsage

instance
  Core.ToJSON
    AwsCertificateManagerCertificateKeyUsage
  where
  toJSON :: AwsCertificateManagerCertificateKeyUsage -> Value
toJSON AwsCertificateManagerCertificateKeyUsage' {Maybe Text
name :: Maybe Text
$sel:name:AwsCertificateManagerCertificateKeyUsage' :: AwsCertificateManagerCertificateKeyUsage -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name]
      )