{-# 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.WorkMail.ListResourceDelegates
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the delegates associated with a resource. Users and groups can be
-- resource delegates and answer requests on behalf of the resource.
--
-- This operation returns paginated results.
module Amazonka.WorkMail.ListResourceDelegates
  ( -- * Creating a Request
    ListResourceDelegates (..),
    newListResourceDelegates,

    -- * Request Lenses
    listResourceDelegates_nextToken,
    listResourceDelegates_maxResults,
    listResourceDelegates_organizationId,
    listResourceDelegates_resourceId,

    -- * Destructuring the Response
    ListResourceDelegatesResponse (..),
    newListResourceDelegatesResponse,

    -- * Response Lenses
    listResourceDelegatesResponse_delegates,
    listResourceDelegatesResponse_nextToken,
    listResourceDelegatesResponse_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.WorkMail.Types

-- | /See:/ 'newListResourceDelegates' smart constructor.
data ListResourceDelegates = ListResourceDelegates'
  { -- | The token used to paginate through the delegates associated with a
    -- resource.
    ListResourceDelegates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The number of maximum results in a page.
    ListResourceDelegates -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The identifier for the organization that contains the resource for which
    -- delegates are listed.
    ListResourceDelegates -> Text
organizationId :: Prelude.Text,
    -- | The identifier for the resource whose delegates are listed.
    ListResourceDelegates -> Text
resourceId :: Prelude.Text
  }
  deriving (ListResourceDelegates -> ListResourceDelegates -> Bool
(ListResourceDelegates -> ListResourceDelegates -> Bool)
-> (ListResourceDelegates -> ListResourceDelegates -> Bool)
-> Eq ListResourceDelegates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourceDelegates -> ListResourceDelegates -> Bool
$c/= :: ListResourceDelegates -> ListResourceDelegates -> Bool
== :: ListResourceDelegates -> ListResourceDelegates -> Bool
$c== :: ListResourceDelegates -> ListResourceDelegates -> Bool
Prelude.Eq, ReadPrec [ListResourceDelegates]
ReadPrec ListResourceDelegates
Int -> ReadS ListResourceDelegates
ReadS [ListResourceDelegates]
(Int -> ReadS ListResourceDelegates)
-> ReadS [ListResourceDelegates]
-> ReadPrec ListResourceDelegates
-> ReadPrec [ListResourceDelegates]
-> Read ListResourceDelegates
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourceDelegates]
$creadListPrec :: ReadPrec [ListResourceDelegates]
readPrec :: ReadPrec ListResourceDelegates
$creadPrec :: ReadPrec ListResourceDelegates
readList :: ReadS [ListResourceDelegates]
$creadList :: ReadS [ListResourceDelegates]
readsPrec :: Int -> ReadS ListResourceDelegates
$creadsPrec :: Int -> ReadS ListResourceDelegates
Prelude.Read, Int -> ListResourceDelegates -> ShowS
[ListResourceDelegates] -> ShowS
ListResourceDelegates -> String
(Int -> ListResourceDelegates -> ShowS)
-> (ListResourceDelegates -> String)
-> ([ListResourceDelegates] -> ShowS)
-> Show ListResourceDelegates
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourceDelegates] -> ShowS
$cshowList :: [ListResourceDelegates] -> ShowS
show :: ListResourceDelegates -> String
$cshow :: ListResourceDelegates -> String
showsPrec :: Int -> ListResourceDelegates -> ShowS
$cshowsPrec :: Int -> ListResourceDelegates -> ShowS
Prelude.Show, (forall x. ListResourceDelegates -> Rep ListResourceDelegates x)
-> (forall x. Rep ListResourceDelegates x -> ListResourceDelegates)
-> Generic ListResourceDelegates
forall x. Rep ListResourceDelegates x -> ListResourceDelegates
forall x. ListResourceDelegates -> Rep ListResourceDelegates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListResourceDelegates x -> ListResourceDelegates
$cfrom :: forall x. ListResourceDelegates -> Rep ListResourceDelegates x
Prelude.Generic)

-- |
-- Create a value of 'ListResourceDelegates' 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', 'listResourceDelegates_nextToken' - The token used to paginate through the delegates associated with a
-- resource.
--
-- 'maxResults', 'listResourceDelegates_maxResults' - The number of maximum results in a page.
--
-- 'organizationId', 'listResourceDelegates_organizationId' - The identifier for the organization that contains the resource for which
-- delegates are listed.
--
-- 'resourceId', 'listResourceDelegates_resourceId' - The identifier for the resource whose delegates are listed.
newListResourceDelegates ::
  -- | 'organizationId'
  Prelude.Text ->
  -- | 'resourceId'
  Prelude.Text ->
  ListResourceDelegates
newListResourceDelegates :: Text -> Text -> ListResourceDelegates
newListResourceDelegates
  Text
pOrganizationId_
  Text
pResourceId_ =
    ListResourceDelegates' :: Maybe Text
-> Maybe Natural -> Text -> Text -> ListResourceDelegates
ListResourceDelegates'
      { $sel:nextToken:ListResourceDelegates' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListResourceDelegates' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:organizationId:ListResourceDelegates' :: Text
organizationId = Text
pOrganizationId_,
        $sel:resourceId:ListResourceDelegates' :: Text
resourceId = Text
pResourceId_
      }

-- | The token used to paginate through the delegates associated with a
-- resource.
listResourceDelegates_nextToken :: Lens.Lens' ListResourceDelegates (Prelude.Maybe Prelude.Text)
listResourceDelegates_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResourceDelegates -> f ListResourceDelegates
listResourceDelegates_nextToken = (ListResourceDelegates -> Maybe Text)
-> (ListResourceDelegates -> Maybe Text -> ListResourceDelegates)
-> Lens
     ListResourceDelegates
     ListResourceDelegates
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceDelegates' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourceDelegates' :: ListResourceDelegates -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourceDelegates
s@ListResourceDelegates' {} Maybe Text
a -> ListResourceDelegates
s {$sel:nextToken:ListResourceDelegates' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourceDelegates)

-- | The number of maximum results in a page.
listResourceDelegates_maxResults :: Lens.Lens' ListResourceDelegates (Prelude.Maybe Prelude.Natural)
listResourceDelegates_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListResourceDelegates -> f ListResourceDelegates
listResourceDelegates_maxResults = (ListResourceDelegates -> Maybe Natural)
-> (ListResourceDelegates
    -> Maybe Natural -> ListResourceDelegates)
-> Lens
     ListResourceDelegates
     ListResourceDelegates
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceDelegates' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListResourceDelegates' :: ListResourceDelegates -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListResourceDelegates
s@ListResourceDelegates' {} Maybe Natural
a -> ListResourceDelegates
s {$sel:maxResults:ListResourceDelegates' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListResourceDelegates)

-- | The identifier for the organization that contains the resource for which
-- delegates are listed.
listResourceDelegates_organizationId :: Lens.Lens' ListResourceDelegates Prelude.Text
listResourceDelegates_organizationId :: (Text -> f Text)
-> ListResourceDelegates -> f ListResourceDelegates
listResourceDelegates_organizationId = (ListResourceDelegates -> Text)
-> (ListResourceDelegates -> Text -> ListResourceDelegates)
-> Lens ListResourceDelegates ListResourceDelegates Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceDelegates' {Text
organizationId :: Text
$sel:organizationId:ListResourceDelegates' :: ListResourceDelegates -> Text
organizationId} -> Text
organizationId) (\s :: ListResourceDelegates
s@ListResourceDelegates' {} Text
a -> ListResourceDelegates
s {$sel:organizationId:ListResourceDelegates' :: Text
organizationId = Text
a} :: ListResourceDelegates)

-- | The identifier for the resource whose delegates are listed.
listResourceDelegates_resourceId :: Lens.Lens' ListResourceDelegates Prelude.Text
listResourceDelegates_resourceId :: (Text -> f Text)
-> ListResourceDelegates -> f ListResourceDelegates
listResourceDelegates_resourceId = (ListResourceDelegates -> Text)
-> (ListResourceDelegates -> Text -> ListResourceDelegates)
-> Lens ListResourceDelegates ListResourceDelegates Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceDelegates' {Text
resourceId :: Text
$sel:resourceId:ListResourceDelegates' :: ListResourceDelegates -> Text
resourceId} -> Text
resourceId) (\s :: ListResourceDelegates
s@ListResourceDelegates' {} Text
a -> ListResourceDelegates
s {$sel:resourceId:ListResourceDelegates' :: Text
resourceId = Text
a} :: ListResourceDelegates)

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

instance Prelude.NFData ListResourceDelegates

instance Core.ToHeaders ListResourceDelegates where
  toHeaders :: ListResourceDelegates -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListResourceDelegates -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"WorkMailService.ListResourceDelegates" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListResourceDelegates where
  toJSON :: ListResourceDelegates -> Value
toJSON ListResourceDelegates' {Maybe Natural
Maybe Text
Text
resourceId :: Text
organizationId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:resourceId:ListResourceDelegates' :: ListResourceDelegates -> Text
$sel:organizationId:ListResourceDelegates' :: ListResourceDelegates -> Text
$sel:maxResults:ListResourceDelegates' :: ListResourceDelegates -> Maybe Natural
$sel:nextToken:ListResourceDelegates' :: ListResourceDelegates -> 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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"OrganizationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId)
          ]
      )

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

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

-- | /See:/ 'newListResourceDelegatesResponse' smart constructor.
data ListResourceDelegatesResponse = ListResourceDelegatesResponse'
  { -- | One page of the resource\'s delegates.
    ListResourceDelegatesResponse -> Maybe [Delegate]
delegates :: Prelude.Maybe [Delegate],
    -- | The token used to paginate through the delegates associated with a
    -- resource. While results are still available, it has an associated value.
    -- When the last page is reached, the token is empty.
    ListResourceDelegatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListResourceDelegatesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListResourceDelegatesResponse
-> ListResourceDelegatesResponse -> Bool
(ListResourceDelegatesResponse
 -> ListResourceDelegatesResponse -> Bool)
-> (ListResourceDelegatesResponse
    -> ListResourceDelegatesResponse -> Bool)
-> Eq ListResourceDelegatesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourceDelegatesResponse
-> ListResourceDelegatesResponse -> Bool
$c/= :: ListResourceDelegatesResponse
-> ListResourceDelegatesResponse -> Bool
== :: ListResourceDelegatesResponse
-> ListResourceDelegatesResponse -> Bool
$c== :: ListResourceDelegatesResponse
-> ListResourceDelegatesResponse -> Bool
Prelude.Eq, ReadPrec [ListResourceDelegatesResponse]
ReadPrec ListResourceDelegatesResponse
Int -> ReadS ListResourceDelegatesResponse
ReadS [ListResourceDelegatesResponse]
(Int -> ReadS ListResourceDelegatesResponse)
-> ReadS [ListResourceDelegatesResponse]
-> ReadPrec ListResourceDelegatesResponse
-> ReadPrec [ListResourceDelegatesResponse]
-> Read ListResourceDelegatesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourceDelegatesResponse]
$creadListPrec :: ReadPrec [ListResourceDelegatesResponse]
readPrec :: ReadPrec ListResourceDelegatesResponse
$creadPrec :: ReadPrec ListResourceDelegatesResponse
readList :: ReadS [ListResourceDelegatesResponse]
$creadList :: ReadS [ListResourceDelegatesResponse]
readsPrec :: Int -> ReadS ListResourceDelegatesResponse
$creadsPrec :: Int -> ReadS ListResourceDelegatesResponse
Prelude.Read, Int -> ListResourceDelegatesResponse -> ShowS
[ListResourceDelegatesResponse] -> ShowS
ListResourceDelegatesResponse -> String
(Int -> ListResourceDelegatesResponse -> ShowS)
-> (ListResourceDelegatesResponse -> String)
-> ([ListResourceDelegatesResponse] -> ShowS)
-> Show ListResourceDelegatesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourceDelegatesResponse] -> ShowS
$cshowList :: [ListResourceDelegatesResponse] -> ShowS
show :: ListResourceDelegatesResponse -> String
$cshow :: ListResourceDelegatesResponse -> String
showsPrec :: Int -> ListResourceDelegatesResponse -> ShowS
$cshowsPrec :: Int -> ListResourceDelegatesResponse -> ShowS
Prelude.Show, (forall x.
 ListResourceDelegatesResponse
 -> Rep ListResourceDelegatesResponse x)
-> (forall x.
    Rep ListResourceDelegatesResponse x
    -> ListResourceDelegatesResponse)
-> Generic ListResourceDelegatesResponse
forall x.
Rep ListResourceDelegatesResponse x
-> ListResourceDelegatesResponse
forall x.
ListResourceDelegatesResponse
-> Rep ListResourceDelegatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourceDelegatesResponse x
-> ListResourceDelegatesResponse
$cfrom :: forall x.
ListResourceDelegatesResponse
-> Rep ListResourceDelegatesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListResourceDelegatesResponse' 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:
--
-- 'delegates', 'listResourceDelegatesResponse_delegates' - One page of the resource\'s delegates.
--
-- 'nextToken', 'listResourceDelegatesResponse_nextToken' - The token used to paginate through the delegates associated with a
-- resource. While results are still available, it has an associated value.
-- When the last page is reached, the token is empty.
--
-- 'httpStatus', 'listResourceDelegatesResponse_httpStatus' - The response's http status code.
newListResourceDelegatesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListResourceDelegatesResponse
newListResourceDelegatesResponse :: Int -> ListResourceDelegatesResponse
newListResourceDelegatesResponse Int
pHttpStatus_ =
  ListResourceDelegatesResponse' :: Maybe [Delegate]
-> Maybe Text -> Int -> ListResourceDelegatesResponse
ListResourceDelegatesResponse'
    { $sel:delegates:ListResourceDelegatesResponse' :: Maybe [Delegate]
delegates =
        Maybe [Delegate]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListResourceDelegatesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListResourceDelegatesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | One page of the resource\'s delegates.
listResourceDelegatesResponse_delegates :: Lens.Lens' ListResourceDelegatesResponse (Prelude.Maybe [Delegate])
listResourceDelegatesResponse_delegates :: (Maybe [Delegate] -> f (Maybe [Delegate]))
-> ListResourceDelegatesResponse -> f ListResourceDelegatesResponse
listResourceDelegatesResponse_delegates = (ListResourceDelegatesResponse -> Maybe [Delegate])
-> (ListResourceDelegatesResponse
    -> Maybe [Delegate] -> ListResourceDelegatesResponse)
-> Lens' ListResourceDelegatesResponse (Maybe [Delegate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceDelegatesResponse' {Maybe [Delegate]
delegates :: Maybe [Delegate]
$sel:delegates:ListResourceDelegatesResponse' :: ListResourceDelegatesResponse -> Maybe [Delegate]
delegates} -> Maybe [Delegate]
delegates) (\s :: ListResourceDelegatesResponse
s@ListResourceDelegatesResponse' {} Maybe [Delegate]
a -> ListResourceDelegatesResponse
s {$sel:delegates:ListResourceDelegatesResponse' :: Maybe [Delegate]
delegates = Maybe [Delegate]
a} :: ListResourceDelegatesResponse) ((Maybe [Delegate] -> f (Maybe [Delegate]))
 -> ListResourceDelegatesResponse
 -> f ListResourceDelegatesResponse)
-> ((Maybe [Delegate] -> f (Maybe [Delegate]))
    -> Maybe [Delegate] -> f (Maybe [Delegate]))
-> (Maybe [Delegate] -> f (Maybe [Delegate]))
-> ListResourceDelegatesResponse
-> f ListResourceDelegatesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Delegate] [Delegate] [Delegate] [Delegate]
-> Iso
     (Maybe [Delegate])
     (Maybe [Delegate])
     (Maybe [Delegate])
     (Maybe [Delegate])
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 [Delegate] [Delegate] [Delegate] [Delegate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token used to paginate through the delegates associated with a
-- resource. While results are still available, it has an associated value.
-- When the last page is reached, the token is empty.
listResourceDelegatesResponse_nextToken :: Lens.Lens' ListResourceDelegatesResponse (Prelude.Maybe Prelude.Text)
listResourceDelegatesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResourceDelegatesResponse -> f ListResourceDelegatesResponse
listResourceDelegatesResponse_nextToken = (ListResourceDelegatesResponse -> Maybe Text)
-> (ListResourceDelegatesResponse
    -> Maybe Text -> ListResourceDelegatesResponse)
-> Lens' ListResourceDelegatesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceDelegatesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourceDelegatesResponse' :: ListResourceDelegatesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourceDelegatesResponse
s@ListResourceDelegatesResponse' {} Maybe Text
a -> ListResourceDelegatesResponse
s {$sel:nextToken:ListResourceDelegatesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourceDelegatesResponse)

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

instance Prelude.NFData ListResourceDelegatesResponse