{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.DirectoryService.CreateTrust
(
createTrust
, CreateTrust
, ctConditionalForwarderIPAddrs
, ctTrustType
, ctDirectoryId
, ctRemoteDomainName
, ctTrustPassword
, ctTrustDirection
, createTrustResponse
, CreateTrustResponse
, ctrsTrustId
, ctrsResponseStatus
) 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 CreateTrust = CreateTrust'
{ _ctConditionalForwarderIPAddrs :: !(Maybe [Text])
, _ctTrustType :: !(Maybe TrustType)
, _ctDirectoryId :: !Text
, _ctRemoteDomainName :: !Text
, _ctTrustPassword :: !(Sensitive Text)
, _ctTrustDirection :: !TrustDirection
} deriving (Eq, Show, Data, Typeable, Generic)
createTrust
:: Text
-> Text
-> Text
-> TrustDirection
-> CreateTrust
createTrust pDirectoryId_ pRemoteDomainName_ pTrustPassword_ pTrustDirection_ =
CreateTrust'
{ _ctConditionalForwarderIPAddrs = Nothing
, _ctTrustType = Nothing
, _ctDirectoryId = pDirectoryId_
, _ctRemoteDomainName = pRemoteDomainName_
, _ctTrustPassword = _Sensitive # pTrustPassword_
, _ctTrustDirection = pTrustDirection_
}
ctConditionalForwarderIPAddrs :: Lens' CreateTrust [Text]
ctConditionalForwarderIPAddrs = lens _ctConditionalForwarderIPAddrs (\ s a -> s{_ctConditionalForwarderIPAddrs = a}) . _Default . _Coerce
ctTrustType :: Lens' CreateTrust (Maybe TrustType)
ctTrustType = lens _ctTrustType (\ s a -> s{_ctTrustType = a})
ctDirectoryId :: Lens' CreateTrust Text
ctDirectoryId = lens _ctDirectoryId (\ s a -> s{_ctDirectoryId = a})
ctRemoteDomainName :: Lens' CreateTrust Text
ctRemoteDomainName = lens _ctRemoteDomainName (\ s a -> s{_ctRemoteDomainName = a})
ctTrustPassword :: Lens' CreateTrust Text
ctTrustPassword = lens _ctTrustPassword (\ s a -> s{_ctTrustPassword = a}) . _Sensitive
ctTrustDirection :: Lens' CreateTrust TrustDirection
ctTrustDirection = lens _ctTrustDirection (\ s a -> s{_ctTrustDirection = a})
instance AWSRequest CreateTrust where
type Rs CreateTrust = CreateTrustResponse
request = postJSON directoryService
response
= receiveJSON
(\ s h x ->
CreateTrustResponse' <$>
(x .?> "TrustId") <*> (pure (fromEnum s)))
instance Hashable CreateTrust where
instance NFData CreateTrust where
instance ToHeaders CreateTrust where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DirectoryService_20150416.CreateTrust" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateTrust where
toJSON CreateTrust'{..}
= object
(catMaybes
[("ConditionalForwarderIpAddrs" .=) <$>
_ctConditionalForwarderIPAddrs,
("TrustType" .=) <$> _ctTrustType,
Just ("DirectoryId" .= _ctDirectoryId),
Just ("RemoteDomainName" .= _ctRemoteDomainName),
Just ("TrustPassword" .= _ctTrustPassword),
Just ("TrustDirection" .= _ctTrustDirection)])
instance ToPath CreateTrust where
toPath = const "/"
instance ToQuery CreateTrust where
toQuery = const mempty
data CreateTrustResponse = CreateTrustResponse'
{ _ctrsTrustId :: !(Maybe Text)
, _ctrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createTrustResponse
:: Int
-> CreateTrustResponse
createTrustResponse pResponseStatus_ =
CreateTrustResponse'
{_ctrsTrustId = Nothing, _ctrsResponseStatus = pResponseStatus_}
ctrsTrustId :: Lens' CreateTrustResponse (Maybe Text)
ctrsTrustId = lens _ctrsTrustId (\ s a -> s{_ctrsTrustId = a})
ctrsResponseStatus :: Lens' CreateTrustResponse Int
ctrsResponseStatus = lens _ctrsResponseStatus (\ s a -> s{_ctrsResponseStatus = a})
instance NFData CreateTrustResponse where