{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $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 = 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 :: Lens' WebhookDefinition Text
webhookDefinition_name = 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 :: Lens' WebhookDefinition Text
webhookDefinition_targetPipeline = 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 :: Lens' WebhookDefinition Text
webhookDefinition_targetAction = 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 :: Lens' WebhookDefinition [WebhookFilterRule]
webhookDefinition_filters = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 :: Lens' WebhookDefinition WebhookAuthenticationType
webhookDefinition_authentication = 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 :: Lens' WebhookDefinition WebhookAuthConfiguration
webhookDefinition_authenticationConfiguration = 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 Data.FromJSON WebhookDefinition where
parseJSON :: Value -> Parser WebhookDefinition
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"WebhookDefinition"
( \Object
x ->
Text
-> Text
-> Text
-> [WebhookFilterRule]
-> WebhookAuthenticationType
-> WebhookAuthConfiguration
-> WebhookDefinition
WebhookDefinition'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
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
"targetPipeline")
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
"targetAction")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"filters" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"authentication")
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
"authenticationConfiguration")
)
instance Prelude.Hashable WebhookDefinition where
hashWithSalt :: Int -> WebhookDefinition -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetPipeline
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetAction
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [WebhookFilterRule]
filters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WebhookAuthenticationType
authentication
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WebhookAuthConfiguration
authenticationConfiguration
instance Prelude.NFData WebhookDefinition where
rnf :: WebhookDefinition -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
targetPipeline
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
targetAction
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [WebhookFilterRule]
filters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WebhookAuthenticationType
authentication
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WebhookAuthConfiguration
authenticationConfiguration
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just
(Key
"targetPipeline" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
targetPipeline),
forall a. a -> Maybe a
Prelude.Just (Key
"targetAction" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
targetAction),
forall a. a -> Maybe a
Prelude.Just (Key
"filters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [WebhookFilterRule]
filters),
forall a. a -> Maybe a
Prelude.Just
(Key
"authentication" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= WebhookAuthenticationType
authentication),
forall a. a -> Maybe a
Prelude.Just
( Key
"authenticationConfiguration"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= WebhookAuthConfiguration
authenticationConfiguration
)
]
)