{-# 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.DescribeAttack
(
describeAttack
, DescribeAttack
, daAttackId
, describeAttackResponse
, DescribeAttackResponse
, darsAttack
, darsResponseStatus
) 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 DescribeAttack = DescribeAttack'
{ _daAttackId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeAttack
:: Text
-> DescribeAttack
describeAttack pAttackId_ = DescribeAttack' {_daAttackId = pAttackId_}
daAttackId :: Lens' DescribeAttack Text
daAttackId = lens _daAttackId (\ s a -> s{_daAttackId = a})
instance AWSRequest DescribeAttack where
type Rs DescribeAttack = DescribeAttackResponse
request = postJSON shield
response
= receiveJSON
(\ s h x ->
DescribeAttackResponse' <$>
(x .?> "Attack") <*> (pure (fromEnum s)))
instance Hashable DescribeAttack where
instance NFData DescribeAttack where
instance ToHeaders DescribeAttack where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSShield_20160616.DescribeAttack" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeAttack where
toJSON DescribeAttack'{..}
= object
(catMaybes [Just ("AttackId" .= _daAttackId)])
instance ToPath DescribeAttack where
toPath = const "/"
instance ToQuery DescribeAttack where
toQuery = const mempty
data DescribeAttackResponse = DescribeAttackResponse'
{ _darsAttack :: !(Maybe AttackDetail)
, _darsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeAttackResponse
:: Int
-> DescribeAttackResponse
describeAttackResponse pResponseStatus_ =
DescribeAttackResponse'
{_darsAttack = Nothing, _darsResponseStatus = pResponseStatus_}
darsAttack :: Lens' DescribeAttackResponse (Maybe AttackDetail)
darsAttack = lens _darsAttack (\ s a -> s{_darsAttack = a})
darsResponseStatus :: Lens' DescribeAttackResponse Int
darsResponseStatus = lens _darsResponseStatus (\ s a -> s{_darsResponseStatus = a})
instance NFData DescribeAttackResponse where