module Network.AWS.CloudDirectory.AttachTypedLink
(
attachTypedLink
, AttachTypedLink
, atlDirectoryARN
, atlSourceObjectReference
, atlTargetObjectReference
, atlTypedLinkFacet
, atlAttributes
, attachTypedLinkResponse
, AttachTypedLinkResponse
, atlrsTypedLinkSpecifier
, atlrsResponseStatus
) where
import Network.AWS.CloudDirectory.Types
import Network.AWS.CloudDirectory.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data AttachTypedLink = AttachTypedLink'
{ _atlDirectoryARN :: !Text
, _atlSourceObjectReference :: !ObjectReference
, _atlTargetObjectReference :: !ObjectReference
, _atlTypedLinkFacet :: !TypedLinkSchemaAndFacetName
, _atlAttributes :: ![AttributeNameAndValue]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
attachTypedLink
:: Text
-> ObjectReference
-> ObjectReference
-> TypedLinkSchemaAndFacetName
-> AttachTypedLink
attachTypedLink pDirectoryARN_ pSourceObjectReference_ pTargetObjectReference_ pTypedLinkFacet_ =
AttachTypedLink'
{ _atlDirectoryARN = pDirectoryARN_
, _atlSourceObjectReference = pSourceObjectReference_
, _atlTargetObjectReference = pTargetObjectReference_
, _atlTypedLinkFacet = pTypedLinkFacet_
, _atlAttributes = mempty
}
atlDirectoryARN :: Lens' AttachTypedLink Text
atlDirectoryARN = lens _atlDirectoryARN (\ s a -> s{_atlDirectoryARN = a});
atlSourceObjectReference :: Lens' AttachTypedLink ObjectReference
atlSourceObjectReference = lens _atlSourceObjectReference (\ s a -> s{_atlSourceObjectReference = a});
atlTargetObjectReference :: Lens' AttachTypedLink ObjectReference
atlTargetObjectReference = lens _atlTargetObjectReference (\ s a -> s{_atlTargetObjectReference = a});
atlTypedLinkFacet :: Lens' AttachTypedLink TypedLinkSchemaAndFacetName
atlTypedLinkFacet = lens _atlTypedLinkFacet (\ s a -> s{_atlTypedLinkFacet = a});
atlAttributes :: Lens' AttachTypedLink [AttributeNameAndValue]
atlAttributes = lens _atlAttributes (\ s a -> s{_atlAttributes = a}) . _Coerce;
instance AWSRequest AttachTypedLink where
type Rs AttachTypedLink = AttachTypedLinkResponse
request = putJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
AttachTypedLinkResponse' <$>
(x .?> "TypedLinkSpecifier") <*> (pure (fromEnum s)))
instance Hashable AttachTypedLink where
instance NFData AttachTypedLink where
instance ToHeaders AttachTypedLink where
toHeaders AttachTypedLink'{..}
= mconcat
["x-amz-data-partition" =# _atlDirectoryARN]
instance ToJSON AttachTypedLink where
toJSON AttachTypedLink'{..}
= object
(catMaybes
[Just
("SourceObjectReference" .=
_atlSourceObjectReference),
Just
("TargetObjectReference" .=
_atlTargetObjectReference),
Just ("TypedLinkFacet" .= _atlTypedLinkFacet),
Just ("Attributes" .= _atlAttributes)])
instance ToPath AttachTypedLink where
toPath
= const
"/amazonclouddirectory/2017-01-11/typedlink/attach"
instance ToQuery AttachTypedLink where
toQuery = const mempty
data AttachTypedLinkResponse = AttachTypedLinkResponse'
{ _atlrsTypedLinkSpecifier :: !(Maybe TypedLinkSpecifier)
, _atlrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
attachTypedLinkResponse
:: Int
-> AttachTypedLinkResponse
attachTypedLinkResponse pResponseStatus_ =
AttachTypedLinkResponse'
{_atlrsTypedLinkSpecifier = Nothing, _atlrsResponseStatus = pResponseStatus_}
atlrsTypedLinkSpecifier :: Lens' AttachTypedLinkResponse (Maybe TypedLinkSpecifier)
atlrsTypedLinkSpecifier = lens _atlrsTypedLinkSpecifier (\ s a -> s{_atlrsTypedLinkSpecifier = a});
atlrsResponseStatus :: Lens' AttachTypedLinkResponse Int
atlrsResponseStatus = lens _atlrsResponseStatus (\ s a -> s{_atlrsResponseStatus = a});
instance NFData AttachTypedLinkResponse where