module Network.AWS.WorkDocs.CreateFolder
(
createFolder
, CreateFolder
, cfAuthenticationToken
, cfName
, cfParentFolderId
, createFolderResponse
, CreateFolderResponse
, cfrsMetadata
, cfrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WorkDocs.Types
import Network.AWS.WorkDocs.Types.Product
data CreateFolder = CreateFolder'
{ _cfAuthenticationToken :: !(Maybe (Sensitive Text))
, _cfName :: !(Maybe Text)
, _cfParentFolderId :: !Text
} deriving (Eq, Show, Data, Typeable, Generic)
createFolder
:: Text
-> CreateFolder
createFolder pParentFolderId_ =
CreateFolder'
{ _cfAuthenticationToken = Nothing
, _cfName = Nothing
, _cfParentFolderId = pParentFolderId_
}
cfAuthenticationToken :: Lens' CreateFolder (Maybe Text)
cfAuthenticationToken = lens _cfAuthenticationToken (\ s a -> s{_cfAuthenticationToken = a}) . mapping _Sensitive;
cfName :: Lens' CreateFolder (Maybe Text)
cfName = lens _cfName (\ s a -> s{_cfName = a});
cfParentFolderId :: Lens' CreateFolder Text
cfParentFolderId = lens _cfParentFolderId (\ s a -> s{_cfParentFolderId = a});
instance AWSRequest CreateFolder where
type Rs CreateFolder = CreateFolderResponse
request = postJSON workDocs
response
= receiveJSON
(\ s h x ->
CreateFolderResponse' <$>
(x .?> "Metadata") <*> (pure (fromEnum s)))
instance Hashable CreateFolder where
instance NFData CreateFolder where
instance ToHeaders CreateFolder where
toHeaders CreateFolder'{..}
= mconcat
["Authentication" =# _cfAuthenticationToken,
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)]
instance ToJSON CreateFolder where
toJSON CreateFolder'{..}
= object
(catMaybes
[("Name" .=) <$> _cfName,
Just ("ParentFolderId" .= _cfParentFolderId)])
instance ToPath CreateFolder where
toPath = const "/api/v1/folders"
instance ToQuery CreateFolder where
toQuery = const mempty
data CreateFolderResponse = CreateFolderResponse'
{ _cfrsMetadata :: !(Maybe FolderMetadata)
, _cfrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createFolderResponse
:: Int
-> CreateFolderResponse
createFolderResponse pResponseStatus_ =
CreateFolderResponse'
{_cfrsMetadata = Nothing, _cfrsResponseStatus = pResponseStatus_}
cfrsMetadata :: Lens' CreateFolderResponse (Maybe FolderMetadata)
cfrsMetadata = lens _cfrsMetadata (\ s a -> s{_cfrsMetadata = a});
cfrsResponseStatus :: Lens' CreateFolderResponse Int
cfrsResponseStatus = lens _cfrsResponseStatus (\ s a -> s{_cfrsResponseStatus = a});
instance NFData CreateFolderResponse where