{-# 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-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.BatchListAttachedIndices 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

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

-- | The maximum number of results to retrieve.
batchListAttachedIndices_maxResults :: Lens.Lens' BatchListAttachedIndices (Prelude.Maybe Prelude.Natural)
batchListAttachedIndices_maxResults :: Lens' BatchListAttachedIndices (Maybe Natural)
batchListAttachedIndices_maxResults = 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)

-- | The pagination token.
batchListAttachedIndices_nextToken :: Lens.Lens' BatchListAttachedIndices (Prelude.Maybe Prelude.Text)
batchListAttachedIndices_nextToken :: Lens' BatchListAttachedIndices (Maybe Text)
batchListAttachedIndices_nextToken = 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)

-- | A reference to the object that has indices attached.
batchListAttachedIndices_targetReference :: Lens.Lens' BatchListAttachedIndices ObjectReference
batchListAttachedIndices_targetReference :: Lens' BatchListAttachedIndices ObjectReference
batchListAttachedIndices_targetReference = 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 where
  hashWithSalt :: Int -> BatchListAttachedIndices -> Int
hashWithSalt Int
_salt BatchListAttachedIndices' {Maybe Natural
Maybe Text
ObjectReference
targetReference :: ObjectReference
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:targetReference:BatchListAttachedIndices' :: BatchListAttachedIndices -> ObjectReference
$sel:nextToken:BatchListAttachedIndices' :: BatchListAttachedIndices -> Maybe Text
$sel:maxResults:BatchListAttachedIndices' :: BatchListAttachedIndices -> 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
targetReference

instance Prelude.NFData BatchListAttachedIndices where
  rnf :: BatchListAttachedIndices -> ()
rnf BatchListAttachedIndices' {Maybe Natural
Maybe Text
ObjectReference
targetReference :: ObjectReference
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:targetReference:BatchListAttachedIndices' :: BatchListAttachedIndices -> ObjectReference
$sel:nextToken:BatchListAttachedIndices' :: BatchListAttachedIndices -> Maybe Text
$sel:maxResults:BatchListAttachedIndices' :: BatchListAttachedIndices -> 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
targetReference

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