{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Shield.Types.ProtectionGroup where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Shield.Types.ProtectedResourceType
import Amazonka.Shield.Types.ProtectionGroupAggregation
import Amazonka.Shield.Types.ProtectionGroupPattern
data ProtectionGroup = ProtectionGroup'
{
ProtectionGroup -> Maybe ProtectedResourceType
resourceType :: Prelude.Maybe ProtectedResourceType,
ProtectionGroup -> Maybe Text
protectionGroupArn :: Prelude.Maybe Prelude.Text,
ProtectionGroup -> Text
protectionGroupId :: Prelude.Text,
ProtectionGroup -> ProtectionGroupAggregation
aggregation :: ProtectionGroupAggregation,
ProtectionGroup -> ProtectionGroupPattern
pattern' :: ProtectionGroupPattern,
ProtectionGroup -> [Text]
members :: [Prelude.Text]
}
deriving (ProtectionGroup -> ProtectionGroup -> Bool
(ProtectionGroup -> ProtectionGroup -> Bool)
-> (ProtectionGroup -> ProtectionGroup -> Bool)
-> Eq ProtectionGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProtectionGroup -> ProtectionGroup -> Bool
$c/= :: ProtectionGroup -> ProtectionGroup -> Bool
== :: ProtectionGroup -> ProtectionGroup -> Bool
$c== :: ProtectionGroup -> ProtectionGroup -> Bool
Prelude.Eq, ReadPrec [ProtectionGroup]
ReadPrec ProtectionGroup
Int -> ReadS ProtectionGroup
ReadS [ProtectionGroup]
(Int -> ReadS ProtectionGroup)
-> ReadS [ProtectionGroup]
-> ReadPrec ProtectionGroup
-> ReadPrec [ProtectionGroup]
-> Read ProtectionGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProtectionGroup]
$creadListPrec :: ReadPrec [ProtectionGroup]
readPrec :: ReadPrec ProtectionGroup
$creadPrec :: ReadPrec ProtectionGroup
readList :: ReadS [ProtectionGroup]
$creadList :: ReadS [ProtectionGroup]
readsPrec :: Int -> ReadS ProtectionGroup
$creadsPrec :: Int -> ReadS ProtectionGroup
Prelude.Read, Int -> ProtectionGroup -> ShowS
[ProtectionGroup] -> ShowS
ProtectionGroup -> String
(Int -> ProtectionGroup -> ShowS)
-> (ProtectionGroup -> String)
-> ([ProtectionGroup] -> ShowS)
-> Show ProtectionGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProtectionGroup] -> ShowS
$cshowList :: [ProtectionGroup] -> ShowS
show :: ProtectionGroup -> String
$cshow :: ProtectionGroup -> String
showsPrec :: Int -> ProtectionGroup -> ShowS
$cshowsPrec :: Int -> ProtectionGroup -> ShowS
Prelude.Show, (forall x. ProtectionGroup -> Rep ProtectionGroup x)
-> (forall x. Rep ProtectionGroup x -> ProtectionGroup)
-> Generic ProtectionGroup
forall x. Rep ProtectionGroup x -> ProtectionGroup
forall x. ProtectionGroup -> Rep ProtectionGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProtectionGroup x -> ProtectionGroup
$cfrom :: forall x. ProtectionGroup -> Rep ProtectionGroup x
Prelude.Generic)
newProtectionGroup ::
Prelude.Text ->
ProtectionGroupAggregation ->
ProtectionGroupPattern ->
ProtectionGroup
newProtectionGroup :: Text
-> ProtectionGroupAggregation
-> ProtectionGroupPattern
-> ProtectionGroup
newProtectionGroup
Text
pProtectionGroupId_
ProtectionGroupAggregation
pAggregation_
ProtectionGroupPattern
pPattern_ =
ProtectionGroup' :: Maybe ProtectedResourceType
-> Maybe Text
-> Text
-> ProtectionGroupAggregation
-> ProtectionGroupPattern
-> [Text]
-> ProtectionGroup
ProtectionGroup'
{ $sel:resourceType:ProtectionGroup' :: Maybe ProtectedResourceType
resourceType = Maybe ProtectedResourceType
forall a. Maybe a
Prelude.Nothing,
$sel:protectionGroupArn:ProtectionGroup' :: Maybe Text
protectionGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:protectionGroupId:ProtectionGroup' :: Text
protectionGroupId = Text
pProtectionGroupId_,
$sel:aggregation:ProtectionGroup' :: ProtectionGroupAggregation
aggregation = ProtectionGroupAggregation
pAggregation_,
$sel:pattern':ProtectionGroup' :: ProtectionGroupPattern
pattern' = ProtectionGroupPattern
pPattern_,
$sel:members:ProtectionGroup' :: [Text]
members = [Text]
forall a. Monoid a => a
Prelude.mempty
}
protectionGroup_resourceType :: Lens.Lens' ProtectionGroup (Prelude.Maybe ProtectedResourceType)
protectionGroup_resourceType :: (Maybe ProtectedResourceType -> f (Maybe ProtectedResourceType))
-> ProtectionGroup -> f ProtectionGroup
protectionGroup_resourceType = (ProtectionGroup -> Maybe ProtectedResourceType)
-> (ProtectionGroup
-> Maybe ProtectedResourceType -> ProtectionGroup)
-> Lens
ProtectionGroup
ProtectionGroup
(Maybe ProtectedResourceType)
(Maybe ProtectedResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectionGroup' {Maybe ProtectedResourceType
resourceType :: Maybe ProtectedResourceType
$sel:resourceType:ProtectionGroup' :: ProtectionGroup -> Maybe ProtectedResourceType
resourceType} -> Maybe ProtectedResourceType
resourceType) (\s :: ProtectionGroup
s@ProtectionGroup' {} Maybe ProtectedResourceType
a -> ProtectionGroup
s {$sel:resourceType:ProtectionGroup' :: Maybe ProtectedResourceType
resourceType = Maybe ProtectedResourceType
a} :: ProtectionGroup)
protectionGroup_protectionGroupArn :: Lens.Lens' ProtectionGroup (Prelude.Maybe Prelude.Text)
protectionGroup_protectionGroupArn :: (Maybe Text -> f (Maybe Text))
-> ProtectionGroup -> f ProtectionGroup
protectionGroup_protectionGroupArn = (ProtectionGroup -> Maybe Text)
-> (ProtectionGroup -> Maybe Text -> ProtectionGroup)
-> Lens ProtectionGroup ProtectionGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectionGroup' {Maybe Text
protectionGroupArn :: Maybe Text
$sel:protectionGroupArn:ProtectionGroup' :: ProtectionGroup -> Maybe Text
protectionGroupArn} -> Maybe Text
protectionGroupArn) (\s :: ProtectionGroup
s@ProtectionGroup' {} Maybe Text
a -> ProtectionGroup
s {$sel:protectionGroupArn:ProtectionGroup' :: Maybe Text
protectionGroupArn = Maybe Text
a} :: ProtectionGroup)
protectionGroup_protectionGroupId :: Lens.Lens' ProtectionGroup Prelude.Text
protectionGroup_protectionGroupId :: (Text -> f Text) -> ProtectionGroup -> f ProtectionGroup
protectionGroup_protectionGroupId = (ProtectionGroup -> Text)
-> (ProtectionGroup -> Text -> ProtectionGroup)
-> Lens ProtectionGroup ProtectionGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectionGroup' {Text
protectionGroupId :: Text
$sel:protectionGroupId:ProtectionGroup' :: ProtectionGroup -> Text
protectionGroupId} -> Text
protectionGroupId) (\s :: ProtectionGroup
s@ProtectionGroup' {} Text
a -> ProtectionGroup
s {$sel:protectionGroupId:ProtectionGroup' :: Text
protectionGroupId = Text
a} :: ProtectionGroup)
protectionGroup_aggregation :: Lens.Lens' ProtectionGroup ProtectionGroupAggregation
protectionGroup_aggregation :: (ProtectionGroupAggregation -> f ProtectionGroupAggregation)
-> ProtectionGroup -> f ProtectionGroup
protectionGroup_aggregation = (ProtectionGroup -> ProtectionGroupAggregation)
-> (ProtectionGroup
-> ProtectionGroupAggregation -> ProtectionGroup)
-> Lens
ProtectionGroup
ProtectionGroup
ProtectionGroupAggregation
ProtectionGroupAggregation
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectionGroup' {ProtectionGroupAggregation
aggregation :: ProtectionGroupAggregation
$sel:aggregation:ProtectionGroup' :: ProtectionGroup -> ProtectionGroupAggregation
aggregation} -> ProtectionGroupAggregation
aggregation) (\s :: ProtectionGroup
s@ProtectionGroup' {} ProtectionGroupAggregation
a -> ProtectionGroup
s {$sel:aggregation:ProtectionGroup' :: ProtectionGroupAggregation
aggregation = ProtectionGroupAggregation
a} :: ProtectionGroup)
protectionGroup_pattern :: Lens.Lens' ProtectionGroup ProtectionGroupPattern
protectionGroup_pattern :: (ProtectionGroupPattern -> f ProtectionGroupPattern)
-> ProtectionGroup -> f ProtectionGroup
protectionGroup_pattern = (ProtectionGroup -> ProtectionGroupPattern)
-> (ProtectionGroup -> ProtectionGroupPattern -> ProtectionGroup)
-> Lens
ProtectionGroup
ProtectionGroup
ProtectionGroupPattern
ProtectionGroupPattern
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectionGroup' {ProtectionGroupPattern
pattern' :: ProtectionGroupPattern
$sel:pattern':ProtectionGroup' :: ProtectionGroup -> ProtectionGroupPattern
pattern'} -> ProtectionGroupPattern
pattern') (\s :: ProtectionGroup
s@ProtectionGroup' {} ProtectionGroupPattern
a -> ProtectionGroup
s {$sel:pattern':ProtectionGroup' :: ProtectionGroupPattern
pattern' = ProtectionGroupPattern
a} :: ProtectionGroup)
protectionGroup_members :: Lens.Lens' ProtectionGroup [Prelude.Text]
protectionGroup_members :: ([Text] -> f [Text]) -> ProtectionGroup -> f ProtectionGroup
protectionGroup_members = (ProtectionGroup -> [Text])
-> (ProtectionGroup -> [Text] -> ProtectionGroup)
-> Lens ProtectionGroup ProtectionGroup [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectionGroup' {[Text]
members :: [Text]
$sel:members:ProtectionGroup' :: ProtectionGroup -> [Text]
members} -> [Text]
members) (\s :: ProtectionGroup
s@ProtectionGroup' {} [Text]
a -> ProtectionGroup
s {$sel:members:ProtectionGroup' :: [Text]
members = [Text]
a} :: ProtectionGroup) (([Text] -> f [Text]) -> ProtectionGroup -> f ProtectionGroup)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ProtectionGroup
-> f ProtectionGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON ProtectionGroup where
parseJSON :: Value -> Parser ProtectionGroup
parseJSON =
String
-> (Object -> Parser ProtectionGroup)
-> Value
-> Parser ProtectionGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ProtectionGroup"
( \Object
x ->
Maybe ProtectedResourceType
-> Maybe Text
-> Text
-> ProtectionGroupAggregation
-> ProtectionGroupPattern
-> [Text]
-> ProtectionGroup
ProtectionGroup'
(Maybe ProtectedResourceType
-> Maybe Text
-> Text
-> ProtectionGroupAggregation
-> ProtectionGroupPattern
-> [Text]
-> ProtectionGroup)
-> Parser (Maybe ProtectedResourceType)
-> Parser
(Maybe Text
-> Text
-> ProtectionGroupAggregation
-> ProtectionGroupPattern
-> [Text]
-> ProtectionGroup)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ProtectedResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceType")
Parser
(Maybe Text
-> Text
-> ProtectionGroupAggregation
-> ProtectionGroupPattern
-> [Text]
-> ProtectionGroup)
-> Parser (Maybe Text)
-> Parser
(Text
-> ProtectionGroupAggregation
-> ProtectionGroupPattern
-> [Text]
-> ProtectionGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProtectionGroupArn")
Parser
(Text
-> ProtectionGroupAggregation
-> ProtectionGroupPattern
-> [Text]
-> ProtectionGroup)
-> Parser Text
-> Parser
(ProtectionGroupAggregation
-> ProtectionGroupPattern -> [Text] -> ProtectionGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ProtectionGroupId")
Parser
(ProtectionGroupAggregation
-> ProtectionGroupPattern -> [Text] -> ProtectionGroup)
-> Parser ProtectionGroupAggregation
-> Parser (ProtectionGroupPattern -> [Text] -> ProtectionGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ProtectionGroupAggregation
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Aggregation")
Parser (ProtectionGroupPattern -> [Text] -> ProtectionGroup)
-> Parser ProtectionGroupPattern
-> Parser ([Text] -> ProtectionGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ProtectionGroupPattern
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Pattern")
Parser ([Text] -> ProtectionGroup)
-> Parser [Text] -> Parser ProtectionGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Members" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ProtectionGroup
instance Prelude.NFData ProtectionGroup