{-# 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.MediaStore.ListContainers
(
listContainers
, ListContainers
, lcNextToken
, lcMaxResults
, listContainersResponse
, ListContainersResponse
, lcrsNextToken
, lcrsResponseStatus
, lcrsContainers
) where
import Network.AWS.Lens
import Network.AWS.MediaStore.Types
import Network.AWS.MediaStore.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListContainers = ListContainers'
{ _lcNextToken :: !(Maybe Text)
, _lcMaxResults :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listContainers
:: ListContainers
listContainers =
ListContainers' {_lcNextToken = Nothing, _lcMaxResults = Nothing}
lcNextToken :: Lens' ListContainers (Maybe Text)
lcNextToken = lens _lcNextToken (\ s a -> s{_lcNextToken = a})
lcMaxResults :: Lens' ListContainers (Maybe Natural)
lcMaxResults = lens _lcMaxResults (\ s a -> s{_lcMaxResults = a}) . mapping _Nat
instance AWSRequest ListContainers where
type Rs ListContainers = ListContainersResponse
request = postJSON mediaStore
response
= receiveJSON
(\ s h x ->
ListContainersResponse' <$>
(x .?> "NextToken") <*> (pure (fromEnum s)) <*>
(x .?> "Containers" .!@ mempty))
instance Hashable ListContainers where
instance NFData ListContainers where
instance ToHeaders ListContainers where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("MediaStore_20170901.ListContainers" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListContainers where
toJSON ListContainers'{..}
= object
(catMaybes
[("NextToken" .=) <$> _lcNextToken,
("MaxResults" .=) <$> _lcMaxResults])
instance ToPath ListContainers where
toPath = const "/"
instance ToQuery ListContainers where
toQuery = const mempty
data ListContainersResponse = ListContainersResponse'
{ _lcrsNextToken :: !(Maybe Text)
, _lcrsResponseStatus :: !Int
, _lcrsContainers :: ![Container]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listContainersResponse
:: Int
-> ListContainersResponse
listContainersResponse pResponseStatus_ =
ListContainersResponse'
{ _lcrsNextToken = Nothing
, _lcrsResponseStatus = pResponseStatus_
, _lcrsContainers = mempty
}
lcrsNextToken :: Lens' ListContainersResponse (Maybe Text)
lcrsNextToken = lens _lcrsNextToken (\ s a -> s{_lcrsNextToken = a})
lcrsResponseStatus :: Lens' ListContainersResponse Int
lcrsResponseStatus = lens _lcrsResponseStatus (\ s a -> s{_lcrsResponseStatus = a})
lcrsContainers :: Lens' ListContainersResponse [Container]
lcrsContainers = lens _lcrsContainers (\ s a -> s{_lcrsContainers = a}) . _Coerce
instance NFData ListContainersResponse where