{-# 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.ListSecretVersionIds
-- 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)
--
-- Lists all of the versions attached to the specified secret. The output
-- does not include the @SecretString@ or @SecretBinary@ fields. By
-- default, the list includes only versions that have at least one staging
-- label in @VersionStage@ attached.
--
-- Always check the @NextToken@ response parameter when calling any of the
-- @List*@ operations. These operations can occasionally return an empty or
-- shorter than expected list of results even when there more results
-- become available. When this happens, the @NextToken@ response parameter
-- contains a value to pass to the next call to the same API to request the
-- next part of the list.
--
-- __Minimum permissions__
--
-- To run this command, you must have the following permissions:
--
-- -   secretsmanager:ListSecretVersionIds
--
-- __Related operations__
--
-- -   To list the secrets in an account, use ListSecrets.
--
-- This operation returns paginated results.
module Amazonka.SecretsManager.ListSecretVersionIds
  ( -- * Creating a Request
    ListSecretVersionIds (..),
    newListSecretVersionIds,

    -- * Request Lenses
    listSecretVersionIds_nextToken,
    listSecretVersionIds_includeDeprecated,
    listSecretVersionIds_maxResults,
    listSecretVersionIds_secretId,

    -- * Destructuring the Response
    ListSecretVersionIdsResponse (..),
    newListSecretVersionIdsResponse,

    -- * Response Lenses
    listSecretVersionIdsResponse_arn,
    listSecretVersionIdsResponse_versions,
    listSecretVersionIdsResponse_nextToken,
    listSecretVersionIdsResponse_name,
    listSecretVersionIdsResponse_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:/ 'newListSecretVersionIds' smart constructor.
data ListSecretVersionIds = ListSecretVersionIds'
  { -- | (Optional) Use this parameter in a request if you receive a @NextToken@
    -- response in a previous request indicating there\'s more output
    -- available. In a subsequent call, set it to the value of the previous
    -- call @NextToken@ response to indicate where the output should continue
    -- from.
    ListSecretVersionIds -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | (Optional) Specifies that you want the results to include versions that
    -- do not have any staging labels attached to them. Such versions are
    -- considered deprecated and are subject to deletion by Secrets Manager as
    -- needed.
    ListSecretVersionIds -> Maybe Bool
includeDeprecated :: Prelude.Maybe Prelude.Bool,
    -- | (Optional) Limits the number of results you want to include in the
    -- response. If you don\'t include this parameter, it defaults to a value
    -- that\'s specific to the operation. If additional items exist beyond the
    -- maximum you specify, the @NextToken@ response element is present and has
    -- a value (isn\'t null). Include that value as the @NextToken@ request
    -- parameter in the next call to the operation to get the next part of the
    -- results. Note that Secrets Manager might return fewer results than the
    -- maximum even when there are more results available. You should check
    -- @NextToken@ after every operation to ensure that you receive all of the
    -- results.
    ListSecretVersionIds -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The identifier for the secret containing the versions you want to list.
    -- 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.
    ListSecretVersionIds -> Text
secretId :: Prelude.Text
  }
  deriving (ListSecretVersionIds -> ListSecretVersionIds -> Bool
(ListSecretVersionIds -> ListSecretVersionIds -> Bool)
-> (ListSecretVersionIds -> ListSecretVersionIds -> Bool)
-> Eq ListSecretVersionIds
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSecretVersionIds -> ListSecretVersionIds -> Bool
$c/= :: ListSecretVersionIds -> ListSecretVersionIds -> Bool
== :: ListSecretVersionIds -> ListSecretVersionIds -> Bool
$c== :: ListSecretVersionIds -> ListSecretVersionIds -> Bool
Prelude.Eq, ReadPrec [ListSecretVersionIds]
ReadPrec ListSecretVersionIds
Int -> ReadS ListSecretVersionIds
ReadS [ListSecretVersionIds]
(Int -> ReadS ListSecretVersionIds)
-> ReadS [ListSecretVersionIds]
-> ReadPrec ListSecretVersionIds
-> ReadPrec [ListSecretVersionIds]
-> Read ListSecretVersionIds
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSecretVersionIds]
$creadListPrec :: ReadPrec [ListSecretVersionIds]
readPrec :: ReadPrec ListSecretVersionIds
$creadPrec :: ReadPrec ListSecretVersionIds
readList :: ReadS [ListSecretVersionIds]
$creadList :: ReadS [ListSecretVersionIds]
readsPrec :: Int -> ReadS ListSecretVersionIds
$creadsPrec :: Int -> ReadS ListSecretVersionIds
Prelude.Read, Int -> ListSecretVersionIds -> ShowS
[ListSecretVersionIds] -> ShowS
ListSecretVersionIds -> String
(Int -> ListSecretVersionIds -> ShowS)
-> (ListSecretVersionIds -> String)
-> ([ListSecretVersionIds] -> ShowS)
-> Show ListSecretVersionIds
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSecretVersionIds] -> ShowS
$cshowList :: [ListSecretVersionIds] -> ShowS
show :: ListSecretVersionIds -> String
$cshow :: ListSecretVersionIds -> String
showsPrec :: Int -> ListSecretVersionIds -> ShowS
$cshowsPrec :: Int -> ListSecretVersionIds -> ShowS
Prelude.Show, (forall x. ListSecretVersionIds -> Rep ListSecretVersionIds x)
-> (forall x. Rep ListSecretVersionIds x -> ListSecretVersionIds)
-> Generic ListSecretVersionIds
forall x. Rep ListSecretVersionIds x -> ListSecretVersionIds
forall x. ListSecretVersionIds -> Rep ListSecretVersionIds x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSecretVersionIds x -> ListSecretVersionIds
$cfrom :: forall x. ListSecretVersionIds -> Rep ListSecretVersionIds x
Prelude.Generic)

-- |
-- Create a value of 'ListSecretVersionIds' 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:
--
-- 'nextToken', 'listSecretVersionIds_nextToken' - (Optional) Use this parameter in a request if you receive a @NextToken@
-- response in a previous request indicating there\'s more output
-- available. In a subsequent call, set it to the value of the previous
-- call @NextToken@ response to indicate where the output should continue
-- from.
--
-- 'includeDeprecated', 'listSecretVersionIds_includeDeprecated' - (Optional) Specifies that you want the results to include versions that
-- do not have any staging labels attached to them. Such versions are
-- considered deprecated and are subject to deletion by Secrets Manager as
-- needed.
--
-- 'maxResults', 'listSecretVersionIds_maxResults' - (Optional) Limits the number of results you want to include in the
-- response. If you don\'t include this parameter, it defaults to a value
-- that\'s specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (isn\'t null). Include that value as the @NextToken@ request
-- parameter in the next call to the operation to get the next part of the
-- results. Note that Secrets Manager might return fewer results than the
-- maximum even when there are more results available. You should check
-- @NextToken@ after every operation to ensure that you receive all of the
-- results.
--
-- 'secretId', 'listSecretVersionIds_secretId' - The identifier for the secret containing the versions you want to list.
-- 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.
newListSecretVersionIds ::
  -- | 'secretId'
  Prelude.Text ->
  ListSecretVersionIds
newListSecretVersionIds :: Text -> ListSecretVersionIds
newListSecretVersionIds Text
pSecretId_ =
  ListSecretVersionIds' :: Maybe Text
-> Maybe Bool -> Maybe Natural -> Text -> ListSecretVersionIds
ListSecretVersionIds'
    { $sel:nextToken:ListSecretVersionIds' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:includeDeprecated:ListSecretVersionIds' :: Maybe Bool
includeDeprecated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListSecretVersionIds' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:secretId:ListSecretVersionIds' :: Text
secretId = Text
pSecretId_
    }

-- | (Optional) Use this parameter in a request if you receive a @NextToken@
-- response in a previous request indicating there\'s more output
-- available. In a subsequent call, set it to the value of the previous
-- call @NextToken@ response to indicate where the output should continue
-- from.
listSecretVersionIds_nextToken :: Lens.Lens' ListSecretVersionIds (Prelude.Maybe Prelude.Text)
listSecretVersionIds_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSecretVersionIds -> f ListSecretVersionIds
listSecretVersionIds_nextToken = (ListSecretVersionIds -> Maybe Text)
-> (ListSecretVersionIds -> Maybe Text -> ListSecretVersionIds)
-> Lens
     ListSecretVersionIds ListSecretVersionIds (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecretVersionIds' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSecretVersionIds' :: ListSecretVersionIds -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSecretVersionIds
s@ListSecretVersionIds' {} Maybe Text
a -> ListSecretVersionIds
s {$sel:nextToken:ListSecretVersionIds' :: Maybe Text
nextToken = Maybe Text
a} :: ListSecretVersionIds)

-- | (Optional) Specifies that you want the results to include versions that
-- do not have any staging labels attached to them. Such versions are
-- considered deprecated and are subject to deletion by Secrets Manager as
-- needed.
listSecretVersionIds_includeDeprecated :: Lens.Lens' ListSecretVersionIds (Prelude.Maybe Prelude.Bool)
listSecretVersionIds_includeDeprecated :: (Maybe Bool -> f (Maybe Bool))
-> ListSecretVersionIds -> f ListSecretVersionIds
listSecretVersionIds_includeDeprecated = (ListSecretVersionIds -> Maybe Bool)
-> (ListSecretVersionIds -> Maybe Bool -> ListSecretVersionIds)
-> Lens
     ListSecretVersionIds ListSecretVersionIds (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecretVersionIds' {Maybe Bool
includeDeprecated :: Maybe Bool
$sel:includeDeprecated:ListSecretVersionIds' :: ListSecretVersionIds -> Maybe Bool
includeDeprecated} -> Maybe Bool
includeDeprecated) (\s :: ListSecretVersionIds
s@ListSecretVersionIds' {} Maybe Bool
a -> ListSecretVersionIds
s {$sel:includeDeprecated:ListSecretVersionIds' :: Maybe Bool
includeDeprecated = Maybe Bool
a} :: ListSecretVersionIds)

-- | (Optional) Limits the number of results you want to include in the
-- response. If you don\'t include this parameter, it defaults to a value
-- that\'s specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (isn\'t null). Include that value as the @NextToken@ request
-- parameter in the next call to the operation to get the next part of the
-- results. Note that Secrets Manager might return fewer results than the
-- maximum even when there are more results available. You should check
-- @NextToken@ after every operation to ensure that you receive all of the
-- results.
listSecretVersionIds_maxResults :: Lens.Lens' ListSecretVersionIds (Prelude.Maybe Prelude.Natural)
listSecretVersionIds_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListSecretVersionIds -> f ListSecretVersionIds
listSecretVersionIds_maxResults = (ListSecretVersionIds -> Maybe Natural)
-> (ListSecretVersionIds -> Maybe Natural -> ListSecretVersionIds)
-> Lens
     ListSecretVersionIds
     ListSecretVersionIds
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecretVersionIds' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSecretVersionIds' :: ListSecretVersionIds -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSecretVersionIds
s@ListSecretVersionIds' {} Maybe Natural
a -> ListSecretVersionIds
s {$sel:maxResults:ListSecretVersionIds' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSecretVersionIds)

-- | The identifier for the secret containing the versions you want to list.
-- 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.
listSecretVersionIds_secretId :: Lens.Lens' ListSecretVersionIds Prelude.Text
listSecretVersionIds_secretId :: (Text -> f Text) -> ListSecretVersionIds -> f ListSecretVersionIds
listSecretVersionIds_secretId = (ListSecretVersionIds -> Text)
-> (ListSecretVersionIds -> Text -> ListSecretVersionIds)
-> Lens ListSecretVersionIds ListSecretVersionIds Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecretVersionIds' {Text
secretId :: Text
$sel:secretId:ListSecretVersionIds' :: ListSecretVersionIds -> Text
secretId} -> Text
secretId) (\s :: ListSecretVersionIds
s@ListSecretVersionIds' {} Text
a -> ListSecretVersionIds
s {$sel:secretId:ListSecretVersionIds' :: Text
secretId = Text
a} :: ListSecretVersionIds)

instance Core.AWSPager ListSecretVersionIds where
  page :: ListSecretVersionIds
-> AWSResponse ListSecretVersionIds -> Maybe ListSecretVersionIds
page ListSecretVersionIds
rq AWSResponse ListSecretVersionIds
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSecretVersionIds
ListSecretVersionIdsResponse
rs
            ListSecretVersionIdsResponse
-> Getting (First Text) ListSecretVersionIdsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSecretVersionIdsResponse
-> Const (First Text) ListSecretVersionIdsResponse
Lens' ListSecretVersionIdsResponse (Maybe Text)
listSecretVersionIdsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSecretVersionIdsResponse
 -> Const (First Text) ListSecretVersionIdsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSecretVersionIdsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListSecretVersionIds
forall a. Maybe a
Prelude.Nothing
    | Maybe [SecretVersionsListEntry] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSecretVersionIds
ListSecretVersionIdsResponse
rs
            ListSecretVersionIdsResponse
-> Getting
     (First [SecretVersionsListEntry])
     ListSecretVersionIdsResponse
     [SecretVersionsListEntry]
-> Maybe [SecretVersionsListEntry]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [SecretVersionsListEntry]
 -> Const
      (First [SecretVersionsListEntry])
      (Maybe [SecretVersionsListEntry]))
-> ListSecretVersionIdsResponse
-> Const
     (First [SecretVersionsListEntry]) ListSecretVersionIdsResponse
Lens'
  ListSecretVersionIdsResponse (Maybe [SecretVersionsListEntry])
listSecretVersionIdsResponse_versions
              ((Maybe [SecretVersionsListEntry]
  -> Const
       (First [SecretVersionsListEntry])
       (Maybe [SecretVersionsListEntry]))
 -> ListSecretVersionIdsResponse
 -> Const
      (First [SecretVersionsListEntry]) ListSecretVersionIdsResponse)
-> (([SecretVersionsListEntry]
     -> Const
          (First [SecretVersionsListEntry]) [SecretVersionsListEntry])
    -> Maybe [SecretVersionsListEntry]
    -> Const
         (First [SecretVersionsListEntry])
         (Maybe [SecretVersionsListEntry]))
-> Getting
     (First [SecretVersionsListEntry])
     ListSecretVersionIdsResponse
     [SecretVersionsListEntry]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SecretVersionsListEntry]
 -> Const
      (First [SecretVersionsListEntry]) [SecretVersionsListEntry])
-> Maybe [SecretVersionsListEntry]
-> Const
     (First [SecretVersionsListEntry]) (Maybe [SecretVersionsListEntry])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListSecretVersionIds
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListSecretVersionIds -> Maybe ListSecretVersionIds
forall a. a -> Maybe a
Prelude.Just (ListSecretVersionIds -> Maybe ListSecretVersionIds)
-> ListSecretVersionIds -> Maybe ListSecretVersionIds
forall a b. (a -> b) -> a -> b
Prelude.$
        ListSecretVersionIds
rq
          ListSecretVersionIds
-> (ListSecretVersionIds -> ListSecretVersionIds)
-> ListSecretVersionIds
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListSecretVersionIds -> Identity ListSecretVersionIds
Lens
  ListSecretVersionIds ListSecretVersionIds (Maybe Text) (Maybe Text)
listSecretVersionIds_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListSecretVersionIds -> Identity ListSecretVersionIds)
-> Maybe Text -> ListSecretVersionIds -> ListSecretVersionIds
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSecretVersionIds
ListSecretVersionIdsResponse
rs
          ListSecretVersionIdsResponse
-> Getting (First Text) ListSecretVersionIdsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSecretVersionIdsResponse
-> Const (First Text) ListSecretVersionIdsResponse
Lens' ListSecretVersionIdsResponse (Maybe Text)
listSecretVersionIdsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSecretVersionIdsResponse
 -> Const (First Text) ListSecretVersionIdsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSecretVersionIdsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListSecretVersionIds where
  type
    AWSResponse ListSecretVersionIds =
      ListSecretVersionIdsResponse
  request :: ListSecretVersionIds -> Request ListSecretVersionIds
request = Service -> ListSecretVersionIds -> Request ListSecretVersionIds
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListSecretVersionIds
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSecretVersionIds)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListSecretVersionIds))
-> Logger
-> Service
-> Proxy ListSecretVersionIds
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSecretVersionIds)))
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 [SecretVersionsListEntry]
-> Maybe Text
-> Maybe Text
-> Int
-> ListSecretVersionIdsResponse
ListSecretVersionIdsResponse'
            (Maybe Text
 -> Maybe [SecretVersionsListEntry]
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> ListSecretVersionIdsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [SecretVersionsListEntry]
      -> Maybe Text -> Maybe Text -> Int -> ListSecretVersionIdsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ARN")
            Either
  String
  (Maybe [SecretVersionsListEntry]
   -> Maybe Text -> Maybe Text -> Int -> ListSecretVersionIdsResponse)
-> Either String (Maybe [SecretVersionsListEntry])
-> Either
     String
     (Maybe Text -> Maybe Text -> Int -> ListSecretVersionIdsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [SecretVersionsListEntry]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Versions" Either String (Maybe (Maybe [SecretVersionsListEntry]))
-> Maybe [SecretVersionsListEntry]
-> Either String (Maybe [SecretVersionsListEntry])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SecretVersionsListEntry]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text -> Maybe Text -> Int -> ListSecretVersionIdsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> ListSecretVersionIdsResponse)
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
"NextToken")
            Either String (Maybe Text -> Int -> ListSecretVersionIdsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListSecretVersionIdsResponse)
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 -> ListSecretVersionIdsResponse)
-> Either String Int -> Either String ListSecretVersionIdsResponse
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 ListSecretVersionIds

instance Prelude.NFData ListSecretVersionIds

instance Core.ToHeaders ListSecretVersionIds where
  toHeaders :: ListSecretVersionIds -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListSecretVersionIds -> 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.ListSecretVersionIds" ::
                          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 ListSecretVersionIds where
  toJSON :: ListSecretVersionIds -> Value
toJSON ListSecretVersionIds' {Maybe Bool
Maybe Natural
Maybe Text
Text
secretId :: Text
maxResults :: Maybe Natural
includeDeprecated :: Maybe Bool
nextToken :: Maybe Text
$sel:secretId:ListSecretVersionIds' :: ListSecretVersionIds -> Text
$sel:maxResults:ListSecretVersionIds' :: ListSecretVersionIds -> Maybe Natural
$sel:includeDeprecated:ListSecretVersionIds' :: ListSecretVersionIds -> Maybe Bool
$sel:nextToken:ListSecretVersionIds' :: ListSecretVersionIds -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" 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
nextToken,
            (Text
"IncludeDeprecated" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeDeprecated,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            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 ListSecretVersionIds where
  toPath :: ListSecretVersionIds -> ByteString
toPath = ByteString -> ListSecretVersionIds -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListSecretVersionIdsResponse' smart constructor.
data ListSecretVersionIdsResponse = ListSecretVersionIdsResponse'
  { -- | The Amazon Resource Name (ARN) for the secret.
    --
    -- Secrets Manager automatically adds several random characters to the name
    -- at the end of the ARN when you initially create a secret. This affects
    -- only the ARN and not the actual friendly name. This ensures that if you
    -- create a new secret with the same name as an old secret that you
    -- previously deleted, then users with access to the old secret /don\'t/
    -- automatically get access to the new secret because the ARNs are
    -- different.
    ListSecretVersionIdsResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The list of the currently available versions of the specified secret.
    ListSecretVersionIdsResponse -> Maybe [SecretVersionsListEntry]
versions :: Prelude.Maybe [SecretVersionsListEntry],
    -- | If present in the response, this value indicates that there\'s more
    -- output available than included in the current response. This can occur
    -- even when the response includes no values at all, such as when you ask
    -- for a filtered view of a very long list. Use this value in the
    -- @NextToken@ request parameter in a subsequent call to the operation to
    -- continue processing and get the next part of the output. You should
    -- repeat this until the @NextToken@ response element comes back empty (as
    -- @null@).
    ListSecretVersionIdsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The friendly name of the secret.
    ListSecretVersionIdsResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListSecretVersionIdsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSecretVersionIdsResponse
-> ListSecretVersionIdsResponse -> Bool
(ListSecretVersionIdsResponse
 -> ListSecretVersionIdsResponse -> Bool)
-> (ListSecretVersionIdsResponse
    -> ListSecretVersionIdsResponse -> Bool)
-> Eq ListSecretVersionIdsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSecretVersionIdsResponse
-> ListSecretVersionIdsResponse -> Bool
$c/= :: ListSecretVersionIdsResponse
-> ListSecretVersionIdsResponse -> Bool
== :: ListSecretVersionIdsResponse
-> ListSecretVersionIdsResponse -> Bool
$c== :: ListSecretVersionIdsResponse
-> ListSecretVersionIdsResponse -> Bool
Prelude.Eq, ReadPrec [ListSecretVersionIdsResponse]
ReadPrec ListSecretVersionIdsResponse
Int -> ReadS ListSecretVersionIdsResponse
ReadS [ListSecretVersionIdsResponse]
(Int -> ReadS ListSecretVersionIdsResponse)
-> ReadS [ListSecretVersionIdsResponse]
-> ReadPrec ListSecretVersionIdsResponse
-> ReadPrec [ListSecretVersionIdsResponse]
-> Read ListSecretVersionIdsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSecretVersionIdsResponse]
$creadListPrec :: ReadPrec [ListSecretVersionIdsResponse]
readPrec :: ReadPrec ListSecretVersionIdsResponse
$creadPrec :: ReadPrec ListSecretVersionIdsResponse
readList :: ReadS [ListSecretVersionIdsResponse]
$creadList :: ReadS [ListSecretVersionIdsResponse]
readsPrec :: Int -> ReadS ListSecretVersionIdsResponse
$creadsPrec :: Int -> ReadS ListSecretVersionIdsResponse
Prelude.Read, Int -> ListSecretVersionIdsResponse -> ShowS
[ListSecretVersionIdsResponse] -> ShowS
ListSecretVersionIdsResponse -> String
(Int -> ListSecretVersionIdsResponse -> ShowS)
-> (ListSecretVersionIdsResponse -> String)
-> ([ListSecretVersionIdsResponse] -> ShowS)
-> Show ListSecretVersionIdsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSecretVersionIdsResponse] -> ShowS
$cshowList :: [ListSecretVersionIdsResponse] -> ShowS
show :: ListSecretVersionIdsResponse -> String
$cshow :: ListSecretVersionIdsResponse -> String
showsPrec :: Int -> ListSecretVersionIdsResponse -> ShowS
$cshowsPrec :: Int -> ListSecretVersionIdsResponse -> ShowS
Prelude.Show, (forall x.
 ListSecretVersionIdsResponse -> Rep ListSecretVersionIdsResponse x)
-> (forall x.
    Rep ListSecretVersionIdsResponse x -> ListSecretVersionIdsResponse)
-> Generic ListSecretVersionIdsResponse
forall x.
Rep ListSecretVersionIdsResponse x -> ListSecretVersionIdsResponse
forall x.
ListSecretVersionIdsResponse -> Rep ListSecretVersionIdsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSecretVersionIdsResponse x -> ListSecretVersionIdsResponse
$cfrom :: forall x.
ListSecretVersionIdsResponse -> Rep ListSecretVersionIdsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListSecretVersionIdsResponse' 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', 'listSecretVersionIdsResponse_arn' - The Amazon Resource Name (ARN) for the secret.
--
-- Secrets Manager automatically adds several random characters to the name
-- at the end of the ARN when you initially create a secret. This affects
-- only the ARN and not the actual friendly name. This ensures that if you
-- create a new secret with the same name as an old secret that you
-- previously deleted, then users with access to the old secret /don\'t/
-- automatically get access to the new secret because the ARNs are
-- different.
--
-- 'versions', 'listSecretVersionIdsResponse_versions' - The list of the currently available versions of the specified secret.
--
-- 'nextToken', 'listSecretVersionIdsResponse_nextToken' - If present in the response, this value indicates that there\'s more
-- output available than included in the current response. This can occur
-- even when the response includes no values at all, such as when you ask
-- for a filtered view of a very long list. Use this value in the
-- @NextToken@ request parameter in a subsequent call to the operation to
-- continue processing and get the next part of the output. You should
-- repeat this until the @NextToken@ response element comes back empty (as
-- @null@).
--
-- 'name', 'listSecretVersionIdsResponse_name' - The friendly name of the secret.
--
-- 'httpStatus', 'listSecretVersionIdsResponse_httpStatus' - The response's http status code.
newListSecretVersionIdsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSecretVersionIdsResponse
newListSecretVersionIdsResponse :: Int -> ListSecretVersionIdsResponse
newListSecretVersionIdsResponse Int
pHttpStatus_ =
  ListSecretVersionIdsResponse' :: Maybe Text
-> Maybe [SecretVersionsListEntry]
-> Maybe Text
-> Maybe Text
-> Int
-> ListSecretVersionIdsResponse
ListSecretVersionIdsResponse'
    { $sel:arn:ListSecretVersionIdsResponse' :: Maybe Text
arn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:versions:ListSecretVersionIdsResponse' :: Maybe [SecretVersionsListEntry]
versions = Maybe [SecretVersionsListEntry]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListSecretVersionIdsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ListSecretVersionIdsResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListSecretVersionIdsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) for the secret.
--
-- Secrets Manager automatically adds several random characters to the name
-- at the end of the ARN when you initially create a secret. This affects
-- only the ARN and not the actual friendly name. This ensures that if you
-- create a new secret with the same name as an old secret that you
-- previously deleted, then users with access to the old secret /don\'t/
-- automatically get access to the new secret because the ARNs are
-- different.
listSecretVersionIdsResponse_arn :: Lens.Lens' ListSecretVersionIdsResponse (Prelude.Maybe Prelude.Text)
listSecretVersionIdsResponse_arn :: (Maybe Text -> f (Maybe Text))
-> ListSecretVersionIdsResponse -> f ListSecretVersionIdsResponse
listSecretVersionIdsResponse_arn = (ListSecretVersionIdsResponse -> Maybe Text)
-> (ListSecretVersionIdsResponse
    -> Maybe Text -> ListSecretVersionIdsResponse)
-> Lens' ListSecretVersionIdsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecretVersionIdsResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:ListSecretVersionIdsResponse' :: ListSecretVersionIdsResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ListSecretVersionIdsResponse
s@ListSecretVersionIdsResponse' {} Maybe Text
a -> ListSecretVersionIdsResponse
s {$sel:arn:ListSecretVersionIdsResponse' :: Maybe Text
arn = Maybe Text
a} :: ListSecretVersionIdsResponse)

-- | The list of the currently available versions of the specified secret.
listSecretVersionIdsResponse_versions :: Lens.Lens' ListSecretVersionIdsResponse (Prelude.Maybe [SecretVersionsListEntry])
listSecretVersionIdsResponse_versions :: (Maybe [SecretVersionsListEntry]
 -> f (Maybe [SecretVersionsListEntry]))
-> ListSecretVersionIdsResponse -> f ListSecretVersionIdsResponse
listSecretVersionIdsResponse_versions = (ListSecretVersionIdsResponse -> Maybe [SecretVersionsListEntry])
-> (ListSecretVersionIdsResponse
    -> Maybe [SecretVersionsListEntry] -> ListSecretVersionIdsResponse)
-> Lens'
     ListSecretVersionIdsResponse (Maybe [SecretVersionsListEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecretVersionIdsResponse' {Maybe [SecretVersionsListEntry]
versions :: Maybe [SecretVersionsListEntry]
$sel:versions:ListSecretVersionIdsResponse' :: ListSecretVersionIdsResponse -> Maybe [SecretVersionsListEntry]
versions} -> Maybe [SecretVersionsListEntry]
versions) (\s :: ListSecretVersionIdsResponse
s@ListSecretVersionIdsResponse' {} Maybe [SecretVersionsListEntry]
a -> ListSecretVersionIdsResponse
s {$sel:versions:ListSecretVersionIdsResponse' :: Maybe [SecretVersionsListEntry]
versions = Maybe [SecretVersionsListEntry]
a} :: ListSecretVersionIdsResponse) ((Maybe [SecretVersionsListEntry]
  -> f (Maybe [SecretVersionsListEntry]))
 -> ListSecretVersionIdsResponse -> f ListSecretVersionIdsResponse)
-> ((Maybe [SecretVersionsListEntry]
     -> f (Maybe [SecretVersionsListEntry]))
    -> Maybe [SecretVersionsListEntry]
    -> f (Maybe [SecretVersionsListEntry]))
-> (Maybe [SecretVersionsListEntry]
    -> f (Maybe [SecretVersionsListEntry]))
-> ListSecretVersionIdsResponse
-> f ListSecretVersionIdsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SecretVersionsListEntry]
  [SecretVersionsListEntry]
  [SecretVersionsListEntry]
  [SecretVersionsListEntry]
-> Iso
     (Maybe [SecretVersionsListEntry])
     (Maybe [SecretVersionsListEntry])
     (Maybe [SecretVersionsListEntry])
     (Maybe [SecretVersionsListEntry])
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
  [SecretVersionsListEntry]
  [SecretVersionsListEntry]
  [SecretVersionsListEntry]
  [SecretVersionsListEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If present in the response, this value indicates that there\'s more
-- output available than included in the current response. This can occur
-- even when the response includes no values at all, such as when you ask
-- for a filtered view of a very long list. Use this value in the
-- @NextToken@ request parameter in a subsequent call to the operation to
-- continue processing and get the next part of the output. You should
-- repeat this until the @NextToken@ response element comes back empty (as
-- @null@).
listSecretVersionIdsResponse_nextToken :: Lens.Lens' ListSecretVersionIdsResponse (Prelude.Maybe Prelude.Text)
listSecretVersionIdsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSecretVersionIdsResponse -> f ListSecretVersionIdsResponse
listSecretVersionIdsResponse_nextToken = (ListSecretVersionIdsResponse -> Maybe Text)
-> (ListSecretVersionIdsResponse
    -> Maybe Text -> ListSecretVersionIdsResponse)
-> Lens' ListSecretVersionIdsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecretVersionIdsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSecretVersionIdsResponse' :: ListSecretVersionIdsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSecretVersionIdsResponse
s@ListSecretVersionIdsResponse' {} Maybe Text
a -> ListSecretVersionIdsResponse
s {$sel:nextToken:ListSecretVersionIdsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSecretVersionIdsResponse)

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

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

instance Prelude.NFData ListSecretVersionIdsResponse