{-# 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.TestInvokeAuthorizer
(
testInvokeAuthorizer
, TestInvokeAuthorizer
, tiaPathWithQueryString
, tiaBody
, tiaAdditionalContext
, tiaStageVariables
, tiaHeaders
, tiaRestAPIId
, tiaAuthorizerId
, testInvokeAuthorizerResponse
, TestInvokeAuthorizerResponse
, tiarsLog
, tiarsPrincipalId
, tiarsLatency
, tiarsAuthorization
, tiarsClaims
, tiarsClientStatus
, tiarsPolicy
, tiarsResponseStatus
) 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 TestInvokeAuthorizer = TestInvokeAuthorizer'
{ _tiaPathWithQueryString :: !(Maybe Text)
, _tiaBody :: !(Maybe Text)
, _tiaAdditionalContext :: !(Maybe (Map Text Text))
, _tiaStageVariables :: !(Maybe (Map Text Text))
, _tiaHeaders :: !(Maybe (Map Text Text))
, _tiaRestAPIId :: !Text
, _tiaAuthorizerId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
testInvokeAuthorizer
:: Text
-> Text
-> TestInvokeAuthorizer
testInvokeAuthorizer pRestAPIId_ pAuthorizerId_ =
TestInvokeAuthorizer'
{ _tiaPathWithQueryString = Nothing
, _tiaBody = Nothing
, _tiaAdditionalContext = Nothing
, _tiaStageVariables = Nothing
, _tiaHeaders = Nothing
, _tiaRestAPIId = pRestAPIId_
, _tiaAuthorizerId = pAuthorizerId_
}
tiaPathWithQueryString :: Lens' TestInvokeAuthorizer (Maybe Text)
tiaPathWithQueryString = lens _tiaPathWithQueryString (\ s a -> s{_tiaPathWithQueryString = a})
tiaBody :: Lens' TestInvokeAuthorizer (Maybe Text)
tiaBody = lens _tiaBody (\ s a -> s{_tiaBody = a})
tiaAdditionalContext :: Lens' TestInvokeAuthorizer (HashMap Text Text)
tiaAdditionalContext = lens _tiaAdditionalContext (\ s a -> s{_tiaAdditionalContext = a}) . _Default . _Map
tiaStageVariables :: Lens' TestInvokeAuthorizer (HashMap Text Text)
tiaStageVariables = lens _tiaStageVariables (\ s a -> s{_tiaStageVariables = a}) . _Default . _Map
tiaHeaders :: Lens' TestInvokeAuthorizer (HashMap Text Text)
tiaHeaders = lens _tiaHeaders (\ s a -> s{_tiaHeaders = a}) . _Default . _Map
tiaRestAPIId :: Lens' TestInvokeAuthorizer Text
tiaRestAPIId = lens _tiaRestAPIId (\ s a -> s{_tiaRestAPIId = a})
tiaAuthorizerId :: Lens' TestInvokeAuthorizer Text
tiaAuthorizerId = lens _tiaAuthorizerId (\ s a -> s{_tiaAuthorizerId = a})
instance AWSRequest TestInvokeAuthorizer where
type Rs TestInvokeAuthorizer =
TestInvokeAuthorizerResponse
request = postJSON apiGateway
response
= receiveJSON
(\ s h x ->
TestInvokeAuthorizerResponse' <$>
(x .?> "log") <*> (x .?> "principalId") <*>
(x .?> "latency")
<*> (x .?> "authorization" .!@ mempty)
<*> (x .?> "claims" .!@ mempty)
<*> (x .?> "clientStatus")
<*> (x .?> "policy")
<*> (pure (fromEnum s)))
instance Hashable TestInvokeAuthorizer where
instance NFData TestInvokeAuthorizer where
instance ToHeaders TestInvokeAuthorizer where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON TestInvokeAuthorizer where
toJSON TestInvokeAuthorizer'{..}
= object
(catMaybes
[("pathWithQueryString" .=) <$>
_tiaPathWithQueryString,
("body" .=) <$> _tiaBody,
("additionalContext" .=) <$> _tiaAdditionalContext,
("stageVariables" .=) <$> _tiaStageVariables,
("headers" .=) <$> _tiaHeaders])
instance ToPath TestInvokeAuthorizer where
toPath TestInvokeAuthorizer'{..}
= mconcat
["/restapis/", toBS _tiaRestAPIId, "/authorizers/",
toBS _tiaAuthorizerId]
instance ToQuery TestInvokeAuthorizer where
toQuery = const mempty
data TestInvokeAuthorizerResponse = TestInvokeAuthorizerResponse'
{ _tiarsLog :: !(Maybe Text)
, _tiarsPrincipalId :: !(Maybe Text)
, _tiarsLatency :: !(Maybe Integer)
, _tiarsAuthorization :: !(Maybe (Map Text [Text]))
, _tiarsClaims :: !(Maybe (Map Text Text))
, _tiarsClientStatus :: !(Maybe Int)
, _tiarsPolicy :: !(Maybe Text)
, _tiarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
testInvokeAuthorizerResponse
:: Int
-> TestInvokeAuthorizerResponse
testInvokeAuthorizerResponse pResponseStatus_ =
TestInvokeAuthorizerResponse'
{ _tiarsLog = Nothing
, _tiarsPrincipalId = Nothing
, _tiarsLatency = Nothing
, _tiarsAuthorization = Nothing
, _tiarsClaims = Nothing
, _tiarsClientStatus = Nothing
, _tiarsPolicy = Nothing
, _tiarsResponseStatus = pResponseStatus_
}
tiarsLog :: Lens' TestInvokeAuthorizerResponse (Maybe Text)
tiarsLog = lens _tiarsLog (\ s a -> s{_tiarsLog = a})
tiarsPrincipalId :: Lens' TestInvokeAuthorizerResponse (Maybe Text)
tiarsPrincipalId = lens _tiarsPrincipalId (\ s a -> s{_tiarsPrincipalId = a})
tiarsLatency :: Lens' TestInvokeAuthorizerResponse (Maybe Integer)
tiarsLatency = lens _tiarsLatency (\ s a -> s{_tiarsLatency = a})
tiarsAuthorization :: Lens' TestInvokeAuthorizerResponse (HashMap Text [Text])
tiarsAuthorization = lens _tiarsAuthorization (\ s a -> s{_tiarsAuthorization = a}) . _Default . _Map
tiarsClaims :: Lens' TestInvokeAuthorizerResponse (HashMap Text Text)
tiarsClaims = lens _tiarsClaims (\ s a -> s{_tiarsClaims = a}) . _Default . _Map
tiarsClientStatus :: Lens' TestInvokeAuthorizerResponse (Maybe Int)
tiarsClientStatus = lens _tiarsClientStatus (\ s a -> s{_tiarsClientStatus = a})
tiarsPolicy :: Lens' TestInvokeAuthorizerResponse (Maybe Text)
tiarsPolicy = lens _tiarsPolicy (\ s a -> s{_tiarsPolicy = a})
tiarsResponseStatus :: Lens' TestInvokeAuthorizerResponse Int
tiarsResponseStatus = lens _tiarsResponseStatus (\ s a -> s{_tiarsResponseStatus = a})
instance NFData TestInvokeAuthorizerResponse where