module Network.AWS.CloudWatchLogs.DescribeLogGroups
(
DescribeLogGroups
, describeLogGroups
, dlgLimit
, dlgLogGroupNamePrefix
, dlgNextToken
, DescribeLogGroupsResponse
, describeLogGroupsResponse
, dlgrLogGroups
, dlgrNextToken
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.CloudWatchLogs.Types
import qualified GHC.Exts
data DescribeLogGroups = DescribeLogGroups
{ _dlgLimit :: Maybe Nat
, _dlgLogGroupNamePrefix :: Maybe Text
, _dlgNextToken :: Maybe Text
} deriving (Eq, Ord, Show)
describeLogGroups :: DescribeLogGroups
describeLogGroups = DescribeLogGroups
{ _dlgLogGroupNamePrefix = Nothing
, _dlgNextToken = Nothing
, _dlgLimit = Nothing
}
dlgLimit :: Lens' DescribeLogGroups (Maybe Natural)
dlgLimit = lens _dlgLimit (\s a -> s { _dlgLimit = a }) . mapping _Nat
dlgLogGroupNamePrefix :: Lens' DescribeLogGroups (Maybe Text)
dlgLogGroupNamePrefix =
lens _dlgLogGroupNamePrefix (\s a -> s { _dlgLogGroupNamePrefix = a })
dlgNextToken :: Lens' DescribeLogGroups (Maybe Text)
dlgNextToken = lens _dlgNextToken (\s a -> s { _dlgNextToken = a })
data DescribeLogGroupsResponse = DescribeLogGroupsResponse
{ _dlgrLogGroups :: List "logGroups" LogGroup
, _dlgrNextToken :: Maybe Text
} deriving (Eq, Show)
describeLogGroupsResponse :: DescribeLogGroupsResponse
describeLogGroupsResponse = DescribeLogGroupsResponse
{ _dlgrLogGroups = mempty
, _dlgrNextToken = Nothing
}
dlgrLogGroups :: Lens' DescribeLogGroupsResponse [LogGroup]
dlgrLogGroups = lens _dlgrLogGroups (\s a -> s { _dlgrLogGroups = a }) . _List
dlgrNextToken :: Lens' DescribeLogGroupsResponse (Maybe Text)
dlgrNextToken = lens _dlgrNextToken (\s a -> s { _dlgrNextToken = a })
instance ToPath DescribeLogGroups where
toPath = const "/"
instance ToQuery DescribeLogGroups where
toQuery = const mempty
instance ToHeaders DescribeLogGroups
instance ToJSON DescribeLogGroups where
toJSON DescribeLogGroups{..} = object
[ "logGroupNamePrefix" .= _dlgLogGroupNamePrefix
, "nextToken" .= _dlgNextToken
, "limit" .= _dlgLimit
]
instance AWSRequest DescribeLogGroups where
type Sv DescribeLogGroups = CloudWatchLogs
type Rs DescribeLogGroups = DescribeLogGroupsResponse
request = post "DescribeLogGroups"
response = jsonResponse
instance FromJSON DescribeLogGroupsResponse where
parseJSON = withObject "DescribeLogGroupsResponse" $ \o -> DescribeLogGroupsResponse
<$> o .:? "logGroups" .!= mempty
<*> o .:? "nextToken"