{-# 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.BatchGetDeploymentGroups
(
batchGetDeploymentGroups
, BatchGetDeploymentGroups
, bgdgApplicationName
, bgdgDeploymentGroupNames
, batchGetDeploymentGroupsResponse
, BatchGetDeploymentGroupsResponse
, bgdgrsDeploymentGroupsInfo
, bgdgrsErrorMessage
, bgdgrsResponseStatus
) where
import Network.AWS.CodeDeploy.Types
import Network.AWS.CodeDeploy.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data BatchGetDeploymentGroups = BatchGetDeploymentGroups'
{ _bgdgApplicationName :: !Text
, _bgdgDeploymentGroupNames :: ![Text]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
batchGetDeploymentGroups
:: Text
-> BatchGetDeploymentGroups
batchGetDeploymentGroups pApplicationName_ =
BatchGetDeploymentGroups'
{ _bgdgApplicationName = pApplicationName_
, _bgdgDeploymentGroupNames = mempty
}
bgdgApplicationName :: Lens' BatchGetDeploymentGroups Text
bgdgApplicationName = lens _bgdgApplicationName (\ s a -> s{_bgdgApplicationName = a});
bgdgDeploymentGroupNames :: Lens' BatchGetDeploymentGroups [Text]
bgdgDeploymentGroupNames = lens _bgdgDeploymentGroupNames (\ s a -> s{_bgdgDeploymentGroupNames = a}) . _Coerce;
instance AWSRequest BatchGetDeploymentGroups where
type Rs BatchGetDeploymentGroups =
BatchGetDeploymentGroupsResponse
request = postJSON codeDeploy
response
= receiveJSON
(\ s h x ->
BatchGetDeploymentGroupsResponse' <$>
(x .?> "deploymentGroupsInfo" .!@ mempty) <*>
(x .?> "errorMessage")
<*> (pure (fromEnum s)))
instance Hashable BatchGetDeploymentGroups
instance NFData BatchGetDeploymentGroups
instance ToHeaders BatchGetDeploymentGroups where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeDeploy_20141006.BatchGetDeploymentGroups" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchGetDeploymentGroups where
toJSON BatchGetDeploymentGroups'{..}
= object
(catMaybes
[Just ("applicationName" .= _bgdgApplicationName),
Just
("deploymentGroupNames" .=
_bgdgDeploymentGroupNames)])
instance ToPath BatchGetDeploymentGroups where
toPath = const "/"
instance ToQuery BatchGetDeploymentGroups where
toQuery = const mempty
data BatchGetDeploymentGroupsResponse = BatchGetDeploymentGroupsResponse'
{ _bgdgrsDeploymentGroupsInfo :: !(Maybe [DeploymentGroupInfo])
, _bgdgrsErrorMessage :: !(Maybe Text)
, _bgdgrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
batchGetDeploymentGroupsResponse
:: Int
-> BatchGetDeploymentGroupsResponse
batchGetDeploymentGroupsResponse pResponseStatus_ =
BatchGetDeploymentGroupsResponse'
{ _bgdgrsDeploymentGroupsInfo = Nothing
, _bgdgrsErrorMessage = Nothing
, _bgdgrsResponseStatus = pResponseStatus_
}
bgdgrsDeploymentGroupsInfo :: Lens' BatchGetDeploymentGroupsResponse [DeploymentGroupInfo]
bgdgrsDeploymentGroupsInfo = lens _bgdgrsDeploymentGroupsInfo (\ s a -> s{_bgdgrsDeploymentGroupsInfo = a}) . _Default . _Coerce;
bgdgrsErrorMessage :: Lens' BatchGetDeploymentGroupsResponse (Maybe Text)
bgdgrsErrorMessage = lens _bgdgrsErrorMessage (\ s a -> s{_bgdgrsErrorMessage = a});
bgdgrsResponseStatus :: Lens' BatchGetDeploymentGroupsResponse Int
bgdgrsResponseStatus = lens _bgdgrsResponseStatus (\ s a -> s{_bgdgrsResponseStatus = a});
instance NFData BatchGetDeploymentGroupsResponse