module Network.AWS.APIGateway.CreateAuthorizer
(
createAuthorizer
, CreateAuthorizer
, caIdentityValidationExpression
, caAuthorizerResultTtlInSeconds
, caAuthType
, caAuthorizerCredentials
, caRestAPIId
, caName
, caType
, caAuthorizerURI
, caIdentitySource
, authorizer
, Authorizer
, aAuthorizerURI
, aIdentityValidationExpression
, aName
, aId
, aAuthorizerResultTtlInSeconds
, aAuthType
, aType
, aIdentitySource
, aAuthorizerCredentials
) 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 CreateAuthorizer = CreateAuthorizer'
{ _caIdentityValidationExpression :: !(Maybe Text)
, _caAuthorizerResultTtlInSeconds :: !(Maybe Int)
, _caAuthType :: !(Maybe Text)
, _caAuthorizerCredentials :: !(Maybe Text)
, _caRestAPIId :: !Text
, _caName :: !Text
, _caType :: !AuthorizerType
, _caAuthorizerURI :: !Text
, _caIdentitySource :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createAuthorizer
:: Text
-> Text
-> AuthorizerType
-> Text
-> Text
-> CreateAuthorizer
createAuthorizer pRestAPIId_ pName_ pType_ pAuthorizerURI_ pIdentitySource_ =
CreateAuthorizer'
{ _caIdentityValidationExpression = Nothing
, _caAuthorizerResultTtlInSeconds = Nothing
, _caAuthType = Nothing
, _caAuthorizerCredentials = Nothing
, _caRestAPIId = pRestAPIId_
, _caName = pName_
, _caType = pType_
, _caAuthorizerURI = pAuthorizerURI_
, _caIdentitySource = pIdentitySource_
}
caIdentityValidationExpression :: Lens' CreateAuthorizer (Maybe Text)
caIdentityValidationExpression = lens _caIdentityValidationExpression (\ s a -> s{_caIdentityValidationExpression = a});
caAuthorizerResultTtlInSeconds :: Lens' CreateAuthorizer (Maybe Int)
caAuthorizerResultTtlInSeconds = lens _caAuthorizerResultTtlInSeconds (\ s a -> s{_caAuthorizerResultTtlInSeconds = a});
caAuthType :: Lens' CreateAuthorizer (Maybe Text)
caAuthType = lens _caAuthType (\ s a -> s{_caAuthType = a});
caAuthorizerCredentials :: Lens' CreateAuthorizer (Maybe Text)
caAuthorizerCredentials = lens _caAuthorizerCredentials (\ s a -> s{_caAuthorizerCredentials = a});
caRestAPIId :: Lens' CreateAuthorizer Text
caRestAPIId = lens _caRestAPIId (\ s a -> s{_caRestAPIId = a});
caName :: Lens' CreateAuthorizer Text
caName = lens _caName (\ s a -> s{_caName = a});
caType :: Lens' CreateAuthorizer AuthorizerType
caType = lens _caType (\ s a -> s{_caType = a});
caAuthorizerURI :: Lens' CreateAuthorizer Text
caAuthorizerURI = lens _caAuthorizerURI (\ s a -> s{_caAuthorizerURI = a});
caIdentitySource :: Lens' CreateAuthorizer Text
caIdentitySource = lens _caIdentitySource (\ s a -> s{_caIdentitySource = a});
instance AWSRequest CreateAuthorizer where
type Rs CreateAuthorizer = Authorizer
request = postJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateAuthorizer
instance NFData CreateAuthorizer
instance ToHeaders CreateAuthorizer where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON CreateAuthorizer where
toJSON CreateAuthorizer'{..}
= object
(catMaybes
[("identityValidationExpression" .=) <$>
_caIdentityValidationExpression,
("authorizerResultTtlInSeconds" .=) <$>
_caAuthorizerResultTtlInSeconds,
("authType" .=) <$> _caAuthType,
("authorizerCredentials" .=) <$>
_caAuthorizerCredentials,
Just ("name" .= _caName), Just ("type" .= _caType),
Just ("authorizerUri" .= _caAuthorizerURI),
Just ("identitySource" .= _caIdentitySource)])
instance ToPath CreateAuthorizer where
toPath CreateAuthorizer'{..}
= mconcat
["/restapis/", toBS _caRestAPIId, "/authorizers"]
instance ToQuery CreateAuthorizer where
toQuery = const mempty