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

-- | Detaches the specified object from the specified index inside a
-- BatchRead operation. For more information, see DetachFromIndex and
-- BatchReadRequest$Operations.
--
-- /See:/ 'newBatchDetachFromIndex' smart constructor.
data BatchDetachFromIndex = BatchDetachFromIndex'
  { -- | A reference to the index object.
    BatchDetachFromIndex -> ObjectReference
indexReference :: ObjectReference,
    -- | A reference to the object being detached from the index.
    BatchDetachFromIndex -> ObjectReference
targetReference :: ObjectReference
  }
  deriving (BatchDetachFromIndex -> BatchDetachFromIndex -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetachFromIndex -> BatchDetachFromIndex -> Bool
$c/= :: BatchDetachFromIndex -> BatchDetachFromIndex -> Bool
== :: BatchDetachFromIndex -> BatchDetachFromIndex -> Bool
$c== :: BatchDetachFromIndex -> BatchDetachFromIndex -> Bool
Prelude.Eq, ReadPrec [BatchDetachFromIndex]
ReadPrec BatchDetachFromIndex
Int -> ReadS BatchDetachFromIndex
ReadS [BatchDetachFromIndex]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDetachFromIndex]
$creadListPrec :: ReadPrec [BatchDetachFromIndex]
readPrec :: ReadPrec BatchDetachFromIndex
$creadPrec :: ReadPrec BatchDetachFromIndex
readList :: ReadS [BatchDetachFromIndex]
$creadList :: ReadS [BatchDetachFromIndex]
readsPrec :: Int -> ReadS BatchDetachFromIndex
$creadsPrec :: Int -> ReadS BatchDetachFromIndex
Prelude.Read, Int -> BatchDetachFromIndex -> ShowS
[BatchDetachFromIndex] -> ShowS
BatchDetachFromIndex -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetachFromIndex] -> ShowS
$cshowList :: [BatchDetachFromIndex] -> ShowS
show :: BatchDetachFromIndex -> String
$cshow :: BatchDetachFromIndex -> String
showsPrec :: Int -> BatchDetachFromIndex -> ShowS
$cshowsPrec :: Int -> BatchDetachFromIndex -> ShowS
Prelude.Show, forall x. Rep BatchDetachFromIndex x -> BatchDetachFromIndex
forall x. BatchDetachFromIndex -> Rep BatchDetachFromIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDetachFromIndex x -> BatchDetachFromIndex
$cfrom :: forall x. BatchDetachFromIndex -> Rep BatchDetachFromIndex x
Prelude.Generic)

-- |
-- Create a value of 'BatchDetachFromIndex' 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:
--
-- 'indexReference', 'batchDetachFromIndex_indexReference' - A reference to the index object.
--
-- 'targetReference', 'batchDetachFromIndex_targetReference' - A reference to the object being detached from the index.
newBatchDetachFromIndex ::
  -- | 'indexReference'
  ObjectReference ->
  -- | 'targetReference'
  ObjectReference ->
  BatchDetachFromIndex
newBatchDetachFromIndex :: ObjectReference -> ObjectReference -> BatchDetachFromIndex
newBatchDetachFromIndex
  ObjectReference
pIndexReference_
  ObjectReference
pTargetReference_ =
    BatchDetachFromIndex'
      { $sel:indexReference:BatchDetachFromIndex' :: ObjectReference
indexReference =
          ObjectReference
pIndexReference_,
        $sel:targetReference:BatchDetachFromIndex' :: ObjectReference
targetReference = ObjectReference
pTargetReference_
      }

-- | A reference to the index object.
batchDetachFromIndex_indexReference :: Lens.Lens' BatchDetachFromIndex ObjectReference
batchDetachFromIndex_indexReference :: Lens' BatchDetachFromIndex ObjectReference
batchDetachFromIndex_indexReference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetachFromIndex' {ObjectReference
indexReference :: ObjectReference
$sel:indexReference:BatchDetachFromIndex' :: BatchDetachFromIndex -> ObjectReference
indexReference} -> ObjectReference
indexReference) (\s :: BatchDetachFromIndex
s@BatchDetachFromIndex' {} ObjectReference
a -> BatchDetachFromIndex
s {$sel:indexReference:BatchDetachFromIndex' :: ObjectReference
indexReference = ObjectReference
a} :: BatchDetachFromIndex)

-- | A reference to the object being detached from the index.
batchDetachFromIndex_targetReference :: Lens.Lens' BatchDetachFromIndex ObjectReference
batchDetachFromIndex_targetReference :: Lens' BatchDetachFromIndex ObjectReference
batchDetachFromIndex_targetReference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetachFromIndex' {ObjectReference
targetReference :: ObjectReference
$sel:targetReference:BatchDetachFromIndex' :: BatchDetachFromIndex -> ObjectReference
targetReference} -> ObjectReference
targetReference) (\s :: BatchDetachFromIndex
s@BatchDetachFromIndex' {} ObjectReference
a -> BatchDetachFromIndex
s {$sel:targetReference:BatchDetachFromIndex' :: ObjectReference
targetReference = ObjectReference
a} :: BatchDetachFromIndex)

instance Prelude.Hashable BatchDetachFromIndex where
  hashWithSalt :: Int -> BatchDetachFromIndex -> Int
hashWithSalt Int
_salt BatchDetachFromIndex' {ObjectReference
targetReference :: ObjectReference
indexReference :: ObjectReference
$sel:targetReference:BatchDetachFromIndex' :: BatchDetachFromIndex -> ObjectReference
$sel:indexReference:BatchDetachFromIndex' :: BatchDetachFromIndex -> ObjectReference
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ObjectReference
indexReference
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ObjectReference
targetReference

instance Prelude.NFData BatchDetachFromIndex where
  rnf :: BatchDetachFromIndex -> ()
rnf BatchDetachFromIndex' {ObjectReference
targetReference :: ObjectReference
indexReference :: ObjectReference
$sel:targetReference:BatchDetachFromIndex' :: BatchDetachFromIndex -> ObjectReference
$sel:indexReference:BatchDetachFromIndex' :: BatchDetachFromIndex -> ObjectReference
..} =
    forall a. NFData a => a -> ()
Prelude.rnf ObjectReference
indexReference
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ObjectReference
targetReference

instance Data.ToJSON BatchDetachFromIndex where
  toJSON :: BatchDetachFromIndex -> Value
toJSON BatchDetachFromIndex' {ObjectReference
targetReference :: ObjectReference
indexReference :: ObjectReference
$sel:targetReference:BatchDetachFromIndex' :: BatchDetachFromIndex -> ObjectReference
$sel:indexReference:BatchDetachFromIndex' :: BatchDetachFromIndex -> ObjectReference
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"IndexReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ObjectReference
indexReference),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"TargetReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ObjectReference
targetReference)
          ]
      )