{-# 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.CodeCommit.TestRepositoryTriggers
(
testRepositoryTriggers
, TestRepositoryTriggers
, trtTriggers
, trtRepositoryName
, testRepositoryTriggersResponse
, TestRepositoryTriggersResponse
, trtrsFailedExecutions
, trtrsSuccessfulExecutions
, trtrsResponseStatus
) where
import Network.AWS.CodeCommit.Types
import Network.AWS.CodeCommit.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data TestRepositoryTriggers = TestRepositoryTriggers'
{ _trtTriggers :: !(Maybe [RepositoryTrigger])
, _trtRepositoryName :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
testRepositoryTriggers
:: TestRepositoryTriggers
testRepositoryTriggers =
TestRepositoryTriggers'
{ _trtTriggers = Nothing
, _trtRepositoryName = Nothing
}
trtTriggers :: Lens' TestRepositoryTriggers [RepositoryTrigger]
trtTriggers = lens _trtTriggers (\ s a -> s{_trtTriggers = a}) . _Default . _Coerce;
trtRepositoryName :: Lens' TestRepositoryTriggers (Maybe Text)
trtRepositoryName = lens _trtRepositoryName (\ s a -> s{_trtRepositoryName = a});
instance AWSRequest TestRepositoryTriggers where
type Rs TestRepositoryTriggers =
TestRepositoryTriggersResponse
request = postJSON codeCommit
response
= receiveJSON
(\ s h x ->
TestRepositoryTriggersResponse' <$>
(x .?> "failedExecutions" .!@ mempty) <*>
(x .?> "successfulExecutions" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable TestRepositoryTriggers
instance NFData TestRepositoryTriggers
instance ToHeaders TestRepositoryTriggers where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.TestRepositoryTriggers" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON TestRepositoryTriggers where
toJSON TestRepositoryTriggers'{..}
= object
(catMaybes
[("triggers" .=) <$> _trtTriggers,
("repositoryName" .=) <$> _trtRepositoryName])
instance ToPath TestRepositoryTriggers where
toPath = const "/"
instance ToQuery TestRepositoryTriggers where
toQuery = const mempty
data TestRepositoryTriggersResponse = TestRepositoryTriggersResponse'
{ _trtrsFailedExecutions :: !(Maybe [RepositoryTriggerExecutionFailure])
, _trtrsSuccessfulExecutions :: !(Maybe [Text])
, _trtrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
testRepositoryTriggersResponse
:: Int
-> TestRepositoryTriggersResponse
testRepositoryTriggersResponse pResponseStatus_ =
TestRepositoryTriggersResponse'
{ _trtrsFailedExecutions = Nothing
, _trtrsSuccessfulExecutions = Nothing
, _trtrsResponseStatus = pResponseStatus_
}
trtrsFailedExecutions :: Lens' TestRepositoryTriggersResponse [RepositoryTriggerExecutionFailure]
trtrsFailedExecutions = lens _trtrsFailedExecutions (\ s a -> s{_trtrsFailedExecutions = a}) . _Default . _Coerce;
trtrsSuccessfulExecutions :: Lens' TestRepositoryTriggersResponse [Text]
trtrsSuccessfulExecutions = lens _trtrsSuccessfulExecutions (\ s a -> s{_trtrsSuccessfulExecutions = a}) . _Default . _Coerce;
trtrsResponseStatus :: Lens' TestRepositoryTriggersResponse Int
trtrsResponseStatus = lens _trtrsResponseStatus (\ s a -> s{_trtrsResponseStatus = a});
instance NFData TestRepositoryTriggersResponse