{-# 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.CreateUsagePlanKey
(
createUsagePlanKey
, CreateUsagePlanKey
, cupkUsagePlanId
, cupkKeyId
, cupkKeyType
, usagePlanKey
, UsagePlanKey
, upkValue
, upkName
, upkId
, upkType
) 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 CreateUsagePlanKey = CreateUsagePlanKey'
{ _cupkUsagePlanId :: !Text
, _cupkKeyId :: !Text
, _cupkKeyType :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createUsagePlanKey
:: Text
-> Text
-> Text
-> CreateUsagePlanKey
createUsagePlanKey pUsagePlanId_ pKeyId_ pKeyType_ =
CreateUsagePlanKey'
{ _cupkUsagePlanId = pUsagePlanId_
, _cupkKeyId = pKeyId_
, _cupkKeyType = pKeyType_
}
cupkUsagePlanId :: Lens' CreateUsagePlanKey Text
cupkUsagePlanId = lens _cupkUsagePlanId (\ s a -> s{_cupkUsagePlanId = a})
cupkKeyId :: Lens' CreateUsagePlanKey Text
cupkKeyId = lens _cupkKeyId (\ s a -> s{_cupkKeyId = a})
cupkKeyType :: Lens' CreateUsagePlanKey Text
cupkKeyType = lens _cupkKeyType (\ s a -> s{_cupkKeyType = a})
instance AWSRequest CreateUsagePlanKey where
type Rs CreateUsagePlanKey = UsagePlanKey
request = postJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateUsagePlanKey where
instance NFData CreateUsagePlanKey where
instance ToHeaders CreateUsagePlanKey where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON CreateUsagePlanKey where
toJSON CreateUsagePlanKey'{..}
= object
(catMaybes
[Just ("keyId" .= _cupkKeyId),
Just ("keyType" .= _cupkKeyType)])
instance ToPath CreateUsagePlanKey where
toPath CreateUsagePlanKey'{..}
= mconcat
["/usageplans/", toBS _cupkUsagePlanId, "/keys"]
instance ToQuery CreateUsagePlanKey where
toQuery = const mempty