{-# 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.RAM.GetResourcePolicies
-- 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)
--
-- Gets the policies for the specified resources that you own and have
-- shared.
--
-- This operation returns paginated results.
module Amazonka.RAM.GetResourcePolicies
  ( -- * Creating a Request
    GetResourcePolicies (..),
    newGetResourcePolicies,

    -- * Request Lenses
    getResourcePolicies_nextToken,
    getResourcePolicies_principal,
    getResourcePolicies_maxResults,
    getResourcePolicies_resourceArns,

    -- * Destructuring the Response
    GetResourcePoliciesResponse (..),
    newGetResourcePoliciesResponse,

    -- * Response Lenses
    getResourcePoliciesResponse_nextToken,
    getResourcePoliciesResponse_policies,
    getResourcePoliciesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetResourcePolicies' smart constructor.
data GetResourcePolicies = GetResourcePolicies'
  { -- | The token for the next page of results.
    GetResourcePolicies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The principal.
    GetResourcePolicies -> Maybe Text
principal :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return with a single call. To retrieve
    -- the remaining results, make another call with the returned @nextToken@
    -- value.
    GetResourcePolicies -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Names (ARNs) of the resources.
    GetResourcePolicies -> [Text]
resourceArns :: [Prelude.Text]
  }
  deriving (GetResourcePolicies -> GetResourcePolicies -> Bool
(GetResourcePolicies -> GetResourcePolicies -> Bool)
-> (GetResourcePolicies -> GetResourcePolicies -> Bool)
-> Eq GetResourcePolicies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResourcePolicies -> GetResourcePolicies -> Bool
$c/= :: GetResourcePolicies -> GetResourcePolicies -> Bool
== :: GetResourcePolicies -> GetResourcePolicies -> Bool
$c== :: GetResourcePolicies -> GetResourcePolicies -> Bool
Prelude.Eq, ReadPrec [GetResourcePolicies]
ReadPrec GetResourcePolicies
Int -> ReadS GetResourcePolicies
ReadS [GetResourcePolicies]
(Int -> ReadS GetResourcePolicies)
-> ReadS [GetResourcePolicies]
-> ReadPrec GetResourcePolicies
-> ReadPrec [GetResourcePolicies]
-> Read GetResourcePolicies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResourcePolicies]
$creadListPrec :: ReadPrec [GetResourcePolicies]
readPrec :: ReadPrec GetResourcePolicies
$creadPrec :: ReadPrec GetResourcePolicies
readList :: ReadS [GetResourcePolicies]
$creadList :: ReadS [GetResourcePolicies]
readsPrec :: Int -> ReadS GetResourcePolicies
$creadsPrec :: Int -> ReadS GetResourcePolicies
Prelude.Read, Int -> GetResourcePolicies -> ShowS
[GetResourcePolicies] -> ShowS
GetResourcePolicies -> String
(Int -> GetResourcePolicies -> ShowS)
-> (GetResourcePolicies -> String)
-> ([GetResourcePolicies] -> ShowS)
-> Show GetResourcePolicies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResourcePolicies] -> ShowS
$cshowList :: [GetResourcePolicies] -> ShowS
show :: GetResourcePolicies -> String
$cshow :: GetResourcePolicies -> String
showsPrec :: Int -> GetResourcePolicies -> ShowS
$cshowsPrec :: Int -> GetResourcePolicies -> ShowS
Prelude.Show, (forall x. GetResourcePolicies -> Rep GetResourcePolicies x)
-> (forall x. Rep GetResourcePolicies x -> GetResourcePolicies)
-> Generic GetResourcePolicies
forall x. Rep GetResourcePolicies x -> GetResourcePolicies
forall x. GetResourcePolicies -> Rep GetResourcePolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetResourcePolicies x -> GetResourcePolicies
$cfrom :: forall x. GetResourcePolicies -> Rep GetResourcePolicies x
Prelude.Generic)

-- |
-- Create a value of 'GetResourcePolicies' 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', 'getResourcePolicies_nextToken' - The token for the next page of results.
--
-- 'principal', 'getResourcePolicies_principal' - The principal.
--
-- 'maxResults', 'getResourcePolicies_maxResults' - The maximum number of results to return with a single call. To retrieve
-- the remaining results, make another call with the returned @nextToken@
-- value.
--
-- 'resourceArns', 'getResourcePolicies_resourceArns' - The Amazon Resource Names (ARNs) of the resources.
newGetResourcePolicies ::
  GetResourcePolicies
newGetResourcePolicies :: GetResourcePolicies
newGetResourcePolicies =
  GetResourcePolicies' :: Maybe Text
-> Maybe Text -> Maybe Natural -> [Text] -> GetResourcePolicies
GetResourcePolicies'
    { $sel:nextToken:GetResourcePolicies' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:principal:GetResourcePolicies' :: Maybe Text
principal = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetResourcePolicies' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArns:GetResourcePolicies' :: [Text]
resourceArns = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The token for the next page of results.
getResourcePolicies_nextToken :: Lens.Lens' GetResourcePolicies (Prelude.Maybe Prelude.Text)
getResourcePolicies_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetResourcePolicies -> f GetResourcePolicies
getResourcePolicies_nextToken = (GetResourcePolicies -> Maybe Text)
-> (GetResourcePolicies -> Maybe Text -> GetResourcePolicies)
-> Lens
     GetResourcePolicies GetResourcePolicies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourcePolicies' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetResourcePolicies' :: GetResourcePolicies -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetResourcePolicies
s@GetResourcePolicies' {} Maybe Text
a -> GetResourcePolicies
s {$sel:nextToken:GetResourcePolicies' :: Maybe Text
nextToken = Maybe Text
a} :: GetResourcePolicies)

-- | The principal.
getResourcePolicies_principal :: Lens.Lens' GetResourcePolicies (Prelude.Maybe Prelude.Text)
getResourcePolicies_principal :: (Maybe Text -> f (Maybe Text))
-> GetResourcePolicies -> f GetResourcePolicies
getResourcePolicies_principal = (GetResourcePolicies -> Maybe Text)
-> (GetResourcePolicies -> Maybe Text -> GetResourcePolicies)
-> Lens
     GetResourcePolicies GetResourcePolicies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourcePolicies' {Maybe Text
principal :: Maybe Text
$sel:principal:GetResourcePolicies' :: GetResourcePolicies -> Maybe Text
principal} -> Maybe Text
principal) (\s :: GetResourcePolicies
s@GetResourcePolicies' {} Maybe Text
a -> GetResourcePolicies
s {$sel:principal:GetResourcePolicies' :: Maybe Text
principal = Maybe Text
a} :: GetResourcePolicies)

-- | The maximum number of results to return with a single call. To retrieve
-- the remaining results, make another call with the returned @nextToken@
-- value.
getResourcePolicies_maxResults :: Lens.Lens' GetResourcePolicies (Prelude.Maybe Prelude.Natural)
getResourcePolicies_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetResourcePolicies -> f GetResourcePolicies
getResourcePolicies_maxResults = (GetResourcePolicies -> Maybe Natural)
-> (GetResourcePolicies -> Maybe Natural -> GetResourcePolicies)
-> Lens
     GetResourcePolicies
     GetResourcePolicies
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourcePolicies' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetResourcePolicies' :: GetResourcePolicies -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetResourcePolicies
s@GetResourcePolicies' {} Maybe Natural
a -> GetResourcePolicies
s {$sel:maxResults:GetResourcePolicies' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetResourcePolicies)

-- | The Amazon Resource Names (ARNs) of the resources.
getResourcePolicies_resourceArns :: Lens.Lens' GetResourcePolicies [Prelude.Text]
getResourcePolicies_resourceArns :: ([Text] -> f [Text])
-> GetResourcePolicies -> f GetResourcePolicies
getResourcePolicies_resourceArns = (GetResourcePolicies -> [Text])
-> (GetResourcePolicies -> [Text] -> GetResourcePolicies)
-> Lens GetResourcePolicies GetResourcePolicies [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourcePolicies' {[Text]
resourceArns :: [Text]
$sel:resourceArns:GetResourcePolicies' :: GetResourcePolicies -> [Text]
resourceArns} -> [Text]
resourceArns) (\s :: GetResourcePolicies
s@GetResourcePolicies' {} [Text]
a -> GetResourcePolicies
s {$sel:resourceArns:GetResourcePolicies' :: [Text]
resourceArns = [Text]
a} :: GetResourcePolicies) (([Text] -> f [Text])
 -> GetResourcePolicies -> f GetResourcePolicies)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> GetResourcePolicies
-> f GetResourcePolicies
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetResourcePolicies

instance Core.ToHeaders GetResourcePolicies where
  toHeaders :: GetResourcePolicies -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetResourcePolicies -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 GetResourcePolicies where
  toJSON :: GetResourcePolicies -> Value
toJSON GetResourcePolicies' {[Text]
Maybe Natural
Maybe Text
resourceArns :: [Text]
maxResults :: Maybe Natural
principal :: Maybe Text
nextToken :: Maybe Text
$sel:resourceArns:GetResourcePolicies' :: GetResourcePolicies -> [Text]
$sel:maxResults:GetResourcePolicies' :: GetResourcePolicies -> Maybe Natural
$sel:principal:GetResourcePolicies' :: GetResourcePolicies -> Maybe Text
$sel:nextToken:GetResourcePolicies' :: GetResourcePolicies -> 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
"principal" 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
principal,
            (Text
"maxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"resourceArns" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
resourceArns)
          ]
      )

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

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

-- | /See:/ 'newGetResourcePoliciesResponse' smart constructor.
data GetResourcePoliciesResponse = GetResourcePoliciesResponse'
  { -- | The token to use to retrieve the next page of results. This value is
    -- @null@ when there are no more results to return.
    GetResourcePoliciesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A key policy document, in JSON format.
    GetResourcePoliciesResponse -> Maybe [Text]
policies :: Prelude.Maybe [Prelude.Text],
    -- | The response's http status code.
    GetResourcePoliciesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetResourcePoliciesResponse -> GetResourcePoliciesResponse -> Bool
(GetResourcePoliciesResponse
 -> GetResourcePoliciesResponse -> Bool)
-> (GetResourcePoliciesResponse
    -> GetResourcePoliciesResponse -> Bool)
-> Eq GetResourcePoliciesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResourcePoliciesResponse -> GetResourcePoliciesResponse -> Bool
$c/= :: GetResourcePoliciesResponse -> GetResourcePoliciesResponse -> Bool
== :: GetResourcePoliciesResponse -> GetResourcePoliciesResponse -> Bool
$c== :: GetResourcePoliciesResponse -> GetResourcePoliciesResponse -> Bool
Prelude.Eq, ReadPrec [GetResourcePoliciesResponse]
ReadPrec GetResourcePoliciesResponse
Int -> ReadS GetResourcePoliciesResponse
ReadS [GetResourcePoliciesResponse]
(Int -> ReadS GetResourcePoliciesResponse)
-> ReadS [GetResourcePoliciesResponse]
-> ReadPrec GetResourcePoliciesResponse
-> ReadPrec [GetResourcePoliciesResponse]
-> Read GetResourcePoliciesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResourcePoliciesResponse]
$creadListPrec :: ReadPrec [GetResourcePoliciesResponse]
readPrec :: ReadPrec GetResourcePoliciesResponse
$creadPrec :: ReadPrec GetResourcePoliciesResponse
readList :: ReadS [GetResourcePoliciesResponse]
$creadList :: ReadS [GetResourcePoliciesResponse]
readsPrec :: Int -> ReadS GetResourcePoliciesResponse
$creadsPrec :: Int -> ReadS GetResourcePoliciesResponse
Prelude.Read, Int -> GetResourcePoliciesResponse -> ShowS
[GetResourcePoliciesResponse] -> ShowS
GetResourcePoliciesResponse -> String
(Int -> GetResourcePoliciesResponse -> ShowS)
-> (GetResourcePoliciesResponse -> String)
-> ([GetResourcePoliciesResponse] -> ShowS)
-> Show GetResourcePoliciesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResourcePoliciesResponse] -> ShowS
$cshowList :: [GetResourcePoliciesResponse] -> ShowS
show :: GetResourcePoliciesResponse -> String
$cshow :: GetResourcePoliciesResponse -> String
showsPrec :: Int -> GetResourcePoliciesResponse -> ShowS
$cshowsPrec :: Int -> GetResourcePoliciesResponse -> ShowS
Prelude.Show, (forall x.
 GetResourcePoliciesResponse -> Rep GetResourcePoliciesResponse x)
-> (forall x.
    Rep GetResourcePoliciesResponse x -> GetResourcePoliciesResponse)
-> Generic GetResourcePoliciesResponse
forall x.
Rep GetResourcePoliciesResponse x -> GetResourcePoliciesResponse
forall x.
GetResourcePoliciesResponse -> Rep GetResourcePoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetResourcePoliciesResponse x -> GetResourcePoliciesResponse
$cfrom :: forall x.
GetResourcePoliciesResponse -> Rep GetResourcePoliciesResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetResourcePoliciesResponse' 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', 'getResourcePoliciesResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'policies', 'getResourcePoliciesResponse_policies' - A key policy document, in JSON format.
--
-- 'httpStatus', 'getResourcePoliciesResponse_httpStatus' - The response's http status code.
newGetResourcePoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetResourcePoliciesResponse
newGetResourcePoliciesResponse :: Int -> GetResourcePoliciesResponse
newGetResourcePoliciesResponse Int
pHttpStatus_ =
  GetResourcePoliciesResponse' :: Maybe Text -> Maybe [Text] -> Int -> GetResourcePoliciesResponse
GetResourcePoliciesResponse'
    { $sel:nextToken:GetResourcePoliciesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policies:GetResourcePoliciesResponse' :: Maybe [Text]
policies = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetResourcePoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
getResourcePoliciesResponse_nextToken :: Lens.Lens' GetResourcePoliciesResponse (Prelude.Maybe Prelude.Text)
getResourcePoliciesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetResourcePoliciesResponse -> f GetResourcePoliciesResponse
getResourcePoliciesResponse_nextToken = (GetResourcePoliciesResponse -> Maybe Text)
-> (GetResourcePoliciesResponse
    -> Maybe Text -> GetResourcePoliciesResponse)
-> Lens' GetResourcePoliciesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourcePoliciesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetResourcePoliciesResponse' :: GetResourcePoliciesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetResourcePoliciesResponse
s@GetResourcePoliciesResponse' {} Maybe Text
a -> GetResourcePoliciesResponse
s {$sel:nextToken:GetResourcePoliciesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetResourcePoliciesResponse)

-- | A key policy document, in JSON format.
getResourcePoliciesResponse_policies :: Lens.Lens' GetResourcePoliciesResponse (Prelude.Maybe [Prelude.Text])
getResourcePoliciesResponse_policies :: (Maybe [Text] -> f (Maybe [Text]))
-> GetResourcePoliciesResponse -> f GetResourcePoliciesResponse
getResourcePoliciesResponse_policies = (GetResourcePoliciesResponse -> Maybe [Text])
-> (GetResourcePoliciesResponse
    -> Maybe [Text] -> GetResourcePoliciesResponse)
-> Lens' GetResourcePoliciesResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourcePoliciesResponse' {Maybe [Text]
policies :: Maybe [Text]
$sel:policies:GetResourcePoliciesResponse' :: GetResourcePoliciesResponse -> Maybe [Text]
policies} -> Maybe [Text]
policies) (\s :: GetResourcePoliciesResponse
s@GetResourcePoliciesResponse' {} Maybe [Text]
a -> GetResourcePoliciesResponse
s {$sel:policies:GetResourcePoliciesResponse' :: Maybe [Text]
policies = Maybe [Text]
a} :: GetResourcePoliciesResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetResourcePoliciesResponse -> f GetResourcePoliciesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetResourcePoliciesResponse
-> f GetResourcePoliciesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetResourcePoliciesResponse