{-# 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.SSM.ListCommandInvocations
(
listCommandInvocations
, ListCommandInvocations
, lciInstanceId
, lciFilters
, lciNextToken
, lciCommandId
, lciDetails
, lciMaxResults
, listCommandInvocationsResponse
, ListCommandInvocationsResponse
, lcirsNextToken
, lcirsCommandInvocations
, lcirsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SSM.Types
import Network.AWS.SSM.Types.Product
data ListCommandInvocations = ListCommandInvocations'
{ _lciInstanceId :: !(Maybe Text)
, _lciFilters :: !(Maybe (List1 CommandFilter))
, _lciNextToken :: !(Maybe Text)
, _lciCommandId :: !(Maybe Text)
, _lciDetails :: !(Maybe Bool)
, _lciMaxResults :: !(Maybe Nat)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listCommandInvocations
:: ListCommandInvocations
listCommandInvocations =
ListCommandInvocations'
{ _lciInstanceId = Nothing
, _lciFilters = Nothing
, _lciNextToken = Nothing
, _lciCommandId = Nothing
, _lciDetails = Nothing
, _lciMaxResults = Nothing
}
lciInstanceId :: Lens' ListCommandInvocations (Maybe Text)
lciInstanceId = lens _lciInstanceId (\ s a -> s{_lciInstanceId = a});
lciFilters :: Lens' ListCommandInvocations (Maybe (NonEmpty CommandFilter))
lciFilters = lens _lciFilters (\ s a -> s{_lciFilters = a}) . mapping _List1;
lciNextToken :: Lens' ListCommandInvocations (Maybe Text)
lciNextToken = lens _lciNextToken (\ s a -> s{_lciNextToken = a});
lciCommandId :: Lens' ListCommandInvocations (Maybe Text)
lciCommandId = lens _lciCommandId (\ s a -> s{_lciCommandId = a});
lciDetails :: Lens' ListCommandInvocations (Maybe Bool)
lciDetails = lens _lciDetails (\ s a -> s{_lciDetails = a});
lciMaxResults :: Lens' ListCommandInvocations (Maybe Natural)
lciMaxResults = lens _lciMaxResults (\ s a -> s{_lciMaxResults = a}) . mapping _Nat;
instance AWSPager ListCommandInvocations where
page rq rs
| stop (rs ^. lcirsNextToken) = Nothing
| stop (rs ^. lcirsCommandInvocations) = Nothing
| otherwise =
Just $ rq & lciNextToken .~ rs ^. lcirsNextToken
instance AWSRequest ListCommandInvocations where
type Rs ListCommandInvocations =
ListCommandInvocationsResponse
request = postJSON ssm
response
= receiveJSON
(\ s h x ->
ListCommandInvocationsResponse' <$>
(x .?> "NextToken") <*>
(x .?> "CommandInvocations" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListCommandInvocations
instance NFData ListCommandInvocations
instance ToHeaders ListCommandInvocations where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.ListCommandInvocations" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListCommandInvocations where
toJSON ListCommandInvocations'{..}
= object
(catMaybes
[("InstanceId" .=) <$> _lciInstanceId,
("Filters" .=) <$> _lciFilters,
("NextToken" .=) <$> _lciNextToken,
("CommandId" .=) <$> _lciCommandId,
("Details" .=) <$> _lciDetails,
("MaxResults" .=) <$> _lciMaxResults])
instance ToPath ListCommandInvocations where
toPath = const "/"
instance ToQuery ListCommandInvocations where
toQuery = const mempty
data ListCommandInvocationsResponse = ListCommandInvocationsResponse'
{ _lcirsNextToken :: !(Maybe Text)
, _lcirsCommandInvocations :: !(Maybe [CommandInvocation])
, _lcirsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listCommandInvocationsResponse
:: Int
-> ListCommandInvocationsResponse
listCommandInvocationsResponse pResponseStatus_ =
ListCommandInvocationsResponse'
{ _lcirsNextToken = Nothing
, _lcirsCommandInvocations = Nothing
, _lcirsResponseStatus = pResponseStatus_
}
lcirsNextToken :: Lens' ListCommandInvocationsResponse (Maybe Text)
lcirsNextToken = lens _lcirsNextToken (\ s a -> s{_lcirsNextToken = a});
lcirsCommandInvocations :: Lens' ListCommandInvocationsResponse [CommandInvocation]
lcirsCommandInvocations = lens _lcirsCommandInvocations (\ s a -> s{_lcirsCommandInvocations = a}) . _Default . _Coerce;
lcirsResponseStatus :: Lens' ListCommandInvocationsResponse Int
lcirsResponseStatus = lens _lcirsResponseStatus (\ s a -> s{_lcirsResponseStatus = a});
instance NFData ListCommandInvocationsResponse