module Network.AWS.DirectoryService.CreateComputer
(
createComputer
, CreateComputer
, ccComputerAttributes
, ccOrganizationalUnitDistinguishedName
, ccDirectoryId
, ccComputerName
, ccPassword
, createComputerResponse
, CreateComputerResponse
, ccrsComputer
, ccrsResponseStatus
) where
import Network.AWS.DirectoryService.Types
import Network.AWS.DirectoryService.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateComputer = CreateComputer'
{ _ccComputerAttributes :: !(Maybe [Attribute])
, _ccOrganizationalUnitDistinguishedName :: !(Maybe Text)
, _ccDirectoryId :: !Text
, _ccComputerName :: !Text
, _ccPassword :: !(Sensitive Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createComputer
:: Text
-> Text
-> Text
-> CreateComputer
createComputer pDirectoryId_ pComputerName_ pPassword_ =
CreateComputer'
{ _ccComputerAttributes = Nothing
, _ccOrganizationalUnitDistinguishedName = Nothing
, _ccDirectoryId = pDirectoryId_
, _ccComputerName = pComputerName_
, _ccPassword = _Sensitive # pPassword_
}
ccComputerAttributes :: Lens' CreateComputer [Attribute]
ccComputerAttributes = lens _ccComputerAttributes (\ s a -> s{_ccComputerAttributes = a}) . _Default . _Coerce;
ccOrganizationalUnitDistinguishedName :: Lens' CreateComputer (Maybe Text)
ccOrganizationalUnitDistinguishedName = lens _ccOrganizationalUnitDistinguishedName (\ s a -> s{_ccOrganizationalUnitDistinguishedName = a});
ccDirectoryId :: Lens' CreateComputer Text
ccDirectoryId = lens _ccDirectoryId (\ s a -> s{_ccDirectoryId = a});
ccComputerName :: Lens' CreateComputer Text
ccComputerName = lens _ccComputerName (\ s a -> s{_ccComputerName = a});
ccPassword :: Lens' CreateComputer Text
ccPassword = lens _ccPassword (\ s a -> s{_ccPassword = a}) . _Sensitive;
instance AWSRequest CreateComputer where
type Rs CreateComputer = CreateComputerResponse
request = postJSON directoryService
response
= receiveJSON
(\ s h x ->
CreateComputerResponse' <$>
(x .?> "Computer") <*> (pure (fromEnum s)))
instance ToHeaders CreateComputer where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DirectoryService_20150416.CreateComputer" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateComputer where
toJSON CreateComputer'{..}
= object
(catMaybes
[("ComputerAttributes" .=) <$> _ccComputerAttributes,
("OrganizationalUnitDistinguishedName" .=) <$>
_ccOrganizationalUnitDistinguishedName,
Just ("DirectoryId" .= _ccDirectoryId),
Just ("ComputerName" .= _ccComputerName),
Just ("Password" .= _ccPassword)])
instance ToPath CreateComputer where
toPath = const "/"
instance ToQuery CreateComputer where
toQuery = const mempty
data CreateComputerResponse = CreateComputerResponse'
{ _ccrsComputer :: !(Maybe Computer)
, _ccrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createComputerResponse
:: Int
-> CreateComputerResponse
createComputerResponse pResponseStatus_ =
CreateComputerResponse'
{ _ccrsComputer = Nothing
, _ccrsResponseStatus = pResponseStatus_
}
ccrsComputer :: Lens' CreateComputerResponse (Maybe Computer)
ccrsComputer = lens _ccrsComputer (\ s a -> s{_ccrsComputer = a});
ccrsResponseStatus :: Lens' CreateComputerResponse Int
ccrsResponseStatus = lens _ccrsResponseStatus (\ s a -> s{_ccrsResponseStatus = a});