{-# 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.Batch.Types.LinuxParameters where
import Amazonka.Batch.Types.Device
import Amazonka.Batch.Types.Tmpfs
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LinuxParameters = LinuxParameters'
{
LinuxParameters -> Maybe Int
sharedMemorySize :: Prelude.Maybe Prelude.Int,
LinuxParameters -> Maybe Bool
initProcessEnabled :: Prelude.Maybe Prelude.Bool,
LinuxParameters -> Maybe [Tmpfs]
tmpfs :: Prelude.Maybe [Tmpfs],
LinuxParameters -> Maybe Int
swappiness :: Prelude.Maybe Prelude.Int,
LinuxParameters -> Maybe [Device]
devices :: Prelude.Maybe [Device],
LinuxParameters -> Maybe Int
maxSwap :: Prelude.Maybe Prelude.Int
}
deriving (LinuxParameters -> LinuxParameters -> Bool
(LinuxParameters -> LinuxParameters -> Bool)
-> (LinuxParameters -> LinuxParameters -> Bool)
-> Eq LinuxParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LinuxParameters -> LinuxParameters -> Bool
$c/= :: LinuxParameters -> LinuxParameters -> Bool
== :: LinuxParameters -> LinuxParameters -> Bool
$c== :: LinuxParameters -> LinuxParameters -> Bool
Prelude.Eq, ReadPrec [LinuxParameters]
ReadPrec LinuxParameters
Int -> ReadS LinuxParameters
ReadS [LinuxParameters]
(Int -> ReadS LinuxParameters)
-> ReadS [LinuxParameters]
-> ReadPrec LinuxParameters
-> ReadPrec [LinuxParameters]
-> Read LinuxParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LinuxParameters]
$creadListPrec :: ReadPrec [LinuxParameters]
readPrec :: ReadPrec LinuxParameters
$creadPrec :: ReadPrec LinuxParameters
readList :: ReadS [LinuxParameters]
$creadList :: ReadS [LinuxParameters]
readsPrec :: Int -> ReadS LinuxParameters
$creadsPrec :: Int -> ReadS LinuxParameters
Prelude.Read, Int -> LinuxParameters -> ShowS
[LinuxParameters] -> ShowS
LinuxParameters -> String
(Int -> LinuxParameters -> ShowS)
-> (LinuxParameters -> String)
-> ([LinuxParameters] -> ShowS)
-> Show LinuxParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LinuxParameters] -> ShowS
$cshowList :: [LinuxParameters] -> ShowS
show :: LinuxParameters -> String
$cshow :: LinuxParameters -> String
showsPrec :: Int -> LinuxParameters -> ShowS
$cshowsPrec :: Int -> LinuxParameters -> ShowS
Prelude.Show, (forall x. LinuxParameters -> Rep LinuxParameters x)
-> (forall x. Rep LinuxParameters x -> LinuxParameters)
-> Generic LinuxParameters
forall x. Rep LinuxParameters x -> LinuxParameters
forall x. LinuxParameters -> Rep LinuxParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LinuxParameters x -> LinuxParameters
$cfrom :: forall x. LinuxParameters -> Rep LinuxParameters x
Prelude.Generic)
newLinuxParameters ::
LinuxParameters
newLinuxParameters :: LinuxParameters
newLinuxParameters =
LinuxParameters' :: Maybe Int
-> Maybe Bool
-> Maybe [Tmpfs]
-> Maybe Int
-> Maybe [Device]
-> Maybe Int
-> LinuxParameters
LinuxParameters'
{ $sel:sharedMemorySize:LinuxParameters' :: Maybe Int
sharedMemorySize =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:initProcessEnabled:LinuxParameters' :: Maybe Bool
initProcessEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:tmpfs:LinuxParameters' :: Maybe [Tmpfs]
tmpfs = Maybe [Tmpfs]
forall a. Maybe a
Prelude.Nothing,
$sel:swappiness:LinuxParameters' :: Maybe Int
swappiness = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:devices:LinuxParameters' :: Maybe [Device]
devices = Maybe [Device]
forall a. Maybe a
Prelude.Nothing,
$sel:maxSwap:LinuxParameters' :: Maybe Int
maxSwap = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
linuxParameters_sharedMemorySize :: Lens.Lens' LinuxParameters (Prelude.Maybe Prelude.Int)
linuxParameters_sharedMemorySize :: (Maybe Int -> f (Maybe Int))
-> LinuxParameters -> f LinuxParameters
linuxParameters_sharedMemorySize = (LinuxParameters -> Maybe Int)
-> (LinuxParameters -> Maybe Int -> LinuxParameters)
-> Lens LinuxParameters LinuxParameters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinuxParameters' {Maybe Int
sharedMemorySize :: Maybe Int
$sel:sharedMemorySize:LinuxParameters' :: LinuxParameters -> Maybe Int
sharedMemorySize} -> Maybe Int
sharedMemorySize) (\s :: LinuxParameters
s@LinuxParameters' {} Maybe Int
a -> LinuxParameters
s {$sel:sharedMemorySize:LinuxParameters' :: Maybe Int
sharedMemorySize = Maybe Int
a} :: LinuxParameters)
linuxParameters_initProcessEnabled :: Lens.Lens' LinuxParameters (Prelude.Maybe Prelude.Bool)
linuxParameters_initProcessEnabled :: (Maybe Bool -> f (Maybe Bool))
-> LinuxParameters -> f LinuxParameters
linuxParameters_initProcessEnabled = (LinuxParameters -> Maybe Bool)
-> (LinuxParameters -> Maybe Bool -> LinuxParameters)
-> Lens LinuxParameters LinuxParameters (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinuxParameters' {Maybe Bool
initProcessEnabled :: Maybe Bool
$sel:initProcessEnabled:LinuxParameters' :: LinuxParameters -> Maybe Bool
initProcessEnabled} -> Maybe Bool
initProcessEnabled) (\s :: LinuxParameters
s@LinuxParameters' {} Maybe Bool
a -> LinuxParameters
s {$sel:initProcessEnabled:LinuxParameters' :: Maybe Bool
initProcessEnabled = Maybe Bool
a} :: LinuxParameters)
linuxParameters_tmpfs :: Lens.Lens' LinuxParameters (Prelude.Maybe [Tmpfs])
linuxParameters_tmpfs :: (Maybe [Tmpfs] -> f (Maybe [Tmpfs]))
-> LinuxParameters -> f LinuxParameters
linuxParameters_tmpfs = (LinuxParameters -> Maybe [Tmpfs])
-> (LinuxParameters -> Maybe [Tmpfs] -> LinuxParameters)
-> Lens
LinuxParameters LinuxParameters (Maybe [Tmpfs]) (Maybe [Tmpfs])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinuxParameters' {Maybe [Tmpfs]
tmpfs :: Maybe [Tmpfs]
$sel:tmpfs:LinuxParameters' :: LinuxParameters -> Maybe [Tmpfs]
tmpfs} -> Maybe [Tmpfs]
tmpfs) (\s :: LinuxParameters
s@LinuxParameters' {} Maybe [Tmpfs]
a -> LinuxParameters
s {$sel:tmpfs:LinuxParameters' :: Maybe [Tmpfs]
tmpfs = Maybe [Tmpfs]
a} :: LinuxParameters) ((Maybe [Tmpfs] -> f (Maybe [Tmpfs]))
-> LinuxParameters -> f LinuxParameters)
-> ((Maybe [Tmpfs] -> f (Maybe [Tmpfs]))
-> Maybe [Tmpfs] -> f (Maybe [Tmpfs]))
-> (Maybe [Tmpfs] -> f (Maybe [Tmpfs]))
-> LinuxParameters
-> f LinuxParameters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tmpfs] [Tmpfs] [Tmpfs] [Tmpfs]
-> Iso
(Maybe [Tmpfs]) (Maybe [Tmpfs]) (Maybe [Tmpfs]) (Maybe [Tmpfs])
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 [Tmpfs] [Tmpfs] [Tmpfs] [Tmpfs]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
linuxParameters_swappiness :: Lens.Lens' LinuxParameters (Prelude.Maybe Prelude.Int)
linuxParameters_swappiness :: (Maybe Int -> f (Maybe Int))
-> LinuxParameters -> f LinuxParameters
linuxParameters_swappiness = (LinuxParameters -> Maybe Int)
-> (LinuxParameters -> Maybe Int -> LinuxParameters)
-> Lens LinuxParameters LinuxParameters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinuxParameters' {Maybe Int
swappiness :: Maybe Int
$sel:swappiness:LinuxParameters' :: LinuxParameters -> Maybe Int
swappiness} -> Maybe Int
swappiness) (\s :: LinuxParameters
s@LinuxParameters' {} Maybe Int
a -> LinuxParameters
s {$sel:swappiness:LinuxParameters' :: Maybe Int
swappiness = Maybe Int
a} :: LinuxParameters)
linuxParameters_devices :: Lens.Lens' LinuxParameters (Prelude.Maybe [Device])
linuxParameters_devices :: (Maybe [Device] -> f (Maybe [Device]))
-> LinuxParameters -> f LinuxParameters
linuxParameters_devices = (LinuxParameters -> Maybe [Device])
-> (LinuxParameters -> Maybe [Device] -> LinuxParameters)
-> Lens
LinuxParameters LinuxParameters (Maybe [Device]) (Maybe [Device])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinuxParameters' {Maybe [Device]
devices :: Maybe [Device]
$sel:devices:LinuxParameters' :: LinuxParameters -> Maybe [Device]
devices} -> Maybe [Device]
devices) (\s :: LinuxParameters
s@LinuxParameters' {} Maybe [Device]
a -> LinuxParameters
s {$sel:devices:LinuxParameters' :: Maybe [Device]
devices = Maybe [Device]
a} :: LinuxParameters) ((Maybe [Device] -> f (Maybe [Device]))
-> LinuxParameters -> f LinuxParameters)
-> ((Maybe [Device] -> f (Maybe [Device]))
-> Maybe [Device] -> f (Maybe [Device]))
-> (Maybe [Device] -> f (Maybe [Device]))
-> LinuxParameters
-> f LinuxParameters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Device] [Device] [Device] [Device]
-> Iso
(Maybe [Device]) (Maybe [Device]) (Maybe [Device]) (Maybe [Device])
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 [Device] [Device] [Device] [Device]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
linuxParameters_maxSwap :: Lens.Lens' LinuxParameters (Prelude.Maybe Prelude.Int)
linuxParameters_maxSwap :: (Maybe Int -> f (Maybe Int))
-> LinuxParameters -> f LinuxParameters
linuxParameters_maxSwap = (LinuxParameters -> Maybe Int)
-> (LinuxParameters -> Maybe Int -> LinuxParameters)
-> Lens LinuxParameters LinuxParameters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinuxParameters' {Maybe Int
maxSwap :: Maybe Int
$sel:maxSwap:LinuxParameters' :: LinuxParameters -> Maybe Int
maxSwap} -> Maybe Int
maxSwap) (\s :: LinuxParameters
s@LinuxParameters' {} Maybe Int
a -> LinuxParameters
s {$sel:maxSwap:LinuxParameters' :: Maybe Int
maxSwap = Maybe Int
a} :: LinuxParameters)
instance Core.FromJSON LinuxParameters where
parseJSON :: Value -> Parser LinuxParameters
parseJSON =
String
-> (Object -> Parser LinuxParameters)
-> Value
-> Parser LinuxParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LinuxParameters"
( \Object
x ->
Maybe Int
-> Maybe Bool
-> Maybe [Tmpfs]
-> Maybe Int
-> Maybe [Device]
-> Maybe Int
-> LinuxParameters
LinuxParameters'
(Maybe Int
-> Maybe Bool
-> Maybe [Tmpfs]
-> Maybe Int
-> Maybe [Device]
-> Maybe Int
-> LinuxParameters)
-> Parser (Maybe Int)
-> Parser
(Maybe Bool
-> Maybe [Tmpfs]
-> Maybe Int
-> Maybe [Device]
-> Maybe Int
-> LinuxParameters)
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
"sharedMemorySize")
Parser
(Maybe Bool
-> Maybe [Tmpfs]
-> Maybe Int
-> Maybe [Device]
-> Maybe Int
-> LinuxParameters)
-> Parser (Maybe Bool)
-> Parser
(Maybe [Tmpfs]
-> Maybe Int -> Maybe [Device] -> Maybe Int -> LinuxParameters)
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
"initProcessEnabled")
Parser
(Maybe [Tmpfs]
-> Maybe Int -> Maybe [Device] -> Maybe Int -> LinuxParameters)
-> Parser (Maybe [Tmpfs])
-> Parser
(Maybe Int -> Maybe [Device] -> Maybe Int -> LinuxParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Tmpfs]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tmpfs" Parser (Maybe (Maybe [Tmpfs]))
-> Maybe [Tmpfs] -> Parser (Maybe [Tmpfs])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Tmpfs]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Int -> Maybe [Device] -> Maybe Int -> LinuxParameters)
-> Parser (Maybe Int)
-> Parser (Maybe [Device] -> Maybe Int -> LinuxParameters)
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
"swappiness")
Parser (Maybe [Device] -> Maybe Int -> LinuxParameters)
-> Parser (Maybe [Device]) -> Parser (Maybe Int -> LinuxParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Device]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"devices" Parser (Maybe (Maybe [Device]))
-> Maybe [Device] -> Parser (Maybe [Device])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Device]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Int -> LinuxParameters)
-> Parser (Maybe Int) -> Parser LinuxParameters
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
"maxSwap")
)
instance Prelude.Hashable LinuxParameters
instance Prelude.NFData LinuxParameters
instance Core.ToJSON LinuxParameters where
toJSON :: LinuxParameters -> Value
toJSON LinuxParameters' {Maybe Bool
Maybe Int
Maybe [Device]
Maybe [Tmpfs]
maxSwap :: Maybe Int
devices :: Maybe [Device]
swappiness :: Maybe Int
tmpfs :: Maybe [Tmpfs]
initProcessEnabled :: Maybe Bool
sharedMemorySize :: Maybe Int
$sel:maxSwap:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:devices:LinuxParameters' :: LinuxParameters -> Maybe [Device]
$sel:swappiness:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:tmpfs:LinuxParameters' :: LinuxParameters -> Maybe [Tmpfs]
$sel:initProcessEnabled:LinuxParameters' :: LinuxParameters -> Maybe Bool
$sel:sharedMemorySize:LinuxParameters' :: LinuxParameters -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"sharedMemorySize" 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
sharedMemorySize,
(Text
"initProcessEnabled" 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
initProcessEnabled,
(Text
"tmpfs" Text -> [Tmpfs] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tmpfs] -> Pair) -> Maybe [Tmpfs] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tmpfs]
tmpfs,
(Text
"swappiness" 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
swappiness,
(Text
"devices" Text -> [Device] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Device] -> Pair) -> Maybe [Device] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Device]
devices,
(Text
"maxSwap" 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
maxSwap
]
)