module Network.AWS.CodeDeploy.ListDeploymentGroups
(
ListDeploymentGroups
, listDeploymentGroups
, ldgApplicationName
, ldgNextToken
, ListDeploymentGroupsResponse
, listDeploymentGroupsResponse
, ldgrApplicationName
, ldgrDeploymentGroups
, ldgrNextToken
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.CodeDeploy.Types
import qualified GHC.Exts
data ListDeploymentGroups = ListDeploymentGroups
{ _ldgApplicationName :: Text
, _ldgNextToken :: Maybe Text
} deriving (Eq, Ord, Read, Show)
listDeploymentGroups :: Text
-> ListDeploymentGroups
listDeploymentGroups p1 = ListDeploymentGroups
{ _ldgApplicationName = p1
, _ldgNextToken = Nothing
}
ldgApplicationName :: Lens' ListDeploymentGroups Text
ldgApplicationName =
lens _ldgApplicationName (\s a -> s { _ldgApplicationName = a })
ldgNextToken :: Lens' ListDeploymentGroups (Maybe Text)
ldgNextToken = lens _ldgNextToken (\s a -> s { _ldgNextToken = a })
data ListDeploymentGroupsResponse = ListDeploymentGroupsResponse
{ _ldgrApplicationName :: Maybe Text
, _ldgrDeploymentGroups :: List "deploymentGroups" Text
, _ldgrNextToken :: Maybe Text
} deriving (Eq, Ord, Read, Show)
listDeploymentGroupsResponse :: ListDeploymentGroupsResponse
listDeploymentGroupsResponse = ListDeploymentGroupsResponse
{ _ldgrApplicationName = Nothing
, _ldgrDeploymentGroups = mempty
, _ldgrNextToken = Nothing
}
ldgrApplicationName :: Lens' ListDeploymentGroupsResponse (Maybe Text)
ldgrApplicationName =
lens _ldgrApplicationName (\s a -> s { _ldgrApplicationName = a })
ldgrDeploymentGroups :: Lens' ListDeploymentGroupsResponse [Text]
ldgrDeploymentGroups =
lens _ldgrDeploymentGroups (\s a -> s { _ldgrDeploymentGroups = a })
. _List
ldgrNextToken :: Lens' ListDeploymentGroupsResponse (Maybe Text)
ldgrNextToken = lens _ldgrNextToken (\s a -> s { _ldgrNextToken = a })
instance ToPath ListDeploymentGroups where
toPath = const "/"
instance ToQuery ListDeploymentGroups where
toQuery = const mempty
instance ToHeaders ListDeploymentGroups
instance ToJSON ListDeploymentGroups where
toJSON ListDeploymentGroups{..} = object
[ "applicationName" .= _ldgApplicationName
, "nextToken" .= _ldgNextToken
]
instance AWSRequest ListDeploymentGroups where
type Sv ListDeploymentGroups = CodeDeploy
type Rs ListDeploymentGroups = ListDeploymentGroupsResponse
request = post "ListDeploymentGroups"
response = jsonResponse
instance FromJSON ListDeploymentGroupsResponse where
parseJSON = withObject "ListDeploymentGroupsResponse" $ \o -> ListDeploymentGroupsResponse
<$> o .:? "applicationName"
<*> o .:? "deploymentGroups" .!= mempty
<*> o .:? "nextToken"