{-# 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.SSM.ModifyDocumentPermission
(
modifyDocumentPermission
, ModifyDocumentPermission
, mdpAccountIdsToAdd
, mdpAccountIdsToRemove
, mdpName
, mdpPermissionType
, modifyDocumentPermissionResponse
, ModifyDocumentPermissionResponse
, mdprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SSM.Types
import Network.AWS.SSM.Types.Product
data ModifyDocumentPermission = ModifyDocumentPermission'
{ _mdpAccountIdsToAdd :: !(Maybe [Text])
, _mdpAccountIdsToRemove :: !(Maybe [Text])
, _mdpName :: !Text
, _mdpPermissionType :: !DocumentPermissionType
} deriving (Eq, Read, Show, Data, Typeable, Generic)
modifyDocumentPermission
:: Text
-> DocumentPermissionType
-> ModifyDocumentPermission
modifyDocumentPermission pName_ pPermissionType_ =
ModifyDocumentPermission'
{ _mdpAccountIdsToAdd = Nothing
, _mdpAccountIdsToRemove = Nothing
, _mdpName = pName_
, _mdpPermissionType = pPermissionType_
}
mdpAccountIdsToAdd :: Lens' ModifyDocumentPermission [Text]
mdpAccountIdsToAdd = lens _mdpAccountIdsToAdd (\ s a -> s{_mdpAccountIdsToAdd = a}) . _Default . _Coerce
mdpAccountIdsToRemove :: Lens' ModifyDocumentPermission [Text]
mdpAccountIdsToRemove = lens _mdpAccountIdsToRemove (\ s a -> s{_mdpAccountIdsToRemove = a}) . _Default . _Coerce
mdpName :: Lens' ModifyDocumentPermission Text
mdpName = lens _mdpName (\ s a -> s{_mdpName = a})
mdpPermissionType :: Lens' ModifyDocumentPermission DocumentPermissionType
mdpPermissionType = lens _mdpPermissionType (\ s a -> s{_mdpPermissionType = a})
instance AWSRequest ModifyDocumentPermission where
type Rs ModifyDocumentPermission =
ModifyDocumentPermissionResponse
request = postJSON ssm
response
= receiveEmpty
(\ s h x ->
ModifyDocumentPermissionResponse' <$>
(pure (fromEnum s)))
instance Hashable ModifyDocumentPermission where
instance NFData ModifyDocumentPermission where
instance ToHeaders ModifyDocumentPermission where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.ModifyDocumentPermission" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ModifyDocumentPermission where
toJSON ModifyDocumentPermission'{..}
= object
(catMaybes
[("AccountIdsToAdd" .=) <$> _mdpAccountIdsToAdd,
("AccountIdsToRemove" .=) <$> _mdpAccountIdsToRemove,
Just ("Name" .= _mdpName),
Just ("PermissionType" .= _mdpPermissionType)])
instance ToPath ModifyDocumentPermission where
toPath = const "/"
instance ToQuery ModifyDocumentPermission where
toQuery = const mempty
newtype ModifyDocumentPermissionResponse = ModifyDocumentPermissionResponse'
{ _mdprsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
modifyDocumentPermissionResponse
:: Int
-> ModifyDocumentPermissionResponse
modifyDocumentPermissionResponse pResponseStatus_ =
ModifyDocumentPermissionResponse' {_mdprsResponseStatus = pResponseStatus_}
mdprsResponseStatus :: Lens' ModifyDocumentPermissionResponse Int
mdprsResponseStatus = lens _mdprsResponseStatus (\ s a -> s{_mdprsResponseStatus = a})
instance NFData ModifyDocumentPermissionResponse
where