{-# 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.GetSecretValue
-- 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)
--
-- Retrieves the contents of the encrypted fields @SecretString@ or
-- @SecretBinary@ from the specified version of a secret, whichever
-- contains content.
--
-- __Minimum permissions__
--
-- To run this command, you must have the following permissions:
--
-- -   secretsmanager:GetSecretValue
--
-- -   kms:Decrypt - required only if you use a customer-managed Amazon Web
--     Services KMS key to encrypt the secret. You do not need this
--     permission to use the account\'s default Amazon Web Services managed
--     CMK for Secrets Manager.
--
-- __Related operations__
--
-- -   To create a new version of the secret with different encrypted
--     information, use PutSecretValue.
--
-- -   To retrieve the non-encrypted details for the secret, use
--     DescribeSecret.
module Amazonka.SecretsManager.GetSecretValue
  ( -- * Creating a Request
    GetSecretValue (..),
    newGetSecretValue,

    -- * Request Lenses
    getSecretValue_versionId,
    getSecretValue_versionStage,
    getSecretValue_secretId,

    -- * Destructuring the Response
    GetSecretValueResponse (..),
    newGetSecretValueResponse,

    -- * Response Lenses
    getSecretValueResponse_versionId,
    getSecretValueResponse_arn,
    getSecretValueResponse_versionStages,
    getSecretValueResponse_secretBinary,
    getSecretValueResponse_createdDate,
    getSecretValueResponse_name,
    getSecretValueResponse_secretString,
    getSecretValueResponse_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:/ 'newGetSecretValue' smart constructor.
data GetSecretValue = GetSecretValue'
  { -- | Specifies the unique identifier of the version of the secret that you
    -- want to retrieve. If you specify both this parameter and @VersionStage@,
    -- the two parameters must refer to the same secret version. If you don\'t
    -- specify either a @VersionStage@ or @VersionId@ then the default is to
    -- perform the operation on the version with the @VersionStage@ value of
    -- @AWSCURRENT@.
    --
    -- This value is typically a
    -- <https://wikipedia.org/wiki/Universally_unique_identifier UUID-type>
    -- value with 32 hexadecimal digits.
    GetSecretValue -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the secret version that you want to retrieve by the staging
    -- label attached to the version.
    --
    -- Staging labels are used to keep track of different versions during the
    -- rotation process. If you specify both this parameter and @VersionId@,
    -- the two parameters must refer to the same secret version . If you don\'t
    -- specify either a @VersionStage@ or @VersionId@, then the default is to
    -- perform the operation on the version with the @VersionStage@ value of
    -- @AWSCURRENT@.
    GetSecretValue -> Maybe Text
versionStage :: Prelude.Maybe Prelude.Text,
    -- | Specifies the secret containing the version that you want to retrieve.
    -- 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.
    GetSecretValue -> Text
secretId :: Prelude.Text
  }
  deriving (GetSecretValue -> GetSecretValue -> Bool
(GetSecretValue -> GetSecretValue -> Bool)
-> (GetSecretValue -> GetSecretValue -> Bool) -> Eq GetSecretValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSecretValue -> GetSecretValue -> Bool
$c/= :: GetSecretValue -> GetSecretValue -> Bool
== :: GetSecretValue -> GetSecretValue -> Bool
$c== :: GetSecretValue -> GetSecretValue -> Bool
Prelude.Eq, ReadPrec [GetSecretValue]
ReadPrec GetSecretValue
Int -> ReadS GetSecretValue
ReadS [GetSecretValue]
(Int -> ReadS GetSecretValue)
-> ReadS [GetSecretValue]
-> ReadPrec GetSecretValue
-> ReadPrec [GetSecretValue]
-> Read GetSecretValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSecretValue]
$creadListPrec :: ReadPrec [GetSecretValue]
readPrec :: ReadPrec GetSecretValue
$creadPrec :: ReadPrec GetSecretValue
readList :: ReadS [GetSecretValue]
$creadList :: ReadS [GetSecretValue]
readsPrec :: Int -> ReadS GetSecretValue
$creadsPrec :: Int -> ReadS GetSecretValue
Prelude.Read, Int -> GetSecretValue -> ShowS
[GetSecretValue] -> ShowS
GetSecretValue -> String
(Int -> GetSecretValue -> ShowS)
-> (GetSecretValue -> String)
-> ([GetSecretValue] -> ShowS)
-> Show GetSecretValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSecretValue] -> ShowS
$cshowList :: [GetSecretValue] -> ShowS
show :: GetSecretValue -> String
$cshow :: GetSecretValue -> String
showsPrec :: Int -> GetSecretValue -> ShowS
$cshowsPrec :: Int -> GetSecretValue -> ShowS
Prelude.Show, (forall x. GetSecretValue -> Rep GetSecretValue x)
-> (forall x. Rep GetSecretValue x -> GetSecretValue)
-> Generic GetSecretValue
forall x. Rep GetSecretValue x -> GetSecretValue
forall x. GetSecretValue -> Rep GetSecretValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSecretValue x -> GetSecretValue
$cfrom :: forall x. GetSecretValue -> Rep GetSecretValue x
Prelude.Generic)

-- |
-- Create a value of 'GetSecretValue' 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', 'getSecretValue_versionId' - Specifies the unique identifier of the version of the secret that you
-- want to retrieve. If you specify both this parameter and @VersionStage@,
-- the two parameters must refer to the same secret version. If you don\'t
-- specify either a @VersionStage@ or @VersionId@ then the default is to
-- perform the operation on the version with the @VersionStage@ value of
-- @AWSCURRENT@.
--
-- This value is typically a
-- <https://wikipedia.org/wiki/Universally_unique_identifier UUID-type>
-- value with 32 hexadecimal digits.
--
-- 'versionStage', 'getSecretValue_versionStage' - Specifies the secret version that you want to retrieve by the staging
-- label attached to the version.
--
-- Staging labels are used to keep track of different versions during the
-- rotation process. If you specify both this parameter and @VersionId@,
-- the two parameters must refer to the same secret version . If you don\'t
-- specify either a @VersionStage@ or @VersionId@, then the default is to
-- perform the operation on the version with the @VersionStage@ value of
-- @AWSCURRENT@.
--
-- 'secretId', 'getSecretValue_secretId' - Specifies the secret containing the version that you want to retrieve.
-- 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.
newGetSecretValue ::
  -- | 'secretId'
  Prelude.Text ->
  GetSecretValue
newGetSecretValue :: Text -> GetSecretValue
newGetSecretValue Text
pSecretId_ =
  GetSecretValue' :: Maybe Text -> Maybe Text -> Text -> GetSecretValue
GetSecretValue'
    { $sel:versionId:GetSecretValue' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:versionStage:GetSecretValue' :: Maybe Text
versionStage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:secretId:GetSecretValue' :: Text
secretId = Text
pSecretId_
    }

-- | Specifies the unique identifier of the version of the secret that you
-- want to retrieve. If you specify both this parameter and @VersionStage@,
-- the two parameters must refer to the same secret version. If you don\'t
-- specify either a @VersionStage@ or @VersionId@ then the default is to
-- perform the operation on the version with the @VersionStage@ value of
-- @AWSCURRENT@.
--
-- This value is typically a
-- <https://wikipedia.org/wiki/Universally_unique_identifier UUID-type>
-- value with 32 hexadecimal digits.
getSecretValue_versionId :: Lens.Lens' GetSecretValue (Prelude.Maybe Prelude.Text)
getSecretValue_versionId :: (Maybe Text -> f (Maybe Text))
-> GetSecretValue -> f GetSecretValue
getSecretValue_versionId = (GetSecretValue -> Maybe Text)
-> (GetSecretValue -> Maybe Text -> GetSecretValue)
-> Lens GetSecretValue GetSecretValue (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecretValue' {Maybe Text
versionId :: Maybe Text
$sel:versionId:GetSecretValue' :: GetSecretValue -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: GetSecretValue
s@GetSecretValue' {} Maybe Text
a -> GetSecretValue
s {$sel:versionId:GetSecretValue' :: Maybe Text
versionId = Maybe Text
a} :: GetSecretValue)

-- | Specifies the secret version that you want to retrieve by the staging
-- label attached to the version.
--
-- Staging labels are used to keep track of different versions during the
-- rotation process. If you specify both this parameter and @VersionId@,
-- the two parameters must refer to the same secret version . If you don\'t
-- specify either a @VersionStage@ or @VersionId@, then the default is to
-- perform the operation on the version with the @VersionStage@ value of
-- @AWSCURRENT@.
getSecretValue_versionStage :: Lens.Lens' GetSecretValue (Prelude.Maybe Prelude.Text)
getSecretValue_versionStage :: (Maybe Text -> f (Maybe Text))
-> GetSecretValue -> f GetSecretValue
getSecretValue_versionStage = (GetSecretValue -> Maybe Text)
-> (GetSecretValue -> Maybe Text -> GetSecretValue)
-> Lens GetSecretValue GetSecretValue (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecretValue' {Maybe Text
versionStage :: Maybe Text
$sel:versionStage:GetSecretValue' :: GetSecretValue -> Maybe Text
versionStage} -> Maybe Text
versionStage) (\s :: GetSecretValue
s@GetSecretValue' {} Maybe Text
a -> GetSecretValue
s {$sel:versionStage:GetSecretValue' :: Maybe Text
versionStage = Maybe Text
a} :: GetSecretValue)

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

instance Core.AWSRequest GetSecretValue where
  type
    AWSResponse GetSecretValue =
      GetSecretValueResponse
  request :: GetSecretValue -> Request GetSecretValue
request = Service -> GetSecretValue -> Request GetSecretValue
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSecretValue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSecretValue)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetSecretValue))
-> Logger
-> Service
-> Proxy GetSecretValue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSecretValue)))
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 (NonEmpty Text)
-> Maybe (Sensitive Base64)
-> Maybe POSIX
-> Maybe Text
-> Maybe (Sensitive Text)
-> Int
-> GetSecretValueResponse
GetSecretValueResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe (NonEmpty Text)
 -> Maybe (Sensitive Base64)
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe (Sensitive Text)
 -> Int
 -> GetSecretValueResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe (NonEmpty Text)
      -> Maybe (Sensitive Base64)
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe (Sensitive Text)
      -> Int
      -> GetSecretValueResponse)
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 (NonEmpty Text)
   -> Maybe (Sensitive Base64)
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe (Sensitive Text)
   -> Int
   -> GetSecretValueResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe (NonEmpty Text)
      -> Maybe (Sensitive Base64)
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe (Sensitive Text)
      -> Int
      -> GetSecretValueResponse)
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 (NonEmpty Text)
   -> Maybe (Sensitive Base64)
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe (Sensitive Text)
   -> Int
   -> GetSecretValueResponse)
-> Either String (Maybe (NonEmpty Text))
-> Either
     String
     (Maybe (Sensitive Base64)
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe (Sensitive Text)
      -> Int
      -> GetSecretValueResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"VersionStages")
            Either
  String
  (Maybe (Sensitive Base64)
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe (Sensitive Text)
   -> Int
   -> GetSecretValueResponse)
-> Either String (Maybe (Sensitive Base64))
-> Either
     String
     (Maybe POSIX
      -> Maybe Text
      -> Maybe (Sensitive Text)
      -> Int
      -> GetSecretValueResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Sensitive Base64))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SecretBinary")
            Either
  String
  (Maybe POSIX
   -> Maybe Text
   -> Maybe (Sensitive Text)
   -> Int
   -> GetSecretValueResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe Text
      -> Maybe (Sensitive Text) -> Int -> GetSecretValueResponse)
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
"CreatedDate")
            Either
  String
  (Maybe Text
   -> Maybe (Sensitive Text) -> Int -> GetSecretValueResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe (Sensitive Text) -> Int -> GetSecretValueResponse)
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 (Sensitive Text) -> Int -> GetSecretValueResponse)
-> Either String (Maybe (Sensitive Text))
-> Either String (Int -> GetSecretValueResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SecretString")
            Either String (Int -> GetSecretValueResponse)
-> Either String Int -> Either String GetSecretValueResponse
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 GetSecretValue

instance Prelude.NFData GetSecretValue

instance Core.ToHeaders GetSecretValue where
  toHeaders :: GetSecretValue -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetSecretValue -> 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.GetSecretValue" ::
                          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 GetSecretValue where
  toJSON :: GetSecretValue -> Value
toJSON GetSecretValue' {Maybe Text
Text
secretId :: Text
versionStage :: Maybe Text
versionId :: Maybe Text
$sel:secretId:GetSecretValue' :: GetSecretValue -> Text
$sel:versionStage:GetSecretValue' :: GetSecretValue -> Maybe Text
$sel:versionId:GetSecretValue' :: GetSecretValue -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"VersionId" 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
versionId,
            (Text
"VersionStage" 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
versionStage,
            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 GetSecretValue where
  toPath :: GetSecretValue -> ByteString
toPath = ByteString -> GetSecretValue -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newGetSecretValueResponse' smart constructor.
data GetSecretValueResponse = GetSecretValueResponse'
  { -- | The unique identifier of this version of the secret.
    GetSecretValueResponse -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the secret.
    GetSecretValueResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | A list of all of the staging labels currently attached to this version
    -- of the secret.
    GetSecretValueResponse -> Maybe (NonEmpty Text)
versionStages :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The decrypted part of the protected secret information that was
    -- originally provided as binary data in the form of a byte array. The
    -- response parameter represents the binary data as a
    -- <https://tools.ietf.org/html/rfc4648#section-4 base64-encoded> string.
    --
    -- This parameter is not used if the secret is created by the Secrets
    -- Manager console.
    --
    -- If you store custom information in this field of the secret, then you
    -- must code your Lambda rotation function to parse and interpret whatever
    -- you store in the @SecretString@ or @SecretBinary@ fields.
    GetSecretValueResponse -> Maybe (Sensitive Base64)
secretBinary :: Prelude.Maybe (Core.Sensitive Core.Base64),
    -- | The date and time that this version of the secret was created.
    GetSecretValueResponse -> Maybe POSIX
createdDate :: Prelude.Maybe Core.POSIX,
    -- | The friendly name of the secret.
    GetSecretValueResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The decrypted part of the protected secret information that was
    -- originally provided as a string.
    --
    -- If you create this secret by using the Secrets Manager console then only
    -- the @SecretString@ parameter contains data. Secrets Manager stores the
    -- information as a JSON structure of key\/value pairs that the Lambda
    -- rotation function knows how to parse.
    --
    -- If you store custom information in the secret by using the CreateSecret,
    -- UpdateSecret, or PutSecretValue API operations instead of the Secrets
    -- Manager console, or by using the __Other secret type__ in the console,
    -- then you must code your Lambda rotation function to parse and interpret
    -- those values.
    GetSecretValueResponse -> Maybe (Sensitive Text)
secretString :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The response's http status code.
    GetSecretValueResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSecretValueResponse -> GetSecretValueResponse -> Bool
(GetSecretValueResponse -> GetSecretValueResponse -> Bool)
-> (GetSecretValueResponse -> GetSecretValueResponse -> Bool)
-> Eq GetSecretValueResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSecretValueResponse -> GetSecretValueResponse -> Bool
$c/= :: GetSecretValueResponse -> GetSecretValueResponse -> Bool
== :: GetSecretValueResponse -> GetSecretValueResponse -> Bool
$c== :: GetSecretValueResponse -> GetSecretValueResponse -> Bool
Prelude.Eq, Int -> GetSecretValueResponse -> ShowS
[GetSecretValueResponse] -> ShowS
GetSecretValueResponse -> String
(Int -> GetSecretValueResponse -> ShowS)
-> (GetSecretValueResponse -> String)
-> ([GetSecretValueResponse] -> ShowS)
-> Show GetSecretValueResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSecretValueResponse] -> ShowS
$cshowList :: [GetSecretValueResponse] -> ShowS
show :: GetSecretValueResponse -> String
$cshow :: GetSecretValueResponse -> String
showsPrec :: Int -> GetSecretValueResponse -> ShowS
$cshowsPrec :: Int -> GetSecretValueResponse -> ShowS
Prelude.Show, (forall x. GetSecretValueResponse -> Rep GetSecretValueResponse x)
-> (forall x.
    Rep GetSecretValueResponse x -> GetSecretValueResponse)
-> Generic GetSecretValueResponse
forall x. Rep GetSecretValueResponse x -> GetSecretValueResponse
forall x. GetSecretValueResponse -> Rep GetSecretValueResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSecretValueResponse x -> GetSecretValueResponse
$cfrom :: forall x. GetSecretValueResponse -> Rep GetSecretValueResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSecretValueResponse' 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', 'getSecretValueResponse_versionId' - The unique identifier of this version of the secret.
--
-- 'arn', 'getSecretValueResponse_arn' - The ARN of the secret.
--
-- 'versionStages', 'getSecretValueResponse_versionStages' - A list of all of the staging labels currently attached to this version
-- of the secret.
--
-- 'secretBinary', 'getSecretValueResponse_secretBinary' - The decrypted part of the protected secret information that was
-- originally provided as binary data in the form of a byte array. The
-- response parameter represents the binary data as a
-- <https://tools.ietf.org/html/rfc4648#section-4 base64-encoded> string.
--
-- This parameter is not used if the secret is created by the Secrets
-- Manager console.
--
-- If you store custom information in this field of the secret, then you
-- must code your Lambda rotation function to parse and interpret whatever
-- you store in the @SecretString@ or @SecretBinary@ fields.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
--
-- 'createdDate', 'getSecretValueResponse_createdDate' - The date and time that this version of the secret was created.
--
-- 'name', 'getSecretValueResponse_name' - The friendly name of the secret.
--
-- 'secretString', 'getSecretValueResponse_secretString' - The decrypted part of the protected secret information that was
-- originally provided as a string.
--
-- If you create this secret by using the Secrets Manager console then only
-- the @SecretString@ parameter contains data. Secrets Manager stores the
-- information as a JSON structure of key\/value pairs that the Lambda
-- rotation function knows how to parse.
--
-- If you store custom information in the secret by using the CreateSecret,
-- UpdateSecret, or PutSecretValue API operations instead of the Secrets
-- Manager console, or by using the __Other secret type__ in the console,
-- then you must code your Lambda rotation function to parse and interpret
-- those values.
--
-- 'httpStatus', 'getSecretValueResponse_httpStatus' - The response's http status code.
newGetSecretValueResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSecretValueResponse
newGetSecretValueResponse :: Int -> GetSecretValueResponse
newGetSecretValueResponse Int
pHttpStatus_ =
  GetSecretValueResponse' :: Maybe Text
-> Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe (Sensitive Base64)
-> Maybe POSIX
-> Maybe Text
-> Maybe (Sensitive Text)
-> Int
-> GetSecretValueResponse
GetSecretValueResponse'
    { $sel:versionId:GetSecretValueResponse' :: Maybe Text
versionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:GetSecretValueResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:versionStages:GetSecretValueResponse' :: Maybe (NonEmpty Text)
versionStages = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:secretBinary:GetSecretValueResponse' :: Maybe (Sensitive Base64)
secretBinary = Maybe (Sensitive Base64)
forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:GetSecretValueResponse' :: Maybe POSIX
createdDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:GetSecretValueResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:secretString:GetSecretValueResponse' :: Maybe (Sensitive Text)
secretString = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSecretValueResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique identifier of this version of the secret.
getSecretValueResponse_versionId :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe Prelude.Text)
getSecretValueResponse_versionId :: (Maybe Text -> f (Maybe Text))
-> GetSecretValueResponse -> f GetSecretValueResponse
getSecretValueResponse_versionId = (GetSecretValueResponse -> Maybe Text)
-> (GetSecretValueResponse -> Maybe Text -> GetSecretValueResponse)
-> Lens
     GetSecretValueResponse
     GetSecretValueResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecretValueResponse' {Maybe Text
versionId :: Maybe Text
$sel:versionId:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: GetSecretValueResponse
s@GetSecretValueResponse' {} Maybe Text
a -> GetSecretValueResponse
s {$sel:versionId:GetSecretValueResponse' :: Maybe Text
versionId = Maybe Text
a} :: GetSecretValueResponse)

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

-- | A list of all of the staging labels currently attached to this version
-- of the secret.
getSecretValueResponse_versionStages :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
getSecretValueResponse_versionStages :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetSecretValueResponse -> f GetSecretValueResponse
getSecretValueResponse_versionStages = (GetSecretValueResponse -> Maybe (NonEmpty Text))
-> (GetSecretValueResponse
    -> Maybe (NonEmpty Text) -> GetSecretValueResponse)
-> Lens
     GetSecretValueResponse
     GetSecretValueResponse
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecretValueResponse' {Maybe (NonEmpty Text)
versionStages :: Maybe (NonEmpty Text)
$sel:versionStages:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe (NonEmpty Text)
versionStages} -> Maybe (NonEmpty Text)
versionStages) (\s :: GetSecretValueResponse
s@GetSecretValueResponse' {} Maybe (NonEmpty Text)
a -> GetSecretValueResponse
s {$sel:versionStages:GetSecretValueResponse' :: Maybe (NonEmpty Text)
versionStages = Maybe (NonEmpty Text)
a} :: GetSecretValueResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> GetSecretValueResponse -> f GetSecretValueResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetSecretValueResponse
-> f GetSecretValueResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The decrypted part of the protected secret information that was
-- originally provided as binary data in the form of a byte array. The
-- response parameter represents the binary data as a
-- <https://tools.ietf.org/html/rfc4648#section-4 base64-encoded> string.
--
-- This parameter is not used if the secret is created by the Secrets
-- Manager console.
--
-- If you store custom information in this field of the secret, then you
-- must code your Lambda rotation function to parse and interpret whatever
-- you store in the @SecretString@ or @SecretBinary@ fields.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
getSecretValueResponse_secretBinary :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe Prelude.ByteString)
getSecretValueResponse_secretBinary :: (Maybe ByteString -> f (Maybe ByteString))
-> GetSecretValueResponse -> f GetSecretValueResponse
getSecretValueResponse_secretBinary = (GetSecretValueResponse -> Maybe (Sensitive Base64))
-> (GetSecretValueResponse
    -> Maybe (Sensitive Base64) -> GetSecretValueResponse)
-> Lens
     GetSecretValueResponse
     GetSecretValueResponse
     (Maybe (Sensitive Base64))
     (Maybe (Sensitive Base64))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecretValueResponse' {Maybe (Sensitive Base64)
secretBinary :: Maybe (Sensitive Base64)
$sel:secretBinary:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe (Sensitive Base64)
secretBinary} -> Maybe (Sensitive Base64)
secretBinary) (\s :: GetSecretValueResponse
s@GetSecretValueResponse' {} Maybe (Sensitive Base64)
a -> GetSecretValueResponse
s {$sel:secretBinary:GetSecretValueResponse' :: Maybe (Sensitive Base64)
secretBinary = Maybe (Sensitive Base64)
a} :: GetSecretValueResponse) ((Maybe (Sensitive Base64) -> f (Maybe (Sensitive Base64)))
 -> GetSecretValueResponse -> f GetSecretValueResponse)
-> ((Maybe ByteString -> f (Maybe ByteString))
    -> Maybe (Sensitive Base64) -> f (Maybe (Sensitive Base64)))
-> (Maybe ByteString -> f (Maybe ByteString))
-> GetSecretValueResponse
-> f GetSecretValueResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Base64) (Sensitive Base64) ByteString ByteString
-> Iso
     (Maybe (Sensitive Base64))
     (Maybe (Sensitive Base64))
     (Maybe ByteString)
     (Maybe ByteString)
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 (Exchange ByteString ByteString Base64 (Identity Base64)
-> Exchange
     ByteString
     ByteString
     (Sensitive Base64)
     (Identity (Sensitive Base64))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Exchange ByteString ByteString Base64 (Identity Base64)
 -> Exchange
      ByteString
      ByteString
      (Sensitive Base64)
      (Identity (Sensitive Base64)))
-> (Exchange ByteString ByteString ByteString (Identity ByteString)
    -> Exchange ByteString ByteString Base64 (Identity Base64))
-> AnIso
     (Sensitive Base64) (Sensitive Base64) ByteString ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Exchange ByteString ByteString ByteString (Identity ByteString)
-> Exchange ByteString ByteString Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64)

-- | The date and time that this version of the secret was created.
getSecretValueResponse_createdDate :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe Prelude.UTCTime)
getSecretValueResponse_createdDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetSecretValueResponse -> f GetSecretValueResponse
getSecretValueResponse_createdDate = (GetSecretValueResponse -> Maybe POSIX)
-> (GetSecretValueResponse
    -> Maybe POSIX -> GetSecretValueResponse)
-> Lens
     GetSecretValueResponse
     GetSecretValueResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecretValueResponse' {Maybe POSIX
createdDate :: Maybe POSIX
$sel:createdDate:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe POSIX
createdDate} -> Maybe POSIX
createdDate) (\s :: GetSecretValueResponse
s@GetSecretValueResponse' {} Maybe POSIX
a -> GetSecretValueResponse
s {$sel:createdDate:GetSecretValueResponse' :: Maybe POSIX
createdDate = Maybe POSIX
a} :: GetSecretValueResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetSecretValueResponse -> f GetSecretValueResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetSecretValueResponse
-> f GetSecretValueResponse
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 friendly name of the secret.
getSecretValueResponse_name :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe Prelude.Text)
getSecretValueResponse_name :: (Maybe Text -> f (Maybe Text))
-> GetSecretValueResponse -> f GetSecretValueResponse
getSecretValueResponse_name = (GetSecretValueResponse -> Maybe Text)
-> (GetSecretValueResponse -> Maybe Text -> GetSecretValueResponse)
-> Lens
     GetSecretValueResponse
     GetSecretValueResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecretValueResponse' {Maybe Text
name :: Maybe Text
$sel:name:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: GetSecretValueResponse
s@GetSecretValueResponse' {} Maybe Text
a -> GetSecretValueResponse
s {$sel:name:GetSecretValueResponse' :: Maybe Text
name = Maybe Text
a} :: GetSecretValueResponse)

-- | The decrypted part of the protected secret information that was
-- originally provided as a string.
--
-- If you create this secret by using the Secrets Manager console then only
-- the @SecretString@ parameter contains data. Secrets Manager stores the
-- information as a JSON structure of key\/value pairs that the Lambda
-- rotation function knows how to parse.
--
-- If you store custom information in the secret by using the CreateSecret,
-- UpdateSecret, or PutSecretValue API operations instead of the Secrets
-- Manager console, or by using the __Other secret type__ in the console,
-- then you must code your Lambda rotation function to parse and interpret
-- those values.
getSecretValueResponse_secretString :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe Prelude.Text)
getSecretValueResponse_secretString :: (Maybe Text -> f (Maybe Text))
-> GetSecretValueResponse -> f GetSecretValueResponse
getSecretValueResponse_secretString = (GetSecretValueResponse -> Maybe (Sensitive Text))
-> (GetSecretValueResponse
    -> Maybe (Sensitive Text) -> GetSecretValueResponse)
-> Lens
     GetSecretValueResponse
     GetSecretValueResponse
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecretValueResponse' {Maybe (Sensitive Text)
secretString :: Maybe (Sensitive Text)
$sel:secretString:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe (Sensitive Text)
secretString} -> Maybe (Sensitive Text)
secretString) (\s :: GetSecretValueResponse
s@GetSecretValueResponse' {} Maybe (Sensitive Text)
a -> GetSecretValueResponse
s {$sel:secretString:GetSecretValueResponse' :: Maybe (Sensitive Text)
secretString = Maybe (Sensitive Text)
a} :: GetSecretValueResponse) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> GetSecretValueResponse -> f GetSecretValueResponse)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> GetSecretValueResponse
-> f GetSecretValueResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

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

instance Prelude.NFData GetSecretValueResponse