{-# 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.LicenseManager.Types.IssuerDetails
-- 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.LicenseManager.Types.IssuerDetails where

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

-- | Details associated with the issuer of a license.
--
-- /See:/ 'newIssuerDetails' smart constructor.
data IssuerDetails = IssuerDetails'
  { -- | Issuer key fingerprint.
    IssuerDetails -> Maybe Text
keyFingerprint :: Prelude.Maybe Prelude.Text,
    -- | Asymmetric KMS key from Key Management Service. The KMS key must have a
    -- key usage of sign and verify, and support the RSASSA-PSS SHA-256 signing
    -- algorithm.
    IssuerDetails -> Maybe Text
signKey :: Prelude.Maybe Prelude.Text,
    -- | Issuer name.
    IssuerDetails -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (IssuerDetails -> IssuerDetails -> Bool
(IssuerDetails -> IssuerDetails -> Bool)
-> (IssuerDetails -> IssuerDetails -> Bool) -> Eq IssuerDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IssuerDetails -> IssuerDetails -> Bool
$c/= :: IssuerDetails -> IssuerDetails -> Bool
== :: IssuerDetails -> IssuerDetails -> Bool
$c== :: IssuerDetails -> IssuerDetails -> Bool
Prelude.Eq, ReadPrec [IssuerDetails]
ReadPrec IssuerDetails
Int -> ReadS IssuerDetails
ReadS [IssuerDetails]
(Int -> ReadS IssuerDetails)
-> ReadS [IssuerDetails]
-> ReadPrec IssuerDetails
-> ReadPrec [IssuerDetails]
-> Read IssuerDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IssuerDetails]
$creadListPrec :: ReadPrec [IssuerDetails]
readPrec :: ReadPrec IssuerDetails
$creadPrec :: ReadPrec IssuerDetails
readList :: ReadS [IssuerDetails]
$creadList :: ReadS [IssuerDetails]
readsPrec :: Int -> ReadS IssuerDetails
$creadsPrec :: Int -> ReadS IssuerDetails
Prelude.Read, Int -> IssuerDetails -> ShowS
[IssuerDetails] -> ShowS
IssuerDetails -> String
(Int -> IssuerDetails -> ShowS)
-> (IssuerDetails -> String)
-> ([IssuerDetails] -> ShowS)
-> Show IssuerDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IssuerDetails] -> ShowS
$cshowList :: [IssuerDetails] -> ShowS
show :: IssuerDetails -> String
$cshow :: IssuerDetails -> String
showsPrec :: Int -> IssuerDetails -> ShowS
$cshowsPrec :: Int -> IssuerDetails -> ShowS
Prelude.Show, (forall x. IssuerDetails -> Rep IssuerDetails x)
-> (forall x. Rep IssuerDetails x -> IssuerDetails)
-> Generic IssuerDetails
forall x. Rep IssuerDetails x -> IssuerDetails
forall x. IssuerDetails -> Rep IssuerDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IssuerDetails x -> IssuerDetails
$cfrom :: forall x. IssuerDetails -> Rep IssuerDetails x
Prelude.Generic)

-- |
-- Create a value of 'IssuerDetails' 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:
--
-- 'keyFingerprint', 'issuerDetails_keyFingerprint' - Issuer key fingerprint.
--
-- 'signKey', 'issuerDetails_signKey' - Asymmetric KMS key from Key Management Service. The KMS key must have a
-- key usage of sign and verify, and support the RSASSA-PSS SHA-256 signing
-- algorithm.
--
-- 'name', 'issuerDetails_name' - Issuer name.
newIssuerDetails ::
  IssuerDetails
newIssuerDetails :: IssuerDetails
newIssuerDetails =
  IssuerDetails' :: Maybe Text -> Maybe Text -> Maybe Text -> IssuerDetails
IssuerDetails'
    { $sel:keyFingerprint:IssuerDetails' :: Maybe Text
keyFingerprint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:signKey:IssuerDetails' :: Maybe Text
signKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:IssuerDetails' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Issuer key fingerprint.
issuerDetails_keyFingerprint :: Lens.Lens' IssuerDetails (Prelude.Maybe Prelude.Text)
issuerDetails_keyFingerprint :: (Maybe Text -> f (Maybe Text)) -> IssuerDetails -> f IssuerDetails
issuerDetails_keyFingerprint = (IssuerDetails -> Maybe Text)
-> (IssuerDetails -> Maybe Text -> IssuerDetails)
-> Lens IssuerDetails IssuerDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IssuerDetails' {Maybe Text
keyFingerprint :: Maybe Text
$sel:keyFingerprint:IssuerDetails' :: IssuerDetails -> Maybe Text
keyFingerprint} -> Maybe Text
keyFingerprint) (\s :: IssuerDetails
s@IssuerDetails' {} Maybe Text
a -> IssuerDetails
s {$sel:keyFingerprint:IssuerDetails' :: Maybe Text
keyFingerprint = Maybe Text
a} :: IssuerDetails)

-- | Asymmetric KMS key from Key Management Service. The KMS key must have a
-- key usage of sign and verify, and support the RSASSA-PSS SHA-256 signing
-- algorithm.
issuerDetails_signKey :: Lens.Lens' IssuerDetails (Prelude.Maybe Prelude.Text)
issuerDetails_signKey :: (Maybe Text -> f (Maybe Text)) -> IssuerDetails -> f IssuerDetails
issuerDetails_signKey = (IssuerDetails -> Maybe Text)
-> (IssuerDetails -> Maybe Text -> IssuerDetails)
-> Lens IssuerDetails IssuerDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IssuerDetails' {Maybe Text
signKey :: Maybe Text
$sel:signKey:IssuerDetails' :: IssuerDetails -> Maybe Text
signKey} -> Maybe Text
signKey) (\s :: IssuerDetails
s@IssuerDetails' {} Maybe Text
a -> IssuerDetails
s {$sel:signKey:IssuerDetails' :: Maybe Text
signKey = Maybe Text
a} :: IssuerDetails)

-- | Issuer name.
issuerDetails_name :: Lens.Lens' IssuerDetails (Prelude.Maybe Prelude.Text)
issuerDetails_name :: (Maybe Text -> f (Maybe Text)) -> IssuerDetails -> f IssuerDetails
issuerDetails_name = (IssuerDetails -> Maybe Text)
-> (IssuerDetails -> Maybe Text -> IssuerDetails)
-> Lens IssuerDetails IssuerDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IssuerDetails' {Maybe Text
name :: Maybe Text
$sel:name:IssuerDetails' :: IssuerDetails -> Maybe Text
name} -> Maybe Text
name) (\s :: IssuerDetails
s@IssuerDetails' {} Maybe Text
a -> IssuerDetails
s {$sel:name:IssuerDetails' :: Maybe Text
name = Maybe Text
a} :: IssuerDetails)

instance Core.FromJSON IssuerDetails where
  parseJSON :: Value -> Parser IssuerDetails
parseJSON =
    String
-> (Object -> Parser IssuerDetails)
-> Value
-> Parser IssuerDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IssuerDetails"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> IssuerDetails
IssuerDetails'
            (Maybe Text -> Maybe Text -> Maybe Text -> IssuerDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> IssuerDetails)
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
"KeyFingerprint")
            Parser (Maybe Text -> Maybe Text -> IssuerDetails)
-> Parser (Maybe Text) -> Parser (Maybe Text -> IssuerDetails)
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
"SignKey")
            Parser (Maybe Text -> IssuerDetails)
-> Parser (Maybe Text) -> Parser IssuerDetails
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 IssuerDetails

instance Prelude.NFData IssuerDetails