{-# 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.ListAssociationVersions
(
listAssociationVersions
, ListAssociationVersions
, lavNextToken
, lavMaxResults
, lavAssociationId
, listAssociationVersionsResponse
, ListAssociationVersionsResponse
, lavrsNextToken
, lavrsAssociationVersions
, lavrsResponseStatus
) 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 ListAssociationVersions = ListAssociationVersions'
{ _lavNextToken :: !(Maybe Text)
, _lavMaxResults :: !(Maybe Nat)
, _lavAssociationId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listAssociationVersions
:: Text
-> ListAssociationVersions
listAssociationVersions pAssociationId_ =
ListAssociationVersions'
{ _lavNextToken = Nothing
, _lavMaxResults = Nothing
, _lavAssociationId = pAssociationId_
}
lavNextToken :: Lens' ListAssociationVersions (Maybe Text)
lavNextToken = lens _lavNextToken (\ s a -> s{_lavNextToken = a})
lavMaxResults :: Lens' ListAssociationVersions (Maybe Natural)
lavMaxResults = lens _lavMaxResults (\ s a -> s{_lavMaxResults = a}) . mapping _Nat
lavAssociationId :: Lens' ListAssociationVersions Text
lavAssociationId = lens _lavAssociationId (\ s a -> s{_lavAssociationId = a})
instance AWSRequest ListAssociationVersions where
type Rs ListAssociationVersions =
ListAssociationVersionsResponse
request = postJSON ssm
response
= receiveJSON
(\ s h x ->
ListAssociationVersionsResponse' <$>
(x .?> "NextToken") <*> (x .?> "AssociationVersions")
<*> (pure (fromEnum s)))
instance Hashable ListAssociationVersions where
instance NFData ListAssociationVersions where
instance ToHeaders ListAssociationVersions where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.ListAssociationVersions" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListAssociationVersions where
toJSON ListAssociationVersions'{..}
= object
(catMaybes
[("NextToken" .=) <$> _lavNextToken,
("MaxResults" .=) <$> _lavMaxResults,
Just ("AssociationId" .= _lavAssociationId)])
instance ToPath ListAssociationVersions where
toPath = const "/"
instance ToQuery ListAssociationVersions where
toQuery = const mempty
data ListAssociationVersionsResponse = ListAssociationVersionsResponse'
{ _lavrsNextToken :: !(Maybe Text)
, _lavrsAssociationVersions :: !(Maybe (List1 AssociationVersionInfo))
, _lavrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listAssociationVersionsResponse
:: Int
-> ListAssociationVersionsResponse
listAssociationVersionsResponse pResponseStatus_ =
ListAssociationVersionsResponse'
{ _lavrsNextToken = Nothing
, _lavrsAssociationVersions = Nothing
, _lavrsResponseStatus = pResponseStatus_
}
lavrsNextToken :: Lens' ListAssociationVersionsResponse (Maybe Text)
lavrsNextToken = lens _lavrsNextToken (\ s a -> s{_lavrsNextToken = a})
lavrsAssociationVersions :: Lens' ListAssociationVersionsResponse (Maybe (NonEmpty AssociationVersionInfo))
lavrsAssociationVersions = lens _lavrsAssociationVersions (\ s a -> s{_lavrsAssociationVersions = a}) . mapping _List1
lavrsResponseStatus :: Lens' ListAssociationVersionsResponse Int
lavrsResponseStatus = lens _lavrsResponseStatus (\ s a -> s{_lavrsResponseStatus = a})
instance NFData ListAssociationVersionsResponse where