{-# 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.SourceAccessConfiguration where
import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types.SourceAccessType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SourceAccessConfiguration = SourceAccessConfiguration'
{
SourceAccessConfiguration -> Maybe Text
uri :: Prelude.Maybe Prelude.Text,
SourceAccessConfiguration -> Maybe SourceAccessType
type' :: Prelude.Maybe SourceAccessType
}
deriving (SourceAccessConfiguration -> SourceAccessConfiguration -> Bool
(SourceAccessConfiguration -> SourceAccessConfiguration -> Bool)
-> (SourceAccessConfiguration -> SourceAccessConfiguration -> Bool)
-> Eq SourceAccessConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceAccessConfiguration -> SourceAccessConfiguration -> Bool
$c/= :: SourceAccessConfiguration -> SourceAccessConfiguration -> Bool
== :: SourceAccessConfiguration -> SourceAccessConfiguration -> Bool
$c== :: SourceAccessConfiguration -> SourceAccessConfiguration -> Bool
Prelude.Eq, ReadPrec [SourceAccessConfiguration]
ReadPrec SourceAccessConfiguration
Int -> ReadS SourceAccessConfiguration
ReadS [SourceAccessConfiguration]
(Int -> ReadS SourceAccessConfiguration)
-> ReadS [SourceAccessConfiguration]
-> ReadPrec SourceAccessConfiguration
-> ReadPrec [SourceAccessConfiguration]
-> Read SourceAccessConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceAccessConfiguration]
$creadListPrec :: ReadPrec [SourceAccessConfiguration]
readPrec :: ReadPrec SourceAccessConfiguration
$creadPrec :: ReadPrec SourceAccessConfiguration
readList :: ReadS [SourceAccessConfiguration]
$creadList :: ReadS [SourceAccessConfiguration]
readsPrec :: Int -> ReadS SourceAccessConfiguration
$creadsPrec :: Int -> ReadS SourceAccessConfiguration
Prelude.Read, Int -> SourceAccessConfiguration -> ShowS
[SourceAccessConfiguration] -> ShowS
SourceAccessConfiguration -> String
(Int -> SourceAccessConfiguration -> ShowS)
-> (SourceAccessConfiguration -> String)
-> ([SourceAccessConfiguration] -> ShowS)
-> Show SourceAccessConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceAccessConfiguration] -> ShowS
$cshowList :: [SourceAccessConfiguration] -> ShowS
show :: SourceAccessConfiguration -> String
$cshow :: SourceAccessConfiguration -> String
showsPrec :: Int -> SourceAccessConfiguration -> ShowS
$cshowsPrec :: Int -> SourceAccessConfiguration -> ShowS
Prelude.Show, (forall x.
SourceAccessConfiguration -> Rep SourceAccessConfiguration x)
-> (forall x.
Rep SourceAccessConfiguration x -> SourceAccessConfiguration)
-> Generic SourceAccessConfiguration
forall x.
Rep SourceAccessConfiguration x -> SourceAccessConfiguration
forall x.
SourceAccessConfiguration -> Rep SourceAccessConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SourceAccessConfiguration x -> SourceAccessConfiguration
$cfrom :: forall x.
SourceAccessConfiguration -> Rep SourceAccessConfiguration x
Prelude.Generic)
newSourceAccessConfiguration ::
SourceAccessConfiguration
newSourceAccessConfiguration :: SourceAccessConfiguration
newSourceAccessConfiguration =
SourceAccessConfiguration' :: Maybe Text -> Maybe SourceAccessType -> SourceAccessConfiguration
SourceAccessConfiguration'
{ $sel:uri:SourceAccessConfiguration' :: Maybe Text
uri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':SourceAccessConfiguration' :: Maybe SourceAccessType
type' = Maybe SourceAccessType
forall a. Maybe a
Prelude.Nothing
}
sourceAccessConfiguration_uri :: Lens.Lens' SourceAccessConfiguration (Prelude.Maybe Prelude.Text)
sourceAccessConfiguration_uri :: (Maybe Text -> f (Maybe Text))
-> SourceAccessConfiguration -> f SourceAccessConfiguration
sourceAccessConfiguration_uri = (SourceAccessConfiguration -> Maybe Text)
-> (SourceAccessConfiguration
-> Maybe Text -> SourceAccessConfiguration)
-> Lens
SourceAccessConfiguration
SourceAccessConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceAccessConfiguration' {Maybe Text
uri :: Maybe Text
$sel:uri:SourceAccessConfiguration' :: SourceAccessConfiguration -> Maybe Text
uri} -> Maybe Text
uri) (\s :: SourceAccessConfiguration
s@SourceAccessConfiguration' {} Maybe Text
a -> SourceAccessConfiguration
s {$sel:uri:SourceAccessConfiguration' :: Maybe Text
uri = Maybe Text
a} :: SourceAccessConfiguration)
sourceAccessConfiguration_type :: Lens.Lens' SourceAccessConfiguration (Prelude.Maybe SourceAccessType)
sourceAccessConfiguration_type :: (Maybe SourceAccessType -> f (Maybe SourceAccessType))
-> SourceAccessConfiguration -> f SourceAccessConfiguration
sourceAccessConfiguration_type = (SourceAccessConfiguration -> Maybe SourceAccessType)
-> (SourceAccessConfiguration
-> Maybe SourceAccessType -> SourceAccessConfiguration)
-> Lens
SourceAccessConfiguration
SourceAccessConfiguration
(Maybe SourceAccessType)
(Maybe SourceAccessType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceAccessConfiguration' {Maybe SourceAccessType
type' :: Maybe SourceAccessType
$sel:type':SourceAccessConfiguration' :: SourceAccessConfiguration -> Maybe SourceAccessType
type'} -> Maybe SourceAccessType
type') (\s :: SourceAccessConfiguration
s@SourceAccessConfiguration' {} Maybe SourceAccessType
a -> SourceAccessConfiguration
s {$sel:type':SourceAccessConfiguration' :: Maybe SourceAccessType
type' = Maybe SourceAccessType
a} :: SourceAccessConfiguration)
instance Core.FromJSON SourceAccessConfiguration where
parseJSON :: Value -> Parser SourceAccessConfiguration
parseJSON =
String
-> (Object -> Parser SourceAccessConfiguration)
-> Value
-> Parser SourceAccessConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SourceAccessConfiguration"
( \Object
x ->
Maybe Text -> Maybe SourceAccessType -> SourceAccessConfiguration
SourceAccessConfiguration'
(Maybe Text -> Maybe SourceAccessType -> SourceAccessConfiguration)
-> Parser (Maybe Text)
-> Parser (Maybe SourceAccessType -> SourceAccessConfiguration)
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
"URI") Parser (Maybe SourceAccessType -> SourceAccessConfiguration)
-> Parser (Maybe SourceAccessType)
-> Parser SourceAccessConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SourceAccessType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
)
instance Prelude.Hashable SourceAccessConfiguration
instance Prelude.NFData SourceAccessConfiguration
instance Core.ToJSON SourceAccessConfiguration where
toJSON :: SourceAccessConfiguration -> Value
toJSON SourceAccessConfiguration' {Maybe Text
Maybe SourceAccessType
type' :: Maybe SourceAccessType
uri :: Maybe Text
$sel:type':SourceAccessConfiguration' :: SourceAccessConfiguration -> Maybe SourceAccessType
$sel:uri:SourceAccessConfiguration' :: SourceAccessConfiguration -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"URI" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
uri,
(Text
"Type" Text -> SourceAccessType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SourceAccessType -> Pair) -> Maybe SourceAccessType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SourceAccessType
type'
]
)