{-# 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.PutRepositoryTriggers
(
putRepositoryTriggers
, PutRepositoryTriggers
, prtTriggers
, prtRepositoryName
, putRepositoryTriggersResponse
, PutRepositoryTriggersResponse
, prtrsConfigurationId
, prtrsResponseStatus
) 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 PutRepositoryTriggers = PutRepositoryTriggers'
{ _prtTriggers :: !(Maybe [RepositoryTrigger])
, _prtRepositoryName :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putRepositoryTriggers
:: PutRepositoryTriggers
putRepositoryTriggers =
PutRepositoryTriggers'
{ _prtTriggers = Nothing
, _prtRepositoryName = Nothing
}
prtTriggers :: Lens' PutRepositoryTriggers [RepositoryTrigger]
prtTriggers = lens _prtTriggers (\ s a -> s{_prtTriggers = a}) . _Default . _Coerce;
prtRepositoryName :: Lens' PutRepositoryTriggers (Maybe Text)
prtRepositoryName = lens _prtRepositoryName (\ s a -> s{_prtRepositoryName = a});
instance AWSRequest PutRepositoryTriggers where
type Rs PutRepositoryTriggers =
PutRepositoryTriggersResponse
request = postJSON codeCommit
response
= receiveJSON
(\ s h x ->
PutRepositoryTriggersResponse' <$>
(x .?> "configurationId") <*> (pure (fromEnum s)))
instance Hashable PutRepositoryTriggers
instance NFData PutRepositoryTriggers
instance ToHeaders PutRepositoryTriggers where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.PutRepositoryTriggers" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutRepositoryTriggers where
toJSON PutRepositoryTriggers'{..}
= object
(catMaybes
[("triggers" .=) <$> _prtTriggers,
("repositoryName" .=) <$> _prtRepositoryName])
instance ToPath PutRepositoryTriggers where
toPath = const "/"
instance ToQuery PutRepositoryTriggers where
toQuery = const mempty
data PutRepositoryTriggersResponse = PutRepositoryTriggersResponse'
{ _prtrsConfigurationId :: !(Maybe Text)
, _prtrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putRepositoryTriggersResponse
:: Int
-> PutRepositoryTriggersResponse
putRepositoryTriggersResponse pResponseStatus_ =
PutRepositoryTriggersResponse'
{ _prtrsConfigurationId = Nothing
, _prtrsResponseStatus = pResponseStatus_
}
prtrsConfigurationId :: Lens' PutRepositoryTriggersResponse (Maybe Text)
prtrsConfigurationId = lens _prtrsConfigurationId (\ s a -> s{_prtrsConfigurationId = a});
prtrsResponseStatus :: Lens' PutRepositoryTriggersResponse Int
prtrsResponseStatus = lens _prtrsResponseStatus (\ s a -> s{_prtrsResponseStatus = a});
instance NFData PutRepositoryTriggersResponse