{-# 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.DescribeInstancePatches
(
describeInstancePatches
, DescribeInstancePatches
, dipFilters
, dipNextToken
, dipMaxResults
, dipInstanceId
, describeInstancePatchesResponse
, DescribeInstancePatchesResponse
, diprsPatches
, diprsNextToken
, diprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SSM.Types
import Network.AWS.SSM.Types.Product
data DescribeInstancePatches = DescribeInstancePatches'
{ _dipFilters :: !(Maybe [PatchOrchestratorFilter])
, _dipNextToken :: !(Maybe Text)
, _dipMaxResults :: !(Maybe Nat)
, _dipInstanceId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeInstancePatches
:: Text
-> DescribeInstancePatches
describeInstancePatches pInstanceId_ =
DescribeInstancePatches'
{ _dipFilters = Nothing
, _dipNextToken = Nothing
, _dipMaxResults = Nothing
, _dipInstanceId = pInstanceId_
}
dipFilters :: Lens' DescribeInstancePatches [PatchOrchestratorFilter]
dipFilters = lens _dipFilters (\ s a -> s{_dipFilters = a}) . _Default . _Coerce
dipNextToken :: Lens' DescribeInstancePatches (Maybe Text)
dipNextToken = lens _dipNextToken (\ s a -> s{_dipNextToken = a})
dipMaxResults :: Lens' DescribeInstancePatches (Maybe Natural)
dipMaxResults = lens _dipMaxResults (\ s a -> s{_dipMaxResults = a}) . mapping _Nat
dipInstanceId :: Lens' DescribeInstancePatches Text
dipInstanceId = lens _dipInstanceId (\ s a -> s{_dipInstanceId = a})
instance AWSRequest DescribeInstancePatches where
type Rs DescribeInstancePatches =
DescribeInstancePatchesResponse
request = postJSON ssm
response
= receiveJSON
(\ s h x ->
DescribeInstancePatchesResponse' <$>
(x .?> "Patches" .!@ mempty) <*> (x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable DescribeInstancePatches where
instance NFData DescribeInstancePatches where
instance ToHeaders DescribeInstancePatches where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.DescribeInstancePatches" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeInstancePatches where
toJSON DescribeInstancePatches'{..}
= object
(catMaybes
[("Filters" .=) <$> _dipFilters,
("NextToken" .=) <$> _dipNextToken,
("MaxResults" .=) <$> _dipMaxResults,
Just ("InstanceId" .= _dipInstanceId)])
instance ToPath DescribeInstancePatches where
toPath = const "/"
instance ToQuery DescribeInstancePatches where
toQuery = const mempty
data DescribeInstancePatchesResponse = DescribeInstancePatchesResponse'
{ _diprsPatches :: !(Maybe [PatchComplianceData])
, _diprsNextToken :: !(Maybe Text)
, _diprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeInstancePatchesResponse
:: Int
-> DescribeInstancePatchesResponse
describeInstancePatchesResponse pResponseStatus_ =
DescribeInstancePatchesResponse'
{ _diprsPatches = Nothing
, _diprsNextToken = Nothing
, _diprsResponseStatus = pResponseStatus_
}
diprsPatches :: Lens' DescribeInstancePatchesResponse [PatchComplianceData]
diprsPatches = lens _diprsPatches (\ s a -> s{_diprsPatches = a}) . _Default . _Coerce
diprsNextToken :: Lens' DescribeInstancePatchesResponse (Maybe Text)
diprsNextToken = lens _diprsNextToken (\ s a -> s{_diprsNextToken = a})
diprsResponseStatus :: Lens' DescribeInstancePatchesResponse Int
diprsResponseStatus = lens _diprsResponseStatus (\ s a -> s{_diprsResponseStatus = a})
instance NFData DescribeInstancePatchesResponse where