{-# 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.ListMailboxPermissions
-- 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 mailbox permissions associated with a user, group, or resource
-- mailbox.
--
-- This operation returns paginated results.
module Amazonka.WorkMail.ListMailboxPermissions
  ( -- * Creating a Request
    ListMailboxPermissions (..),
    newListMailboxPermissions,

    -- * Request Lenses
    listMailboxPermissions_nextToken,
    listMailboxPermissions_maxResults,
    listMailboxPermissions_organizationId,
    listMailboxPermissions_entityId,

    -- * Destructuring the Response
    ListMailboxPermissionsResponse (..),
    newListMailboxPermissionsResponse,

    -- * Response Lenses
    listMailboxPermissionsResponse_nextToken,
    listMailboxPermissionsResponse_permissions,
    listMailboxPermissionsResponse_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:/ 'newListMailboxPermissions' smart constructor.
data ListMailboxPermissions = ListMailboxPermissions'
  { -- | The token to use to retrieve the next page of results. The first call
    -- does not contain any tokens.
    ListMailboxPermissions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return in a single call.
    ListMailboxPermissions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The identifier of the organization under which the user, group, or
    -- resource exists.
    ListMailboxPermissions -> Text
organizationId :: Prelude.Text,
    -- | The identifier of the user, group, or resource for which to list mailbox
    -- permissions.
    ListMailboxPermissions -> Text
entityId :: Prelude.Text
  }
  deriving (ListMailboxPermissions -> ListMailboxPermissions -> Bool
(ListMailboxPermissions -> ListMailboxPermissions -> Bool)
-> (ListMailboxPermissions -> ListMailboxPermissions -> Bool)
-> Eq ListMailboxPermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMailboxPermissions -> ListMailboxPermissions -> Bool
$c/= :: ListMailboxPermissions -> ListMailboxPermissions -> Bool
== :: ListMailboxPermissions -> ListMailboxPermissions -> Bool
$c== :: ListMailboxPermissions -> ListMailboxPermissions -> Bool
Prelude.Eq, ReadPrec [ListMailboxPermissions]
ReadPrec ListMailboxPermissions
Int -> ReadS ListMailboxPermissions
ReadS [ListMailboxPermissions]
(Int -> ReadS ListMailboxPermissions)
-> ReadS [ListMailboxPermissions]
-> ReadPrec ListMailboxPermissions
-> ReadPrec [ListMailboxPermissions]
-> Read ListMailboxPermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMailboxPermissions]
$creadListPrec :: ReadPrec [ListMailboxPermissions]
readPrec :: ReadPrec ListMailboxPermissions
$creadPrec :: ReadPrec ListMailboxPermissions
readList :: ReadS [ListMailboxPermissions]
$creadList :: ReadS [ListMailboxPermissions]
readsPrec :: Int -> ReadS ListMailboxPermissions
$creadsPrec :: Int -> ReadS ListMailboxPermissions
Prelude.Read, Int -> ListMailboxPermissions -> ShowS
[ListMailboxPermissions] -> ShowS
ListMailboxPermissions -> String
(Int -> ListMailboxPermissions -> ShowS)
-> (ListMailboxPermissions -> String)
-> ([ListMailboxPermissions] -> ShowS)
-> Show ListMailboxPermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMailboxPermissions] -> ShowS
$cshowList :: [ListMailboxPermissions] -> ShowS
show :: ListMailboxPermissions -> String
$cshow :: ListMailboxPermissions -> String
showsPrec :: Int -> ListMailboxPermissions -> ShowS
$cshowsPrec :: Int -> ListMailboxPermissions -> ShowS
Prelude.Show, (forall x. ListMailboxPermissions -> Rep ListMailboxPermissions x)
-> (forall x.
    Rep ListMailboxPermissions x -> ListMailboxPermissions)
-> Generic ListMailboxPermissions
forall x. Rep ListMailboxPermissions x -> ListMailboxPermissions
forall x. ListMailboxPermissions -> Rep ListMailboxPermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMailboxPermissions x -> ListMailboxPermissions
$cfrom :: forall x. ListMailboxPermissions -> Rep ListMailboxPermissions x
Prelude.Generic)

-- |
-- Create a value of 'ListMailboxPermissions' 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', 'listMailboxPermissions_nextToken' - The token to use to retrieve the next page of results. The first call
-- does not contain any tokens.
--
-- 'maxResults', 'listMailboxPermissions_maxResults' - The maximum number of results to return in a single call.
--
-- 'organizationId', 'listMailboxPermissions_organizationId' - The identifier of the organization under which the user, group, or
-- resource exists.
--
-- 'entityId', 'listMailboxPermissions_entityId' - The identifier of the user, group, or resource for which to list mailbox
-- permissions.
newListMailboxPermissions ::
  -- | 'organizationId'
  Prelude.Text ->
  -- | 'entityId'
  Prelude.Text ->
  ListMailboxPermissions
newListMailboxPermissions :: Text -> Text -> ListMailboxPermissions
newListMailboxPermissions Text
pOrganizationId_ Text
pEntityId_ =
  ListMailboxPermissions' :: Maybe Text
-> Maybe Natural -> Text -> Text -> ListMailboxPermissions
ListMailboxPermissions'
    { $sel:nextToken:ListMailboxPermissions' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListMailboxPermissions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:organizationId:ListMailboxPermissions' :: Text
organizationId = Text
pOrganizationId_,
      $sel:entityId:ListMailboxPermissions' :: Text
entityId = Text
pEntityId_
    }

-- | The token to use to retrieve the next page of results. The first call
-- does not contain any tokens.
listMailboxPermissions_nextToken :: Lens.Lens' ListMailboxPermissions (Prelude.Maybe Prelude.Text)
listMailboxPermissions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListMailboxPermissions -> f ListMailboxPermissions
listMailboxPermissions_nextToken = (ListMailboxPermissions -> Maybe Text)
-> (ListMailboxPermissions -> Maybe Text -> ListMailboxPermissions)
-> Lens
     ListMailboxPermissions
     ListMailboxPermissions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailboxPermissions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMailboxPermissions' :: ListMailboxPermissions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMailboxPermissions
s@ListMailboxPermissions' {} Maybe Text
a -> ListMailboxPermissions
s {$sel:nextToken:ListMailboxPermissions' :: Maybe Text
nextToken = Maybe Text
a} :: ListMailboxPermissions)

-- | The maximum number of results to return in a single call.
listMailboxPermissions_maxResults :: Lens.Lens' ListMailboxPermissions (Prelude.Maybe Prelude.Natural)
listMailboxPermissions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListMailboxPermissions -> f ListMailboxPermissions
listMailboxPermissions_maxResults = (ListMailboxPermissions -> Maybe Natural)
-> (ListMailboxPermissions
    -> Maybe Natural -> ListMailboxPermissions)
-> Lens
     ListMailboxPermissions
     ListMailboxPermissions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailboxPermissions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListMailboxPermissions' :: ListMailboxPermissions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListMailboxPermissions
s@ListMailboxPermissions' {} Maybe Natural
a -> ListMailboxPermissions
s {$sel:maxResults:ListMailboxPermissions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListMailboxPermissions)

-- | The identifier of the organization under which the user, group, or
-- resource exists.
listMailboxPermissions_organizationId :: Lens.Lens' ListMailboxPermissions Prelude.Text
listMailboxPermissions_organizationId :: (Text -> f Text)
-> ListMailboxPermissions -> f ListMailboxPermissions
listMailboxPermissions_organizationId = (ListMailboxPermissions -> Text)
-> (ListMailboxPermissions -> Text -> ListMailboxPermissions)
-> Lens ListMailboxPermissions ListMailboxPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailboxPermissions' {Text
organizationId :: Text
$sel:organizationId:ListMailboxPermissions' :: ListMailboxPermissions -> Text
organizationId} -> Text
organizationId) (\s :: ListMailboxPermissions
s@ListMailboxPermissions' {} Text
a -> ListMailboxPermissions
s {$sel:organizationId:ListMailboxPermissions' :: Text
organizationId = Text
a} :: ListMailboxPermissions)

-- | The identifier of the user, group, or resource for which to list mailbox
-- permissions.
listMailboxPermissions_entityId :: Lens.Lens' ListMailboxPermissions Prelude.Text
listMailboxPermissions_entityId :: (Text -> f Text)
-> ListMailboxPermissions -> f ListMailboxPermissions
listMailboxPermissions_entityId = (ListMailboxPermissions -> Text)
-> (ListMailboxPermissions -> Text -> ListMailboxPermissions)
-> Lens ListMailboxPermissions ListMailboxPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailboxPermissions' {Text
entityId :: Text
$sel:entityId:ListMailboxPermissions' :: ListMailboxPermissions -> Text
entityId} -> Text
entityId) (\s :: ListMailboxPermissions
s@ListMailboxPermissions' {} Text
a -> ListMailboxPermissions
s {$sel:entityId:ListMailboxPermissions' :: Text
entityId = Text
a} :: ListMailboxPermissions)

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

instance Prelude.NFData ListMailboxPermissions

instance Core.ToHeaders ListMailboxPermissions where
  toHeaders :: ListMailboxPermissions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListMailboxPermissions -> 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.ListMailboxPermissions" ::
                          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 ListMailboxPermissions where
  toJSON :: ListMailboxPermissions -> Value
toJSON ListMailboxPermissions' {Maybe Natural
Maybe Text
Text
entityId :: Text
organizationId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:entityId:ListMailboxPermissions' :: ListMailboxPermissions -> Text
$sel:organizationId:ListMailboxPermissions' :: ListMailboxPermissions -> Text
$sel:maxResults:ListMailboxPermissions' :: ListMailboxPermissions -> Maybe Natural
$sel:nextToken:ListMailboxPermissions' :: ListMailboxPermissions -> 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
"EntityId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
entityId)
          ]
      )

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

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

-- | /See:/ 'newListMailboxPermissionsResponse' smart constructor.
data ListMailboxPermissionsResponse = ListMailboxPermissionsResponse'
  { -- | The token to use to retrieve the next page of results. The value is
    -- \"null\" when there are no more results to return.
    ListMailboxPermissionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | One page of the user, group, or resource mailbox permissions.
    ListMailboxPermissionsResponse -> Maybe [Permission]
permissions :: Prelude.Maybe [Permission],
    -- | The response's http status code.
    ListMailboxPermissionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListMailboxPermissionsResponse
-> ListMailboxPermissionsResponse -> Bool
(ListMailboxPermissionsResponse
 -> ListMailboxPermissionsResponse -> Bool)
-> (ListMailboxPermissionsResponse
    -> ListMailboxPermissionsResponse -> Bool)
-> Eq ListMailboxPermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMailboxPermissionsResponse
-> ListMailboxPermissionsResponse -> Bool
$c/= :: ListMailboxPermissionsResponse
-> ListMailboxPermissionsResponse -> Bool
== :: ListMailboxPermissionsResponse
-> ListMailboxPermissionsResponse -> Bool
$c== :: ListMailboxPermissionsResponse
-> ListMailboxPermissionsResponse -> Bool
Prelude.Eq, ReadPrec [ListMailboxPermissionsResponse]
ReadPrec ListMailboxPermissionsResponse
Int -> ReadS ListMailboxPermissionsResponse
ReadS [ListMailboxPermissionsResponse]
(Int -> ReadS ListMailboxPermissionsResponse)
-> ReadS [ListMailboxPermissionsResponse]
-> ReadPrec ListMailboxPermissionsResponse
-> ReadPrec [ListMailboxPermissionsResponse]
-> Read ListMailboxPermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMailboxPermissionsResponse]
$creadListPrec :: ReadPrec [ListMailboxPermissionsResponse]
readPrec :: ReadPrec ListMailboxPermissionsResponse
$creadPrec :: ReadPrec ListMailboxPermissionsResponse
readList :: ReadS [ListMailboxPermissionsResponse]
$creadList :: ReadS [ListMailboxPermissionsResponse]
readsPrec :: Int -> ReadS ListMailboxPermissionsResponse
$creadsPrec :: Int -> ReadS ListMailboxPermissionsResponse
Prelude.Read, Int -> ListMailboxPermissionsResponse -> ShowS
[ListMailboxPermissionsResponse] -> ShowS
ListMailboxPermissionsResponse -> String
(Int -> ListMailboxPermissionsResponse -> ShowS)
-> (ListMailboxPermissionsResponse -> String)
-> ([ListMailboxPermissionsResponse] -> ShowS)
-> Show ListMailboxPermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMailboxPermissionsResponse] -> ShowS
$cshowList :: [ListMailboxPermissionsResponse] -> ShowS
show :: ListMailboxPermissionsResponse -> String
$cshow :: ListMailboxPermissionsResponse -> String
showsPrec :: Int -> ListMailboxPermissionsResponse -> ShowS
$cshowsPrec :: Int -> ListMailboxPermissionsResponse -> ShowS
Prelude.Show, (forall x.
 ListMailboxPermissionsResponse
 -> Rep ListMailboxPermissionsResponse x)
-> (forall x.
    Rep ListMailboxPermissionsResponse x
    -> ListMailboxPermissionsResponse)
-> Generic ListMailboxPermissionsResponse
forall x.
Rep ListMailboxPermissionsResponse x
-> ListMailboxPermissionsResponse
forall x.
ListMailboxPermissionsResponse
-> Rep ListMailboxPermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListMailboxPermissionsResponse x
-> ListMailboxPermissionsResponse
$cfrom :: forall x.
ListMailboxPermissionsResponse
-> Rep ListMailboxPermissionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListMailboxPermissionsResponse' 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', 'listMailboxPermissionsResponse_nextToken' - The token to use to retrieve the next page of results. The value is
-- \"null\" when there are no more results to return.
--
-- 'permissions', 'listMailboxPermissionsResponse_permissions' - One page of the user, group, or resource mailbox permissions.
--
-- 'httpStatus', 'listMailboxPermissionsResponse_httpStatus' - The response's http status code.
newListMailboxPermissionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListMailboxPermissionsResponse
newListMailboxPermissionsResponse :: Int -> ListMailboxPermissionsResponse
newListMailboxPermissionsResponse Int
pHttpStatus_ =
  ListMailboxPermissionsResponse' :: Maybe Text
-> Maybe [Permission] -> Int -> ListMailboxPermissionsResponse
ListMailboxPermissionsResponse'
    { $sel:nextToken:ListMailboxPermissionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:permissions:ListMailboxPermissionsResponse' :: Maybe [Permission]
permissions = Maybe [Permission]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListMailboxPermissionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | One page of the user, group, or resource mailbox permissions.
listMailboxPermissionsResponse_permissions :: Lens.Lens' ListMailboxPermissionsResponse (Prelude.Maybe [Permission])
listMailboxPermissionsResponse_permissions :: (Maybe [Permission] -> f (Maybe [Permission]))
-> ListMailboxPermissionsResponse
-> f ListMailboxPermissionsResponse
listMailboxPermissionsResponse_permissions = (ListMailboxPermissionsResponse -> Maybe [Permission])
-> (ListMailboxPermissionsResponse
    -> Maybe [Permission] -> ListMailboxPermissionsResponse)
-> Lens' ListMailboxPermissionsResponse (Maybe [Permission])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailboxPermissionsResponse' {Maybe [Permission]
permissions :: Maybe [Permission]
$sel:permissions:ListMailboxPermissionsResponse' :: ListMailboxPermissionsResponse -> Maybe [Permission]
permissions} -> Maybe [Permission]
permissions) (\s :: ListMailboxPermissionsResponse
s@ListMailboxPermissionsResponse' {} Maybe [Permission]
a -> ListMailboxPermissionsResponse
s {$sel:permissions:ListMailboxPermissionsResponse' :: Maybe [Permission]
permissions = Maybe [Permission]
a} :: ListMailboxPermissionsResponse) ((Maybe [Permission] -> f (Maybe [Permission]))
 -> ListMailboxPermissionsResponse
 -> f ListMailboxPermissionsResponse)
-> ((Maybe [Permission] -> f (Maybe [Permission]))
    -> Maybe [Permission] -> f (Maybe [Permission]))
-> (Maybe [Permission] -> f (Maybe [Permission]))
-> ListMailboxPermissionsResponse
-> f ListMailboxPermissionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Permission] [Permission] [Permission] [Permission]
-> Iso
     (Maybe [Permission])
     (Maybe [Permission])
     (Maybe [Permission])
     (Maybe [Permission])
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 [Permission] [Permission] [Permission] [Permission]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListMailboxPermissionsResponse