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

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

-- | Contains information about an extended key usage X.509 v3 extension
-- object.
--
-- /See:/ 'newAwsCertificateManagerCertificateExtendedKeyUsage' smart constructor.
data AwsCertificateManagerCertificateExtendedKeyUsage = AwsCertificateManagerCertificateExtendedKeyUsage'
  { -- | An object identifier (OID) for the extension value.
    --
    -- The format is numbers separated by periods.
    AwsCertificateManagerCertificateExtendedKeyUsage -> Maybe Text
oId :: Prelude.Maybe Prelude.Text,
    -- | The name of an extension value. Indicates the purpose for which the
    -- certificate public key can be used.
    AwsCertificateManagerCertificateExtendedKeyUsage -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsCertificateManagerCertificateExtendedKeyUsage
-> AwsCertificateManagerCertificateExtendedKeyUsage -> Bool
(AwsCertificateManagerCertificateExtendedKeyUsage
 -> AwsCertificateManagerCertificateExtendedKeyUsage -> Bool)
-> (AwsCertificateManagerCertificateExtendedKeyUsage
    -> AwsCertificateManagerCertificateExtendedKeyUsage -> Bool)
-> Eq AwsCertificateManagerCertificateExtendedKeyUsage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCertificateManagerCertificateExtendedKeyUsage
-> AwsCertificateManagerCertificateExtendedKeyUsage -> Bool
$c/= :: AwsCertificateManagerCertificateExtendedKeyUsage
-> AwsCertificateManagerCertificateExtendedKeyUsage -> Bool
== :: AwsCertificateManagerCertificateExtendedKeyUsage
-> AwsCertificateManagerCertificateExtendedKeyUsage -> Bool
$c== :: AwsCertificateManagerCertificateExtendedKeyUsage
-> AwsCertificateManagerCertificateExtendedKeyUsage -> Bool
Prelude.Eq, ReadPrec [AwsCertificateManagerCertificateExtendedKeyUsage]
ReadPrec AwsCertificateManagerCertificateExtendedKeyUsage
Int -> ReadS AwsCertificateManagerCertificateExtendedKeyUsage
ReadS [AwsCertificateManagerCertificateExtendedKeyUsage]
(Int -> ReadS AwsCertificateManagerCertificateExtendedKeyUsage)
-> ReadS [AwsCertificateManagerCertificateExtendedKeyUsage]
-> ReadPrec AwsCertificateManagerCertificateExtendedKeyUsage
-> ReadPrec [AwsCertificateManagerCertificateExtendedKeyUsage]
-> Read AwsCertificateManagerCertificateExtendedKeyUsage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCertificateManagerCertificateExtendedKeyUsage]
$creadListPrec :: ReadPrec [AwsCertificateManagerCertificateExtendedKeyUsage]
readPrec :: ReadPrec AwsCertificateManagerCertificateExtendedKeyUsage
$creadPrec :: ReadPrec AwsCertificateManagerCertificateExtendedKeyUsage
readList :: ReadS [AwsCertificateManagerCertificateExtendedKeyUsage]
$creadList :: ReadS [AwsCertificateManagerCertificateExtendedKeyUsage]
readsPrec :: Int -> ReadS AwsCertificateManagerCertificateExtendedKeyUsage
$creadsPrec :: Int -> ReadS AwsCertificateManagerCertificateExtendedKeyUsage
Prelude.Read, Int -> AwsCertificateManagerCertificateExtendedKeyUsage -> ShowS
[AwsCertificateManagerCertificateExtendedKeyUsage] -> ShowS
AwsCertificateManagerCertificateExtendedKeyUsage -> String
(Int -> AwsCertificateManagerCertificateExtendedKeyUsage -> ShowS)
-> (AwsCertificateManagerCertificateExtendedKeyUsage -> String)
-> ([AwsCertificateManagerCertificateExtendedKeyUsage] -> ShowS)
-> Show AwsCertificateManagerCertificateExtendedKeyUsage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCertificateManagerCertificateExtendedKeyUsage] -> ShowS
$cshowList :: [AwsCertificateManagerCertificateExtendedKeyUsage] -> ShowS
show :: AwsCertificateManagerCertificateExtendedKeyUsage -> String
$cshow :: AwsCertificateManagerCertificateExtendedKeyUsage -> String
showsPrec :: Int -> AwsCertificateManagerCertificateExtendedKeyUsage -> ShowS
$cshowsPrec :: Int -> AwsCertificateManagerCertificateExtendedKeyUsage -> ShowS
Prelude.Show, (forall x.
 AwsCertificateManagerCertificateExtendedKeyUsage
 -> Rep AwsCertificateManagerCertificateExtendedKeyUsage x)
-> (forall x.
    Rep AwsCertificateManagerCertificateExtendedKeyUsage x
    -> AwsCertificateManagerCertificateExtendedKeyUsage)
-> Generic AwsCertificateManagerCertificateExtendedKeyUsage
forall x.
Rep AwsCertificateManagerCertificateExtendedKeyUsage x
-> AwsCertificateManagerCertificateExtendedKeyUsage
forall x.
AwsCertificateManagerCertificateExtendedKeyUsage
-> Rep AwsCertificateManagerCertificateExtendedKeyUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCertificateManagerCertificateExtendedKeyUsage x
-> AwsCertificateManagerCertificateExtendedKeyUsage
$cfrom :: forall x.
AwsCertificateManagerCertificateExtendedKeyUsage
-> Rep AwsCertificateManagerCertificateExtendedKeyUsage x
Prelude.Generic)

-- |
-- Create a value of 'AwsCertificateManagerCertificateExtendedKeyUsage' 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:
--
-- 'oId', 'awsCertificateManagerCertificateExtendedKeyUsage_oId' - An object identifier (OID) for the extension value.
--
-- The format is numbers separated by periods.
--
-- 'name', 'awsCertificateManagerCertificateExtendedKeyUsage_name' - The name of an extension value. Indicates the purpose for which the
-- certificate public key can be used.
newAwsCertificateManagerCertificateExtendedKeyUsage ::
  AwsCertificateManagerCertificateExtendedKeyUsage
newAwsCertificateManagerCertificateExtendedKeyUsage :: AwsCertificateManagerCertificateExtendedKeyUsage
newAwsCertificateManagerCertificateExtendedKeyUsage =
  AwsCertificateManagerCertificateExtendedKeyUsage' :: Maybe Text
-> Maybe Text -> AwsCertificateManagerCertificateExtendedKeyUsage
AwsCertificateManagerCertificateExtendedKeyUsage'
    { $sel:oId:AwsCertificateManagerCertificateExtendedKeyUsage' :: Maybe Text
oId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:AwsCertificateManagerCertificateExtendedKeyUsage' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | An object identifier (OID) for the extension value.
--
-- The format is numbers separated by periods.
awsCertificateManagerCertificateExtendedKeyUsage_oId :: Lens.Lens' AwsCertificateManagerCertificateExtendedKeyUsage (Prelude.Maybe Prelude.Text)
awsCertificateManagerCertificateExtendedKeyUsage_oId :: (Maybe Text -> f (Maybe Text))
-> AwsCertificateManagerCertificateExtendedKeyUsage
-> f AwsCertificateManagerCertificateExtendedKeyUsage
awsCertificateManagerCertificateExtendedKeyUsage_oId = (AwsCertificateManagerCertificateExtendedKeyUsage -> Maybe Text)
-> (AwsCertificateManagerCertificateExtendedKeyUsage
    -> Maybe Text -> AwsCertificateManagerCertificateExtendedKeyUsage)
-> Lens
     AwsCertificateManagerCertificateExtendedKeyUsage
     AwsCertificateManagerCertificateExtendedKeyUsage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCertificateManagerCertificateExtendedKeyUsage' {Maybe Text
oId :: Maybe Text
$sel:oId:AwsCertificateManagerCertificateExtendedKeyUsage' :: AwsCertificateManagerCertificateExtendedKeyUsage -> Maybe Text
oId} -> Maybe Text
oId) (\s :: AwsCertificateManagerCertificateExtendedKeyUsage
s@AwsCertificateManagerCertificateExtendedKeyUsage' {} Maybe Text
a -> AwsCertificateManagerCertificateExtendedKeyUsage
s {$sel:oId:AwsCertificateManagerCertificateExtendedKeyUsage' :: Maybe Text
oId = Maybe Text
a} :: AwsCertificateManagerCertificateExtendedKeyUsage)

-- | The name of an extension value. Indicates the purpose for which the
-- certificate public key can be used.
awsCertificateManagerCertificateExtendedKeyUsage_name :: Lens.Lens' AwsCertificateManagerCertificateExtendedKeyUsage (Prelude.Maybe Prelude.Text)
awsCertificateManagerCertificateExtendedKeyUsage_name :: (Maybe Text -> f (Maybe Text))
-> AwsCertificateManagerCertificateExtendedKeyUsage
-> f AwsCertificateManagerCertificateExtendedKeyUsage
awsCertificateManagerCertificateExtendedKeyUsage_name = (AwsCertificateManagerCertificateExtendedKeyUsage -> Maybe Text)
-> (AwsCertificateManagerCertificateExtendedKeyUsage
    -> Maybe Text -> AwsCertificateManagerCertificateExtendedKeyUsage)
-> Lens
     AwsCertificateManagerCertificateExtendedKeyUsage
     AwsCertificateManagerCertificateExtendedKeyUsage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCertificateManagerCertificateExtendedKeyUsage' {Maybe Text
name :: Maybe Text
$sel:name:AwsCertificateManagerCertificateExtendedKeyUsage' :: AwsCertificateManagerCertificateExtendedKeyUsage -> Maybe Text
name} -> Maybe Text
name) (\s :: AwsCertificateManagerCertificateExtendedKeyUsage
s@AwsCertificateManagerCertificateExtendedKeyUsage' {} Maybe Text
a -> AwsCertificateManagerCertificateExtendedKeyUsage
s {$sel:name:AwsCertificateManagerCertificateExtendedKeyUsage' :: Maybe Text
name = Maybe Text
a} :: AwsCertificateManagerCertificateExtendedKeyUsage)

instance
  Core.FromJSON
    AwsCertificateManagerCertificateExtendedKeyUsage
  where
  parseJSON :: Value -> Parser AwsCertificateManagerCertificateExtendedKeyUsage
parseJSON =
    String
-> (Object
    -> Parser AwsCertificateManagerCertificateExtendedKeyUsage)
-> Value
-> Parser AwsCertificateManagerCertificateExtendedKeyUsage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsCertificateManagerCertificateExtendedKeyUsage"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> AwsCertificateManagerCertificateExtendedKeyUsage
AwsCertificateManagerCertificateExtendedKeyUsage'
            (Maybe Text
 -> Maybe Text -> AwsCertificateManagerCertificateExtendedKeyUsage)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> AwsCertificateManagerCertificateExtendedKeyUsage)
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
"OId") Parser
  (Maybe Text -> AwsCertificateManagerCertificateExtendedKeyUsage)
-> Parser (Maybe Text)
-> Parser AwsCertificateManagerCertificateExtendedKeyUsage
forall (f :: * -> *) a b. Applicative f => 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
    AwsCertificateManagerCertificateExtendedKeyUsage

instance
  Prelude.NFData
    AwsCertificateManagerCertificateExtendedKeyUsage

instance
  Core.ToJSON
    AwsCertificateManagerCertificateExtendedKeyUsage
  where
  toJSON :: AwsCertificateManagerCertificateExtendedKeyUsage -> Value
toJSON
    AwsCertificateManagerCertificateExtendedKeyUsage' {Maybe Text
name :: Maybe Text
oId :: Maybe Text
$sel:name:AwsCertificateManagerCertificateExtendedKeyUsage' :: AwsCertificateManagerCertificateExtendedKeyUsage -> Maybe Text
$sel:oId:AwsCertificateManagerCertificateExtendedKeyUsage' :: AwsCertificateManagerCertificateExtendedKeyUsage -> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"OId" 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
oId,
              (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
            ]
        )