module Network.AWS.DirectoryService.CreateMicrosoftAD
(
createMicrosoftAD
, CreateMicrosoftAD
, cmadShortName
, cmadDescription
, cmadName
, cmadPassword
, cmadVPCSettings
, createMicrosoftADResponse
, CreateMicrosoftADResponse
, cmadrsDirectoryId
, cmadrsResponseStatus
) where
import Network.AWS.DirectoryService.Types
import Network.AWS.DirectoryService.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateMicrosoftAD = CreateMicrosoftAD'
{ _cmadShortName :: !(Maybe Text)
, _cmadDescription :: !(Maybe Text)
, _cmadName :: !Text
, _cmadPassword :: !(Sensitive Text)
, _cmadVPCSettings :: !DirectoryVPCSettings
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createMicrosoftAD
:: Text
-> Text
-> DirectoryVPCSettings
-> CreateMicrosoftAD
createMicrosoftAD pName_ pPassword_ pVPCSettings_ =
CreateMicrosoftAD'
{ _cmadShortName = Nothing
, _cmadDescription = Nothing
, _cmadName = pName_
, _cmadPassword = _Sensitive # pPassword_
, _cmadVPCSettings = pVPCSettings_
}
cmadShortName :: Lens' CreateMicrosoftAD (Maybe Text)
cmadShortName = lens _cmadShortName (\ s a -> s{_cmadShortName = a});
cmadDescription :: Lens' CreateMicrosoftAD (Maybe Text)
cmadDescription = lens _cmadDescription (\ s a -> s{_cmadDescription = a});
cmadName :: Lens' CreateMicrosoftAD Text
cmadName = lens _cmadName (\ s a -> s{_cmadName = a});
cmadPassword :: Lens' CreateMicrosoftAD Text
cmadPassword = lens _cmadPassword (\ s a -> s{_cmadPassword = a}) . _Sensitive;
cmadVPCSettings :: Lens' CreateMicrosoftAD DirectoryVPCSettings
cmadVPCSettings = lens _cmadVPCSettings (\ s a -> s{_cmadVPCSettings = a});
instance AWSRequest CreateMicrosoftAD where
type Rs CreateMicrosoftAD = CreateMicrosoftADResponse
request = postJSON directoryService
response
= receiveJSON
(\ s h x ->
CreateMicrosoftADResponse' <$>
(x .?> "DirectoryId") <*> (pure (fromEnum s)))
instance Hashable CreateMicrosoftAD
instance NFData CreateMicrosoftAD
instance ToHeaders CreateMicrosoftAD where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DirectoryService_20150416.CreateMicrosoftAD" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateMicrosoftAD where
toJSON CreateMicrosoftAD'{..}
= object
(catMaybes
[("ShortName" .=) <$> _cmadShortName,
("Description" .=) <$> _cmadDescription,
Just ("Name" .= _cmadName),
Just ("Password" .= _cmadPassword),
Just ("VpcSettings" .= _cmadVPCSettings)])
instance ToPath CreateMicrosoftAD where
toPath = const "/"
instance ToQuery CreateMicrosoftAD where
toQuery = const mempty
data CreateMicrosoftADResponse = CreateMicrosoftADResponse'
{ _cmadrsDirectoryId :: !(Maybe Text)
, _cmadrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createMicrosoftADResponse
:: Int
-> CreateMicrosoftADResponse
createMicrosoftADResponse pResponseStatus_ =
CreateMicrosoftADResponse'
{ _cmadrsDirectoryId = Nothing
, _cmadrsResponseStatus = pResponseStatus_
}
cmadrsDirectoryId :: Lens' CreateMicrosoftADResponse (Maybe Text)
cmadrsDirectoryId = lens _cmadrsDirectoryId (\ s a -> s{_cmadrsDirectoryId = a});
cmadrsResponseStatus :: Lens' CreateMicrosoftADResponse Int
cmadrsResponseStatus = lens _cmadrsResponseStatus (\ s a -> s{_cmadrsResponseStatus = a});
instance NFData CreateMicrosoftADResponse