{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CloudDirectory.AddFacetToObject
(
AddFacetToObject (..),
newAddFacetToObject,
addFacetToObject_objectAttributeList,
addFacetToObject_directoryArn,
addFacetToObject_schemaFacet,
addFacetToObject_objectReference,
AddFacetToObjectResponse (..),
newAddFacetToObjectResponse,
addFacetToObjectResponse_httpStatus,
)
where
import Amazonka.CloudDirectory.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AddFacetToObject = AddFacetToObject'
{
AddFacetToObject -> Maybe [AttributeKeyAndValue]
objectAttributeList :: Prelude.Maybe [AttributeKeyAndValue],
AddFacetToObject -> Text
directoryArn :: Prelude.Text,
AddFacetToObject -> SchemaFacet
schemaFacet :: SchemaFacet,
AddFacetToObject -> ObjectReference
objectReference :: ObjectReference
}
deriving (AddFacetToObject -> AddFacetToObject -> Bool
(AddFacetToObject -> AddFacetToObject -> Bool)
-> (AddFacetToObject -> AddFacetToObject -> Bool)
-> Eq AddFacetToObject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddFacetToObject -> AddFacetToObject -> Bool
$c/= :: AddFacetToObject -> AddFacetToObject -> Bool
== :: AddFacetToObject -> AddFacetToObject -> Bool
$c== :: AddFacetToObject -> AddFacetToObject -> Bool
Prelude.Eq, ReadPrec [AddFacetToObject]
ReadPrec AddFacetToObject
Int -> ReadS AddFacetToObject
ReadS [AddFacetToObject]
(Int -> ReadS AddFacetToObject)
-> ReadS [AddFacetToObject]
-> ReadPrec AddFacetToObject
-> ReadPrec [AddFacetToObject]
-> Read AddFacetToObject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddFacetToObject]
$creadListPrec :: ReadPrec [AddFacetToObject]
readPrec :: ReadPrec AddFacetToObject
$creadPrec :: ReadPrec AddFacetToObject
readList :: ReadS [AddFacetToObject]
$creadList :: ReadS [AddFacetToObject]
readsPrec :: Int -> ReadS AddFacetToObject
$creadsPrec :: Int -> ReadS AddFacetToObject
Prelude.Read, Int -> AddFacetToObject -> ShowS
[AddFacetToObject] -> ShowS
AddFacetToObject -> String
(Int -> AddFacetToObject -> ShowS)
-> (AddFacetToObject -> String)
-> ([AddFacetToObject] -> ShowS)
-> Show AddFacetToObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddFacetToObject] -> ShowS
$cshowList :: [AddFacetToObject] -> ShowS
show :: AddFacetToObject -> String
$cshow :: AddFacetToObject -> String
showsPrec :: Int -> AddFacetToObject -> ShowS
$cshowsPrec :: Int -> AddFacetToObject -> ShowS
Prelude.Show, (forall x. AddFacetToObject -> Rep AddFacetToObject x)
-> (forall x. Rep AddFacetToObject x -> AddFacetToObject)
-> Generic AddFacetToObject
forall x. Rep AddFacetToObject x -> AddFacetToObject
forall x. AddFacetToObject -> Rep AddFacetToObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddFacetToObject x -> AddFacetToObject
$cfrom :: forall x. AddFacetToObject -> Rep AddFacetToObject x
Prelude.Generic)
newAddFacetToObject ::
Prelude.Text ->
SchemaFacet ->
ObjectReference ->
AddFacetToObject
newAddFacetToObject :: Text -> SchemaFacet -> ObjectReference -> AddFacetToObject
newAddFacetToObject
Text
pDirectoryArn_
SchemaFacet
pSchemaFacet_
ObjectReference
pObjectReference_ =
AddFacetToObject' :: Maybe [AttributeKeyAndValue]
-> Text -> SchemaFacet -> ObjectReference -> AddFacetToObject
AddFacetToObject'
{ $sel:objectAttributeList:AddFacetToObject' :: Maybe [AttributeKeyAndValue]
objectAttributeList =
Maybe [AttributeKeyAndValue]
forall a. Maybe a
Prelude.Nothing,
$sel:directoryArn:AddFacetToObject' :: Text
directoryArn = Text
pDirectoryArn_,
$sel:schemaFacet:AddFacetToObject' :: SchemaFacet
schemaFacet = SchemaFacet
pSchemaFacet_,
$sel:objectReference:AddFacetToObject' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
}
addFacetToObject_objectAttributeList :: Lens.Lens' AddFacetToObject (Prelude.Maybe [AttributeKeyAndValue])
addFacetToObject_objectAttributeList :: (Maybe [AttributeKeyAndValue] -> f (Maybe [AttributeKeyAndValue]))
-> AddFacetToObject -> f AddFacetToObject
addFacetToObject_objectAttributeList = (AddFacetToObject -> Maybe [AttributeKeyAndValue])
-> (AddFacetToObject
-> Maybe [AttributeKeyAndValue] -> AddFacetToObject)
-> Lens
AddFacetToObject
AddFacetToObject
(Maybe [AttributeKeyAndValue])
(Maybe [AttributeKeyAndValue])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddFacetToObject' {Maybe [AttributeKeyAndValue]
objectAttributeList :: Maybe [AttributeKeyAndValue]
$sel:objectAttributeList:AddFacetToObject' :: AddFacetToObject -> Maybe [AttributeKeyAndValue]
objectAttributeList} -> Maybe [AttributeKeyAndValue]
objectAttributeList) (\s :: AddFacetToObject
s@AddFacetToObject' {} Maybe [AttributeKeyAndValue]
a -> AddFacetToObject
s {$sel:objectAttributeList:AddFacetToObject' :: Maybe [AttributeKeyAndValue]
objectAttributeList = Maybe [AttributeKeyAndValue]
a} :: AddFacetToObject) ((Maybe [AttributeKeyAndValue] -> f (Maybe [AttributeKeyAndValue]))
-> AddFacetToObject -> f AddFacetToObject)
-> ((Maybe [AttributeKeyAndValue]
-> f (Maybe [AttributeKeyAndValue]))
-> Maybe [AttributeKeyAndValue]
-> f (Maybe [AttributeKeyAndValue]))
-> (Maybe [AttributeKeyAndValue]
-> f (Maybe [AttributeKeyAndValue]))
-> AddFacetToObject
-> f AddFacetToObject
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AttributeKeyAndValue]
[AttributeKeyAndValue]
[AttributeKeyAndValue]
[AttributeKeyAndValue]
-> Iso
(Maybe [AttributeKeyAndValue])
(Maybe [AttributeKeyAndValue])
(Maybe [AttributeKeyAndValue])
(Maybe [AttributeKeyAndValue])
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 AnIso
[AttributeKeyAndValue]
[AttributeKeyAndValue]
[AttributeKeyAndValue]
[AttributeKeyAndValue]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
addFacetToObject_directoryArn :: Lens.Lens' AddFacetToObject Prelude.Text
addFacetToObject_directoryArn :: (Text -> f Text) -> AddFacetToObject -> f AddFacetToObject
addFacetToObject_directoryArn = (AddFacetToObject -> Text)
-> (AddFacetToObject -> Text -> AddFacetToObject)
-> Lens AddFacetToObject AddFacetToObject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddFacetToObject' {Text
directoryArn :: Text
$sel:directoryArn:AddFacetToObject' :: AddFacetToObject -> Text
directoryArn} -> Text
directoryArn) (\s :: AddFacetToObject
s@AddFacetToObject' {} Text
a -> AddFacetToObject
s {$sel:directoryArn:AddFacetToObject' :: Text
directoryArn = Text
a} :: AddFacetToObject)
addFacetToObject_schemaFacet :: Lens.Lens' AddFacetToObject SchemaFacet
addFacetToObject_schemaFacet :: (SchemaFacet -> f SchemaFacet)
-> AddFacetToObject -> f AddFacetToObject
addFacetToObject_schemaFacet = (AddFacetToObject -> SchemaFacet)
-> (AddFacetToObject -> SchemaFacet -> AddFacetToObject)
-> Lens AddFacetToObject AddFacetToObject SchemaFacet SchemaFacet
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddFacetToObject' {SchemaFacet
schemaFacet :: SchemaFacet
$sel:schemaFacet:AddFacetToObject' :: AddFacetToObject -> SchemaFacet
schemaFacet} -> SchemaFacet
schemaFacet) (\s :: AddFacetToObject
s@AddFacetToObject' {} SchemaFacet
a -> AddFacetToObject
s {$sel:schemaFacet:AddFacetToObject' :: SchemaFacet
schemaFacet = SchemaFacet
a} :: AddFacetToObject)
addFacetToObject_objectReference :: Lens.Lens' AddFacetToObject ObjectReference
addFacetToObject_objectReference :: (ObjectReference -> f ObjectReference)
-> AddFacetToObject -> f AddFacetToObject
addFacetToObject_objectReference = (AddFacetToObject -> ObjectReference)
-> (AddFacetToObject -> ObjectReference -> AddFacetToObject)
-> Lens
AddFacetToObject AddFacetToObject ObjectReference ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddFacetToObject' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:AddFacetToObject' :: AddFacetToObject -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: AddFacetToObject
s@AddFacetToObject' {} ObjectReference
a -> AddFacetToObject
s {$sel:objectReference:AddFacetToObject' :: ObjectReference
objectReference = ObjectReference
a} :: AddFacetToObject)
instance Core.AWSRequest AddFacetToObject where
type
AWSResponse AddFacetToObject =
AddFacetToObjectResponse
request :: AddFacetToObject -> Request AddFacetToObject
request = Service -> AddFacetToObject -> Request AddFacetToObject
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddFacetToObject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddFacetToObject)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AddFacetToObject))
-> Logger
-> Service
-> Proxy AddFacetToObject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddFacetToObject)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AddFacetToObjectResponse
AddFacetToObjectResponse'
(Int -> AddFacetToObjectResponse)
-> Either String Int -> Either String AddFacetToObjectResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable AddFacetToObject
instance Prelude.NFData AddFacetToObject
instance Core.ToHeaders AddFacetToObject where
toHeaders :: AddFacetToObject -> ResponseHeaders
toHeaders AddFacetToObject' {Maybe [AttributeKeyAndValue]
Text
ObjectReference
SchemaFacet
objectReference :: ObjectReference
schemaFacet :: SchemaFacet
directoryArn :: Text
objectAttributeList :: Maybe [AttributeKeyAndValue]
$sel:objectReference:AddFacetToObject' :: AddFacetToObject -> ObjectReference
$sel:schemaFacet:AddFacetToObject' :: AddFacetToObject -> SchemaFacet
$sel:directoryArn:AddFacetToObject' :: AddFacetToObject -> Text
$sel:objectAttributeList:AddFacetToObject' :: AddFacetToObject -> Maybe [AttributeKeyAndValue]
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-data-partition" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
directoryArn]
instance Core.ToJSON AddFacetToObject where
toJSON :: AddFacetToObject -> Value
toJSON AddFacetToObject' {Maybe [AttributeKeyAndValue]
Text
ObjectReference
SchemaFacet
objectReference :: ObjectReference
schemaFacet :: SchemaFacet
directoryArn :: Text
objectAttributeList :: Maybe [AttributeKeyAndValue]
$sel:objectReference:AddFacetToObject' :: AddFacetToObject -> ObjectReference
$sel:schemaFacet:AddFacetToObject' :: AddFacetToObject -> SchemaFacet
$sel:directoryArn:AddFacetToObject' :: AddFacetToObject -> Text
$sel:objectAttributeList:AddFacetToObject' :: AddFacetToObject -> Maybe [AttributeKeyAndValue]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ObjectAttributeList" Text -> [AttributeKeyAndValue] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([AttributeKeyAndValue] -> Pair)
-> Maybe [AttributeKeyAndValue] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AttributeKeyAndValue]
objectAttributeList,
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
"ObjectReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
objectReference)
]
)
instance Core.ToPath AddFacetToObject where
toPath :: AddFacetToObject -> ByteString
toPath =
ByteString -> AddFacetToObject -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/object/facets"
instance Core.ToQuery AddFacetToObject where
toQuery :: AddFacetToObject -> QueryString
toQuery = QueryString -> AddFacetToObject -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddFacetToObjectResponse = AddFacetToObjectResponse'
{
AddFacetToObjectResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddFacetToObjectResponse -> AddFacetToObjectResponse -> Bool
(AddFacetToObjectResponse -> AddFacetToObjectResponse -> Bool)
-> (AddFacetToObjectResponse -> AddFacetToObjectResponse -> Bool)
-> Eq AddFacetToObjectResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddFacetToObjectResponse -> AddFacetToObjectResponse -> Bool
$c/= :: AddFacetToObjectResponse -> AddFacetToObjectResponse -> Bool
== :: AddFacetToObjectResponse -> AddFacetToObjectResponse -> Bool
$c== :: AddFacetToObjectResponse -> AddFacetToObjectResponse -> Bool
Prelude.Eq, ReadPrec [AddFacetToObjectResponse]
ReadPrec AddFacetToObjectResponse
Int -> ReadS AddFacetToObjectResponse
ReadS [AddFacetToObjectResponse]
(Int -> ReadS AddFacetToObjectResponse)
-> ReadS [AddFacetToObjectResponse]
-> ReadPrec AddFacetToObjectResponse
-> ReadPrec [AddFacetToObjectResponse]
-> Read AddFacetToObjectResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddFacetToObjectResponse]
$creadListPrec :: ReadPrec [AddFacetToObjectResponse]
readPrec :: ReadPrec AddFacetToObjectResponse
$creadPrec :: ReadPrec AddFacetToObjectResponse
readList :: ReadS [AddFacetToObjectResponse]
$creadList :: ReadS [AddFacetToObjectResponse]
readsPrec :: Int -> ReadS AddFacetToObjectResponse
$creadsPrec :: Int -> ReadS AddFacetToObjectResponse
Prelude.Read, Int -> AddFacetToObjectResponse -> ShowS
[AddFacetToObjectResponse] -> ShowS
AddFacetToObjectResponse -> String
(Int -> AddFacetToObjectResponse -> ShowS)
-> (AddFacetToObjectResponse -> String)
-> ([AddFacetToObjectResponse] -> ShowS)
-> Show AddFacetToObjectResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddFacetToObjectResponse] -> ShowS
$cshowList :: [AddFacetToObjectResponse] -> ShowS
show :: AddFacetToObjectResponse -> String
$cshow :: AddFacetToObjectResponse -> String
showsPrec :: Int -> AddFacetToObjectResponse -> ShowS
$cshowsPrec :: Int -> AddFacetToObjectResponse -> ShowS
Prelude.Show, (forall x.
AddFacetToObjectResponse -> Rep AddFacetToObjectResponse x)
-> (forall x.
Rep AddFacetToObjectResponse x -> AddFacetToObjectResponse)
-> Generic AddFacetToObjectResponse
forall x.
Rep AddFacetToObjectResponse x -> AddFacetToObjectResponse
forall x.
AddFacetToObjectResponse -> Rep AddFacetToObjectResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddFacetToObjectResponse x -> AddFacetToObjectResponse
$cfrom :: forall x.
AddFacetToObjectResponse -> Rep AddFacetToObjectResponse x
Prelude.Generic)
newAddFacetToObjectResponse ::
Prelude.Int ->
AddFacetToObjectResponse
newAddFacetToObjectResponse :: Int -> AddFacetToObjectResponse
newAddFacetToObjectResponse Int
pHttpStatus_ =
AddFacetToObjectResponse' :: Int -> AddFacetToObjectResponse
AddFacetToObjectResponse'
{ $sel:httpStatus:AddFacetToObjectResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
addFacetToObjectResponse_httpStatus :: Lens.Lens' AddFacetToObjectResponse Prelude.Int
addFacetToObjectResponse_httpStatus :: (Int -> f Int)
-> AddFacetToObjectResponse -> f AddFacetToObjectResponse
addFacetToObjectResponse_httpStatus = (AddFacetToObjectResponse -> Int)
-> (AddFacetToObjectResponse -> Int -> AddFacetToObjectResponse)
-> Lens AddFacetToObjectResponse AddFacetToObjectResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddFacetToObjectResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddFacetToObjectResponse' :: AddFacetToObjectResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddFacetToObjectResponse
s@AddFacetToObjectResponse' {} Int
a -> AddFacetToObjectResponse
s {$sel:httpStatus:AddFacetToObjectResponse' :: Int
httpStatus = Int
a} :: AddFacetToObjectResponse)
instance Prelude.NFData AddFacetToObjectResponse