module Network.AWS.MachineLearning.DescribeDataSources
(
describeDataSources
, DescribeDataSources
, ddsEQ
, ddsGE
, ddsPrefix
, ddsGT
, ddsNE
, ddsNextToken
, ddsSortOrder
, ddsLimit
, ddsLT
, ddsFilterVariable
, ddsLE
, describeDataSourcesResponse
, DescribeDataSourcesResponse
, ddssrsResults
, ddssrsNextToken
, ddssrsResponseStatus
) where
import Network.AWS.MachineLearning.Types
import Network.AWS.MachineLearning.Types.Product
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeDataSources = DescribeDataSources'
{ _ddsEQ :: !(Maybe Text)
, _ddsGE :: !(Maybe Text)
, _ddsPrefix :: !(Maybe Text)
, _ddsGT :: !(Maybe Text)
, _ddsNE :: !(Maybe Text)
, _ddsNextToken :: !(Maybe Text)
, _ddsSortOrder :: !(Maybe SortOrder)
, _ddsLimit :: !(Maybe Nat)
, _ddsLT :: !(Maybe Text)
, _ddsFilterVariable :: !(Maybe DataSourceFilterVariable)
, _ddsLE :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeDataSources
:: DescribeDataSources
describeDataSources =
DescribeDataSources'
{ _ddsEQ = Nothing
, _ddsGE = Nothing
, _ddsPrefix = Nothing
, _ddsGT = Nothing
, _ddsNE = Nothing
, _ddsNextToken = Nothing
, _ddsSortOrder = Nothing
, _ddsLimit = Nothing
, _ddsLT = Nothing
, _ddsFilterVariable = Nothing
, _ddsLE = Nothing
}
ddsEQ :: Lens' DescribeDataSources (Maybe Text)
ddsEQ = lens _ddsEQ (\ s a -> s{_ddsEQ = a});
ddsGE :: Lens' DescribeDataSources (Maybe Text)
ddsGE = lens _ddsGE (\ s a -> s{_ddsGE = a});
ddsPrefix :: Lens' DescribeDataSources (Maybe Text)
ddsPrefix = lens _ddsPrefix (\ s a -> s{_ddsPrefix = a});
ddsGT :: Lens' DescribeDataSources (Maybe Text)
ddsGT = lens _ddsGT (\ s a -> s{_ddsGT = a});
ddsNE :: Lens' DescribeDataSources (Maybe Text)
ddsNE = lens _ddsNE (\ s a -> s{_ddsNE = a});
ddsNextToken :: Lens' DescribeDataSources (Maybe Text)
ddsNextToken = lens _ddsNextToken (\ s a -> s{_ddsNextToken = a});
ddsSortOrder :: Lens' DescribeDataSources (Maybe SortOrder)
ddsSortOrder = lens _ddsSortOrder (\ s a -> s{_ddsSortOrder = a});
ddsLimit :: Lens' DescribeDataSources (Maybe Natural)
ddsLimit = lens _ddsLimit (\ s a -> s{_ddsLimit = a}) . mapping _Nat;
ddsLT :: Lens' DescribeDataSources (Maybe Text)
ddsLT = lens _ddsLT (\ s a -> s{_ddsLT = a});
ddsFilterVariable :: Lens' DescribeDataSources (Maybe DataSourceFilterVariable)
ddsFilterVariable = lens _ddsFilterVariable (\ s a -> s{_ddsFilterVariable = a});
ddsLE :: Lens' DescribeDataSources (Maybe Text)
ddsLE = lens _ddsLE (\ s a -> s{_ddsLE = a});
instance AWSPager DescribeDataSources where
page rq rs
| stop (rs ^. ddssrsNextToken) = Nothing
| stop (rs ^. ddssrsResults) = Nothing
| otherwise =
Just $ rq & ddsNextToken .~ rs ^. ddssrsNextToken
instance AWSRequest DescribeDataSources where
type Rs DescribeDataSources =
DescribeDataSourcesResponse
request = postJSON machineLearning
response
= receiveJSON
(\ s h x ->
DescribeDataSourcesResponse' <$>
(x .?> "Results" .!@ mempty) <*> (x .?> "NextToken")
<*> (pure (fromEnum s)))
instance ToHeaders DescribeDataSources where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonML_20141212.DescribeDataSources" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeDataSources where
toJSON DescribeDataSources'{..}
= object
(catMaybes
[("EQ" .=) <$> _ddsEQ, ("GE" .=) <$> _ddsGE,
("Prefix" .=) <$> _ddsPrefix, ("GT" .=) <$> _ddsGT,
("NE" .=) <$> _ddsNE,
("NextToken" .=) <$> _ddsNextToken,
("SortOrder" .=) <$> _ddsSortOrder,
("Limit" .=) <$> _ddsLimit, ("LT" .=) <$> _ddsLT,
("FilterVariable" .=) <$> _ddsFilterVariable,
("LE" .=) <$> _ddsLE])
instance ToPath DescribeDataSources where
toPath = const "/"
instance ToQuery DescribeDataSources where
toQuery = const mempty
data DescribeDataSourcesResponse = DescribeDataSourcesResponse'
{ _ddssrsResults :: !(Maybe [DataSource])
, _ddssrsNextToken :: !(Maybe Text)
, _ddssrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeDataSourcesResponse
:: Int
-> DescribeDataSourcesResponse
describeDataSourcesResponse pResponseStatus_ =
DescribeDataSourcesResponse'
{ _ddssrsResults = Nothing
, _ddssrsNextToken = Nothing
, _ddssrsResponseStatus = pResponseStatus_
}
ddssrsResults :: Lens' DescribeDataSourcesResponse [DataSource]
ddssrsResults = lens _ddssrsResults (\ s a -> s{_ddssrsResults = a}) . _Default . _Coerce;
ddssrsNextToken :: Lens' DescribeDataSourcesResponse (Maybe Text)
ddssrsNextToken = lens _ddssrsNextToken (\ s a -> s{_ddssrsNextToken = a});
ddssrsResponseStatus :: Lens' DescribeDataSourcesResponse Int
ddssrsResponseStatus = lens _ddssrsResponseStatus (\ s a -> s{_ddssrsResponseStatus = a});