{-# 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.GetDetector
(
getDetector
, GetDetector
, gdDetectorId
, getDetectorResponse
, GetDetectorResponse
, gdrsStatus
, gdrsCreatedAt
, gdrsUpdatedAt
, gdrsServiceRole
, gdrsResponseStatus
) 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 GetDetector = GetDetector'
{ _gdDetectorId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getDetector
:: Text
-> GetDetector
getDetector pDetectorId_ = GetDetector' {_gdDetectorId = pDetectorId_}
gdDetectorId :: Lens' GetDetector Text
gdDetectorId = lens _gdDetectorId (\ s a -> s{_gdDetectorId = a})
instance AWSRequest GetDetector where
type Rs GetDetector = GetDetectorResponse
request = get guardDuty
response
= receiveJSON
(\ s h x ->
GetDetectorResponse' <$>
(x .?> "status") <*> (x .?> "createdAt") <*>
(x .?> "updatedAt")
<*> (x .?> "serviceRole")
<*> (pure (fromEnum s)))
instance Hashable GetDetector where
instance NFData GetDetector where
instance ToHeaders GetDetector where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetDetector where
toPath GetDetector'{..}
= mconcat ["/detector/", toBS _gdDetectorId]
instance ToQuery GetDetector where
toQuery = const mempty
data GetDetectorResponse = GetDetectorResponse'
{ _gdrsStatus :: !(Maybe DetectorStatus)
, _gdrsCreatedAt :: !(Maybe Text)
, _gdrsUpdatedAt :: !(Maybe Text)
, _gdrsServiceRole :: !(Maybe Text)
, _gdrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getDetectorResponse
:: Int
-> GetDetectorResponse
getDetectorResponse pResponseStatus_ =
GetDetectorResponse'
{ _gdrsStatus = Nothing
, _gdrsCreatedAt = Nothing
, _gdrsUpdatedAt = Nothing
, _gdrsServiceRole = Nothing
, _gdrsResponseStatus = pResponseStatus_
}
gdrsStatus :: Lens' GetDetectorResponse (Maybe DetectorStatus)
gdrsStatus = lens _gdrsStatus (\ s a -> s{_gdrsStatus = a})
gdrsCreatedAt :: Lens' GetDetectorResponse (Maybe Text)
gdrsCreatedAt = lens _gdrsCreatedAt (\ s a -> s{_gdrsCreatedAt = a})
gdrsUpdatedAt :: Lens' GetDetectorResponse (Maybe Text)
gdrsUpdatedAt = lens _gdrsUpdatedAt (\ s a -> s{_gdrsUpdatedAt = a})
gdrsServiceRole :: Lens' GetDetectorResponse (Maybe Text)
gdrsServiceRole = lens _gdrsServiceRole (\ s a -> s{_gdrsServiceRole = a})
gdrsResponseStatus :: Lens' GetDetectorResponse Int
gdrsResponseStatus = lens _gdrsResponseStatus (\ s a -> s{_gdrsResponseStatus = a})
instance NFData GetDetectorResponse where