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

import Amazonka.CloudDirectory.Types.AttributeKeyAndValue
import Amazonka.CloudDirectory.Types.ObjectReference
import Amazonka.CloudDirectory.Types.SchemaFacet
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the output of a batch add facet to object operation.
--
-- /See:/ 'newBatchAddFacetToObject' smart constructor.
data BatchAddFacetToObject = BatchAddFacetToObject'
  { -- | Represents the facet being added to the object.
    BatchAddFacetToObject -> SchemaFacet
schemaFacet :: SchemaFacet,
    -- | The attributes to set on the object.
    BatchAddFacetToObject -> [AttributeKeyAndValue]
objectAttributeList :: [AttributeKeyAndValue],
    -- | A reference to the object being mutated.
    BatchAddFacetToObject -> ObjectReference
objectReference :: ObjectReference
  }
  deriving (BatchAddFacetToObject -> BatchAddFacetToObject -> Bool
(BatchAddFacetToObject -> BatchAddFacetToObject -> Bool)
-> (BatchAddFacetToObject -> BatchAddFacetToObject -> Bool)
-> Eq BatchAddFacetToObject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchAddFacetToObject -> BatchAddFacetToObject -> Bool
$c/= :: BatchAddFacetToObject -> BatchAddFacetToObject -> Bool
== :: BatchAddFacetToObject -> BatchAddFacetToObject -> Bool
$c== :: BatchAddFacetToObject -> BatchAddFacetToObject -> Bool
Prelude.Eq, ReadPrec [BatchAddFacetToObject]
ReadPrec BatchAddFacetToObject
Int -> ReadS BatchAddFacetToObject
ReadS [BatchAddFacetToObject]
(Int -> ReadS BatchAddFacetToObject)
-> ReadS [BatchAddFacetToObject]
-> ReadPrec BatchAddFacetToObject
-> ReadPrec [BatchAddFacetToObject]
-> Read BatchAddFacetToObject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchAddFacetToObject]
$creadListPrec :: ReadPrec [BatchAddFacetToObject]
readPrec :: ReadPrec BatchAddFacetToObject
$creadPrec :: ReadPrec BatchAddFacetToObject
readList :: ReadS [BatchAddFacetToObject]
$creadList :: ReadS [BatchAddFacetToObject]
readsPrec :: Int -> ReadS BatchAddFacetToObject
$creadsPrec :: Int -> ReadS BatchAddFacetToObject
Prelude.Read, Int -> BatchAddFacetToObject -> ShowS
[BatchAddFacetToObject] -> ShowS
BatchAddFacetToObject -> String
(Int -> BatchAddFacetToObject -> ShowS)
-> (BatchAddFacetToObject -> String)
-> ([BatchAddFacetToObject] -> ShowS)
-> Show BatchAddFacetToObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchAddFacetToObject] -> ShowS
$cshowList :: [BatchAddFacetToObject] -> ShowS
show :: BatchAddFacetToObject -> String
$cshow :: BatchAddFacetToObject -> String
showsPrec :: Int -> BatchAddFacetToObject -> ShowS
$cshowsPrec :: Int -> BatchAddFacetToObject -> ShowS
Prelude.Show, (forall x. BatchAddFacetToObject -> Rep BatchAddFacetToObject x)
-> (forall x. Rep BatchAddFacetToObject x -> BatchAddFacetToObject)
-> Generic BatchAddFacetToObject
forall x. Rep BatchAddFacetToObject x -> BatchAddFacetToObject
forall x. BatchAddFacetToObject -> Rep BatchAddFacetToObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchAddFacetToObject x -> BatchAddFacetToObject
$cfrom :: forall x. BatchAddFacetToObject -> Rep BatchAddFacetToObject x
Prelude.Generic)

-- |
-- Create a value of 'BatchAddFacetToObject' 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:
--
-- 'schemaFacet', 'batchAddFacetToObject_schemaFacet' - Represents the facet being added to the object.
--
-- 'objectAttributeList', 'batchAddFacetToObject_objectAttributeList' - The attributes to set on the object.
--
-- 'objectReference', 'batchAddFacetToObject_objectReference' - A reference to the object being mutated.
newBatchAddFacetToObject ::
  -- | 'schemaFacet'
  SchemaFacet ->
  -- | 'objectReference'
  ObjectReference ->
  BatchAddFacetToObject
newBatchAddFacetToObject :: SchemaFacet -> ObjectReference -> BatchAddFacetToObject
newBatchAddFacetToObject
  SchemaFacet
pSchemaFacet_
  ObjectReference
pObjectReference_ =
    BatchAddFacetToObject' :: SchemaFacet
-> [AttributeKeyAndValue]
-> ObjectReference
-> BatchAddFacetToObject
BatchAddFacetToObject'
      { $sel:schemaFacet:BatchAddFacetToObject' :: SchemaFacet
schemaFacet = SchemaFacet
pSchemaFacet_,
        $sel:objectAttributeList:BatchAddFacetToObject' :: [AttributeKeyAndValue]
objectAttributeList = [AttributeKeyAndValue]
forall a. Monoid a => a
Prelude.mempty,
        $sel:objectReference:BatchAddFacetToObject' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
      }

-- | Represents the facet being added to the object.
batchAddFacetToObject_schemaFacet :: Lens.Lens' BatchAddFacetToObject SchemaFacet
batchAddFacetToObject_schemaFacet :: (SchemaFacet -> f SchemaFacet)
-> BatchAddFacetToObject -> f BatchAddFacetToObject
batchAddFacetToObject_schemaFacet = (BatchAddFacetToObject -> SchemaFacet)
-> (BatchAddFacetToObject -> SchemaFacet -> BatchAddFacetToObject)
-> Lens
     BatchAddFacetToObject BatchAddFacetToObject SchemaFacet SchemaFacet
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchAddFacetToObject' {SchemaFacet
schemaFacet :: SchemaFacet
$sel:schemaFacet:BatchAddFacetToObject' :: BatchAddFacetToObject -> SchemaFacet
schemaFacet} -> SchemaFacet
schemaFacet) (\s :: BatchAddFacetToObject
s@BatchAddFacetToObject' {} SchemaFacet
a -> BatchAddFacetToObject
s {$sel:schemaFacet:BatchAddFacetToObject' :: SchemaFacet
schemaFacet = SchemaFacet
a} :: BatchAddFacetToObject)

-- | The attributes to set on the object.
batchAddFacetToObject_objectAttributeList :: Lens.Lens' BatchAddFacetToObject [AttributeKeyAndValue]
batchAddFacetToObject_objectAttributeList :: ([AttributeKeyAndValue] -> f [AttributeKeyAndValue])
-> BatchAddFacetToObject -> f BatchAddFacetToObject
batchAddFacetToObject_objectAttributeList = (BatchAddFacetToObject -> [AttributeKeyAndValue])
-> (BatchAddFacetToObject
    -> [AttributeKeyAndValue] -> BatchAddFacetToObject)
-> Lens
     BatchAddFacetToObject
     BatchAddFacetToObject
     [AttributeKeyAndValue]
     [AttributeKeyAndValue]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchAddFacetToObject' {[AttributeKeyAndValue]
objectAttributeList :: [AttributeKeyAndValue]
$sel:objectAttributeList:BatchAddFacetToObject' :: BatchAddFacetToObject -> [AttributeKeyAndValue]
objectAttributeList} -> [AttributeKeyAndValue]
objectAttributeList) (\s :: BatchAddFacetToObject
s@BatchAddFacetToObject' {} [AttributeKeyAndValue]
a -> BatchAddFacetToObject
s {$sel:objectAttributeList:BatchAddFacetToObject' :: [AttributeKeyAndValue]
objectAttributeList = [AttributeKeyAndValue]
a} :: BatchAddFacetToObject) (([AttributeKeyAndValue] -> f [AttributeKeyAndValue])
 -> BatchAddFacetToObject -> f BatchAddFacetToObject)
-> (([AttributeKeyAndValue] -> f [AttributeKeyAndValue])
    -> [AttributeKeyAndValue] -> f [AttributeKeyAndValue])
-> ([AttributeKeyAndValue] -> f [AttributeKeyAndValue])
-> BatchAddFacetToObject
-> f BatchAddFacetToObject
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AttributeKeyAndValue] -> f [AttributeKeyAndValue])
-> [AttributeKeyAndValue] -> f [AttributeKeyAndValue]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A reference to the object being mutated.
batchAddFacetToObject_objectReference :: Lens.Lens' BatchAddFacetToObject ObjectReference
batchAddFacetToObject_objectReference :: (ObjectReference -> f ObjectReference)
-> BatchAddFacetToObject -> f BatchAddFacetToObject
batchAddFacetToObject_objectReference = (BatchAddFacetToObject -> ObjectReference)
-> (BatchAddFacetToObject
    -> ObjectReference -> BatchAddFacetToObject)
-> Lens
     BatchAddFacetToObject
     BatchAddFacetToObject
     ObjectReference
     ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchAddFacetToObject' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:BatchAddFacetToObject' :: BatchAddFacetToObject -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: BatchAddFacetToObject
s@BatchAddFacetToObject' {} ObjectReference
a -> BatchAddFacetToObject
s {$sel:objectReference:BatchAddFacetToObject' :: ObjectReference
objectReference = ObjectReference
a} :: BatchAddFacetToObject)

instance Prelude.Hashable BatchAddFacetToObject

instance Prelude.NFData BatchAddFacetToObject

instance Core.ToJSON BatchAddFacetToObject where
  toJSON :: BatchAddFacetToObject -> Value
toJSON BatchAddFacetToObject' {[AttributeKeyAndValue]
ObjectReference
SchemaFacet
objectReference :: ObjectReference
objectAttributeList :: [AttributeKeyAndValue]
schemaFacet :: SchemaFacet
$sel:objectReference:BatchAddFacetToObject' :: BatchAddFacetToObject -> ObjectReference
$sel:objectAttributeList:BatchAddFacetToObject' :: BatchAddFacetToObject -> [AttributeKeyAndValue]
$sel:schemaFacet:BatchAddFacetToObject' :: BatchAddFacetToObject -> SchemaFacet
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SchemaFacet" Text -> SchemaFacet -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SchemaFacet
schemaFacet),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ObjectAttributeList" Text -> [AttributeKeyAndValue] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [AttributeKeyAndValue]
objectAttributeList),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ObjectReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
objectReference)
          ]
      )