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

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

-- | Retrieves all available parent paths for any object type such as node,
-- leaf node, policy node, and index node objects inside a BatchRead
-- operation. For more information, see ListObjectParentPaths and
-- BatchReadRequest$Operations.
--
-- /See:/ 'newBatchListObjectParentPaths' smart constructor.
data BatchListObjectParentPaths = BatchListObjectParentPaths'
  { -- | The pagination token.
    BatchListObjectParentPaths -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to retrieve.
    BatchListObjectParentPaths -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The reference that identifies the object whose attributes will be
    -- listed.
    BatchListObjectParentPaths -> ObjectReference
objectReference :: ObjectReference
  }
  deriving (BatchListObjectParentPaths -> BatchListObjectParentPaths -> Bool
(BatchListObjectParentPaths -> BatchListObjectParentPaths -> Bool)
-> (BatchListObjectParentPaths
    -> BatchListObjectParentPaths -> Bool)
-> Eq BatchListObjectParentPaths
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchListObjectParentPaths -> BatchListObjectParentPaths -> Bool
$c/= :: BatchListObjectParentPaths -> BatchListObjectParentPaths -> Bool
== :: BatchListObjectParentPaths -> BatchListObjectParentPaths -> Bool
$c== :: BatchListObjectParentPaths -> BatchListObjectParentPaths -> Bool
Prelude.Eq, ReadPrec [BatchListObjectParentPaths]
ReadPrec BatchListObjectParentPaths
Int -> ReadS BatchListObjectParentPaths
ReadS [BatchListObjectParentPaths]
(Int -> ReadS BatchListObjectParentPaths)
-> ReadS [BatchListObjectParentPaths]
-> ReadPrec BatchListObjectParentPaths
-> ReadPrec [BatchListObjectParentPaths]
-> Read BatchListObjectParentPaths
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchListObjectParentPaths]
$creadListPrec :: ReadPrec [BatchListObjectParentPaths]
readPrec :: ReadPrec BatchListObjectParentPaths
$creadPrec :: ReadPrec BatchListObjectParentPaths
readList :: ReadS [BatchListObjectParentPaths]
$creadList :: ReadS [BatchListObjectParentPaths]
readsPrec :: Int -> ReadS BatchListObjectParentPaths
$creadsPrec :: Int -> ReadS BatchListObjectParentPaths
Prelude.Read, Int -> BatchListObjectParentPaths -> ShowS
[BatchListObjectParentPaths] -> ShowS
BatchListObjectParentPaths -> String
(Int -> BatchListObjectParentPaths -> ShowS)
-> (BatchListObjectParentPaths -> String)
-> ([BatchListObjectParentPaths] -> ShowS)
-> Show BatchListObjectParentPaths
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchListObjectParentPaths] -> ShowS
$cshowList :: [BatchListObjectParentPaths] -> ShowS
show :: BatchListObjectParentPaths -> String
$cshow :: BatchListObjectParentPaths -> String
showsPrec :: Int -> BatchListObjectParentPaths -> ShowS
$cshowsPrec :: Int -> BatchListObjectParentPaths -> ShowS
Prelude.Show, (forall x.
 BatchListObjectParentPaths -> Rep BatchListObjectParentPaths x)
-> (forall x.
    Rep BatchListObjectParentPaths x -> BatchListObjectParentPaths)
-> Generic BatchListObjectParentPaths
forall x.
Rep BatchListObjectParentPaths x -> BatchListObjectParentPaths
forall x.
BatchListObjectParentPaths -> Rep BatchListObjectParentPaths x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchListObjectParentPaths x -> BatchListObjectParentPaths
$cfrom :: forall x.
BatchListObjectParentPaths -> Rep BatchListObjectParentPaths x
Prelude.Generic)

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

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

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

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

instance Prelude.Hashable BatchListObjectParentPaths

instance Prelude.NFData BatchListObjectParentPaths

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