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

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

-- | Represents the output of a ListIndex response operation.
--
-- /See:/ 'newBatchListIndexResponse' smart constructor.
data BatchListIndexResponse = BatchListIndexResponse'
  { -- | The objects and indexed values attached to the index.
    BatchListIndexResponse -> Maybe [IndexAttachment]
indexAttachments :: Prelude.Maybe [IndexAttachment],
    -- | The pagination token.
    BatchListIndexResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchListIndexResponse -> BatchListIndexResponse -> Bool
(BatchListIndexResponse -> BatchListIndexResponse -> Bool)
-> (BatchListIndexResponse -> BatchListIndexResponse -> Bool)
-> Eq BatchListIndexResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchListIndexResponse -> BatchListIndexResponse -> Bool
$c/= :: BatchListIndexResponse -> BatchListIndexResponse -> Bool
== :: BatchListIndexResponse -> BatchListIndexResponse -> Bool
$c== :: BatchListIndexResponse -> BatchListIndexResponse -> Bool
Prelude.Eq, ReadPrec [BatchListIndexResponse]
ReadPrec BatchListIndexResponse
Int -> ReadS BatchListIndexResponse
ReadS [BatchListIndexResponse]
(Int -> ReadS BatchListIndexResponse)
-> ReadS [BatchListIndexResponse]
-> ReadPrec BatchListIndexResponse
-> ReadPrec [BatchListIndexResponse]
-> Read BatchListIndexResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchListIndexResponse]
$creadListPrec :: ReadPrec [BatchListIndexResponse]
readPrec :: ReadPrec BatchListIndexResponse
$creadPrec :: ReadPrec BatchListIndexResponse
readList :: ReadS [BatchListIndexResponse]
$creadList :: ReadS [BatchListIndexResponse]
readsPrec :: Int -> ReadS BatchListIndexResponse
$creadsPrec :: Int -> ReadS BatchListIndexResponse
Prelude.Read, Int -> BatchListIndexResponse -> ShowS
[BatchListIndexResponse] -> ShowS
BatchListIndexResponse -> String
(Int -> BatchListIndexResponse -> ShowS)
-> (BatchListIndexResponse -> String)
-> ([BatchListIndexResponse] -> ShowS)
-> Show BatchListIndexResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchListIndexResponse] -> ShowS
$cshowList :: [BatchListIndexResponse] -> ShowS
show :: BatchListIndexResponse -> String
$cshow :: BatchListIndexResponse -> String
showsPrec :: Int -> BatchListIndexResponse -> ShowS
$cshowsPrec :: Int -> BatchListIndexResponse -> ShowS
Prelude.Show, (forall x. BatchListIndexResponse -> Rep BatchListIndexResponse x)
-> (forall x.
    Rep BatchListIndexResponse x -> BatchListIndexResponse)
-> Generic BatchListIndexResponse
forall x. Rep BatchListIndexResponse x -> BatchListIndexResponse
forall x. BatchListIndexResponse -> Rep BatchListIndexResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchListIndexResponse x -> BatchListIndexResponse
$cfrom :: forall x. BatchListIndexResponse -> Rep BatchListIndexResponse x
Prelude.Generic)

-- |
-- Create a value of 'BatchListIndexResponse' 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:
--
-- 'indexAttachments', 'batchListIndexResponse_indexAttachments' - The objects and indexed values attached to the index.
--
-- 'nextToken', 'batchListIndexResponse_nextToken' - The pagination token.
newBatchListIndexResponse ::
  BatchListIndexResponse
newBatchListIndexResponse :: BatchListIndexResponse
newBatchListIndexResponse =
  BatchListIndexResponse' :: Maybe [IndexAttachment] -> Maybe Text -> BatchListIndexResponse
BatchListIndexResponse'
    { $sel:indexAttachments:BatchListIndexResponse' :: Maybe [IndexAttachment]
indexAttachments =
        Maybe [IndexAttachment]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:BatchListIndexResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The objects and indexed values attached to the index.
batchListIndexResponse_indexAttachments :: Lens.Lens' BatchListIndexResponse (Prelude.Maybe [IndexAttachment])
batchListIndexResponse_indexAttachments :: (Maybe [IndexAttachment] -> f (Maybe [IndexAttachment]))
-> BatchListIndexResponse -> f BatchListIndexResponse
batchListIndexResponse_indexAttachments = (BatchListIndexResponse -> Maybe [IndexAttachment])
-> (BatchListIndexResponse
    -> Maybe [IndexAttachment] -> BatchListIndexResponse)
-> Lens
     BatchListIndexResponse
     BatchListIndexResponse
     (Maybe [IndexAttachment])
     (Maybe [IndexAttachment])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListIndexResponse' {Maybe [IndexAttachment]
indexAttachments :: Maybe [IndexAttachment]
$sel:indexAttachments:BatchListIndexResponse' :: BatchListIndexResponse -> Maybe [IndexAttachment]
indexAttachments} -> Maybe [IndexAttachment]
indexAttachments) (\s :: BatchListIndexResponse
s@BatchListIndexResponse' {} Maybe [IndexAttachment]
a -> BatchListIndexResponse
s {$sel:indexAttachments:BatchListIndexResponse' :: Maybe [IndexAttachment]
indexAttachments = Maybe [IndexAttachment]
a} :: BatchListIndexResponse) ((Maybe [IndexAttachment] -> f (Maybe [IndexAttachment]))
 -> BatchListIndexResponse -> f BatchListIndexResponse)
-> ((Maybe [IndexAttachment] -> f (Maybe [IndexAttachment]))
    -> Maybe [IndexAttachment] -> f (Maybe [IndexAttachment]))
-> (Maybe [IndexAttachment] -> f (Maybe [IndexAttachment]))
-> BatchListIndexResponse
-> f BatchListIndexResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [IndexAttachment]
  [IndexAttachment]
  [IndexAttachment]
  [IndexAttachment]
-> Iso
     (Maybe [IndexAttachment])
     (Maybe [IndexAttachment])
     (Maybe [IndexAttachment])
     (Maybe [IndexAttachment])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [IndexAttachment]
  [IndexAttachment]
  [IndexAttachment]
  [IndexAttachment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Core.FromJSON BatchListIndexResponse where
  parseJSON :: Value -> Parser BatchListIndexResponse
parseJSON =
    String
-> (Object -> Parser BatchListIndexResponse)
-> Value
-> Parser BatchListIndexResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchListIndexResponse"
      ( \Object
x ->
          Maybe [IndexAttachment] -> Maybe Text -> BatchListIndexResponse
BatchListIndexResponse'
            (Maybe [IndexAttachment] -> Maybe Text -> BatchListIndexResponse)
-> Parser (Maybe [IndexAttachment])
-> Parser (Maybe Text -> BatchListIndexResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [IndexAttachment]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IndexAttachments"
                            Parser (Maybe (Maybe [IndexAttachment]))
-> Maybe [IndexAttachment] -> Parser (Maybe [IndexAttachment])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [IndexAttachment]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> BatchListIndexResponse)
-> Parser (Maybe Text) -> Parser BatchListIndexResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NextToken")
      )

instance Prelude.Hashable BatchListIndexResponse

instance Prelude.NFData BatchListIndexResponse