{-# 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.BatchListAttachedIndices
-- 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.BatchListAttachedIndices 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 indices attached to an object inside a BatchRead operation. For
-- more information, see ListAttachedIndices and
-- BatchReadRequest$Operations.
--
-- /See:/ 'newBatchListAttachedIndices' smart constructor.
data BatchListAttachedIndices = BatchListAttachedIndices'
  { -- | The pagination token.
    BatchListAttachedIndices -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to retrieve.
    BatchListAttachedIndices -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A reference to the object that has indices attached.
    BatchListAttachedIndices -> ObjectReference
targetReference :: ObjectReference
  }
  deriving (BatchListAttachedIndices -> BatchListAttachedIndices -> Bool
(BatchListAttachedIndices -> BatchListAttachedIndices -> Bool)
-> (BatchListAttachedIndices -> BatchListAttachedIndices -> Bool)
-> Eq BatchListAttachedIndices
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchListAttachedIndices -> BatchListAttachedIndices -> Bool
$c/= :: BatchListAttachedIndices -> BatchListAttachedIndices -> Bool
== :: BatchListAttachedIndices -> BatchListAttachedIndices -> Bool
$c== :: BatchListAttachedIndices -> BatchListAttachedIndices -> Bool
Prelude.Eq, ReadPrec [BatchListAttachedIndices]
ReadPrec BatchListAttachedIndices
Int -> ReadS BatchListAttachedIndices
ReadS [BatchListAttachedIndices]
(Int -> ReadS BatchListAttachedIndices)
-> ReadS [BatchListAttachedIndices]
-> ReadPrec BatchListAttachedIndices
-> ReadPrec [BatchListAttachedIndices]
-> Read BatchListAttachedIndices
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchListAttachedIndices]
$creadListPrec :: ReadPrec [BatchListAttachedIndices]
readPrec :: ReadPrec BatchListAttachedIndices
$creadPrec :: ReadPrec BatchListAttachedIndices
readList :: ReadS [BatchListAttachedIndices]
$creadList :: ReadS [BatchListAttachedIndices]
readsPrec :: Int -> ReadS BatchListAttachedIndices
$creadsPrec :: Int -> ReadS BatchListAttachedIndices
Prelude.Read, Int -> BatchListAttachedIndices -> ShowS
[BatchListAttachedIndices] -> ShowS
BatchListAttachedIndices -> String
(Int -> BatchListAttachedIndices -> ShowS)
-> (BatchListAttachedIndices -> String)
-> ([BatchListAttachedIndices] -> ShowS)
-> Show BatchListAttachedIndices
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchListAttachedIndices] -> ShowS
$cshowList :: [BatchListAttachedIndices] -> ShowS
show :: BatchListAttachedIndices -> String
$cshow :: BatchListAttachedIndices -> String
showsPrec :: Int -> BatchListAttachedIndices -> ShowS
$cshowsPrec :: Int -> BatchListAttachedIndices -> ShowS
Prelude.Show, (forall x.
 BatchListAttachedIndices -> Rep BatchListAttachedIndices x)
-> (forall x.
    Rep BatchListAttachedIndices x -> BatchListAttachedIndices)
-> Generic BatchListAttachedIndices
forall x.
Rep BatchListAttachedIndices x -> BatchListAttachedIndices
forall x.
BatchListAttachedIndices -> Rep BatchListAttachedIndices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchListAttachedIndices x -> BatchListAttachedIndices
$cfrom :: forall x.
BatchListAttachedIndices -> Rep BatchListAttachedIndices x
Prelude.Generic)

-- |
-- Create a value of 'BatchListAttachedIndices' 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', 'batchListAttachedIndices_nextToken' - The pagination token.
--
-- 'maxResults', 'batchListAttachedIndices_maxResults' - The maximum number of results to retrieve.
--
-- 'targetReference', 'batchListAttachedIndices_targetReference' - A reference to the object that has indices attached.
newBatchListAttachedIndices ::
  -- | 'targetReference'
  ObjectReference ->
  BatchListAttachedIndices
newBatchListAttachedIndices :: ObjectReference -> BatchListAttachedIndices
newBatchListAttachedIndices ObjectReference
pTargetReference_ =
  BatchListAttachedIndices' :: Maybe Text
-> Maybe Natural -> ObjectReference -> BatchListAttachedIndices
BatchListAttachedIndices'
    { $sel:nextToken:BatchListAttachedIndices' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:BatchListAttachedIndices' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:targetReference:BatchListAttachedIndices' :: ObjectReference
targetReference = ObjectReference
pTargetReference_
    }

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

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

-- | A reference to the object that has indices attached.
batchListAttachedIndices_targetReference :: Lens.Lens' BatchListAttachedIndices ObjectReference
batchListAttachedIndices_targetReference :: (ObjectReference -> f ObjectReference)
-> BatchListAttachedIndices -> f BatchListAttachedIndices
batchListAttachedIndices_targetReference = (BatchListAttachedIndices -> ObjectReference)
-> (BatchListAttachedIndices
    -> ObjectReference -> BatchListAttachedIndices)
-> Lens
     BatchListAttachedIndices
     BatchListAttachedIndices
     ObjectReference
     ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListAttachedIndices' {ObjectReference
targetReference :: ObjectReference
$sel:targetReference:BatchListAttachedIndices' :: BatchListAttachedIndices -> ObjectReference
targetReference} -> ObjectReference
targetReference) (\s :: BatchListAttachedIndices
s@BatchListAttachedIndices' {} ObjectReference
a -> BatchListAttachedIndices
s {$sel:targetReference:BatchListAttachedIndices' :: ObjectReference
targetReference = ObjectReference
a} :: BatchListAttachedIndices)

instance Prelude.Hashable BatchListAttachedIndices

instance Prelude.NFData BatchListAttachedIndices

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