module Network.AWS.CloudWatchLogs.DescribeLogStreams
(
DescribeLogStreams
, describeLogStreams
, dls1Limit
, dls1LogGroupName
, dls1LogStreamNamePrefix
, dls1NextToken
, DescribeLogStreamsResponse
, describeLogStreamsResponse
, dlsrLogStreams
, dlsrNextToken
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.CloudWatchLogs.Types
import qualified GHC.Exts
data DescribeLogStreams = DescribeLogStreams
{ _dls1Limit :: Maybe Nat
, _dls1LogGroupName :: Text
, _dls1LogStreamNamePrefix :: Maybe Text
, _dls1NextToken :: Maybe Text
} deriving (Eq, Ord, Show)
describeLogStreams :: Text
-> DescribeLogStreams
describeLogStreams p1 = DescribeLogStreams
{ _dls1LogGroupName = p1
, _dls1LogStreamNamePrefix = Nothing
, _dls1NextToken = Nothing
, _dls1Limit = Nothing
}
dls1Limit :: Lens' DescribeLogStreams (Maybe Natural)
dls1Limit = lens _dls1Limit (\s a -> s { _dls1Limit = a }) . mapping _Nat
dls1LogGroupName :: Lens' DescribeLogStreams Text
dls1LogGroupName = lens _dls1LogGroupName (\s a -> s { _dls1LogGroupName = a })
dls1LogStreamNamePrefix :: Lens' DescribeLogStreams (Maybe Text)
dls1LogStreamNamePrefix =
lens _dls1LogStreamNamePrefix (\s a -> s { _dls1LogStreamNamePrefix = a })
dls1NextToken :: Lens' DescribeLogStreams (Maybe Text)
dls1NextToken = lens _dls1NextToken (\s a -> s { _dls1NextToken = a })
data DescribeLogStreamsResponse = DescribeLogStreamsResponse
{ _dlsrLogStreams :: List "logStreams" LogStream
, _dlsrNextToken :: Maybe Text
} deriving (Eq, Show)
describeLogStreamsResponse :: DescribeLogStreamsResponse
describeLogStreamsResponse = DescribeLogStreamsResponse
{ _dlsrLogStreams = mempty
, _dlsrNextToken = Nothing
}
dlsrLogStreams :: Lens' DescribeLogStreamsResponse [LogStream]
dlsrLogStreams = lens _dlsrLogStreams (\s a -> s { _dlsrLogStreams = a }) . _List
dlsrNextToken :: Lens' DescribeLogStreamsResponse (Maybe Text)
dlsrNextToken = lens _dlsrNextToken (\s a -> s { _dlsrNextToken = a })
instance ToPath DescribeLogStreams where
toPath = const "/"
instance ToQuery DescribeLogStreams where
toQuery = const mempty
instance ToHeaders DescribeLogStreams
instance ToJSON DescribeLogStreams where
toJSON DescribeLogStreams{..} = object
[ "logGroupName" .= _dls1LogGroupName
, "logStreamNamePrefix" .= _dls1LogStreamNamePrefix
, "nextToken" .= _dls1NextToken
, "limit" .= _dls1Limit
]
instance AWSRequest DescribeLogStreams where
type Sv DescribeLogStreams = CloudWatchLogs
type Rs DescribeLogStreams = DescribeLogStreamsResponse
request = post "DescribeLogStreams"
response = jsonResponse
instance FromJSON DescribeLogStreamsResponse where
parseJSON = withObject "DescribeLogStreamsResponse" $ \o -> DescribeLogStreamsResponse
<$> o .: "logStreams"
<*> o .:? "nextToken"