{-# 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.ResourceGroups.UpdateGroup
(
updateGroup
, UpdateGroup
, ugDescription
, ugGroupName
, updateGroupResponse
, UpdateGroupResponse
, ugrsGroup
, ugrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.ResourceGroups.Types
import Network.AWS.ResourceGroups.Types.Product
import Network.AWS.Response
data UpdateGroup = UpdateGroup'
{ _ugDescription :: !(Maybe Text)
, _ugGroupName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateGroup
:: Text
-> UpdateGroup
updateGroup pGroupName_ =
UpdateGroup' {_ugDescription = Nothing, _ugGroupName = pGroupName_}
ugDescription :: Lens' UpdateGroup (Maybe Text)
ugDescription = lens _ugDescription (\ s a -> s{_ugDescription = a})
ugGroupName :: Lens' UpdateGroup Text
ugGroupName = lens _ugGroupName (\ s a -> s{_ugGroupName = a})
instance AWSRequest UpdateGroup where
type Rs UpdateGroup = UpdateGroupResponse
request = putJSON resourceGroups
response
= receiveJSON
(\ s h x ->
UpdateGroupResponse' <$>
(x .?> "Group") <*> (pure (fromEnum s)))
instance Hashable UpdateGroup where
instance NFData UpdateGroup where
instance ToHeaders UpdateGroup where
toHeaders = const mempty
instance ToJSON UpdateGroup where
toJSON UpdateGroup'{..}
= object
(catMaybes [("Description" .=) <$> _ugDescription])
instance ToPath UpdateGroup where
toPath UpdateGroup'{..}
= mconcat ["/groups/", toBS _ugGroupName]
instance ToQuery UpdateGroup where
toQuery = const mempty
data UpdateGroupResponse = UpdateGroupResponse'
{ _ugrsGroup :: !(Maybe Group)
, _ugrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateGroupResponse
:: Int
-> UpdateGroupResponse
updateGroupResponse pResponseStatus_ =
UpdateGroupResponse'
{_ugrsGroup = Nothing, _ugrsResponseStatus = pResponseStatus_}
ugrsGroup :: Lens' UpdateGroupResponse (Maybe Group)
ugrsGroup = lens _ugrsGroup (\ s a -> s{_ugrsGroup = a})
ugrsResponseStatus :: Lens' UpdateGroupResponse Int
ugrsResponseStatus = lens _ugrsResponseStatus (\ s a -> s{_ugrsResponseStatus = a})
instance NFData UpdateGroupResponse where