{-# 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.WAF.CreateRegexPatternSet
(
createRegexPatternSet
, CreateRegexPatternSet
, crpsName
, crpsChangeToken
, createRegexPatternSetResponse
, CreateRegexPatternSetResponse
, crpsrsRegexPatternSet
, crpsrsChangeToken
, crpsrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WAF.Types
import Network.AWS.WAF.Types.Product
data CreateRegexPatternSet = CreateRegexPatternSet'
{ _crpsName :: !Text
, _crpsChangeToken :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createRegexPatternSet
:: Text
-> Text
-> CreateRegexPatternSet
createRegexPatternSet pName_ pChangeToken_ =
CreateRegexPatternSet' {_crpsName = pName_, _crpsChangeToken = pChangeToken_}
crpsName :: Lens' CreateRegexPatternSet Text
crpsName = lens _crpsName (\ s a -> s{_crpsName = a})
crpsChangeToken :: Lens' CreateRegexPatternSet Text
crpsChangeToken = lens _crpsChangeToken (\ s a -> s{_crpsChangeToken = a})
instance AWSRequest CreateRegexPatternSet where
type Rs CreateRegexPatternSet =
CreateRegexPatternSetResponse
request = postJSON waf
response
= receiveJSON
(\ s h x ->
CreateRegexPatternSetResponse' <$>
(x .?> "RegexPatternSet") <*> (x .?> "ChangeToken")
<*> (pure (fromEnum s)))
instance Hashable CreateRegexPatternSet where
instance NFData CreateRegexPatternSet where
instance ToHeaders CreateRegexPatternSet where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSWAF_20150824.CreateRegexPatternSet" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateRegexPatternSet where
toJSON CreateRegexPatternSet'{..}
= object
(catMaybes
[Just ("Name" .= _crpsName),
Just ("ChangeToken" .= _crpsChangeToken)])
instance ToPath CreateRegexPatternSet where
toPath = const "/"
instance ToQuery CreateRegexPatternSet where
toQuery = const mempty
data CreateRegexPatternSetResponse = CreateRegexPatternSetResponse'
{ _crpsrsRegexPatternSet :: !(Maybe RegexPatternSet)
, _crpsrsChangeToken :: !(Maybe Text)
, _crpsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createRegexPatternSetResponse
:: Int
-> CreateRegexPatternSetResponse
createRegexPatternSetResponse pResponseStatus_ =
CreateRegexPatternSetResponse'
{ _crpsrsRegexPatternSet = Nothing
, _crpsrsChangeToken = Nothing
, _crpsrsResponseStatus = pResponseStatus_
}
crpsrsRegexPatternSet :: Lens' CreateRegexPatternSetResponse (Maybe RegexPatternSet)
crpsrsRegexPatternSet = lens _crpsrsRegexPatternSet (\ s a -> s{_crpsrsRegexPatternSet = a})
crpsrsChangeToken :: Lens' CreateRegexPatternSetResponse (Maybe Text)
crpsrsChangeToken = lens _crpsrsChangeToken (\ s a -> s{_crpsrsChangeToken = a})
crpsrsResponseStatus :: Lens' CreateRegexPatternSetResponse Int
crpsrsResponseStatus = lens _crpsrsResponseStatus (\ s a -> s{_crpsrsResponseStatus = a})
instance NFData CreateRegexPatternSetResponse where