{-# 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.CognitoIdentityProvider.UpdateGroup
(
updateGroup
, UpdateGroup
, ugPrecedence
, ugDescription
, ugRoleARN
, ugGroupName
, ugUserPoolId
, updateGroupResponse
, UpdateGroupResponse
, ugrsGroup
, ugrsResponseStatus
) where
import Network.AWS.CognitoIdentityProvider.Types
import Network.AWS.CognitoIdentityProvider.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateGroup = UpdateGroup'
{ _ugPrecedence :: !(Maybe Nat)
, _ugDescription :: !(Maybe Text)
, _ugRoleARN :: !(Maybe Text)
, _ugGroupName :: !Text
, _ugUserPoolId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateGroup
:: Text
-> Text
-> UpdateGroup
updateGroup pGroupName_ pUserPoolId_ =
UpdateGroup'
{ _ugPrecedence = Nothing
, _ugDescription = Nothing
, _ugRoleARN = Nothing
, _ugGroupName = pGroupName_
, _ugUserPoolId = pUserPoolId_
}
ugPrecedence :: Lens' UpdateGroup (Maybe Natural)
ugPrecedence = lens _ugPrecedence (\ s a -> s{_ugPrecedence = a}) . mapping _Nat
ugDescription :: Lens' UpdateGroup (Maybe Text)
ugDescription = lens _ugDescription (\ s a -> s{_ugDescription = a})
ugRoleARN :: Lens' UpdateGroup (Maybe Text)
ugRoleARN = lens _ugRoleARN (\ s a -> s{_ugRoleARN = a})
ugGroupName :: Lens' UpdateGroup Text
ugGroupName = lens _ugGroupName (\ s a -> s{_ugGroupName = a})
ugUserPoolId :: Lens' UpdateGroup Text
ugUserPoolId = lens _ugUserPoolId (\ s a -> s{_ugUserPoolId = a})
instance AWSRequest UpdateGroup where
type Rs UpdateGroup = UpdateGroupResponse
request = postJSON cognitoIdentityProvider
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
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.UpdateGroup" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateGroup where
toJSON UpdateGroup'{..}
= object
(catMaybes
[("Precedence" .=) <$> _ugPrecedence,
("Description" .=) <$> _ugDescription,
("RoleArn" .=) <$> _ugRoleARN,
Just ("GroupName" .= _ugGroupName),
Just ("UserPoolId" .= _ugUserPoolId)])
instance ToPath UpdateGroup where
toPath = const "/"
instance ToQuery UpdateGroup where
toQuery = const mempty
data UpdateGroupResponse = UpdateGroupResponse'
{ _ugrsGroup :: !(Maybe GroupType)
, _ugrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateGroupResponse
:: Int
-> UpdateGroupResponse
updateGroupResponse pResponseStatus_ =
UpdateGroupResponse'
{_ugrsGroup = Nothing, _ugrsResponseStatus = pResponseStatus_}
ugrsGroup :: Lens' UpdateGroupResponse (Maybe GroupType)
ugrsGroup = lens _ugrsGroup (\ s a -> s{_ugrsGroup = a})
ugrsResponseStatus :: Lens' UpdateGroupResponse Int
ugrsResponseStatus = lens _ugrsResponseStatus (\ s a -> s{_ugrsResponseStatus = a})
instance NFData UpdateGroupResponse where