{-# 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.CloudDirectory.DetachPolicy
(
detachPolicy
, DetachPolicy
, dpDirectoryARN
, dpPolicyReference
, dpObjectReference
, detachPolicyResponse
, DetachPolicyResponse
, dprsResponseStatus
) 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 DetachPolicy = DetachPolicy'
{ _dpDirectoryARN :: !Text
, _dpPolicyReference :: !ObjectReference
, _dpObjectReference :: !ObjectReference
} deriving (Eq, Read, Show, Data, Typeable, Generic)
detachPolicy
:: Text
-> ObjectReference
-> ObjectReference
-> DetachPolicy
detachPolicy pDirectoryARN_ pPolicyReference_ pObjectReference_ =
DetachPolicy'
{ _dpDirectoryARN = pDirectoryARN_
, _dpPolicyReference = pPolicyReference_
, _dpObjectReference = pObjectReference_
}
dpDirectoryARN :: Lens' DetachPolicy Text
dpDirectoryARN = lens _dpDirectoryARN (\ s a -> s{_dpDirectoryARN = a})
dpPolicyReference :: Lens' DetachPolicy ObjectReference
dpPolicyReference = lens _dpPolicyReference (\ s a -> s{_dpPolicyReference = a})
dpObjectReference :: Lens' DetachPolicy ObjectReference
dpObjectReference = lens _dpObjectReference (\ s a -> s{_dpObjectReference = a})
instance AWSRequest DetachPolicy where
type Rs DetachPolicy = DetachPolicyResponse
request = putJSON cloudDirectory
response
= receiveEmpty
(\ s h x ->
DetachPolicyResponse' <$> (pure (fromEnum s)))
instance Hashable DetachPolicy where
instance NFData DetachPolicy where
instance ToHeaders DetachPolicy where
toHeaders DetachPolicy'{..}
= mconcat ["x-amz-data-partition" =# _dpDirectoryARN]
instance ToJSON DetachPolicy where
toJSON DetachPolicy'{..}
= object
(catMaybes
[Just ("PolicyReference" .= _dpPolicyReference),
Just ("ObjectReference" .= _dpObjectReference)])
instance ToPath DetachPolicy where
toPath
= const
"/amazonclouddirectory/2017-01-11/policy/detach"
instance ToQuery DetachPolicy where
toQuery = const mempty
newtype DetachPolicyResponse = DetachPolicyResponse'
{ _dprsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
detachPolicyResponse
:: Int
-> DetachPolicyResponse
detachPolicyResponse pResponseStatus_ =
DetachPolicyResponse' {_dprsResponseStatus = pResponseStatus_}
dprsResponseStatus :: Lens' DetachPolicyResponse Int
dprsResponseStatus = lens _dprsResponseStatus (\ s a -> s{_dprsResponseStatus = a})
instance NFData DetachPolicyResponse where