{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CloudDirectory.Types.BatchListObjectPolicies
-- 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)
module Amazonka.CloudDirectory.Types.BatchListObjectPolicies where

import Amazonka.CloudDirectory.Types.ObjectReference
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns policies attached to an object in pagination fashion inside a
-- BatchRead operation. For more information, see ListObjectPolicies and
-- BatchReadRequest$Operations.
--
-- /See:/ 'newBatchListObjectPolicies' smart constructor.
data BatchListObjectPolicies = BatchListObjectPolicies'
  { -- | The pagination token.
    BatchListObjectPolicies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to retrieve.
    BatchListObjectPolicies -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The reference that identifies the object whose attributes will be
    -- listed.
    BatchListObjectPolicies -> ObjectReference
objectReference :: ObjectReference
  }
  deriving (BatchListObjectPolicies -> BatchListObjectPolicies -> Bool
(BatchListObjectPolicies -> BatchListObjectPolicies -> Bool)
-> (BatchListObjectPolicies -> BatchListObjectPolicies -> Bool)
-> Eq BatchListObjectPolicies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchListObjectPolicies -> BatchListObjectPolicies -> Bool
$c/= :: BatchListObjectPolicies -> BatchListObjectPolicies -> Bool
== :: BatchListObjectPolicies -> BatchListObjectPolicies -> Bool
$c== :: BatchListObjectPolicies -> BatchListObjectPolicies -> Bool
Prelude.Eq, ReadPrec [BatchListObjectPolicies]
ReadPrec BatchListObjectPolicies
Int -> ReadS BatchListObjectPolicies
ReadS [BatchListObjectPolicies]
(Int -> ReadS BatchListObjectPolicies)
-> ReadS [BatchListObjectPolicies]
-> ReadPrec BatchListObjectPolicies
-> ReadPrec [BatchListObjectPolicies]
-> Read BatchListObjectPolicies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchListObjectPolicies]
$creadListPrec :: ReadPrec [BatchListObjectPolicies]
readPrec :: ReadPrec BatchListObjectPolicies
$creadPrec :: ReadPrec BatchListObjectPolicies
readList :: ReadS [BatchListObjectPolicies]
$creadList :: ReadS [BatchListObjectPolicies]
readsPrec :: Int -> ReadS BatchListObjectPolicies
$creadsPrec :: Int -> ReadS BatchListObjectPolicies
Prelude.Read, Int -> BatchListObjectPolicies -> ShowS
[BatchListObjectPolicies] -> ShowS
BatchListObjectPolicies -> String
(Int -> BatchListObjectPolicies -> ShowS)
-> (BatchListObjectPolicies -> String)
-> ([BatchListObjectPolicies] -> ShowS)
-> Show BatchListObjectPolicies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchListObjectPolicies] -> ShowS
$cshowList :: [BatchListObjectPolicies] -> ShowS
show :: BatchListObjectPolicies -> String
$cshow :: BatchListObjectPolicies -> String
showsPrec :: Int -> BatchListObjectPolicies -> ShowS
$cshowsPrec :: Int -> BatchListObjectPolicies -> ShowS
Prelude.Show, (forall x.
 BatchListObjectPolicies -> Rep BatchListObjectPolicies x)
-> (forall x.
    Rep BatchListObjectPolicies x -> BatchListObjectPolicies)
-> Generic BatchListObjectPolicies
forall x. Rep BatchListObjectPolicies x -> BatchListObjectPolicies
forall x. BatchListObjectPolicies -> Rep BatchListObjectPolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchListObjectPolicies x -> BatchListObjectPolicies
$cfrom :: forall x. BatchListObjectPolicies -> Rep BatchListObjectPolicies x
Prelude.Generic)

-- |
-- Create a value of 'BatchListObjectPolicies' 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', 'batchListObjectPolicies_nextToken' - The pagination token.
--
-- 'maxResults', 'batchListObjectPolicies_maxResults' - The maximum number of results to retrieve.
--
-- 'objectReference', 'batchListObjectPolicies_objectReference' - The reference that identifies the object whose attributes will be
-- listed.
newBatchListObjectPolicies ::
  -- | 'objectReference'
  ObjectReference ->
  BatchListObjectPolicies
newBatchListObjectPolicies :: ObjectReference -> BatchListObjectPolicies
newBatchListObjectPolicies ObjectReference
pObjectReference_ =
  BatchListObjectPolicies' :: Maybe Text
-> Maybe Natural -> ObjectReference -> BatchListObjectPolicies
BatchListObjectPolicies'
    { $sel:nextToken:BatchListObjectPolicies' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:BatchListObjectPolicies' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:objectReference:BatchListObjectPolicies' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
    }

-- | The pagination token.
batchListObjectPolicies_nextToken :: Lens.Lens' BatchListObjectPolicies (Prelude.Maybe Prelude.Text)
batchListObjectPolicies_nextToken :: (Maybe Text -> f (Maybe Text))
-> BatchListObjectPolicies -> f BatchListObjectPolicies
batchListObjectPolicies_nextToken = (BatchListObjectPolicies -> Maybe Text)
-> (BatchListObjectPolicies
    -> Maybe Text -> BatchListObjectPolicies)
-> Lens
     BatchListObjectPolicies
     BatchListObjectPolicies
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListObjectPolicies' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:BatchListObjectPolicies' :: BatchListObjectPolicies -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: BatchListObjectPolicies
s@BatchListObjectPolicies' {} Maybe Text
a -> BatchListObjectPolicies
s {$sel:nextToken:BatchListObjectPolicies' :: Maybe Text
nextToken = Maybe Text
a} :: BatchListObjectPolicies)

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

-- | The reference that identifies the object whose attributes will be
-- listed.
batchListObjectPolicies_objectReference :: Lens.Lens' BatchListObjectPolicies ObjectReference
batchListObjectPolicies_objectReference :: (ObjectReference -> f ObjectReference)
-> BatchListObjectPolicies -> f BatchListObjectPolicies
batchListObjectPolicies_objectReference = (BatchListObjectPolicies -> ObjectReference)
-> (BatchListObjectPolicies
    -> ObjectReference -> BatchListObjectPolicies)
-> Lens
     BatchListObjectPolicies
     BatchListObjectPolicies
     ObjectReference
     ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListObjectPolicies' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:BatchListObjectPolicies' :: BatchListObjectPolicies -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: BatchListObjectPolicies
s@BatchListObjectPolicies' {} ObjectReference
a -> BatchListObjectPolicies
s {$sel:objectReference:BatchListObjectPolicies' :: ObjectReference
objectReference = ObjectReference
a} :: BatchListObjectPolicies)

instance Prelude.Hashable BatchListObjectPolicies

instance Prelude.NFData BatchListObjectPolicies

instance Core.ToJSON BatchListObjectPolicies where
  toJSON :: BatchListObjectPolicies -> Value
toJSON BatchListObjectPolicies' {Maybe Natural
Maybe Text
ObjectReference
objectReference :: ObjectReference
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:objectReference:BatchListObjectPolicies' :: BatchListObjectPolicies -> ObjectReference
$sel:maxResults:BatchListObjectPolicies' :: BatchListObjectPolicies -> Maybe Natural
$sel:nextToken:BatchListObjectPolicies' :: BatchListObjectPolicies -> 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
"ObjectReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
objectReference)
          ]
      )