module Network.AWS.SSM.GetDocument
(
getDocument
, GetDocument
, gdDocumentVersion
, gdName
, getDocumentResponse
, GetDocumentResponse
, gdrsDocumentType
, gdrsContent
, gdrsName
, gdrsDocumentVersion
, gdrsResponseStatus
) 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 GetDocument = GetDocument'
{ _gdDocumentVersion :: !(Maybe Text)
, _gdName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getDocument
:: Text
-> GetDocument
getDocument pName_ =
GetDocument' {_gdDocumentVersion = Nothing, _gdName = pName_}
gdDocumentVersion :: Lens' GetDocument (Maybe Text)
gdDocumentVersion = lens _gdDocumentVersion (\ s a -> s{_gdDocumentVersion = a});
gdName :: Lens' GetDocument Text
gdName = lens _gdName (\ s a -> s{_gdName = a});
instance AWSRequest GetDocument where
type Rs GetDocument = GetDocumentResponse
request = postJSON ssm
response
= receiveJSON
(\ s h x ->
GetDocumentResponse' <$>
(x .?> "DocumentType") <*> (x .?> "Content") <*>
(x .?> "Name")
<*> (x .?> "DocumentVersion")
<*> (pure (fromEnum s)))
instance Hashable GetDocument where
instance NFData GetDocument where
instance ToHeaders GetDocument where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.GetDocument" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetDocument where
toJSON GetDocument'{..}
= object
(catMaybes
[("DocumentVersion" .=) <$> _gdDocumentVersion,
Just ("Name" .= _gdName)])
instance ToPath GetDocument where
toPath = const "/"
instance ToQuery GetDocument where
toQuery = const mempty
data GetDocumentResponse = GetDocumentResponse'
{ _gdrsDocumentType :: !(Maybe DocumentType)
, _gdrsContent :: !(Maybe Text)
, _gdrsName :: !(Maybe Text)
, _gdrsDocumentVersion :: !(Maybe Text)
, _gdrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getDocumentResponse
:: Int
-> GetDocumentResponse
getDocumentResponse pResponseStatus_ =
GetDocumentResponse'
{ _gdrsDocumentType = Nothing
, _gdrsContent = Nothing
, _gdrsName = Nothing
, _gdrsDocumentVersion = Nothing
, _gdrsResponseStatus = pResponseStatus_
}
gdrsDocumentType :: Lens' GetDocumentResponse (Maybe DocumentType)
gdrsDocumentType = lens _gdrsDocumentType (\ s a -> s{_gdrsDocumentType = a});
gdrsContent :: Lens' GetDocumentResponse (Maybe Text)
gdrsContent = lens _gdrsContent (\ s a -> s{_gdrsContent = a});
gdrsName :: Lens' GetDocumentResponse (Maybe Text)
gdrsName = lens _gdrsName (\ s a -> s{_gdrsName = a});
gdrsDocumentVersion :: Lens' GetDocumentResponse (Maybe Text)
gdrsDocumentVersion = lens _gdrsDocumentVersion (\ s a -> s{_gdrsDocumentVersion = a});
gdrsResponseStatus :: Lens' GetDocumentResponse Int
gdrsResponseStatus = lens _gdrsResponseStatus (\ s a -> s{_gdrsResponseStatus = a});
instance NFData GetDocumentResponse where