{-# 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.CodeBuild.Types.Webhook where
import Amazonka.CodeBuild.Types.WebhookBuildType
import Amazonka.CodeBuild.Types.WebhookFilter
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Webhook = Webhook'
{
Webhook -> Maybe Text
branchFilter :: Prelude.Maybe Prelude.Text,
Webhook -> Maybe POSIX
lastModifiedSecret :: Prelude.Maybe Core.POSIX,
Webhook -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
Webhook -> Maybe Text
secret :: Prelude.Maybe Prelude.Text,
Webhook -> Maybe [[WebhookFilter]]
filterGroups :: Prelude.Maybe [[WebhookFilter]],
Webhook -> Maybe Text
payloadUrl :: Prelude.Maybe Prelude.Text,
Webhook -> Maybe WebhookBuildType
buildType :: Prelude.Maybe WebhookBuildType
}
deriving (Webhook -> Webhook -> Bool
(Webhook -> Webhook -> Bool)
-> (Webhook -> Webhook -> Bool) -> Eq Webhook
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Webhook -> Webhook -> Bool
$c/= :: Webhook -> Webhook -> Bool
== :: Webhook -> Webhook -> Bool
$c== :: Webhook -> Webhook -> Bool
Prelude.Eq, ReadPrec [Webhook]
ReadPrec Webhook
Int -> ReadS Webhook
ReadS [Webhook]
(Int -> ReadS Webhook)
-> ReadS [Webhook]
-> ReadPrec Webhook
-> ReadPrec [Webhook]
-> Read Webhook
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Webhook]
$creadListPrec :: ReadPrec [Webhook]
readPrec :: ReadPrec Webhook
$creadPrec :: ReadPrec Webhook
readList :: ReadS [Webhook]
$creadList :: ReadS [Webhook]
readsPrec :: Int -> ReadS Webhook
$creadsPrec :: Int -> ReadS Webhook
Prelude.Read, Int -> Webhook -> ShowS
[Webhook] -> ShowS
Webhook -> String
(Int -> Webhook -> ShowS)
-> (Webhook -> String) -> ([Webhook] -> ShowS) -> Show Webhook
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Webhook] -> ShowS
$cshowList :: [Webhook] -> ShowS
show :: Webhook -> String
$cshow :: Webhook -> String
showsPrec :: Int -> Webhook -> ShowS
$cshowsPrec :: Int -> Webhook -> ShowS
Prelude.Show, (forall x. Webhook -> Rep Webhook x)
-> (forall x. Rep Webhook x -> Webhook) -> Generic Webhook
forall x. Rep Webhook x -> Webhook
forall x. Webhook -> Rep Webhook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Webhook x -> Webhook
$cfrom :: forall x. Webhook -> Rep Webhook x
Prelude.Generic)
newWebhook ::
Webhook
newWebhook :: Webhook
newWebhook =
Webhook' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe [[WebhookFilter]]
-> Maybe Text
-> Maybe WebhookBuildType
-> Webhook
Webhook'
{ $sel:branchFilter:Webhook' :: Maybe Text
branchFilter = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:lastModifiedSecret:Webhook' :: Maybe POSIX
lastModifiedSecret = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:url:Webhook' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:secret:Webhook' :: Maybe Text
secret = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:filterGroups:Webhook' :: Maybe [[WebhookFilter]]
filterGroups = Maybe [[WebhookFilter]]
forall a. Maybe a
Prelude.Nothing,
$sel:payloadUrl:Webhook' :: Maybe Text
payloadUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:buildType:Webhook' :: Maybe WebhookBuildType
buildType = Maybe WebhookBuildType
forall a. Maybe a
Prelude.Nothing
}
webhook_branchFilter :: Lens.Lens' Webhook (Prelude.Maybe Prelude.Text)
webhook_branchFilter :: (Maybe Text -> f (Maybe Text)) -> Webhook -> f Webhook
webhook_branchFilter = (Webhook -> Maybe Text)
-> (Webhook -> Maybe Text -> Webhook)
-> Lens Webhook Webhook (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Webhook' {Maybe Text
branchFilter :: Maybe Text
$sel:branchFilter:Webhook' :: Webhook -> Maybe Text
branchFilter} -> Maybe Text
branchFilter) (\s :: Webhook
s@Webhook' {} Maybe Text
a -> Webhook
s {$sel:branchFilter:Webhook' :: Maybe Text
branchFilter = Maybe Text
a} :: Webhook)
webhook_lastModifiedSecret :: Lens.Lens' Webhook (Prelude.Maybe Prelude.UTCTime)
webhook_lastModifiedSecret :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Webhook -> f Webhook
webhook_lastModifiedSecret = (Webhook -> Maybe POSIX)
-> (Webhook -> Maybe POSIX -> Webhook)
-> Lens Webhook Webhook (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Webhook' {Maybe POSIX
lastModifiedSecret :: Maybe POSIX
$sel:lastModifiedSecret:Webhook' :: Webhook -> Maybe POSIX
lastModifiedSecret} -> Maybe POSIX
lastModifiedSecret) (\s :: Webhook
s@Webhook' {} Maybe POSIX
a -> Webhook
s {$sel:lastModifiedSecret:Webhook' :: Maybe POSIX
lastModifiedSecret = Maybe POSIX
a} :: Webhook) ((Maybe POSIX -> f (Maybe POSIX)) -> Webhook -> f Webhook)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Webhook
-> f Webhook
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
webhook_url :: Lens.Lens' Webhook (Prelude.Maybe Prelude.Text)
webhook_url :: (Maybe Text -> f (Maybe Text)) -> Webhook -> f Webhook
webhook_url = (Webhook -> Maybe Text)
-> (Webhook -> Maybe Text -> Webhook)
-> Lens Webhook Webhook (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Webhook' {Maybe Text
url :: Maybe Text
$sel:url:Webhook' :: Webhook -> Maybe Text
url} -> Maybe Text
url) (\s :: Webhook
s@Webhook' {} Maybe Text
a -> Webhook
s {$sel:url:Webhook' :: Maybe Text
url = Maybe Text
a} :: Webhook)
webhook_secret :: Lens.Lens' Webhook (Prelude.Maybe Prelude.Text)
webhook_secret :: (Maybe Text -> f (Maybe Text)) -> Webhook -> f Webhook
webhook_secret = (Webhook -> Maybe Text)
-> (Webhook -> Maybe Text -> Webhook)
-> Lens Webhook Webhook (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Webhook' {Maybe Text
secret :: Maybe Text
$sel:secret:Webhook' :: Webhook -> Maybe Text
secret} -> Maybe Text
secret) (\s :: Webhook
s@Webhook' {} Maybe Text
a -> Webhook
s {$sel:secret:Webhook' :: Maybe Text
secret = Maybe Text
a} :: Webhook)
webhook_filterGroups :: Lens.Lens' Webhook (Prelude.Maybe [[WebhookFilter]])
webhook_filterGroups :: (Maybe [[WebhookFilter]] -> f (Maybe [[WebhookFilter]]))
-> Webhook -> f Webhook
webhook_filterGroups = (Webhook -> Maybe [[WebhookFilter]])
-> (Webhook -> Maybe [[WebhookFilter]] -> Webhook)
-> Lens
Webhook Webhook (Maybe [[WebhookFilter]]) (Maybe [[WebhookFilter]])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Webhook' {Maybe [[WebhookFilter]]
filterGroups :: Maybe [[WebhookFilter]]
$sel:filterGroups:Webhook' :: Webhook -> Maybe [[WebhookFilter]]
filterGroups} -> Maybe [[WebhookFilter]]
filterGroups) (\s :: Webhook
s@Webhook' {} Maybe [[WebhookFilter]]
a -> Webhook
s {$sel:filterGroups:Webhook' :: Maybe [[WebhookFilter]]
filterGroups = Maybe [[WebhookFilter]]
a} :: Webhook) ((Maybe [[WebhookFilter]] -> f (Maybe [[WebhookFilter]]))
-> Webhook -> f Webhook)
-> ((Maybe [[WebhookFilter]] -> f (Maybe [[WebhookFilter]]))
-> Maybe [[WebhookFilter]] -> f (Maybe [[WebhookFilter]]))
-> (Maybe [[WebhookFilter]] -> f (Maybe [[WebhookFilter]]))
-> Webhook
-> f Webhook
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[[WebhookFilter]]
[[WebhookFilter]]
[[WebhookFilter]]
[[WebhookFilter]]
-> Iso
(Maybe [[WebhookFilter]])
(Maybe [[WebhookFilter]])
(Maybe [[WebhookFilter]])
(Maybe [[WebhookFilter]])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[[WebhookFilter]]
[[WebhookFilter]]
[[WebhookFilter]]
[[WebhookFilter]]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
webhook_payloadUrl :: Lens.Lens' Webhook (Prelude.Maybe Prelude.Text)
webhook_payloadUrl :: (Maybe Text -> f (Maybe Text)) -> Webhook -> f Webhook
webhook_payloadUrl = (Webhook -> Maybe Text)
-> (Webhook -> Maybe Text -> Webhook)
-> Lens Webhook Webhook (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Webhook' {Maybe Text
payloadUrl :: Maybe Text
$sel:payloadUrl:Webhook' :: Webhook -> Maybe Text
payloadUrl} -> Maybe Text
payloadUrl) (\s :: Webhook
s@Webhook' {} Maybe Text
a -> Webhook
s {$sel:payloadUrl:Webhook' :: Maybe Text
payloadUrl = Maybe Text
a} :: Webhook)
webhook_buildType :: Lens.Lens' Webhook (Prelude.Maybe WebhookBuildType)
webhook_buildType :: (Maybe WebhookBuildType -> f (Maybe WebhookBuildType))
-> Webhook -> f Webhook
webhook_buildType = (Webhook -> Maybe WebhookBuildType)
-> (Webhook -> Maybe WebhookBuildType -> Webhook)
-> Lens
Webhook Webhook (Maybe WebhookBuildType) (Maybe WebhookBuildType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Webhook' {Maybe WebhookBuildType
buildType :: Maybe WebhookBuildType
$sel:buildType:Webhook' :: Webhook -> Maybe WebhookBuildType
buildType} -> Maybe WebhookBuildType
buildType) (\s :: Webhook
s@Webhook' {} Maybe WebhookBuildType
a -> Webhook
s {$sel:buildType:Webhook' :: Maybe WebhookBuildType
buildType = Maybe WebhookBuildType
a} :: Webhook)
instance Core.FromJSON Webhook where
parseJSON :: Value -> Parser Webhook
parseJSON =
String -> (Object -> Parser Webhook) -> Value -> Parser Webhook
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Webhook"
( \Object
x ->
Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe [[WebhookFilter]]
-> Maybe Text
-> Maybe WebhookBuildType
-> Webhook
Webhook'
(Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe [[WebhookFilter]]
-> Maybe Text
-> Maybe WebhookBuildType
-> Webhook)
-> Parser (Maybe Text)
-> Parser
(Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe [[WebhookFilter]]
-> Maybe Text
-> Maybe WebhookBuildType
-> Webhook)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"branchFilter")
Parser
(Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe [[WebhookFilter]]
-> Maybe Text
-> Maybe WebhookBuildType
-> Webhook)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe [[WebhookFilter]]
-> Maybe Text
-> Maybe WebhookBuildType
-> Webhook)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastModifiedSecret")
Parser
(Maybe Text
-> Maybe Text
-> Maybe [[WebhookFilter]]
-> Maybe Text
-> Maybe WebhookBuildType
-> Webhook)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe [[WebhookFilter]]
-> Maybe Text
-> Maybe WebhookBuildType
-> Webhook)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"url")
Parser
(Maybe Text
-> Maybe [[WebhookFilter]]
-> Maybe Text
-> Maybe WebhookBuildType
-> Webhook)
-> Parser (Maybe Text)
-> Parser
(Maybe [[WebhookFilter]]
-> Maybe Text -> Maybe WebhookBuildType -> Webhook)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"secret")
Parser
(Maybe [[WebhookFilter]]
-> Maybe Text -> Maybe WebhookBuildType -> Webhook)
-> Parser (Maybe [[WebhookFilter]])
-> Parser (Maybe Text -> Maybe WebhookBuildType -> Webhook)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [[WebhookFilter]]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"filterGroups" Parser (Maybe (Maybe [[WebhookFilter]]))
-> Maybe [[WebhookFilter]] -> Parser (Maybe [[WebhookFilter]])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [[WebhookFilter]]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> Maybe WebhookBuildType -> Webhook)
-> Parser (Maybe Text)
-> Parser (Maybe WebhookBuildType -> Webhook)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"payloadUrl")
Parser (Maybe WebhookBuildType -> Webhook)
-> Parser (Maybe WebhookBuildType) -> Parser Webhook
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe WebhookBuildType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"buildType")
)
instance Prelude.Hashable Webhook
instance Prelude.NFData Webhook