module Network.AWS.CodeDeploy.ListDeployments
(
listDeployments
, ListDeployments
, ldCreateTimeRange
, ldNextToken
, ldIncludeOnlyStatuses
, ldApplicationName
, ldDeploymentGroupName
, listDeploymentsResponse
, ListDeploymentsResponse
, ldrsNextToken
, ldrsDeployments
, ldrsStatus
) where
import Network.AWS.CodeDeploy.Types
import Network.AWS.CodeDeploy.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListDeployments = ListDeployments'
{ _ldCreateTimeRange :: !(Maybe TimeRange)
, _ldNextToken :: !(Maybe Text)
, _ldIncludeOnlyStatuses :: !(Maybe [DeploymentStatus])
, _ldApplicationName :: !(Maybe Text)
, _ldDeploymentGroupName :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listDeployments
:: ListDeployments
listDeployments =
ListDeployments'
{ _ldCreateTimeRange = Nothing
, _ldNextToken = Nothing
, _ldIncludeOnlyStatuses = Nothing
, _ldApplicationName = Nothing
, _ldDeploymentGroupName = Nothing
}
ldCreateTimeRange :: Lens' ListDeployments (Maybe TimeRange)
ldCreateTimeRange = lens _ldCreateTimeRange (\ s a -> s{_ldCreateTimeRange = a});
ldNextToken :: Lens' ListDeployments (Maybe Text)
ldNextToken = lens _ldNextToken (\ s a -> s{_ldNextToken = a});
ldIncludeOnlyStatuses :: Lens' ListDeployments [DeploymentStatus]
ldIncludeOnlyStatuses = lens _ldIncludeOnlyStatuses (\ s a -> s{_ldIncludeOnlyStatuses = a}) . _Default . _Coerce;
ldApplicationName :: Lens' ListDeployments (Maybe Text)
ldApplicationName = lens _ldApplicationName (\ s a -> s{_ldApplicationName = a});
ldDeploymentGroupName :: Lens' ListDeployments (Maybe Text)
ldDeploymentGroupName = lens _ldDeploymentGroupName (\ s a -> s{_ldDeploymentGroupName = a});
instance AWSRequest ListDeployments where
type Rs ListDeployments = ListDeploymentsResponse
request = postJSON codeDeploy
response
= receiveJSON
(\ s h x ->
ListDeploymentsResponse' <$>
(x .?> "nextToken") <*>
(x .?> "deployments" .!@ mempty)
<*> (pure (fromEnum s)))
instance ToHeaders ListDeployments where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeDeploy_20141006.ListDeployments" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListDeployments where
toJSON ListDeployments'{..}
= object
(catMaybes
[("createTimeRange" .=) <$> _ldCreateTimeRange,
("nextToken" .=) <$> _ldNextToken,
("includeOnlyStatuses" .=) <$>
_ldIncludeOnlyStatuses,
("applicationName" .=) <$> _ldApplicationName,
("deploymentGroupName" .=) <$>
_ldDeploymentGroupName])
instance ToPath ListDeployments where
toPath = const "/"
instance ToQuery ListDeployments where
toQuery = const mempty
data ListDeploymentsResponse = ListDeploymentsResponse'
{ _ldrsNextToken :: !(Maybe Text)
, _ldrsDeployments :: !(Maybe [Text])
, _ldrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listDeploymentsResponse
:: Int
-> ListDeploymentsResponse
listDeploymentsResponse pStatus_ =
ListDeploymentsResponse'
{ _ldrsNextToken = Nothing
, _ldrsDeployments = Nothing
, _ldrsStatus = pStatus_
}
ldrsNextToken :: Lens' ListDeploymentsResponse (Maybe Text)
ldrsNextToken = lens _ldrsNextToken (\ s a -> s{_ldrsNextToken = a});
ldrsDeployments :: Lens' ListDeploymentsResponse [Text]
ldrsDeployments = lens _ldrsDeployments (\ s a -> s{_ldrsDeployments = a}) . _Default . _Coerce;
ldrsStatus :: Lens' ListDeploymentsResponse Int
ldrsStatus = lens _ldrsStatus (\ s a -> s{_ldrsStatus = a});