{-# 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.CodeBuild.UpdateWebhook
(
updateWebhook
, UpdateWebhook
, uwBranchFilter
, uwRotateSecret
, uwProjectName
, updateWebhookResponse
, UpdateWebhookResponse
, uwrsWebhook
, uwrsResponseStatus
) where
import Network.AWS.CodeBuild.Types
import Network.AWS.CodeBuild.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateWebhook = UpdateWebhook'
{ _uwBranchFilter :: !(Maybe Text)
, _uwRotateSecret :: !(Maybe Bool)
, _uwProjectName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateWebhook
:: Text
-> UpdateWebhook
updateWebhook pProjectName_ =
UpdateWebhook'
{ _uwBranchFilter = Nothing
, _uwRotateSecret = Nothing
, _uwProjectName = pProjectName_
}
uwBranchFilter :: Lens' UpdateWebhook (Maybe Text)
uwBranchFilter = lens _uwBranchFilter (\ s a -> s{_uwBranchFilter = a})
uwRotateSecret :: Lens' UpdateWebhook (Maybe Bool)
uwRotateSecret = lens _uwRotateSecret (\ s a -> s{_uwRotateSecret = a})
uwProjectName :: Lens' UpdateWebhook Text
uwProjectName = lens _uwProjectName (\ s a -> s{_uwProjectName = a})
instance AWSRequest UpdateWebhook where
type Rs UpdateWebhook = UpdateWebhookResponse
request = postJSON codeBuild
response
= receiveJSON
(\ s h x ->
UpdateWebhookResponse' <$>
(x .?> "webhook") <*> (pure (fromEnum s)))
instance Hashable UpdateWebhook where
instance NFData UpdateWebhook where
instance ToHeaders UpdateWebhook where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeBuild_20161006.UpdateWebhook" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateWebhook where
toJSON UpdateWebhook'{..}
= object
(catMaybes
[("branchFilter" .=) <$> _uwBranchFilter,
("rotateSecret" .=) <$> _uwRotateSecret,
Just ("projectName" .= _uwProjectName)])
instance ToPath UpdateWebhook where
toPath = const "/"
instance ToQuery UpdateWebhook where
toQuery = const mempty
data UpdateWebhookResponse = UpdateWebhookResponse'
{ _uwrsWebhook :: !(Maybe Webhook)
, _uwrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateWebhookResponse
:: Int
-> UpdateWebhookResponse
updateWebhookResponse pResponseStatus_ =
UpdateWebhookResponse'
{_uwrsWebhook = Nothing, _uwrsResponseStatus = pResponseStatus_}
uwrsWebhook :: Lens' UpdateWebhookResponse (Maybe Webhook)
uwrsWebhook = lens _uwrsWebhook (\ s a -> s{_uwrsWebhook = a})
uwrsResponseStatus :: Lens' UpdateWebhookResponse Int
uwrsResponseStatus = lens _uwrsResponseStatus (\ s a -> s{_uwrsResponseStatus = a})
instance NFData UpdateWebhookResponse where