{-# 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.Signer.Types.SigningJobRevocationRecord
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Signer.Types.SigningJobRevocationRecord where

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

-- | Revocation information for a signing job.
--
-- /See:/ 'newSigningJobRevocationRecord' smart constructor.
data SigningJobRevocationRecord = SigningJobRevocationRecord'
  { -- | A caller-supplied reason for revocation.
    SigningJobRevocationRecord -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | The time of revocation.
    SigningJobRevocationRecord -> Maybe POSIX
revokedAt :: Prelude.Maybe Data.POSIX,
    -- | The identity of the revoker.
    SigningJobRevocationRecord -> Maybe Text
revokedBy :: Prelude.Maybe Prelude.Text
  }
  deriving (SigningJobRevocationRecord -> SigningJobRevocationRecord -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SigningJobRevocationRecord -> SigningJobRevocationRecord -> Bool
$c/= :: SigningJobRevocationRecord -> SigningJobRevocationRecord -> Bool
== :: SigningJobRevocationRecord -> SigningJobRevocationRecord -> Bool
$c== :: SigningJobRevocationRecord -> SigningJobRevocationRecord -> Bool
Prelude.Eq, ReadPrec [SigningJobRevocationRecord]
ReadPrec SigningJobRevocationRecord
Int -> ReadS SigningJobRevocationRecord
ReadS [SigningJobRevocationRecord]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SigningJobRevocationRecord]
$creadListPrec :: ReadPrec [SigningJobRevocationRecord]
readPrec :: ReadPrec SigningJobRevocationRecord
$creadPrec :: ReadPrec SigningJobRevocationRecord
readList :: ReadS [SigningJobRevocationRecord]
$creadList :: ReadS [SigningJobRevocationRecord]
readsPrec :: Int -> ReadS SigningJobRevocationRecord
$creadsPrec :: Int -> ReadS SigningJobRevocationRecord
Prelude.Read, Int -> SigningJobRevocationRecord -> ShowS
[SigningJobRevocationRecord] -> ShowS
SigningJobRevocationRecord -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SigningJobRevocationRecord] -> ShowS
$cshowList :: [SigningJobRevocationRecord] -> ShowS
show :: SigningJobRevocationRecord -> String
$cshow :: SigningJobRevocationRecord -> String
showsPrec :: Int -> SigningJobRevocationRecord -> ShowS
$cshowsPrec :: Int -> SigningJobRevocationRecord -> ShowS
Prelude.Show, forall x.
Rep SigningJobRevocationRecord x -> SigningJobRevocationRecord
forall x.
SigningJobRevocationRecord -> Rep SigningJobRevocationRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SigningJobRevocationRecord x -> SigningJobRevocationRecord
$cfrom :: forall x.
SigningJobRevocationRecord -> Rep SigningJobRevocationRecord x
Prelude.Generic)

-- |
-- Create a value of 'SigningJobRevocationRecord' 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:
--
-- 'reason', 'signingJobRevocationRecord_reason' - A caller-supplied reason for revocation.
--
-- 'revokedAt', 'signingJobRevocationRecord_revokedAt' - The time of revocation.
--
-- 'revokedBy', 'signingJobRevocationRecord_revokedBy' - The identity of the revoker.
newSigningJobRevocationRecord ::
  SigningJobRevocationRecord
newSigningJobRevocationRecord :: SigningJobRevocationRecord
newSigningJobRevocationRecord =
  SigningJobRevocationRecord'
    { $sel:reason:SigningJobRevocationRecord' :: Maybe Text
reason =
        forall a. Maybe a
Prelude.Nothing,
      $sel:revokedAt:SigningJobRevocationRecord' :: Maybe POSIX
revokedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:revokedBy:SigningJobRevocationRecord' :: Maybe Text
revokedBy = forall a. Maybe a
Prelude.Nothing
    }

-- | A caller-supplied reason for revocation.
signingJobRevocationRecord_reason :: Lens.Lens' SigningJobRevocationRecord (Prelude.Maybe Prelude.Text)
signingJobRevocationRecord_reason :: Lens' SigningJobRevocationRecord (Maybe Text)
signingJobRevocationRecord_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigningJobRevocationRecord' {Maybe Text
reason :: Maybe Text
$sel:reason:SigningJobRevocationRecord' :: SigningJobRevocationRecord -> Maybe Text
reason} -> Maybe Text
reason) (\s :: SigningJobRevocationRecord
s@SigningJobRevocationRecord' {} Maybe Text
a -> SigningJobRevocationRecord
s {$sel:reason:SigningJobRevocationRecord' :: Maybe Text
reason = Maybe Text
a} :: SigningJobRevocationRecord)

-- | The time of revocation.
signingJobRevocationRecord_revokedAt :: Lens.Lens' SigningJobRevocationRecord (Prelude.Maybe Prelude.UTCTime)
signingJobRevocationRecord_revokedAt :: Lens' SigningJobRevocationRecord (Maybe UTCTime)
signingJobRevocationRecord_revokedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigningJobRevocationRecord' {Maybe POSIX
revokedAt :: Maybe POSIX
$sel:revokedAt:SigningJobRevocationRecord' :: SigningJobRevocationRecord -> Maybe POSIX
revokedAt} -> Maybe POSIX
revokedAt) (\s :: SigningJobRevocationRecord
s@SigningJobRevocationRecord' {} Maybe POSIX
a -> SigningJobRevocationRecord
s {$sel:revokedAt:SigningJobRevocationRecord' :: Maybe POSIX
revokedAt = Maybe POSIX
a} :: SigningJobRevocationRecord) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The identity of the revoker.
signingJobRevocationRecord_revokedBy :: Lens.Lens' SigningJobRevocationRecord (Prelude.Maybe Prelude.Text)
signingJobRevocationRecord_revokedBy :: Lens' SigningJobRevocationRecord (Maybe Text)
signingJobRevocationRecord_revokedBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigningJobRevocationRecord' {Maybe Text
revokedBy :: Maybe Text
$sel:revokedBy:SigningJobRevocationRecord' :: SigningJobRevocationRecord -> Maybe Text
revokedBy} -> Maybe Text
revokedBy) (\s :: SigningJobRevocationRecord
s@SigningJobRevocationRecord' {} Maybe Text
a -> SigningJobRevocationRecord
s {$sel:revokedBy:SigningJobRevocationRecord' :: Maybe Text
revokedBy = Maybe Text
a} :: SigningJobRevocationRecord)

instance Data.FromJSON SigningJobRevocationRecord where
  parseJSON :: Value -> Parser SigningJobRevocationRecord
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SigningJobRevocationRecord"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX -> Maybe Text -> SigningJobRevocationRecord
SigningJobRevocationRecord'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"reason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"revokedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"revokedBy")
      )

instance Prelude.Hashable SigningJobRevocationRecord where
  hashWithSalt :: Int -> SigningJobRevocationRecord -> Int
hashWithSalt Int
_salt SigningJobRevocationRecord' {Maybe Text
Maybe POSIX
revokedBy :: Maybe Text
revokedAt :: Maybe POSIX
reason :: Maybe Text
$sel:revokedBy:SigningJobRevocationRecord' :: SigningJobRevocationRecord -> Maybe Text
$sel:revokedAt:SigningJobRevocationRecord' :: SigningJobRevocationRecord -> Maybe POSIX
$sel:reason:SigningJobRevocationRecord' :: SigningJobRevocationRecord -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
revokedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
revokedBy

instance Prelude.NFData SigningJobRevocationRecord where
  rnf :: SigningJobRevocationRecord -> ()
rnf SigningJobRevocationRecord' {Maybe Text
Maybe POSIX
revokedBy :: Maybe Text
revokedAt :: Maybe POSIX
reason :: Maybe Text
$sel:revokedBy:SigningJobRevocationRecord' :: SigningJobRevocationRecord -> Maybe Text
$sel:revokedAt:SigningJobRevocationRecord' :: SigningJobRevocationRecord -> Maybe POSIX
$sel:reason:SigningJobRevocationRecord' :: SigningJobRevocationRecord -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
revokedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
revokedBy