module Network.AWS.CloudDirectory.ListIndex
(
listIndex
, ListIndex
, liRangesOnIndexedValues
, liConsistencyLevel
, liNextToken
, liMaxResults
, liDirectoryARN
, liIndexReference
, listIndexResponse
, ListIndexResponse
, lirsIndexAttachments
, lirsNextToken
, lirsResponseStatus
) 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 ListIndex = ListIndex'
{ _liRangesOnIndexedValues :: !(Maybe [ObjectAttributeRange])
, _liConsistencyLevel :: !(Maybe ConsistencyLevel)
, _liNextToken :: !(Maybe Text)
, _liMaxResults :: !(Maybe Nat)
, _liDirectoryARN :: !Text
, _liIndexReference :: !ObjectReference
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listIndex
:: Text
-> ObjectReference
-> ListIndex
listIndex pDirectoryARN_ pIndexReference_ =
ListIndex'
{ _liRangesOnIndexedValues = Nothing
, _liConsistencyLevel = Nothing
, _liNextToken = Nothing
, _liMaxResults = Nothing
, _liDirectoryARN = pDirectoryARN_
, _liIndexReference = pIndexReference_
}
liRangesOnIndexedValues :: Lens' ListIndex [ObjectAttributeRange]
liRangesOnIndexedValues = lens _liRangesOnIndexedValues (\ s a -> s{_liRangesOnIndexedValues = a}) . _Default . _Coerce;
liConsistencyLevel :: Lens' ListIndex (Maybe ConsistencyLevel)
liConsistencyLevel = lens _liConsistencyLevel (\ s a -> s{_liConsistencyLevel = a});
liNextToken :: Lens' ListIndex (Maybe Text)
liNextToken = lens _liNextToken (\ s a -> s{_liNextToken = a});
liMaxResults :: Lens' ListIndex (Maybe Natural)
liMaxResults = lens _liMaxResults (\ s a -> s{_liMaxResults = a}) . mapping _Nat;
liDirectoryARN :: Lens' ListIndex Text
liDirectoryARN = lens _liDirectoryARN (\ s a -> s{_liDirectoryARN = a});
liIndexReference :: Lens' ListIndex ObjectReference
liIndexReference = lens _liIndexReference (\ s a -> s{_liIndexReference = a});
instance AWSRequest ListIndex where
type Rs ListIndex = ListIndexResponse
request = postJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
ListIndexResponse' <$>
(x .?> "IndexAttachments" .!@ mempty) <*>
(x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable ListIndex where
instance NFData ListIndex where
instance ToHeaders ListIndex where
toHeaders ListIndex'{..}
= mconcat
["x-amz-consistency-level" =# _liConsistencyLevel,
"x-amz-data-partition" =# _liDirectoryARN]
instance ToJSON ListIndex where
toJSON ListIndex'{..}
= object
(catMaybes
[("RangesOnIndexedValues" .=) <$>
_liRangesOnIndexedValues,
("NextToken" .=) <$> _liNextToken,
("MaxResults" .=) <$> _liMaxResults,
Just ("IndexReference" .= _liIndexReference)])
instance ToPath ListIndex where
toPath
= const
"/amazonclouddirectory/2017-01-11/index/targets"
instance ToQuery ListIndex where
toQuery = const mempty
data ListIndexResponse = ListIndexResponse'
{ _lirsIndexAttachments :: !(Maybe [IndexAttachment])
, _lirsNextToken :: !(Maybe Text)
, _lirsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listIndexResponse
:: Int
-> ListIndexResponse
listIndexResponse pResponseStatus_ =
ListIndexResponse'
{ _lirsIndexAttachments = Nothing
, _lirsNextToken = Nothing
, _lirsResponseStatus = pResponseStatus_
}
lirsIndexAttachments :: Lens' ListIndexResponse [IndexAttachment]
lirsIndexAttachments = lens _lirsIndexAttachments (\ s a -> s{_lirsIndexAttachments = a}) . _Default . _Coerce;
lirsNextToken :: Lens' ListIndexResponse (Maybe Text)
lirsNextToken = lens _lirsNextToken (\ s a -> s{_lirsNextToken = a});
lirsResponseStatus :: Lens' ListIndexResponse Int
lirsResponseStatus = lens _lirsResponseStatus (\ s a -> s{_lirsResponseStatus = a});
instance NFData ListIndexResponse where