{-# 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.BatchListObjectChildren
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudDirectory.Types.BatchListObjectChildren where

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

-- | Represents the output of a ListObjectChildren operation.
--
-- /See:/ 'newBatchListObjectChildren' smart constructor.
data BatchListObjectChildren = BatchListObjectChildren'
  { -- | Maximum number of items to be retrieved in a single call. This is an
    -- approximate number.
    BatchListObjectChildren -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The pagination token.
    BatchListObjectChildren -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Reference of the object for which child objects are being listed.
    BatchListObjectChildren -> ObjectReference
objectReference :: ObjectReference
  }
  deriving (BatchListObjectChildren -> BatchListObjectChildren -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchListObjectChildren -> BatchListObjectChildren -> Bool
$c/= :: BatchListObjectChildren -> BatchListObjectChildren -> Bool
== :: BatchListObjectChildren -> BatchListObjectChildren -> Bool
$c== :: BatchListObjectChildren -> BatchListObjectChildren -> Bool
Prelude.Eq, ReadPrec [BatchListObjectChildren]
ReadPrec BatchListObjectChildren
Int -> ReadS BatchListObjectChildren
ReadS [BatchListObjectChildren]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchListObjectChildren]
$creadListPrec :: ReadPrec [BatchListObjectChildren]
readPrec :: ReadPrec BatchListObjectChildren
$creadPrec :: ReadPrec BatchListObjectChildren
readList :: ReadS [BatchListObjectChildren]
$creadList :: ReadS [BatchListObjectChildren]
readsPrec :: Int -> ReadS BatchListObjectChildren
$creadsPrec :: Int -> ReadS BatchListObjectChildren
Prelude.Read, Int -> BatchListObjectChildren -> ShowS
[BatchListObjectChildren] -> ShowS
BatchListObjectChildren -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchListObjectChildren] -> ShowS
$cshowList :: [BatchListObjectChildren] -> ShowS
show :: BatchListObjectChildren -> String
$cshow :: BatchListObjectChildren -> String
showsPrec :: Int -> BatchListObjectChildren -> ShowS
$cshowsPrec :: Int -> BatchListObjectChildren -> ShowS
Prelude.Show, forall x. Rep BatchListObjectChildren x -> BatchListObjectChildren
forall x. BatchListObjectChildren -> Rep BatchListObjectChildren x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchListObjectChildren x -> BatchListObjectChildren
$cfrom :: forall x. BatchListObjectChildren -> Rep BatchListObjectChildren x
Prelude.Generic)

-- |
-- Create a value of 'BatchListObjectChildren' 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:
--
-- 'maxResults', 'batchListObjectChildren_maxResults' - Maximum number of items to be retrieved in a single call. This is an
-- approximate number.
--
-- 'nextToken', 'batchListObjectChildren_nextToken' - The pagination token.
--
-- 'objectReference', 'batchListObjectChildren_objectReference' - Reference of the object for which child objects are being listed.
newBatchListObjectChildren ::
  -- | 'objectReference'
  ObjectReference ->
  BatchListObjectChildren
newBatchListObjectChildren :: ObjectReference -> BatchListObjectChildren
newBatchListObjectChildren ObjectReference
pObjectReference_ =
  BatchListObjectChildren'
    { $sel:maxResults:BatchListObjectChildren' :: Maybe Natural
maxResults =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:BatchListObjectChildren' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:objectReference:BatchListObjectChildren' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
    }

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

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

-- | Reference of the object for which child objects are being listed.
batchListObjectChildren_objectReference :: Lens.Lens' BatchListObjectChildren ObjectReference
batchListObjectChildren_objectReference :: Lens' BatchListObjectChildren ObjectReference
batchListObjectChildren_objectReference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListObjectChildren' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:BatchListObjectChildren' :: BatchListObjectChildren -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: BatchListObjectChildren
s@BatchListObjectChildren' {} ObjectReference
a -> BatchListObjectChildren
s {$sel:objectReference:BatchListObjectChildren' :: ObjectReference
objectReference = ObjectReference
a} :: BatchListObjectChildren)

instance Prelude.Hashable BatchListObjectChildren where
  hashWithSalt :: Int -> BatchListObjectChildren -> Int
hashWithSalt Int
_salt BatchListObjectChildren' {Maybe Natural
Maybe Text
ObjectReference
objectReference :: ObjectReference
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:objectReference:BatchListObjectChildren' :: BatchListObjectChildren -> ObjectReference
$sel:nextToken:BatchListObjectChildren' :: BatchListObjectChildren -> Maybe Text
$sel:maxResults:BatchListObjectChildren' :: BatchListObjectChildren -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ObjectReference
objectReference

instance Prelude.NFData BatchListObjectChildren where
  rnf :: BatchListObjectChildren -> ()
rnf BatchListObjectChildren' {Maybe Natural
Maybe Text
ObjectReference
objectReference :: ObjectReference
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:objectReference:BatchListObjectChildren' :: BatchListObjectChildren -> ObjectReference
$sel:nextToken:BatchListObjectChildren' :: BatchListObjectChildren -> Maybe Text
$sel:maxResults:BatchListObjectChildren' :: BatchListObjectChildren -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ObjectReference
objectReference

instance Data.ToJSON BatchListObjectChildren where
  toJSON :: BatchListObjectChildren -> Value
toJSON BatchListObjectChildren' {Maybe Natural
Maybe Text
ObjectReference
objectReference :: ObjectReference
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:objectReference:BatchListObjectChildren' :: BatchListObjectChildren -> ObjectReference
$sel:nextToken:BatchListObjectChildren' :: BatchListObjectChildren -> Maybe Text
$sel:maxResults:BatchListObjectChildren' :: BatchListObjectChildren -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ObjectReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ObjectReference
objectReference)
          ]
      )