{-# 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.WorkDocs.DescribeResourcePermissions
-- 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)
--
-- Describes the permissions of a specified resource.
--
-- This operation returns paginated results.
module Amazonka.WorkDocs.DescribeResourcePermissions
  ( -- * Creating a Request
    DescribeResourcePermissions (..),
    newDescribeResourcePermissions,

    -- * Request Lenses
    describeResourcePermissions_principalId,
    describeResourcePermissions_authenticationToken,
    describeResourcePermissions_marker,
    describeResourcePermissions_limit,
    describeResourcePermissions_resourceId,

    -- * Destructuring the Response
    DescribeResourcePermissionsResponse (..),
    newDescribeResourcePermissionsResponse,

    -- * Response Lenses
    describeResourcePermissionsResponse_principals,
    describeResourcePermissionsResponse_marker,
    describeResourcePermissionsResponse_httpStatus,
  )
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.WorkDocs.Types

-- | /See:/ 'newDescribeResourcePermissions' smart constructor.
data DescribeResourcePermissions = DescribeResourcePermissions'
  { -- | The ID of the principal to filter permissions by.
    DescribeResourcePermissions -> Maybe Text
principalId :: Prelude.Maybe Prelude.Text,
    -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    DescribeResourcePermissions -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The marker for the next set of results. (You received this marker from a
    -- previous call)
    DescribeResourcePermissions -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return with this call.
    DescribeResourcePermissions -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the resource.
    DescribeResourcePermissions -> Text
resourceId :: Prelude.Text
  }
  deriving (DescribeResourcePermissions -> DescribeResourcePermissions -> Bool
(DescribeResourcePermissions
 -> DescribeResourcePermissions -> Bool)
-> (DescribeResourcePermissions
    -> DescribeResourcePermissions -> Bool)
-> Eq DescribeResourcePermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourcePermissions -> DescribeResourcePermissions -> Bool
$c/= :: DescribeResourcePermissions -> DescribeResourcePermissions -> Bool
== :: DescribeResourcePermissions -> DescribeResourcePermissions -> Bool
$c== :: DescribeResourcePermissions -> DescribeResourcePermissions -> Bool
Prelude.Eq, Int -> DescribeResourcePermissions -> ShowS
[DescribeResourcePermissions] -> ShowS
DescribeResourcePermissions -> String
(Int -> DescribeResourcePermissions -> ShowS)
-> (DescribeResourcePermissions -> String)
-> ([DescribeResourcePermissions] -> ShowS)
-> Show DescribeResourcePermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourcePermissions] -> ShowS
$cshowList :: [DescribeResourcePermissions] -> ShowS
show :: DescribeResourcePermissions -> String
$cshow :: DescribeResourcePermissions -> String
showsPrec :: Int -> DescribeResourcePermissions -> ShowS
$cshowsPrec :: Int -> DescribeResourcePermissions -> ShowS
Prelude.Show, (forall x.
 DescribeResourcePermissions -> Rep DescribeResourcePermissions x)
-> (forall x.
    Rep DescribeResourcePermissions x -> DescribeResourcePermissions)
-> Generic DescribeResourcePermissions
forall x.
Rep DescribeResourcePermissions x -> DescribeResourcePermissions
forall x.
DescribeResourcePermissions -> Rep DescribeResourcePermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeResourcePermissions x -> DescribeResourcePermissions
$cfrom :: forall x.
DescribeResourcePermissions -> Rep DescribeResourcePermissions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeResourcePermissions' 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:
--
-- 'principalId', 'describeResourcePermissions_principalId' - The ID of the principal to filter permissions by.
--
-- 'authenticationToken', 'describeResourcePermissions_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'marker', 'describeResourcePermissions_marker' - The marker for the next set of results. (You received this marker from a
-- previous call)
--
-- 'limit', 'describeResourcePermissions_limit' - The maximum number of items to return with this call.
--
-- 'resourceId', 'describeResourcePermissions_resourceId' - The ID of the resource.
newDescribeResourcePermissions ::
  -- | 'resourceId'
  Prelude.Text ->
  DescribeResourcePermissions
newDescribeResourcePermissions :: Text -> DescribeResourcePermissions
newDescribeResourcePermissions Text
pResourceId_ =
  DescribeResourcePermissions' :: Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe Natural
-> Text
-> DescribeResourcePermissions
DescribeResourcePermissions'
    { $sel:principalId:DescribeResourcePermissions' :: Maybe Text
principalId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:authenticationToken:DescribeResourcePermissions' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeResourcePermissions' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeResourcePermissions' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceId:DescribeResourcePermissions' :: Text
resourceId = Text
pResourceId_
    }

-- | The ID of the principal to filter permissions by.
describeResourcePermissions_principalId :: Lens.Lens' DescribeResourcePermissions (Prelude.Maybe Prelude.Text)
describeResourcePermissions_principalId :: (Maybe Text -> f (Maybe Text))
-> DescribeResourcePermissions -> f DescribeResourcePermissions
describeResourcePermissions_principalId = (DescribeResourcePermissions -> Maybe Text)
-> (DescribeResourcePermissions
    -> Maybe Text -> DescribeResourcePermissions)
-> Lens
     DescribeResourcePermissions
     DescribeResourcePermissions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePermissions' {Maybe Text
principalId :: Maybe Text
$sel:principalId:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Text
principalId} -> Maybe Text
principalId) (\s :: DescribeResourcePermissions
s@DescribeResourcePermissions' {} Maybe Text
a -> DescribeResourcePermissions
s {$sel:principalId:DescribeResourcePermissions' :: Maybe Text
principalId = Maybe Text
a} :: DescribeResourcePermissions)

-- | Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
describeResourcePermissions_authenticationToken :: Lens.Lens' DescribeResourcePermissions (Prelude.Maybe Prelude.Text)
describeResourcePermissions_authenticationToken :: (Maybe Text -> f (Maybe Text))
-> DescribeResourcePermissions -> f DescribeResourcePermissions
describeResourcePermissions_authenticationToken = (DescribeResourcePermissions -> Maybe (Sensitive Text))
-> (DescribeResourcePermissions
    -> Maybe (Sensitive Text) -> DescribeResourcePermissions)
-> Lens
     DescribeResourcePermissions
     DescribeResourcePermissions
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePermissions' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: DescribeResourcePermissions
s@DescribeResourcePermissions' {} Maybe (Sensitive Text)
a -> DescribeResourcePermissions
s {$sel:authenticationToken:DescribeResourcePermissions' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: DescribeResourcePermissions) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> DescribeResourcePermissions -> f DescribeResourcePermissions)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> DescribeResourcePermissions
-> f DescribeResourcePermissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The marker for the next set of results. (You received this marker from a
-- previous call)
describeResourcePermissions_marker :: Lens.Lens' DescribeResourcePermissions (Prelude.Maybe Prelude.Text)
describeResourcePermissions_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeResourcePermissions -> f DescribeResourcePermissions
describeResourcePermissions_marker = (DescribeResourcePermissions -> Maybe Text)
-> (DescribeResourcePermissions
    -> Maybe Text -> DescribeResourcePermissions)
-> Lens
     DescribeResourcePermissions
     DescribeResourcePermissions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePermissions' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeResourcePermissions
s@DescribeResourcePermissions' {} Maybe Text
a -> DescribeResourcePermissions
s {$sel:marker:DescribeResourcePermissions' :: Maybe Text
marker = Maybe Text
a} :: DescribeResourcePermissions)

-- | The maximum number of items to return with this call.
describeResourcePermissions_limit :: Lens.Lens' DescribeResourcePermissions (Prelude.Maybe Prelude.Natural)
describeResourcePermissions_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeResourcePermissions -> f DescribeResourcePermissions
describeResourcePermissions_limit = (DescribeResourcePermissions -> Maybe Natural)
-> (DescribeResourcePermissions
    -> Maybe Natural -> DescribeResourcePermissions)
-> Lens
     DescribeResourcePermissions
     DescribeResourcePermissions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePermissions' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeResourcePermissions
s@DescribeResourcePermissions' {} Maybe Natural
a -> DescribeResourcePermissions
s {$sel:limit:DescribeResourcePermissions' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeResourcePermissions)

-- | The ID of the resource.
describeResourcePermissions_resourceId :: Lens.Lens' DescribeResourcePermissions Prelude.Text
describeResourcePermissions_resourceId :: (Text -> f Text)
-> DescribeResourcePermissions -> f DescribeResourcePermissions
describeResourcePermissions_resourceId = (DescribeResourcePermissions -> Text)
-> (DescribeResourcePermissions
    -> Text -> DescribeResourcePermissions)
-> Lens
     DescribeResourcePermissions DescribeResourcePermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePermissions' {Text
resourceId :: Text
$sel:resourceId:DescribeResourcePermissions' :: DescribeResourcePermissions -> Text
resourceId} -> Text
resourceId) (\s :: DescribeResourcePermissions
s@DescribeResourcePermissions' {} Text
a -> DescribeResourcePermissions
s {$sel:resourceId:DescribeResourcePermissions' :: Text
resourceId = Text
a} :: DescribeResourcePermissions)

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

instance Prelude.NFData DescribeResourcePermissions

instance Core.ToHeaders DescribeResourcePermissions where
  toHeaders :: DescribeResourcePermissions -> ResponseHeaders
toHeaders DescribeResourcePermissions' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
resourceId :: Text
limit :: Maybe Natural
marker :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
principalId :: Maybe Text
$sel:resourceId:DescribeResourcePermissions' :: DescribeResourcePermissions -> Text
$sel:limit:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Natural
$sel:marker:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Text
$sel:authenticationToken:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe (Sensitive Text)
$sel:principalId:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe (Sensitive Text)
authenticationToken,
        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.ToPath DescribeResourcePermissions where
  toPath :: DescribeResourcePermissions -> ByteString
toPath DescribeResourcePermissions' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
resourceId :: Text
limit :: Maybe Natural
marker :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
principalId :: Maybe Text
$sel:resourceId:DescribeResourcePermissions' :: DescribeResourcePermissions -> Text
$sel:limit:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Natural
$sel:marker:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Text
$sel:authenticationToken:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe (Sensitive Text)
$sel:principalId:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/api/v1/resources/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceId,
        ByteString
"/permissions"
      ]

instance Core.ToQuery DescribeResourcePermissions where
  toQuery :: DescribeResourcePermissions -> QueryString
toQuery DescribeResourcePermissions' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
resourceId :: Text
limit :: Maybe Natural
marker :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
principalId :: Maybe Text
$sel:resourceId:DescribeResourcePermissions' :: DescribeResourcePermissions -> Text
$sel:limit:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Natural
$sel:marker:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Text
$sel:authenticationToken:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe (Sensitive Text)
$sel:principalId:DescribeResourcePermissions' :: DescribeResourcePermissions -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"principalId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
principalId,
        ByteString
"marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"limit" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
limit
      ]

-- | /See:/ 'newDescribeResourcePermissionsResponse' smart constructor.
data DescribeResourcePermissionsResponse = DescribeResourcePermissionsResponse'
  { -- | The principals.
    DescribeResourcePermissionsResponse -> Maybe [Principal]
principals :: Prelude.Maybe [Principal],
    -- | The marker to use when requesting the next set of results. If there are
    -- no additional results, the string is empty.
    DescribeResourcePermissionsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeResourcePermissionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeResourcePermissionsResponse
-> DescribeResourcePermissionsResponse -> Bool
(DescribeResourcePermissionsResponse
 -> DescribeResourcePermissionsResponse -> Bool)
-> (DescribeResourcePermissionsResponse
    -> DescribeResourcePermissionsResponse -> Bool)
-> Eq DescribeResourcePermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourcePermissionsResponse
-> DescribeResourcePermissionsResponse -> Bool
$c/= :: DescribeResourcePermissionsResponse
-> DescribeResourcePermissionsResponse -> Bool
== :: DescribeResourcePermissionsResponse
-> DescribeResourcePermissionsResponse -> Bool
$c== :: DescribeResourcePermissionsResponse
-> DescribeResourcePermissionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeResourcePermissionsResponse]
ReadPrec DescribeResourcePermissionsResponse
Int -> ReadS DescribeResourcePermissionsResponse
ReadS [DescribeResourcePermissionsResponse]
(Int -> ReadS DescribeResourcePermissionsResponse)
-> ReadS [DescribeResourcePermissionsResponse]
-> ReadPrec DescribeResourcePermissionsResponse
-> ReadPrec [DescribeResourcePermissionsResponse]
-> Read DescribeResourcePermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourcePermissionsResponse]
$creadListPrec :: ReadPrec [DescribeResourcePermissionsResponse]
readPrec :: ReadPrec DescribeResourcePermissionsResponse
$creadPrec :: ReadPrec DescribeResourcePermissionsResponse
readList :: ReadS [DescribeResourcePermissionsResponse]
$creadList :: ReadS [DescribeResourcePermissionsResponse]
readsPrec :: Int -> ReadS DescribeResourcePermissionsResponse
$creadsPrec :: Int -> ReadS DescribeResourcePermissionsResponse
Prelude.Read, Int -> DescribeResourcePermissionsResponse -> ShowS
[DescribeResourcePermissionsResponse] -> ShowS
DescribeResourcePermissionsResponse -> String
(Int -> DescribeResourcePermissionsResponse -> ShowS)
-> (DescribeResourcePermissionsResponse -> String)
-> ([DescribeResourcePermissionsResponse] -> ShowS)
-> Show DescribeResourcePermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourcePermissionsResponse] -> ShowS
$cshowList :: [DescribeResourcePermissionsResponse] -> ShowS
show :: DescribeResourcePermissionsResponse -> String
$cshow :: DescribeResourcePermissionsResponse -> String
showsPrec :: Int -> DescribeResourcePermissionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeResourcePermissionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeResourcePermissionsResponse
 -> Rep DescribeResourcePermissionsResponse x)
-> (forall x.
    Rep DescribeResourcePermissionsResponse x
    -> DescribeResourcePermissionsResponse)
-> Generic DescribeResourcePermissionsResponse
forall x.
Rep DescribeResourcePermissionsResponse x
-> DescribeResourcePermissionsResponse
forall x.
DescribeResourcePermissionsResponse
-> Rep DescribeResourcePermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeResourcePermissionsResponse x
-> DescribeResourcePermissionsResponse
$cfrom :: forall x.
DescribeResourcePermissionsResponse
-> Rep DescribeResourcePermissionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeResourcePermissionsResponse' 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:
--
-- 'principals', 'describeResourcePermissionsResponse_principals' - The principals.
--
-- 'marker', 'describeResourcePermissionsResponse_marker' - The marker to use when requesting the next set of results. If there are
-- no additional results, the string is empty.
--
-- 'httpStatus', 'describeResourcePermissionsResponse_httpStatus' - The response's http status code.
newDescribeResourcePermissionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeResourcePermissionsResponse
newDescribeResourcePermissionsResponse :: Int -> DescribeResourcePermissionsResponse
newDescribeResourcePermissionsResponse Int
pHttpStatus_ =
  DescribeResourcePermissionsResponse' :: Maybe [Principal]
-> Maybe Text -> Int -> DescribeResourcePermissionsResponse
DescribeResourcePermissionsResponse'
    { $sel:principals:DescribeResourcePermissionsResponse' :: Maybe [Principal]
principals =
        Maybe [Principal]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeResourcePermissionsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeResourcePermissionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The principals.
describeResourcePermissionsResponse_principals :: Lens.Lens' DescribeResourcePermissionsResponse (Prelude.Maybe [Principal])
describeResourcePermissionsResponse_principals :: (Maybe [Principal] -> f (Maybe [Principal]))
-> DescribeResourcePermissionsResponse
-> f DescribeResourcePermissionsResponse
describeResourcePermissionsResponse_principals = (DescribeResourcePermissionsResponse -> Maybe [Principal])
-> (DescribeResourcePermissionsResponse
    -> Maybe [Principal] -> DescribeResourcePermissionsResponse)
-> Lens' DescribeResourcePermissionsResponse (Maybe [Principal])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePermissionsResponse' {Maybe [Principal]
principals :: Maybe [Principal]
$sel:principals:DescribeResourcePermissionsResponse' :: DescribeResourcePermissionsResponse -> Maybe [Principal]
principals} -> Maybe [Principal]
principals) (\s :: DescribeResourcePermissionsResponse
s@DescribeResourcePermissionsResponse' {} Maybe [Principal]
a -> DescribeResourcePermissionsResponse
s {$sel:principals:DescribeResourcePermissionsResponse' :: Maybe [Principal]
principals = Maybe [Principal]
a} :: DescribeResourcePermissionsResponse) ((Maybe [Principal] -> f (Maybe [Principal]))
 -> DescribeResourcePermissionsResponse
 -> f DescribeResourcePermissionsResponse)
-> ((Maybe [Principal] -> f (Maybe [Principal]))
    -> Maybe [Principal] -> f (Maybe [Principal]))
-> (Maybe [Principal] -> f (Maybe [Principal]))
-> DescribeResourcePermissionsResponse
-> f DescribeResourcePermissionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Principal] [Principal] [Principal] [Principal]
-> Iso
     (Maybe [Principal])
     (Maybe [Principal])
     (Maybe [Principal])
     (Maybe [Principal])
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 [Principal] [Principal] [Principal] [Principal]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The marker to use when requesting the next set of results. If there are
-- no additional results, the string is empty.
describeResourcePermissionsResponse_marker :: Lens.Lens' DescribeResourcePermissionsResponse (Prelude.Maybe Prelude.Text)
describeResourcePermissionsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeResourcePermissionsResponse
-> f DescribeResourcePermissionsResponse
describeResourcePermissionsResponse_marker = (DescribeResourcePermissionsResponse -> Maybe Text)
-> (DescribeResourcePermissionsResponse
    -> Maybe Text -> DescribeResourcePermissionsResponse)
-> Lens' DescribeResourcePermissionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePermissionsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeResourcePermissionsResponse' :: DescribeResourcePermissionsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeResourcePermissionsResponse
s@DescribeResourcePermissionsResponse' {} Maybe Text
a -> DescribeResourcePermissionsResponse
s {$sel:marker:DescribeResourcePermissionsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeResourcePermissionsResponse)

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

instance
  Prelude.NFData
    DescribeResourcePermissionsResponse