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

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

-- | Represents the output of a @BatchUpdate@ operation.
--
-- /See:/ 'newBatchUpdateObjectAttributes' smart constructor.
data BatchUpdateObjectAttributes = BatchUpdateObjectAttributes'
  { -- | Reference that identifies the object.
    BatchUpdateObjectAttributes -> ObjectReference
objectReference :: ObjectReference,
    -- | Attributes update structure.
    BatchUpdateObjectAttributes -> [ObjectAttributeUpdate]
attributeUpdates :: [ObjectAttributeUpdate]
  }
  deriving (BatchUpdateObjectAttributes -> BatchUpdateObjectAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateObjectAttributes -> BatchUpdateObjectAttributes -> Bool
$c/= :: BatchUpdateObjectAttributes -> BatchUpdateObjectAttributes -> Bool
== :: BatchUpdateObjectAttributes -> BatchUpdateObjectAttributes -> Bool
$c== :: BatchUpdateObjectAttributes -> BatchUpdateObjectAttributes -> Bool
Prelude.Eq, ReadPrec [BatchUpdateObjectAttributes]
ReadPrec BatchUpdateObjectAttributes
Int -> ReadS BatchUpdateObjectAttributes
ReadS [BatchUpdateObjectAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdateObjectAttributes]
$creadListPrec :: ReadPrec [BatchUpdateObjectAttributes]
readPrec :: ReadPrec BatchUpdateObjectAttributes
$creadPrec :: ReadPrec BatchUpdateObjectAttributes
readList :: ReadS [BatchUpdateObjectAttributes]
$creadList :: ReadS [BatchUpdateObjectAttributes]
readsPrec :: Int -> ReadS BatchUpdateObjectAttributes
$creadsPrec :: Int -> ReadS BatchUpdateObjectAttributes
Prelude.Read, Int -> BatchUpdateObjectAttributes -> ShowS
[BatchUpdateObjectAttributes] -> ShowS
BatchUpdateObjectAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateObjectAttributes] -> ShowS
$cshowList :: [BatchUpdateObjectAttributes] -> ShowS
show :: BatchUpdateObjectAttributes -> String
$cshow :: BatchUpdateObjectAttributes -> String
showsPrec :: Int -> BatchUpdateObjectAttributes -> ShowS
$cshowsPrec :: Int -> BatchUpdateObjectAttributes -> ShowS
Prelude.Show, forall x.
Rep BatchUpdateObjectAttributes x -> BatchUpdateObjectAttributes
forall x.
BatchUpdateObjectAttributes -> Rep BatchUpdateObjectAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchUpdateObjectAttributes x -> BatchUpdateObjectAttributes
$cfrom :: forall x.
BatchUpdateObjectAttributes -> Rep BatchUpdateObjectAttributes x
Prelude.Generic)

-- |
-- Create a value of 'BatchUpdateObjectAttributes' 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:
--
-- 'objectReference', 'batchUpdateObjectAttributes_objectReference' - Reference that identifies the object.
--
-- 'attributeUpdates', 'batchUpdateObjectAttributes_attributeUpdates' - Attributes update structure.
newBatchUpdateObjectAttributes ::
  -- | 'objectReference'
  ObjectReference ->
  BatchUpdateObjectAttributes
newBatchUpdateObjectAttributes :: ObjectReference -> BatchUpdateObjectAttributes
newBatchUpdateObjectAttributes ObjectReference
pObjectReference_ =
  BatchUpdateObjectAttributes'
    { $sel:objectReference:BatchUpdateObjectAttributes' :: ObjectReference
objectReference =
        ObjectReference
pObjectReference_,
      $sel:attributeUpdates:BatchUpdateObjectAttributes' :: [ObjectAttributeUpdate]
attributeUpdates = forall a. Monoid a => a
Prelude.mempty
    }

-- | Reference that identifies the object.
batchUpdateObjectAttributes_objectReference :: Lens.Lens' BatchUpdateObjectAttributes ObjectReference
batchUpdateObjectAttributes_objectReference :: Lens' BatchUpdateObjectAttributes ObjectReference
batchUpdateObjectAttributes_objectReference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateObjectAttributes' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:BatchUpdateObjectAttributes' :: BatchUpdateObjectAttributes -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: BatchUpdateObjectAttributes
s@BatchUpdateObjectAttributes' {} ObjectReference
a -> BatchUpdateObjectAttributes
s {$sel:objectReference:BatchUpdateObjectAttributes' :: ObjectReference
objectReference = ObjectReference
a} :: BatchUpdateObjectAttributes)

-- | Attributes update structure.
batchUpdateObjectAttributes_attributeUpdates :: Lens.Lens' BatchUpdateObjectAttributes [ObjectAttributeUpdate]
batchUpdateObjectAttributes_attributeUpdates :: Lens' BatchUpdateObjectAttributes [ObjectAttributeUpdate]
batchUpdateObjectAttributes_attributeUpdates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateObjectAttributes' {[ObjectAttributeUpdate]
attributeUpdates :: [ObjectAttributeUpdate]
$sel:attributeUpdates:BatchUpdateObjectAttributes' :: BatchUpdateObjectAttributes -> [ObjectAttributeUpdate]
attributeUpdates} -> [ObjectAttributeUpdate]
attributeUpdates) (\s :: BatchUpdateObjectAttributes
s@BatchUpdateObjectAttributes' {} [ObjectAttributeUpdate]
a -> BatchUpdateObjectAttributes
s {$sel:attributeUpdates:BatchUpdateObjectAttributes' :: [ObjectAttributeUpdate]
attributeUpdates = [ObjectAttributeUpdate]
a} :: BatchUpdateObjectAttributes) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable BatchUpdateObjectAttributes where
  hashWithSalt :: Int -> BatchUpdateObjectAttributes -> Int
hashWithSalt Int
_salt BatchUpdateObjectAttributes' {[ObjectAttributeUpdate]
ObjectReference
attributeUpdates :: [ObjectAttributeUpdate]
objectReference :: ObjectReference
$sel:attributeUpdates:BatchUpdateObjectAttributes' :: BatchUpdateObjectAttributes -> [ObjectAttributeUpdate]
$sel:objectReference:BatchUpdateObjectAttributes' :: BatchUpdateObjectAttributes -> ObjectReference
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ObjectReference
objectReference
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [ObjectAttributeUpdate]
attributeUpdates

instance Prelude.NFData BatchUpdateObjectAttributes where
  rnf :: BatchUpdateObjectAttributes -> ()
rnf BatchUpdateObjectAttributes' {[ObjectAttributeUpdate]
ObjectReference
attributeUpdates :: [ObjectAttributeUpdate]
objectReference :: ObjectReference
$sel:attributeUpdates:BatchUpdateObjectAttributes' :: BatchUpdateObjectAttributes -> [ObjectAttributeUpdate]
$sel:objectReference:BatchUpdateObjectAttributes' :: BatchUpdateObjectAttributes -> ObjectReference
..} =
    forall a. NFData a => a -> ()
Prelude.rnf ObjectReference
objectReference
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ObjectAttributeUpdate]
attributeUpdates

instance Data.ToJSON BatchUpdateObjectAttributes where
  toJSON :: BatchUpdateObjectAttributes -> Value
toJSON BatchUpdateObjectAttributes' {[ObjectAttributeUpdate]
ObjectReference
attributeUpdates :: [ObjectAttributeUpdate]
objectReference :: ObjectReference
$sel:attributeUpdates:BatchUpdateObjectAttributes' :: BatchUpdateObjectAttributes -> [ObjectAttributeUpdate]
$sel:objectReference:BatchUpdateObjectAttributes' :: BatchUpdateObjectAttributes -> ObjectReference
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"ObjectReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ObjectReference
objectReference),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"AttributeUpdates" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [ObjectAttributeUpdate]
attributeUpdates)
          ]
      )