{-# 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.PutInventory
(
putInventory
, PutInventory
, piInstanceId
, piItems
, putInventoryResponse
, PutInventoryResponse
, pirsMessage
, pirsResponseStatus
) 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 PutInventory = PutInventory'
{ _piInstanceId :: !Text
, _piItems :: !(List1 InventoryItem)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putInventory
:: Text
-> NonEmpty InventoryItem
-> PutInventory
putInventory pInstanceId_ pItems_ =
PutInventory' {_piInstanceId = pInstanceId_, _piItems = _List1 # pItems_}
piInstanceId :: Lens' PutInventory Text
piInstanceId = lens _piInstanceId (\ s a -> s{_piInstanceId = a})
piItems :: Lens' PutInventory (NonEmpty InventoryItem)
piItems = lens _piItems (\ s a -> s{_piItems = a}) . _List1
instance AWSRequest PutInventory where
type Rs PutInventory = PutInventoryResponse
request = postJSON ssm
response
= receiveJSON
(\ s h x ->
PutInventoryResponse' <$>
(x .?> "Message") <*> (pure (fromEnum s)))
instance Hashable PutInventory where
instance NFData PutInventory where
instance ToHeaders PutInventory where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.PutInventory" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutInventory where
toJSON PutInventory'{..}
= object
(catMaybes
[Just ("InstanceId" .= _piInstanceId),
Just ("Items" .= _piItems)])
instance ToPath PutInventory where
toPath = const "/"
instance ToQuery PutInventory where
toQuery = const mempty
data PutInventoryResponse = PutInventoryResponse'
{ _pirsMessage :: !(Maybe Text)
, _pirsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putInventoryResponse
:: Int
-> PutInventoryResponse
putInventoryResponse pResponseStatus_ =
PutInventoryResponse'
{_pirsMessage = Nothing, _pirsResponseStatus = pResponseStatus_}
pirsMessage :: Lens' PutInventoryResponse (Maybe Text)
pirsMessage = lens _pirsMessage (\ s a -> s{_pirsMessage = a})
pirsResponseStatus :: Lens' PutInventoryResponse Int
pirsResponseStatus = lens _pirsResponseStatus (\ s a -> s{_pirsResponseStatus = a})
instance NFData PutInventoryResponse where