{-# 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.WebhookAuthConfiguration 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 WebhookAuthConfiguration = WebhookAuthConfiguration'
{
WebhookAuthConfiguration -> Maybe Text
allowedIPRange :: Prelude.Maybe Prelude.Text,
WebhookAuthConfiguration -> Maybe Text
secretToken :: Prelude.Maybe Prelude.Text
}
deriving (WebhookAuthConfiguration -> WebhookAuthConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WebhookAuthConfiguration -> WebhookAuthConfiguration -> Bool
$c/= :: WebhookAuthConfiguration -> WebhookAuthConfiguration -> Bool
== :: WebhookAuthConfiguration -> WebhookAuthConfiguration -> Bool
$c== :: WebhookAuthConfiguration -> WebhookAuthConfiguration -> Bool
Prelude.Eq, ReadPrec [WebhookAuthConfiguration]
ReadPrec WebhookAuthConfiguration
Int -> ReadS WebhookAuthConfiguration
ReadS [WebhookAuthConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WebhookAuthConfiguration]
$creadListPrec :: ReadPrec [WebhookAuthConfiguration]
readPrec :: ReadPrec WebhookAuthConfiguration
$creadPrec :: ReadPrec WebhookAuthConfiguration
readList :: ReadS [WebhookAuthConfiguration]
$creadList :: ReadS [WebhookAuthConfiguration]
readsPrec :: Int -> ReadS WebhookAuthConfiguration
$creadsPrec :: Int -> ReadS WebhookAuthConfiguration
Prelude.Read, Int -> WebhookAuthConfiguration -> ShowS
[WebhookAuthConfiguration] -> ShowS
WebhookAuthConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WebhookAuthConfiguration] -> ShowS
$cshowList :: [WebhookAuthConfiguration] -> ShowS
show :: WebhookAuthConfiguration -> String
$cshow :: WebhookAuthConfiguration -> String
showsPrec :: Int -> WebhookAuthConfiguration -> ShowS
$cshowsPrec :: Int -> WebhookAuthConfiguration -> ShowS
Prelude.Show, forall x.
Rep WebhookAuthConfiguration x -> WebhookAuthConfiguration
forall x.
WebhookAuthConfiguration -> Rep WebhookAuthConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WebhookAuthConfiguration x -> WebhookAuthConfiguration
$cfrom :: forall x.
WebhookAuthConfiguration -> Rep WebhookAuthConfiguration x
Prelude.Generic)
newWebhookAuthConfiguration ::
WebhookAuthConfiguration
newWebhookAuthConfiguration :: WebhookAuthConfiguration
newWebhookAuthConfiguration =
WebhookAuthConfiguration'
{ $sel:allowedIPRange:WebhookAuthConfiguration' :: Maybe Text
allowedIPRange =
forall a. Maybe a
Prelude.Nothing,
$sel:secretToken:WebhookAuthConfiguration' :: Maybe Text
secretToken = forall a. Maybe a
Prelude.Nothing
}
webhookAuthConfiguration_allowedIPRange :: Lens.Lens' WebhookAuthConfiguration (Prelude.Maybe Prelude.Text)
webhookAuthConfiguration_allowedIPRange :: Lens' WebhookAuthConfiguration (Maybe Text)
webhookAuthConfiguration_allowedIPRange = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebhookAuthConfiguration' {Maybe Text
allowedIPRange :: Maybe Text
$sel:allowedIPRange:WebhookAuthConfiguration' :: WebhookAuthConfiguration -> Maybe Text
allowedIPRange} -> Maybe Text
allowedIPRange) (\s :: WebhookAuthConfiguration
s@WebhookAuthConfiguration' {} Maybe Text
a -> WebhookAuthConfiguration
s {$sel:allowedIPRange:WebhookAuthConfiguration' :: Maybe Text
allowedIPRange = Maybe Text
a} :: WebhookAuthConfiguration)
webhookAuthConfiguration_secretToken :: Lens.Lens' WebhookAuthConfiguration (Prelude.Maybe Prelude.Text)
webhookAuthConfiguration_secretToken :: Lens' WebhookAuthConfiguration (Maybe Text)
webhookAuthConfiguration_secretToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebhookAuthConfiguration' {Maybe Text
secretToken :: Maybe Text
$sel:secretToken:WebhookAuthConfiguration' :: WebhookAuthConfiguration -> Maybe Text
secretToken} -> Maybe Text
secretToken) (\s :: WebhookAuthConfiguration
s@WebhookAuthConfiguration' {} Maybe Text
a -> WebhookAuthConfiguration
s {$sel:secretToken:WebhookAuthConfiguration' :: Maybe Text
secretToken = Maybe Text
a} :: WebhookAuthConfiguration)
instance Data.FromJSON WebhookAuthConfiguration where
parseJSON :: Value -> Parser WebhookAuthConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"WebhookAuthConfiguration"
( \Object
x ->
Maybe Text -> Maybe Text -> WebhookAuthConfiguration
WebhookAuthConfiguration'
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
"AllowedIPRange")
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
"SecretToken")
)
instance Prelude.Hashable WebhookAuthConfiguration where
hashWithSalt :: Int -> WebhookAuthConfiguration -> Int
hashWithSalt Int
_salt WebhookAuthConfiguration' {Maybe Text
secretToken :: Maybe Text
allowedIPRange :: Maybe Text
$sel:secretToken:WebhookAuthConfiguration' :: WebhookAuthConfiguration -> Maybe Text
$sel:allowedIPRange:WebhookAuthConfiguration' :: WebhookAuthConfiguration -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
allowedIPRange
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
secretToken
instance Prelude.NFData WebhookAuthConfiguration where
rnf :: WebhookAuthConfiguration -> ()
rnf WebhookAuthConfiguration' {Maybe Text
secretToken :: Maybe Text
allowedIPRange :: Maybe Text
$sel:secretToken:WebhookAuthConfiguration' :: WebhookAuthConfiguration -> Maybe Text
$sel:allowedIPRange:WebhookAuthConfiguration' :: WebhookAuthConfiguration -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
allowedIPRange
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
secretToken
instance Data.ToJSON WebhookAuthConfiguration where
toJSON :: WebhookAuthConfiguration -> Value
toJSON WebhookAuthConfiguration' {Maybe Text
secretToken :: Maybe Text
allowedIPRange :: Maybe Text
$sel:secretToken:WebhookAuthConfiguration' :: WebhookAuthConfiguration -> Maybe Text
$sel:allowedIPRange:WebhookAuthConfiguration' :: WebhookAuthConfiguration -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AllowedIPRange" 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
allowedIPRange,
(Key
"SecretToken" 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
secretToken
]
)