{-# 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.GuardDuty.InviteMembers
(
inviteMembers
, InviteMembers
, imAccountIds
, imDisableEmailNotification
, imMessage
, imDetectorId
, inviteMembersResponse
, InviteMembersResponse
, imrsUnprocessedAccounts
, imrsResponseStatus
) where
import Network.AWS.GuardDuty.Types
import Network.AWS.GuardDuty.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data InviteMembers = InviteMembers'
{ _imAccountIds :: !(Maybe [Text])
, _imDisableEmailNotification :: !(Maybe Bool)
, _imMessage :: !(Maybe Text)
, _imDetectorId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
inviteMembers
:: Text
-> InviteMembers
inviteMembers pDetectorId_ =
InviteMembers'
{ _imAccountIds = Nothing
, _imDisableEmailNotification = Nothing
, _imMessage = Nothing
, _imDetectorId = pDetectorId_
}
imAccountIds :: Lens' InviteMembers [Text]
imAccountIds = lens _imAccountIds (\ s a -> s{_imAccountIds = a}) . _Default . _Coerce
imDisableEmailNotification :: Lens' InviteMembers (Maybe Bool)
imDisableEmailNotification = lens _imDisableEmailNotification (\ s a -> s{_imDisableEmailNotification = a})
imMessage :: Lens' InviteMembers (Maybe Text)
imMessage = lens _imMessage (\ s a -> s{_imMessage = a})
imDetectorId :: Lens' InviteMembers Text
imDetectorId = lens _imDetectorId (\ s a -> s{_imDetectorId = a})
instance AWSRequest InviteMembers where
type Rs InviteMembers = InviteMembersResponse
request = postJSON guardDuty
response
= receiveJSON
(\ s h x ->
InviteMembersResponse' <$>
(x .?> "unprocessedAccounts" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable InviteMembers where
instance NFData InviteMembers where
instance ToHeaders InviteMembers where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON InviteMembers where
toJSON InviteMembers'{..}
= object
(catMaybes
[("accountIds" .=) <$> _imAccountIds,
("disableEmailNotification" .=) <$>
_imDisableEmailNotification,
("message" .=) <$> _imMessage])
instance ToPath InviteMembers where
toPath InviteMembers'{..}
= mconcat
["/detector/", toBS _imDetectorId, "/member/invite"]
instance ToQuery InviteMembers where
toQuery = const mempty
data InviteMembersResponse = InviteMembersResponse'
{ _imrsUnprocessedAccounts :: !(Maybe [UnprocessedAccount])
, _imrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
inviteMembersResponse
:: Int
-> InviteMembersResponse
inviteMembersResponse pResponseStatus_ =
InviteMembersResponse'
{_imrsUnprocessedAccounts = Nothing, _imrsResponseStatus = pResponseStatus_}
imrsUnprocessedAccounts :: Lens' InviteMembersResponse [UnprocessedAccount]
imrsUnprocessedAccounts = lens _imrsUnprocessedAccounts (\ s a -> s{_imrsUnprocessedAccounts = a}) . _Default . _Coerce
imrsResponseStatus :: Lens' InviteMembersResponse Int
imrsResponseStatus = lens _imrsResponseStatus (\ s a -> s{_imrsResponseStatus = a})
instance NFData InviteMembersResponse where