{-# 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.GetInventorySchema -- Copyright : (c) 2013-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Return a list of inventory type names for the account, or return a list of attribute names for a specific Inventory item type. -- -- module Network.AWS.SSM.GetInventorySchema ( -- * Creating a Request getInventorySchema , GetInventorySchema -- * Request Lenses , gisTypeName , gisNextToken , gisMaxResults -- * Destructuring the Response , getInventorySchemaResponse , GetInventorySchemaResponse -- * Response Lenses , gisrsSchemas , gisrsNextToken , gisrsResponseStatus ) 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:/ 'getInventorySchema' smart constructor. data GetInventorySchema = GetInventorySchema' { _gisTypeName :: !(Maybe Text) , _gisNextToken :: !(Maybe Text) , _gisMaxResults :: !(Maybe Nat) } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'GetInventorySchema' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'gisTypeName' - The type of inventory item to return. -- -- * 'gisNextToken' - The token for the next set of items to return. (You received this token from a previous call.) -- -- * 'gisMaxResults' - The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results. getInventorySchema :: GetInventorySchema getInventorySchema = GetInventorySchema' { _gisTypeName = Nothing , _gisNextToken = Nothing , _gisMaxResults = Nothing } -- | The type of inventory item to return. gisTypeName :: Lens' GetInventorySchema (Maybe Text) gisTypeName = lens _gisTypeName (\ s a -> s{_gisTypeName = a}); -- | The token for the next set of items to return. (You received this token from a previous call.) gisNextToken :: Lens' GetInventorySchema (Maybe Text) gisNextToken = lens _gisNextToken (\ s a -> s{_gisNextToken = a}); -- | The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results. gisMaxResults :: Lens' GetInventorySchema (Maybe Natural) gisMaxResults = lens _gisMaxResults (\ s a -> s{_gisMaxResults = a}) . mapping _Nat; instance AWSRequest GetInventorySchema where type Rs GetInventorySchema = GetInventorySchemaResponse request = postJSON ssm response = receiveJSON (\ s h x -> GetInventorySchemaResponse' <$> (x .?> "Schemas" .!@ mempty) <*> (x .?> "NextToken") <*> (pure (fromEnum s))) instance Hashable GetInventorySchema instance NFData GetInventorySchema instance ToHeaders GetInventorySchema where toHeaders = const (mconcat ["X-Amz-Target" =# ("AmazonSSM.GetInventorySchema" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON GetInventorySchema where toJSON GetInventorySchema'{..} = object (catMaybes [("TypeName" .=) <$> _gisTypeName, ("NextToken" .=) <$> _gisNextToken, ("MaxResults" .=) <$> _gisMaxResults]) instance ToPath GetInventorySchema where toPath = const "/" instance ToQuery GetInventorySchema where toQuery = const mempty -- | /See:/ 'getInventorySchemaResponse' smart constructor. data GetInventorySchemaResponse = GetInventorySchemaResponse' { _gisrsSchemas :: !(Maybe [InventoryItemSchema]) , _gisrsNextToken :: !(Maybe Text) , _gisrsResponseStatus :: !Int } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'GetInventorySchemaResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'gisrsSchemas' - Inventory schemas returned by the request. -- -- * 'gisrsNextToken' - The token to use when requesting the next set of items. If there are no additional items to return, the string is empty. -- -- * 'gisrsResponseStatus' - -- | The response status code. getInventorySchemaResponse :: Int -- ^ 'gisrsResponseStatus' -> GetInventorySchemaResponse getInventorySchemaResponse pResponseStatus_ = GetInventorySchemaResponse' { _gisrsSchemas = Nothing , _gisrsNextToken = Nothing , _gisrsResponseStatus = pResponseStatus_ } -- | Inventory schemas returned by the request. gisrsSchemas :: Lens' GetInventorySchemaResponse [InventoryItemSchema] gisrsSchemas = lens _gisrsSchemas (\ s a -> s{_gisrsSchemas = a}) . _Default . _Coerce; -- | The token to use when requesting the next set of items. If there are no additional items to return, the string is empty. gisrsNextToken :: Lens' GetInventorySchemaResponse (Maybe Text) gisrsNextToken = lens _gisrsNextToken (\ s a -> s{_gisrsNextToken = a}); -- | -- | The response status code. gisrsResponseStatus :: Lens' GetInventorySchemaResponse Int gisrsResponseStatus = lens _gisrsResponseStatus (\ s a -> s{_gisrsResponseStatus = a}); instance NFData GetInventorySchemaResponse