{-# 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.RotateSecret
-- 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)
--
-- Configures and starts the asynchronous process of rotating this secret.
-- If you include the configuration parameters, the operation sets those
-- values for the secret and then immediately starts a rotation. If you do
-- not include the configuration parameters, the operation starts a
-- rotation with the values already stored in the secret. After the
-- rotation completes, the protected service and its clients all use the
-- new version of the secret.
--
-- This required configuration information includes the ARN of an Amazon
-- Web Services Lambda function and optionally, the time between scheduled
-- rotations. The Lambda rotation function creates a new version of the
-- secret and creates or updates the credentials on the protected service
-- to match. After testing the new credentials, the function marks the new
-- secret with the staging label @AWSCURRENT@ so that your clients all
-- immediately begin to use the new version. For more information about
-- rotating secrets and how to configure a Lambda function to rotate the
-- secrets for your protected service, see
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html Rotating Secrets in Amazon Web Services Secrets Manager>
-- in the /Amazon Web Services Secrets Manager User Guide/.
--
-- Secrets Manager schedules the next rotation when the previous one
-- completes. Secrets Manager schedules the date by adding the rotation
-- interval (number of days) to the actual date of the last rotation. The
-- service chooses the hour within that 24-hour date window randomly. The
-- minute is also chosen somewhat randomly, but weighted towards the top of
-- the hour and influenced by a variety of factors that help distribute
-- load.
--
-- The rotation function must end with the versions of the secret in one of
-- two states:
--
-- -   The @AWSPENDING@ and @AWSCURRENT@ staging labels are attached to the
--     same version of the secret, or
--
-- -   The @AWSPENDING@ staging label is not attached to any version of the
--     secret.
--
-- If the @AWSPENDING@ staging label is present but not attached to the
-- same version as @AWSCURRENT@ then any later invocation of @RotateSecret@
-- assumes that a previous rotation request is still in progress and
-- returns an error.
--
-- __Minimum permissions__
--
-- To run this command, you must have the following permissions:
--
-- -   secretsmanager:RotateSecret
--
-- -   lambda:InvokeFunction (on the function specified in the secret\'s
--     metadata)
--
-- __Related operations__
--
-- -   To list the secrets in your account, use ListSecrets.
--
-- -   To get the details for a version of a secret, use DescribeSecret.
--
-- -   To create a new version of a secret, use CreateSecret.
--
-- -   To attach staging labels to or remove staging labels from a version
--     of a secret, use UpdateSecretVersionStage.
module Amazonka.SecretsManager.RotateSecret
  ( -- * Creating a Request
    RotateSecret (..),
    newRotateSecret,

    -- * Request Lenses
    rotateSecret_rotationRules,
    rotateSecret_clientRequestToken,
    rotateSecret_rotationLambdaARN,
    rotateSecret_secretId,

    -- * Destructuring the Response
    RotateSecretResponse (..),
    newRotateSecretResponse,

    -- * Response Lenses
    rotateSecretResponse_versionId,
    rotateSecretResponse_arn,
    rotateSecretResponse_name,
    rotateSecretResponse_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:/ 'newRotateSecret' smart constructor.
data RotateSecret = RotateSecret'
  { -- | A structure that defines the rotation configuration for this secret.
    RotateSecret -> Maybe RotationRulesType
rotationRules :: Prelude.Maybe RotationRulesType,
    -- | (Optional) Specifies a unique identifier for the new version of the
    -- secret that helps ensure idempotency.
    --
    -- If you use the Amazon Web Services CLI or one of the Amazon Web Services
    -- SDK to call this operation, then you can leave this parameter empty. The
    -- CLI or SDK generates a random UUID for you and includes that in the
    -- request for this parameter. If you don\'t use the SDK and instead
    -- generate a raw HTTP request to the Secrets Manager service endpoint,
    -- then you must generate a @ClientRequestToken@ yourself for new versions
    -- and include that value in the request.
    --
    -- You only need to specify your own value if you implement your own retry
    -- logic and want to ensure that a given secret is not created twice. We
    -- recommend that you generate a
    -- <https://wikipedia.org/wiki/Universally_unique_identifier UUID-type>
    -- value to ensure uniqueness within the specified secret.
    --
    -- Secrets Manager uses this value to prevent the accidental creation of
    -- duplicate versions if there are failures and retries during the
    -- function\'s processing. This value becomes the @VersionId@ of the new
    -- version.
    RotateSecret -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | (Optional) Specifies the ARN of the Lambda function that can rotate the
    -- secret.
    RotateSecret -> Maybe Text
rotationLambdaARN :: Prelude.Maybe Prelude.Text,
    -- | Specifies the secret that you want to rotate. 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.
    RotateSecret -> Text
secretId :: Prelude.Text
  }
  deriving (RotateSecret -> RotateSecret -> Bool
(RotateSecret -> RotateSecret -> Bool)
-> (RotateSecret -> RotateSecret -> Bool) -> Eq RotateSecret
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RotateSecret -> RotateSecret -> Bool
$c/= :: RotateSecret -> RotateSecret -> Bool
== :: RotateSecret -> RotateSecret -> Bool
$c== :: RotateSecret -> RotateSecret -> Bool
Prelude.Eq, ReadPrec [RotateSecret]
ReadPrec RotateSecret
Int -> ReadS RotateSecret
ReadS [RotateSecret]
(Int -> ReadS RotateSecret)
-> ReadS [RotateSecret]
-> ReadPrec RotateSecret
-> ReadPrec [RotateSecret]
-> Read RotateSecret
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RotateSecret]
$creadListPrec :: ReadPrec [RotateSecret]
readPrec :: ReadPrec RotateSecret
$creadPrec :: ReadPrec RotateSecret
readList :: ReadS [RotateSecret]
$creadList :: ReadS [RotateSecret]
readsPrec :: Int -> ReadS RotateSecret
$creadsPrec :: Int -> ReadS RotateSecret
Prelude.Read, Int -> RotateSecret -> ShowS
[RotateSecret] -> ShowS
RotateSecret -> String
(Int -> RotateSecret -> ShowS)
-> (RotateSecret -> String)
-> ([RotateSecret] -> ShowS)
-> Show RotateSecret
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RotateSecret] -> ShowS
$cshowList :: [RotateSecret] -> ShowS
show :: RotateSecret -> String
$cshow :: RotateSecret -> String
showsPrec :: Int -> RotateSecret -> ShowS
$cshowsPrec :: Int -> RotateSecret -> ShowS
Prelude.Show, (forall x. RotateSecret -> Rep RotateSecret x)
-> (forall x. Rep RotateSecret x -> RotateSecret)
-> Generic RotateSecret
forall x. Rep RotateSecret x -> RotateSecret
forall x. RotateSecret -> Rep RotateSecret x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RotateSecret x -> RotateSecret
$cfrom :: forall x. RotateSecret -> Rep RotateSecret x
Prelude.Generic)

-- |
-- Create a value of 'RotateSecret' 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:
--
-- 'rotationRules', 'rotateSecret_rotationRules' - A structure that defines the rotation configuration for this secret.
--
-- 'clientRequestToken', 'rotateSecret_clientRequestToken' - (Optional) Specifies a unique identifier for the new version of the
-- secret that helps ensure idempotency.
--
-- If you use the Amazon Web Services CLI or one of the Amazon Web Services
-- SDK to call this operation, then you can leave this parameter empty. The
-- CLI or SDK generates a random UUID for you and includes that in the
-- request for this parameter. If you don\'t use the SDK and instead
-- generate a raw HTTP request to the Secrets Manager service endpoint,
-- then you must generate a @ClientRequestToken@ yourself for new versions
-- and include that value in the request.
--
-- You only need to specify your own value if you implement your own retry
-- logic and want to ensure that a given secret is not created twice. We
-- recommend that you generate a
-- <https://wikipedia.org/wiki/Universally_unique_identifier UUID-type>
-- value to ensure uniqueness within the specified secret.
--
-- Secrets Manager uses this value to prevent the accidental creation of
-- duplicate versions if there are failures and retries during the
-- function\'s processing. This value becomes the @VersionId@ of the new
-- version.
--
-- 'rotationLambdaARN', 'rotateSecret_rotationLambdaARN' - (Optional) Specifies the ARN of the Lambda function that can rotate the
-- secret.
--
-- 'secretId', 'rotateSecret_secretId' - Specifies the secret that you want to rotate. 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.
newRotateSecret ::
  -- | 'secretId'
  Prelude.Text ->
  RotateSecret
newRotateSecret :: Text -> RotateSecret
newRotateSecret Text
pSecretId_ =
  RotateSecret' :: Maybe RotationRulesType
-> Maybe Text -> Maybe Text -> Text -> RotateSecret
RotateSecret'
    { $sel:rotationRules:RotateSecret' :: Maybe RotationRulesType
rotationRules = Maybe RotationRulesType
forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestToken:RotateSecret' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:rotationLambdaARN:RotateSecret' :: Maybe Text
rotationLambdaARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:secretId:RotateSecret' :: Text
secretId = Text
pSecretId_
    }

-- | A structure that defines the rotation configuration for this secret.
rotateSecret_rotationRules :: Lens.Lens' RotateSecret (Prelude.Maybe RotationRulesType)
rotateSecret_rotationRules :: (Maybe RotationRulesType -> f (Maybe RotationRulesType))
-> RotateSecret -> f RotateSecret
rotateSecret_rotationRules = (RotateSecret -> Maybe RotationRulesType)
-> (RotateSecret -> Maybe RotationRulesType -> RotateSecret)
-> Lens
     RotateSecret
     RotateSecret
     (Maybe RotationRulesType)
     (Maybe RotationRulesType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecret' {Maybe RotationRulesType
rotationRules :: Maybe RotationRulesType
$sel:rotationRules:RotateSecret' :: RotateSecret -> Maybe RotationRulesType
rotationRules} -> Maybe RotationRulesType
rotationRules) (\s :: RotateSecret
s@RotateSecret' {} Maybe RotationRulesType
a -> RotateSecret
s {$sel:rotationRules:RotateSecret' :: Maybe RotationRulesType
rotationRules = Maybe RotationRulesType
a} :: RotateSecret)

-- | (Optional) Specifies a unique identifier for the new version of the
-- secret that helps ensure idempotency.
--
-- If you use the Amazon Web Services CLI or one of the Amazon Web Services
-- SDK to call this operation, then you can leave this parameter empty. The
-- CLI or SDK generates a random UUID for you and includes that in the
-- request for this parameter. If you don\'t use the SDK and instead
-- generate a raw HTTP request to the Secrets Manager service endpoint,
-- then you must generate a @ClientRequestToken@ yourself for new versions
-- and include that value in the request.
--
-- You only need to specify your own value if you implement your own retry
-- logic and want to ensure that a given secret is not created twice. We
-- recommend that you generate a
-- <https://wikipedia.org/wiki/Universally_unique_identifier UUID-type>
-- value to ensure uniqueness within the specified secret.
--
-- Secrets Manager uses this value to prevent the accidental creation of
-- duplicate versions if there are failures and retries during the
-- function\'s processing. This value becomes the @VersionId@ of the new
-- version.
rotateSecret_clientRequestToken :: Lens.Lens' RotateSecret (Prelude.Maybe Prelude.Text)
rotateSecret_clientRequestToken :: (Maybe Text -> f (Maybe Text)) -> RotateSecret -> f RotateSecret
rotateSecret_clientRequestToken = (RotateSecret -> Maybe Text)
-> (RotateSecret -> Maybe Text -> RotateSecret)
-> Lens RotateSecret RotateSecret (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecret' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:RotateSecret' :: RotateSecret -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: RotateSecret
s@RotateSecret' {} Maybe Text
a -> RotateSecret
s {$sel:clientRequestToken:RotateSecret' :: Maybe Text
clientRequestToken = Maybe Text
a} :: RotateSecret)

-- | (Optional) Specifies the ARN of the Lambda function that can rotate the
-- secret.
rotateSecret_rotationLambdaARN :: Lens.Lens' RotateSecret (Prelude.Maybe Prelude.Text)
rotateSecret_rotationLambdaARN :: (Maybe Text -> f (Maybe Text)) -> RotateSecret -> f RotateSecret
rotateSecret_rotationLambdaARN = (RotateSecret -> Maybe Text)
-> (RotateSecret -> Maybe Text -> RotateSecret)
-> Lens RotateSecret RotateSecret (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecret' {Maybe Text
rotationLambdaARN :: Maybe Text
$sel:rotationLambdaARN:RotateSecret' :: RotateSecret -> Maybe Text
rotationLambdaARN} -> Maybe Text
rotationLambdaARN) (\s :: RotateSecret
s@RotateSecret' {} Maybe Text
a -> RotateSecret
s {$sel:rotationLambdaARN:RotateSecret' :: Maybe Text
rotationLambdaARN = Maybe Text
a} :: RotateSecret)

-- | Specifies the secret that you want to rotate. 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.
rotateSecret_secretId :: Lens.Lens' RotateSecret Prelude.Text
rotateSecret_secretId :: (Text -> f Text) -> RotateSecret -> f RotateSecret
rotateSecret_secretId = (RotateSecret -> Text)
-> (RotateSecret -> Text -> RotateSecret)
-> Lens RotateSecret RotateSecret Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecret' {Text
secretId :: Text
$sel:secretId:RotateSecret' :: RotateSecret -> Text
secretId} -> Text
secretId) (\s :: RotateSecret
s@RotateSecret' {} Text
a -> RotateSecret
s {$sel:secretId:RotateSecret' :: Text
secretId = Text
a} :: RotateSecret)

instance Core.AWSRequest RotateSecret where
  type AWSResponse RotateSecret = RotateSecretResponse
  request :: RotateSecret -> Request RotateSecret
request = Service -> RotateSecret -> Request RotateSecret
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RotateSecret
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RotateSecret)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse RotateSecret))
-> Logger
-> Service
-> Proxy RotateSecret
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RotateSecret)))
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 Text -> Int -> RotateSecretResponse
RotateSecretResponse'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Int -> RotateSecretResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> RotateSecretResponse)
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
"VersionId")
            Either
  String (Maybe Text -> Maybe Text -> Int -> RotateSecretResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> RotateSecretResponse)
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
"ARN")
            Either String (Maybe Text -> Int -> RotateSecretResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RotateSecretResponse)
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 (Int -> RotateSecretResponse)
-> Either String Int -> Either String RotateSecretResponse
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 RotateSecret

instance Prelude.NFData RotateSecret

instance Core.ToHeaders RotateSecret where
  toHeaders :: RotateSecret -> ResponseHeaders
toHeaders =
    ResponseHeaders -> RotateSecret -> 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.RotateSecret" ::
                          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 RotateSecret where
  toJSON :: RotateSecret -> Value
toJSON RotateSecret' {Maybe Text
Maybe RotationRulesType
Text
secretId :: Text
rotationLambdaARN :: Maybe Text
clientRequestToken :: Maybe Text
rotationRules :: Maybe RotationRulesType
$sel:secretId:RotateSecret' :: RotateSecret -> Text
$sel:rotationLambdaARN:RotateSecret' :: RotateSecret -> Maybe Text
$sel:clientRequestToken:RotateSecret' :: RotateSecret -> Maybe Text
$sel:rotationRules:RotateSecret' :: RotateSecret -> Maybe RotationRulesType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RotationRules" Text -> RotationRulesType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RotationRulesType -> Pair)
-> Maybe RotationRulesType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RotationRulesType
rotationRules,
            (Text
"ClientRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientRequestToken,
            (Text
"RotationLambdaARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
rotationLambdaARN,
            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 RotateSecret where
  toPath :: RotateSecret -> ByteString
toPath = ByteString -> RotateSecret -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newRotateSecretResponse' smart constructor.
data RotateSecretResponse = RotateSecretResponse'
  { -- | The ID of the new version of the secret created by the rotation started
    -- by this request.
    RotateSecretResponse -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the secret.
    RotateSecretResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The friendly name of the secret.
    RotateSecretResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    RotateSecretResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RotateSecretResponse -> RotateSecretResponse -> Bool
(RotateSecretResponse -> RotateSecretResponse -> Bool)
-> (RotateSecretResponse -> RotateSecretResponse -> Bool)
-> Eq RotateSecretResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RotateSecretResponse -> RotateSecretResponse -> Bool
$c/= :: RotateSecretResponse -> RotateSecretResponse -> Bool
== :: RotateSecretResponse -> RotateSecretResponse -> Bool
$c== :: RotateSecretResponse -> RotateSecretResponse -> Bool
Prelude.Eq, ReadPrec [RotateSecretResponse]
ReadPrec RotateSecretResponse
Int -> ReadS RotateSecretResponse
ReadS [RotateSecretResponse]
(Int -> ReadS RotateSecretResponse)
-> ReadS [RotateSecretResponse]
-> ReadPrec RotateSecretResponse
-> ReadPrec [RotateSecretResponse]
-> Read RotateSecretResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RotateSecretResponse]
$creadListPrec :: ReadPrec [RotateSecretResponse]
readPrec :: ReadPrec RotateSecretResponse
$creadPrec :: ReadPrec RotateSecretResponse
readList :: ReadS [RotateSecretResponse]
$creadList :: ReadS [RotateSecretResponse]
readsPrec :: Int -> ReadS RotateSecretResponse
$creadsPrec :: Int -> ReadS RotateSecretResponse
Prelude.Read, Int -> RotateSecretResponse -> ShowS
[RotateSecretResponse] -> ShowS
RotateSecretResponse -> String
(Int -> RotateSecretResponse -> ShowS)
-> (RotateSecretResponse -> String)
-> ([RotateSecretResponse] -> ShowS)
-> Show RotateSecretResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RotateSecretResponse] -> ShowS
$cshowList :: [RotateSecretResponse] -> ShowS
show :: RotateSecretResponse -> String
$cshow :: RotateSecretResponse -> String
showsPrec :: Int -> RotateSecretResponse -> ShowS
$cshowsPrec :: Int -> RotateSecretResponse -> ShowS
Prelude.Show, (forall x. RotateSecretResponse -> Rep RotateSecretResponse x)
-> (forall x. Rep RotateSecretResponse x -> RotateSecretResponse)
-> Generic RotateSecretResponse
forall x. Rep RotateSecretResponse x -> RotateSecretResponse
forall x. RotateSecretResponse -> Rep RotateSecretResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RotateSecretResponse x -> RotateSecretResponse
$cfrom :: forall x. RotateSecretResponse -> Rep RotateSecretResponse x
Prelude.Generic)

-- |
-- Create a value of 'RotateSecretResponse' 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:
--
-- 'versionId', 'rotateSecretResponse_versionId' - The ID of the new version of the secret created by the rotation started
-- by this request.
--
-- 'arn', 'rotateSecretResponse_arn' - The ARN of the secret.
--
-- 'name', 'rotateSecretResponse_name' - The friendly name of the secret.
--
-- 'httpStatus', 'rotateSecretResponse_httpStatus' - The response's http status code.
newRotateSecretResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RotateSecretResponse
newRotateSecretResponse :: Int -> RotateSecretResponse
newRotateSecretResponse Int
pHttpStatus_ =
  RotateSecretResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> RotateSecretResponse
RotateSecretResponse'
    { $sel:versionId:RotateSecretResponse' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:RotateSecretResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:RotateSecretResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RotateSecretResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID of the new version of the secret created by the rotation started
-- by this request.
rotateSecretResponse_versionId :: Lens.Lens' RotateSecretResponse (Prelude.Maybe Prelude.Text)
rotateSecretResponse_versionId :: (Maybe Text -> f (Maybe Text))
-> RotateSecretResponse -> f RotateSecretResponse
rotateSecretResponse_versionId = (RotateSecretResponse -> Maybe Text)
-> (RotateSecretResponse -> Maybe Text -> RotateSecretResponse)
-> Lens
     RotateSecretResponse RotateSecretResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecretResponse' {Maybe Text
versionId :: Maybe Text
$sel:versionId:RotateSecretResponse' :: RotateSecretResponse -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: RotateSecretResponse
s@RotateSecretResponse' {} Maybe Text
a -> RotateSecretResponse
s {$sel:versionId:RotateSecretResponse' :: Maybe Text
versionId = Maybe Text
a} :: RotateSecretResponse)

-- | The ARN of the secret.
rotateSecretResponse_arn :: Lens.Lens' RotateSecretResponse (Prelude.Maybe Prelude.Text)
rotateSecretResponse_arn :: (Maybe Text -> f (Maybe Text))
-> RotateSecretResponse -> f RotateSecretResponse
rotateSecretResponse_arn = (RotateSecretResponse -> Maybe Text)
-> (RotateSecretResponse -> Maybe Text -> RotateSecretResponse)
-> Lens
     RotateSecretResponse RotateSecretResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecretResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:RotateSecretResponse' :: RotateSecretResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: RotateSecretResponse
s@RotateSecretResponse' {} Maybe Text
a -> RotateSecretResponse
s {$sel:arn:RotateSecretResponse' :: Maybe Text
arn = Maybe Text
a} :: RotateSecretResponse)

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

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

instance Prelude.NFData RotateSecretResponse