module Network.AWS.CloudDirectory.AttachObject
(
attachObject
, AttachObject
, aoDirectoryARN
, aoParentReference
, aoChildReference
, aoLinkName
, attachObjectResponse
, AttachObjectResponse
, aorsAttachedObjectIdentifier
, aorsResponseStatus
) 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 AttachObject = AttachObject'
{ _aoDirectoryARN :: !Text
, _aoParentReference :: !ObjectReference
, _aoChildReference :: !ObjectReference
, _aoLinkName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
attachObject
:: Text
-> ObjectReference
-> ObjectReference
-> Text
-> AttachObject
attachObject pDirectoryARN_ pParentReference_ pChildReference_ pLinkName_ =
AttachObject'
{ _aoDirectoryARN = pDirectoryARN_
, _aoParentReference = pParentReference_
, _aoChildReference = pChildReference_
, _aoLinkName = pLinkName_
}
aoDirectoryARN :: Lens' AttachObject Text
aoDirectoryARN = lens _aoDirectoryARN (\ s a -> s{_aoDirectoryARN = a});
aoParentReference :: Lens' AttachObject ObjectReference
aoParentReference = lens _aoParentReference (\ s a -> s{_aoParentReference = a});
aoChildReference :: Lens' AttachObject ObjectReference
aoChildReference = lens _aoChildReference (\ s a -> s{_aoChildReference = a});
aoLinkName :: Lens' AttachObject Text
aoLinkName = lens _aoLinkName (\ s a -> s{_aoLinkName = a});
instance AWSRequest AttachObject where
type Rs AttachObject = AttachObjectResponse
request = putJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
AttachObjectResponse' <$>
(x .?> "AttachedObjectIdentifier") <*>
(pure (fromEnum s)))
instance Hashable AttachObject where
instance NFData AttachObject where
instance ToHeaders AttachObject where
toHeaders AttachObject'{..}
= mconcat ["x-amz-data-partition" =# _aoDirectoryARN]
instance ToJSON AttachObject where
toJSON AttachObject'{..}
= object
(catMaybes
[Just ("ParentReference" .= _aoParentReference),
Just ("ChildReference" .= _aoChildReference),
Just ("LinkName" .= _aoLinkName)])
instance ToPath AttachObject where
toPath
= const
"/amazonclouddirectory/2017-01-11/object/attach"
instance ToQuery AttachObject where
toQuery = const mempty
data AttachObjectResponse = AttachObjectResponse'
{ _aorsAttachedObjectIdentifier :: !(Maybe Text)
, _aorsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
attachObjectResponse
:: Int
-> AttachObjectResponse
attachObjectResponse pResponseStatus_ =
AttachObjectResponse'
{ _aorsAttachedObjectIdentifier = Nothing
, _aorsResponseStatus = pResponseStatus_
}
aorsAttachedObjectIdentifier :: Lens' AttachObjectResponse (Maybe Text)
aorsAttachedObjectIdentifier = lens _aorsAttachedObjectIdentifier (\ s a -> s{_aorsAttachedObjectIdentifier = a});
aorsResponseStatus :: Lens' AttachObjectResponse Int
aorsResponseStatus = lens _aorsResponseStatus (\ s a -> s{_aorsResponseStatus = a});
instance NFData AttachObjectResponse where