{-# 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.SSMIncidents.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)
--
-- Retrieves the resource policies attached to the specified response plan.
--
-- This operation returns paginated results.
module Amazonka.SSMIncidents.GetResourcePolicies
  ( -- * Creating a Request
    GetResourcePolicies (..),
    newGetResourcePolicies,

    -- * Request Lenses
    getResourcePolicies_nextToken,
    getResourcePolicies_maxResults,
    getResourcePolicies_resourceArn,

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

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

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

-- | /See:/ 'newGetResourcePolicies' smart constructor.
data GetResourcePolicies = GetResourcePolicies'
  { -- | The pagination token to continue to the next page of results.
    GetResourcePolicies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of resource policies to display per page of results.
    GetResourcePolicies -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the response plan with the attached
    -- resource policy.
    GetResourcePolicies -> Text
resourceArn :: 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 pagination token to continue to the next page of results.
--
-- 'maxResults', 'getResourcePolicies_maxResults' - The maximum number of resource policies to display per page of results.
--
-- 'resourceArn', 'getResourcePolicies_resourceArn' - The Amazon Resource Name (ARN) of the response plan with the attached
-- resource policy.
newGetResourcePolicies ::
  -- | 'resourceArn'
  Prelude.Text ->
  GetResourcePolicies
newGetResourcePolicies :: Text -> GetResourcePolicies
newGetResourcePolicies Text
pResourceArn_ =
  GetResourcePolicies' :: Maybe Text -> Maybe Natural -> Text -> GetResourcePolicies
GetResourcePolicies'
    { $sel:nextToken:GetResourcePolicies' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetResourcePolicies' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArn:GetResourcePolicies' :: Text
resourceArn = Text
pResourceArn_
    }

-- | The pagination token to continue to 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 maximum number of resource policies to display per page of results.
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 Name (ARN) of the response plan with the attached
-- resource policy.
getResourcePolicies_resourceArn :: Lens.Lens' GetResourcePolicies Prelude.Text
getResourcePolicies_resourceArn :: (Text -> f Text) -> GetResourcePolicies -> f GetResourcePolicies
getResourcePolicies_resourceArn = (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
resourceArn :: Text
$sel:resourceArn:GetResourcePolicies' :: GetResourcePolicies -> Text
resourceArn} -> Text
resourceArn) (\s :: GetResourcePolicies
s@GetResourcePolicies' {} Text
a -> GetResourcePolicies
s {$sel:resourceArn:GetResourcePolicies' :: Text
resourceArn = Text
a} :: GetResourcePolicies)

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
    | [ResourcePolicy] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetResourcePolicies
GetResourcePoliciesResponse
rs
            GetResourcePoliciesResponse
-> Getting
     [ResourcePolicy] GetResourcePoliciesResponse [ResourcePolicy]
-> [ResourcePolicy]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [ResourcePolicy] GetResourcePoliciesResponse [ResourcePolicy]
Lens' GetResourcePoliciesResponse [ResourcePolicy]
getResourcePoliciesResponse_resourcePolicies
        ) =
      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
-> Int -> [ResourcePolicy] -> GetResourcePoliciesResponse
GetResourcePoliciesResponse'
            (Maybe Text
 -> Int -> [ResourcePolicy] -> GetResourcePoliciesResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> [ResourcePolicy] -> 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 (Int -> [ResourcePolicy] -> GetResourcePoliciesResponse)
-> Either String Int
-> Either String ([ResourcePolicy] -> 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))
            Either String ([ResourcePolicy] -> GetResourcePoliciesResponse)
-> Either String [ResourcePolicy]
-> Either String GetResourcePoliciesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [ResourcePolicy])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"resourcePolicies"
                            Either String (Maybe [ResourcePolicy])
-> [ResourcePolicy] -> Either String [ResourcePolicy]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ResourcePolicy]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

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' {Maybe Natural
Maybe Text
Text
resourceArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:resourceArn:GetResourcePolicies' :: GetResourcePolicies -> Text
$sel:maxResults:GetResourcePolicies' :: GetResourcePolicies -> Maybe Natural
$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
"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 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 GetResourcePolicies' {Maybe Natural
Maybe Text
Text
resourceArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:resourceArn:GetResourcePolicies' :: GetResourcePolicies -> Text
$sel:maxResults:GetResourcePolicies' :: GetResourcePolicies -> Maybe Natural
$sel:nextToken:GetResourcePolicies' :: GetResourcePolicies -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"resourceArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
resourceArn]

-- | /See:/ 'newGetResourcePoliciesResponse' smart constructor.
data GetResourcePoliciesResponse = GetResourcePoliciesResponse'
  { -- | The pagination token to continue to the next page of results.
    GetResourcePoliciesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetResourcePoliciesResponse -> Int
httpStatus :: Prelude.Int,
    -- | Details about the resource policy attached to the response plan.
    GetResourcePoliciesResponse -> [ResourcePolicy]
resourcePolicies :: [ResourcePolicy]
  }
  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 pagination token to continue to the next page of results.
--
-- 'httpStatus', 'getResourcePoliciesResponse_httpStatus' - The response's http status code.
--
-- 'resourcePolicies', 'getResourcePoliciesResponse_resourcePolicies' - Details about the resource policy attached to the response plan.
newGetResourcePoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetResourcePoliciesResponse
newGetResourcePoliciesResponse :: Int -> GetResourcePoliciesResponse
newGetResourcePoliciesResponse Int
pHttpStatus_ =
  GetResourcePoliciesResponse' :: Maybe Text
-> Int -> [ResourcePolicy] -> GetResourcePoliciesResponse
GetResourcePoliciesResponse'
    { $sel:nextToken:GetResourcePoliciesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetResourcePoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:resourcePolicies:GetResourcePoliciesResponse' :: [ResourcePolicy]
resourcePolicies = [ResourcePolicy]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The pagination token to continue to the next page of results.
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)

-- | 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)

-- | Details about the resource policy attached to the response plan.
getResourcePoliciesResponse_resourcePolicies :: Lens.Lens' GetResourcePoliciesResponse [ResourcePolicy]
getResourcePoliciesResponse_resourcePolicies :: ([ResourcePolicy] -> f [ResourcePolicy])
-> GetResourcePoliciesResponse -> f GetResourcePoliciesResponse
getResourcePoliciesResponse_resourcePolicies = (GetResourcePoliciesResponse -> [ResourcePolicy])
-> (GetResourcePoliciesResponse
    -> [ResourcePolicy] -> GetResourcePoliciesResponse)
-> Lens' GetResourcePoliciesResponse [ResourcePolicy]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourcePoliciesResponse' {[ResourcePolicy]
resourcePolicies :: [ResourcePolicy]
$sel:resourcePolicies:GetResourcePoliciesResponse' :: GetResourcePoliciesResponse -> [ResourcePolicy]
resourcePolicies} -> [ResourcePolicy]
resourcePolicies) (\s :: GetResourcePoliciesResponse
s@GetResourcePoliciesResponse' {} [ResourcePolicy]
a -> GetResourcePoliciesResponse
s {$sel:resourcePolicies:GetResourcePoliciesResponse' :: [ResourcePolicy]
resourcePolicies = [ResourcePolicy]
a} :: GetResourcePoliciesResponse) (([ResourcePolicy] -> f [ResourcePolicy])
 -> GetResourcePoliciesResponse -> f GetResourcePoliciesResponse)
-> (([ResourcePolicy] -> f [ResourcePolicy])
    -> [ResourcePolicy] -> f [ResourcePolicy])
-> ([ResourcePolicy] -> f [ResourcePolicy])
-> GetResourcePoliciesResponse
-> f GetResourcePoliciesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ResourcePolicy] -> f [ResourcePolicy])
-> [ResourcePolicy] -> f [ResourcePolicy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData GetResourcePoliciesResponse