{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Batch.Types.LinuxParameters
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Linux-specific modifications that are applied to the container, such as
-- details for device mappings.
--
-- /See:/ 'newLinuxParameters' smart constructor.
data LinuxParameters = LinuxParameters'
  { -- | Any of the host devices to expose to the container. This parameter maps
    -- to @Devices@ in the
    -- <https://docs.docker.com/engine/api/v1.23/#create-a-container Create a container>
    -- section of the
    -- <https://docs.docker.com/engine/api/v1.23/ Docker Remote API> and the
    -- @--device@ option to
    -- <https://docs.docker.com/engine/reference/run/ docker run>.
    --
    -- This parameter isn\'t applicable to jobs that are running on Fargate
    -- resources. Don\'t provide it for these jobs.
    LinuxParameters -> Maybe [Device]
devices :: Prelude.Maybe [Device],
    -- | If true, run an @init@ process inside the container that forwards
    -- signals and reaps processes. This parameter maps to the @--init@ option
    -- to <https://docs.docker.com/engine/reference/run/ docker run>. This
    -- parameter requires version 1.25 of the Docker Remote API or greater on
    -- your container instance. To check the Docker Remote API version on your
    -- container instance, log in to your container instance and run the
    -- following command: @sudo docker version | grep \"Server API version\"@
    LinuxParameters -> Maybe Bool
initProcessEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The total amount of swap memory (in MiB) a container can use. This
    -- parameter is translated to the @--memory-swap@ option to
    -- <https://docs.docker.com/engine/reference/run/ docker run> where the
    -- value is the sum of the container memory plus the @maxSwap@ value. For
    -- more information, see
    -- <https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details --memory-swap details>
    -- in the Docker documentation.
    --
    -- If a @maxSwap@ value of @0@ is specified, the container doesn\'t use
    -- swap. Accepted values are @0@ or any positive integer. If the @maxSwap@
    -- parameter is omitted, the container doesn\'t use the swap configuration
    -- for the container instance that it\'s running on. A @maxSwap@ value must
    -- be set for the @swappiness@ parameter to be used.
    --
    -- This parameter isn\'t applicable to jobs that are running on Fargate
    -- resources. Don\'t provide it for these jobs.
    LinuxParameters -> Maybe Int
maxSwap :: Prelude.Maybe Prelude.Int,
    -- | The value for the size (in MiB) of the @\/dev\/shm@ volume. This
    -- parameter maps to the @--shm-size@ option to
    -- <https://docs.docker.com/engine/reference/run/ docker run>.
    --
    -- This parameter isn\'t applicable to jobs that are running on Fargate
    -- resources. Don\'t provide it for these jobs.
    LinuxParameters -> Maybe Int
sharedMemorySize :: Prelude.Maybe Prelude.Int,
    -- | You can use this parameter to tune a container\'s memory swappiness
    -- behavior. A @swappiness@ value of @0@ causes swapping to not occur
    -- unless absolutely necessary. A @swappiness@ value of @100@ causes pages
    -- to be swapped aggressively. Valid values are whole numbers between @0@
    -- and @100@. If the @swappiness@ parameter isn\'t specified, a default
    -- value of @60@ is used. If a value isn\'t specified for @maxSwap@, then
    -- this parameter is ignored. If @maxSwap@ is set to 0, the container
    -- doesn\'t use swap. This parameter maps to the @--memory-swappiness@
    -- option to <https://docs.docker.com/engine/reference/run/ docker run>.
    --
    -- Consider the following when you use a per-container swap configuration.
    --
    -- -   Swap space must be enabled and allocated on the container instance
    --     for the containers to use.
    --
    --     By default, the Amazon ECS optimized AMIs don\'t have swap enabled.
    --     You must enable swap on the instance to use this feature. For more
    --     information, see
    --     <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-store-swap-volumes.html Instance store swap volumes>
    --     in the /Amazon EC2 User Guide for Linux Instances/ or
    --     <http://aws.amazon.com/premiumsupport/knowledge-center/ec2-memory-swap-file/ How do I allocate memory to work as swap space in an Amazon EC2 instance by using a swap file?>
    --
    -- -   The swap space parameters are only supported for job definitions
    --     using EC2 resources.
    --
    -- -   If the @maxSwap@ and @swappiness@ parameters are omitted from a job
    --     definition, each container has a default @swappiness@ value of 60.
    --     Moreover, the total swap usage is limited to two times the memory
    --     reservation of the container.
    --
    -- This parameter isn\'t applicable to jobs that are running on Fargate
    -- resources. Don\'t provide it for these jobs.
    LinuxParameters -> Maybe Int
swappiness :: Prelude.Maybe Prelude.Int,
    -- | The container path, mount options, and size (in MiB) of the @tmpfs@
    -- mount. This parameter maps to the @--tmpfs@ option to
    -- <https://docs.docker.com/engine/reference/run/ docker run>.
    --
    -- This parameter isn\'t applicable to jobs that are running on Fargate
    -- resources. Don\'t provide this parameter for this resource type.
    LinuxParameters -> Maybe [Tmpfs]
tmpfs :: Prelude.Maybe [Tmpfs]
  }
  deriving (LinuxParameters -> LinuxParameters -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'LinuxParameters' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'devices', 'linuxParameters_devices' - Any of the host devices to expose to the container. This parameter maps
-- to @Devices@ in the
-- <https://docs.docker.com/engine/api/v1.23/#create-a-container Create a container>
-- section of the
-- <https://docs.docker.com/engine/api/v1.23/ Docker Remote API> and the
-- @--device@ option to
-- <https://docs.docker.com/engine/reference/run/ docker run>.
--
-- This parameter isn\'t applicable to jobs that are running on Fargate
-- resources. Don\'t provide it for these jobs.
--
-- 'initProcessEnabled', 'linuxParameters_initProcessEnabled' - If true, run an @init@ process inside the container that forwards
-- signals and reaps processes. This parameter maps to the @--init@ option
-- to <https://docs.docker.com/engine/reference/run/ docker run>. This
-- parameter requires version 1.25 of the Docker Remote API or greater on
-- your container instance. To check the Docker Remote API version on your
-- container instance, log in to your container instance and run the
-- following command: @sudo docker version | grep \"Server API version\"@
--
-- 'maxSwap', 'linuxParameters_maxSwap' - The total amount of swap memory (in MiB) a container can use. This
-- parameter is translated to the @--memory-swap@ option to
-- <https://docs.docker.com/engine/reference/run/ docker run> where the
-- value is the sum of the container memory plus the @maxSwap@ value. For
-- more information, see
-- <https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details --memory-swap details>
-- in the Docker documentation.
--
-- If a @maxSwap@ value of @0@ is specified, the container doesn\'t use
-- swap. Accepted values are @0@ or any positive integer. If the @maxSwap@
-- parameter is omitted, the container doesn\'t use the swap configuration
-- for the container instance that it\'s running on. A @maxSwap@ value must
-- be set for the @swappiness@ parameter to be used.
--
-- This parameter isn\'t applicable to jobs that are running on Fargate
-- resources. Don\'t provide it for these jobs.
--
-- 'sharedMemorySize', 'linuxParameters_sharedMemorySize' - The value for the size (in MiB) of the @\/dev\/shm@ volume. This
-- parameter maps to the @--shm-size@ option to
-- <https://docs.docker.com/engine/reference/run/ docker run>.
--
-- This parameter isn\'t applicable to jobs that are running on Fargate
-- resources. Don\'t provide it for these jobs.
--
-- 'swappiness', 'linuxParameters_swappiness' - You can use this parameter to tune a container\'s memory swappiness
-- behavior. A @swappiness@ value of @0@ causes swapping to not occur
-- unless absolutely necessary. A @swappiness@ value of @100@ causes pages
-- to be swapped aggressively. Valid values are whole numbers between @0@
-- and @100@. If the @swappiness@ parameter isn\'t specified, a default
-- value of @60@ is used. If a value isn\'t specified for @maxSwap@, then
-- this parameter is ignored. If @maxSwap@ is set to 0, the container
-- doesn\'t use swap. This parameter maps to the @--memory-swappiness@
-- option to <https://docs.docker.com/engine/reference/run/ docker run>.
--
-- Consider the following when you use a per-container swap configuration.
--
-- -   Swap space must be enabled and allocated on the container instance
--     for the containers to use.
--
--     By default, the Amazon ECS optimized AMIs don\'t have swap enabled.
--     You must enable swap on the instance to use this feature. For more
--     information, see
--     <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-store-swap-volumes.html Instance store swap volumes>
--     in the /Amazon EC2 User Guide for Linux Instances/ or
--     <http://aws.amazon.com/premiumsupport/knowledge-center/ec2-memory-swap-file/ How do I allocate memory to work as swap space in an Amazon EC2 instance by using a swap file?>
--
-- -   The swap space parameters are only supported for job definitions
--     using EC2 resources.
--
-- -   If the @maxSwap@ and @swappiness@ parameters are omitted from a job
--     definition, each container has a default @swappiness@ value of 60.
--     Moreover, the total swap usage is limited to two times the memory
--     reservation of the container.
--
-- This parameter isn\'t applicable to jobs that are running on Fargate
-- resources. Don\'t provide it for these jobs.
--
-- 'tmpfs', 'linuxParameters_tmpfs' - The container path, mount options, and size (in MiB) of the @tmpfs@
-- mount. This parameter maps to the @--tmpfs@ option to
-- <https://docs.docker.com/engine/reference/run/ docker run>.
--
-- This parameter isn\'t applicable to jobs that are running on Fargate
-- resources. Don\'t provide this parameter for this resource type.
newLinuxParameters ::
  LinuxParameters
newLinuxParameters :: LinuxParameters
newLinuxParameters =
  LinuxParameters'
    { $sel:devices:LinuxParameters' :: Maybe [Device]
devices = forall a. Maybe a
Prelude.Nothing,
      $sel:initProcessEnabled:LinuxParameters' :: Maybe Bool
initProcessEnabled = forall a. Maybe a
Prelude.Nothing,
      $sel:maxSwap:LinuxParameters' :: Maybe Int
maxSwap = forall a. Maybe a
Prelude.Nothing,
      $sel:sharedMemorySize:LinuxParameters' :: Maybe Int
sharedMemorySize = forall a. Maybe a
Prelude.Nothing,
      $sel:swappiness:LinuxParameters' :: Maybe Int
swappiness = forall a. Maybe a
Prelude.Nothing,
      $sel:tmpfs:LinuxParameters' :: Maybe [Tmpfs]
tmpfs = forall a. Maybe a
Prelude.Nothing
    }

-- | Any of the host devices to expose to the container. This parameter maps
-- to @Devices@ in the
-- <https://docs.docker.com/engine/api/v1.23/#create-a-container Create a container>
-- section of the
-- <https://docs.docker.com/engine/api/v1.23/ Docker Remote API> and the
-- @--device@ option to
-- <https://docs.docker.com/engine/reference/run/ docker run>.
--
-- This parameter isn\'t applicable to jobs that are running on Fargate
-- resources. Don\'t provide it for these jobs.
linuxParameters_devices :: Lens.Lens' LinuxParameters (Prelude.Maybe [Device])
linuxParameters_devices :: Lens' LinuxParameters (Maybe [Device])
linuxParameters_devices = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If true, run an @init@ process inside the container that forwards
-- signals and reaps processes. This parameter maps to the @--init@ option
-- to <https://docs.docker.com/engine/reference/run/ docker run>. This
-- parameter requires version 1.25 of the Docker Remote API or greater on
-- your container instance. To check the Docker Remote API version on your
-- container instance, log in to your container instance and run the
-- following command: @sudo docker version | grep \"Server API version\"@
linuxParameters_initProcessEnabled :: Lens.Lens' LinuxParameters (Prelude.Maybe Prelude.Bool)
linuxParameters_initProcessEnabled :: Lens' LinuxParameters (Maybe Bool)
linuxParameters_initProcessEnabled = 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)

-- | The total amount of swap memory (in MiB) a container can use. This
-- parameter is translated to the @--memory-swap@ option to
-- <https://docs.docker.com/engine/reference/run/ docker run> where the
-- value is the sum of the container memory plus the @maxSwap@ value. For
-- more information, see
-- <https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details --memory-swap details>
-- in the Docker documentation.
--
-- If a @maxSwap@ value of @0@ is specified, the container doesn\'t use
-- swap. Accepted values are @0@ or any positive integer. If the @maxSwap@
-- parameter is omitted, the container doesn\'t use the swap configuration
-- for the container instance that it\'s running on. A @maxSwap@ value must
-- be set for the @swappiness@ parameter to be used.
--
-- This parameter isn\'t applicable to jobs that are running on Fargate
-- resources. Don\'t provide it for these jobs.
linuxParameters_maxSwap :: Lens.Lens' LinuxParameters (Prelude.Maybe Prelude.Int)
linuxParameters_maxSwap :: Lens' LinuxParameters (Maybe Int)
linuxParameters_maxSwap = 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)

-- | The value for the size (in MiB) of the @\/dev\/shm@ volume. This
-- parameter maps to the @--shm-size@ option to
-- <https://docs.docker.com/engine/reference/run/ docker run>.
--
-- This parameter isn\'t applicable to jobs that are running on Fargate
-- resources. Don\'t provide it for these jobs.
linuxParameters_sharedMemorySize :: Lens.Lens' LinuxParameters (Prelude.Maybe Prelude.Int)
linuxParameters_sharedMemorySize :: Lens' LinuxParameters (Maybe Int)
linuxParameters_sharedMemorySize = 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)

-- | You can use this parameter to tune a container\'s memory swappiness
-- behavior. A @swappiness@ value of @0@ causes swapping to not occur
-- unless absolutely necessary. A @swappiness@ value of @100@ causes pages
-- to be swapped aggressively. Valid values are whole numbers between @0@
-- and @100@. If the @swappiness@ parameter isn\'t specified, a default
-- value of @60@ is used. If a value isn\'t specified for @maxSwap@, then
-- this parameter is ignored. If @maxSwap@ is set to 0, the container
-- doesn\'t use swap. This parameter maps to the @--memory-swappiness@
-- option to <https://docs.docker.com/engine/reference/run/ docker run>.
--
-- Consider the following when you use a per-container swap configuration.
--
-- -   Swap space must be enabled and allocated on the container instance
--     for the containers to use.
--
--     By default, the Amazon ECS optimized AMIs don\'t have swap enabled.
--     You must enable swap on the instance to use this feature. For more
--     information, see
--     <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-store-swap-volumes.html Instance store swap volumes>
--     in the /Amazon EC2 User Guide for Linux Instances/ or
--     <http://aws.amazon.com/premiumsupport/knowledge-center/ec2-memory-swap-file/ How do I allocate memory to work as swap space in an Amazon EC2 instance by using a swap file?>
--
-- -   The swap space parameters are only supported for job definitions
--     using EC2 resources.
--
-- -   If the @maxSwap@ and @swappiness@ parameters are omitted from a job
--     definition, each container has a default @swappiness@ value of 60.
--     Moreover, the total swap usage is limited to two times the memory
--     reservation of the container.
--
-- This parameter isn\'t applicable to jobs that are running on Fargate
-- resources. Don\'t provide it for these jobs.
linuxParameters_swappiness :: Lens.Lens' LinuxParameters (Prelude.Maybe Prelude.Int)
linuxParameters_swappiness :: Lens' LinuxParameters (Maybe Int)
linuxParameters_swappiness = 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)

-- | The container path, mount options, and size (in MiB) of the @tmpfs@
-- mount. This parameter maps to the @--tmpfs@ option to
-- <https://docs.docker.com/engine/reference/run/ docker run>.
--
-- This parameter isn\'t applicable to jobs that are running on Fargate
-- resources. Don\'t provide this parameter for this resource type.
linuxParameters_tmpfs :: Lens.Lens' LinuxParameters (Prelude.Maybe [Tmpfs])
linuxParameters_tmpfs :: Lens' LinuxParameters (Maybe [Tmpfs])
linuxParameters_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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON LinuxParameters where
  parseJSON :: Value -> Parser LinuxParameters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LinuxParameters"
      ( \Object
x ->
          Maybe [Device]
-> Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe [Tmpfs]
-> LinuxParameters
LinuxParameters'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"devices" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"initProcessEnabled")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"maxSwap")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"sharedMemorySize")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"swappiness")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"tmpfs" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable LinuxParameters where
  hashWithSalt :: Int -> LinuxParameters -> Int
hashWithSalt Int
_salt LinuxParameters' {Maybe Bool
Maybe Int
Maybe [Device]
Maybe [Tmpfs]
tmpfs :: Maybe [Tmpfs]
swappiness :: Maybe Int
sharedMemorySize :: Maybe Int
maxSwap :: Maybe Int
initProcessEnabled :: Maybe Bool
devices :: Maybe [Device]
$sel:tmpfs:LinuxParameters' :: LinuxParameters -> Maybe [Tmpfs]
$sel:swappiness:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:sharedMemorySize:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:maxSwap:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:initProcessEnabled:LinuxParameters' :: LinuxParameters -> Maybe Bool
$sel:devices:LinuxParameters' :: LinuxParameters -> Maybe [Device]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Device]
devices
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
initProcessEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxSwap
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
sharedMemorySize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
swappiness
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tmpfs]
tmpfs

instance Prelude.NFData LinuxParameters where
  rnf :: LinuxParameters -> ()
rnf LinuxParameters' {Maybe Bool
Maybe Int
Maybe [Device]
Maybe [Tmpfs]
tmpfs :: Maybe [Tmpfs]
swappiness :: Maybe Int
sharedMemorySize :: Maybe Int
maxSwap :: Maybe Int
initProcessEnabled :: Maybe Bool
devices :: Maybe [Device]
$sel:tmpfs:LinuxParameters' :: LinuxParameters -> Maybe [Tmpfs]
$sel:swappiness:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:sharedMemorySize:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:maxSwap:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:initProcessEnabled:LinuxParameters' :: LinuxParameters -> Maybe Bool
$sel:devices:LinuxParameters' :: LinuxParameters -> Maybe [Device]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Device]
devices
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
initProcessEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxSwap
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
sharedMemorySize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
swappiness
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tmpfs]
tmpfs

instance Data.ToJSON LinuxParameters where
  toJSON :: LinuxParameters -> Value
toJSON LinuxParameters' {Maybe Bool
Maybe Int
Maybe [Device]
Maybe [Tmpfs]
tmpfs :: Maybe [Tmpfs]
swappiness :: Maybe Int
sharedMemorySize :: Maybe Int
maxSwap :: Maybe Int
initProcessEnabled :: Maybe Bool
devices :: Maybe [Device]
$sel:tmpfs:LinuxParameters' :: LinuxParameters -> Maybe [Tmpfs]
$sel:swappiness:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:sharedMemorySize:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:maxSwap:LinuxParameters' :: LinuxParameters -> Maybe Int
$sel:initProcessEnabled:LinuxParameters' :: LinuxParameters -> Maybe Bool
$sel:devices:LinuxParameters' :: LinuxParameters -> Maybe [Device]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"devices" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Device]
devices,
            (Key
"initProcessEnabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
initProcessEnabled,
            (Key
"maxSwap" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxSwap,
            (Key
"sharedMemorySize" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
sharedMemorySize,
            (Key
"swappiness" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
swappiness,
            (Key
"tmpfs" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tmpfs]
tmpfs
          ]
      )