{-# 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.DescribeInstancePatchStates
(
describeInstancePatchStates
, DescribeInstancePatchStates
, dipsNextToken
, dipsMaxResults
, dipsInstanceIds
, describeInstancePatchStatesResponse
, DescribeInstancePatchStatesResponse
, dipsrsNextToken
, dipsrsInstancePatchStates
, dipsrsResponseStatus
) 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 DescribeInstancePatchStates = DescribeInstancePatchStates'
{ _dipsNextToken :: !(Maybe Text)
, _dipsMaxResults :: !(Maybe Nat)
, _dipsInstanceIds :: ![Text]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeInstancePatchStates
:: DescribeInstancePatchStates
describeInstancePatchStates =
DescribeInstancePatchStates'
{ _dipsNextToken = Nothing
, _dipsMaxResults = Nothing
, _dipsInstanceIds = mempty
}
dipsNextToken :: Lens' DescribeInstancePatchStates (Maybe Text)
dipsNextToken = lens _dipsNextToken (\ s a -> s{_dipsNextToken = a})
dipsMaxResults :: Lens' DescribeInstancePatchStates (Maybe Natural)
dipsMaxResults = lens _dipsMaxResults (\ s a -> s{_dipsMaxResults = a}) . mapping _Nat
dipsInstanceIds :: Lens' DescribeInstancePatchStates [Text]
dipsInstanceIds = lens _dipsInstanceIds (\ s a -> s{_dipsInstanceIds = a}) . _Coerce
instance AWSRequest DescribeInstancePatchStates where
type Rs DescribeInstancePatchStates =
DescribeInstancePatchStatesResponse
request = postJSON ssm
response
= receiveJSON
(\ s h x ->
DescribeInstancePatchStatesResponse' <$>
(x .?> "NextToken") <*>
(x .?> "InstancePatchStates" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable DescribeInstancePatchStates where
instance NFData DescribeInstancePatchStates where
instance ToHeaders DescribeInstancePatchStates where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.DescribeInstancePatchStates" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeInstancePatchStates where
toJSON DescribeInstancePatchStates'{..}
= object
(catMaybes
[("NextToken" .=) <$> _dipsNextToken,
("MaxResults" .=) <$> _dipsMaxResults,
Just ("InstanceIds" .= _dipsInstanceIds)])
instance ToPath DescribeInstancePatchStates where
toPath = const "/"
instance ToQuery DescribeInstancePatchStates where
toQuery = const mempty
data DescribeInstancePatchStatesResponse = DescribeInstancePatchStatesResponse'
{ _dipsrsNextToken :: !(Maybe Text)
, _dipsrsInstancePatchStates :: !(Maybe [InstancePatchState])
, _dipsrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
describeInstancePatchStatesResponse
:: Int
-> DescribeInstancePatchStatesResponse
describeInstancePatchStatesResponse pResponseStatus_ =
DescribeInstancePatchStatesResponse'
{ _dipsrsNextToken = Nothing
, _dipsrsInstancePatchStates = Nothing
, _dipsrsResponseStatus = pResponseStatus_
}
dipsrsNextToken :: Lens' DescribeInstancePatchStatesResponse (Maybe Text)
dipsrsNextToken = lens _dipsrsNextToken (\ s a -> s{_dipsrsNextToken = a})
dipsrsInstancePatchStates :: Lens' DescribeInstancePatchStatesResponse [InstancePatchState]
dipsrsInstancePatchStates = lens _dipsrsInstancePatchStates (\ s a -> s{_dipsrsInstancePatchStates = a}) . _Default . _Coerce
dipsrsResponseStatus :: Lens' DescribeInstancePatchStatesResponse Int
dipsrsResponseStatus = lens _dipsrsResponseStatus (\ s a -> s{_dipsrsResponseStatus = a})
instance NFData DescribeInstancePatchStatesResponse
where