{-# 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.FMS.ListPolicies
-- 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)
--
-- Returns an array of @PolicySummary@ objects.
--
-- This operation returns paginated results.
module Amazonka.FMS.ListPolicies
  ( -- * Creating a Request
    ListPolicies (..),
    newListPolicies,

    -- * Request Lenses
    listPolicies_nextToken,
    listPolicies_maxResults,

    -- * Destructuring the Response
    ListPoliciesResponse (..),
    newListPoliciesResponse,

    -- * Response Lenses
    listPoliciesResponse_nextToken,
    listPoliciesResponse_policyList,
    listPoliciesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.FMS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListPolicies' smart constructor.
data ListPolicies = ListPolicies'
  { -- | If you specify a value for @MaxResults@ and you have more
    -- @PolicySummary@ objects than the number that you specify for
    -- @MaxResults@, Firewall Manager returns a @NextToken@ value in the
    -- response that allows you to list another group of @PolicySummary@
    -- objects. For the second and subsequent @ListPolicies@ requests, specify
    -- the value of @NextToken@ from the previous response to get information
    -- about another batch of @PolicySummary@ objects.
    ListPolicies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Specifies the number of @PolicySummary@ objects that you want Firewall
    -- Manager to return for this request. If you have more @PolicySummary@
    -- objects than the number that you specify for @MaxResults@, the response
    -- includes a @NextToken@ value that you can use to get another batch of
    -- @PolicySummary@ objects.
    ListPolicies -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListPolicies -> ListPolicies -> Bool
(ListPolicies -> ListPolicies -> Bool)
-> (ListPolicies -> ListPolicies -> Bool) -> Eq ListPolicies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPolicies -> ListPolicies -> Bool
$c/= :: ListPolicies -> ListPolicies -> Bool
== :: ListPolicies -> ListPolicies -> Bool
$c== :: ListPolicies -> ListPolicies -> Bool
Prelude.Eq, ReadPrec [ListPolicies]
ReadPrec ListPolicies
Int -> ReadS ListPolicies
ReadS [ListPolicies]
(Int -> ReadS ListPolicies)
-> ReadS [ListPolicies]
-> ReadPrec ListPolicies
-> ReadPrec [ListPolicies]
-> Read ListPolicies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPolicies]
$creadListPrec :: ReadPrec [ListPolicies]
readPrec :: ReadPrec ListPolicies
$creadPrec :: ReadPrec ListPolicies
readList :: ReadS [ListPolicies]
$creadList :: ReadS [ListPolicies]
readsPrec :: Int -> ReadS ListPolicies
$creadsPrec :: Int -> ReadS ListPolicies
Prelude.Read, Int -> ListPolicies -> ShowS
[ListPolicies] -> ShowS
ListPolicies -> String
(Int -> ListPolicies -> ShowS)
-> (ListPolicies -> String)
-> ([ListPolicies] -> ShowS)
-> Show ListPolicies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPolicies] -> ShowS
$cshowList :: [ListPolicies] -> ShowS
show :: ListPolicies -> String
$cshow :: ListPolicies -> String
showsPrec :: Int -> ListPolicies -> ShowS
$cshowsPrec :: Int -> ListPolicies -> ShowS
Prelude.Show, (forall x. ListPolicies -> Rep ListPolicies x)
-> (forall x. Rep ListPolicies x -> ListPolicies)
-> Generic ListPolicies
forall x. Rep ListPolicies x -> ListPolicies
forall x. ListPolicies -> Rep ListPolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPolicies x -> ListPolicies
$cfrom :: forall x. ListPolicies -> Rep ListPolicies x
Prelude.Generic)

-- |
-- Create a value of 'ListPolicies' 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', 'listPolicies_nextToken' - If you specify a value for @MaxResults@ and you have more
-- @PolicySummary@ objects than the number that you specify for
-- @MaxResults@, Firewall Manager returns a @NextToken@ value in the
-- response that allows you to list another group of @PolicySummary@
-- objects. For the second and subsequent @ListPolicies@ requests, specify
-- the value of @NextToken@ from the previous response to get information
-- about another batch of @PolicySummary@ objects.
--
-- 'maxResults', 'listPolicies_maxResults' - Specifies the number of @PolicySummary@ objects that you want Firewall
-- Manager to return for this request. If you have more @PolicySummary@
-- objects than the number that you specify for @MaxResults@, the response
-- includes a @NextToken@ value that you can use to get another batch of
-- @PolicySummary@ objects.
newListPolicies ::
  ListPolicies
newListPolicies :: ListPolicies
newListPolicies =
  ListPolicies' :: Maybe Text -> Maybe Natural -> ListPolicies
ListPolicies'
    { $sel:nextToken:ListPolicies' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListPolicies' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | If you specify a value for @MaxResults@ and you have more
-- @PolicySummary@ objects than the number that you specify for
-- @MaxResults@, Firewall Manager returns a @NextToken@ value in the
-- response that allows you to list another group of @PolicySummary@
-- objects. For the second and subsequent @ListPolicies@ requests, specify
-- the value of @NextToken@ from the previous response to get information
-- about another batch of @PolicySummary@ objects.
listPolicies_nextToken :: Lens.Lens' ListPolicies (Prelude.Maybe Prelude.Text)
listPolicies_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListPolicies -> f ListPolicies
listPolicies_nextToken = (ListPolicies -> Maybe Text)
-> (ListPolicies -> Maybe Text -> ListPolicies)
-> Lens ListPolicies ListPolicies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicies' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPolicies' :: ListPolicies -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPolicies
s@ListPolicies' {} Maybe Text
a -> ListPolicies
s {$sel:nextToken:ListPolicies' :: Maybe Text
nextToken = Maybe Text
a} :: ListPolicies)

-- | Specifies the number of @PolicySummary@ objects that you want Firewall
-- Manager to return for this request. If you have more @PolicySummary@
-- objects than the number that you specify for @MaxResults@, the response
-- includes a @NextToken@ value that you can use to get another batch of
-- @PolicySummary@ objects.
listPolicies_maxResults :: Lens.Lens' ListPolicies (Prelude.Maybe Prelude.Natural)
listPolicies_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListPolicies -> f ListPolicies
listPolicies_maxResults = (ListPolicies -> Maybe Natural)
-> (ListPolicies -> Maybe Natural -> ListPolicies)
-> Lens ListPolicies ListPolicies (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicies' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPolicies' :: ListPolicies -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPolicies
s@ListPolicies' {} Maybe Natural
a -> ListPolicies
s {$sel:maxResults:ListPolicies' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPolicies)

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

instance Prelude.NFData ListPolicies

instance Core.ToHeaders ListPolicies where
  toHeaders :: ListPolicies -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListPolicies -> 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
"AWSFMS_20180101.ListPolicies" ::
                          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 ListPolicies where
  toJSON :: ListPolicies -> Value
toJSON ListPolicies' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListPolicies' :: ListPolicies -> Maybe Natural
$sel:nextToken:ListPolicies' :: ListPolicies -> 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
"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 ListPolicies where
  toPath :: ListPolicies -> ByteString
toPath = ByteString -> ListPolicies -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListPoliciesResponse' smart constructor.
data ListPoliciesResponse = ListPoliciesResponse'
  { -- | If you have more @PolicySummary@ objects than the number that you
    -- specified for @MaxResults@ in the request, the response includes a
    -- @NextToken@ value. To list more @PolicySummary@ objects, submit another
    -- @ListPolicies@ request, and specify the @NextToken@ value from the
    -- response in the @NextToken@ value in the next request.
    ListPoliciesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of @PolicySummary@ objects.
    ListPoliciesResponse -> Maybe [PolicySummary]
policyList :: Prelude.Maybe [PolicySummary],
    -- | The response's http status code.
    ListPoliciesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPoliciesResponse -> ListPoliciesResponse -> Bool
(ListPoliciesResponse -> ListPoliciesResponse -> Bool)
-> (ListPoliciesResponse -> ListPoliciesResponse -> Bool)
-> Eq ListPoliciesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPoliciesResponse -> ListPoliciesResponse -> Bool
$c/= :: ListPoliciesResponse -> ListPoliciesResponse -> Bool
== :: ListPoliciesResponse -> ListPoliciesResponse -> Bool
$c== :: ListPoliciesResponse -> ListPoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListPoliciesResponse]
ReadPrec ListPoliciesResponse
Int -> ReadS ListPoliciesResponse
ReadS [ListPoliciesResponse]
(Int -> ReadS ListPoliciesResponse)
-> ReadS [ListPoliciesResponse]
-> ReadPrec ListPoliciesResponse
-> ReadPrec [ListPoliciesResponse]
-> Read ListPoliciesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPoliciesResponse]
$creadListPrec :: ReadPrec [ListPoliciesResponse]
readPrec :: ReadPrec ListPoliciesResponse
$creadPrec :: ReadPrec ListPoliciesResponse
readList :: ReadS [ListPoliciesResponse]
$creadList :: ReadS [ListPoliciesResponse]
readsPrec :: Int -> ReadS ListPoliciesResponse
$creadsPrec :: Int -> ReadS ListPoliciesResponse
Prelude.Read, Int -> ListPoliciesResponse -> ShowS
[ListPoliciesResponse] -> ShowS
ListPoliciesResponse -> String
(Int -> ListPoliciesResponse -> ShowS)
-> (ListPoliciesResponse -> String)
-> ([ListPoliciesResponse] -> ShowS)
-> Show ListPoliciesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPoliciesResponse] -> ShowS
$cshowList :: [ListPoliciesResponse] -> ShowS
show :: ListPoliciesResponse -> String
$cshow :: ListPoliciesResponse -> String
showsPrec :: Int -> ListPoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListPoliciesResponse -> ShowS
Prelude.Show, (forall x. ListPoliciesResponse -> Rep ListPoliciesResponse x)
-> (forall x. Rep ListPoliciesResponse x -> ListPoliciesResponse)
-> Generic ListPoliciesResponse
forall x. Rep ListPoliciesResponse x -> ListPoliciesResponse
forall x. ListPoliciesResponse -> Rep ListPoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPoliciesResponse x -> ListPoliciesResponse
$cfrom :: forall x. ListPoliciesResponse -> Rep ListPoliciesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPoliciesResponse' 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', 'listPoliciesResponse_nextToken' - If you have more @PolicySummary@ objects than the number that you
-- specified for @MaxResults@ in the request, the response includes a
-- @NextToken@ value. To list more @PolicySummary@ objects, submit another
-- @ListPolicies@ request, and specify the @NextToken@ value from the
-- response in the @NextToken@ value in the next request.
--
-- 'policyList', 'listPoliciesResponse_policyList' - An array of @PolicySummary@ objects.
--
-- 'httpStatus', 'listPoliciesResponse_httpStatus' - The response's http status code.
newListPoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPoliciesResponse
newListPoliciesResponse :: Int -> ListPoliciesResponse
newListPoliciesResponse Int
pHttpStatus_ =
  ListPoliciesResponse' :: Maybe Text -> Maybe [PolicySummary] -> Int -> ListPoliciesResponse
ListPoliciesResponse'
    { $sel:nextToken:ListPoliciesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyList:ListPoliciesResponse' :: Maybe [PolicySummary]
policyList = Maybe [PolicySummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If you have more @PolicySummary@ objects than the number that you
-- specified for @MaxResults@ in the request, the response includes a
-- @NextToken@ value. To list more @PolicySummary@ objects, submit another
-- @ListPolicies@ request, and specify the @NextToken@ value from the
-- response in the @NextToken@ value in the next request.
listPoliciesResponse_nextToken :: Lens.Lens' ListPoliciesResponse (Prelude.Maybe Prelude.Text)
listPoliciesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPoliciesResponse -> f ListPoliciesResponse
listPoliciesResponse_nextToken = (ListPoliciesResponse -> Maybe Text)
-> (ListPoliciesResponse -> Maybe Text -> ListPoliciesResponse)
-> Lens' ListPoliciesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPoliciesResponse
s@ListPoliciesResponse' {} Maybe Text
a -> ListPoliciesResponse
s {$sel:nextToken:ListPoliciesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPoliciesResponse)

-- | An array of @PolicySummary@ objects.
listPoliciesResponse_policyList :: Lens.Lens' ListPoliciesResponse (Prelude.Maybe [PolicySummary])
listPoliciesResponse_policyList :: (Maybe [PolicySummary] -> f (Maybe [PolicySummary]))
-> ListPoliciesResponse -> f ListPoliciesResponse
listPoliciesResponse_policyList = (ListPoliciesResponse -> Maybe [PolicySummary])
-> (ListPoliciesResponse
    -> Maybe [PolicySummary] -> ListPoliciesResponse)
-> Lens' ListPoliciesResponse (Maybe [PolicySummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesResponse' {Maybe [PolicySummary]
policyList :: Maybe [PolicySummary]
$sel:policyList:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe [PolicySummary]
policyList} -> Maybe [PolicySummary]
policyList) (\s :: ListPoliciesResponse
s@ListPoliciesResponse' {} Maybe [PolicySummary]
a -> ListPoliciesResponse
s {$sel:policyList:ListPoliciesResponse' :: Maybe [PolicySummary]
policyList = Maybe [PolicySummary]
a} :: ListPoliciesResponse) ((Maybe [PolicySummary] -> f (Maybe [PolicySummary]))
 -> ListPoliciesResponse -> f ListPoliciesResponse)
-> ((Maybe [PolicySummary] -> f (Maybe [PolicySummary]))
    -> Maybe [PolicySummary] -> f (Maybe [PolicySummary]))
-> (Maybe [PolicySummary] -> f (Maybe [PolicySummary]))
-> ListPoliciesResponse
-> f ListPoliciesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PolicySummary] [PolicySummary] [PolicySummary] [PolicySummary]
-> Iso
     (Maybe [PolicySummary])
     (Maybe [PolicySummary])
     (Maybe [PolicySummary])
     (Maybe [PolicySummary])
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
  [PolicySummary] [PolicySummary] [PolicySummary] [PolicySummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListPoliciesResponse