module Network.AWS.CloudDirectory.AttachToIndex
(
attachToIndex
, AttachToIndex
, atiDirectoryARN
, atiIndexReference
, atiTargetReference
, attachToIndexResponse
, AttachToIndexResponse
, atirsAttachedObjectIdentifier
, atirsResponseStatus
) 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 AttachToIndex = AttachToIndex'
{ _atiDirectoryARN :: !Text
, _atiIndexReference :: !ObjectReference
, _atiTargetReference :: !ObjectReference
} deriving (Eq, Read, Show, Data, Typeable, Generic)
attachToIndex
:: Text
-> ObjectReference
-> ObjectReference
-> AttachToIndex
attachToIndex pDirectoryARN_ pIndexReference_ pTargetReference_ =
AttachToIndex'
{ _atiDirectoryARN = pDirectoryARN_
, _atiIndexReference = pIndexReference_
, _atiTargetReference = pTargetReference_
}
atiDirectoryARN :: Lens' AttachToIndex Text
atiDirectoryARN = lens _atiDirectoryARN (\ s a -> s{_atiDirectoryARN = a});
atiIndexReference :: Lens' AttachToIndex ObjectReference
atiIndexReference = lens _atiIndexReference (\ s a -> s{_atiIndexReference = a});
atiTargetReference :: Lens' AttachToIndex ObjectReference
atiTargetReference = lens _atiTargetReference (\ s a -> s{_atiTargetReference = a});
instance AWSRequest AttachToIndex where
type Rs AttachToIndex = AttachToIndexResponse
request = putJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
AttachToIndexResponse' <$>
(x .?> "AttachedObjectIdentifier") <*>
(pure (fromEnum s)))
instance Hashable AttachToIndex where
instance NFData AttachToIndex where
instance ToHeaders AttachToIndex where
toHeaders AttachToIndex'{..}
= mconcat
["x-amz-data-partition" =# _atiDirectoryARN]
instance ToJSON AttachToIndex where
toJSON AttachToIndex'{..}
= object
(catMaybes
[Just ("IndexReference" .= _atiIndexReference),
Just ("TargetReference" .= _atiTargetReference)])
instance ToPath AttachToIndex where
toPath
= const
"/amazonclouddirectory/2017-01-11/index/attach"
instance ToQuery AttachToIndex where
toQuery = const mempty
data AttachToIndexResponse = AttachToIndexResponse'
{ _atirsAttachedObjectIdentifier :: !(Maybe Text)
, _atirsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
attachToIndexResponse
:: Int
-> AttachToIndexResponse
attachToIndexResponse pResponseStatus_ =
AttachToIndexResponse'
{ _atirsAttachedObjectIdentifier = Nothing
, _atirsResponseStatus = pResponseStatus_
}
atirsAttachedObjectIdentifier :: Lens' AttachToIndexResponse (Maybe Text)
atirsAttachedObjectIdentifier = lens _atirsAttachedObjectIdentifier (\ s a -> s{_atirsAttachedObjectIdentifier = a});
atirsResponseStatus :: Lens' AttachToIndexResponse Int
atirsResponseStatus = lens _atirsResponseStatus (\ s a -> s{_atirsResponseStatus = a});
instance NFData AttachToIndexResponse where