{-# 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.CodeDeploy.ListDeploymentConfigs
(
listDeploymentConfigs
, ListDeploymentConfigs
, ldcNextToken
, listDeploymentConfigsResponse
, ListDeploymentConfigsResponse
, ldcrsNextToken
, ldcrsDeploymentConfigsList
, ldcrsResponseStatus
) where
import Network.AWS.CodeDeploy.Types
import Network.AWS.CodeDeploy.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype ListDeploymentConfigs = ListDeploymentConfigs'
{ _ldcNextToken :: Maybe Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listDeploymentConfigs
:: ListDeploymentConfigs
listDeploymentConfigs = ListDeploymentConfigs' {_ldcNextToken = Nothing}
ldcNextToken :: Lens' ListDeploymentConfigs (Maybe Text)
ldcNextToken = lens _ldcNextToken (\ s a -> s{_ldcNextToken = a})
instance AWSPager ListDeploymentConfigs where
page rq rs
| stop (rs ^. ldcrsNextToken) = Nothing
| stop (rs ^. ldcrsDeploymentConfigsList) = Nothing
| otherwise =
Just $ rq & ldcNextToken .~ rs ^. ldcrsNextToken
instance AWSRequest ListDeploymentConfigs where
type Rs ListDeploymentConfigs =
ListDeploymentConfigsResponse
request = postJSON codeDeploy
response
= receiveJSON
(\ s h x ->
ListDeploymentConfigsResponse' <$>
(x .?> "nextToken") <*>
(x .?> "deploymentConfigsList" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListDeploymentConfigs where
instance NFData ListDeploymentConfigs where
instance ToHeaders ListDeploymentConfigs where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeDeploy_20141006.ListDeploymentConfigs" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListDeploymentConfigs where
toJSON ListDeploymentConfigs'{..}
= object
(catMaybes [("nextToken" .=) <$> _ldcNextToken])
instance ToPath ListDeploymentConfigs where
toPath = const "/"
instance ToQuery ListDeploymentConfigs where
toQuery = const mempty
data ListDeploymentConfigsResponse = ListDeploymentConfigsResponse'
{ _ldcrsNextToken :: !(Maybe Text)
, _ldcrsDeploymentConfigsList :: !(Maybe [Text])
, _ldcrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listDeploymentConfigsResponse
:: Int
-> ListDeploymentConfigsResponse
listDeploymentConfigsResponse pResponseStatus_ =
ListDeploymentConfigsResponse'
{ _ldcrsNextToken = Nothing
, _ldcrsDeploymentConfigsList = Nothing
, _ldcrsResponseStatus = pResponseStatus_
}
ldcrsNextToken :: Lens' ListDeploymentConfigsResponse (Maybe Text)
ldcrsNextToken = lens _ldcrsNextToken (\ s a -> s{_ldcrsNextToken = a})
ldcrsDeploymentConfigsList :: Lens' ListDeploymentConfigsResponse [Text]
ldcrsDeploymentConfigsList = lens _ldcrsDeploymentConfigsList (\ s a -> s{_ldcrsDeploymentConfigsList = a}) . _Default . _Coerce
ldcrsResponseStatus :: Lens' ListDeploymentConfigsResponse Int
ldcrsResponseStatus = lens _ldcrsResponseStatus (\ s a -> s{_ldcrsResponseStatus = a})
instance NFData ListDeploymentConfigsResponse where