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