{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.
--
-- We recommend that you cache your secret values by using client-side
-- caching. Caching secrets improves speed and reduces your costs. For more
-- information, see
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets.html Cache secrets for your applications>.
--
-- To retrieve the previous version of a secret, use @VersionStage@ and
-- specify AWSPREVIOUS. To revert to the previous version of a secret, call
-- <https://docs.aws.amazon.com/cli/latest/reference/secretsmanager/update-secret-version-stage.html UpdateSecretVersionStage>.
--
-- Secrets Manager generates a CloudTrail log entry when you call this
-- action. Do not include sensitive information in request parameters
-- because it might be logged. For more information, see
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html Logging Secrets Manager events with CloudTrail>.
--
-- __Required permissions:__ @secretsmanager:GetSecretValue@. If the secret
-- is encrypted using a customer-managed key instead of the Amazon Web
-- Services managed key @aws\/secretsmanager@, then you also need
-- @kms:Decrypt@ permissions for that key. For more information, see
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions IAM policy actions for Secrets Manager>
-- and
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html Authentication and access control in Secrets Manager>.
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_arn,
    getSecretValueResponse_createdDate,
    getSecretValueResponse_name,
    getSecretValueResponse_secretBinary,
    getSecretValueResponse_secretString,
    getSecretValueResponse_versionId,
    getSecretValueResponse_versionStages,
    getSecretValueResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | The unique identifier of the version of the secret to retrieve. If you
    -- include 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 Secrets Manager returns the
    -- @AWSCURRENT@ version.
    --
    -- 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,
    -- | The staging label of the version of the secret to retrieve.
    --
    -- Secrets Manager uses staging labels to keep track of different versions
    -- during the rotation process. If you include 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@, Secrets
    -- Manager returns the @AWSCURRENT@ version.
    GetSecretValue -> Maybe Text
versionStage :: Prelude.Maybe Prelude.Text,
    -- | The ARN or name of the secret to retrieve.
    --
    -- For an ARN, we recommend that you specify a complete ARN rather than a
    -- partial ARN. See
    -- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen Finding a secret from a partial ARN>.
    GetSecretValue -> Text
secretId :: Prelude.Text
  }
  deriving (GetSecretValue -> GetSecretValue -> Bool
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]
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
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. 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' - The unique identifier of the version of the secret to retrieve. If you
-- include 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 Secrets Manager returns the
-- @AWSCURRENT@ version.
--
-- This value is typically a
-- <https://wikipedia.org/wiki/Universally_unique_identifier UUID-type>
-- value with 32 hexadecimal digits.
--
-- 'versionStage', 'getSecretValue_versionStage' - The staging label of the version of the secret to retrieve.
--
-- Secrets Manager uses staging labels to keep track of different versions
-- during the rotation process. If you include 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@, Secrets
-- Manager returns the @AWSCURRENT@ version.
--
-- 'secretId', 'getSecretValue_secretId' - The ARN or name of the secret to retrieve.
--
-- For an ARN, we recommend that you specify a complete ARN rather than a
-- partial ARN. See
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen Finding a secret from a partial ARN>.
newGetSecretValue ::
  -- | 'secretId'
  Prelude.Text ->
  GetSecretValue
newGetSecretValue :: Text -> GetSecretValue
newGetSecretValue Text
pSecretId_ =
  GetSecretValue'
    { $sel:versionId:GetSecretValue' :: Maybe Text
versionId = forall a. Maybe a
Prelude.Nothing,
      $sel:versionStage:GetSecretValue' :: Maybe Text
versionStage = forall a. Maybe a
Prelude.Nothing,
      $sel:secretId:GetSecretValue' :: Text
secretId = Text
pSecretId_
    }

-- | The unique identifier of the version of the secret to retrieve. If you
-- include 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 Secrets Manager returns the
-- @AWSCURRENT@ version.
--
-- 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 :: Lens' GetSecretValue (Maybe Text)
getSecretValue_versionId = 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)

-- | The staging label of the version of the secret to retrieve.
--
-- Secrets Manager uses staging labels to keep track of different versions
-- during the rotation process. If you include 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@, Secrets
-- Manager returns the @AWSCURRENT@ version.
getSecretValue_versionStage :: Lens.Lens' GetSecretValue (Prelude.Maybe Prelude.Text)
getSecretValue_versionStage :: Lens' GetSecretValue (Maybe Text)
getSecretValue_versionStage = 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)

-- | The ARN or name of the secret to retrieve.
--
-- For an ARN, we recommend that you specify a complete ARN rather than a
-- partial ARN. See
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen Finding a secret from a partial ARN>.
getSecretValue_secretId :: Lens.Lens' GetSecretValue Prelude.Text
getSecretValue_secretId :: Lens' GetSecretValue Text
getSecretValue_secretId = 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 :: (Service -> Service) -> GetSecretValue -> Request GetSecretValue
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetSecretValue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSecretValue)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe (Sensitive Base64)
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe (NonEmpty Text)
-> Int
-> GetSecretValueResponse
GetSecretValueResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ARN")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CreatedDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SecretBinary")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SecretString")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"VersionId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"VersionStages")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetSecretValue where
  hashWithSalt :: Int -> GetSecretValue -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionStage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
secretId

instance Prelude.NFData GetSecretValue where
  rnf :: GetSecretValue -> ()
rnf 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
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionStage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
secretId

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

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"VersionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
versionId,
            (Key
"VersionStage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
versionStage,
            forall a. a -> Maybe a
Prelude.Just (Key
"SecretId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
secretId)
          ]
      )

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

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

-- | /See:/ 'newGetSecretValueResponse' smart constructor.
data GetSecretValueResponse = GetSecretValueResponse'
  { -- | The ARN of the secret.
    GetSecretValueResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The date and time that this version of the secret was created. If you
    -- don\'t specify which version in @VersionId@ or @VersionStage@, then
    -- Secrets Manager uses the @AWSCURRENT@ version.
    GetSecretValueResponse -> Maybe POSIX
createdDate :: Prelude.Maybe Data.POSIX,
    -- | The friendly name of the secret.
    GetSecretValueResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The decrypted secret value, if the secret value 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.
    --
    -- If the secret was created by using the Secrets Manager console, or if
    -- the secret value was originally provided as a string, then this field is
    -- omitted. The secret value appears in @SecretString@ instead.
    GetSecretValueResponse -> Maybe (Sensitive Base64)
secretBinary :: Prelude.Maybe (Data.Sensitive Data.Base64),
    -- | The decrypted secret value, if the secret value was originally provided
    -- as a string or through the Secrets Manager console.
    --
    -- If this secret was created by using the console, then Secrets Manager
    -- stores the information as a JSON structure of key\/value pairs.
    GetSecretValueResponse -> Maybe (Sensitive Text)
secretString :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The unique identifier of this version of the secret.
    GetSecretValueResponse -> Maybe Text
versionId :: 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 response's http status code.
    GetSecretValueResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSecretValueResponse -> GetSecretValueResponse -> Bool
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
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. 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:
--
-- 'arn', 'getSecretValueResponse_arn' - The ARN of the secret.
--
-- 'createdDate', 'getSecretValueResponse_createdDate' - The date and time that this version of the secret was created. If you
-- don\'t specify which version in @VersionId@ or @VersionStage@, then
-- Secrets Manager uses the @AWSCURRENT@ version.
--
-- 'name', 'getSecretValueResponse_name' - The friendly name of the secret.
--
-- 'secretBinary', 'getSecretValueResponse_secretBinary' - The decrypted secret value, if the secret value 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.
--
-- If the secret was created by using the Secrets Manager console, or if
-- the secret value was originally provided as a string, then this field is
-- omitted. The secret value appears in @SecretString@ instead.--
-- -- /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.
--
-- 'secretString', 'getSecretValueResponse_secretString' - The decrypted secret value, if the secret value was originally provided
-- as a string or through the Secrets Manager console.
--
-- If this secret was created by using the console, then Secrets Manager
-- stores the information as a JSON structure of key\/value pairs.
--
-- 'versionId', 'getSecretValueResponse_versionId' - The unique identifier of this version of the secret.
--
-- 'versionStages', 'getSecretValueResponse_versionStages' - A list of all of the staging labels currently attached to this version
-- of the secret.
--
-- 'httpStatus', 'getSecretValueResponse_httpStatus' - The response's http status code.
newGetSecretValueResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSecretValueResponse
newGetSecretValueResponse :: Int -> GetSecretValueResponse
newGetSecretValueResponse Int
pHttpStatus_ =
  GetSecretValueResponse'
    { $sel:arn:GetSecretValueResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:GetSecretValueResponse' :: Maybe POSIX
createdDate = forall a. Maybe a
Prelude.Nothing,
      $sel:name:GetSecretValueResponse' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:secretBinary:GetSecretValueResponse' :: Maybe (Sensitive Base64)
secretBinary = forall a. Maybe a
Prelude.Nothing,
      $sel:secretString:GetSecretValueResponse' :: Maybe (Sensitive Text)
secretString = forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:GetSecretValueResponse' :: Maybe Text
versionId = forall a. Maybe a
Prelude.Nothing,
      $sel:versionStages:GetSecretValueResponse' :: Maybe (NonEmpty Text)
versionStages = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSecretValueResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the secret.
getSecretValueResponse_arn :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe Prelude.Text)
getSecretValueResponse_arn :: Lens' GetSecretValueResponse (Maybe Text)
getSecretValueResponse_arn = 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)

-- | The date and time that this version of the secret was created. If you
-- don\'t specify which version in @VersionId@ or @VersionStage@, then
-- Secrets Manager uses the @AWSCURRENT@ version.
getSecretValueResponse_createdDate :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe Prelude.UTCTime)
getSecretValueResponse_createdDate :: Lens' GetSecretValueResponse (Maybe UTCTime)
getSecretValueResponse_createdDate = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The friendly name of the secret.
getSecretValueResponse_name :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe Prelude.Text)
getSecretValueResponse_name :: Lens' GetSecretValueResponse (Maybe Text)
getSecretValueResponse_name = 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 secret value, if the secret value 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.
--
-- If the secret was created by using the Secrets Manager console, or if
-- the secret value was originally provided as a string, then this field is
-- omitted. The secret value appears in @SecretString@ instead.--
-- -- /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 :: Lens' GetSecretValueResponse (Maybe ByteString)
getSecretValueResponse_secretBinary = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 (forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Iso' Base64 ByteString
Data._Base64)

-- | The decrypted secret value, if the secret value was originally provided
-- as a string or through the Secrets Manager console.
--
-- If this secret was created by using the console, then Secrets Manager
-- stores the information as a JSON structure of key\/value pairs.
getSecretValueResponse_secretString :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe Prelude.Text)
getSecretValueResponse_secretString :: Lens' GetSecretValueResponse (Maybe Text)
getSecretValueResponse_secretString = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The unique identifier of this version of the secret.
getSecretValueResponse_versionId :: Lens.Lens' GetSecretValueResponse (Prelude.Maybe Prelude.Text)
getSecretValueResponse_versionId :: Lens' GetSecretValueResponse (Maybe Text)
getSecretValueResponse_versionId = 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)

-- | 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 :: Lens' GetSecretValueResponse (Maybe (NonEmpty Text))
getSecretValueResponse_versionStages = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
getSecretValueResponse_httpStatus :: Lens.Lens' GetSecretValueResponse Prelude.Int
getSecretValueResponse_httpStatus :: Lens' GetSecretValueResponse Int
getSecretValueResponse_httpStatus = 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 where
  rnf :: GetSecretValueResponse -> ()
rnf GetSecretValueResponse' {Int
Maybe (NonEmpty Text)
Maybe Text
Maybe (Sensitive Text)
Maybe (Sensitive Base64)
Maybe POSIX
httpStatus :: Int
versionStages :: Maybe (NonEmpty Text)
versionId :: Maybe Text
secretString :: Maybe (Sensitive Text)
secretBinary :: Maybe (Sensitive Base64)
name :: Maybe Text
createdDate :: Maybe POSIX
arn :: Maybe Text
$sel:httpStatus:GetSecretValueResponse' :: GetSecretValueResponse -> Int
$sel:versionStages:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe (NonEmpty Text)
$sel:versionId:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe Text
$sel:secretString:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe (Sensitive Text)
$sel:secretBinary:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe (Sensitive Base64)
$sel:name:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe Text
$sel:createdDate:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe POSIX
$sel:arn:GetSecretValueResponse' :: GetSecretValueResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Base64)
secretBinary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
secretString
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
versionStages
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus