{-# 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.BatchListAttachedIndicesResponse
-- 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.BatchListAttachedIndicesResponse 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 ListAttachedIndices response operation.
--
-- /See:/ 'newBatchListAttachedIndicesResponse' smart constructor.
data BatchListAttachedIndicesResponse = BatchListAttachedIndicesResponse'
  { -- | The indices attached to the specified object.
    BatchListAttachedIndicesResponse -> Maybe [IndexAttachment]
indexAttachments :: Prelude.Maybe [IndexAttachment],
    -- | The pagination token.
    BatchListAttachedIndicesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchListAttachedIndicesResponse
-> BatchListAttachedIndicesResponse -> Bool
(BatchListAttachedIndicesResponse
 -> BatchListAttachedIndicesResponse -> Bool)
-> (BatchListAttachedIndicesResponse
    -> BatchListAttachedIndicesResponse -> Bool)
-> Eq BatchListAttachedIndicesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchListAttachedIndicesResponse
-> BatchListAttachedIndicesResponse -> Bool
$c/= :: BatchListAttachedIndicesResponse
-> BatchListAttachedIndicesResponse -> Bool
== :: BatchListAttachedIndicesResponse
-> BatchListAttachedIndicesResponse -> Bool
$c== :: BatchListAttachedIndicesResponse
-> BatchListAttachedIndicesResponse -> Bool
Prelude.Eq, ReadPrec [BatchListAttachedIndicesResponse]
ReadPrec BatchListAttachedIndicesResponse
Int -> ReadS BatchListAttachedIndicesResponse
ReadS [BatchListAttachedIndicesResponse]
(Int -> ReadS BatchListAttachedIndicesResponse)
-> ReadS [BatchListAttachedIndicesResponse]
-> ReadPrec BatchListAttachedIndicesResponse
-> ReadPrec [BatchListAttachedIndicesResponse]
-> Read BatchListAttachedIndicesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchListAttachedIndicesResponse]
$creadListPrec :: ReadPrec [BatchListAttachedIndicesResponse]
readPrec :: ReadPrec BatchListAttachedIndicesResponse
$creadPrec :: ReadPrec BatchListAttachedIndicesResponse
readList :: ReadS [BatchListAttachedIndicesResponse]
$creadList :: ReadS [BatchListAttachedIndicesResponse]
readsPrec :: Int -> ReadS BatchListAttachedIndicesResponse
$creadsPrec :: Int -> ReadS BatchListAttachedIndicesResponse
Prelude.Read, Int -> BatchListAttachedIndicesResponse -> ShowS
[BatchListAttachedIndicesResponse] -> ShowS
BatchListAttachedIndicesResponse -> String
(Int -> BatchListAttachedIndicesResponse -> ShowS)
-> (BatchListAttachedIndicesResponse -> String)
-> ([BatchListAttachedIndicesResponse] -> ShowS)
-> Show BatchListAttachedIndicesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchListAttachedIndicesResponse] -> ShowS
$cshowList :: [BatchListAttachedIndicesResponse] -> ShowS
show :: BatchListAttachedIndicesResponse -> String
$cshow :: BatchListAttachedIndicesResponse -> String
showsPrec :: Int -> BatchListAttachedIndicesResponse -> ShowS
$cshowsPrec :: Int -> BatchListAttachedIndicesResponse -> ShowS
Prelude.Show, (forall x.
 BatchListAttachedIndicesResponse
 -> Rep BatchListAttachedIndicesResponse x)
-> (forall x.
    Rep BatchListAttachedIndicesResponse x
    -> BatchListAttachedIndicesResponse)
-> Generic BatchListAttachedIndicesResponse
forall x.
Rep BatchListAttachedIndicesResponse x
-> BatchListAttachedIndicesResponse
forall x.
BatchListAttachedIndicesResponse
-> Rep BatchListAttachedIndicesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchListAttachedIndicesResponse x
-> BatchListAttachedIndicesResponse
$cfrom :: forall x.
BatchListAttachedIndicesResponse
-> Rep BatchListAttachedIndicesResponse x
Prelude.Generic)

-- |
-- Create a value of 'BatchListAttachedIndicesResponse' 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', 'batchListAttachedIndicesResponse_indexAttachments' - The indices attached to the specified object.
--
-- 'nextToken', 'batchListAttachedIndicesResponse_nextToken' - The pagination token.
newBatchListAttachedIndicesResponse ::
  BatchListAttachedIndicesResponse
newBatchListAttachedIndicesResponse :: BatchListAttachedIndicesResponse
newBatchListAttachedIndicesResponse =
  BatchListAttachedIndicesResponse' :: Maybe [IndexAttachment]
-> Maybe Text -> BatchListAttachedIndicesResponse
BatchListAttachedIndicesResponse'
    { $sel:indexAttachments:BatchListAttachedIndicesResponse' :: Maybe [IndexAttachment]
indexAttachments =
        Maybe [IndexAttachment]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:BatchListAttachedIndicesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The indices attached to the specified object.
batchListAttachedIndicesResponse_indexAttachments :: Lens.Lens' BatchListAttachedIndicesResponse (Prelude.Maybe [IndexAttachment])
batchListAttachedIndicesResponse_indexAttachments :: (Maybe [IndexAttachment] -> f (Maybe [IndexAttachment]))
-> BatchListAttachedIndicesResponse
-> f BatchListAttachedIndicesResponse
batchListAttachedIndicesResponse_indexAttachments = (BatchListAttachedIndicesResponse -> Maybe [IndexAttachment])
-> (BatchListAttachedIndicesResponse
    -> Maybe [IndexAttachment] -> BatchListAttachedIndicesResponse)
-> Lens
     BatchListAttachedIndicesResponse
     BatchListAttachedIndicesResponse
     (Maybe [IndexAttachment])
     (Maybe [IndexAttachment])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListAttachedIndicesResponse' {Maybe [IndexAttachment]
indexAttachments :: Maybe [IndexAttachment]
$sel:indexAttachments:BatchListAttachedIndicesResponse' :: BatchListAttachedIndicesResponse -> Maybe [IndexAttachment]
indexAttachments} -> Maybe [IndexAttachment]
indexAttachments) (\s :: BatchListAttachedIndicesResponse
s@BatchListAttachedIndicesResponse' {} Maybe [IndexAttachment]
a -> BatchListAttachedIndicesResponse
s {$sel:indexAttachments:BatchListAttachedIndicesResponse' :: Maybe [IndexAttachment]
indexAttachments = Maybe [IndexAttachment]
a} :: BatchListAttachedIndicesResponse) ((Maybe [IndexAttachment] -> f (Maybe [IndexAttachment]))
 -> BatchListAttachedIndicesResponse
 -> f BatchListAttachedIndicesResponse)
-> ((Maybe [IndexAttachment] -> f (Maybe [IndexAttachment]))
    -> Maybe [IndexAttachment] -> f (Maybe [IndexAttachment]))
-> (Maybe [IndexAttachment] -> f (Maybe [IndexAttachment]))
-> BatchListAttachedIndicesResponse
-> f BatchListAttachedIndicesResponse
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.
batchListAttachedIndicesResponse_nextToken :: Lens.Lens' BatchListAttachedIndicesResponse (Prelude.Maybe Prelude.Text)
batchListAttachedIndicesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> BatchListAttachedIndicesResponse
-> f BatchListAttachedIndicesResponse
batchListAttachedIndicesResponse_nextToken = (BatchListAttachedIndicesResponse -> Maybe Text)
-> (BatchListAttachedIndicesResponse
    -> Maybe Text -> BatchListAttachedIndicesResponse)
-> Lens
     BatchListAttachedIndicesResponse
     BatchListAttachedIndicesResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListAttachedIndicesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:BatchListAttachedIndicesResponse' :: BatchListAttachedIndicesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: BatchListAttachedIndicesResponse
s@BatchListAttachedIndicesResponse' {} Maybe Text
a -> BatchListAttachedIndicesResponse
s {$sel:nextToken:BatchListAttachedIndicesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: BatchListAttachedIndicesResponse)

instance
  Core.FromJSON
    BatchListAttachedIndicesResponse
  where
  parseJSON :: Value -> Parser BatchListAttachedIndicesResponse
parseJSON =
    String
-> (Object -> Parser BatchListAttachedIndicesResponse)
-> Value
-> Parser BatchListAttachedIndicesResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchListAttachedIndicesResponse"
      ( \Object
x ->
          Maybe [IndexAttachment]
-> Maybe Text -> BatchListAttachedIndicesResponse
BatchListAttachedIndicesResponse'
            (Maybe [IndexAttachment]
 -> Maybe Text -> BatchListAttachedIndicesResponse)
-> Parser (Maybe [IndexAttachment])
-> Parser (Maybe Text -> BatchListAttachedIndicesResponse)
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 -> BatchListAttachedIndicesResponse)
-> Parser (Maybe Text) -> Parser BatchListAttachedIndicesResponse
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
    BatchListAttachedIndicesResponse

instance
  Prelude.NFData
    BatchListAttachedIndicesResponse