{-# 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.NetworkFirewall.Types.StatelessRuleGroupReference where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data StatelessRuleGroupReference = StatelessRuleGroupReference'
{
StatelessRuleGroupReference -> Text
resourceArn :: Prelude.Text,
StatelessRuleGroupReference -> Natural
priority :: Prelude.Natural
}
deriving (StatelessRuleGroupReference -> StatelessRuleGroupReference -> Bool
(StatelessRuleGroupReference
-> StatelessRuleGroupReference -> Bool)
-> (StatelessRuleGroupReference
-> StatelessRuleGroupReference -> Bool)
-> Eq StatelessRuleGroupReference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StatelessRuleGroupReference -> StatelessRuleGroupReference -> Bool
$c/= :: StatelessRuleGroupReference -> StatelessRuleGroupReference -> Bool
== :: StatelessRuleGroupReference -> StatelessRuleGroupReference -> Bool
$c== :: StatelessRuleGroupReference -> StatelessRuleGroupReference -> Bool
Prelude.Eq, ReadPrec [StatelessRuleGroupReference]
ReadPrec StatelessRuleGroupReference
Int -> ReadS StatelessRuleGroupReference
ReadS [StatelessRuleGroupReference]
(Int -> ReadS StatelessRuleGroupReference)
-> ReadS [StatelessRuleGroupReference]
-> ReadPrec StatelessRuleGroupReference
-> ReadPrec [StatelessRuleGroupReference]
-> Read StatelessRuleGroupReference
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StatelessRuleGroupReference]
$creadListPrec :: ReadPrec [StatelessRuleGroupReference]
readPrec :: ReadPrec StatelessRuleGroupReference
$creadPrec :: ReadPrec StatelessRuleGroupReference
readList :: ReadS [StatelessRuleGroupReference]
$creadList :: ReadS [StatelessRuleGroupReference]
readsPrec :: Int -> ReadS StatelessRuleGroupReference
$creadsPrec :: Int -> ReadS StatelessRuleGroupReference
Prelude.Read, Int -> StatelessRuleGroupReference -> ShowS
[StatelessRuleGroupReference] -> ShowS
StatelessRuleGroupReference -> String
(Int -> StatelessRuleGroupReference -> ShowS)
-> (StatelessRuleGroupReference -> String)
-> ([StatelessRuleGroupReference] -> ShowS)
-> Show StatelessRuleGroupReference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StatelessRuleGroupReference] -> ShowS
$cshowList :: [StatelessRuleGroupReference] -> ShowS
show :: StatelessRuleGroupReference -> String
$cshow :: StatelessRuleGroupReference -> String
showsPrec :: Int -> StatelessRuleGroupReference -> ShowS
$cshowsPrec :: Int -> StatelessRuleGroupReference -> ShowS
Prelude.Show, (forall x.
StatelessRuleGroupReference -> Rep StatelessRuleGroupReference x)
-> (forall x.
Rep StatelessRuleGroupReference x -> StatelessRuleGroupReference)
-> Generic StatelessRuleGroupReference
forall x.
Rep StatelessRuleGroupReference x -> StatelessRuleGroupReference
forall x.
StatelessRuleGroupReference -> Rep StatelessRuleGroupReference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StatelessRuleGroupReference x -> StatelessRuleGroupReference
$cfrom :: forall x.
StatelessRuleGroupReference -> Rep StatelessRuleGroupReference x
Prelude.Generic)
newStatelessRuleGroupReference ::
Prelude.Text ->
Prelude.Natural ->
StatelessRuleGroupReference
newStatelessRuleGroupReference :: Text -> Natural -> StatelessRuleGroupReference
newStatelessRuleGroupReference
Text
pResourceArn_
Natural
pPriority_ =
StatelessRuleGroupReference' :: Text -> Natural -> StatelessRuleGroupReference
StatelessRuleGroupReference'
{ $sel:resourceArn:StatelessRuleGroupReference' :: Text
resourceArn =
Text
pResourceArn_,
$sel:priority:StatelessRuleGroupReference' :: Natural
priority = Natural
pPriority_
}
statelessRuleGroupReference_resourceArn :: Lens.Lens' StatelessRuleGroupReference Prelude.Text
statelessRuleGroupReference_resourceArn :: (Text -> f Text)
-> StatelessRuleGroupReference -> f StatelessRuleGroupReference
statelessRuleGroupReference_resourceArn = (StatelessRuleGroupReference -> Text)
-> (StatelessRuleGroupReference
-> Text -> StatelessRuleGroupReference)
-> Lens
StatelessRuleGroupReference StatelessRuleGroupReference Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatelessRuleGroupReference' {Text
resourceArn :: Text
$sel:resourceArn:StatelessRuleGroupReference' :: StatelessRuleGroupReference -> Text
resourceArn} -> Text
resourceArn) (\s :: StatelessRuleGroupReference
s@StatelessRuleGroupReference' {} Text
a -> StatelessRuleGroupReference
s {$sel:resourceArn:StatelessRuleGroupReference' :: Text
resourceArn = Text
a} :: StatelessRuleGroupReference)
statelessRuleGroupReference_priority :: Lens.Lens' StatelessRuleGroupReference Prelude.Natural
statelessRuleGroupReference_priority :: (Natural -> f Natural)
-> StatelessRuleGroupReference -> f StatelessRuleGroupReference
statelessRuleGroupReference_priority = (StatelessRuleGroupReference -> Natural)
-> (StatelessRuleGroupReference
-> Natural -> StatelessRuleGroupReference)
-> Lens
StatelessRuleGroupReference
StatelessRuleGroupReference
Natural
Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatelessRuleGroupReference' {Natural
priority :: Natural
$sel:priority:StatelessRuleGroupReference' :: StatelessRuleGroupReference -> Natural
priority} -> Natural
priority) (\s :: StatelessRuleGroupReference
s@StatelessRuleGroupReference' {} Natural
a -> StatelessRuleGroupReference
s {$sel:priority:StatelessRuleGroupReference' :: Natural
priority = Natural
a} :: StatelessRuleGroupReference)
instance Core.FromJSON StatelessRuleGroupReference where
parseJSON :: Value -> Parser StatelessRuleGroupReference
parseJSON =
String
-> (Object -> Parser StatelessRuleGroupReference)
-> Value
-> Parser StatelessRuleGroupReference
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"StatelessRuleGroupReference"
( \Object
x ->
Text -> Natural -> StatelessRuleGroupReference
StatelessRuleGroupReference'
(Text -> Natural -> StatelessRuleGroupReference)
-> Parser Text -> Parser (Natural -> StatelessRuleGroupReference)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceArn")
Parser (Natural -> StatelessRuleGroupReference)
-> Parser Natural -> Parser StatelessRuleGroupReference
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Priority")
)
instance Prelude.Hashable StatelessRuleGroupReference
instance Prelude.NFData StatelessRuleGroupReference
instance Core.ToJSON StatelessRuleGroupReference where
toJSON :: StatelessRuleGroupReference -> Value
toJSON StatelessRuleGroupReference' {Natural
Text
priority :: Natural
resourceArn :: Text
$sel:priority:StatelessRuleGroupReference' :: StatelessRuleGroupReference -> Natural
$sel:resourceArn:StatelessRuleGroupReference' :: StatelessRuleGroupReference -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Priority" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
priority)
]
)