{-# 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.GetMasterAccount
(
getMasterAccount
, GetMasterAccount
, gmaDetectorId
, getMasterAccountResponse
, GetMasterAccountResponse
, gmarsMaster
, gmarsResponseStatus
) 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
newtype GetMasterAccount = GetMasterAccount'
{ _gmaDetectorId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getMasterAccount
:: Text
-> GetMasterAccount
getMasterAccount pDetectorId_ =
GetMasterAccount' {_gmaDetectorId = pDetectorId_}
gmaDetectorId :: Lens' GetMasterAccount Text
gmaDetectorId = lens _gmaDetectorId (\ s a -> s{_gmaDetectorId = a})
instance AWSRequest GetMasterAccount where
type Rs GetMasterAccount = GetMasterAccountResponse
request = get guardDuty
response
= receiveJSON
(\ s h x ->
GetMasterAccountResponse' <$>
(x .?> "master") <*> (pure (fromEnum s)))
instance Hashable GetMasterAccount where
instance NFData GetMasterAccount where
instance ToHeaders GetMasterAccount where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetMasterAccount where
toPath GetMasterAccount'{..}
= mconcat
["/detector/", toBS _gmaDetectorId, "/master"]
instance ToQuery GetMasterAccount where
toQuery = const mempty
data GetMasterAccountResponse = GetMasterAccountResponse'
{ _gmarsMaster :: !(Maybe Master)
, _gmarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getMasterAccountResponse
:: Int
-> GetMasterAccountResponse
getMasterAccountResponse pResponseStatus_ =
GetMasterAccountResponse'
{_gmarsMaster = Nothing, _gmarsResponseStatus = pResponseStatus_}
gmarsMaster :: Lens' GetMasterAccountResponse (Maybe Master)
gmarsMaster = lens _gmarsMaster (\ s a -> s{_gmarsMaster = a})
gmarsResponseStatus :: Lens' GetMasterAccountResponse Int
gmarsResponseStatus = lens _gmarsResponseStatus (\ s a -> s{_gmarsResponseStatus = a})
instance NFData GetMasterAccountResponse where