module Network.AWS.DirectoryService.DescribeSnapshots
(
describeSnapshots
, DescribeSnapshots
, dsDirectoryId
, dsNextToken
, dsSnapshotIds
, dsLimit
, describeSnapshotsResponse
, DescribeSnapshotsResponse
, dssrsNextToken
, dssrsSnapshots
, dssrsResponseStatus
) where
import Network.AWS.DirectoryService.Types
import Network.AWS.DirectoryService.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeSnapshots = DescribeSnapshots'
{ _dsDirectoryId :: !(Maybe Text)
, _dsNextToken :: !(Maybe Text)
, _dsSnapshotIds :: !(Maybe [Text])
, _dsLimit :: !(Maybe Nat)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeSnapshots
:: DescribeSnapshots
describeSnapshots =
DescribeSnapshots'
{ _dsDirectoryId = Nothing
, _dsNextToken = Nothing
, _dsSnapshotIds = Nothing
, _dsLimit = Nothing
}
dsDirectoryId :: Lens' DescribeSnapshots (Maybe Text)
dsDirectoryId = lens _dsDirectoryId (\ s a -> s{_dsDirectoryId = a});
dsNextToken :: Lens' DescribeSnapshots (Maybe Text)
dsNextToken = lens _dsNextToken (\ s a -> s{_dsNextToken = a});
dsSnapshotIds :: Lens' DescribeSnapshots [Text]
dsSnapshotIds = lens _dsSnapshotIds (\ s a -> s{_dsSnapshotIds = a}) . _Default . _Coerce;
dsLimit :: Lens' DescribeSnapshots (Maybe Natural)
dsLimit = lens _dsLimit (\ s a -> s{_dsLimit = a}) . mapping _Nat;
instance AWSRequest DescribeSnapshots where
type Rs DescribeSnapshots = DescribeSnapshotsResponse
request = postJSON directoryService
response
= receiveJSON
(\ s h x ->
DescribeSnapshotsResponse' <$>
(x .?> "NextToken") <*>
(x .?> "Snapshots" .!@ mempty)
<*> (pure (fromEnum s)))
instance ToHeaders DescribeSnapshots where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DirectoryService_20150416.DescribeSnapshots" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeSnapshots where
toJSON DescribeSnapshots'{..}
= object
(catMaybes
[("DirectoryId" .=) <$> _dsDirectoryId,
("NextToken" .=) <$> _dsNextToken,
("SnapshotIds" .=) <$> _dsSnapshotIds,
("Limit" .=) <$> _dsLimit])
instance ToPath DescribeSnapshots where
toPath = const "/"
instance ToQuery DescribeSnapshots where
toQuery = const mempty
data DescribeSnapshotsResponse = DescribeSnapshotsResponse'
{ _dssrsNextToken :: !(Maybe Text)
, _dssrsSnapshots :: !(Maybe [Snapshot])
, _dssrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeSnapshotsResponse
:: Int
-> DescribeSnapshotsResponse
describeSnapshotsResponse pResponseStatus_ =
DescribeSnapshotsResponse'
{ _dssrsNextToken = Nothing
, _dssrsSnapshots = Nothing
, _dssrsResponseStatus = pResponseStatus_
}
dssrsNextToken :: Lens' DescribeSnapshotsResponse (Maybe Text)
dssrsNextToken = lens _dssrsNextToken (\ s a -> s{_dssrsNextToken = a});
dssrsSnapshots :: Lens' DescribeSnapshotsResponse [Snapshot]
dssrsSnapshots = lens _dssrsSnapshots (\ s a -> s{_dssrsSnapshots = a}) . _Default . _Coerce;
dssrsResponseStatus :: Lens' DescribeSnapshotsResponse Int
dssrsResponseStatus = lens _dssrsResponseStatus (\ s a -> s{_dssrsResponseStatus = a});