{-# 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.StorageGateway.ListTapes
(
listTapes
, ListTapes
, ltMarker
, ltLimit
, ltTapeARNs
, listTapesResponse
, ListTapesResponse
, ltrsMarker
, ltrsTapeInfos
, ltrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.StorageGateway.Types
import Network.AWS.StorageGateway.Types.Product
data ListTapes = ListTapes'
{ _ltMarker :: !(Maybe Text)
, _ltLimit :: !(Maybe Nat)
, _ltTapeARNs :: !(Maybe [Text])
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listTapes
:: ListTapes
listTapes =
ListTapes'
{ _ltMarker = Nothing
, _ltLimit = Nothing
, _ltTapeARNs = Nothing
}
ltMarker :: Lens' ListTapes (Maybe Text)
ltMarker = lens _ltMarker (\ s a -> s{_ltMarker = a});
ltLimit :: Lens' ListTapes (Maybe Natural)
ltLimit = lens _ltLimit (\ s a -> s{_ltLimit = a}) . mapping _Nat;
ltTapeARNs :: Lens' ListTapes [Text]
ltTapeARNs = lens _ltTapeARNs (\ s a -> s{_ltTapeARNs = a}) . _Default . _Coerce;
instance AWSRequest ListTapes where
type Rs ListTapes = ListTapesResponse
request = postJSON storageGateway
response
= receiveJSON
(\ s h x ->
ListTapesResponse' <$>
(x .?> "Marker") <*> (x .?> "TapeInfos" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListTapes
instance NFData ListTapes
instance ToHeaders ListTapes where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("StorageGateway_20130630.ListTapes" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListTapes where
toJSON ListTapes'{..}
= object
(catMaybes
[("Marker" .=) <$> _ltMarker,
("Limit" .=) <$> _ltLimit,
("TapeARNs" .=) <$> _ltTapeARNs])
instance ToPath ListTapes where
toPath = const "/"
instance ToQuery ListTapes where
toQuery = const mempty
data ListTapesResponse = ListTapesResponse'
{ _ltrsMarker :: !(Maybe Text)
, _ltrsTapeInfos :: !(Maybe [TapeInfo])
, _ltrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listTapesResponse
:: Int
-> ListTapesResponse
listTapesResponse pResponseStatus_ =
ListTapesResponse'
{ _ltrsMarker = Nothing
, _ltrsTapeInfos = Nothing
, _ltrsResponseStatus = pResponseStatus_
}
ltrsMarker :: Lens' ListTapesResponse (Maybe Text)
ltrsMarker = lens _ltrsMarker (\ s a -> s{_ltrsMarker = a});
ltrsTapeInfos :: Lens' ListTapesResponse [TapeInfo]
ltrsTapeInfos = lens _ltrsTapeInfos (\ s a -> s{_ltrsTapeInfos = a}) . _Default . _Coerce;
ltrsResponseStatus :: Lens' ListTapesResponse Int
ltrsResponseStatus = lens _ltrsResponseStatus (\ s a -> s{_ltrsResponseStatus = a});
instance NFData ListTapesResponse