{-# 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.ECS.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.ECS.Types.LinuxParameters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECS.Types.Device
import Amazonka.ECS.Types.KernelCapabilities
import Amazonka.ECS.Types.Tmpfs
import qualified Amazonka.Prelude as Prelude

-- | Linux-specific options that are applied to the container, such as Linux
-- KernelCapabilities.
--
-- /See:/ 'newLinuxParameters' smart constructor.
data LinuxParameters = LinuxParameters'
  { -- | The Linux capabilities for the container that are added to or dropped
    -- from the default configuration provided by Docker.
    --
    -- For tasks that use the Fargate launch type, @capabilities@ is supported
    -- for all platform versions but the @add@ parameter is only supported if
    -- using platform version 1.4.0 or later.
    LinuxParameters -> Maybe KernelCapabilities
capabilities :: Prelude.Maybe KernelCapabilities,
    -- | Any host devices to expose to the container. This parameter maps to
    -- @Devices@ in the
    -- <https://docs.docker.com/engine/api/v1.35/#operation/ContainerCreate Create a container>
    -- section of the
    -- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
    -- @--device@ option to
    -- <https://docs.docker.com/engine/reference/run/#security-configuration docker run>.
    --
    -- If you\'re using tasks that use the Fargate launch type, the @devices@
    -- parameter isn\'t supported.
    LinuxParameters -> Maybe [Device]
devices :: Prelude.Maybe [Device],
    -- | 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/#security-configuration 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 --format \'{{.Server.APIVersion}}\'@
    LinuxParameters -> Maybe Bool
initProcessEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The total amount of swap memory (in MiB) a container can use. This
    -- parameter will be translated to the @--memory-swap@ option to
    -- <https://docs.docker.com/engine/reference/run/#security-configuration docker run>
    -- where the value would be the sum of the container memory plus the
    -- @maxSwap@ value.
    --
    -- If a @maxSwap@ value of @0@ is specified, the container will not use
    -- swap. Accepted values are @0@ or any positive integer. If the @maxSwap@
    -- parameter is omitted, the container will use the swap configuration for
    -- the container instance it is running on. A @maxSwap@ value must be set
    -- for the @swappiness@ parameter to be used.
    --
    -- If you\'re using tasks that use the Fargate launch type, the @maxSwap@
    -- parameter isn\'t supported.
    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/#security-configuration docker run>.
    --
    -- If you are using tasks that use the Fargate launch type, the
    -- @sharedMemorySize@ parameter is not supported.
    LinuxParameters -> Maybe Int
sharedMemorySize :: Prelude.Maybe Prelude.Int,
    -- | This allows you to tune a container\'s memory swappiness behavior. A
    -- @swappiness@ value of @0@ will cause swapping to not happen unless
    -- absolutely necessary. A @swappiness@ value of @100@ will cause pages to
    -- be swapped very aggressively. Accepted values are whole numbers between
    -- @0@ and @100@. If the @swappiness@ parameter is not specified, a default
    -- value of @60@ is used. If a value is not specified for @maxSwap@ then
    -- this parameter is ignored. This parameter maps to the
    -- @--memory-swappiness@ option to
    -- <https://docs.docker.com/engine/reference/run/#security-configuration docker run>.
    --
    -- If you\'re using tasks that use the Fargate launch type, the
    -- @swappiness@ parameter isn\'t supported.
    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/#security-configuration docker run>.
    --
    -- If you\'re using tasks that use the Fargate launch type, the @tmpfs@
    -- parameter isn\'t supported.
    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:
--
-- 'capabilities', 'linuxParameters_capabilities' - The Linux capabilities for the container that are added to or dropped
-- from the default configuration provided by Docker.
--
-- For tasks that use the Fargate launch type, @capabilities@ is supported
-- for all platform versions but the @add@ parameter is only supported if
-- using platform version 1.4.0 or later.
--
-- 'devices', 'linuxParameters_devices' - Any host devices to expose to the container. This parameter maps to
-- @Devices@ in the
-- <https://docs.docker.com/engine/api/v1.35/#operation/ContainerCreate Create a container>
-- section of the
-- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
-- @--device@ option to
-- <https://docs.docker.com/engine/reference/run/#security-configuration docker run>.
--
-- If you\'re using tasks that use the Fargate launch type, the @devices@
-- parameter isn\'t supported.
--
-- 'initProcessEnabled', 'linuxParameters_initProcessEnabled' - 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/#security-configuration 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 --format \'{{.Server.APIVersion}}\'@
--
-- 'maxSwap', 'linuxParameters_maxSwap' - The total amount of swap memory (in MiB) a container can use. This
-- parameter will be translated to the @--memory-swap@ option to
-- <https://docs.docker.com/engine/reference/run/#security-configuration docker run>
-- where the value would be the sum of the container memory plus the
-- @maxSwap@ value.
--
-- If a @maxSwap@ value of @0@ is specified, the container will not use
-- swap. Accepted values are @0@ or any positive integer. If the @maxSwap@
-- parameter is omitted, the container will use the swap configuration for
-- the container instance it is running on. A @maxSwap@ value must be set
-- for the @swappiness@ parameter to be used.
--
-- If you\'re using tasks that use the Fargate launch type, the @maxSwap@
-- parameter isn\'t supported.
--
-- '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/#security-configuration docker run>.
--
-- If you are using tasks that use the Fargate launch type, the
-- @sharedMemorySize@ parameter is not supported.
--
-- 'swappiness', 'linuxParameters_swappiness' - This allows you to tune a container\'s memory swappiness behavior. A
-- @swappiness@ value of @0@ will cause swapping to not happen unless
-- absolutely necessary. A @swappiness@ value of @100@ will cause pages to
-- be swapped very aggressively. Accepted values are whole numbers between
-- @0@ and @100@. If the @swappiness@ parameter is not specified, a default
-- value of @60@ is used. If a value is not specified for @maxSwap@ then
-- this parameter is ignored. This parameter maps to the
-- @--memory-swappiness@ option to
-- <https://docs.docker.com/engine/reference/run/#security-configuration docker run>.
--
-- If you\'re using tasks that use the Fargate launch type, the
-- @swappiness@ parameter isn\'t supported.
--
-- '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/#security-configuration docker run>.
--
-- If you\'re using tasks that use the Fargate launch type, the @tmpfs@
-- parameter isn\'t supported.
newLinuxParameters ::
  LinuxParameters
newLinuxParameters :: LinuxParameters
newLinuxParameters =
  LinuxParameters'
    { $sel:capabilities:LinuxParameters' :: Maybe KernelCapabilities
capabilities = forall a. Maybe a
Prelude.Nothing,
      $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
    }

-- | The Linux capabilities for the container that are added to or dropped
-- from the default configuration provided by Docker.
--
-- For tasks that use the Fargate launch type, @capabilities@ is supported
-- for all platform versions but the @add@ parameter is only supported if
-- using platform version 1.4.0 or later.
linuxParameters_capabilities :: Lens.Lens' LinuxParameters (Prelude.Maybe KernelCapabilities)
linuxParameters_capabilities :: Lens' LinuxParameters (Maybe KernelCapabilities)
linuxParameters_capabilities = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinuxParameters' {Maybe KernelCapabilities
capabilities :: Maybe KernelCapabilities
$sel:capabilities:LinuxParameters' :: LinuxParameters -> Maybe KernelCapabilities
capabilities} -> Maybe KernelCapabilities
capabilities) (\s :: LinuxParameters
s@LinuxParameters' {} Maybe KernelCapabilities
a -> LinuxParameters
s {$sel:capabilities:LinuxParameters' :: Maybe KernelCapabilities
capabilities = Maybe KernelCapabilities
a} :: LinuxParameters)

-- | Any host devices to expose to the container. This parameter maps to
-- @Devices@ in the
-- <https://docs.docker.com/engine/api/v1.35/#operation/ContainerCreate Create a container>
-- section of the
-- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
-- @--device@ option to
-- <https://docs.docker.com/engine/reference/run/#security-configuration docker run>.
--
-- If you\'re using tasks that use the Fargate launch type, the @devices@
-- parameter isn\'t supported.
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

-- | 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/#security-configuration 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 --format \'{{.Server.APIVersion}}\'@
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 will be translated to the @--memory-swap@ option to
-- <https://docs.docker.com/engine/reference/run/#security-configuration docker run>
-- where the value would be the sum of the container memory plus the
-- @maxSwap@ value.
--
-- If a @maxSwap@ value of @0@ is specified, the container will not use
-- swap. Accepted values are @0@ or any positive integer. If the @maxSwap@
-- parameter is omitted, the container will use the swap configuration for
-- the container instance it is running on. A @maxSwap@ value must be set
-- for the @swappiness@ parameter to be used.
--
-- If you\'re using tasks that use the Fargate launch type, the @maxSwap@
-- parameter isn\'t supported.
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/#security-configuration docker run>.
--
-- If you are using tasks that use the Fargate launch type, the
-- @sharedMemorySize@ parameter is not supported.
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)

-- | This allows you to tune a container\'s memory swappiness behavior. A
-- @swappiness@ value of @0@ will cause swapping to not happen unless
-- absolutely necessary. A @swappiness@ value of @100@ will cause pages to
-- be swapped very aggressively. Accepted values are whole numbers between
-- @0@ and @100@. If the @swappiness@ parameter is not specified, a default
-- value of @60@ is used. If a value is not specified for @maxSwap@ then
-- this parameter is ignored. This parameter maps to the
-- @--memory-swappiness@ option to
-- <https://docs.docker.com/engine/reference/run/#security-configuration docker run>.
--
-- If you\'re using tasks that use the Fargate launch type, the
-- @swappiness@ parameter isn\'t supported.
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/#security-configuration docker run>.
--
-- If you\'re using tasks that use the Fargate launch type, the @tmpfs@
-- parameter isn\'t supported.
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 KernelCapabilities
-> 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
"capabilities")
            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
"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]
Maybe KernelCapabilities
tmpfs :: Maybe [Tmpfs]
swappiness :: Maybe Int
sharedMemorySize :: Maybe Int
maxSwap :: Maybe Int
initProcessEnabled :: Maybe Bool
devices :: Maybe [Device]
capabilities :: Maybe KernelCapabilities
$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]
$sel:capabilities:LinuxParameters' :: LinuxParameters -> Maybe KernelCapabilities
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KernelCapabilities
capabilities
      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]
Maybe KernelCapabilities
tmpfs :: Maybe [Tmpfs]
swappiness :: Maybe Int
sharedMemorySize :: Maybe Int
maxSwap :: Maybe Int
initProcessEnabled :: Maybe Bool
devices :: Maybe [Device]
capabilities :: Maybe KernelCapabilities
$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]
$sel:capabilities:LinuxParameters' :: LinuxParameters -> Maybe KernelCapabilities
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe KernelCapabilities
capabilities
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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]
Maybe KernelCapabilities
tmpfs :: Maybe [Tmpfs]
swappiness :: Maybe Int
sharedMemorySize :: Maybe Int
maxSwap :: Maybe Int
initProcessEnabled :: Maybe Bool
devices :: Maybe [Device]
capabilities :: Maybe KernelCapabilities
$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]
$sel:capabilities:LinuxParameters' :: LinuxParameters -> Maybe KernelCapabilities
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"capabilities" 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 KernelCapabilities
capabilities,
            (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
          ]
      )