{-# 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-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.Signer.Types.SigningJobRevocationRecord where

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

-- | Revocation information for a signing job.
--
-- /See:/ 'newSigningJobRevocationRecord' smart constructor.
data SigningJobRevocationRecord = SigningJobRevocationRecord'
  { -- | The identity of the revoker.
    SigningJobRevocationRecord -> Maybe Text
revokedBy :: Prelude.Maybe Prelude.Text,
    -- | The time of revocation.
    SigningJobRevocationRecord -> Maybe POSIX
revokedAt :: Prelude.Maybe Core.POSIX,
    -- | A caller-supplied reason for revocation.
    SigningJobRevocationRecord -> Maybe Text
reason :: Prelude.Maybe Prelude.Text
  }
  deriving (SigningJobRevocationRecord -> SigningJobRevocationRecord -> Bool
(SigningJobRevocationRecord -> SigningJobRevocationRecord -> Bool)
-> (SigningJobRevocationRecord
    -> SigningJobRevocationRecord -> Bool)
-> Eq SigningJobRevocationRecord
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]
(Int -> ReadS SigningJobRevocationRecord)
-> ReadS [SigningJobRevocationRecord]
-> ReadPrec SigningJobRevocationRecord
-> ReadPrec [SigningJobRevocationRecord]
-> Read 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
(Int -> SigningJobRevocationRecord -> ShowS)
-> (SigningJobRevocationRecord -> String)
-> ([SigningJobRevocationRecord] -> ShowS)
-> Show SigningJobRevocationRecord
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.
 SigningJobRevocationRecord -> Rep SigningJobRevocationRecord x)
-> (forall x.
    Rep SigningJobRevocationRecord x -> SigningJobRevocationRecord)
-> Generic SigningJobRevocationRecord
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:
--
-- 'revokedBy', 'signingJobRevocationRecord_revokedBy' - The identity of the revoker.
--
-- 'revokedAt', 'signingJobRevocationRecord_revokedAt' - The time of revocation.
--
-- 'reason', 'signingJobRevocationRecord_reason' - A caller-supplied reason for revocation.
newSigningJobRevocationRecord ::
  SigningJobRevocationRecord
newSigningJobRevocationRecord :: SigningJobRevocationRecord
newSigningJobRevocationRecord =
  SigningJobRevocationRecord' :: Maybe Text
-> Maybe POSIX -> Maybe Text -> SigningJobRevocationRecord
SigningJobRevocationRecord'
    { $sel:revokedBy:SigningJobRevocationRecord' :: Maybe Text
revokedBy =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:revokedAt:SigningJobRevocationRecord' :: Maybe POSIX
revokedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:reason:SigningJobRevocationRecord' :: Maybe Text
reason = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The identity of the revoker.
signingJobRevocationRecord_revokedBy :: Lens.Lens' SigningJobRevocationRecord (Prelude.Maybe Prelude.Text)
signingJobRevocationRecord_revokedBy :: (Maybe Text -> f (Maybe Text))
-> SigningJobRevocationRecord -> f SigningJobRevocationRecord
signingJobRevocationRecord_revokedBy = (SigningJobRevocationRecord -> Maybe Text)
-> (SigningJobRevocationRecord
    -> Maybe Text -> SigningJobRevocationRecord)
-> Lens
     SigningJobRevocationRecord
     SigningJobRevocationRecord
     (Maybe Text)
     (Maybe Text)
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)

-- | The time of revocation.
signingJobRevocationRecord_revokedAt :: Lens.Lens' SigningJobRevocationRecord (Prelude.Maybe Prelude.UTCTime)
signingJobRevocationRecord_revokedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SigningJobRevocationRecord -> f SigningJobRevocationRecord
signingJobRevocationRecord_revokedAt = (SigningJobRevocationRecord -> Maybe POSIX)
-> (SigningJobRevocationRecord
    -> Maybe POSIX -> SigningJobRevocationRecord)
-> Lens
     SigningJobRevocationRecord
     SigningJobRevocationRecord
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> SigningJobRevocationRecord -> f SigningJobRevocationRecord)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SigningJobRevocationRecord
-> f SigningJobRevocationRecord
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A caller-supplied reason for revocation.
signingJobRevocationRecord_reason :: Lens.Lens' SigningJobRevocationRecord (Prelude.Maybe Prelude.Text)
signingJobRevocationRecord_reason :: (Maybe Text -> f (Maybe Text))
-> SigningJobRevocationRecord -> f SigningJobRevocationRecord
signingJobRevocationRecord_reason = (SigningJobRevocationRecord -> Maybe Text)
-> (SigningJobRevocationRecord
    -> Maybe Text -> SigningJobRevocationRecord)
-> Lens
     SigningJobRevocationRecord
     SigningJobRevocationRecord
     (Maybe Text)
     (Maybe Text)
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)

instance Core.FromJSON SigningJobRevocationRecord where
  parseJSON :: Value -> Parser SigningJobRevocationRecord
parseJSON =
    String
-> (Object -> Parser SigningJobRevocationRecord)
-> Value
-> Parser SigningJobRevocationRecord
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SigningJobRevocationRecord"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX -> Maybe Text -> SigningJobRevocationRecord
SigningJobRevocationRecord'
            (Maybe Text
 -> Maybe POSIX -> Maybe Text -> SigningJobRevocationRecord)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> SigningJobRevocationRecord)
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
"revokedBy")
            Parser (Maybe POSIX -> Maybe Text -> SigningJobRevocationRecord)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> SigningJobRevocationRecord)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"revokedAt")
            Parser (Maybe Text -> SigningJobRevocationRecord)
-> Parser (Maybe Text) -> Parser SigningJobRevocationRecord
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
"reason")
      )

instance Prelude.Hashable SigningJobRevocationRecord

instance Prelude.NFData SigningJobRevocationRecord