{-# 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.CloudWatchLogs.DescribeResourcePolicies
-- 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 the resource policies in this account.
--
-- This operation returns paginated results.
module Amazonka.CloudWatchLogs.DescribeResourcePolicies
  ( -- * Creating a Request
    DescribeResourcePolicies (..),
    newDescribeResourcePolicies,

    -- * Request Lenses
    describeResourcePolicies_nextToken,
    describeResourcePolicies_limit,

    -- * Destructuring the Response
    DescribeResourcePoliciesResponse (..),
    newDescribeResourcePoliciesResponse,

    -- * Response Lenses
    describeResourcePoliciesResponse_resourcePolicies,
    describeResourcePoliciesResponse_nextToken,
    describeResourcePoliciesResponse_httpStatus,
  )
where

import Amazonka.CloudWatchLogs.Types
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

-- | /See:/ 'newDescribeResourcePolicies' smart constructor.
data DescribeResourcePolicies = DescribeResourcePolicies'
  { DescribeResourcePolicies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of resource policies to be displayed with one call of
    -- this API.
    DescribeResourcePolicies -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeResourcePolicies -> DescribeResourcePolicies -> Bool
(DescribeResourcePolicies -> DescribeResourcePolicies -> Bool)
-> (DescribeResourcePolicies -> DescribeResourcePolicies -> Bool)
-> Eq DescribeResourcePolicies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourcePolicies -> DescribeResourcePolicies -> Bool
$c/= :: DescribeResourcePolicies -> DescribeResourcePolicies -> Bool
== :: DescribeResourcePolicies -> DescribeResourcePolicies -> Bool
$c== :: DescribeResourcePolicies -> DescribeResourcePolicies -> Bool
Prelude.Eq, ReadPrec [DescribeResourcePolicies]
ReadPrec DescribeResourcePolicies
Int -> ReadS DescribeResourcePolicies
ReadS [DescribeResourcePolicies]
(Int -> ReadS DescribeResourcePolicies)
-> ReadS [DescribeResourcePolicies]
-> ReadPrec DescribeResourcePolicies
-> ReadPrec [DescribeResourcePolicies]
-> Read DescribeResourcePolicies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourcePolicies]
$creadListPrec :: ReadPrec [DescribeResourcePolicies]
readPrec :: ReadPrec DescribeResourcePolicies
$creadPrec :: ReadPrec DescribeResourcePolicies
readList :: ReadS [DescribeResourcePolicies]
$creadList :: ReadS [DescribeResourcePolicies]
readsPrec :: Int -> ReadS DescribeResourcePolicies
$creadsPrec :: Int -> ReadS DescribeResourcePolicies
Prelude.Read, Int -> DescribeResourcePolicies -> ShowS
[DescribeResourcePolicies] -> ShowS
DescribeResourcePolicies -> String
(Int -> DescribeResourcePolicies -> ShowS)
-> (DescribeResourcePolicies -> String)
-> ([DescribeResourcePolicies] -> ShowS)
-> Show DescribeResourcePolicies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourcePolicies] -> ShowS
$cshowList :: [DescribeResourcePolicies] -> ShowS
show :: DescribeResourcePolicies -> String
$cshow :: DescribeResourcePolicies -> String
showsPrec :: Int -> DescribeResourcePolicies -> ShowS
$cshowsPrec :: Int -> DescribeResourcePolicies -> ShowS
Prelude.Show, (forall x.
 DescribeResourcePolicies -> Rep DescribeResourcePolicies x)
-> (forall x.
    Rep DescribeResourcePolicies x -> DescribeResourcePolicies)
-> Generic DescribeResourcePolicies
forall x.
Rep DescribeResourcePolicies x -> DescribeResourcePolicies
forall x.
DescribeResourcePolicies -> Rep DescribeResourcePolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeResourcePolicies x -> DescribeResourcePolicies
$cfrom :: forall x.
DescribeResourcePolicies -> Rep DescribeResourcePolicies x
Prelude.Generic)

-- |
-- Create a value of 'DescribeResourcePolicies' 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', 'describeResourcePolicies_nextToken' - Undocumented member.
--
-- 'limit', 'describeResourcePolicies_limit' - The maximum number of resource policies to be displayed with one call of
-- this API.
newDescribeResourcePolicies ::
  DescribeResourcePolicies
newDescribeResourcePolicies :: DescribeResourcePolicies
newDescribeResourcePolicies =
  DescribeResourcePolicies' :: Maybe Text -> Maybe Natural -> DescribeResourcePolicies
DescribeResourcePolicies'
    { $sel:nextToken:DescribeResourcePolicies' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeResourcePolicies' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
describeResourcePolicies_nextToken :: Lens.Lens' DescribeResourcePolicies (Prelude.Maybe Prelude.Text)
describeResourcePolicies_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeResourcePolicies -> f DescribeResourcePolicies
describeResourcePolicies_nextToken = (DescribeResourcePolicies -> Maybe Text)
-> (DescribeResourcePolicies
    -> Maybe Text -> DescribeResourcePolicies)
-> Lens
     DescribeResourcePolicies
     DescribeResourcePolicies
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePolicies' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeResourcePolicies' :: DescribeResourcePolicies -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeResourcePolicies
s@DescribeResourcePolicies' {} Maybe Text
a -> DescribeResourcePolicies
s {$sel:nextToken:DescribeResourcePolicies' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeResourcePolicies)

-- | The maximum number of resource policies to be displayed with one call of
-- this API.
describeResourcePolicies_limit :: Lens.Lens' DescribeResourcePolicies (Prelude.Maybe Prelude.Natural)
describeResourcePolicies_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeResourcePolicies -> f DescribeResourcePolicies
describeResourcePolicies_limit = (DescribeResourcePolicies -> Maybe Natural)
-> (DescribeResourcePolicies
    -> Maybe Natural -> DescribeResourcePolicies)
-> Lens
     DescribeResourcePolicies
     DescribeResourcePolicies
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePolicies' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeResourcePolicies' :: DescribeResourcePolicies -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeResourcePolicies
s@DescribeResourcePolicies' {} Maybe Natural
a -> DescribeResourcePolicies
s {$sel:limit:DescribeResourcePolicies' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeResourcePolicies)

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

instance Prelude.NFData DescribeResourcePolicies

instance Core.ToHeaders DescribeResourcePolicies where
  toHeaders :: DescribeResourcePolicies -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeResourcePolicies -> 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
"Logs_20140328.DescribeResourcePolicies" ::
                          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 DescribeResourcePolicies where
  toJSON :: DescribeResourcePolicies -> Value
toJSON DescribeResourcePolicies' {Maybe Natural
Maybe Text
limit :: Maybe Natural
nextToken :: Maybe Text
$sel:limit:DescribeResourcePolicies' :: DescribeResourcePolicies -> Maybe Natural
$sel:nextToken:DescribeResourcePolicies' :: DescribeResourcePolicies -> 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
"limit" 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
limit
          ]
      )

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

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

-- | /See:/ 'newDescribeResourcePoliciesResponse' smart constructor.
data DescribeResourcePoliciesResponse = DescribeResourcePoliciesResponse'
  { -- | The resource policies that exist in this account.
    DescribeResourcePoliciesResponse -> Maybe [ResourcePolicy]
resourcePolicies :: Prelude.Maybe [ResourcePolicy],
    DescribeResourcePoliciesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeResourcePoliciesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeResourcePoliciesResponse
-> DescribeResourcePoliciesResponse -> Bool
(DescribeResourcePoliciesResponse
 -> DescribeResourcePoliciesResponse -> Bool)
-> (DescribeResourcePoliciesResponse
    -> DescribeResourcePoliciesResponse -> Bool)
-> Eq DescribeResourcePoliciesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourcePoliciesResponse
-> DescribeResourcePoliciesResponse -> Bool
$c/= :: DescribeResourcePoliciesResponse
-> DescribeResourcePoliciesResponse -> Bool
== :: DescribeResourcePoliciesResponse
-> DescribeResourcePoliciesResponse -> Bool
$c== :: DescribeResourcePoliciesResponse
-> DescribeResourcePoliciesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeResourcePoliciesResponse]
ReadPrec DescribeResourcePoliciesResponse
Int -> ReadS DescribeResourcePoliciesResponse
ReadS [DescribeResourcePoliciesResponse]
(Int -> ReadS DescribeResourcePoliciesResponse)
-> ReadS [DescribeResourcePoliciesResponse]
-> ReadPrec DescribeResourcePoliciesResponse
-> ReadPrec [DescribeResourcePoliciesResponse]
-> Read DescribeResourcePoliciesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourcePoliciesResponse]
$creadListPrec :: ReadPrec [DescribeResourcePoliciesResponse]
readPrec :: ReadPrec DescribeResourcePoliciesResponse
$creadPrec :: ReadPrec DescribeResourcePoliciesResponse
readList :: ReadS [DescribeResourcePoliciesResponse]
$creadList :: ReadS [DescribeResourcePoliciesResponse]
readsPrec :: Int -> ReadS DescribeResourcePoliciesResponse
$creadsPrec :: Int -> ReadS DescribeResourcePoliciesResponse
Prelude.Read, Int -> DescribeResourcePoliciesResponse -> ShowS
[DescribeResourcePoliciesResponse] -> ShowS
DescribeResourcePoliciesResponse -> String
(Int -> DescribeResourcePoliciesResponse -> ShowS)
-> (DescribeResourcePoliciesResponse -> String)
-> ([DescribeResourcePoliciesResponse] -> ShowS)
-> Show DescribeResourcePoliciesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourcePoliciesResponse] -> ShowS
$cshowList :: [DescribeResourcePoliciesResponse] -> ShowS
show :: DescribeResourcePoliciesResponse -> String
$cshow :: DescribeResourcePoliciesResponse -> String
showsPrec :: Int -> DescribeResourcePoliciesResponse -> ShowS
$cshowsPrec :: Int -> DescribeResourcePoliciesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeResourcePoliciesResponse
 -> Rep DescribeResourcePoliciesResponse x)
-> (forall x.
    Rep DescribeResourcePoliciesResponse x
    -> DescribeResourcePoliciesResponse)
-> Generic DescribeResourcePoliciesResponse
forall x.
Rep DescribeResourcePoliciesResponse x
-> DescribeResourcePoliciesResponse
forall x.
DescribeResourcePoliciesResponse
-> Rep DescribeResourcePoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeResourcePoliciesResponse x
-> DescribeResourcePoliciesResponse
$cfrom :: forall x.
DescribeResourcePoliciesResponse
-> Rep DescribeResourcePoliciesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeResourcePoliciesResponse' 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:
--
-- 'resourcePolicies', 'describeResourcePoliciesResponse_resourcePolicies' - The resource policies that exist in this account.
--
-- 'nextToken', 'describeResourcePoliciesResponse_nextToken' - Undocumented member.
--
-- 'httpStatus', 'describeResourcePoliciesResponse_httpStatus' - The response's http status code.
newDescribeResourcePoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeResourcePoliciesResponse
newDescribeResourcePoliciesResponse :: Int -> DescribeResourcePoliciesResponse
newDescribeResourcePoliciesResponse Int
pHttpStatus_ =
  DescribeResourcePoliciesResponse' :: Maybe [ResourcePolicy]
-> Maybe Text -> Int -> DescribeResourcePoliciesResponse
DescribeResourcePoliciesResponse'
    { $sel:resourcePolicies:DescribeResourcePoliciesResponse' :: Maybe [ResourcePolicy]
resourcePolicies =
        Maybe [ResourcePolicy]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeResourcePoliciesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeResourcePoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The resource policies that exist in this account.
describeResourcePoliciesResponse_resourcePolicies :: Lens.Lens' DescribeResourcePoliciesResponse (Prelude.Maybe [ResourcePolicy])
describeResourcePoliciesResponse_resourcePolicies :: (Maybe [ResourcePolicy] -> f (Maybe [ResourcePolicy]))
-> DescribeResourcePoliciesResponse
-> f DescribeResourcePoliciesResponse
describeResourcePoliciesResponse_resourcePolicies = (DescribeResourcePoliciesResponse -> Maybe [ResourcePolicy])
-> (DescribeResourcePoliciesResponse
    -> Maybe [ResourcePolicy] -> DescribeResourcePoliciesResponse)
-> Lens' DescribeResourcePoliciesResponse (Maybe [ResourcePolicy])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePoliciesResponse' {Maybe [ResourcePolicy]
resourcePolicies :: Maybe [ResourcePolicy]
$sel:resourcePolicies:DescribeResourcePoliciesResponse' :: DescribeResourcePoliciesResponse -> Maybe [ResourcePolicy]
resourcePolicies} -> Maybe [ResourcePolicy]
resourcePolicies) (\s :: DescribeResourcePoliciesResponse
s@DescribeResourcePoliciesResponse' {} Maybe [ResourcePolicy]
a -> DescribeResourcePoliciesResponse
s {$sel:resourcePolicies:DescribeResourcePoliciesResponse' :: Maybe [ResourcePolicy]
resourcePolicies = Maybe [ResourcePolicy]
a} :: DescribeResourcePoliciesResponse) ((Maybe [ResourcePolicy] -> f (Maybe [ResourcePolicy]))
 -> DescribeResourcePoliciesResponse
 -> f DescribeResourcePoliciesResponse)
-> ((Maybe [ResourcePolicy] -> f (Maybe [ResourcePolicy]))
    -> Maybe [ResourcePolicy] -> f (Maybe [ResourcePolicy]))
-> (Maybe [ResourcePolicy] -> f (Maybe [ResourcePolicy]))
-> DescribeResourcePoliciesResponse
-> f DescribeResourcePoliciesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourcePolicy] [ResourcePolicy] [ResourcePolicy] [ResourcePolicy]
-> Iso
     (Maybe [ResourcePolicy])
     (Maybe [ResourcePolicy])
     (Maybe [ResourcePolicy])
     (Maybe [ResourcePolicy])
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
  [ResourcePolicy] [ResourcePolicy] [ResourcePolicy] [ResourcePolicy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
describeResourcePoliciesResponse_nextToken :: Lens.Lens' DescribeResourcePoliciesResponse (Prelude.Maybe Prelude.Text)
describeResourcePoliciesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeResourcePoliciesResponse
-> f DescribeResourcePoliciesResponse
describeResourcePoliciesResponse_nextToken = (DescribeResourcePoliciesResponse -> Maybe Text)
-> (DescribeResourcePoliciesResponse
    -> Maybe Text -> DescribeResourcePoliciesResponse)
-> Lens' DescribeResourcePoliciesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePoliciesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeResourcePoliciesResponse' :: DescribeResourcePoliciesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeResourcePoliciesResponse
s@DescribeResourcePoliciesResponse' {} Maybe Text
a -> DescribeResourcePoliciesResponse
s {$sel:nextToken:DescribeResourcePoliciesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeResourcePoliciesResponse)

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

instance
  Prelude.NFData
    DescribeResourcePoliciesResponse