{-# 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.BatchCreateObject
-- 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.BatchCreateObject 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Represents the output of a CreateObject operation.
--
-- /See:/ 'newBatchCreateObject' smart constructor.
data BatchCreateObject = BatchCreateObject'
  { -- | The batch reference name. See
    -- <https://docs.aws.amazon.com/clouddirectory/latest/developerguide/transaction_support.html Transaction Support>
    -- for more information.
    BatchCreateObject -> Maybe Text
batchReferenceName :: Prelude.Maybe Prelude.Text,
    -- | The name of the link.
    BatchCreateObject -> Maybe Text
linkName :: Prelude.Maybe Prelude.Text,
    -- | If specified, the parent reference to which this object will be
    -- attached.
    BatchCreateObject -> Maybe ObjectReference
parentReference :: Prelude.Maybe ObjectReference,
    -- | A list of @FacetArns@ that will be associated with the object. For more
    -- information, see arns.
    BatchCreateObject -> [SchemaFacet]
schemaFacet :: [SchemaFacet],
    -- | An attribute map, which contains an attribute ARN as the key and
    -- attribute value as the map value.
    BatchCreateObject -> [AttributeKeyAndValue]
objectAttributeList :: [AttributeKeyAndValue]
  }
  deriving (BatchCreateObject -> BatchCreateObject -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateObject -> BatchCreateObject -> Bool
$c/= :: BatchCreateObject -> BatchCreateObject -> Bool
== :: BatchCreateObject -> BatchCreateObject -> Bool
$c== :: BatchCreateObject -> BatchCreateObject -> Bool
Prelude.Eq, ReadPrec [BatchCreateObject]
ReadPrec BatchCreateObject
Int -> ReadS BatchCreateObject
ReadS [BatchCreateObject]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchCreateObject]
$creadListPrec :: ReadPrec [BatchCreateObject]
readPrec :: ReadPrec BatchCreateObject
$creadPrec :: ReadPrec BatchCreateObject
readList :: ReadS [BatchCreateObject]
$creadList :: ReadS [BatchCreateObject]
readsPrec :: Int -> ReadS BatchCreateObject
$creadsPrec :: Int -> ReadS BatchCreateObject
Prelude.Read, Int -> BatchCreateObject -> ShowS
[BatchCreateObject] -> ShowS
BatchCreateObject -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateObject] -> ShowS
$cshowList :: [BatchCreateObject] -> ShowS
show :: BatchCreateObject -> String
$cshow :: BatchCreateObject -> String
showsPrec :: Int -> BatchCreateObject -> ShowS
$cshowsPrec :: Int -> BatchCreateObject -> ShowS
Prelude.Show, forall x. Rep BatchCreateObject x -> BatchCreateObject
forall x. BatchCreateObject -> Rep BatchCreateObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchCreateObject x -> BatchCreateObject
$cfrom :: forall x. BatchCreateObject -> Rep BatchCreateObject x
Prelude.Generic)

-- |
-- Create a value of 'BatchCreateObject' 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:
--
-- 'batchReferenceName', 'batchCreateObject_batchReferenceName' - The batch reference name. See
-- <https://docs.aws.amazon.com/clouddirectory/latest/developerguide/transaction_support.html Transaction Support>
-- for more information.
--
-- 'linkName', 'batchCreateObject_linkName' - The name of the link.
--
-- 'parentReference', 'batchCreateObject_parentReference' - If specified, the parent reference to which this object will be
-- attached.
--
-- 'schemaFacet', 'batchCreateObject_schemaFacet' - A list of @FacetArns@ that will be associated with the object. For more
-- information, see arns.
--
-- 'objectAttributeList', 'batchCreateObject_objectAttributeList' - An attribute map, which contains an attribute ARN as the key and
-- attribute value as the map value.
newBatchCreateObject ::
  BatchCreateObject
newBatchCreateObject :: BatchCreateObject
newBatchCreateObject =
  BatchCreateObject'
    { $sel:batchReferenceName:BatchCreateObject' :: Maybe Text
batchReferenceName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:linkName:BatchCreateObject' :: Maybe Text
linkName = forall a. Maybe a
Prelude.Nothing,
      $sel:parentReference:BatchCreateObject' :: Maybe ObjectReference
parentReference = forall a. Maybe a
Prelude.Nothing,
      $sel:schemaFacet:BatchCreateObject' :: [SchemaFacet]
schemaFacet = forall a. Monoid a => a
Prelude.mempty,
      $sel:objectAttributeList:BatchCreateObject' :: [AttributeKeyAndValue]
objectAttributeList = forall a. Monoid a => a
Prelude.mempty
    }

-- | The batch reference name. See
-- <https://docs.aws.amazon.com/clouddirectory/latest/developerguide/transaction_support.html Transaction Support>
-- for more information.
batchCreateObject_batchReferenceName :: Lens.Lens' BatchCreateObject (Prelude.Maybe Prelude.Text)
batchCreateObject_batchReferenceName :: Lens' BatchCreateObject (Maybe Text)
batchCreateObject_batchReferenceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateObject' {Maybe Text
batchReferenceName :: Maybe Text
$sel:batchReferenceName:BatchCreateObject' :: BatchCreateObject -> Maybe Text
batchReferenceName} -> Maybe Text
batchReferenceName) (\s :: BatchCreateObject
s@BatchCreateObject' {} Maybe Text
a -> BatchCreateObject
s {$sel:batchReferenceName:BatchCreateObject' :: Maybe Text
batchReferenceName = Maybe Text
a} :: BatchCreateObject)

-- | The name of the link.
batchCreateObject_linkName :: Lens.Lens' BatchCreateObject (Prelude.Maybe Prelude.Text)
batchCreateObject_linkName :: Lens' BatchCreateObject (Maybe Text)
batchCreateObject_linkName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateObject' {Maybe Text
linkName :: Maybe Text
$sel:linkName:BatchCreateObject' :: BatchCreateObject -> Maybe Text
linkName} -> Maybe Text
linkName) (\s :: BatchCreateObject
s@BatchCreateObject' {} Maybe Text
a -> BatchCreateObject
s {$sel:linkName:BatchCreateObject' :: Maybe Text
linkName = Maybe Text
a} :: BatchCreateObject)

-- | If specified, the parent reference to which this object will be
-- attached.
batchCreateObject_parentReference :: Lens.Lens' BatchCreateObject (Prelude.Maybe ObjectReference)
batchCreateObject_parentReference :: Lens' BatchCreateObject (Maybe ObjectReference)
batchCreateObject_parentReference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateObject' {Maybe ObjectReference
parentReference :: Maybe ObjectReference
$sel:parentReference:BatchCreateObject' :: BatchCreateObject -> Maybe ObjectReference
parentReference} -> Maybe ObjectReference
parentReference) (\s :: BatchCreateObject
s@BatchCreateObject' {} Maybe ObjectReference
a -> BatchCreateObject
s {$sel:parentReference:BatchCreateObject' :: Maybe ObjectReference
parentReference = Maybe ObjectReference
a} :: BatchCreateObject)

-- | A list of @FacetArns@ that will be associated with the object. For more
-- information, see arns.
batchCreateObject_schemaFacet :: Lens.Lens' BatchCreateObject [SchemaFacet]
batchCreateObject_schemaFacet :: Lens' BatchCreateObject [SchemaFacet]
batchCreateObject_schemaFacet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateObject' {[SchemaFacet]
schemaFacet :: [SchemaFacet]
$sel:schemaFacet:BatchCreateObject' :: BatchCreateObject -> [SchemaFacet]
schemaFacet} -> [SchemaFacet]
schemaFacet) (\s :: BatchCreateObject
s@BatchCreateObject' {} [SchemaFacet]
a -> BatchCreateObject
s {$sel:schemaFacet:BatchCreateObject' :: [SchemaFacet]
schemaFacet = [SchemaFacet]
a} :: BatchCreateObject) 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

-- | An attribute map, which contains an attribute ARN as the key and
-- attribute value as the map value.
batchCreateObject_objectAttributeList :: Lens.Lens' BatchCreateObject [AttributeKeyAndValue]
batchCreateObject_objectAttributeList :: Lens' BatchCreateObject [AttributeKeyAndValue]
batchCreateObject_objectAttributeList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateObject' {[AttributeKeyAndValue]
objectAttributeList :: [AttributeKeyAndValue]
$sel:objectAttributeList:BatchCreateObject' :: BatchCreateObject -> [AttributeKeyAndValue]
objectAttributeList} -> [AttributeKeyAndValue]
objectAttributeList) (\s :: BatchCreateObject
s@BatchCreateObject' {} [AttributeKeyAndValue]
a -> BatchCreateObject
s {$sel:objectAttributeList:BatchCreateObject' :: [AttributeKeyAndValue]
objectAttributeList = [AttributeKeyAndValue]
a} :: BatchCreateObject) 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 BatchCreateObject where
  hashWithSalt :: Int -> BatchCreateObject -> Int
hashWithSalt Int
_salt BatchCreateObject' {[SchemaFacet]
[AttributeKeyAndValue]
Maybe Text
Maybe ObjectReference
objectAttributeList :: [AttributeKeyAndValue]
schemaFacet :: [SchemaFacet]
parentReference :: Maybe ObjectReference
linkName :: Maybe Text
batchReferenceName :: Maybe Text
$sel:objectAttributeList:BatchCreateObject' :: BatchCreateObject -> [AttributeKeyAndValue]
$sel:schemaFacet:BatchCreateObject' :: BatchCreateObject -> [SchemaFacet]
$sel:parentReference:BatchCreateObject' :: BatchCreateObject -> Maybe ObjectReference
$sel:linkName:BatchCreateObject' :: BatchCreateObject -> Maybe Text
$sel:batchReferenceName:BatchCreateObject' :: BatchCreateObject -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
batchReferenceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
linkName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ObjectReference
parentReference
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [SchemaFacet]
schemaFacet
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [AttributeKeyAndValue]
objectAttributeList

instance Prelude.NFData BatchCreateObject where
  rnf :: BatchCreateObject -> ()
rnf BatchCreateObject' {[SchemaFacet]
[AttributeKeyAndValue]
Maybe Text
Maybe ObjectReference
objectAttributeList :: [AttributeKeyAndValue]
schemaFacet :: [SchemaFacet]
parentReference :: Maybe ObjectReference
linkName :: Maybe Text
batchReferenceName :: Maybe Text
$sel:objectAttributeList:BatchCreateObject' :: BatchCreateObject -> [AttributeKeyAndValue]
$sel:schemaFacet:BatchCreateObject' :: BatchCreateObject -> [SchemaFacet]
$sel:parentReference:BatchCreateObject' :: BatchCreateObject -> Maybe ObjectReference
$sel:linkName:BatchCreateObject' :: BatchCreateObject -> Maybe Text
$sel:batchReferenceName:BatchCreateObject' :: BatchCreateObject -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
batchReferenceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
linkName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ObjectReference
parentReference
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [SchemaFacet]
schemaFacet
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [AttributeKeyAndValue]
objectAttributeList

instance Data.ToJSON BatchCreateObject where
  toJSON :: BatchCreateObject -> Value
toJSON BatchCreateObject' {[SchemaFacet]
[AttributeKeyAndValue]
Maybe Text
Maybe ObjectReference
objectAttributeList :: [AttributeKeyAndValue]
schemaFacet :: [SchemaFacet]
parentReference :: Maybe ObjectReference
linkName :: Maybe Text
batchReferenceName :: Maybe Text
$sel:objectAttributeList:BatchCreateObject' :: BatchCreateObject -> [AttributeKeyAndValue]
$sel:schemaFacet:BatchCreateObject' :: BatchCreateObject -> [SchemaFacet]
$sel:parentReference:BatchCreateObject' :: BatchCreateObject -> Maybe ObjectReference
$sel:linkName:BatchCreateObject' :: BatchCreateObject -> Maybe Text
$sel:batchReferenceName:BatchCreateObject' :: BatchCreateObject -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"BatchReferenceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
batchReferenceName,
            (Key
"LinkName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
linkName,
            (Key
"ParentReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ObjectReference
parentReference,
            forall a. a -> Maybe a
Prelude.Just (Key
"SchemaFacet" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [SchemaFacet]
schemaFacet),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ObjectAttributeList" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [AttributeKeyAndValue]
objectAttributeList)
          ]
      )