{-# 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.WAF.Types.IPSetDescriptor where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAF.Types.IPSetDescriptorType
data IPSetDescriptor = IPSetDescriptor'
{
IPSetDescriptor -> IPSetDescriptorType
type' :: IPSetDescriptorType,
IPSetDescriptor -> Text
value :: Prelude.Text
}
deriving (IPSetDescriptor -> IPSetDescriptor -> Bool
(IPSetDescriptor -> IPSetDescriptor -> Bool)
-> (IPSetDescriptor -> IPSetDescriptor -> Bool)
-> Eq IPSetDescriptor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IPSetDescriptor -> IPSetDescriptor -> Bool
$c/= :: IPSetDescriptor -> IPSetDescriptor -> Bool
== :: IPSetDescriptor -> IPSetDescriptor -> Bool
$c== :: IPSetDescriptor -> IPSetDescriptor -> Bool
Prelude.Eq, ReadPrec [IPSetDescriptor]
ReadPrec IPSetDescriptor
Int -> ReadS IPSetDescriptor
ReadS [IPSetDescriptor]
(Int -> ReadS IPSetDescriptor)
-> ReadS [IPSetDescriptor]
-> ReadPrec IPSetDescriptor
-> ReadPrec [IPSetDescriptor]
-> Read IPSetDescriptor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IPSetDescriptor]
$creadListPrec :: ReadPrec [IPSetDescriptor]
readPrec :: ReadPrec IPSetDescriptor
$creadPrec :: ReadPrec IPSetDescriptor
readList :: ReadS [IPSetDescriptor]
$creadList :: ReadS [IPSetDescriptor]
readsPrec :: Int -> ReadS IPSetDescriptor
$creadsPrec :: Int -> ReadS IPSetDescriptor
Prelude.Read, Int -> IPSetDescriptor -> ShowS
[IPSetDescriptor] -> ShowS
IPSetDescriptor -> String
(Int -> IPSetDescriptor -> ShowS)
-> (IPSetDescriptor -> String)
-> ([IPSetDescriptor] -> ShowS)
-> Show IPSetDescriptor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IPSetDescriptor] -> ShowS
$cshowList :: [IPSetDescriptor] -> ShowS
show :: IPSetDescriptor -> String
$cshow :: IPSetDescriptor -> String
showsPrec :: Int -> IPSetDescriptor -> ShowS
$cshowsPrec :: Int -> IPSetDescriptor -> ShowS
Prelude.Show, (forall x. IPSetDescriptor -> Rep IPSetDescriptor x)
-> (forall x. Rep IPSetDescriptor x -> IPSetDescriptor)
-> Generic IPSetDescriptor
forall x. Rep IPSetDescriptor x -> IPSetDescriptor
forall x. IPSetDescriptor -> Rep IPSetDescriptor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IPSetDescriptor x -> IPSetDescriptor
$cfrom :: forall x. IPSetDescriptor -> Rep IPSetDescriptor x
Prelude.Generic)
newIPSetDescriptor ::
IPSetDescriptorType ->
Prelude.Text ->
IPSetDescriptor
newIPSetDescriptor :: IPSetDescriptorType -> Text -> IPSetDescriptor
newIPSetDescriptor IPSetDescriptorType
pType_ Text
pValue_ =
IPSetDescriptor' :: IPSetDescriptorType -> Text -> IPSetDescriptor
IPSetDescriptor' {$sel:type':IPSetDescriptor' :: IPSetDescriptorType
type' = IPSetDescriptorType
pType_, $sel:value:IPSetDescriptor' :: Text
value = Text
pValue_}
iPSetDescriptor_type :: Lens.Lens' IPSetDescriptor IPSetDescriptorType
iPSetDescriptor_type :: (IPSetDescriptorType -> f IPSetDescriptorType)
-> IPSetDescriptor -> f IPSetDescriptor
iPSetDescriptor_type = (IPSetDescriptor -> IPSetDescriptorType)
-> (IPSetDescriptor -> IPSetDescriptorType -> IPSetDescriptor)
-> Lens
IPSetDescriptor
IPSetDescriptor
IPSetDescriptorType
IPSetDescriptorType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPSetDescriptor' {IPSetDescriptorType
type' :: IPSetDescriptorType
$sel:type':IPSetDescriptor' :: IPSetDescriptor -> IPSetDescriptorType
type'} -> IPSetDescriptorType
type') (\s :: IPSetDescriptor
s@IPSetDescriptor' {} IPSetDescriptorType
a -> IPSetDescriptor
s {$sel:type':IPSetDescriptor' :: IPSetDescriptorType
type' = IPSetDescriptorType
a} :: IPSetDescriptor)
iPSetDescriptor_value :: Lens.Lens' IPSetDescriptor Prelude.Text
iPSetDescriptor_value :: (Text -> f Text) -> IPSetDescriptor -> f IPSetDescriptor
iPSetDescriptor_value = (IPSetDescriptor -> Text)
-> (IPSetDescriptor -> Text -> IPSetDescriptor)
-> Lens IPSetDescriptor IPSetDescriptor Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPSetDescriptor' {Text
value :: Text
$sel:value:IPSetDescriptor' :: IPSetDescriptor -> Text
value} -> Text
value) (\s :: IPSetDescriptor
s@IPSetDescriptor' {} Text
a -> IPSetDescriptor
s {$sel:value:IPSetDescriptor' :: Text
value = Text
a} :: IPSetDescriptor)
instance Core.FromJSON IPSetDescriptor where
parseJSON :: Value -> Parser IPSetDescriptor
parseJSON =
String
-> (Object -> Parser IPSetDescriptor)
-> Value
-> Parser IPSetDescriptor
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IPSetDescriptor"
( \Object
x ->
IPSetDescriptorType -> Text -> IPSetDescriptor
IPSetDescriptor'
(IPSetDescriptorType -> Text -> IPSetDescriptor)
-> Parser IPSetDescriptorType -> Parser (Text -> IPSetDescriptor)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser IPSetDescriptorType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type") Parser (Text -> IPSetDescriptor)
-> Parser Text -> Parser IPSetDescriptor
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
"Value")
)
instance Prelude.Hashable IPSetDescriptor
instance Prelude.NFData IPSetDescriptor
instance Core.ToJSON IPSetDescriptor where
toJSON :: IPSetDescriptor -> Value
toJSON IPSetDescriptor' {Text
IPSetDescriptorType
value :: Text
type' :: IPSetDescriptorType
$sel:value:IPSetDescriptor' :: IPSetDescriptor -> Text
$sel:type':IPSetDescriptor' :: IPSetDescriptor -> IPSetDescriptorType
..} =
[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
"Type" Text -> IPSetDescriptorType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= IPSetDescriptorType
type'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value)
]
)