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

import Amazonka.CloudDirectory.Types.IndexAttachment
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

-- | 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
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]
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
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.
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'
    { $sel:indexAttachments:BatchListAttachedIndicesResponse' :: Maybe [IndexAttachment]
indexAttachments =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:BatchListAttachedIndicesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The indices attached to the specified object.
batchListAttachedIndicesResponse_indexAttachments :: Lens.Lens' BatchListAttachedIndicesResponse (Prelude.Maybe [IndexAttachment])
batchListAttachedIndicesResponse_indexAttachments :: Lens' BatchListAttachedIndicesResponse (Maybe [IndexAttachment])
batchListAttachedIndicesResponse_indexAttachments = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' BatchListAttachedIndicesResponse (Maybe Text)
batchListAttachedIndicesResponse_nextToken = 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
  Data.FromJSON
    BatchListAttachedIndicesResponse
  where
  parseJSON :: Value -> Parser BatchListAttachedIndicesResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchListAttachedIndicesResponse"
      ( \Object
x ->
          Maybe [IndexAttachment]
-> Maybe Text -> BatchListAttachedIndicesResponse
BatchListAttachedIndicesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IndexAttachments"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"NextToken")
      )

instance
  Prelude.Hashable
    BatchListAttachedIndicesResponse
  where
  hashWithSalt :: Int -> BatchListAttachedIndicesResponse -> Int
hashWithSalt
    Int
_salt
    BatchListAttachedIndicesResponse' {Maybe [IndexAttachment]
Maybe Text
nextToken :: Maybe Text
indexAttachments :: Maybe [IndexAttachment]
$sel:nextToken:BatchListAttachedIndicesResponse' :: BatchListAttachedIndicesResponse -> Maybe Text
$sel:indexAttachments:BatchListAttachedIndicesResponse' :: BatchListAttachedIndicesResponse -> Maybe [IndexAttachment]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [IndexAttachment]
indexAttachments
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance
  Prelude.NFData
    BatchListAttachedIndicesResponse
  where
  rnf :: BatchListAttachedIndicesResponse -> ()
rnf BatchListAttachedIndicesResponse' {Maybe [IndexAttachment]
Maybe Text
nextToken :: Maybe Text
indexAttachments :: Maybe [IndexAttachment]
$sel:nextToken:BatchListAttachedIndicesResponse' :: BatchListAttachedIndicesResponse -> Maybe Text
$sel:indexAttachments:BatchListAttachedIndicesResponse' :: BatchListAttachedIndicesResponse -> Maybe [IndexAttachment]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [IndexAttachment]
indexAttachments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken