{-# 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.SecretsManager.DeleteSecret
-- 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)
--
-- Deletes an entire secret and all of the versions. You can optionally
-- include a recovery window during which you can restore the secret. If
-- you don\'t specify a recovery window value, the operation defaults to 30
-- days. Secrets Manager attaches a @DeletionDate@ stamp to the secret that
-- specifies the end of the recovery window. At the end of the recovery
-- window, Secrets Manager deletes the secret permanently.
--
-- At any time before recovery window ends, you can use RestoreSecret to
-- remove the @DeletionDate@ and cancel the deletion of the secret.
--
-- You cannot access the encrypted secret information in any secret
-- scheduled for deletion. If you need to access that information, you must
-- cancel the deletion with RestoreSecret and then retrieve the
-- information.
--
-- -   There is no explicit operation to delete a version of a secret.
--     Instead, remove all staging labels from the @VersionStage@ field of
--     a version. That marks the version as deprecated and allows Secrets
--     Manager to delete it as needed. Versions without any staging labels
--     do not show up in ListSecretVersionIds unless you specify
--     @IncludeDeprecated@.
--
-- -   The permanent secret deletion at the end of the waiting period is
--     performed as a background task with low priority. There is no
--     guarantee of a specific time after the recovery window for the
--     actual delete operation to occur.
--
-- __Minimum permissions__
--
-- To run this command, you must have the following permissions:
--
-- -   secretsmanager:DeleteSecret
--
-- __Related operations__
--
-- -   To create a secret, use CreateSecret.
--
-- -   To cancel deletion of a version of a secret before the recovery
--     window has expired, use RestoreSecret.
module Amazonka.SecretsManager.DeleteSecret
  ( -- * Creating a Request
    DeleteSecret (..),
    newDeleteSecret,

    -- * Request Lenses
    deleteSecret_recoveryWindowInDays,
    deleteSecret_forceDeleteWithoutRecovery,
    deleteSecret_secretId,

    -- * Destructuring the Response
    DeleteSecretResponse (..),
    newDeleteSecretResponse,

    -- * Response Lenses
    deleteSecretResponse_arn,
    deleteSecretResponse_name,
    deleteSecretResponse_deletionDate,
    deleteSecretResponse_httpStatus,
  )
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.SecretsManager.Types

-- | /See:/ 'newDeleteSecret' smart constructor.
data DeleteSecret = DeleteSecret'
  { -- | (Optional) Specifies the number of days that Secrets Manager waits
    -- before Secrets Manager can delete the secret. You can\'t use both this
    -- parameter and the @ForceDeleteWithoutRecovery@ parameter in the same API
    -- call.
    --
    -- This value can range from 7 to 30 days with a default value of 30.
    DeleteSecret -> Maybe Integer
recoveryWindowInDays :: Prelude.Maybe Prelude.Integer,
    -- | (Optional) Specifies that the secret is to be deleted without any
    -- recovery window. You can\'t use both this parameter and the
    -- @RecoveryWindowInDays@ parameter in the same API call.
    --
    -- An asynchronous background process performs the actual deletion, so
    -- there can be a short delay before the operation completes. If you write
    -- code to delete and then immediately recreate a secret with the same
    -- name, ensure that your code includes appropriate back off and retry
    -- logic.
    --
    -- Use this parameter with caution. This parameter causes the operation to
    -- skip the normal waiting period before the permanent deletion that Amazon
    -- Web Services would normally impose with the @RecoveryWindowInDays@
    -- parameter. If you delete a secret with the @ForceDeleteWithouRecovery@
    -- parameter, then you have no opportunity to recover the secret. You lose
    -- the secret permanently.
    --
    -- If you use this parameter and include a previously deleted or
    -- nonexistent secret, the operation does not return the error
    -- @ResourceNotFoundException@ in order to correctly handle retries.
    DeleteSecret -> Maybe Bool
forceDeleteWithoutRecovery :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the secret to delete. You can specify either the Amazon
    -- Resource Name (ARN) or the friendly name of the secret.
    --
    -- For an ARN, we recommend that you specify a complete ARN rather than a
    -- partial ARN.
    DeleteSecret -> Text
secretId :: Prelude.Text
  }
  deriving (DeleteSecret -> DeleteSecret -> Bool
(DeleteSecret -> DeleteSecret -> Bool)
-> (DeleteSecret -> DeleteSecret -> Bool) -> Eq DeleteSecret
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSecret -> DeleteSecret -> Bool
$c/= :: DeleteSecret -> DeleteSecret -> Bool
== :: DeleteSecret -> DeleteSecret -> Bool
$c== :: DeleteSecret -> DeleteSecret -> Bool
Prelude.Eq, ReadPrec [DeleteSecret]
ReadPrec DeleteSecret
Int -> ReadS DeleteSecret
ReadS [DeleteSecret]
(Int -> ReadS DeleteSecret)
-> ReadS [DeleteSecret]
-> ReadPrec DeleteSecret
-> ReadPrec [DeleteSecret]
-> Read DeleteSecret
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSecret]
$creadListPrec :: ReadPrec [DeleteSecret]
readPrec :: ReadPrec DeleteSecret
$creadPrec :: ReadPrec DeleteSecret
readList :: ReadS [DeleteSecret]
$creadList :: ReadS [DeleteSecret]
readsPrec :: Int -> ReadS DeleteSecret
$creadsPrec :: Int -> ReadS DeleteSecret
Prelude.Read, Int -> DeleteSecret -> ShowS
[DeleteSecret] -> ShowS
DeleteSecret -> String
(Int -> DeleteSecret -> ShowS)
-> (DeleteSecret -> String)
-> ([DeleteSecret] -> ShowS)
-> Show DeleteSecret
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSecret] -> ShowS
$cshowList :: [DeleteSecret] -> ShowS
show :: DeleteSecret -> String
$cshow :: DeleteSecret -> String
showsPrec :: Int -> DeleteSecret -> ShowS
$cshowsPrec :: Int -> DeleteSecret -> ShowS
Prelude.Show, (forall x. DeleteSecret -> Rep DeleteSecret x)
-> (forall x. Rep DeleteSecret x -> DeleteSecret)
-> Generic DeleteSecret
forall x. Rep DeleteSecret x -> DeleteSecret
forall x. DeleteSecret -> Rep DeleteSecret x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSecret x -> DeleteSecret
$cfrom :: forall x. DeleteSecret -> Rep DeleteSecret x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSecret' 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:
--
-- 'recoveryWindowInDays', 'deleteSecret_recoveryWindowInDays' - (Optional) Specifies the number of days that Secrets Manager waits
-- before Secrets Manager can delete the secret. You can\'t use both this
-- parameter and the @ForceDeleteWithoutRecovery@ parameter in the same API
-- call.
--
-- This value can range from 7 to 30 days with a default value of 30.
--
-- 'forceDeleteWithoutRecovery', 'deleteSecret_forceDeleteWithoutRecovery' - (Optional) Specifies that the secret is to be deleted without any
-- recovery window. You can\'t use both this parameter and the
-- @RecoveryWindowInDays@ parameter in the same API call.
--
-- An asynchronous background process performs the actual deletion, so
-- there can be a short delay before the operation completes. If you write
-- code to delete and then immediately recreate a secret with the same
-- name, ensure that your code includes appropriate back off and retry
-- logic.
--
-- Use this parameter with caution. This parameter causes the operation to
-- skip the normal waiting period before the permanent deletion that Amazon
-- Web Services would normally impose with the @RecoveryWindowInDays@
-- parameter. If you delete a secret with the @ForceDeleteWithouRecovery@
-- parameter, then you have no opportunity to recover the secret. You lose
-- the secret permanently.
--
-- If you use this parameter and include a previously deleted or
-- nonexistent secret, the operation does not return the error
-- @ResourceNotFoundException@ in order to correctly handle retries.
--
-- 'secretId', 'deleteSecret_secretId' - Specifies the secret to delete. You can specify either the Amazon
-- Resource Name (ARN) or the friendly name of the secret.
--
-- For an ARN, we recommend that you specify a complete ARN rather than a
-- partial ARN.
newDeleteSecret ::
  -- | 'secretId'
  Prelude.Text ->
  DeleteSecret
newDeleteSecret :: Text -> DeleteSecret
newDeleteSecret Text
pSecretId_ =
  DeleteSecret' :: Maybe Integer -> Maybe Bool -> Text -> DeleteSecret
DeleteSecret'
    { $sel:recoveryWindowInDays:DeleteSecret' :: Maybe Integer
recoveryWindowInDays =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:forceDeleteWithoutRecovery:DeleteSecret' :: Maybe Bool
forceDeleteWithoutRecovery = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:secretId:DeleteSecret' :: Text
secretId = Text
pSecretId_
    }

-- | (Optional) Specifies the number of days that Secrets Manager waits
-- before Secrets Manager can delete the secret. You can\'t use both this
-- parameter and the @ForceDeleteWithoutRecovery@ parameter in the same API
-- call.
--
-- This value can range from 7 to 30 days with a default value of 30.
deleteSecret_recoveryWindowInDays :: Lens.Lens' DeleteSecret (Prelude.Maybe Prelude.Integer)
deleteSecret_recoveryWindowInDays :: (Maybe Integer -> f (Maybe Integer))
-> DeleteSecret -> f DeleteSecret
deleteSecret_recoveryWindowInDays = (DeleteSecret -> Maybe Integer)
-> (DeleteSecret -> Maybe Integer -> DeleteSecret)
-> Lens DeleteSecret DeleteSecret (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSecret' {Maybe Integer
recoveryWindowInDays :: Maybe Integer
$sel:recoveryWindowInDays:DeleteSecret' :: DeleteSecret -> Maybe Integer
recoveryWindowInDays} -> Maybe Integer
recoveryWindowInDays) (\s :: DeleteSecret
s@DeleteSecret' {} Maybe Integer
a -> DeleteSecret
s {$sel:recoveryWindowInDays:DeleteSecret' :: Maybe Integer
recoveryWindowInDays = Maybe Integer
a} :: DeleteSecret)

-- | (Optional) Specifies that the secret is to be deleted without any
-- recovery window. You can\'t use both this parameter and the
-- @RecoveryWindowInDays@ parameter in the same API call.
--
-- An asynchronous background process performs the actual deletion, so
-- there can be a short delay before the operation completes. If you write
-- code to delete and then immediately recreate a secret with the same
-- name, ensure that your code includes appropriate back off and retry
-- logic.
--
-- Use this parameter with caution. This parameter causes the operation to
-- skip the normal waiting period before the permanent deletion that Amazon
-- Web Services would normally impose with the @RecoveryWindowInDays@
-- parameter. If you delete a secret with the @ForceDeleteWithouRecovery@
-- parameter, then you have no opportunity to recover the secret. You lose
-- the secret permanently.
--
-- If you use this parameter and include a previously deleted or
-- nonexistent secret, the operation does not return the error
-- @ResourceNotFoundException@ in order to correctly handle retries.
deleteSecret_forceDeleteWithoutRecovery :: Lens.Lens' DeleteSecret (Prelude.Maybe Prelude.Bool)
deleteSecret_forceDeleteWithoutRecovery :: (Maybe Bool -> f (Maybe Bool)) -> DeleteSecret -> f DeleteSecret
deleteSecret_forceDeleteWithoutRecovery = (DeleteSecret -> Maybe Bool)
-> (DeleteSecret -> Maybe Bool -> DeleteSecret)
-> Lens DeleteSecret DeleteSecret (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSecret' {Maybe Bool
forceDeleteWithoutRecovery :: Maybe Bool
$sel:forceDeleteWithoutRecovery:DeleteSecret' :: DeleteSecret -> Maybe Bool
forceDeleteWithoutRecovery} -> Maybe Bool
forceDeleteWithoutRecovery) (\s :: DeleteSecret
s@DeleteSecret' {} Maybe Bool
a -> DeleteSecret
s {$sel:forceDeleteWithoutRecovery:DeleteSecret' :: Maybe Bool
forceDeleteWithoutRecovery = Maybe Bool
a} :: DeleteSecret)

-- | Specifies the secret to delete. You can specify either the Amazon
-- Resource Name (ARN) or the friendly name of the secret.
--
-- For an ARN, we recommend that you specify a complete ARN rather than a
-- partial ARN.
deleteSecret_secretId :: Lens.Lens' DeleteSecret Prelude.Text
deleteSecret_secretId :: (Text -> f Text) -> DeleteSecret -> f DeleteSecret
deleteSecret_secretId = (DeleteSecret -> Text)
-> (DeleteSecret -> Text -> DeleteSecret)
-> Lens DeleteSecret DeleteSecret Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSecret' {Text
secretId :: Text
$sel:secretId:DeleteSecret' :: DeleteSecret -> Text
secretId} -> Text
secretId) (\s :: DeleteSecret
s@DeleteSecret' {} Text
a -> DeleteSecret
s {$sel:secretId:DeleteSecret' :: Text
secretId = Text
a} :: DeleteSecret)

instance Core.AWSRequest DeleteSecret where
  type AWSResponse DeleteSecret = DeleteSecretResponse
  request :: DeleteSecret -> Request DeleteSecret
request = Service -> DeleteSecret -> Request DeleteSecret
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteSecret
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSecret)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteSecret))
-> Logger
-> Service
-> Proxy DeleteSecret
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSecret)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text -> Maybe POSIX -> Int -> DeleteSecretResponse
DeleteSecretResponse'
            (Maybe Text
 -> Maybe Text -> Maybe POSIX -> Int -> DeleteSecretResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe POSIX -> Int -> DeleteSecretResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ARN")
            Either
  String (Maybe Text -> Maybe POSIX -> Int -> DeleteSecretResponse)
-> Either String (Maybe Text)
-> Either String (Maybe POSIX -> Int -> DeleteSecretResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Name")
            Either String (Maybe POSIX -> Int -> DeleteSecretResponse)
-> Either String (Maybe POSIX)
-> Either String (Int -> DeleteSecretResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DeletionDate")
            Either String (Int -> DeleteSecretResponse)
-> Either String Int -> Either String DeleteSecretResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteSecret

instance Prelude.NFData DeleteSecret

instance Core.ToHeaders DeleteSecret where
  toHeaders :: DeleteSecret -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteSecret -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"secretsmanager.DeleteSecret" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeleteSecret where
  toJSON :: DeleteSecret -> Value
toJSON DeleteSecret' {Maybe Bool
Maybe Integer
Text
secretId :: Text
forceDeleteWithoutRecovery :: Maybe Bool
recoveryWindowInDays :: Maybe Integer
$sel:secretId:DeleteSecret' :: DeleteSecret -> Text
$sel:forceDeleteWithoutRecovery:DeleteSecret' :: DeleteSecret -> Maybe Bool
$sel:recoveryWindowInDays:DeleteSecret' :: DeleteSecret -> Maybe Integer
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RecoveryWindowInDays" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
recoveryWindowInDays,
            (Text
"ForceDeleteWithoutRecovery" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
forceDeleteWithoutRecovery,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SecretId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
secretId)
          ]
      )

instance Core.ToPath DeleteSecret where
  toPath :: DeleteSecret -> ByteString
toPath = ByteString -> DeleteSecret -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDeleteSecretResponse' smart constructor.
data DeleteSecretResponse = DeleteSecretResponse'
  { -- | The ARN of the secret that is now scheduled for deletion.
    DeleteSecretResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The friendly name of the secret currently scheduled for deletion.
    DeleteSecretResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The date and time after which this secret can be deleted by Secrets
    -- Manager and can no longer be restored. This value is the date and time
    -- of the delete request plus the number of days specified in
    -- @RecoveryWindowInDays@.
    DeleteSecretResponse -> Maybe POSIX
deletionDate :: Prelude.Maybe Core.POSIX,
    -- | The response's http status code.
    DeleteSecretResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteSecretResponse -> DeleteSecretResponse -> Bool
(DeleteSecretResponse -> DeleteSecretResponse -> Bool)
-> (DeleteSecretResponse -> DeleteSecretResponse -> Bool)
-> Eq DeleteSecretResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSecretResponse -> DeleteSecretResponse -> Bool
$c/= :: DeleteSecretResponse -> DeleteSecretResponse -> Bool
== :: DeleteSecretResponse -> DeleteSecretResponse -> Bool
$c== :: DeleteSecretResponse -> DeleteSecretResponse -> Bool
Prelude.Eq, ReadPrec [DeleteSecretResponse]
ReadPrec DeleteSecretResponse
Int -> ReadS DeleteSecretResponse
ReadS [DeleteSecretResponse]
(Int -> ReadS DeleteSecretResponse)
-> ReadS [DeleteSecretResponse]
-> ReadPrec DeleteSecretResponse
-> ReadPrec [DeleteSecretResponse]
-> Read DeleteSecretResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSecretResponse]
$creadListPrec :: ReadPrec [DeleteSecretResponse]
readPrec :: ReadPrec DeleteSecretResponse
$creadPrec :: ReadPrec DeleteSecretResponse
readList :: ReadS [DeleteSecretResponse]
$creadList :: ReadS [DeleteSecretResponse]
readsPrec :: Int -> ReadS DeleteSecretResponse
$creadsPrec :: Int -> ReadS DeleteSecretResponse
Prelude.Read, Int -> DeleteSecretResponse -> ShowS
[DeleteSecretResponse] -> ShowS
DeleteSecretResponse -> String
(Int -> DeleteSecretResponse -> ShowS)
-> (DeleteSecretResponse -> String)
-> ([DeleteSecretResponse] -> ShowS)
-> Show DeleteSecretResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSecretResponse] -> ShowS
$cshowList :: [DeleteSecretResponse] -> ShowS
show :: DeleteSecretResponse -> String
$cshow :: DeleteSecretResponse -> String
showsPrec :: Int -> DeleteSecretResponse -> ShowS
$cshowsPrec :: Int -> DeleteSecretResponse -> ShowS
Prelude.Show, (forall x. DeleteSecretResponse -> Rep DeleteSecretResponse x)
-> (forall x. Rep DeleteSecretResponse x -> DeleteSecretResponse)
-> Generic DeleteSecretResponse
forall x. Rep DeleteSecretResponse x -> DeleteSecretResponse
forall x. DeleteSecretResponse -> Rep DeleteSecretResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSecretResponse x -> DeleteSecretResponse
$cfrom :: forall x. DeleteSecretResponse -> Rep DeleteSecretResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSecretResponse' 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:
--
-- 'arn', 'deleteSecretResponse_arn' - The ARN of the secret that is now scheduled for deletion.
--
-- 'name', 'deleteSecretResponse_name' - The friendly name of the secret currently scheduled for deletion.
--
-- 'deletionDate', 'deleteSecretResponse_deletionDate' - The date and time after which this secret can be deleted by Secrets
-- Manager and can no longer be restored. This value is the date and time
-- of the delete request plus the number of days specified in
-- @RecoveryWindowInDays@.
--
-- 'httpStatus', 'deleteSecretResponse_httpStatus' - The response's http status code.
newDeleteSecretResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteSecretResponse
newDeleteSecretResponse :: Int -> DeleteSecretResponse
newDeleteSecretResponse Int
pHttpStatus_ =
  DeleteSecretResponse' :: Maybe Text
-> Maybe Text -> Maybe POSIX -> Int -> DeleteSecretResponse
DeleteSecretResponse'
    { $sel:arn:DeleteSecretResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DeleteSecretResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deletionDate:DeleteSecretResponse' :: Maybe POSIX
deletionDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteSecretResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the secret that is now scheduled for deletion.
deleteSecretResponse_arn :: Lens.Lens' DeleteSecretResponse (Prelude.Maybe Prelude.Text)
deleteSecretResponse_arn :: (Maybe Text -> f (Maybe Text))
-> DeleteSecretResponse -> f DeleteSecretResponse
deleteSecretResponse_arn = (DeleteSecretResponse -> Maybe Text)
-> (DeleteSecretResponse -> Maybe Text -> DeleteSecretResponse)
-> Lens
     DeleteSecretResponse DeleteSecretResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSecretResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:DeleteSecretResponse' :: DeleteSecretResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeleteSecretResponse
s@DeleteSecretResponse' {} Maybe Text
a -> DeleteSecretResponse
s {$sel:arn:DeleteSecretResponse' :: Maybe Text
arn = Maybe Text
a} :: DeleteSecretResponse)

-- | The friendly name of the secret currently scheduled for deletion.
deleteSecretResponse_name :: Lens.Lens' DeleteSecretResponse (Prelude.Maybe Prelude.Text)
deleteSecretResponse_name :: (Maybe Text -> f (Maybe Text))
-> DeleteSecretResponse -> f DeleteSecretResponse
deleteSecretResponse_name = (DeleteSecretResponse -> Maybe Text)
-> (DeleteSecretResponse -> Maybe Text -> DeleteSecretResponse)
-> Lens
     DeleteSecretResponse DeleteSecretResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSecretResponse' {Maybe Text
name :: Maybe Text
$sel:name:DeleteSecretResponse' :: DeleteSecretResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: DeleteSecretResponse
s@DeleteSecretResponse' {} Maybe Text
a -> DeleteSecretResponse
s {$sel:name:DeleteSecretResponse' :: Maybe Text
name = Maybe Text
a} :: DeleteSecretResponse)

-- | The date and time after which this secret can be deleted by Secrets
-- Manager and can no longer be restored. This value is the date and time
-- of the delete request plus the number of days specified in
-- @RecoveryWindowInDays@.
deleteSecretResponse_deletionDate :: Lens.Lens' DeleteSecretResponse (Prelude.Maybe Prelude.UTCTime)
deleteSecretResponse_deletionDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DeleteSecretResponse -> f DeleteSecretResponse
deleteSecretResponse_deletionDate = (DeleteSecretResponse -> Maybe POSIX)
-> (DeleteSecretResponse -> Maybe POSIX -> DeleteSecretResponse)
-> Lens
     DeleteSecretResponse
     DeleteSecretResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSecretResponse' {Maybe POSIX
deletionDate :: Maybe POSIX
$sel:deletionDate:DeleteSecretResponse' :: DeleteSecretResponse -> Maybe POSIX
deletionDate} -> Maybe POSIX
deletionDate) (\s :: DeleteSecretResponse
s@DeleteSecretResponse' {} Maybe POSIX
a -> DeleteSecretResponse
s {$sel:deletionDate:DeleteSecretResponse' :: Maybe POSIX
deletionDate = Maybe POSIX
a} :: DeleteSecretResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> DeleteSecretResponse -> f DeleteSecretResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DeleteSecretResponse
-> f DeleteSecretResponse
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

-- | The response's http status code.
deleteSecretResponse_httpStatus :: Lens.Lens' DeleteSecretResponse Prelude.Int
deleteSecretResponse_httpStatus :: (Int -> f Int) -> DeleteSecretResponse -> f DeleteSecretResponse
deleteSecretResponse_httpStatus = (DeleteSecretResponse -> Int)
-> (DeleteSecretResponse -> Int -> DeleteSecretResponse)
-> Lens DeleteSecretResponse DeleteSecretResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSecretResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteSecretResponse' :: DeleteSecretResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteSecretResponse
s@DeleteSecretResponse' {} Int
a -> DeleteSecretResponse
s {$sel:httpStatus:DeleteSecretResponse' :: Int
httpStatus = Int
a} :: DeleteSecretResponse)

instance Prelude.NFData DeleteSecretResponse