{-# 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.WebhookDefinition where
import Amazonka.CodePipeline.Types.WebhookAuthConfiguration
import Amazonka.CodePipeline.Types.WebhookAuthenticationType
import Amazonka.CodePipeline.Types.WebhookFilterRule
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data WebhookDefinition = WebhookDefinition'
{
WebhookDefinition -> Text
name :: Prelude.Text,
WebhookDefinition -> Text
targetPipeline :: Prelude.Text,
WebhookDefinition -> Text
targetAction :: Prelude.Text,
WebhookDefinition -> [WebhookFilterRule]
filters :: [WebhookFilterRule],
WebhookDefinition -> WebhookAuthenticationType
authentication :: WebhookAuthenticationType,
WebhookDefinition -> WebhookAuthConfiguration
authenticationConfiguration :: WebhookAuthConfiguration
}
deriving (WebhookDefinition -> WebhookDefinition -> Bool
(WebhookDefinition -> WebhookDefinition -> Bool)
-> (WebhookDefinition -> WebhookDefinition -> Bool)
-> Eq WebhookDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WebhookDefinition -> WebhookDefinition -> Bool
$c/= :: WebhookDefinition -> WebhookDefinition -> Bool
== :: WebhookDefinition -> WebhookDefinition -> Bool
$c== :: WebhookDefinition -> WebhookDefinition -> Bool
Prelude.Eq, ReadPrec [WebhookDefinition]
ReadPrec WebhookDefinition
Int -> ReadS WebhookDefinition
ReadS [WebhookDefinition]
(Int -> ReadS WebhookDefinition)
-> ReadS [WebhookDefinition]
-> ReadPrec WebhookDefinition
-> ReadPrec [WebhookDefinition]
-> Read WebhookDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WebhookDefinition]
$creadListPrec :: ReadPrec [WebhookDefinition]
readPrec :: ReadPrec WebhookDefinition
$creadPrec :: ReadPrec WebhookDefinition
readList :: ReadS [WebhookDefinition]
$creadList :: ReadS [WebhookDefinition]
readsPrec :: Int -> ReadS WebhookDefinition
$creadsPrec :: Int -> ReadS WebhookDefinition
Prelude.Read, Int -> WebhookDefinition -> ShowS
[WebhookDefinition] -> ShowS
WebhookDefinition -> String
(Int -> WebhookDefinition -> ShowS)
-> (WebhookDefinition -> String)
-> ([WebhookDefinition] -> ShowS)
-> Show WebhookDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WebhookDefinition] -> ShowS
$cshowList :: [WebhookDefinition] -> ShowS
show :: WebhookDefinition -> String
$cshow :: WebhookDefinition -> String
showsPrec :: Int -> WebhookDefinition -> ShowS
$cshowsPrec :: Int -> WebhookDefinition -> ShowS
Prelude.Show, (forall x. WebhookDefinition -> Rep WebhookDefinition x)
-> (forall x. Rep WebhookDefinition x -> WebhookDefinition)
-> Generic WebhookDefinition
forall x. Rep WebhookDefinition x -> WebhookDefinition
forall x. WebhookDefinition -> Rep WebhookDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WebhookDefinition x -> WebhookDefinition
$cfrom :: forall x. WebhookDefinition -> Rep WebhookDefinition x
Prelude.Generic)
newWebhookDefinition ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
WebhookAuthenticationType ->
WebhookAuthConfiguration ->
WebhookDefinition
newWebhookDefinition :: Text
-> Text
-> Text
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition
newWebhookDefinition
Text
pName_
Text
pTargetPipeline_
Text
pTargetAction_
WebhookAuthenticationType
pAuthentication_
WebhookAuthConfiguration
pAuthenticationConfiguration_ =
WebhookDefinition' :: Text
-> Text
-> Text
-> [WebhookFilterRule]
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition
WebhookDefinition'
{ $sel:name:WebhookDefinition' :: Text
name = Text
pName_,
$sel:targetPipeline:WebhookDefinition' :: Text
targetPipeline = Text
pTargetPipeline_,
$sel:targetAction:WebhookDefinition' :: Text
targetAction = Text
pTargetAction_,
$sel:filters:WebhookDefinition' :: [WebhookFilterRule]
filters = [WebhookFilterRule]
forall a. Monoid a => a
Prelude.mempty,
$sel:authentication:WebhookDefinition' :: WebhookAuthenticationType
authentication = WebhookAuthenticationType
pAuthentication_,
$sel:authenticationConfiguration:WebhookDefinition' :: WebhookAuthConfiguration
authenticationConfiguration =
WebhookAuthConfiguration
pAuthenticationConfiguration_
}
webhookDefinition_name :: Lens.Lens' WebhookDefinition Prelude.Text
webhookDefinition_name :: (Text -> f Text) -> WebhookDefinition -> f WebhookDefinition
webhookDefinition_name = (WebhookDefinition -> Text)
-> (WebhookDefinition -> Text -> WebhookDefinition)
-> Lens WebhookDefinition WebhookDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebhookDefinition' {Text
name :: Text
$sel:name:WebhookDefinition' :: WebhookDefinition -> Text
name} -> Text
name) (\s :: WebhookDefinition
s@WebhookDefinition' {} Text
a -> WebhookDefinition
s {$sel:name:WebhookDefinition' :: Text
name = Text
a} :: WebhookDefinition)
webhookDefinition_targetPipeline :: Lens.Lens' WebhookDefinition Prelude.Text
webhookDefinition_targetPipeline :: (Text -> f Text) -> WebhookDefinition -> f WebhookDefinition
webhookDefinition_targetPipeline = (WebhookDefinition -> Text)
-> (WebhookDefinition -> Text -> WebhookDefinition)
-> Lens WebhookDefinition WebhookDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebhookDefinition' {Text
targetPipeline :: Text
$sel:targetPipeline:WebhookDefinition' :: WebhookDefinition -> Text
targetPipeline} -> Text
targetPipeline) (\s :: WebhookDefinition
s@WebhookDefinition' {} Text
a -> WebhookDefinition
s {$sel:targetPipeline:WebhookDefinition' :: Text
targetPipeline = Text
a} :: WebhookDefinition)
webhookDefinition_targetAction :: Lens.Lens' WebhookDefinition Prelude.Text
webhookDefinition_targetAction :: (Text -> f Text) -> WebhookDefinition -> f WebhookDefinition
webhookDefinition_targetAction = (WebhookDefinition -> Text)
-> (WebhookDefinition -> Text -> WebhookDefinition)
-> Lens WebhookDefinition WebhookDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebhookDefinition' {Text
targetAction :: Text
$sel:targetAction:WebhookDefinition' :: WebhookDefinition -> Text
targetAction} -> Text
targetAction) (\s :: WebhookDefinition
s@WebhookDefinition' {} Text
a -> WebhookDefinition
s {$sel:targetAction:WebhookDefinition' :: Text
targetAction = Text
a} :: WebhookDefinition)
webhookDefinition_filters :: Lens.Lens' WebhookDefinition [WebhookFilterRule]
webhookDefinition_filters :: ([WebhookFilterRule] -> f [WebhookFilterRule])
-> WebhookDefinition -> f WebhookDefinition
webhookDefinition_filters = (WebhookDefinition -> [WebhookFilterRule])
-> (WebhookDefinition -> [WebhookFilterRule] -> WebhookDefinition)
-> Lens
WebhookDefinition
WebhookDefinition
[WebhookFilterRule]
[WebhookFilterRule]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebhookDefinition' {[WebhookFilterRule]
filters :: [WebhookFilterRule]
$sel:filters:WebhookDefinition' :: WebhookDefinition -> [WebhookFilterRule]
filters} -> [WebhookFilterRule]
filters) (\s :: WebhookDefinition
s@WebhookDefinition' {} [WebhookFilterRule]
a -> WebhookDefinition
s {$sel:filters:WebhookDefinition' :: [WebhookFilterRule]
filters = [WebhookFilterRule]
a} :: WebhookDefinition) (([WebhookFilterRule] -> f [WebhookFilterRule])
-> WebhookDefinition -> f WebhookDefinition)
-> (([WebhookFilterRule] -> f [WebhookFilterRule])
-> [WebhookFilterRule] -> f [WebhookFilterRule])
-> ([WebhookFilterRule] -> f [WebhookFilterRule])
-> WebhookDefinition
-> f WebhookDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([WebhookFilterRule] -> f [WebhookFilterRule])
-> [WebhookFilterRule] -> f [WebhookFilterRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
webhookDefinition_authentication :: Lens.Lens' WebhookDefinition WebhookAuthenticationType
webhookDefinition_authentication :: (WebhookAuthenticationType -> f WebhookAuthenticationType)
-> WebhookDefinition -> f WebhookDefinition
webhookDefinition_authentication = (WebhookDefinition -> WebhookAuthenticationType)
-> (WebhookDefinition
-> WebhookAuthenticationType -> WebhookDefinition)
-> Lens
WebhookDefinition
WebhookDefinition
WebhookAuthenticationType
WebhookAuthenticationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebhookDefinition' {WebhookAuthenticationType
authentication :: WebhookAuthenticationType
$sel:authentication:WebhookDefinition' :: WebhookDefinition -> WebhookAuthenticationType
authentication} -> WebhookAuthenticationType
authentication) (\s :: WebhookDefinition
s@WebhookDefinition' {} WebhookAuthenticationType
a -> WebhookDefinition
s {$sel:authentication:WebhookDefinition' :: WebhookAuthenticationType
authentication = WebhookAuthenticationType
a} :: WebhookDefinition)
webhookDefinition_authenticationConfiguration :: Lens.Lens' WebhookDefinition WebhookAuthConfiguration
webhookDefinition_authenticationConfiguration :: (WebhookAuthConfiguration -> f WebhookAuthConfiguration)
-> WebhookDefinition -> f WebhookDefinition
webhookDefinition_authenticationConfiguration = (WebhookDefinition -> WebhookAuthConfiguration)
-> (WebhookDefinition
-> WebhookAuthConfiguration -> WebhookDefinition)
-> Lens
WebhookDefinition
WebhookDefinition
WebhookAuthConfiguration
WebhookAuthConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebhookDefinition' {WebhookAuthConfiguration
authenticationConfiguration :: WebhookAuthConfiguration
$sel:authenticationConfiguration:WebhookDefinition' :: WebhookDefinition -> WebhookAuthConfiguration
authenticationConfiguration} -> WebhookAuthConfiguration
authenticationConfiguration) (\s :: WebhookDefinition
s@WebhookDefinition' {} WebhookAuthConfiguration
a -> WebhookDefinition
s {$sel:authenticationConfiguration:WebhookDefinition' :: WebhookAuthConfiguration
authenticationConfiguration = WebhookAuthConfiguration
a} :: WebhookDefinition)
instance Core.FromJSON WebhookDefinition where
parseJSON :: Value -> Parser WebhookDefinition
parseJSON =
String
-> (Object -> Parser WebhookDefinition)
-> Value
-> Parser WebhookDefinition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"WebhookDefinition"
( \Object
x ->
Text
-> Text
-> Text
-> [WebhookFilterRule]
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition
WebhookDefinition'
(Text
-> Text
-> Text
-> [WebhookFilterRule]
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition)
-> Parser Text
-> Parser
(Text
-> Text
-> [WebhookFilterRule]
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition)
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
"name")
Parser
(Text
-> Text
-> [WebhookFilterRule]
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition)
-> Parser Text
-> Parser
(Text
-> [WebhookFilterRule]
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition)
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
"targetPipeline")
Parser
(Text
-> [WebhookFilterRule]
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition)
-> Parser Text
-> Parser
([WebhookFilterRule]
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition)
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
"targetAction")
Parser
([WebhookFilterRule]
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition)
-> Parser [WebhookFilterRule]
-> Parser
(WebhookAuthenticationType
-> WebhookAuthConfiguration -> WebhookDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [WebhookFilterRule])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"filters" Parser (Maybe [WebhookFilterRule])
-> [WebhookFilterRule] -> Parser [WebhookFilterRule]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [WebhookFilterRule]
forall a. Monoid a => a
Prelude.mempty)
Parser
(WebhookAuthenticationType
-> WebhookAuthConfiguration -> WebhookDefinition)
-> Parser WebhookAuthenticationType
-> Parser (WebhookAuthConfiguration -> WebhookDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser WebhookAuthenticationType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"authentication")
Parser (WebhookAuthConfiguration -> WebhookDefinition)
-> Parser WebhookAuthConfiguration -> Parser WebhookDefinition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser WebhookAuthConfiguration
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"authenticationConfiguration")
)
instance Prelude.Hashable WebhookDefinition
instance Prelude.NFData WebhookDefinition
instance Core.ToJSON WebhookDefinition where
toJSON :: WebhookDefinition -> Value
toJSON WebhookDefinition' {[WebhookFilterRule]
Text
WebhookAuthConfiguration
WebhookAuthenticationType
authenticationConfiguration :: WebhookAuthConfiguration
authentication :: WebhookAuthenticationType
filters :: [WebhookFilterRule]
targetAction :: Text
targetPipeline :: Text
name :: Text
$sel:authenticationConfiguration:WebhookDefinition' :: WebhookDefinition -> WebhookAuthConfiguration
$sel:authentication:WebhookDefinition' :: WebhookDefinition -> WebhookAuthenticationType
$sel:filters:WebhookDefinition' :: WebhookDefinition -> [WebhookFilterRule]
$sel:targetAction:WebhookDefinition' :: WebhookDefinition -> Text
$sel:targetPipeline:WebhookDefinition' :: WebhookDefinition -> Text
$sel:name:WebhookDefinition' :: WebhookDefinition -> 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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"targetPipeline" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetPipeline),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"targetAction" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetAction),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"filters" Text -> [WebhookFilterRule] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [WebhookFilterRule]
filters),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"authentication" Text -> WebhookAuthenticationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= WebhookAuthenticationType
authentication),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"authenticationConfiguration"
Text -> WebhookAuthConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= WebhookAuthConfiguration
authenticationConfiguration
)
]
)