{-# 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.APIGateway.UpdateUsage
(
updateUsage
, UpdateUsage
, uuPatchOperations
, uuUsagePlanId
, uuKeyId
, usage
, Usage
, uUsagePlanId
, uEndDate
, uItems
, uStartDate
, uPosition
) where
import Network.AWS.APIGateway.Types
import Network.AWS.APIGateway.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateUsage = UpdateUsage'
{ _uuPatchOperations :: !(Maybe [PatchOperation])
, _uuUsagePlanId :: !Text
, _uuKeyId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateUsage
:: Text
-> Text
-> UpdateUsage
updateUsage pUsagePlanId_ pKeyId_ =
UpdateUsage'
{ _uuPatchOperations = Nothing
, _uuUsagePlanId = pUsagePlanId_
, _uuKeyId = pKeyId_
}
uuPatchOperations :: Lens' UpdateUsage [PatchOperation]
uuPatchOperations = lens _uuPatchOperations (\ s a -> s{_uuPatchOperations = a}) . _Default . _Coerce
uuUsagePlanId :: Lens' UpdateUsage Text
uuUsagePlanId = lens _uuUsagePlanId (\ s a -> s{_uuUsagePlanId = a})
uuKeyId :: Lens' UpdateUsage Text
uuKeyId = lens _uuKeyId (\ s a -> s{_uuKeyId = a})
instance AWSRequest UpdateUsage where
type Rs UpdateUsage = Usage
request = patchJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable UpdateUsage where
instance NFData UpdateUsage where
instance ToHeaders UpdateUsage where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON UpdateUsage where
toJSON UpdateUsage'{..}
= object
(catMaybes
[("patchOperations" .=) <$> _uuPatchOperations])
instance ToPath UpdateUsage where
toPath UpdateUsage'{..}
= mconcat
["/usageplans/", toBS _uuUsagePlanId, "/keys/",
toBS _uuKeyId, "/usage"]
instance ToQuery UpdateUsage where
toQuery = const mempty