{-# 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.CodePipeline.Types.WebhookFilterRule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data WebhookFilterRule = WebhookFilterRule'
{
WebhookFilterRule -> Maybe Text
matchEquals :: Prelude.Maybe Prelude.Text,
WebhookFilterRule -> Text
jsonPath :: Prelude.Text
}
deriving (WebhookFilterRule -> WebhookFilterRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WebhookFilterRule -> WebhookFilterRule -> Bool
$c/= :: WebhookFilterRule -> WebhookFilterRule -> Bool
== :: WebhookFilterRule -> WebhookFilterRule -> Bool
$c== :: WebhookFilterRule -> WebhookFilterRule -> Bool
Prelude.Eq, ReadPrec [WebhookFilterRule]
ReadPrec WebhookFilterRule
Int -> ReadS WebhookFilterRule
ReadS [WebhookFilterRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WebhookFilterRule]
$creadListPrec :: ReadPrec [WebhookFilterRule]
readPrec :: ReadPrec WebhookFilterRule
$creadPrec :: ReadPrec WebhookFilterRule
readList :: ReadS [WebhookFilterRule]
$creadList :: ReadS [WebhookFilterRule]
readsPrec :: Int -> ReadS WebhookFilterRule
$creadsPrec :: Int -> ReadS WebhookFilterRule
Prelude.Read, Int -> WebhookFilterRule -> ShowS
[WebhookFilterRule] -> ShowS
WebhookFilterRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WebhookFilterRule] -> ShowS
$cshowList :: [WebhookFilterRule] -> ShowS
show :: WebhookFilterRule -> String
$cshow :: WebhookFilterRule -> String
showsPrec :: Int -> WebhookFilterRule -> ShowS
$cshowsPrec :: Int -> WebhookFilterRule -> ShowS
Prelude.Show, forall x. Rep WebhookFilterRule x -> WebhookFilterRule
forall x. WebhookFilterRule -> Rep WebhookFilterRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WebhookFilterRule x -> WebhookFilterRule
$cfrom :: forall x. WebhookFilterRule -> Rep WebhookFilterRule x
Prelude.Generic)
newWebhookFilterRule ::
Prelude.Text ->
WebhookFilterRule
newWebhookFilterRule :: Text -> WebhookFilterRule
newWebhookFilterRule Text
pJsonPath_ =
WebhookFilterRule'
{ $sel:matchEquals:WebhookFilterRule' :: Maybe Text
matchEquals = forall a. Maybe a
Prelude.Nothing,
$sel:jsonPath:WebhookFilterRule' :: Text
jsonPath = Text
pJsonPath_
}
webhookFilterRule_matchEquals :: Lens.Lens' WebhookFilterRule (Prelude.Maybe Prelude.Text)
webhookFilterRule_matchEquals :: Lens' WebhookFilterRule (Maybe Text)
webhookFilterRule_matchEquals = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebhookFilterRule' {Maybe Text
matchEquals :: Maybe Text
$sel:matchEquals:WebhookFilterRule' :: WebhookFilterRule -> Maybe Text
matchEquals} -> Maybe Text
matchEquals) (\s :: WebhookFilterRule
s@WebhookFilterRule' {} Maybe Text
a -> WebhookFilterRule
s {$sel:matchEquals:WebhookFilterRule' :: Maybe Text
matchEquals = Maybe Text
a} :: WebhookFilterRule)
webhookFilterRule_jsonPath :: Lens.Lens' WebhookFilterRule Prelude.Text
webhookFilterRule_jsonPath :: Lens' WebhookFilterRule Text
webhookFilterRule_jsonPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebhookFilterRule' {Text
jsonPath :: Text
$sel:jsonPath:WebhookFilterRule' :: WebhookFilterRule -> Text
jsonPath} -> Text
jsonPath) (\s :: WebhookFilterRule
s@WebhookFilterRule' {} Text
a -> WebhookFilterRule
s {$sel:jsonPath:WebhookFilterRule' :: Text
jsonPath = Text
a} :: WebhookFilterRule)
instance Data.FromJSON WebhookFilterRule where
parseJSON :: Value -> Parser WebhookFilterRule
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"WebhookFilterRule"
( \Object
x ->
Maybe Text -> Text -> WebhookFilterRule
WebhookFilterRule'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"matchEquals")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"jsonPath")
)
instance Prelude.Hashable WebhookFilterRule where
hashWithSalt :: Int -> WebhookFilterRule -> Int
hashWithSalt Int
_salt WebhookFilterRule' {Maybe Text
Text
jsonPath :: Text
matchEquals :: Maybe Text
$sel:jsonPath:WebhookFilterRule' :: WebhookFilterRule -> Text
$sel:matchEquals:WebhookFilterRule' :: WebhookFilterRule -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
matchEquals
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jsonPath
instance Prelude.NFData WebhookFilterRule where
rnf :: WebhookFilterRule -> ()
rnf WebhookFilterRule' {Maybe Text
Text
jsonPath :: Text
matchEquals :: Maybe Text
$sel:jsonPath:WebhookFilterRule' :: WebhookFilterRule -> Text
$sel:matchEquals:WebhookFilterRule' :: WebhookFilterRule -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
matchEquals
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
jsonPath
instance Data.ToJSON WebhookFilterRule where
toJSON :: WebhookFilterRule -> Value
toJSON WebhookFilterRule' {Maybe Text
Text
jsonPath :: Text
matchEquals :: Maybe Text
$sel:jsonPath:WebhookFilterRule' :: WebhookFilterRule -> Text
$sel:matchEquals:WebhookFilterRule' :: WebhookFilterRule -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"matchEquals" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
matchEquals,
forall a. a -> Maybe a
Prelude.Just (Key
"jsonPath" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
jsonPath)
]
)