{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.RevokeSigningProfile
-- 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)
--
-- Changes the state of a signing profile to REVOKED. This indicates that
-- signatures generated using the signing profile after an effective start
-- date are no longer valid.
module Amazonka.Signer.RevokeSigningProfile
  ( -- * Creating a Request
    RevokeSigningProfile (..),
    newRevokeSigningProfile,

    -- * Request Lenses
    revokeSigningProfile_profileVersion,
    revokeSigningProfile_reason,
    revokeSigningProfile_effectiveTime,
    revokeSigningProfile_profileName,

    -- * Destructuring the Response
    RevokeSigningProfileResponse (..),
    newRevokeSigningProfileResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Signer.Types

-- | /See:/ 'newRevokeSigningProfile' smart constructor.
data RevokeSigningProfile = RevokeSigningProfile'
  { -- | The version of the signing profile to be revoked.
    RevokeSigningProfile -> Text
profileVersion :: Prelude.Text,
    -- | The reason for revoking a signing profile.
    RevokeSigningProfile -> Text
reason :: Prelude.Text,
    -- | A timestamp for when revocation of a Signing Profile should become
    -- effective. Signatures generated using the signing profile after this
    -- timestamp are not trusted.
    RevokeSigningProfile -> POSIX
effectiveTime :: Core.POSIX,
    -- | The name of the signing profile to be revoked.
    RevokeSigningProfile -> Text
profileName :: Prelude.Text
  }
  deriving (RevokeSigningProfile -> RevokeSigningProfile -> Bool
(RevokeSigningProfile -> RevokeSigningProfile -> Bool)
-> (RevokeSigningProfile -> RevokeSigningProfile -> Bool)
-> Eq RevokeSigningProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokeSigningProfile -> RevokeSigningProfile -> Bool
$c/= :: RevokeSigningProfile -> RevokeSigningProfile -> Bool
== :: RevokeSigningProfile -> RevokeSigningProfile -> Bool
$c== :: RevokeSigningProfile -> RevokeSigningProfile -> Bool
Prelude.Eq, ReadPrec [RevokeSigningProfile]
ReadPrec RevokeSigningProfile
Int -> ReadS RevokeSigningProfile
ReadS [RevokeSigningProfile]
(Int -> ReadS RevokeSigningProfile)
-> ReadS [RevokeSigningProfile]
-> ReadPrec RevokeSigningProfile
-> ReadPrec [RevokeSigningProfile]
-> Read RevokeSigningProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevokeSigningProfile]
$creadListPrec :: ReadPrec [RevokeSigningProfile]
readPrec :: ReadPrec RevokeSigningProfile
$creadPrec :: ReadPrec RevokeSigningProfile
readList :: ReadS [RevokeSigningProfile]
$creadList :: ReadS [RevokeSigningProfile]
readsPrec :: Int -> ReadS RevokeSigningProfile
$creadsPrec :: Int -> ReadS RevokeSigningProfile
Prelude.Read, Int -> RevokeSigningProfile -> ShowS
[RevokeSigningProfile] -> ShowS
RevokeSigningProfile -> String
(Int -> RevokeSigningProfile -> ShowS)
-> (RevokeSigningProfile -> String)
-> ([RevokeSigningProfile] -> ShowS)
-> Show RevokeSigningProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokeSigningProfile] -> ShowS
$cshowList :: [RevokeSigningProfile] -> ShowS
show :: RevokeSigningProfile -> String
$cshow :: RevokeSigningProfile -> String
showsPrec :: Int -> RevokeSigningProfile -> ShowS
$cshowsPrec :: Int -> RevokeSigningProfile -> ShowS
Prelude.Show, (forall x. RevokeSigningProfile -> Rep RevokeSigningProfile x)
-> (forall x. Rep RevokeSigningProfile x -> RevokeSigningProfile)
-> Generic RevokeSigningProfile
forall x. Rep RevokeSigningProfile x -> RevokeSigningProfile
forall x. RevokeSigningProfile -> Rep RevokeSigningProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevokeSigningProfile x -> RevokeSigningProfile
$cfrom :: forall x. RevokeSigningProfile -> Rep RevokeSigningProfile x
Prelude.Generic)

-- |
-- Create a value of 'RevokeSigningProfile' 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:
--
-- 'profileVersion', 'revokeSigningProfile_profileVersion' - The version of the signing profile to be revoked.
--
-- 'reason', 'revokeSigningProfile_reason' - The reason for revoking a signing profile.
--
-- 'effectiveTime', 'revokeSigningProfile_effectiveTime' - A timestamp for when revocation of a Signing Profile should become
-- effective. Signatures generated using the signing profile after this
-- timestamp are not trusted.
--
-- 'profileName', 'revokeSigningProfile_profileName' - The name of the signing profile to be revoked.
newRevokeSigningProfile ::
  -- | 'profileVersion'
  Prelude.Text ->
  -- | 'reason'
  Prelude.Text ->
  -- | 'effectiveTime'
  Prelude.UTCTime ->
  -- | 'profileName'
  Prelude.Text ->
  RevokeSigningProfile
newRevokeSigningProfile :: Text -> Text -> UTCTime -> Text -> RevokeSigningProfile
newRevokeSigningProfile
  Text
pProfileVersion_
  Text
pReason_
  UTCTime
pEffectiveTime_
  Text
pProfileName_ =
    RevokeSigningProfile' :: Text -> Text -> POSIX -> Text -> RevokeSigningProfile
RevokeSigningProfile'
      { $sel:profileVersion:RevokeSigningProfile' :: Text
profileVersion =
          Text
pProfileVersion_,
        $sel:reason:RevokeSigningProfile' :: Text
reason = Text
pReason_,
        $sel:effectiveTime:RevokeSigningProfile' :: POSIX
effectiveTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEffectiveTime_,
        $sel:profileName:RevokeSigningProfile' :: Text
profileName = Text
pProfileName_
      }

-- | The version of the signing profile to be revoked.
revokeSigningProfile_profileVersion :: Lens.Lens' RevokeSigningProfile Prelude.Text
revokeSigningProfile_profileVersion :: (Text -> f Text) -> RevokeSigningProfile -> f RevokeSigningProfile
revokeSigningProfile_profileVersion = (RevokeSigningProfile -> Text)
-> (RevokeSigningProfile -> Text -> RevokeSigningProfile)
-> Lens RevokeSigningProfile RevokeSigningProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeSigningProfile' {Text
profileVersion :: Text
$sel:profileVersion:RevokeSigningProfile' :: RevokeSigningProfile -> Text
profileVersion} -> Text
profileVersion) (\s :: RevokeSigningProfile
s@RevokeSigningProfile' {} Text
a -> RevokeSigningProfile
s {$sel:profileVersion:RevokeSigningProfile' :: Text
profileVersion = Text
a} :: RevokeSigningProfile)

-- | The reason for revoking a signing profile.
revokeSigningProfile_reason :: Lens.Lens' RevokeSigningProfile Prelude.Text
revokeSigningProfile_reason :: (Text -> f Text) -> RevokeSigningProfile -> f RevokeSigningProfile
revokeSigningProfile_reason = (RevokeSigningProfile -> Text)
-> (RevokeSigningProfile -> Text -> RevokeSigningProfile)
-> Lens RevokeSigningProfile RevokeSigningProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeSigningProfile' {Text
reason :: Text
$sel:reason:RevokeSigningProfile' :: RevokeSigningProfile -> Text
reason} -> Text
reason) (\s :: RevokeSigningProfile
s@RevokeSigningProfile' {} Text
a -> RevokeSigningProfile
s {$sel:reason:RevokeSigningProfile' :: Text
reason = Text
a} :: RevokeSigningProfile)

-- | A timestamp for when revocation of a Signing Profile should become
-- effective. Signatures generated using the signing profile after this
-- timestamp are not trusted.
revokeSigningProfile_effectiveTime :: Lens.Lens' RevokeSigningProfile Prelude.UTCTime
revokeSigningProfile_effectiveTime :: (UTCTime -> f UTCTime)
-> RevokeSigningProfile -> f RevokeSigningProfile
revokeSigningProfile_effectiveTime = (RevokeSigningProfile -> POSIX)
-> (RevokeSigningProfile -> POSIX -> RevokeSigningProfile)
-> Lens RevokeSigningProfile RevokeSigningProfile POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeSigningProfile' {POSIX
effectiveTime :: POSIX
$sel:effectiveTime:RevokeSigningProfile' :: RevokeSigningProfile -> POSIX
effectiveTime} -> POSIX
effectiveTime) (\s :: RevokeSigningProfile
s@RevokeSigningProfile' {} POSIX
a -> RevokeSigningProfile
s {$sel:effectiveTime:RevokeSigningProfile' :: POSIX
effectiveTime = POSIX
a} :: RevokeSigningProfile) ((POSIX -> f POSIX)
 -> RevokeSigningProfile -> f RevokeSigningProfile)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> RevokeSigningProfile
-> f RevokeSigningProfile
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the signing profile to be revoked.
revokeSigningProfile_profileName :: Lens.Lens' RevokeSigningProfile Prelude.Text
revokeSigningProfile_profileName :: (Text -> f Text) -> RevokeSigningProfile -> f RevokeSigningProfile
revokeSigningProfile_profileName = (RevokeSigningProfile -> Text)
-> (RevokeSigningProfile -> Text -> RevokeSigningProfile)
-> Lens RevokeSigningProfile RevokeSigningProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeSigningProfile' {Text
profileName :: Text
$sel:profileName:RevokeSigningProfile' :: RevokeSigningProfile -> Text
profileName} -> Text
profileName) (\s :: RevokeSigningProfile
s@RevokeSigningProfile' {} Text
a -> RevokeSigningProfile
s {$sel:profileName:RevokeSigningProfile' :: Text
profileName = Text
a} :: RevokeSigningProfile)

instance Core.AWSRequest RevokeSigningProfile where
  type
    AWSResponse RevokeSigningProfile =
      RevokeSigningProfileResponse
  request :: RevokeSigningProfile -> Request RevokeSigningProfile
request = Service -> RevokeSigningProfile -> Request RevokeSigningProfile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RevokeSigningProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RevokeSigningProfile)))
response =
    AWSResponse RevokeSigningProfile
-> Logger
-> Service
-> Proxy RevokeSigningProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RevokeSigningProfile)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse RevokeSigningProfile
RevokeSigningProfileResponse
RevokeSigningProfileResponse'

instance Prelude.Hashable RevokeSigningProfile

instance Prelude.NFData RevokeSigningProfile

instance Core.ToHeaders RevokeSigningProfile where
  toHeaders :: RevokeSigningProfile -> [Header]
toHeaders =
    [Header] -> RevokeSigningProfile -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON RevokeSigningProfile where
  toJSON :: RevokeSigningProfile -> Value
toJSON RevokeSigningProfile' {Text
POSIX
profileName :: Text
effectiveTime :: POSIX
reason :: Text
profileVersion :: Text
$sel:profileName:RevokeSigningProfile' :: RevokeSigningProfile -> Text
$sel:effectiveTime:RevokeSigningProfile' :: RevokeSigningProfile -> POSIX
$sel:reason:RevokeSigningProfile' :: RevokeSigningProfile -> Text
$sel:profileVersion:RevokeSigningProfile' :: RevokeSigningProfile -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"profileVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
profileVersion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"reason" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
reason),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"effectiveTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
effectiveTime)
          ]
      )

instance Core.ToPath RevokeSigningProfile where
  toPath :: RevokeSigningProfile -> ByteString
toPath RevokeSigningProfile' {Text
POSIX
profileName :: Text
effectiveTime :: POSIX
reason :: Text
profileVersion :: Text
$sel:profileName:RevokeSigningProfile' :: RevokeSigningProfile -> Text
$sel:effectiveTime:RevokeSigningProfile' :: RevokeSigningProfile -> POSIX
$sel:reason:RevokeSigningProfile' :: RevokeSigningProfile -> Text
$sel:profileVersion:RevokeSigningProfile' :: RevokeSigningProfile -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/signing-profiles/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
profileName,
        ByteString
"/revoke"
      ]

instance Core.ToQuery RevokeSigningProfile where
  toQuery :: RevokeSigningProfile -> QueryString
toQuery = QueryString -> RevokeSigningProfile -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newRevokeSigningProfileResponse' smart constructor.
data RevokeSigningProfileResponse = RevokeSigningProfileResponse'
  {
  }
  deriving (RevokeSigningProfileResponse
-> RevokeSigningProfileResponse -> Bool
(RevokeSigningProfileResponse
 -> RevokeSigningProfileResponse -> Bool)
-> (RevokeSigningProfileResponse
    -> RevokeSigningProfileResponse -> Bool)
-> Eq RevokeSigningProfileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokeSigningProfileResponse
-> RevokeSigningProfileResponse -> Bool
$c/= :: RevokeSigningProfileResponse
-> RevokeSigningProfileResponse -> Bool
== :: RevokeSigningProfileResponse
-> RevokeSigningProfileResponse -> Bool
$c== :: RevokeSigningProfileResponse
-> RevokeSigningProfileResponse -> Bool
Prelude.Eq, ReadPrec [RevokeSigningProfileResponse]
ReadPrec RevokeSigningProfileResponse
Int -> ReadS RevokeSigningProfileResponse
ReadS [RevokeSigningProfileResponse]
(Int -> ReadS RevokeSigningProfileResponse)
-> ReadS [RevokeSigningProfileResponse]
-> ReadPrec RevokeSigningProfileResponse
-> ReadPrec [RevokeSigningProfileResponse]
-> Read RevokeSigningProfileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevokeSigningProfileResponse]
$creadListPrec :: ReadPrec [RevokeSigningProfileResponse]
readPrec :: ReadPrec RevokeSigningProfileResponse
$creadPrec :: ReadPrec RevokeSigningProfileResponse
readList :: ReadS [RevokeSigningProfileResponse]
$creadList :: ReadS [RevokeSigningProfileResponse]
readsPrec :: Int -> ReadS RevokeSigningProfileResponse
$creadsPrec :: Int -> ReadS RevokeSigningProfileResponse
Prelude.Read, Int -> RevokeSigningProfileResponse -> ShowS
[RevokeSigningProfileResponse] -> ShowS
RevokeSigningProfileResponse -> String
(Int -> RevokeSigningProfileResponse -> ShowS)
-> (RevokeSigningProfileResponse -> String)
-> ([RevokeSigningProfileResponse] -> ShowS)
-> Show RevokeSigningProfileResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokeSigningProfileResponse] -> ShowS
$cshowList :: [RevokeSigningProfileResponse] -> ShowS
show :: RevokeSigningProfileResponse -> String
$cshow :: RevokeSigningProfileResponse -> String
showsPrec :: Int -> RevokeSigningProfileResponse -> ShowS
$cshowsPrec :: Int -> RevokeSigningProfileResponse -> ShowS
Prelude.Show, (forall x.
 RevokeSigningProfileResponse -> Rep RevokeSigningProfileResponse x)
-> (forall x.
    Rep RevokeSigningProfileResponse x -> RevokeSigningProfileResponse)
-> Generic RevokeSigningProfileResponse
forall x.
Rep RevokeSigningProfileResponse x -> RevokeSigningProfileResponse
forall x.
RevokeSigningProfileResponse -> Rep RevokeSigningProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RevokeSigningProfileResponse x -> RevokeSigningProfileResponse
$cfrom :: forall x.
RevokeSigningProfileResponse -> Rep RevokeSigningProfileResponse x
Prelude.Generic)

-- |
-- Create a value of 'RevokeSigningProfileResponse' 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.
newRevokeSigningProfileResponse ::
  RevokeSigningProfileResponse
newRevokeSigningProfileResponse :: RevokeSigningProfileResponse
newRevokeSigningProfileResponse =
  RevokeSigningProfileResponse
RevokeSigningProfileResponse'

instance Prelude.NFData RevokeSigningProfileResponse