{-# 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.Shield.DescribeProtection
(
describeProtection
, DescribeProtection
, dpProtectionId
, describeProtectionResponse
, DescribeProtectionResponse
, dprsProtection
, dprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Shield.Types
import Network.AWS.Shield.Types.Product
newtype DescribeProtection = DescribeProtection'
{ _dpProtectionId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeProtection
:: Text
-> DescribeProtection
describeProtection pProtectionId_ =
DescribeProtection' {_dpProtectionId = pProtectionId_}
dpProtectionId :: Lens' DescribeProtection Text
dpProtectionId = lens _dpProtectionId (\ s a -> s{_dpProtectionId = a})
instance AWSRequest DescribeProtection where
type Rs DescribeProtection =
DescribeProtectionResponse
request = postJSON shield
response
= receiveJSON
(\ s h x ->
DescribeProtectionResponse' <$>
(x .?> "Protection") <*> (pure (fromEnum s)))
instance Hashable DescribeProtection where
instance NFData DescribeProtection where
instance ToHeaders DescribeProtection where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSShield_20160616.DescribeProtection" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeProtection where
toJSON DescribeProtection'{..}
= object
(catMaybes
[Just ("ProtectionId" .= _dpProtectionId)])
instance ToPath DescribeProtection where
toPath = const "/"
instance ToQuery DescribeProtection where
toQuery = const mempty
data DescribeProtectionResponse = DescribeProtectionResponse'
{ _dprsProtection :: !(Maybe Protection)
, _dprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeProtectionResponse
:: Int
-> DescribeProtectionResponse
describeProtectionResponse pResponseStatus_ =
DescribeProtectionResponse'
{_dprsProtection = Nothing, _dprsResponseStatus = pResponseStatus_}
dprsProtection :: Lens' DescribeProtectionResponse (Maybe Protection)
dprsProtection = lens _dprsProtection (\ s a -> s{_dprsProtection = a})
dprsResponseStatus :: Lens' DescribeProtectionResponse Int
dprsResponseStatus = lens _dprsResponseStatus (\ s a -> s{_dprsResponseStatus = a})
instance NFData DescribeProtectionResponse where