{-# 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.IAM.ListPoliciesGrantingServiceAccess
-- 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 a list of policies that the IAM identity (user, group, or
-- role) can use to access each specified service.
--
-- This operation does not use other policy types when determining whether
-- a resource could access a service. These other policy types include
-- resource-based policies, access control lists, Organizations policies,
-- IAM permissions boundaries, and STS assume role policies. It only
-- applies permissions policy logic. For more about the evaluation of
-- policy types, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-basics Evaluating policies>
-- in the /IAM User Guide/.
--
-- The list of policies returned by the operation depends on the ARN of the
-- identity that you provide.
--
-- -   __User__ – The list of policies includes the managed and inline
--     policies that are attached to the user directly. The list also
--     includes any additional managed and inline policies that are
--     attached to the group to which the user belongs.
--
-- -   __Group__ – The list of policies includes only the managed and
--     inline policies that are attached to the group directly. Policies
--     that are attached to the group’s user are not included.
--
-- -   __Role__ – The list of policies includes only the managed and inline
--     policies that are attached to the role.
--
-- For each managed policy, this operation returns the ARN and policy name.
-- For each inline policy, it returns the policy name and the entity to
-- which it is attached. Inline policies do not have an ARN. For more
-- information about these policy types, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html Managed policies and inline policies>
-- in the /IAM User Guide/.
--
-- Policies that are attached to users and roles as permissions boundaries
-- are not returned. To view which managed policy is currently used to set
-- the permissions boundary for a user or role, use the GetUser or GetRole
-- operations.
module Amazonka.IAM.ListPoliciesGrantingServiceAccess
  ( -- * Creating a Request
    ListPoliciesGrantingServiceAccess (..),
    newListPoliciesGrantingServiceAccess,

    -- * Request Lenses
    listPoliciesGrantingServiceAccess_marker,
    listPoliciesGrantingServiceAccess_arn,
    listPoliciesGrantingServiceAccess_serviceNamespaces,

    -- * Destructuring the Response
    ListPoliciesGrantingServiceAccessResponse (..),
    newListPoliciesGrantingServiceAccessResponse,

    -- * Response Lenses
    listPoliciesGrantingServiceAccessResponse_marker,
    listPoliciesGrantingServiceAccessResponse_isTruncated,
    listPoliciesGrantingServiceAccessResponse_httpStatus,
    listPoliciesGrantingServiceAccessResponse_policiesGrantingServiceAccess,
  )
where

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

-- | /See:/ 'newListPoliciesGrantingServiceAccess' smart constructor.
data ListPoliciesGrantingServiceAccess = ListPoliciesGrantingServiceAccess'
  { -- | Use this parameter only when paginating results and only after you
    -- receive a response indicating that the results are truncated. Set it to
    -- the value of the @Marker@ element in the response that you received to
    -- indicate where the next call should start.
    ListPoliciesGrantingServiceAccess -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the IAM identity (user, group, or role) whose policies you
    -- want to list.
    ListPoliciesGrantingServiceAccess -> Text
arn :: Prelude.Text,
    -- | The service namespace for the Amazon Web Services services whose
    -- policies you want to list.
    --
    -- To learn the service namespace for a service, see
    -- <https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html Actions, resources, and condition keys for Amazon Web Services services>
    -- in the /IAM User Guide/. Choose the name of the service to view details
    -- for that service. In the first paragraph, find the service prefix. For
    -- example, @(service prefix: a4b)@. For more information about service
    -- namespaces, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces Amazon Web Services service namespaces>
    -- in the /Amazon Web Services General Reference/.
    ListPoliciesGrantingServiceAccess -> NonEmpty Text
serviceNamespaces :: Prelude.NonEmpty Prelude.Text
  }
  deriving (ListPoliciesGrantingServiceAccess
-> ListPoliciesGrantingServiceAccess -> Bool
(ListPoliciesGrantingServiceAccess
 -> ListPoliciesGrantingServiceAccess -> Bool)
-> (ListPoliciesGrantingServiceAccess
    -> ListPoliciesGrantingServiceAccess -> Bool)
-> Eq ListPoliciesGrantingServiceAccess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPoliciesGrantingServiceAccess
-> ListPoliciesGrantingServiceAccess -> Bool
$c/= :: ListPoliciesGrantingServiceAccess
-> ListPoliciesGrantingServiceAccess -> Bool
== :: ListPoliciesGrantingServiceAccess
-> ListPoliciesGrantingServiceAccess -> Bool
$c== :: ListPoliciesGrantingServiceAccess
-> ListPoliciesGrantingServiceAccess -> Bool
Prelude.Eq, ReadPrec [ListPoliciesGrantingServiceAccess]
ReadPrec ListPoliciesGrantingServiceAccess
Int -> ReadS ListPoliciesGrantingServiceAccess
ReadS [ListPoliciesGrantingServiceAccess]
(Int -> ReadS ListPoliciesGrantingServiceAccess)
-> ReadS [ListPoliciesGrantingServiceAccess]
-> ReadPrec ListPoliciesGrantingServiceAccess
-> ReadPrec [ListPoliciesGrantingServiceAccess]
-> Read ListPoliciesGrantingServiceAccess
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPoliciesGrantingServiceAccess]
$creadListPrec :: ReadPrec [ListPoliciesGrantingServiceAccess]
readPrec :: ReadPrec ListPoliciesGrantingServiceAccess
$creadPrec :: ReadPrec ListPoliciesGrantingServiceAccess
readList :: ReadS [ListPoliciesGrantingServiceAccess]
$creadList :: ReadS [ListPoliciesGrantingServiceAccess]
readsPrec :: Int -> ReadS ListPoliciesGrantingServiceAccess
$creadsPrec :: Int -> ReadS ListPoliciesGrantingServiceAccess
Prelude.Read, Int -> ListPoliciesGrantingServiceAccess -> ShowS
[ListPoliciesGrantingServiceAccess] -> ShowS
ListPoliciesGrantingServiceAccess -> String
(Int -> ListPoliciesGrantingServiceAccess -> ShowS)
-> (ListPoliciesGrantingServiceAccess -> String)
-> ([ListPoliciesGrantingServiceAccess] -> ShowS)
-> Show ListPoliciesGrantingServiceAccess
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPoliciesGrantingServiceAccess] -> ShowS
$cshowList :: [ListPoliciesGrantingServiceAccess] -> ShowS
show :: ListPoliciesGrantingServiceAccess -> String
$cshow :: ListPoliciesGrantingServiceAccess -> String
showsPrec :: Int -> ListPoliciesGrantingServiceAccess -> ShowS
$cshowsPrec :: Int -> ListPoliciesGrantingServiceAccess -> ShowS
Prelude.Show, (forall x.
 ListPoliciesGrantingServiceAccess
 -> Rep ListPoliciesGrantingServiceAccess x)
-> (forall x.
    Rep ListPoliciesGrantingServiceAccess x
    -> ListPoliciesGrantingServiceAccess)
-> Generic ListPoliciesGrantingServiceAccess
forall x.
Rep ListPoliciesGrantingServiceAccess x
-> ListPoliciesGrantingServiceAccess
forall x.
ListPoliciesGrantingServiceAccess
-> Rep ListPoliciesGrantingServiceAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPoliciesGrantingServiceAccess x
-> ListPoliciesGrantingServiceAccess
$cfrom :: forall x.
ListPoliciesGrantingServiceAccess
-> Rep ListPoliciesGrantingServiceAccess x
Prelude.Generic)

-- |
-- Create a value of 'ListPoliciesGrantingServiceAccess' 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:
--
-- 'marker', 'listPoliciesGrantingServiceAccess_marker' - Use this parameter only when paginating results and only after you
-- receive a response indicating that the results are truncated. Set it to
-- the value of the @Marker@ element in the response that you received to
-- indicate where the next call should start.
--
-- 'arn', 'listPoliciesGrantingServiceAccess_arn' - The ARN of the IAM identity (user, group, or role) whose policies you
-- want to list.
--
-- 'serviceNamespaces', 'listPoliciesGrantingServiceAccess_serviceNamespaces' - The service namespace for the Amazon Web Services services whose
-- policies you want to list.
--
-- To learn the service namespace for a service, see
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html Actions, resources, and condition keys for Amazon Web Services services>
-- in the /IAM User Guide/. Choose the name of the service to view details
-- for that service. In the first paragraph, find the service prefix. For
-- example, @(service prefix: a4b)@. For more information about service
-- namespaces, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces Amazon Web Services service namespaces>
-- in the /Amazon Web Services General Reference/.
newListPoliciesGrantingServiceAccess ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'serviceNamespaces'
  Prelude.NonEmpty Prelude.Text ->
  ListPoliciesGrantingServiceAccess
newListPoliciesGrantingServiceAccess :: Text -> NonEmpty Text -> ListPoliciesGrantingServiceAccess
newListPoliciesGrantingServiceAccess
  Text
pArn_
  NonEmpty Text
pServiceNamespaces_ =
    ListPoliciesGrantingServiceAccess' :: Maybe Text
-> Text -> NonEmpty Text -> ListPoliciesGrantingServiceAccess
ListPoliciesGrantingServiceAccess'
      { $sel:marker:ListPoliciesGrantingServiceAccess' :: Maybe Text
marker =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:arn:ListPoliciesGrantingServiceAccess' :: Text
arn = Text
pArn_,
        $sel:serviceNamespaces:ListPoliciesGrantingServiceAccess' :: NonEmpty Text
serviceNamespaces =
          Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
            (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pServiceNamespaces_
      }

-- | Use this parameter only when paginating results and only after you
-- receive a response indicating that the results are truncated. Set it to
-- the value of the @Marker@ element in the response that you received to
-- indicate where the next call should start.
listPoliciesGrantingServiceAccess_marker :: Lens.Lens' ListPoliciesGrantingServiceAccess (Prelude.Maybe Prelude.Text)
listPoliciesGrantingServiceAccess_marker :: (Maybe Text -> f (Maybe Text))
-> ListPoliciesGrantingServiceAccess
-> f ListPoliciesGrantingServiceAccess
listPoliciesGrantingServiceAccess_marker = (ListPoliciesGrantingServiceAccess -> Maybe Text)
-> (ListPoliciesGrantingServiceAccess
    -> Maybe Text -> ListPoliciesGrantingServiceAccess)
-> Lens
     ListPoliciesGrantingServiceAccess
     ListPoliciesGrantingServiceAccess
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesGrantingServiceAccess' {Maybe Text
marker :: Maybe Text
$sel:marker:ListPoliciesGrantingServiceAccess' :: ListPoliciesGrantingServiceAccess -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListPoliciesGrantingServiceAccess
s@ListPoliciesGrantingServiceAccess' {} Maybe Text
a -> ListPoliciesGrantingServiceAccess
s {$sel:marker:ListPoliciesGrantingServiceAccess' :: Maybe Text
marker = Maybe Text
a} :: ListPoliciesGrantingServiceAccess)

-- | The ARN of the IAM identity (user, group, or role) whose policies you
-- want to list.
listPoliciesGrantingServiceAccess_arn :: Lens.Lens' ListPoliciesGrantingServiceAccess Prelude.Text
listPoliciesGrantingServiceAccess_arn :: (Text -> f Text)
-> ListPoliciesGrantingServiceAccess
-> f ListPoliciesGrantingServiceAccess
listPoliciesGrantingServiceAccess_arn = (ListPoliciesGrantingServiceAccess -> Text)
-> (ListPoliciesGrantingServiceAccess
    -> Text -> ListPoliciesGrantingServiceAccess)
-> Lens
     ListPoliciesGrantingServiceAccess
     ListPoliciesGrantingServiceAccess
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesGrantingServiceAccess' {Text
arn :: Text
$sel:arn:ListPoliciesGrantingServiceAccess' :: ListPoliciesGrantingServiceAccess -> Text
arn} -> Text
arn) (\s :: ListPoliciesGrantingServiceAccess
s@ListPoliciesGrantingServiceAccess' {} Text
a -> ListPoliciesGrantingServiceAccess
s {$sel:arn:ListPoliciesGrantingServiceAccess' :: Text
arn = Text
a} :: ListPoliciesGrantingServiceAccess)

-- | The service namespace for the Amazon Web Services services whose
-- policies you want to list.
--
-- To learn the service namespace for a service, see
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html Actions, resources, and condition keys for Amazon Web Services services>
-- in the /IAM User Guide/. Choose the name of the service to view details
-- for that service. In the first paragraph, find the service prefix. For
-- example, @(service prefix: a4b)@. For more information about service
-- namespaces, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces Amazon Web Services service namespaces>
-- in the /Amazon Web Services General Reference/.
listPoliciesGrantingServiceAccess_serviceNamespaces :: Lens.Lens' ListPoliciesGrantingServiceAccess (Prelude.NonEmpty Prelude.Text)
listPoliciesGrantingServiceAccess_serviceNamespaces :: (NonEmpty Text -> f (NonEmpty Text))
-> ListPoliciesGrantingServiceAccess
-> f ListPoliciesGrantingServiceAccess
listPoliciesGrantingServiceAccess_serviceNamespaces = (ListPoliciesGrantingServiceAccess -> NonEmpty Text)
-> (ListPoliciesGrantingServiceAccess
    -> NonEmpty Text -> ListPoliciesGrantingServiceAccess)
-> Lens
     ListPoliciesGrantingServiceAccess
     ListPoliciesGrantingServiceAccess
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesGrantingServiceAccess' {NonEmpty Text
serviceNamespaces :: NonEmpty Text
$sel:serviceNamespaces:ListPoliciesGrantingServiceAccess' :: ListPoliciesGrantingServiceAccess -> NonEmpty Text
serviceNamespaces} -> NonEmpty Text
serviceNamespaces) (\s :: ListPoliciesGrantingServiceAccess
s@ListPoliciesGrantingServiceAccess' {} NonEmpty Text
a -> ListPoliciesGrantingServiceAccess
s {$sel:serviceNamespaces:ListPoliciesGrantingServiceAccess' :: NonEmpty Text
serviceNamespaces = NonEmpty Text
a} :: ListPoliciesGrantingServiceAccess) ((NonEmpty Text -> f (NonEmpty Text))
 -> ListPoliciesGrantingServiceAccess
 -> f ListPoliciesGrantingServiceAccess)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> ListPoliciesGrantingServiceAccess
-> f ListPoliciesGrantingServiceAccess
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.AWSRequest
    ListPoliciesGrantingServiceAccess
  where
  type
    AWSResponse ListPoliciesGrantingServiceAccess =
      ListPoliciesGrantingServiceAccessResponse
  request :: ListPoliciesGrantingServiceAccess
-> Request ListPoliciesGrantingServiceAccess
request = Service
-> ListPoliciesGrantingServiceAccess
-> Request ListPoliciesGrantingServiceAccess
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ListPoliciesGrantingServiceAccess
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListPoliciesGrantingServiceAccess)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListPoliciesGrantingServiceAccess))
-> Logger
-> Service
-> Proxy ListPoliciesGrantingServiceAccess
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListPoliciesGrantingServiceAccess)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ListPoliciesGrantingServiceAccessResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe Bool
-> Int
-> [ListPoliciesGrantingServiceAccessEntry]
-> ListPoliciesGrantingServiceAccessResponse
ListPoliciesGrantingServiceAccessResponse'
            (Maybe Text
 -> Maybe Bool
 -> Int
 -> [ListPoliciesGrantingServiceAccessEntry]
 -> ListPoliciesGrantingServiceAccessResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Int
      -> [ListPoliciesGrantingServiceAccessEntry]
      -> ListPoliciesGrantingServiceAccessResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Marker")
              Either
  String
  (Maybe Bool
   -> Int
   -> [ListPoliciesGrantingServiceAccessEntry]
   -> ListPoliciesGrantingServiceAccessResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Int
      -> [ListPoliciesGrantingServiceAccessEntry]
      -> ListPoliciesGrantingServiceAccessResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsTruncated")
              Either
  String
  (Int
   -> [ListPoliciesGrantingServiceAccessEntry]
   -> ListPoliciesGrantingServiceAccessResponse)
-> Either String Int
-> Either
     String
     ([ListPoliciesGrantingServiceAccessEntry]
      -> ListPoliciesGrantingServiceAccessResponse)
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
  ([ListPoliciesGrantingServiceAccessEntry]
   -> ListPoliciesGrantingServiceAccessResponse)
-> Either String [ListPoliciesGrantingServiceAccessEntry]
-> Either String ListPoliciesGrantingServiceAccessResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PoliciesGrantingServiceAccess"
                              Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                              Either String [Node]
-> ([Node]
    -> Either String [ListPoliciesGrantingServiceAccessEntry])
-> Either String [ListPoliciesGrantingServiceAccessEntry]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text
-> [Node] -> Either String [ListPoliciesGrantingServiceAccessEntry]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member"
                          )
      )

instance
  Prelude.Hashable
    ListPoliciesGrantingServiceAccess

instance
  Prelude.NFData
    ListPoliciesGrantingServiceAccess

instance
  Core.ToHeaders
    ListPoliciesGrantingServiceAccess
  where
  toHeaders :: ListPoliciesGrantingServiceAccess -> ResponseHeaders
toHeaders = ResponseHeaders
-> ListPoliciesGrantingServiceAccess -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance
  Core.ToQuery
    ListPoliciesGrantingServiceAccess
  where
  toQuery :: ListPoliciesGrantingServiceAccess -> QueryString
toQuery ListPoliciesGrantingServiceAccess' {Maybe Text
NonEmpty Text
Text
serviceNamespaces :: NonEmpty Text
arn :: Text
marker :: Maybe Text
$sel:serviceNamespaces:ListPoliciesGrantingServiceAccess' :: ListPoliciesGrantingServiceAccess -> NonEmpty Text
$sel:arn:ListPoliciesGrantingServiceAccess' :: ListPoliciesGrantingServiceAccess -> Text
$sel:marker:ListPoliciesGrantingServiceAccess' :: ListPoliciesGrantingServiceAccess -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"ListPoliciesGrantingServiceAccess" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"Arn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
arn,
        ByteString
"ServiceNamespaces"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> NonEmpty Text -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" NonEmpty Text
serviceNamespaces
      ]

-- | /See:/ 'newListPoliciesGrantingServiceAccessResponse' smart constructor.
data ListPoliciesGrantingServiceAccessResponse = ListPoliciesGrantingServiceAccessResponse'
  { -- | When @IsTruncated@ is @true@, this element is present and contains the
    -- value to use for the @Marker@ parameter in a subsequent pagination
    -- request.
    ListPoliciesGrantingServiceAccessResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A flag that indicates whether there are more items to return. If your
    -- results were truncated, you can make a subsequent pagination request
    -- using the @Marker@ request parameter to retrieve more items. We
    -- recommend that you check @IsTruncated@ after every call to ensure that
    -- you receive all your results.
    ListPoliciesGrantingServiceAccessResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    ListPoliciesGrantingServiceAccessResponse -> Int
httpStatus :: Prelude.Int,
    -- | A @ListPoliciesGrantingServiceAccess@ object that contains details about
    -- the permissions policies attached to the specified identity (user,
    -- group, or role).
    ListPoliciesGrantingServiceAccessResponse
-> [ListPoliciesGrantingServiceAccessEntry]
policiesGrantingServiceAccess :: [ListPoliciesGrantingServiceAccessEntry]
  }
  deriving (ListPoliciesGrantingServiceAccessResponse
-> ListPoliciesGrantingServiceAccessResponse -> Bool
(ListPoliciesGrantingServiceAccessResponse
 -> ListPoliciesGrantingServiceAccessResponse -> Bool)
-> (ListPoliciesGrantingServiceAccessResponse
    -> ListPoliciesGrantingServiceAccessResponse -> Bool)
-> Eq ListPoliciesGrantingServiceAccessResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPoliciesGrantingServiceAccessResponse
-> ListPoliciesGrantingServiceAccessResponse -> Bool
$c/= :: ListPoliciesGrantingServiceAccessResponse
-> ListPoliciesGrantingServiceAccessResponse -> Bool
== :: ListPoliciesGrantingServiceAccessResponse
-> ListPoliciesGrantingServiceAccessResponse -> Bool
$c== :: ListPoliciesGrantingServiceAccessResponse
-> ListPoliciesGrantingServiceAccessResponse -> Bool
Prelude.Eq, ReadPrec [ListPoliciesGrantingServiceAccessResponse]
ReadPrec ListPoliciesGrantingServiceAccessResponse
Int -> ReadS ListPoliciesGrantingServiceAccessResponse
ReadS [ListPoliciesGrantingServiceAccessResponse]
(Int -> ReadS ListPoliciesGrantingServiceAccessResponse)
-> ReadS [ListPoliciesGrantingServiceAccessResponse]
-> ReadPrec ListPoliciesGrantingServiceAccessResponse
-> ReadPrec [ListPoliciesGrantingServiceAccessResponse]
-> Read ListPoliciesGrantingServiceAccessResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPoliciesGrantingServiceAccessResponse]
$creadListPrec :: ReadPrec [ListPoliciesGrantingServiceAccessResponse]
readPrec :: ReadPrec ListPoliciesGrantingServiceAccessResponse
$creadPrec :: ReadPrec ListPoliciesGrantingServiceAccessResponse
readList :: ReadS [ListPoliciesGrantingServiceAccessResponse]
$creadList :: ReadS [ListPoliciesGrantingServiceAccessResponse]
readsPrec :: Int -> ReadS ListPoliciesGrantingServiceAccessResponse
$creadsPrec :: Int -> ReadS ListPoliciesGrantingServiceAccessResponse
Prelude.Read, Int -> ListPoliciesGrantingServiceAccessResponse -> ShowS
[ListPoliciesGrantingServiceAccessResponse] -> ShowS
ListPoliciesGrantingServiceAccessResponse -> String
(Int -> ListPoliciesGrantingServiceAccessResponse -> ShowS)
-> (ListPoliciesGrantingServiceAccessResponse -> String)
-> ([ListPoliciesGrantingServiceAccessResponse] -> ShowS)
-> Show ListPoliciesGrantingServiceAccessResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPoliciesGrantingServiceAccessResponse] -> ShowS
$cshowList :: [ListPoliciesGrantingServiceAccessResponse] -> ShowS
show :: ListPoliciesGrantingServiceAccessResponse -> String
$cshow :: ListPoliciesGrantingServiceAccessResponse -> String
showsPrec :: Int -> ListPoliciesGrantingServiceAccessResponse -> ShowS
$cshowsPrec :: Int -> ListPoliciesGrantingServiceAccessResponse -> ShowS
Prelude.Show, (forall x.
 ListPoliciesGrantingServiceAccessResponse
 -> Rep ListPoliciesGrantingServiceAccessResponse x)
-> (forall x.
    Rep ListPoliciesGrantingServiceAccessResponse x
    -> ListPoliciesGrantingServiceAccessResponse)
-> Generic ListPoliciesGrantingServiceAccessResponse
forall x.
Rep ListPoliciesGrantingServiceAccessResponse x
-> ListPoliciesGrantingServiceAccessResponse
forall x.
ListPoliciesGrantingServiceAccessResponse
-> Rep ListPoliciesGrantingServiceAccessResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPoliciesGrantingServiceAccessResponse x
-> ListPoliciesGrantingServiceAccessResponse
$cfrom :: forall x.
ListPoliciesGrantingServiceAccessResponse
-> Rep ListPoliciesGrantingServiceAccessResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPoliciesGrantingServiceAccessResponse' 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:
--
-- 'marker', 'listPoliciesGrantingServiceAccessResponse_marker' - When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
--
-- 'isTruncated', 'listPoliciesGrantingServiceAccessResponse_isTruncated' - A flag that indicates whether there are more items to return. If your
-- results were truncated, you can make a subsequent pagination request
-- using the @Marker@ request parameter to retrieve more items. We
-- recommend that you check @IsTruncated@ after every call to ensure that
-- you receive all your results.
--
-- 'httpStatus', 'listPoliciesGrantingServiceAccessResponse_httpStatus' - The response's http status code.
--
-- 'policiesGrantingServiceAccess', 'listPoliciesGrantingServiceAccessResponse_policiesGrantingServiceAccess' - A @ListPoliciesGrantingServiceAccess@ object that contains details about
-- the permissions policies attached to the specified identity (user,
-- group, or role).
newListPoliciesGrantingServiceAccessResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPoliciesGrantingServiceAccessResponse
newListPoliciesGrantingServiceAccessResponse :: Int -> ListPoliciesGrantingServiceAccessResponse
newListPoliciesGrantingServiceAccessResponse
  Int
pHttpStatus_ =
    ListPoliciesGrantingServiceAccessResponse' :: Maybe Text
-> Maybe Bool
-> Int
-> [ListPoliciesGrantingServiceAccessEntry]
-> ListPoliciesGrantingServiceAccessResponse
ListPoliciesGrantingServiceAccessResponse'
      { $sel:marker:ListPoliciesGrantingServiceAccessResponse' :: Maybe Text
marker =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:isTruncated:ListPoliciesGrantingServiceAccessResponse' :: Maybe Bool
isTruncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListPoliciesGrantingServiceAccessResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:policiesGrantingServiceAccess:ListPoliciesGrantingServiceAccessResponse' :: [ListPoliciesGrantingServiceAccessEntry]
policiesGrantingServiceAccess =
          [ListPoliciesGrantingServiceAccessEntry]
forall a. Monoid a => a
Prelude.mempty
      }

-- | When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
listPoliciesGrantingServiceAccessResponse_marker :: Lens.Lens' ListPoliciesGrantingServiceAccessResponse (Prelude.Maybe Prelude.Text)
listPoliciesGrantingServiceAccessResponse_marker :: (Maybe Text -> f (Maybe Text))
-> ListPoliciesGrantingServiceAccessResponse
-> f ListPoliciesGrantingServiceAccessResponse
listPoliciesGrantingServiceAccessResponse_marker = (ListPoliciesGrantingServiceAccessResponse -> Maybe Text)
-> (ListPoliciesGrantingServiceAccessResponse
    -> Maybe Text -> ListPoliciesGrantingServiceAccessResponse)
-> Lens
     ListPoliciesGrantingServiceAccessResponse
     ListPoliciesGrantingServiceAccessResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesGrantingServiceAccessResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListPoliciesGrantingServiceAccessResponse' :: ListPoliciesGrantingServiceAccessResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListPoliciesGrantingServiceAccessResponse
s@ListPoliciesGrantingServiceAccessResponse' {} Maybe Text
a -> ListPoliciesGrantingServiceAccessResponse
s {$sel:marker:ListPoliciesGrantingServiceAccessResponse' :: Maybe Text
marker = Maybe Text
a} :: ListPoliciesGrantingServiceAccessResponse)

-- | A flag that indicates whether there are more items to return. If your
-- results were truncated, you can make a subsequent pagination request
-- using the @Marker@ request parameter to retrieve more items. We
-- recommend that you check @IsTruncated@ after every call to ensure that
-- you receive all your results.
listPoliciesGrantingServiceAccessResponse_isTruncated :: Lens.Lens' ListPoliciesGrantingServiceAccessResponse (Prelude.Maybe Prelude.Bool)
listPoliciesGrantingServiceAccessResponse_isTruncated :: (Maybe Bool -> f (Maybe Bool))
-> ListPoliciesGrantingServiceAccessResponse
-> f ListPoliciesGrantingServiceAccessResponse
listPoliciesGrantingServiceAccessResponse_isTruncated = (ListPoliciesGrantingServiceAccessResponse -> Maybe Bool)
-> (ListPoliciesGrantingServiceAccessResponse
    -> Maybe Bool -> ListPoliciesGrantingServiceAccessResponse)
-> Lens
     ListPoliciesGrantingServiceAccessResponse
     ListPoliciesGrantingServiceAccessResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesGrantingServiceAccessResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListPoliciesGrantingServiceAccessResponse' :: ListPoliciesGrantingServiceAccessResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListPoliciesGrantingServiceAccessResponse
s@ListPoliciesGrantingServiceAccessResponse' {} Maybe Bool
a -> ListPoliciesGrantingServiceAccessResponse
s {$sel:isTruncated:ListPoliciesGrantingServiceAccessResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListPoliciesGrantingServiceAccessResponse)

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

-- | A @ListPoliciesGrantingServiceAccess@ object that contains details about
-- the permissions policies attached to the specified identity (user,
-- group, or role).
listPoliciesGrantingServiceAccessResponse_policiesGrantingServiceAccess :: Lens.Lens' ListPoliciesGrantingServiceAccessResponse [ListPoliciesGrantingServiceAccessEntry]
listPoliciesGrantingServiceAccessResponse_policiesGrantingServiceAccess :: ([ListPoliciesGrantingServiceAccessEntry]
 -> f [ListPoliciesGrantingServiceAccessEntry])
-> ListPoliciesGrantingServiceAccessResponse
-> f ListPoliciesGrantingServiceAccessResponse
listPoliciesGrantingServiceAccessResponse_policiesGrantingServiceAccess = (ListPoliciesGrantingServiceAccessResponse
 -> [ListPoliciesGrantingServiceAccessEntry])
-> (ListPoliciesGrantingServiceAccessResponse
    -> [ListPoliciesGrantingServiceAccessEntry]
    -> ListPoliciesGrantingServiceAccessResponse)
-> Lens
     ListPoliciesGrantingServiceAccessResponse
     ListPoliciesGrantingServiceAccessResponse
     [ListPoliciesGrantingServiceAccessEntry]
     [ListPoliciesGrantingServiceAccessEntry]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesGrantingServiceAccessResponse' {[ListPoliciesGrantingServiceAccessEntry]
policiesGrantingServiceAccess :: [ListPoliciesGrantingServiceAccessEntry]
$sel:policiesGrantingServiceAccess:ListPoliciesGrantingServiceAccessResponse' :: ListPoliciesGrantingServiceAccessResponse
-> [ListPoliciesGrantingServiceAccessEntry]
policiesGrantingServiceAccess} -> [ListPoliciesGrantingServiceAccessEntry]
policiesGrantingServiceAccess) (\s :: ListPoliciesGrantingServiceAccessResponse
s@ListPoliciesGrantingServiceAccessResponse' {} [ListPoliciesGrantingServiceAccessEntry]
a -> ListPoliciesGrantingServiceAccessResponse
s {$sel:policiesGrantingServiceAccess:ListPoliciesGrantingServiceAccessResponse' :: [ListPoliciesGrantingServiceAccessEntry]
policiesGrantingServiceAccess = [ListPoliciesGrantingServiceAccessEntry]
a} :: ListPoliciesGrantingServiceAccessResponse) (([ListPoliciesGrantingServiceAccessEntry]
  -> f [ListPoliciesGrantingServiceAccessEntry])
 -> ListPoliciesGrantingServiceAccessResponse
 -> f ListPoliciesGrantingServiceAccessResponse)
-> (([ListPoliciesGrantingServiceAccessEntry]
     -> f [ListPoliciesGrantingServiceAccessEntry])
    -> [ListPoliciesGrantingServiceAccessEntry]
    -> f [ListPoliciesGrantingServiceAccessEntry])
-> ([ListPoliciesGrantingServiceAccessEntry]
    -> f [ListPoliciesGrantingServiceAccessEntry])
-> ListPoliciesGrantingServiceAccessResponse
-> f ListPoliciesGrantingServiceAccessResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ListPoliciesGrantingServiceAccessEntry]
 -> f [ListPoliciesGrantingServiceAccessEntry])
-> [ListPoliciesGrantingServiceAccessEntry]
-> f [ListPoliciesGrantingServiceAccessEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    ListPoliciesGrantingServiceAccessResponse