module Network.AWS.Shield.Types.Product where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Shield.Types.Sum
data AttackDetail = AttackDetail'
{ _adAttackId :: !(Maybe Text)
, _adStartTime :: !(Maybe POSIX)
, _adSubResources :: !(Maybe [SubResourceSummary])
, _adMitigations :: !(Maybe [Mitigation])
, _adAttackCounters :: !(Maybe [SummarizedCounter])
, _adResourceARN :: !(Maybe Text)
, _adEndTime :: !(Maybe POSIX)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
attackDetail
:: AttackDetail
attackDetail =
AttackDetail'
{ _adAttackId = Nothing
, _adStartTime = Nothing
, _adSubResources = Nothing
, _adMitigations = Nothing
, _adAttackCounters = Nothing
, _adResourceARN = Nothing
, _adEndTime = Nothing
}
adAttackId :: Lens' AttackDetail (Maybe Text)
adAttackId = lens _adAttackId (\ s a -> s{_adAttackId = a});
adStartTime :: Lens' AttackDetail (Maybe UTCTime)
adStartTime = lens _adStartTime (\ s a -> s{_adStartTime = a}) . mapping _Time;
adSubResources :: Lens' AttackDetail [SubResourceSummary]
adSubResources = lens _adSubResources (\ s a -> s{_adSubResources = a}) . _Default . _Coerce;
adMitigations :: Lens' AttackDetail [Mitigation]
adMitigations = lens _adMitigations (\ s a -> s{_adMitigations = a}) . _Default . _Coerce;
adAttackCounters :: Lens' AttackDetail [SummarizedCounter]
adAttackCounters = lens _adAttackCounters (\ s a -> s{_adAttackCounters = a}) . _Default . _Coerce;
adResourceARN :: Lens' AttackDetail (Maybe Text)
adResourceARN = lens _adResourceARN (\ s a -> s{_adResourceARN = a});
adEndTime :: Lens' AttackDetail (Maybe UTCTime)
adEndTime = lens _adEndTime (\ s a -> s{_adEndTime = a}) . mapping _Time;
instance FromJSON AttackDetail where
parseJSON
= withObject "AttackDetail"
(\ x ->
AttackDetail' <$>
(x .:? "AttackId") <*> (x .:? "StartTime") <*>
(x .:? "SubResources" .!= mempty)
<*> (x .:? "Mitigations" .!= mempty)
<*> (x .:? "AttackCounters" .!= mempty)
<*> (x .:? "ResourceArn")
<*> (x .:? "EndTime"))
instance Hashable AttackDetail where
instance NFData AttackDetail where
data AttackSummary = AttackSummary'
{ _asAttackVectors :: !(Maybe [AttackVectorDescription])
, _asAttackId :: !(Maybe Text)
, _asStartTime :: !(Maybe POSIX)
, _asResourceARN :: !(Maybe Text)
, _asEndTime :: !(Maybe POSIX)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
attackSummary
:: AttackSummary
attackSummary =
AttackSummary'
{ _asAttackVectors = Nothing
, _asAttackId = Nothing
, _asStartTime = Nothing
, _asResourceARN = Nothing
, _asEndTime = Nothing
}
asAttackVectors :: Lens' AttackSummary [AttackVectorDescription]
asAttackVectors = lens _asAttackVectors (\ s a -> s{_asAttackVectors = a}) . _Default . _Coerce;
asAttackId :: Lens' AttackSummary (Maybe Text)
asAttackId = lens _asAttackId (\ s a -> s{_asAttackId = a});
asStartTime :: Lens' AttackSummary (Maybe UTCTime)
asStartTime = lens _asStartTime (\ s a -> s{_asStartTime = a}) . mapping _Time;
asResourceARN :: Lens' AttackSummary (Maybe Text)
asResourceARN = lens _asResourceARN (\ s a -> s{_asResourceARN = a});
asEndTime :: Lens' AttackSummary (Maybe UTCTime)
asEndTime = lens _asEndTime (\ s a -> s{_asEndTime = a}) . mapping _Time;
instance FromJSON AttackSummary where
parseJSON
= withObject "AttackSummary"
(\ x ->
AttackSummary' <$>
(x .:? "AttackVectors" .!= mempty) <*>
(x .:? "AttackId")
<*> (x .:? "StartTime")
<*> (x .:? "ResourceArn")
<*> (x .:? "EndTime"))
instance Hashable AttackSummary where
instance NFData AttackSummary where
newtype AttackVectorDescription = AttackVectorDescription'
{ _avdVectorType :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
attackVectorDescription
:: Text
-> AttackVectorDescription
attackVectorDescription pVectorType_ =
AttackVectorDescription' {_avdVectorType = pVectorType_}
avdVectorType :: Lens' AttackVectorDescription Text
avdVectorType = lens _avdVectorType (\ s a -> s{_avdVectorType = a});
instance FromJSON AttackVectorDescription where
parseJSON
= withObject "AttackVectorDescription"
(\ x ->
AttackVectorDescription' <$> (x .: "VectorType"))
instance Hashable AttackVectorDescription where
instance NFData AttackVectorDescription where
newtype Mitigation = Mitigation'
{ _mMitigationName :: Maybe Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
mitigation
:: Mitigation
mitigation = Mitigation' {_mMitigationName = Nothing}
mMitigationName :: Lens' Mitigation (Maybe Text)
mMitigationName = lens _mMitigationName (\ s a -> s{_mMitigationName = a});
instance FromJSON Mitigation where
parseJSON
= withObject "Mitigation"
(\ x -> Mitigation' <$> (x .:? "MitigationName"))
instance Hashable Mitigation where
instance NFData Mitigation where
data Protection = Protection'
{ _pResourceARN :: !(Maybe Text)
, _pName :: !(Maybe Text)
, _pId :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
protection
:: Protection
protection =
Protection' {_pResourceARN = Nothing, _pName = Nothing, _pId = Nothing}
pResourceARN :: Lens' Protection (Maybe Text)
pResourceARN = lens _pResourceARN (\ s a -> s{_pResourceARN = a});
pName :: Lens' Protection (Maybe Text)
pName = lens _pName (\ s a -> s{_pName = a});
pId :: Lens' Protection (Maybe Text)
pId = lens _pId (\ s a -> s{_pId = a});
instance FromJSON Protection where
parseJSON
= withObject "Protection"
(\ x ->
Protection' <$>
(x .:? "ResourceArn") <*> (x .:? "Name") <*>
(x .:? "Id"))
instance Hashable Protection where
instance NFData Protection where
data SubResourceSummary = SubResourceSummary'
{ _srsCounters :: !(Maybe [SummarizedCounter])
, _srsAttackVectors :: !(Maybe [SummarizedAttackVector])
, _srsId :: !(Maybe Text)
, _srsType :: !(Maybe SubResourceType)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
subResourceSummary
:: SubResourceSummary
subResourceSummary =
SubResourceSummary'
{ _srsCounters = Nothing
, _srsAttackVectors = Nothing
, _srsId = Nothing
, _srsType = Nothing
}
srsCounters :: Lens' SubResourceSummary [SummarizedCounter]
srsCounters = lens _srsCounters (\ s a -> s{_srsCounters = a}) . _Default . _Coerce;
srsAttackVectors :: Lens' SubResourceSummary [SummarizedAttackVector]
srsAttackVectors = lens _srsAttackVectors (\ s a -> s{_srsAttackVectors = a}) . _Default . _Coerce;
srsId :: Lens' SubResourceSummary (Maybe Text)
srsId = lens _srsId (\ s a -> s{_srsId = a});
srsType :: Lens' SubResourceSummary (Maybe SubResourceType)
srsType = lens _srsType (\ s a -> s{_srsType = a});
instance FromJSON SubResourceSummary where
parseJSON
= withObject "SubResourceSummary"
(\ x ->
SubResourceSummary' <$>
(x .:? "Counters" .!= mempty) <*>
(x .:? "AttackVectors" .!= mempty)
<*> (x .:? "Id")
<*> (x .:? "Type"))
instance Hashable SubResourceSummary where
instance NFData SubResourceSummary where
data Subscription = Subscription'
{ _sTimeCommitmentInSeconds :: !(Maybe Nat)
, _sStartTime :: !(Maybe POSIX)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
subscription
:: Subscription
subscription =
Subscription' {_sTimeCommitmentInSeconds = Nothing, _sStartTime = Nothing}
sTimeCommitmentInSeconds :: Lens' Subscription (Maybe Natural)
sTimeCommitmentInSeconds = lens _sTimeCommitmentInSeconds (\ s a -> s{_sTimeCommitmentInSeconds = a}) . mapping _Nat;
sStartTime :: Lens' Subscription (Maybe UTCTime)
sStartTime = lens _sStartTime (\ s a -> s{_sStartTime = a}) . mapping _Time;
instance FromJSON Subscription where
parseJSON
= withObject "Subscription"
(\ x ->
Subscription' <$>
(x .:? "TimeCommitmentInSeconds") <*>
(x .:? "StartTime"))
instance Hashable Subscription where
instance NFData Subscription where
data SummarizedAttackVector = SummarizedAttackVector'
{ _savVectorCounters :: !(Maybe [SummarizedCounter])
, _savVectorType :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
summarizedAttackVector
:: Text
-> SummarizedAttackVector
summarizedAttackVector pVectorType_ =
SummarizedAttackVector'
{_savVectorCounters = Nothing, _savVectorType = pVectorType_}
savVectorCounters :: Lens' SummarizedAttackVector [SummarizedCounter]
savVectorCounters = lens _savVectorCounters (\ s a -> s{_savVectorCounters = a}) . _Default . _Coerce;
savVectorType :: Lens' SummarizedAttackVector Text
savVectorType = lens _savVectorType (\ s a -> s{_savVectorType = a});
instance FromJSON SummarizedAttackVector where
parseJSON
= withObject "SummarizedAttackVector"
(\ x ->
SummarizedAttackVector' <$>
(x .:? "VectorCounters" .!= mempty) <*>
(x .: "VectorType"))
instance Hashable SummarizedAttackVector where
instance NFData SummarizedAttackVector where
data SummarizedCounter = SummarizedCounter'
{ _scMax :: !(Maybe Double)
, _scAverage :: !(Maybe Double)
, _scN :: !(Maybe Int)
, _scName :: !(Maybe Text)
, _scSum :: !(Maybe Double)
, _scUnit :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
summarizedCounter
:: SummarizedCounter
summarizedCounter =
SummarizedCounter'
{ _scMax = Nothing
, _scAverage = Nothing
, _scN = Nothing
, _scName = Nothing
, _scSum = Nothing
, _scUnit = Nothing
}
scMax :: Lens' SummarizedCounter (Maybe Double)
scMax = lens _scMax (\ s a -> s{_scMax = a});
scAverage :: Lens' SummarizedCounter (Maybe Double)
scAverage = lens _scAverage (\ s a -> s{_scAverage = a});
scN :: Lens' SummarizedCounter (Maybe Int)
scN = lens _scN (\ s a -> s{_scN = a});
scName :: Lens' SummarizedCounter (Maybe Text)
scName = lens _scName (\ s a -> s{_scName = a});
scSum :: Lens' SummarizedCounter (Maybe Double)
scSum = lens _scSum (\ s a -> s{_scSum = a});
scUnit :: Lens' SummarizedCounter (Maybe Text)
scUnit = lens _scUnit (\ s a -> s{_scUnit = a});
instance FromJSON SummarizedCounter where
parseJSON
= withObject "SummarizedCounter"
(\ x ->
SummarizedCounter' <$>
(x .:? "Max") <*> (x .:? "Average") <*> (x .:? "N")
<*> (x .:? "Name")
<*> (x .:? "Sum")
<*> (x .:? "Unit"))
instance Hashable SummarizedCounter where
instance NFData SummarizedCounter where
data TimeRange = TimeRange'
{ _trFromInclusive :: !(Maybe POSIX)
, _trToExclusive :: !(Maybe POSIX)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
timeRange
:: TimeRange
timeRange = TimeRange' {_trFromInclusive = Nothing, _trToExclusive = Nothing}
trFromInclusive :: Lens' TimeRange (Maybe UTCTime)
trFromInclusive = lens _trFromInclusive (\ s a -> s{_trFromInclusive = a}) . mapping _Time;
trToExclusive :: Lens' TimeRange (Maybe UTCTime)
trToExclusive = lens _trToExclusive (\ s a -> s{_trToExclusive = a}) . mapping _Time;
instance Hashable TimeRange where
instance NFData TimeRange where
instance ToJSON TimeRange where
toJSON TimeRange'{..}
= object
(catMaybes
[("FromInclusive" .=) <$> _trFromInclusive,
("ToExclusive" .=) <$> _trToExclusive])