{-# 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.Lambda.Types.SelfManagedEventSource where
import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types.EndPointType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SelfManagedEventSource = SelfManagedEventSource'
{
SelfManagedEventSource
-> Maybe (HashMap EndPointType (NonEmpty Text))
endpoints :: Prelude.Maybe (Prelude.HashMap EndPointType (Prelude.NonEmpty Prelude.Text))
}
deriving (SelfManagedEventSource -> SelfManagedEventSource -> Bool
(SelfManagedEventSource -> SelfManagedEventSource -> Bool)
-> (SelfManagedEventSource -> SelfManagedEventSource -> Bool)
-> Eq SelfManagedEventSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelfManagedEventSource -> SelfManagedEventSource -> Bool
$c/= :: SelfManagedEventSource -> SelfManagedEventSource -> Bool
== :: SelfManagedEventSource -> SelfManagedEventSource -> Bool
$c== :: SelfManagedEventSource -> SelfManagedEventSource -> Bool
Prelude.Eq, ReadPrec [SelfManagedEventSource]
ReadPrec SelfManagedEventSource
Int -> ReadS SelfManagedEventSource
ReadS [SelfManagedEventSource]
(Int -> ReadS SelfManagedEventSource)
-> ReadS [SelfManagedEventSource]
-> ReadPrec SelfManagedEventSource
-> ReadPrec [SelfManagedEventSource]
-> Read SelfManagedEventSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelfManagedEventSource]
$creadListPrec :: ReadPrec [SelfManagedEventSource]
readPrec :: ReadPrec SelfManagedEventSource
$creadPrec :: ReadPrec SelfManagedEventSource
readList :: ReadS [SelfManagedEventSource]
$creadList :: ReadS [SelfManagedEventSource]
readsPrec :: Int -> ReadS SelfManagedEventSource
$creadsPrec :: Int -> ReadS SelfManagedEventSource
Prelude.Read, Int -> SelfManagedEventSource -> ShowS
[SelfManagedEventSource] -> ShowS
SelfManagedEventSource -> String
(Int -> SelfManagedEventSource -> ShowS)
-> (SelfManagedEventSource -> String)
-> ([SelfManagedEventSource] -> ShowS)
-> Show SelfManagedEventSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelfManagedEventSource] -> ShowS
$cshowList :: [SelfManagedEventSource] -> ShowS
show :: SelfManagedEventSource -> String
$cshow :: SelfManagedEventSource -> String
showsPrec :: Int -> SelfManagedEventSource -> ShowS
$cshowsPrec :: Int -> SelfManagedEventSource -> ShowS
Prelude.Show, (forall x. SelfManagedEventSource -> Rep SelfManagedEventSource x)
-> (forall x.
Rep SelfManagedEventSource x -> SelfManagedEventSource)
-> Generic SelfManagedEventSource
forall x. Rep SelfManagedEventSource x -> SelfManagedEventSource
forall x. SelfManagedEventSource -> Rep SelfManagedEventSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SelfManagedEventSource x -> SelfManagedEventSource
$cfrom :: forall x. SelfManagedEventSource -> Rep SelfManagedEventSource x
Prelude.Generic)
newSelfManagedEventSource ::
SelfManagedEventSource
newSelfManagedEventSource :: SelfManagedEventSource
newSelfManagedEventSource =
SelfManagedEventSource' :: Maybe (HashMap EndPointType (NonEmpty Text))
-> SelfManagedEventSource
SelfManagedEventSource'
{ $sel:endpoints:SelfManagedEventSource' :: Maybe (HashMap EndPointType (NonEmpty Text))
endpoints =
Maybe (HashMap EndPointType (NonEmpty Text))
forall a. Maybe a
Prelude.Nothing
}
selfManagedEventSource_endpoints :: Lens.Lens' SelfManagedEventSource (Prelude.Maybe (Prelude.HashMap EndPointType (Prelude.NonEmpty Prelude.Text)))
selfManagedEventSource_endpoints :: (Maybe (HashMap EndPointType (NonEmpty Text))
-> f (Maybe (HashMap EndPointType (NonEmpty Text))))
-> SelfManagedEventSource -> f SelfManagedEventSource
selfManagedEventSource_endpoints = (SelfManagedEventSource
-> Maybe (HashMap EndPointType (NonEmpty Text)))
-> (SelfManagedEventSource
-> Maybe (HashMap EndPointType (NonEmpty Text))
-> SelfManagedEventSource)
-> Lens
SelfManagedEventSource
SelfManagedEventSource
(Maybe (HashMap EndPointType (NonEmpty Text)))
(Maybe (HashMap EndPointType (NonEmpty Text)))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfManagedEventSource' {Maybe (HashMap EndPointType (NonEmpty Text))
endpoints :: Maybe (HashMap EndPointType (NonEmpty Text))
$sel:endpoints:SelfManagedEventSource' :: SelfManagedEventSource
-> Maybe (HashMap EndPointType (NonEmpty Text))
endpoints} -> Maybe (HashMap EndPointType (NonEmpty Text))
endpoints) (\s :: SelfManagedEventSource
s@SelfManagedEventSource' {} Maybe (HashMap EndPointType (NonEmpty Text))
a -> SelfManagedEventSource
s {$sel:endpoints:SelfManagedEventSource' :: Maybe (HashMap EndPointType (NonEmpty Text))
endpoints = Maybe (HashMap EndPointType (NonEmpty Text))
a} :: SelfManagedEventSource) ((Maybe (HashMap EndPointType (NonEmpty Text))
-> f (Maybe (HashMap EndPointType (NonEmpty Text))))
-> SelfManagedEventSource -> f SelfManagedEventSource)
-> ((Maybe (HashMap EndPointType (NonEmpty Text))
-> f (Maybe (HashMap EndPointType (NonEmpty Text))))
-> Maybe (HashMap EndPointType (NonEmpty Text))
-> f (Maybe (HashMap EndPointType (NonEmpty Text))))
-> (Maybe (HashMap EndPointType (NonEmpty Text))
-> f (Maybe (HashMap EndPointType (NonEmpty Text))))
-> SelfManagedEventSource
-> f SelfManagedEventSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap EndPointType (NonEmpty Text))
(HashMap EndPointType (NonEmpty Text))
(HashMap EndPointType (NonEmpty Text))
(HashMap EndPointType (NonEmpty Text))
-> Iso
(Maybe (HashMap EndPointType (NonEmpty Text)))
(Maybe (HashMap EndPointType (NonEmpty Text)))
(Maybe (HashMap EndPointType (NonEmpty Text)))
(Maybe (HashMap EndPointType (NonEmpty Text)))
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
(HashMap EndPointType (NonEmpty Text))
(HashMap EndPointType (NonEmpty Text))
(HashMap EndPointType (NonEmpty Text))
(HashMap EndPointType (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON SelfManagedEventSource where
parseJSON :: Value -> Parser SelfManagedEventSource
parseJSON =
String
-> (Object -> Parser SelfManagedEventSource)
-> Value
-> Parser SelfManagedEventSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SelfManagedEventSource"
( \Object
x ->
Maybe (HashMap EndPointType (NonEmpty Text))
-> SelfManagedEventSource
SelfManagedEventSource'
(Maybe (HashMap EndPointType (NonEmpty Text))
-> SelfManagedEventSource)
-> Parser (Maybe (HashMap EndPointType (NonEmpty Text)))
-> Parser SelfManagedEventSource
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser (Maybe (Maybe (HashMap EndPointType (NonEmpty Text))))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Endpoints" Parser (Maybe (Maybe (HashMap EndPointType (NonEmpty Text))))
-> Maybe (HashMap EndPointType (NonEmpty Text))
-> Parser (Maybe (HashMap EndPointType (NonEmpty Text)))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap EndPointType (NonEmpty Text))
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable SelfManagedEventSource
instance Prelude.NFData SelfManagedEventSource
instance Core.ToJSON SelfManagedEventSource where
toJSON :: SelfManagedEventSource -> Value
toJSON SelfManagedEventSource' {Maybe (HashMap EndPointType (NonEmpty Text))
endpoints :: Maybe (HashMap EndPointType (NonEmpty Text))
$sel:endpoints:SelfManagedEventSource' :: SelfManagedEventSource
-> Maybe (HashMap EndPointType (NonEmpty Text))
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Endpoints" Text -> HashMap EndPointType (NonEmpty Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap EndPointType (NonEmpty Text) -> Pair)
-> Maybe (HashMap EndPointType (NonEmpty Text)) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap EndPointType (NonEmpty Text))
endpoints]
)