module Network.AWS.CloudDirectory.ListObjectPolicies
(
listObjectPolicies
, ListObjectPolicies
, lConsistencyLevel
, lNextToken
, lMaxResults
, lDirectoryARN
, lObjectReference
, listObjectPoliciesResponse
, ListObjectPoliciesResponse
, loprsNextToken
, loprsAttachedPolicyIds
, loprsResponseStatus
) 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 ListObjectPolicies = ListObjectPolicies'
{ _lConsistencyLevel :: !(Maybe ConsistencyLevel)
, _lNextToken :: !(Maybe Text)
, _lMaxResults :: !(Maybe Nat)
, _lDirectoryARN :: !Text
, _lObjectReference :: !ObjectReference
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listObjectPolicies
:: Text
-> ObjectReference
-> ListObjectPolicies
listObjectPolicies pDirectoryARN_ pObjectReference_ =
ListObjectPolicies'
{ _lConsistencyLevel = Nothing
, _lNextToken = Nothing
, _lMaxResults = Nothing
, _lDirectoryARN = pDirectoryARN_
, _lObjectReference = pObjectReference_
}
lConsistencyLevel :: Lens' ListObjectPolicies (Maybe ConsistencyLevel)
lConsistencyLevel = lens _lConsistencyLevel (\ s a -> s{_lConsistencyLevel = a});
lNextToken :: Lens' ListObjectPolicies (Maybe Text)
lNextToken = lens _lNextToken (\ s a -> s{_lNextToken = a});
lMaxResults :: Lens' ListObjectPolicies (Maybe Natural)
lMaxResults = lens _lMaxResults (\ s a -> s{_lMaxResults = a}) . mapping _Nat;
lDirectoryARN :: Lens' ListObjectPolicies Text
lDirectoryARN = lens _lDirectoryARN (\ s a -> s{_lDirectoryARN = a});
lObjectReference :: Lens' ListObjectPolicies ObjectReference
lObjectReference = lens _lObjectReference (\ s a -> s{_lObjectReference = a});
instance AWSRequest ListObjectPolicies where
type Rs ListObjectPolicies =
ListObjectPoliciesResponse
request = postJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
ListObjectPoliciesResponse' <$>
(x .?> "NextToken") <*>
(x .?> "AttachedPolicyIds" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListObjectPolicies where
instance NFData ListObjectPolicies where
instance ToHeaders ListObjectPolicies where
toHeaders ListObjectPolicies'{..}
= mconcat
["x-amz-consistency-level" =# _lConsistencyLevel,
"x-amz-data-partition" =# _lDirectoryARN]
instance ToJSON ListObjectPolicies where
toJSON ListObjectPolicies'{..}
= object
(catMaybes
[("NextToken" .=) <$> _lNextToken,
("MaxResults" .=) <$> _lMaxResults,
Just ("ObjectReference" .= _lObjectReference)])
instance ToPath ListObjectPolicies where
toPath
= const
"/amazonclouddirectory/2017-01-11/object/policy"
instance ToQuery ListObjectPolicies where
toQuery = const mempty
data ListObjectPoliciesResponse = ListObjectPoliciesResponse'
{ _loprsNextToken :: !(Maybe Text)
, _loprsAttachedPolicyIds :: !(Maybe [Text])
, _loprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listObjectPoliciesResponse
:: Int
-> ListObjectPoliciesResponse
listObjectPoliciesResponse pResponseStatus_ =
ListObjectPoliciesResponse'
{ _loprsNextToken = Nothing
, _loprsAttachedPolicyIds = Nothing
, _loprsResponseStatus = pResponseStatus_
}
loprsNextToken :: Lens' ListObjectPoliciesResponse (Maybe Text)
loprsNextToken = lens _loprsNextToken (\ s a -> s{_loprsNextToken = a});
loprsAttachedPolicyIds :: Lens' ListObjectPoliciesResponse [Text]
loprsAttachedPolicyIds = lens _loprsAttachedPolicyIds (\ s a -> s{_loprsAttachedPolicyIds = a}) . _Default . _Coerce;
loprsResponseStatus :: Lens' ListObjectPoliciesResponse Int
loprsResponseStatus = lens _loprsResponseStatus (\ s a -> s{_loprsResponseStatus = a});
instance NFData ListObjectPoliciesResponse where