{-# 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.Organizations.ListPolicies
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the list of all policies in an organization of a specified
-- type.
--
-- Always check the @NextToken@ response parameter for a @null@ value when
-- calling a @List*@ operation. These operations can occasionally return an
-- empty set of results even when there are more results available. The
-- @NextToken@ response parameter value is @null@ /only/ when there are no
-- more results to display.
--
-- This operation can be called only from the organization\'s management
-- account or by a member account that is a delegated administrator for an
-- Amazon Web Services service.
--
-- This operation returns paginated results.
module Amazonka.Organizations.ListPolicies
  ( -- * Creating a Request
    ListPolicies (..),
    newListPolicies,

    -- * Request Lenses
    listPolicies_maxResults,
    listPolicies_nextToken,
    listPolicies_filter,

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

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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Organizations.Types
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'
  { -- | The total number of results that you want included on each page of the
    -- response. If you do not include this parameter, it defaults to a value
    -- that is specific to the operation. If additional items exist beyond the
    -- maximum you specify, the @NextToken@ response element is present and has
    -- a value (is not 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 Organizations 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.
    ListPolicies -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The parameter for receiving additional results if you receive a
    -- @NextToken@ response in a previous request. A @NextToken@ response
    -- indicates that more output is available. Set this parameter to the value
    -- of the previous call\'s @NextToken@ response to indicate where the
    -- output should continue from.
    ListPolicies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Specifies the type of policy that you want to include in the response.
    -- You must specify one of the following values:
    --
    -- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html AISERVICES_OPT_OUT_POLICY>
    --
    -- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup.html BACKUP_POLICY>
    --
    -- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scp.html SERVICE_CONTROL_POLICY>
    --
    -- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_tag-policies.html TAG_POLICY>
    ListPolicies -> PolicyType
filter' :: PolicyType
  }
  deriving (ListPolicies -> ListPolicies -> Bool
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]
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
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. 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:
--
-- 'maxResults', 'listPolicies_maxResults' - The total number of results that you want included on each page of the
-- response. If you do not include this parameter, it defaults to a value
-- that is specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (is not 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 Organizations 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.
--
-- 'nextToken', 'listPolicies_nextToken' - The parameter for receiving additional results if you receive a
-- @NextToken@ response in a previous request. A @NextToken@ response
-- indicates that more output is available. Set this parameter to the value
-- of the previous call\'s @NextToken@ response to indicate where the
-- output should continue from.
--
-- 'filter'', 'listPolicies_filter' - Specifies the type of policy that you want to include in the response.
-- You must specify one of the following values:
--
-- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html AISERVICES_OPT_OUT_POLICY>
--
-- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup.html BACKUP_POLICY>
--
-- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scp.html SERVICE_CONTROL_POLICY>
--
-- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_tag-policies.html TAG_POLICY>
newListPolicies ::
  -- | 'filter''
  PolicyType ->
  ListPolicies
newListPolicies :: PolicyType -> ListPolicies
newListPolicies PolicyType
pFilter_ =
  ListPolicies'
    { $sel:maxResults:ListPolicies' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPolicies' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListPolicies' :: PolicyType
filter' = PolicyType
pFilter_
    }

-- | The total number of results that you want included on each page of the
-- response. If you do not include this parameter, it defaults to a value
-- that is specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (is not 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 Organizations 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.
listPolicies_maxResults :: Lens.Lens' ListPolicies (Prelude.Maybe Prelude.Natural)
listPolicies_maxResults :: Lens' ListPolicies (Maybe Natural)
listPolicies_maxResults = 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)

-- | The parameter for receiving additional results if you receive a
-- @NextToken@ response in a previous request. A @NextToken@ response
-- indicates that more output is available. Set this parameter to the value
-- of the previous call\'s @NextToken@ response to indicate where the
-- output should continue from.
listPolicies_nextToken :: Lens.Lens' ListPolicies (Prelude.Maybe Prelude.Text)
listPolicies_nextToken :: Lens' ListPolicies (Maybe Text)
listPolicies_nextToken = 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 type of policy that you want to include in the response.
-- You must specify one of the following values:
--
-- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html AISERVICES_OPT_OUT_POLICY>
--
-- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup.html BACKUP_POLICY>
--
-- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scp.html SERVICE_CONTROL_POLICY>
--
-- -   <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_tag-policies.html TAG_POLICY>
listPolicies_filter :: Lens.Lens' ListPolicies PolicyType
listPolicies_filter :: Lens' ListPolicies PolicyType
listPolicies_filter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicies' {PolicyType
filter' :: PolicyType
$sel:filter':ListPolicies' :: ListPolicies -> PolicyType
filter'} -> PolicyType
filter') (\s :: ListPolicies
s@ListPolicies' {} PolicyType
a -> ListPolicies
s {$sel:filter':ListPolicies' :: PolicyType
filter' = PolicyType
a} :: ListPolicies)

instance Core.AWSPager ListPolicies where
  page :: ListPolicies -> AWSResponse ListPolicies -> Maybe ListPolicies
page ListPolicies
rq AWSResponse ListPolicies
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPolicies
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPoliciesResponse (Maybe Text)
listPoliciesResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPolicies
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPoliciesResponse (Maybe [PolicySummary])
listPoliciesResponse_policies
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListPolicies
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPolicies (Maybe Text)
listPolicies_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPolicies
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPoliciesResponse (Maybe Text)
listPoliciesResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListPolicies where
  type AWSResponse ListPolicies = ListPoliciesResponse
  request :: (Service -> Service) -> ListPolicies -> Request ListPolicies
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListPolicies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPolicies)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe [PolicySummary] -> Int -> ListPoliciesResponse
ListPoliciesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Policies" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListPolicies where
  hashWithSalt :: Int -> ListPolicies -> Int
hashWithSalt Int
_salt ListPolicies' {Maybe Natural
Maybe Text
PolicyType
filter' :: PolicyType
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:filter':ListPolicies' :: ListPolicies -> PolicyType
$sel:nextToken:ListPolicies' :: ListPolicies -> Maybe Text
$sel:maxResults:ListPolicies' :: ListPolicies -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PolicyType
filter'

instance Prelude.NFData ListPolicies where
  rnf :: ListPolicies -> ()
rnf ListPolicies' {Maybe Natural
Maybe Text
PolicyType
filter' :: PolicyType
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:filter':ListPolicies' :: ListPolicies -> PolicyType
$sel:nextToken:ListPolicies' :: ListPolicies -> Maybe Text
$sel:maxResults:ListPolicies' :: ListPolicies -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PolicyType
filter'

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

instance Data.ToJSON ListPolicies where
  toJSON :: ListPolicies -> Value
toJSON ListPolicies' {Maybe Natural
Maybe Text
PolicyType
filter' :: PolicyType
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:filter':ListPolicies' :: ListPolicies -> PolicyType
$sel:nextToken:ListPolicies' :: ListPolicies -> Maybe Text
$sel:maxResults:ListPolicies' :: ListPolicies -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            forall a. a -> Maybe a
Prelude.Just (Key
"Filter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PolicyType
filter')
          ]
      )

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

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

-- | /See:/ 'newListPoliciesResponse' smart constructor.
data ListPoliciesResponse = ListPoliciesResponse'
  { -- | If present, indicates that more output is available than is included in
    -- the current response. Use this value in the @NextToken@ request
    -- parameter in a subsequent call to the operation to get the next part of
    -- the output. You should repeat this until the @NextToken@ response
    -- element comes back as @null@.
    ListPoliciesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of policies that match the filter criteria in the request. The
    -- output list doesn\'t include the policy contents. To see the content for
    -- a policy, see DescribePolicy.
    ListPoliciesResponse -> Maybe [PolicySummary]
policies :: Prelude.Maybe [PolicySummary],
    -- | The response's http status code.
    ListPoliciesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPoliciesResponse -> ListPoliciesResponse -> Bool
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]
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
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. 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 present, indicates that more output is available than is included in
-- the current response. Use this value in the @NextToken@ request
-- parameter in a subsequent call to the operation to get the next part of
-- the output. You should repeat this until the @NextToken@ response
-- element comes back as @null@.
--
-- 'policies', 'listPoliciesResponse_policies' - A list of policies that match the filter criteria in the request. The
-- output list doesn\'t include the policy contents. To see the content for
-- a policy, see DescribePolicy.
--
-- 'httpStatus', 'listPoliciesResponse_httpStatus' - The response's http status code.
newListPoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPoliciesResponse
newListPoliciesResponse :: Int -> ListPoliciesResponse
newListPoliciesResponse Int
pHttpStatus_ =
  ListPoliciesResponse'
    { $sel:nextToken:ListPoliciesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:policies:ListPoliciesResponse' :: Maybe [PolicySummary]
policies = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If present, indicates that more output is available than is included in
-- the current response. Use this value in the @NextToken@ request
-- parameter in a subsequent call to the operation to get the next part of
-- the output. You should repeat this until the @NextToken@ response
-- element comes back as @null@.
listPoliciesResponse_nextToken :: Lens.Lens' ListPoliciesResponse (Prelude.Maybe Prelude.Text)
listPoliciesResponse_nextToken :: Lens' ListPoliciesResponse (Maybe Text)
listPoliciesResponse_nextToken = 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)

-- | A list of policies that match the filter criteria in the request. The
-- output list doesn\'t include the policy contents. To see the content for
-- a policy, see DescribePolicy.
listPoliciesResponse_policies :: Lens.Lens' ListPoliciesResponse (Prelude.Maybe [PolicySummary])
listPoliciesResponse_policies :: Lens' ListPoliciesResponse (Maybe [PolicySummary])
listPoliciesResponse_policies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesResponse' {Maybe [PolicySummary]
policies :: Maybe [PolicySummary]
$sel:policies:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe [PolicySummary]
policies} -> Maybe [PolicySummary]
policies) (\s :: ListPoliciesResponse
s@ListPoliciesResponse' {} Maybe [PolicySummary]
a -> ListPoliciesResponse
s {$sel:policies:ListPoliciesResponse' :: Maybe [PolicySummary]
policies = Maybe [PolicySummary]
a} :: ListPoliciesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
listPoliciesResponse_httpStatus :: Lens.Lens' ListPoliciesResponse Prelude.Int
listPoliciesResponse_httpStatus :: Lens' ListPoliciesResponse Int
listPoliciesResponse_httpStatus = 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 where
  rnf :: ListPoliciesResponse -> ()
rnf ListPoliciesResponse' {Int
Maybe [PolicySummary]
Maybe Text
httpStatus :: Int
policies :: Maybe [PolicySummary]
nextToken :: Maybe Text
$sel:httpStatus:ListPoliciesResponse' :: ListPoliciesResponse -> Int
$sel:policies:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe [PolicySummary]
$sel:nextToken:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PolicySummary]
policies
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus