{-# 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.Greengrass.Types.FunctionConfiguration where
import qualified Amazonka.Core as Core
import Amazonka.Greengrass.Types.EncodingType
import Amazonka.Greengrass.Types.FunctionConfigurationEnvironment
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FunctionConfiguration = FunctionConfiguration'
{
FunctionConfiguration -> Maybe Int
memorySize :: Prelude.Maybe Prelude.Int,
FunctionConfiguration -> Maybe Text
execArgs :: Prelude.Maybe Prelude.Text,
FunctionConfiguration -> Maybe FunctionConfigurationEnvironment
environment :: Prelude.Maybe FunctionConfigurationEnvironment,
FunctionConfiguration -> Maybe Text
executable :: Prelude.Maybe Prelude.Text,
FunctionConfiguration -> Maybe Bool
pinned :: Prelude.Maybe Prelude.Bool,
FunctionConfiguration -> Maybe EncodingType
encodingType :: Prelude.Maybe EncodingType,
FunctionConfiguration -> Maybe Int
timeout :: Prelude.Maybe Prelude.Int
}
deriving (FunctionConfiguration -> FunctionConfiguration -> Bool
(FunctionConfiguration -> FunctionConfiguration -> Bool)
-> (FunctionConfiguration -> FunctionConfiguration -> Bool)
-> Eq FunctionConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionConfiguration -> FunctionConfiguration -> Bool
$c/= :: FunctionConfiguration -> FunctionConfiguration -> Bool
== :: FunctionConfiguration -> FunctionConfiguration -> Bool
$c== :: FunctionConfiguration -> FunctionConfiguration -> Bool
Prelude.Eq, ReadPrec [FunctionConfiguration]
ReadPrec FunctionConfiguration
Int -> ReadS FunctionConfiguration
ReadS [FunctionConfiguration]
(Int -> ReadS FunctionConfiguration)
-> ReadS [FunctionConfiguration]
-> ReadPrec FunctionConfiguration
-> ReadPrec [FunctionConfiguration]
-> Read FunctionConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FunctionConfiguration]
$creadListPrec :: ReadPrec [FunctionConfiguration]
readPrec :: ReadPrec FunctionConfiguration
$creadPrec :: ReadPrec FunctionConfiguration
readList :: ReadS [FunctionConfiguration]
$creadList :: ReadS [FunctionConfiguration]
readsPrec :: Int -> ReadS FunctionConfiguration
$creadsPrec :: Int -> ReadS FunctionConfiguration
Prelude.Read, Int -> FunctionConfiguration -> ShowS
[FunctionConfiguration] -> ShowS
FunctionConfiguration -> String
(Int -> FunctionConfiguration -> ShowS)
-> (FunctionConfiguration -> String)
-> ([FunctionConfiguration] -> ShowS)
-> Show FunctionConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionConfiguration] -> ShowS
$cshowList :: [FunctionConfiguration] -> ShowS
show :: FunctionConfiguration -> String
$cshow :: FunctionConfiguration -> String
showsPrec :: Int -> FunctionConfiguration -> ShowS
$cshowsPrec :: Int -> FunctionConfiguration -> ShowS
Prelude.Show, (forall x. FunctionConfiguration -> Rep FunctionConfiguration x)
-> (forall x. Rep FunctionConfiguration x -> FunctionConfiguration)
-> Generic FunctionConfiguration
forall x. Rep FunctionConfiguration x -> FunctionConfiguration
forall x. FunctionConfiguration -> Rep FunctionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FunctionConfiguration x -> FunctionConfiguration
$cfrom :: forall x. FunctionConfiguration -> Rep FunctionConfiguration x
Prelude.Generic)
newFunctionConfiguration ::
FunctionConfiguration
newFunctionConfiguration :: FunctionConfiguration
newFunctionConfiguration =
FunctionConfiguration' :: Maybe Int
-> Maybe Text
-> Maybe FunctionConfigurationEnvironment
-> Maybe Text
-> Maybe Bool
-> Maybe EncodingType
-> Maybe Int
-> FunctionConfiguration
FunctionConfiguration'
{ $sel:memorySize:FunctionConfiguration' :: Maybe Int
memorySize =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:execArgs:FunctionConfiguration' :: Maybe Text
execArgs = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:environment:FunctionConfiguration' :: Maybe FunctionConfigurationEnvironment
environment = Maybe FunctionConfigurationEnvironment
forall a. Maybe a
Prelude.Nothing,
$sel:executable:FunctionConfiguration' :: Maybe Text
executable = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:pinned:FunctionConfiguration' :: Maybe Bool
pinned = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:encodingType:FunctionConfiguration' :: Maybe EncodingType
encodingType = Maybe EncodingType
forall a. Maybe a
Prelude.Nothing,
$sel:timeout:FunctionConfiguration' :: Maybe Int
timeout = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
functionConfiguration_memorySize :: Lens.Lens' FunctionConfiguration (Prelude.Maybe Prelude.Int)
functionConfiguration_memorySize :: (Maybe Int -> f (Maybe Int))
-> FunctionConfiguration -> f FunctionConfiguration
functionConfiguration_memorySize = (FunctionConfiguration -> Maybe Int)
-> (FunctionConfiguration -> Maybe Int -> FunctionConfiguration)
-> Lens
FunctionConfiguration FunctionConfiguration (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionConfiguration' {Maybe Int
memorySize :: Maybe Int
$sel:memorySize:FunctionConfiguration' :: FunctionConfiguration -> Maybe Int
memorySize} -> Maybe Int
memorySize) (\s :: FunctionConfiguration
s@FunctionConfiguration' {} Maybe Int
a -> FunctionConfiguration
s {$sel:memorySize:FunctionConfiguration' :: Maybe Int
memorySize = Maybe Int
a} :: FunctionConfiguration)
functionConfiguration_execArgs :: Lens.Lens' FunctionConfiguration (Prelude.Maybe Prelude.Text)
functionConfiguration_execArgs :: (Maybe Text -> f (Maybe Text))
-> FunctionConfiguration -> f FunctionConfiguration
functionConfiguration_execArgs = (FunctionConfiguration -> Maybe Text)
-> (FunctionConfiguration -> Maybe Text -> FunctionConfiguration)
-> Lens
FunctionConfiguration
FunctionConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionConfiguration' {Maybe Text
execArgs :: Maybe Text
$sel:execArgs:FunctionConfiguration' :: FunctionConfiguration -> Maybe Text
execArgs} -> Maybe Text
execArgs) (\s :: FunctionConfiguration
s@FunctionConfiguration' {} Maybe Text
a -> FunctionConfiguration
s {$sel:execArgs:FunctionConfiguration' :: Maybe Text
execArgs = Maybe Text
a} :: FunctionConfiguration)
functionConfiguration_environment :: Lens.Lens' FunctionConfiguration (Prelude.Maybe FunctionConfigurationEnvironment)
functionConfiguration_environment :: (Maybe FunctionConfigurationEnvironment
-> f (Maybe FunctionConfigurationEnvironment))
-> FunctionConfiguration -> f FunctionConfiguration
functionConfiguration_environment = (FunctionConfiguration -> Maybe FunctionConfigurationEnvironment)
-> (FunctionConfiguration
-> Maybe FunctionConfigurationEnvironment -> FunctionConfiguration)
-> Lens
FunctionConfiguration
FunctionConfiguration
(Maybe FunctionConfigurationEnvironment)
(Maybe FunctionConfigurationEnvironment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionConfiguration' {Maybe FunctionConfigurationEnvironment
environment :: Maybe FunctionConfigurationEnvironment
$sel:environment:FunctionConfiguration' :: FunctionConfiguration -> Maybe FunctionConfigurationEnvironment
environment} -> Maybe FunctionConfigurationEnvironment
environment) (\s :: FunctionConfiguration
s@FunctionConfiguration' {} Maybe FunctionConfigurationEnvironment
a -> FunctionConfiguration
s {$sel:environment:FunctionConfiguration' :: Maybe FunctionConfigurationEnvironment
environment = Maybe FunctionConfigurationEnvironment
a} :: FunctionConfiguration)
functionConfiguration_executable :: Lens.Lens' FunctionConfiguration (Prelude.Maybe Prelude.Text)
functionConfiguration_executable :: (Maybe Text -> f (Maybe Text))
-> FunctionConfiguration -> f FunctionConfiguration
functionConfiguration_executable = (FunctionConfiguration -> Maybe Text)
-> (FunctionConfiguration -> Maybe Text -> FunctionConfiguration)
-> Lens
FunctionConfiguration
FunctionConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionConfiguration' {Maybe Text
executable :: Maybe Text
$sel:executable:FunctionConfiguration' :: FunctionConfiguration -> Maybe Text
executable} -> Maybe Text
executable) (\s :: FunctionConfiguration
s@FunctionConfiguration' {} Maybe Text
a -> FunctionConfiguration
s {$sel:executable:FunctionConfiguration' :: Maybe Text
executable = Maybe Text
a} :: FunctionConfiguration)
functionConfiguration_pinned :: Lens.Lens' FunctionConfiguration (Prelude.Maybe Prelude.Bool)
functionConfiguration_pinned :: (Maybe Bool -> f (Maybe Bool))
-> FunctionConfiguration -> f FunctionConfiguration
functionConfiguration_pinned = (FunctionConfiguration -> Maybe Bool)
-> (FunctionConfiguration -> Maybe Bool -> FunctionConfiguration)
-> Lens
FunctionConfiguration
FunctionConfiguration
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionConfiguration' {Maybe Bool
pinned :: Maybe Bool
$sel:pinned:FunctionConfiguration' :: FunctionConfiguration -> Maybe Bool
pinned} -> Maybe Bool
pinned) (\s :: FunctionConfiguration
s@FunctionConfiguration' {} Maybe Bool
a -> FunctionConfiguration
s {$sel:pinned:FunctionConfiguration' :: Maybe Bool
pinned = Maybe Bool
a} :: FunctionConfiguration)
functionConfiguration_encodingType :: Lens.Lens' FunctionConfiguration (Prelude.Maybe EncodingType)
functionConfiguration_encodingType :: (Maybe EncodingType -> f (Maybe EncodingType))
-> FunctionConfiguration -> f FunctionConfiguration
functionConfiguration_encodingType = (FunctionConfiguration -> Maybe EncodingType)
-> (FunctionConfiguration
-> Maybe EncodingType -> FunctionConfiguration)
-> Lens
FunctionConfiguration
FunctionConfiguration
(Maybe EncodingType)
(Maybe EncodingType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionConfiguration' {Maybe EncodingType
encodingType :: Maybe EncodingType
$sel:encodingType:FunctionConfiguration' :: FunctionConfiguration -> Maybe EncodingType
encodingType} -> Maybe EncodingType
encodingType) (\s :: FunctionConfiguration
s@FunctionConfiguration' {} Maybe EncodingType
a -> FunctionConfiguration
s {$sel:encodingType:FunctionConfiguration' :: Maybe EncodingType
encodingType = Maybe EncodingType
a} :: FunctionConfiguration)
functionConfiguration_timeout :: Lens.Lens' FunctionConfiguration (Prelude.Maybe Prelude.Int)
functionConfiguration_timeout :: (Maybe Int -> f (Maybe Int))
-> FunctionConfiguration -> f FunctionConfiguration
functionConfiguration_timeout = (FunctionConfiguration -> Maybe Int)
-> (FunctionConfiguration -> Maybe Int -> FunctionConfiguration)
-> Lens
FunctionConfiguration FunctionConfiguration (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionConfiguration' {Maybe Int
timeout :: Maybe Int
$sel:timeout:FunctionConfiguration' :: FunctionConfiguration -> Maybe Int
timeout} -> Maybe Int
timeout) (\s :: FunctionConfiguration
s@FunctionConfiguration' {} Maybe Int
a -> FunctionConfiguration
s {$sel:timeout:FunctionConfiguration' :: Maybe Int
timeout = Maybe Int
a} :: FunctionConfiguration)
instance Core.FromJSON FunctionConfiguration where
parseJSON :: Value -> Parser FunctionConfiguration
parseJSON =
String
-> (Object -> Parser FunctionConfiguration)
-> Value
-> Parser FunctionConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FunctionConfiguration"
( \Object
x ->
Maybe Int
-> Maybe Text
-> Maybe FunctionConfigurationEnvironment
-> Maybe Text
-> Maybe Bool
-> Maybe EncodingType
-> Maybe Int
-> FunctionConfiguration
FunctionConfiguration'
(Maybe Int
-> Maybe Text
-> Maybe FunctionConfigurationEnvironment
-> Maybe Text
-> Maybe Bool
-> Maybe EncodingType
-> Maybe Int
-> FunctionConfiguration)
-> Parser (Maybe Int)
-> Parser
(Maybe Text
-> Maybe FunctionConfigurationEnvironment
-> Maybe Text
-> Maybe Bool
-> Maybe EncodingType
-> Maybe Int
-> FunctionConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MemorySize")
Parser
(Maybe Text
-> Maybe FunctionConfigurationEnvironment
-> Maybe Text
-> Maybe Bool
-> Maybe EncodingType
-> Maybe Int
-> FunctionConfiguration)
-> Parser (Maybe Text)
-> Parser
(Maybe FunctionConfigurationEnvironment
-> Maybe Text
-> Maybe Bool
-> Maybe EncodingType
-> Maybe Int
-> FunctionConfiguration)
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
"ExecArgs")
Parser
(Maybe FunctionConfigurationEnvironment
-> Maybe Text
-> Maybe Bool
-> Maybe EncodingType
-> Maybe Int
-> FunctionConfiguration)
-> Parser (Maybe FunctionConfigurationEnvironment)
-> Parser
(Maybe Text
-> Maybe Bool
-> Maybe EncodingType
-> Maybe Int
-> FunctionConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FunctionConfigurationEnvironment)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Environment")
Parser
(Maybe Text
-> Maybe Bool
-> Maybe EncodingType
-> Maybe Int
-> FunctionConfiguration)
-> Parser (Maybe Text)
-> Parser
(Maybe Bool
-> Maybe EncodingType -> Maybe Int -> FunctionConfiguration)
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
"Executable")
Parser
(Maybe Bool
-> Maybe EncodingType -> Maybe Int -> FunctionConfiguration)
-> Parser (Maybe Bool)
-> Parser
(Maybe EncodingType -> Maybe Int -> FunctionConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Pinned")
Parser (Maybe EncodingType -> Maybe Int -> FunctionConfiguration)
-> Parser (Maybe EncodingType)
-> Parser (Maybe Int -> FunctionConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EncodingType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EncodingType")
Parser (Maybe Int -> FunctionConfiguration)
-> Parser (Maybe Int) -> Parser FunctionConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Timeout")
)
instance Prelude.Hashable FunctionConfiguration
instance Prelude.NFData FunctionConfiguration
instance Core.ToJSON FunctionConfiguration where
toJSON :: FunctionConfiguration -> Value
toJSON FunctionConfiguration' {Maybe Bool
Maybe Int
Maybe Text
Maybe EncodingType
Maybe FunctionConfigurationEnvironment
timeout :: Maybe Int
encodingType :: Maybe EncodingType
pinned :: Maybe Bool
executable :: Maybe Text
environment :: Maybe FunctionConfigurationEnvironment
execArgs :: Maybe Text
memorySize :: Maybe Int
$sel:timeout:FunctionConfiguration' :: FunctionConfiguration -> Maybe Int
$sel:encodingType:FunctionConfiguration' :: FunctionConfiguration -> Maybe EncodingType
$sel:pinned:FunctionConfiguration' :: FunctionConfiguration -> Maybe Bool
$sel:executable:FunctionConfiguration' :: FunctionConfiguration -> Maybe Text
$sel:environment:FunctionConfiguration' :: FunctionConfiguration -> Maybe FunctionConfigurationEnvironment
$sel:execArgs:FunctionConfiguration' :: FunctionConfiguration -> Maybe Text
$sel:memorySize:FunctionConfiguration' :: FunctionConfiguration -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MemorySize" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
memorySize,
(Text
"ExecArgs" 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
execArgs,
(Text
"Environment" Text -> FunctionConfigurationEnvironment -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FunctionConfigurationEnvironment -> Pair)
-> Maybe FunctionConfigurationEnvironment -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FunctionConfigurationEnvironment
environment,
(Text
"Executable" 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
executable,
(Text
"Pinned" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
pinned,
(Text
"EncodingType" Text -> EncodingType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EncodingType -> Pair) -> Maybe EncodingType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncodingType
encodingType,
(Text
"Timeout" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
timeout
]
)