{-# 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.IoT.TestInvokeAuthorizer
(
testInvokeAuthorizer
, TestInvokeAuthorizer
, tiaAuthorizerName
, tiaToken
, tiaTokenSignature
, testInvokeAuthorizerResponse
, TestInvokeAuthorizerResponse
, tiarsPolicyDocuments
, tiarsPrincipalId
, tiarsDisconnectAfterInSeconds
, tiarsIsAuthenticated
, tiarsRefreshAfterInSeconds
, tiarsResponseStatus
) where
import Network.AWS.IoT.Types
import Network.AWS.IoT.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data TestInvokeAuthorizer = TestInvokeAuthorizer'
{ _tiaAuthorizerName :: !Text
, _tiaToken :: !Text
, _tiaTokenSignature :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
testInvokeAuthorizer
:: Text
-> Text
-> Text
-> TestInvokeAuthorizer
testInvokeAuthorizer pAuthorizerName_ pToken_ pTokenSignature_ =
TestInvokeAuthorizer'
{ _tiaAuthorizerName = pAuthorizerName_
, _tiaToken = pToken_
, _tiaTokenSignature = pTokenSignature_
}
tiaAuthorizerName :: Lens' TestInvokeAuthorizer Text
tiaAuthorizerName = lens _tiaAuthorizerName (\ s a -> s{_tiaAuthorizerName = a})
tiaToken :: Lens' TestInvokeAuthorizer Text
tiaToken = lens _tiaToken (\ s a -> s{_tiaToken = a})
tiaTokenSignature :: Lens' TestInvokeAuthorizer Text
tiaTokenSignature = lens _tiaTokenSignature (\ s a -> s{_tiaTokenSignature = a})
instance AWSRequest TestInvokeAuthorizer where
type Rs TestInvokeAuthorizer =
TestInvokeAuthorizerResponse
request = postJSON ioT
response
= receiveJSON
(\ s h x ->
TestInvokeAuthorizerResponse' <$>
(x .?> "policyDocuments" .!@ mempty) <*>
(x .?> "principalId")
<*> (x .?> "disconnectAfterInSeconds")
<*> (x .?> "isAuthenticated")
<*> (x .?> "refreshAfterInSeconds")
<*> (pure (fromEnum s)))
instance Hashable TestInvokeAuthorizer where
instance NFData TestInvokeAuthorizer where
instance ToHeaders TestInvokeAuthorizer where
toHeaders = const mempty
instance ToJSON TestInvokeAuthorizer where
toJSON TestInvokeAuthorizer'{..}
= object
(catMaybes
[Just ("token" .= _tiaToken),
Just ("tokenSignature" .= _tiaTokenSignature)])
instance ToPath TestInvokeAuthorizer where
toPath TestInvokeAuthorizer'{..}
= mconcat
["/authorizer/", toBS _tiaAuthorizerName, "/test"]
instance ToQuery TestInvokeAuthorizer where
toQuery = const mempty
data TestInvokeAuthorizerResponse = TestInvokeAuthorizerResponse'
{ _tiarsPolicyDocuments :: !(Maybe [Text])
, _tiarsPrincipalId :: !(Maybe Text)
, _tiarsDisconnectAfterInSeconds :: !(Maybe Int)
, _tiarsIsAuthenticated :: !(Maybe Bool)
, _tiarsRefreshAfterInSeconds :: !(Maybe Int)
, _tiarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
testInvokeAuthorizerResponse
:: Int
-> TestInvokeAuthorizerResponse
testInvokeAuthorizerResponse pResponseStatus_ =
TestInvokeAuthorizerResponse'
{ _tiarsPolicyDocuments = Nothing
, _tiarsPrincipalId = Nothing
, _tiarsDisconnectAfterInSeconds = Nothing
, _tiarsIsAuthenticated = Nothing
, _tiarsRefreshAfterInSeconds = Nothing
, _tiarsResponseStatus = pResponseStatus_
}
tiarsPolicyDocuments :: Lens' TestInvokeAuthorizerResponse [Text]
tiarsPolicyDocuments = lens _tiarsPolicyDocuments (\ s a -> s{_tiarsPolicyDocuments = a}) . _Default . _Coerce
tiarsPrincipalId :: Lens' TestInvokeAuthorizerResponse (Maybe Text)
tiarsPrincipalId = lens _tiarsPrincipalId (\ s a -> s{_tiarsPrincipalId = a})
tiarsDisconnectAfterInSeconds :: Lens' TestInvokeAuthorizerResponse (Maybe Int)
tiarsDisconnectAfterInSeconds = lens _tiarsDisconnectAfterInSeconds (\ s a -> s{_tiarsDisconnectAfterInSeconds = a})
tiarsIsAuthenticated :: Lens' TestInvokeAuthorizerResponse (Maybe Bool)
tiarsIsAuthenticated = lens _tiarsIsAuthenticated (\ s a -> s{_tiarsIsAuthenticated = a})
tiarsRefreshAfterInSeconds :: Lens' TestInvokeAuthorizerResponse (Maybe Int)
tiarsRefreshAfterInSeconds = lens _tiarsRefreshAfterInSeconds (\ s a -> s{_tiarsRefreshAfterInSeconds = a})
tiarsResponseStatus :: Lens' TestInvokeAuthorizerResponse Int
tiarsResponseStatus = lens _tiarsResponseStatus (\ s a -> s{_tiarsResponseStatus = a})
instance NFData TestInvokeAuthorizerResponse where