{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.SSM.DescribeDocument -- Copyright : (c) 2013-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Describes the specified SSM document. -- -- module Network.AWS.SSM.DescribeDocument ( -- * Creating a Request describeDocument , DescribeDocument -- * Request Lenses , ddDocumentVersion , ddName -- * Destructuring the Response , describeDocumentResponse , DescribeDocumentResponse -- * Response Lenses , drsDocument , drsResponseStatus ) 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 -- | /See:/ 'describeDocument' smart constructor. data DescribeDocument = DescribeDocument' { _ddDocumentVersion :: !(Maybe Text) , _ddName :: !Text } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'DescribeDocument' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ddDocumentVersion' - The document version for which you want information. Can be a specific version or the default version. -- -- * 'ddName' - The name of the SSM document. describeDocument :: Text -- ^ 'ddName' -> DescribeDocument describeDocument pName_ = DescribeDocument' { _ddDocumentVersion = Nothing , _ddName = pName_ } -- | The document version for which you want information. Can be a specific version or the default version. ddDocumentVersion :: Lens' DescribeDocument (Maybe Text) ddDocumentVersion = lens _ddDocumentVersion (\ s a -> s{_ddDocumentVersion = a}); -- | The name of the SSM document. ddName :: Lens' DescribeDocument Text ddName = lens _ddName (\ s a -> s{_ddName = a}); instance AWSRequest DescribeDocument where type Rs DescribeDocument = DescribeDocumentResponse request = postJSON ssm response = receiveJSON (\ s h x -> DescribeDocumentResponse' <$> (x .?> "Document") <*> (pure (fromEnum s))) instance Hashable DescribeDocument instance NFData DescribeDocument instance ToHeaders DescribeDocument where toHeaders = const (mconcat ["X-Amz-Target" =# ("AmazonSSM.DescribeDocument" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON DescribeDocument where toJSON DescribeDocument'{..} = object (catMaybes [("DocumentVersion" .=) <$> _ddDocumentVersion, Just ("Name" .= _ddName)]) instance ToPath DescribeDocument where toPath = const "/" instance ToQuery DescribeDocument where toQuery = const mempty -- | /See:/ 'describeDocumentResponse' smart constructor. data DescribeDocumentResponse = DescribeDocumentResponse' { _drsDocument :: !(Maybe DocumentDescription) , _drsResponseStatus :: !Int } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'DescribeDocumentResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'drsDocument' - Information about the SSM document. -- -- * 'drsResponseStatus' - -- | The response status code. describeDocumentResponse :: Int -- ^ 'drsResponseStatus' -> DescribeDocumentResponse describeDocumentResponse pResponseStatus_ = DescribeDocumentResponse' { _drsDocument = Nothing , _drsResponseStatus = pResponseStatus_ } -- | Information about the SSM document. drsDocument :: Lens' DescribeDocumentResponse (Maybe DocumentDescription) drsDocument = lens _drsDocument (\ s a -> s{_drsDocument = a}); -- | -- | The response status code. drsResponseStatus :: Lens' DescribeDocumentResponse Int drsResponseStatus = lens _drsResponseStatus (\ s a -> s{_drsResponseStatus = a}); instance NFData DescribeDocumentResponse