{-# 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.BatchListObjectParents
-- 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.BatchListObjectParents where

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

-- | Lists parent objects that are associated with a given object in
-- pagination fashion.
--
-- /See:/ 'newBatchListObjectParents' smart constructor.
data BatchListObjectParents = BatchListObjectParents'
  { -- | The pagination token.
    BatchListObjectParents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to be retrieved in a single call. This is an
    -- approximate number.
    BatchListObjectParents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    BatchListObjectParents -> ObjectReference
objectReference :: ObjectReference
  }
  deriving (BatchListObjectParents -> BatchListObjectParents -> Bool
(BatchListObjectParents -> BatchListObjectParents -> Bool)
-> (BatchListObjectParents -> BatchListObjectParents -> Bool)
-> Eq BatchListObjectParents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchListObjectParents -> BatchListObjectParents -> Bool
$c/= :: BatchListObjectParents -> BatchListObjectParents -> Bool
== :: BatchListObjectParents -> BatchListObjectParents -> Bool
$c== :: BatchListObjectParents -> BatchListObjectParents -> Bool
Prelude.Eq, ReadPrec [BatchListObjectParents]
ReadPrec BatchListObjectParents
Int -> ReadS BatchListObjectParents
ReadS [BatchListObjectParents]
(Int -> ReadS BatchListObjectParents)
-> ReadS [BatchListObjectParents]
-> ReadPrec BatchListObjectParents
-> ReadPrec [BatchListObjectParents]
-> Read BatchListObjectParents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchListObjectParents]
$creadListPrec :: ReadPrec [BatchListObjectParents]
readPrec :: ReadPrec BatchListObjectParents
$creadPrec :: ReadPrec BatchListObjectParents
readList :: ReadS [BatchListObjectParents]
$creadList :: ReadS [BatchListObjectParents]
readsPrec :: Int -> ReadS BatchListObjectParents
$creadsPrec :: Int -> ReadS BatchListObjectParents
Prelude.Read, Int -> BatchListObjectParents -> ShowS
[BatchListObjectParents] -> ShowS
BatchListObjectParents -> String
(Int -> BatchListObjectParents -> ShowS)
-> (BatchListObjectParents -> String)
-> ([BatchListObjectParents] -> ShowS)
-> Show BatchListObjectParents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchListObjectParents] -> ShowS
$cshowList :: [BatchListObjectParents] -> ShowS
show :: BatchListObjectParents -> String
$cshow :: BatchListObjectParents -> String
showsPrec :: Int -> BatchListObjectParents -> ShowS
$cshowsPrec :: Int -> BatchListObjectParents -> ShowS
Prelude.Show, (forall x. BatchListObjectParents -> Rep BatchListObjectParents x)
-> (forall x.
    Rep BatchListObjectParents x -> BatchListObjectParents)
-> Generic BatchListObjectParents
forall x. Rep BatchListObjectParents x -> BatchListObjectParents
forall x. BatchListObjectParents -> Rep BatchListObjectParents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchListObjectParents x -> BatchListObjectParents
$cfrom :: forall x. BatchListObjectParents -> Rep BatchListObjectParents x
Prelude.Generic)

-- |
-- Create a value of 'BatchListObjectParents' 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', 'batchListObjectParents_nextToken' - The pagination token.
--
-- 'maxResults', 'batchListObjectParents_maxResults' - The maximum number of items to be retrieved in a single call. This is an
-- approximate number.
--
-- 'objectReference', 'batchListObjectParents_objectReference' - Undocumented member.
newBatchListObjectParents ::
  -- | 'objectReference'
  ObjectReference ->
  BatchListObjectParents
newBatchListObjectParents :: ObjectReference -> BatchListObjectParents
newBatchListObjectParents ObjectReference
pObjectReference_ =
  BatchListObjectParents' :: Maybe Text
-> Maybe Natural -> ObjectReference -> BatchListObjectParents
BatchListObjectParents'
    { $sel:nextToken:BatchListObjectParents' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:BatchListObjectParents' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:objectReference:BatchListObjectParents' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
    }

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

-- | The maximum number of items to be retrieved in a single call. This is an
-- approximate number.
batchListObjectParents_maxResults :: Lens.Lens' BatchListObjectParents (Prelude.Maybe Prelude.Natural)
batchListObjectParents_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> BatchListObjectParents -> f BatchListObjectParents
batchListObjectParents_maxResults = (BatchListObjectParents -> Maybe Natural)
-> (BatchListObjectParents
    -> Maybe Natural -> BatchListObjectParents)
-> Lens
     BatchListObjectParents
     BatchListObjectParents
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListObjectParents' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:BatchListObjectParents' :: BatchListObjectParents -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: BatchListObjectParents
s@BatchListObjectParents' {} Maybe Natural
a -> BatchListObjectParents
s {$sel:maxResults:BatchListObjectParents' :: Maybe Natural
maxResults = Maybe Natural
a} :: BatchListObjectParents)

-- | Undocumented member.
batchListObjectParents_objectReference :: Lens.Lens' BatchListObjectParents ObjectReference
batchListObjectParents_objectReference :: (ObjectReference -> f ObjectReference)
-> BatchListObjectParents -> f BatchListObjectParents
batchListObjectParents_objectReference = (BatchListObjectParents -> ObjectReference)
-> (BatchListObjectParents
    -> ObjectReference -> BatchListObjectParents)
-> Lens
     BatchListObjectParents
     BatchListObjectParents
     ObjectReference
     ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListObjectParents' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:BatchListObjectParents' :: BatchListObjectParents -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: BatchListObjectParents
s@BatchListObjectParents' {} ObjectReference
a -> BatchListObjectParents
s {$sel:objectReference:BatchListObjectParents' :: ObjectReference
objectReference = ObjectReference
a} :: BatchListObjectParents)

instance Prelude.Hashable BatchListObjectParents

instance Prelude.NFData BatchListObjectParents

instance Core.ToJSON BatchListObjectParents where
  toJSON :: BatchListObjectParents -> Value
toJSON BatchListObjectParents' {Maybe Natural
Maybe Text
ObjectReference
objectReference :: ObjectReference
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:objectReference:BatchListObjectParents' :: BatchListObjectParents -> ObjectReference
$sel:maxResults:BatchListObjectParents' :: BatchListObjectParents -> Maybe Natural
$sel:nextToken:BatchListObjectParents' :: BatchListObjectParents -> 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)
          ]
      )