{-# 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.ListSecrets
-- 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 secrets that are stored by Secrets Manager in the
-- Amazon Web Services account. To list the versions currently stored for a
-- specific secret, use ListSecretVersionIds. The encrypted fields
-- @SecretString@ and @SecretBinary@ are not included in the output. To get
-- that information, call the GetSecretValue operation.
--
-- 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:ListSecrets
--
-- __Related operations__
--
-- -   To list the versions attached to a secret, use ListSecretVersionIds.
--
-- This operation returns paginated results.
module Amazonka.SecretsManager.ListSecrets
  ( -- * Creating a Request
    ListSecrets (..),
    newListSecrets,

    -- * Request Lenses
    listSecrets_filters,
    listSecrets_nextToken,
    listSecrets_sortOrder,
    listSecrets_maxResults,

    -- * Destructuring the Response
    ListSecretsResponse (..),
    newListSecretsResponse,

    -- * Response Lenses
    listSecretsResponse_nextToken,
    listSecretsResponse_secretList,
    listSecretsResponse_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:/ 'newListSecrets' smart constructor.
data ListSecrets = ListSecrets'
  { -- | Lists the secret request filters.
    ListSecrets -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | (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.
    ListSecrets -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Lists secrets in the requested order.
    ListSecrets -> Maybe SortOrderType
sortOrder :: Prelude.Maybe SortOrderType,
    -- | (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.
    ListSecrets -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListSecrets -> ListSecrets -> Bool
(ListSecrets -> ListSecrets -> Bool)
-> (ListSecrets -> ListSecrets -> Bool) -> Eq ListSecrets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSecrets -> ListSecrets -> Bool
$c/= :: ListSecrets -> ListSecrets -> Bool
== :: ListSecrets -> ListSecrets -> Bool
$c== :: ListSecrets -> ListSecrets -> Bool
Prelude.Eq, ReadPrec [ListSecrets]
ReadPrec ListSecrets
Int -> ReadS ListSecrets
ReadS [ListSecrets]
(Int -> ReadS ListSecrets)
-> ReadS [ListSecrets]
-> ReadPrec ListSecrets
-> ReadPrec [ListSecrets]
-> Read ListSecrets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSecrets]
$creadListPrec :: ReadPrec [ListSecrets]
readPrec :: ReadPrec ListSecrets
$creadPrec :: ReadPrec ListSecrets
readList :: ReadS [ListSecrets]
$creadList :: ReadS [ListSecrets]
readsPrec :: Int -> ReadS ListSecrets
$creadsPrec :: Int -> ReadS ListSecrets
Prelude.Read, Int -> ListSecrets -> ShowS
[ListSecrets] -> ShowS
ListSecrets -> String
(Int -> ListSecrets -> ShowS)
-> (ListSecrets -> String)
-> ([ListSecrets] -> ShowS)
-> Show ListSecrets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSecrets] -> ShowS
$cshowList :: [ListSecrets] -> ShowS
show :: ListSecrets -> String
$cshow :: ListSecrets -> String
showsPrec :: Int -> ListSecrets -> ShowS
$cshowsPrec :: Int -> ListSecrets -> ShowS
Prelude.Show, (forall x. ListSecrets -> Rep ListSecrets x)
-> (forall x. Rep ListSecrets x -> ListSecrets)
-> Generic ListSecrets
forall x. Rep ListSecrets x -> ListSecrets
forall x. ListSecrets -> Rep ListSecrets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSecrets x -> ListSecrets
$cfrom :: forall x. ListSecrets -> Rep ListSecrets x
Prelude.Generic)

-- |
-- Create a value of 'ListSecrets' 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:
--
-- 'filters', 'listSecrets_filters' - Lists the secret request filters.
--
-- 'nextToken', 'listSecrets_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.
--
-- 'sortOrder', 'listSecrets_sortOrder' - Lists secrets in the requested order.
--
-- 'maxResults', 'listSecrets_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.
newListSecrets ::
  ListSecrets
newListSecrets :: ListSecrets
newListSecrets =
  ListSecrets' :: Maybe [Filter]
-> Maybe Text
-> Maybe SortOrderType
-> Maybe Natural
-> ListSecrets
ListSecrets'
    { $sel:filters:ListSecrets' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListSecrets' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListSecrets' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListSecrets' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Lists the secret request filters.
listSecrets_filters :: Lens.Lens' ListSecrets (Prelude.Maybe [Filter])
listSecrets_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> ListSecrets -> f ListSecrets
listSecrets_filters = (ListSecrets -> Maybe [Filter])
-> (ListSecrets -> Maybe [Filter] -> ListSecrets)
-> Lens ListSecrets ListSecrets (Maybe [Filter]) (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecrets' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:ListSecrets' :: ListSecrets -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: ListSecrets
s@ListSecrets' {} Maybe [Filter]
a -> ListSecrets
s {$sel:filters:ListSecrets' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: ListSecrets) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> ListSecrets -> f ListSecrets)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> ListSecrets
-> f ListSecrets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | (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.
listSecrets_nextToken :: Lens.Lens' ListSecrets (Prelude.Maybe Prelude.Text)
listSecrets_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListSecrets -> f ListSecrets
listSecrets_nextToken = (ListSecrets -> Maybe Text)
-> (ListSecrets -> Maybe Text -> ListSecrets)
-> Lens ListSecrets ListSecrets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecrets' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSecrets' :: ListSecrets -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSecrets
s@ListSecrets' {} Maybe Text
a -> ListSecrets
s {$sel:nextToken:ListSecrets' :: Maybe Text
nextToken = Maybe Text
a} :: ListSecrets)

-- | Lists secrets in the requested order.
listSecrets_sortOrder :: Lens.Lens' ListSecrets (Prelude.Maybe SortOrderType)
listSecrets_sortOrder :: (Maybe SortOrderType -> f (Maybe SortOrderType))
-> ListSecrets -> f ListSecrets
listSecrets_sortOrder = (ListSecrets -> Maybe SortOrderType)
-> (ListSecrets -> Maybe SortOrderType -> ListSecrets)
-> Lens
     ListSecrets ListSecrets (Maybe SortOrderType) (Maybe SortOrderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecrets' {Maybe SortOrderType
sortOrder :: Maybe SortOrderType
$sel:sortOrder:ListSecrets' :: ListSecrets -> Maybe SortOrderType
sortOrder} -> Maybe SortOrderType
sortOrder) (\s :: ListSecrets
s@ListSecrets' {} Maybe SortOrderType
a -> ListSecrets
s {$sel:sortOrder:ListSecrets' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
a} :: ListSecrets)

-- | (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.
listSecrets_maxResults :: Lens.Lens' ListSecrets (Prelude.Maybe Prelude.Natural)
listSecrets_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListSecrets -> f ListSecrets
listSecrets_maxResults = (ListSecrets -> Maybe Natural)
-> (ListSecrets -> Maybe Natural -> ListSecrets)
-> Lens ListSecrets ListSecrets (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecrets' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSecrets' :: ListSecrets -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSecrets
s@ListSecrets' {} Maybe Natural
a -> ListSecrets
s {$sel:maxResults:ListSecrets' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSecrets)

instance Core.AWSPager ListSecrets where
  page :: ListSecrets -> AWSResponse ListSecrets -> Maybe ListSecrets
page ListSecrets
rq AWSResponse ListSecrets
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSecrets
ListSecretsResponse
rs
            ListSecretsResponse
-> Getting (First Text) ListSecretsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSecretsResponse -> Const (First Text) ListSecretsResponse
Lens' ListSecretsResponse (Maybe Text)
listSecretsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSecretsResponse -> Const (First Text) ListSecretsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSecretsResponse 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 ListSecrets
forall a. Maybe a
Prelude.Nothing
    | Maybe [SecretListEntry] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSecrets
ListSecretsResponse
rs
            ListSecretsResponse
-> Getting
     (First [SecretListEntry]) ListSecretsResponse [SecretListEntry]
-> Maybe [SecretListEntry]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [SecretListEntry]
 -> Const (First [SecretListEntry]) (Maybe [SecretListEntry]))
-> ListSecretsResponse
-> Const (First [SecretListEntry]) ListSecretsResponse
Lens' ListSecretsResponse (Maybe [SecretListEntry])
listSecretsResponse_secretList ((Maybe [SecretListEntry]
  -> Const (First [SecretListEntry]) (Maybe [SecretListEntry]))
 -> ListSecretsResponse
 -> Const (First [SecretListEntry]) ListSecretsResponse)
-> (([SecretListEntry]
     -> Const (First [SecretListEntry]) [SecretListEntry])
    -> Maybe [SecretListEntry]
    -> Const (First [SecretListEntry]) (Maybe [SecretListEntry]))
-> Getting
     (First [SecretListEntry]) ListSecretsResponse [SecretListEntry]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SecretListEntry]
 -> Const (First [SecretListEntry]) [SecretListEntry])
-> Maybe [SecretListEntry]
-> Const (First [SecretListEntry]) (Maybe [SecretListEntry])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListSecrets
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListSecrets -> Maybe ListSecrets
forall a. a -> Maybe a
Prelude.Just (ListSecrets -> Maybe ListSecrets)
-> ListSecrets -> Maybe ListSecrets
forall a b. (a -> b) -> a -> b
Prelude.$
        ListSecrets
rq
          ListSecrets -> (ListSecrets -> ListSecrets) -> ListSecrets
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListSecrets -> Identity ListSecrets
Lens ListSecrets ListSecrets (Maybe Text) (Maybe Text)
listSecrets_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListSecrets -> Identity ListSecrets)
-> Maybe Text -> ListSecrets -> ListSecrets
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSecrets
ListSecretsResponse
rs
          ListSecretsResponse
-> Getting (First Text) ListSecretsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSecretsResponse -> Const (First Text) ListSecretsResponse
Lens' ListSecretsResponse (Maybe Text)
listSecretsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSecretsResponse -> Const (First Text) ListSecretsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSecretsResponse 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 ListSecrets where
  type AWSResponse ListSecrets = ListSecretsResponse
  request :: ListSecrets -> Request ListSecrets
request = Service -> ListSecrets -> Request ListSecrets
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListSecrets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSecrets)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListSecrets))
-> Logger
-> Service
-> Proxy ListSecrets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSecrets)))
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 [SecretListEntry] -> Int -> ListSecretsResponse
ListSecretsResponse'
            (Maybe Text
 -> Maybe [SecretListEntry] -> Int -> ListSecretsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [SecretListEntry] -> Int -> ListSecretsResponse)
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
"NextToken")
            Either
  String (Maybe [SecretListEntry] -> Int -> ListSecretsResponse)
-> Either String (Maybe [SecretListEntry])
-> Either String (Int -> ListSecretsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [SecretListEntry]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SecretList" Either String (Maybe (Maybe [SecretListEntry]))
-> Maybe [SecretListEntry]
-> Either String (Maybe [SecretListEntry])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SecretListEntry]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListSecretsResponse)
-> Either String Int -> Either String ListSecretsResponse
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 ListSecrets

instance Prelude.NFData ListSecrets

instance Core.ToHeaders ListSecrets where
  toHeaders :: ListSecrets -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListSecrets -> 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.ListSecrets" :: 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 ListSecrets where
  toJSON :: ListSecrets -> Value
toJSON ListSecrets' {Maybe Natural
Maybe [Filter]
Maybe Text
Maybe SortOrderType
maxResults :: Maybe Natural
sortOrder :: Maybe SortOrderType
nextToken :: Maybe Text
filters :: Maybe [Filter]
$sel:maxResults:ListSecrets' :: ListSecrets -> Maybe Natural
$sel:sortOrder:ListSecrets' :: ListSecrets -> Maybe SortOrderType
$sel:nextToken:ListSecrets' :: ListSecrets -> Maybe Text
$sel:filters:ListSecrets' :: ListSecrets -> Maybe [Filter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (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
"SortOrder" Text -> SortOrderType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortOrderType -> Pair) -> Maybe SortOrderType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortOrderType
sortOrder,
            (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
          ]
      )

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

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

-- | /See:/ 'newListSecretsResponse' smart constructor.
data ListSecretsResponse = ListSecretsResponse'
  { -- | 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@).
    ListSecretsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of the secrets in the account.
    ListSecretsResponse -> Maybe [SecretListEntry]
secretList :: Prelude.Maybe [SecretListEntry],
    -- | The response's http status code.
    ListSecretsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSecretsResponse -> ListSecretsResponse -> Bool
(ListSecretsResponse -> ListSecretsResponse -> Bool)
-> (ListSecretsResponse -> ListSecretsResponse -> Bool)
-> Eq ListSecretsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSecretsResponse -> ListSecretsResponse -> Bool
$c/= :: ListSecretsResponse -> ListSecretsResponse -> Bool
== :: ListSecretsResponse -> ListSecretsResponse -> Bool
$c== :: ListSecretsResponse -> ListSecretsResponse -> Bool
Prelude.Eq, ReadPrec [ListSecretsResponse]
ReadPrec ListSecretsResponse
Int -> ReadS ListSecretsResponse
ReadS [ListSecretsResponse]
(Int -> ReadS ListSecretsResponse)
-> ReadS [ListSecretsResponse]
-> ReadPrec ListSecretsResponse
-> ReadPrec [ListSecretsResponse]
-> Read ListSecretsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSecretsResponse]
$creadListPrec :: ReadPrec [ListSecretsResponse]
readPrec :: ReadPrec ListSecretsResponse
$creadPrec :: ReadPrec ListSecretsResponse
readList :: ReadS [ListSecretsResponse]
$creadList :: ReadS [ListSecretsResponse]
readsPrec :: Int -> ReadS ListSecretsResponse
$creadsPrec :: Int -> ReadS ListSecretsResponse
Prelude.Read, Int -> ListSecretsResponse -> ShowS
[ListSecretsResponse] -> ShowS
ListSecretsResponse -> String
(Int -> ListSecretsResponse -> ShowS)
-> (ListSecretsResponse -> String)
-> ([ListSecretsResponse] -> ShowS)
-> Show ListSecretsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSecretsResponse] -> ShowS
$cshowList :: [ListSecretsResponse] -> ShowS
show :: ListSecretsResponse -> String
$cshow :: ListSecretsResponse -> String
showsPrec :: Int -> ListSecretsResponse -> ShowS
$cshowsPrec :: Int -> ListSecretsResponse -> ShowS
Prelude.Show, (forall x. ListSecretsResponse -> Rep ListSecretsResponse x)
-> (forall x. Rep ListSecretsResponse x -> ListSecretsResponse)
-> Generic ListSecretsResponse
forall x. Rep ListSecretsResponse x -> ListSecretsResponse
forall x. ListSecretsResponse -> Rep ListSecretsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSecretsResponse x -> ListSecretsResponse
$cfrom :: forall x. ListSecretsResponse -> Rep ListSecretsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListSecretsResponse' 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', 'listSecretsResponse_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@).
--
-- 'secretList', 'listSecretsResponse_secretList' - A list of the secrets in the account.
--
-- 'httpStatus', 'listSecretsResponse_httpStatus' - The response's http status code.
newListSecretsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSecretsResponse
newListSecretsResponse :: Int -> ListSecretsResponse
newListSecretsResponse Int
pHttpStatus_ =
  ListSecretsResponse' :: Maybe Text -> Maybe [SecretListEntry] -> Int -> ListSecretsResponse
ListSecretsResponse'
    { $sel:nextToken:ListSecretsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:secretList:ListSecretsResponse' :: Maybe [SecretListEntry]
secretList = Maybe [SecretListEntry]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListSecretsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | 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@).
listSecretsResponse_nextToken :: Lens.Lens' ListSecretsResponse (Prelude.Maybe Prelude.Text)
listSecretsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSecretsResponse -> f ListSecretsResponse
listSecretsResponse_nextToken = (ListSecretsResponse -> Maybe Text)
-> (ListSecretsResponse -> Maybe Text -> ListSecretsResponse)
-> Lens' ListSecretsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecretsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSecretsResponse' :: ListSecretsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSecretsResponse
s@ListSecretsResponse' {} Maybe Text
a -> ListSecretsResponse
s {$sel:nextToken:ListSecretsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSecretsResponse)

-- | A list of the secrets in the account.
listSecretsResponse_secretList :: Lens.Lens' ListSecretsResponse (Prelude.Maybe [SecretListEntry])
listSecretsResponse_secretList :: (Maybe [SecretListEntry] -> f (Maybe [SecretListEntry]))
-> ListSecretsResponse -> f ListSecretsResponse
listSecretsResponse_secretList = (ListSecretsResponse -> Maybe [SecretListEntry])
-> (ListSecretsResponse
    -> Maybe [SecretListEntry] -> ListSecretsResponse)
-> Lens' ListSecretsResponse (Maybe [SecretListEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSecretsResponse' {Maybe [SecretListEntry]
secretList :: Maybe [SecretListEntry]
$sel:secretList:ListSecretsResponse' :: ListSecretsResponse -> Maybe [SecretListEntry]
secretList} -> Maybe [SecretListEntry]
secretList) (\s :: ListSecretsResponse
s@ListSecretsResponse' {} Maybe [SecretListEntry]
a -> ListSecretsResponse
s {$sel:secretList:ListSecretsResponse' :: Maybe [SecretListEntry]
secretList = Maybe [SecretListEntry]
a} :: ListSecretsResponse) ((Maybe [SecretListEntry] -> f (Maybe [SecretListEntry]))
 -> ListSecretsResponse -> f ListSecretsResponse)
-> ((Maybe [SecretListEntry] -> f (Maybe [SecretListEntry]))
    -> Maybe [SecretListEntry] -> f (Maybe [SecretListEntry]))
-> (Maybe [SecretListEntry] -> f (Maybe [SecretListEntry]))
-> ListSecretsResponse
-> f ListSecretsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SecretListEntry]
  [SecretListEntry]
  [SecretListEntry]
  [SecretListEntry]
-> Iso
     (Maybe [SecretListEntry])
     (Maybe [SecretListEntry])
     (Maybe [SecretListEntry])
     (Maybe [SecretListEntry])
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
  [SecretListEntry]
  [SecretListEntry]
  [SecretListEntry]
  [SecretListEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListSecretsResponse