module Network.AWS.CloudDirectory.CreateDirectory
(
createDirectory
, CreateDirectory
, cdName
, cdSchemaARN
, createDirectoryResponse
, CreateDirectoryResponse
, cdrsResponseStatus
, cdrsDirectoryARN
, cdrsName
, cdrsObjectIdentifier
, cdrsAppliedSchemaARN
) 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 CreateDirectory = CreateDirectory'
{ _cdName :: !Text
, _cdSchemaARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDirectory
:: Text
-> Text
-> CreateDirectory
createDirectory pName_ pSchemaARN_ =
CreateDirectory' {_cdName = pName_, _cdSchemaARN = pSchemaARN_}
cdName :: Lens' CreateDirectory Text
cdName = lens _cdName (\ s a -> s{_cdName = a});
cdSchemaARN :: Lens' CreateDirectory Text
cdSchemaARN = lens _cdSchemaARN (\ s a -> s{_cdSchemaARN = a});
instance AWSRequest CreateDirectory where
type Rs CreateDirectory = CreateDirectoryResponse
request = putJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
CreateDirectoryResponse' <$>
(pure (fromEnum s)) <*> (x .:> "DirectoryArn") <*>
(x .:> "Name")
<*> (x .:> "ObjectIdentifier")
<*> (x .:> "AppliedSchemaArn"))
instance Hashable CreateDirectory where
instance NFData CreateDirectory where
instance ToHeaders CreateDirectory where
toHeaders CreateDirectory'{..}
= mconcat ["x-amz-data-partition" =# _cdSchemaARN]
instance ToJSON CreateDirectory where
toJSON CreateDirectory'{..}
= object (catMaybes [Just ("Name" .= _cdName)])
instance ToPath CreateDirectory where
toPath
= const
"/amazonclouddirectory/2017-01-11/directory/create"
instance ToQuery CreateDirectory where
toQuery = const mempty
data CreateDirectoryResponse = CreateDirectoryResponse'
{ _cdrsResponseStatus :: !Int
, _cdrsDirectoryARN :: !Text
, _cdrsName :: !Text
, _cdrsObjectIdentifier :: !Text
, _cdrsAppliedSchemaARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDirectoryResponse
:: Int
-> Text
-> Text
-> Text
-> Text
-> CreateDirectoryResponse
createDirectoryResponse pResponseStatus_ pDirectoryARN_ pName_ pObjectIdentifier_ pAppliedSchemaARN_ =
CreateDirectoryResponse'
{ _cdrsResponseStatus = pResponseStatus_
, _cdrsDirectoryARN = pDirectoryARN_
, _cdrsName = pName_
, _cdrsObjectIdentifier = pObjectIdentifier_
, _cdrsAppliedSchemaARN = pAppliedSchemaARN_
}
cdrsResponseStatus :: Lens' CreateDirectoryResponse Int
cdrsResponseStatus = lens _cdrsResponseStatus (\ s a -> s{_cdrsResponseStatus = a});
cdrsDirectoryARN :: Lens' CreateDirectoryResponse Text
cdrsDirectoryARN = lens _cdrsDirectoryARN (\ s a -> s{_cdrsDirectoryARN = a});
cdrsName :: Lens' CreateDirectoryResponse Text
cdrsName = lens _cdrsName (\ s a -> s{_cdrsName = a});
cdrsObjectIdentifier :: Lens' CreateDirectoryResponse Text
cdrsObjectIdentifier = lens _cdrsObjectIdentifier (\ s a -> s{_cdrsObjectIdentifier = a});
cdrsAppliedSchemaARN :: Lens' CreateDirectoryResponse Text
cdrsAppliedSchemaARN = lens _cdrsAppliedSchemaARN (\ s a -> s{_cdrsAppliedSchemaARN = a});
instance NFData CreateDirectoryResponse where