{-# 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.UpdateUsagePlan
(
updateUsagePlan
, UpdateUsagePlan
, uupPatchOperations
, uupUsagePlanId
, usagePlan
, UsagePlan
, upApiStages
, upName
, upId
, upThrottle
, upQuota
, upDescription
, upProductCode
) 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 UpdateUsagePlan = UpdateUsagePlan'
{ _uupPatchOperations :: !(Maybe [PatchOperation])
, _uupUsagePlanId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
updateUsagePlan
:: Text
-> UpdateUsagePlan
updateUsagePlan pUsagePlanId_ =
UpdateUsagePlan'
{ _uupPatchOperations = Nothing
, _uupUsagePlanId = pUsagePlanId_
}
uupPatchOperations :: Lens' UpdateUsagePlan [PatchOperation]
uupPatchOperations = lens _uupPatchOperations (\ s a -> s{_uupPatchOperations = a}) . _Default . _Coerce;
uupUsagePlanId :: Lens' UpdateUsagePlan Text
uupUsagePlanId = lens _uupUsagePlanId (\ s a -> s{_uupUsagePlanId = a});
instance AWSRequest UpdateUsagePlan where
type Rs UpdateUsagePlan = UsagePlan
request = patchJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable UpdateUsagePlan
instance NFData UpdateUsagePlan
instance ToHeaders UpdateUsagePlan where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON UpdateUsagePlan where
toJSON UpdateUsagePlan'{..}
= object
(catMaybes
[("patchOperations" .=) <$> _uupPatchOperations])
instance ToPath UpdateUsagePlan where
toPath UpdateUsagePlan'{..}
= mconcat ["/usageplans/", toBS _uupUsagePlanId]
instance ToQuery UpdateUsagePlan where
toQuery = const mempty