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