{-# 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.FunctionRunAsConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FunctionRunAsConfig = FunctionRunAsConfig'
{
FunctionRunAsConfig -> Maybe Int
uid :: Prelude.Maybe Prelude.Int,
FunctionRunAsConfig -> Maybe Int
gid :: Prelude.Maybe Prelude.Int
}
deriving (FunctionRunAsConfig -> FunctionRunAsConfig -> Bool
(FunctionRunAsConfig -> FunctionRunAsConfig -> Bool)
-> (FunctionRunAsConfig -> FunctionRunAsConfig -> Bool)
-> Eq FunctionRunAsConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionRunAsConfig -> FunctionRunAsConfig -> Bool
$c/= :: FunctionRunAsConfig -> FunctionRunAsConfig -> Bool
== :: FunctionRunAsConfig -> FunctionRunAsConfig -> Bool
$c== :: FunctionRunAsConfig -> FunctionRunAsConfig -> Bool
Prelude.Eq, ReadPrec [FunctionRunAsConfig]
ReadPrec FunctionRunAsConfig
Int -> ReadS FunctionRunAsConfig
ReadS [FunctionRunAsConfig]
(Int -> ReadS FunctionRunAsConfig)
-> ReadS [FunctionRunAsConfig]
-> ReadPrec FunctionRunAsConfig
-> ReadPrec [FunctionRunAsConfig]
-> Read FunctionRunAsConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FunctionRunAsConfig]
$creadListPrec :: ReadPrec [FunctionRunAsConfig]
readPrec :: ReadPrec FunctionRunAsConfig
$creadPrec :: ReadPrec FunctionRunAsConfig
readList :: ReadS [FunctionRunAsConfig]
$creadList :: ReadS [FunctionRunAsConfig]
readsPrec :: Int -> ReadS FunctionRunAsConfig
$creadsPrec :: Int -> ReadS FunctionRunAsConfig
Prelude.Read, Int -> FunctionRunAsConfig -> ShowS
[FunctionRunAsConfig] -> ShowS
FunctionRunAsConfig -> String
(Int -> FunctionRunAsConfig -> ShowS)
-> (FunctionRunAsConfig -> String)
-> ([FunctionRunAsConfig] -> ShowS)
-> Show FunctionRunAsConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionRunAsConfig] -> ShowS
$cshowList :: [FunctionRunAsConfig] -> ShowS
show :: FunctionRunAsConfig -> String
$cshow :: FunctionRunAsConfig -> String
showsPrec :: Int -> FunctionRunAsConfig -> ShowS
$cshowsPrec :: Int -> FunctionRunAsConfig -> ShowS
Prelude.Show, (forall x. FunctionRunAsConfig -> Rep FunctionRunAsConfig x)
-> (forall x. Rep FunctionRunAsConfig x -> FunctionRunAsConfig)
-> Generic FunctionRunAsConfig
forall x. Rep FunctionRunAsConfig x -> FunctionRunAsConfig
forall x. FunctionRunAsConfig -> Rep FunctionRunAsConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FunctionRunAsConfig x -> FunctionRunAsConfig
$cfrom :: forall x. FunctionRunAsConfig -> Rep FunctionRunAsConfig x
Prelude.Generic)
newFunctionRunAsConfig ::
FunctionRunAsConfig
newFunctionRunAsConfig :: FunctionRunAsConfig
newFunctionRunAsConfig =
FunctionRunAsConfig' :: Maybe Int -> Maybe Int -> FunctionRunAsConfig
FunctionRunAsConfig'
{ $sel:uid:FunctionRunAsConfig' :: Maybe Int
uid = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:gid:FunctionRunAsConfig' :: Maybe Int
gid = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
functionRunAsConfig_uid :: Lens.Lens' FunctionRunAsConfig (Prelude.Maybe Prelude.Int)
functionRunAsConfig_uid :: (Maybe Int -> f (Maybe Int))
-> FunctionRunAsConfig -> f FunctionRunAsConfig
functionRunAsConfig_uid = (FunctionRunAsConfig -> Maybe Int)
-> (FunctionRunAsConfig -> Maybe Int -> FunctionRunAsConfig)
-> Lens
FunctionRunAsConfig FunctionRunAsConfig (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionRunAsConfig' {Maybe Int
uid :: Maybe Int
$sel:uid:FunctionRunAsConfig' :: FunctionRunAsConfig -> Maybe Int
uid} -> Maybe Int
uid) (\s :: FunctionRunAsConfig
s@FunctionRunAsConfig' {} Maybe Int
a -> FunctionRunAsConfig
s {$sel:uid:FunctionRunAsConfig' :: Maybe Int
uid = Maybe Int
a} :: FunctionRunAsConfig)
functionRunAsConfig_gid :: Lens.Lens' FunctionRunAsConfig (Prelude.Maybe Prelude.Int)
functionRunAsConfig_gid :: (Maybe Int -> f (Maybe Int))
-> FunctionRunAsConfig -> f FunctionRunAsConfig
functionRunAsConfig_gid = (FunctionRunAsConfig -> Maybe Int)
-> (FunctionRunAsConfig -> Maybe Int -> FunctionRunAsConfig)
-> Lens
FunctionRunAsConfig FunctionRunAsConfig (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionRunAsConfig' {Maybe Int
gid :: Maybe Int
$sel:gid:FunctionRunAsConfig' :: FunctionRunAsConfig -> Maybe Int
gid} -> Maybe Int
gid) (\s :: FunctionRunAsConfig
s@FunctionRunAsConfig' {} Maybe Int
a -> FunctionRunAsConfig
s {$sel:gid:FunctionRunAsConfig' :: Maybe Int
gid = Maybe Int
a} :: FunctionRunAsConfig)
instance Core.FromJSON FunctionRunAsConfig where
parseJSON :: Value -> Parser FunctionRunAsConfig
parseJSON =
String
-> (Object -> Parser FunctionRunAsConfig)
-> Value
-> Parser FunctionRunAsConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FunctionRunAsConfig"
( \Object
x ->
Maybe Int -> Maybe Int -> FunctionRunAsConfig
FunctionRunAsConfig'
(Maybe Int -> Maybe Int -> FunctionRunAsConfig)
-> Parser (Maybe Int) -> Parser (Maybe Int -> FunctionRunAsConfig)
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
"Uid") Parser (Maybe Int -> FunctionRunAsConfig)
-> Parser (Maybe Int) -> Parser FunctionRunAsConfig
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
"Gid")
)
instance Prelude.Hashable FunctionRunAsConfig
instance Prelude.NFData FunctionRunAsConfig
instance Core.ToJSON FunctionRunAsConfig where
toJSON :: FunctionRunAsConfig -> Value
toJSON FunctionRunAsConfig' {Maybe Int
gid :: Maybe Int
uid :: Maybe Int
$sel:gid:FunctionRunAsConfig' :: FunctionRunAsConfig -> Maybe Int
$sel:uid:FunctionRunAsConfig' :: FunctionRunAsConfig -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Uid" 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
uid,
(Text
"Gid" 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
gid
]
)