module Network.AWS.DirectoryService.CreateSnapshot
    (
    
      createSnapshot
    , CreateSnapshot
    
    , csName
    , csDirectoryId
    
    , createSnapshotResponse
    , CreateSnapshotResponse
    
    , csrsSnapshotId
    , csrsResponseStatus
    ) where
import           Network.AWS.DirectoryService.Types
import           Network.AWS.DirectoryService.Types.Product
import           Network.AWS.Prelude
import           Network.AWS.Request
import           Network.AWS.Response
data CreateSnapshot = CreateSnapshot'
    { _csName        :: !(Maybe Text)
    , _csDirectoryId :: !Text
    } deriving (Eq,Read,Show,Data,Typeable,Generic)
createSnapshot
    :: Text 
    -> CreateSnapshot
createSnapshot pDirectoryId_ =
    CreateSnapshot'
    { _csName = Nothing
    , _csDirectoryId = pDirectoryId_
    }
csName :: Lens' CreateSnapshot (Maybe Text)
csName = lens _csName (\ s a -> s{_csName = a});
csDirectoryId :: Lens' CreateSnapshot Text
csDirectoryId = lens _csDirectoryId (\ s a -> s{_csDirectoryId = a});
instance AWSRequest CreateSnapshot where
        type Rs CreateSnapshot = CreateSnapshotResponse
        request = postJSON directoryService
        response
          = receiveJSON
              (\ s h x ->
                 CreateSnapshotResponse' <$>
                   (x .?> "SnapshotId") <*> (pure (fromEnum s)))
instance ToHeaders CreateSnapshot where
        toHeaders
          = const
              (mconcat
                 ["X-Amz-Target" =#
                    ("DirectoryService_20150416.CreateSnapshot" ::
                       ByteString),
                  "Content-Type" =#
                    ("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateSnapshot where
        toJSON CreateSnapshot'{..}
          = object
              (catMaybes
                 [("Name" .=) <$> _csName,
                  Just ("DirectoryId" .= _csDirectoryId)])
instance ToPath CreateSnapshot where
        toPath = const "/"
instance ToQuery CreateSnapshot where
        toQuery = const mempty
data CreateSnapshotResponse = CreateSnapshotResponse'
    { _csrsSnapshotId     :: !(Maybe Text)
    , _csrsResponseStatus :: !Int
    } deriving (Eq,Read,Show,Data,Typeable,Generic)
createSnapshotResponse
    :: Int 
    -> CreateSnapshotResponse
createSnapshotResponse pResponseStatus_ =
    CreateSnapshotResponse'
    { _csrsSnapshotId = Nothing
    , _csrsResponseStatus = pResponseStatus_
    }
csrsSnapshotId :: Lens' CreateSnapshotResponse (Maybe Text)
csrsSnapshotId = lens _csrsSnapshotId (\ s a -> s{_csrsSnapshotId = a});
csrsResponseStatus :: Lens' CreateSnapshotResponse Int
csrsResponseStatus = lens _csrsResponseStatus (\ s a -> s{_csrsResponseStatus = a});