module Network.AWS.APIGateway.CreateAPIKey
(
createAPIKey
, CreateAPIKey
, cakEnabled
, cakName
, cakStageKeys
, cakDescription
, apiKey
, APIKey
, akEnabled
, akCreatedDate
, akName
, akId
, akStageKeys
, akLastUpdatedDate
, akDescription
) 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 CreateAPIKey = CreateAPIKey'
{ _cakEnabled :: !(Maybe Bool)
, _cakName :: !(Maybe Text)
, _cakStageKeys :: !(Maybe [StageKey])
, _cakDescription :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createAPIKey
:: CreateAPIKey
createAPIKey =
CreateAPIKey'
{ _cakEnabled = Nothing
, _cakName = Nothing
, _cakStageKeys = Nothing
, _cakDescription = Nothing
}
cakEnabled :: Lens' CreateAPIKey (Maybe Bool)
cakEnabled = lens _cakEnabled (\ s a -> s{_cakEnabled = a});
cakName :: Lens' CreateAPIKey (Maybe Text)
cakName = lens _cakName (\ s a -> s{_cakName = a});
cakStageKeys :: Lens' CreateAPIKey [StageKey]
cakStageKeys = lens _cakStageKeys (\ s a -> s{_cakStageKeys = a}) . _Default . _Coerce;
cakDescription :: Lens' CreateAPIKey (Maybe Text)
cakDescription = lens _cakDescription (\ s a -> s{_cakDescription = a});
instance AWSRequest CreateAPIKey where
type Rs CreateAPIKey = APIKey
request = postJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateAPIKey
instance NFData CreateAPIKey
instance ToHeaders CreateAPIKey where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON CreateAPIKey where
toJSON CreateAPIKey'{..}
= object
(catMaybes
[("enabled" .=) <$> _cakEnabled,
("name" .=) <$> _cakName,
("stageKeys" .=) <$> _cakStageKeys,
("description" .=) <$> _cakDescription])
instance ToPath CreateAPIKey where
toPath = const "/apikeys"
instance ToQuery CreateAPIKey where
toQuery = const mempty