{-# 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.WorkMail.CreateGroup
(
createGroup
, CreateGroup
, cgOrganizationId
, cgName
, createGroupResponse
, CreateGroupResponse
, cgrsGroupId
, cgrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WorkMail.Types
import Network.AWS.WorkMail.Types.Product
data CreateGroup = CreateGroup'
{ _cgOrganizationId :: !Text
, _cgName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createGroup
:: Text
-> Text
-> CreateGroup
createGroup pOrganizationId_ pName_ =
CreateGroup' {_cgOrganizationId = pOrganizationId_, _cgName = pName_}
cgOrganizationId :: Lens' CreateGroup Text
cgOrganizationId = lens _cgOrganizationId (\ s a -> s{_cgOrganizationId = a})
cgName :: Lens' CreateGroup Text
cgName = lens _cgName (\ s a -> s{_cgName = a})
instance AWSRequest CreateGroup where
type Rs CreateGroup = CreateGroupResponse
request = postJSON workMail
response
= receiveJSON
(\ s h x ->
CreateGroupResponse' <$>
(x .?> "GroupId") <*> (pure (fromEnum s)))
instance Hashable CreateGroup where
instance NFData CreateGroup where
instance ToHeaders CreateGroup where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("WorkMailService.CreateGroup" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateGroup where
toJSON CreateGroup'{..}
= object
(catMaybes
[Just ("OrganizationId" .= _cgOrganizationId),
Just ("Name" .= _cgName)])
instance ToPath CreateGroup where
toPath = const "/"
instance ToQuery CreateGroup where
toQuery = const mempty
data CreateGroupResponse = CreateGroupResponse'
{ _cgrsGroupId :: !(Maybe Text)
, _cgrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createGroupResponse
:: Int
-> CreateGroupResponse
createGroupResponse pResponseStatus_ =
CreateGroupResponse'
{_cgrsGroupId = Nothing, _cgrsResponseStatus = pResponseStatus_}
cgrsGroupId :: Lens' CreateGroupResponse (Maybe Text)
cgrsGroupId = lens _cgrsGroupId (\ s a -> s{_cgrsGroupId = a})
cgrsResponseStatus :: Lens' CreateGroupResponse Int
cgrsResponseStatus = lens _cgrsResponseStatus (\ s a -> s{_cgrsResponseStatus = a})
instance NFData CreateGroupResponse where