{-# 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.GetGroup
(
getGroup
, GetGroup
, ggGroupName
, ggUserPoolId
, getGroupResponse
, GetGroupResponse
, ggrsGroup
, ggrsResponseStatus
) 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 GetGroup = GetGroup'
{ _ggGroupName :: !Text
, _ggUserPoolId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getGroup
:: Text
-> Text
-> GetGroup
getGroup pGroupName_ pUserPoolId_ =
GetGroup' {_ggGroupName = pGroupName_, _ggUserPoolId = pUserPoolId_}
ggGroupName :: Lens' GetGroup Text
ggGroupName = lens _ggGroupName (\ s a -> s{_ggGroupName = a})
ggUserPoolId :: Lens' GetGroup Text
ggUserPoolId = lens _ggUserPoolId (\ s a -> s{_ggUserPoolId = a})
instance AWSRequest GetGroup where
type Rs GetGroup = GetGroupResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
GetGroupResponse' <$>
(x .?> "Group") <*> (pure (fromEnum s)))
instance Hashable GetGroup where
instance NFData GetGroup where
instance ToHeaders GetGroup where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.GetGroup" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetGroup where
toJSON GetGroup'{..}
= object
(catMaybes
[Just ("GroupName" .= _ggGroupName),
Just ("UserPoolId" .= _ggUserPoolId)])
instance ToPath GetGroup where
toPath = const "/"
instance ToQuery GetGroup where
toQuery = const mempty
data GetGroupResponse = GetGroupResponse'
{ _ggrsGroup :: !(Maybe GroupType)
, _ggrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getGroupResponse
:: Int
-> GetGroupResponse
getGroupResponse pResponseStatus_ =
GetGroupResponse'
{_ggrsGroup = Nothing, _ggrsResponseStatus = pResponseStatus_}
ggrsGroup :: Lens' GetGroupResponse (Maybe GroupType)
ggrsGroup = lens _ggrsGroup (\ s a -> s{_ggrsGroup = a})
ggrsResponseStatus :: Lens' GetGroupResponse Int
ggrsResponseStatus = lens _ggrsResponseStatus (\ s a -> s{_ggrsResponseStatus = a})
instance NFData GetGroupResponse where