{-# 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.ElasticTranscoder.TestRole
(
testRole
, TestRole
, trRole
, trInputBucket
, trOutputBucket
, trTopics
, testRoleResponse
, TestRoleResponse
, trrsSuccess
, trrsMessages
, trrsResponseStatus
) where
import Network.AWS.ElasticTranscoder.Types
import Network.AWS.ElasticTranscoder.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data TestRole = TestRole'
{ _trRole :: !Text
, _trInputBucket :: !Text
, _trOutputBucket :: !Text
, _trTopics :: ![Text]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
testRole
:: Text
-> Text
-> Text
-> TestRole
testRole pRole_ pInputBucket_ pOutputBucket_ =
TestRole'
{ _trRole = pRole_
, _trInputBucket = pInputBucket_
, _trOutputBucket = pOutputBucket_
, _trTopics = mempty
}
trRole :: Lens' TestRole Text
trRole = lens _trRole (\ s a -> s{_trRole = a});
trInputBucket :: Lens' TestRole Text
trInputBucket = lens _trInputBucket (\ s a -> s{_trInputBucket = a});
trOutputBucket :: Lens' TestRole Text
trOutputBucket = lens _trOutputBucket (\ s a -> s{_trOutputBucket = a});
trTopics :: Lens' TestRole [Text]
trTopics = lens _trTopics (\ s a -> s{_trTopics = a}) . _Coerce;
instance AWSRequest TestRole where
type Rs TestRole = TestRoleResponse
request = postJSON elasticTranscoder
response
= receiveJSON
(\ s h x ->
TestRoleResponse' <$>
(x .?> "Success") <*> (x .?> "Messages" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable TestRole
instance NFData TestRole
instance ToHeaders TestRole where
toHeaders = const mempty
instance ToJSON TestRole where
toJSON TestRole'{..}
= object
(catMaybes
[Just ("Role" .= _trRole),
Just ("InputBucket" .= _trInputBucket),
Just ("OutputBucket" .= _trOutputBucket),
Just ("Topics" .= _trTopics)])
instance ToPath TestRole where
toPath = const "/2012-09-25/roleTests"
instance ToQuery TestRole where
toQuery = const mempty
data TestRoleResponse = TestRoleResponse'
{ _trrsSuccess :: !(Maybe Text)
, _trrsMessages :: !(Maybe [Text])
, _trrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
testRoleResponse
:: Int
-> TestRoleResponse
testRoleResponse pResponseStatus_ =
TestRoleResponse'
{ _trrsSuccess = Nothing
, _trrsMessages = Nothing
, _trrsResponseStatus = pResponseStatus_
}
trrsSuccess :: Lens' TestRoleResponse (Maybe Text)
trrsSuccess = lens _trrsSuccess (\ s a -> s{_trrsSuccess = a});
trrsMessages :: Lens' TestRoleResponse [Text]
trrsMessages = lens _trrsMessages (\ s a -> s{_trrsMessages = a}) . _Default . _Coerce;
trrsResponseStatus :: Lens' TestRoleResponse Int
trrsResponseStatus = lens _trrsResponseStatus (\ s a -> s{_trrsResponseStatus = a});
instance NFData TestRoleResponse