{-# 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.ContainerOverride
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ECS.Types.ContainerOverride where

import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.EnvironmentFile
import Amazonka.ECS.Types.KeyValuePair
import Amazonka.ECS.Types.ResourceRequirement
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The overrides that should be sent to a container. An empty container
-- override can be passed in. An example of an empty container override
-- would be @{\"containerOverrides\": [ ] }@. If a non-empty container
-- override is specified, the @name@ parameter must be included.
--
-- /See:/ 'newContainerOverride' smart constructor.
data ContainerOverride = ContainerOverride'
  { -- | The command to send to the container that overrides the default command
    -- from the Docker image or the task definition. You must also specify a
    -- container name.
    ContainerOverride -> Maybe [Text]
command :: Prelude.Maybe [Prelude.Text],
    -- | The environment variables to send to the container. You can add new
    -- environment variables, which are added to the container at launch, or
    -- you can override the existing environment variables from the Docker
    -- image or the task definition. You must also specify a container name.
    ContainerOverride -> Maybe [KeyValuePair]
environment :: Prelude.Maybe [KeyValuePair],
    -- | A list of files containing the environment variables to pass to a
    -- container, instead of the value from the container definition.
    ContainerOverride -> Maybe [EnvironmentFile]
environmentFiles :: Prelude.Maybe [EnvironmentFile],
    -- | The type and amount of a resource to assign to a container, instead of
    -- the default value from the task definition. The only supported resource
    -- is a GPU.
    ContainerOverride -> Maybe [ResourceRequirement]
resourceRequirements :: Prelude.Maybe [ResourceRequirement],
    -- | The hard limit (in MiB) of memory to present to the container, instead
    -- of the default value from the task definition. If your container
    -- attempts to exceed the memory specified here, the container is killed.
    -- You must also specify a container name.
    ContainerOverride -> Maybe Int
memory :: Prelude.Maybe Prelude.Int,
    -- | The name of the container that receives the override. This parameter is
    -- required if any override is specified.
    ContainerOverride -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The number of @cpu@ units reserved for the container, instead of the
    -- default value from the task definition. You must also specify a
    -- container name.
    ContainerOverride -> Maybe Int
cpu :: Prelude.Maybe Prelude.Int,
    -- | The soft limit (in MiB) of memory to reserve for the container, instead
    -- of the default value from the task definition. You must also specify a
    -- container name.
    ContainerOverride -> Maybe Int
memoryReservation :: Prelude.Maybe Prelude.Int
  }
  deriving (ContainerOverride -> ContainerOverride -> Bool
(ContainerOverride -> ContainerOverride -> Bool)
-> (ContainerOverride -> ContainerOverride -> Bool)
-> Eq ContainerOverride
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerOverride -> ContainerOverride -> Bool
$c/= :: ContainerOverride -> ContainerOverride -> Bool
== :: ContainerOverride -> ContainerOverride -> Bool
$c== :: ContainerOverride -> ContainerOverride -> Bool
Prelude.Eq, ReadPrec [ContainerOverride]
ReadPrec ContainerOverride
Int -> ReadS ContainerOverride
ReadS [ContainerOverride]
(Int -> ReadS ContainerOverride)
-> ReadS [ContainerOverride]
-> ReadPrec ContainerOverride
-> ReadPrec [ContainerOverride]
-> Read ContainerOverride
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerOverride]
$creadListPrec :: ReadPrec [ContainerOverride]
readPrec :: ReadPrec ContainerOverride
$creadPrec :: ReadPrec ContainerOverride
readList :: ReadS [ContainerOverride]
$creadList :: ReadS [ContainerOverride]
readsPrec :: Int -> ReadS ContainerOverride
$creadsPrec :: Int -> ReadS ContainerOverride
Prelude.Read, Int -> ContainerOverride -> ShowS
[ContainerOverride] -> ShowS
ContainerOverride -> String
(Int -> ContainerOverride -> ShowS)
-> (ContainerOverride -> String)
-> ([ContainerOverride] -> ShowS)
-> Show ContainerOverride
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerOverride] -> ShowS
$cshowList :: [ContainerOverride] -> ShowS
show :: ContainerOverride -> String
$cshow :: ContainerOverride -> String
showsPrec :: Int -> ContainerOverride -> ShowS
$cshowsPrec :: Int -> ContainerOverride -> ShowS
Prelude.Show, (forall x. ContainerOverride -> Rep ContainerOverride x)
-> (forall x. Rep ContainerOverride x -> ContainerOverride)
-> Generic ContainerOverride
forall x. Rep ContainerOverride x -> ContainerOverride
forall x. ContainerOverride -> Rep ContainerOverride x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContainerOverride x -> ContainerOverride
$cfrom :: forall x. ContainerOverride -> Rep ContainerOverride x
Prelude.Generic)

-- |
-- Create a value of 'ContainerOverride' 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:
--
-- 'command', 'containerOverride_command' - The command to send to the container that overrides the default command
-- from the Docker image or the task definition. You must also specify a
-- container name.
--
-- 'environment', 'containerOverride_environment' - The environment variables to send to the container. You can add new
-- environment variables, which are added to the container at launch, or
-- you can override the existing environment variables from the Docker
-- image or the task definition. You must also specify a container name.
--
-- 'environmentFiles', 'containerOverride_environmentFiles' - A list of files containing the environment variables to pass to a
-- container, instead of the value from the container definition.
--
-- 'resourceRequirements', 'containerOverride_resourceRequirements' - The type and amount of a resource to assign to a container, instead of
-- the default value from the task definition. The only supported resource
-- is a GPU.
--
-- 'memory', 'containerOverride_memory' - The hard limit (in MiB) of memory to present to the container, instead
-- of the default value from the task definition. If your container
-- attempts to exceed the memory specified here, the container is killed.
-- You must also specify a container name.
--
-- 'name', 'containerOverride_name' - The name of the container that receives the override. This parameter is
-- required if any override is specified.
--
-- 'cpu', 'containerOverride_cpu' - The number of @cpu@ units reserved for the container, instead of the
-- default value from the task definition. You must also specify a
-- container name.
--
-- 'memoryReservation', 'containerOverride_memoryReservation' - The soft limit (in MiB) of memory to reserve for the container, instead
-- of the default value from the task definition. You must also specify a
-- container name.
newContainerOverride ::
  ContainerOverride
newContainerOverride :: ContainerOverride
newContainerOverride =
  ContainerOverride' :: Maybe [Text]
-> Maybe [KeyValuePair]
-> Maybe [EnvironmentFile]
-> Maybe [ResourceRequirement]
-> Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> ContainerOverride
ContainerOverride'
    { $sel:command:ContainerOverride' :: Maybe [Text]
command = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:environment:ContainerOverride' :: Maybe [KeyValuePair]
environment = Maybe [KeyValuePair]
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentFiles:ContainerOverride' :: Maybe [EnvironmentFile]
environmentFiles = Maybe [EnvironmentFile]
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceRequirements:ContainerOverride' :: Maybe [ResourceRequirement]
resourceRequirements = Maybe [ResourceRequirement]
forall a. Maybe a
Prelude.Nothing,
      $sel:memory:ContainerOverride' :: Maybe Int
memory = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ContainerOverride' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cpu:ContainerOverride' :: Maybe Int
cpu = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:memoryReservation:ContainerOverride' :: Maybe Int
memoryReservation = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The command to send to the container that overrides the default command
-- from the Docker image or the task definition. You must also specify a
-- container name.
containerOverride_command :: Lens.Lens' ContainerOverride (Prelude.Maybe [Prelude.Text])
containerOverride_command :: (Maybe [Text] -> f (Maybe [Text]))
-> ContainerOverride -> f ContainerOverride
containerOverride_command = (ContainerOverride -> Maybe [Text])
-> (ContainerOverride -> Maybe [Text] -> ContainerOverride)
-> Lens
     ContainerOverride ContainerOverride (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverride' {Maybe [Text]
command :: Maybe [Text]
$sel:command:ContainerOverride' :: ContainerOverride -> Maybe [Text]
command} -> Maybe [Text]
command) (\s :: ContainerOverride
s@ContainerOverride' {} Maybe [Text]
a -> ContainerOverride
s {$sel:command:ContainerOverride' :: Maybe [Text]
command = Maybe [Text]
a} :: ContainerOverride) ((Maybe [Text] -> f (Maybe [Text]))
 -> ContainerOverride -> f ContainerOverride)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ContainerOverride
-> f ContainerOverride
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The environment variables to send to the container. You can add new
-- environment variables, which are added to the container at launch, or
-- you can override the existing environment variables from the Docker
-- image or the task definition. You must also specify a container name.
containerOverride_environment :: Lens.Lens' ContainerOverride (Prelude.Maybe [KeyValuePair])
containerOverride_environment :: (Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> ContainerOverride -> f ContainerOverride
containerOverride_environment = (ContainerOverride -> Maybe [KeyValuePair])
-> (ContainerOverride -> Maybe [KeyValuePair] -> ContainerOverride)
-> Lens
     ContainerOverride
     ContainerOverride
     (Maybe [KeyValuePair])
     (Maybe [KeyValuePair])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverride' {Maybe [KeyValuePair]
environment :: Maybe [KeyValuePair]
$sel:environment:ContainerOverride' :: ContainerOverride -> Maybe [KeyValuePair]
environment} -> Maybe [KeyValuePair]
environment) (\s :: ContainerOverride
s@ContainerOverride' {} Maybe [KeyValuePair]
a -> ContainerOverride
s {$sel:environment:ContainerOverride' :: Maybe [KeyValuePair]
environment = Maybe [KeyValuePair]
a} :: ContainerOverride) ((Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
 -> ContainerOverride -> f ContainerOverride)
-> ((Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
    -> Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> (Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> ContainerOverride
-> f ContainerOverride
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [KeyValuePair] [KeyValuePair] [KeyValuePair] [KeyValuePair]
-> Iso
     (Maybe [KeyValuePair])
     (Maybe [KeyValuePair])
     (Maybe [KeyValuePair])
     (Maybe [KeyValuePair])
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 [KeyValuePair] [KeyValuePair] [KeyValuePair] [KeyValuePair]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of files containing the environment variables to pass to a
-- container, instead of the value from the container definition.
containerOverride_environmentFiles :: Lens.Lens' ContainerOverride (Prelude.Maybe [EnvironmentFile])
containerOverride_environmentFiles :: (Maybe [EnvironmentFile] -> f (Maybe [EnvironmentFile]))
-> ContainerOverride -> f ContainerOverride
containerOverride_environmentFiles = (ContainerOverride -> Maybe [EnvironmentFile])
-> (ContainerOverride
    -> Maybe [EnvironmentFile] -> ContainerOverride)
-> Lens
     ContainerOverride
     ContainerOverride
     (Maybe [EnvironmentFile])
     (Maybe [EnvironmentFile])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverride' {Maybe [EnvironmentFile]
environmentFiles :: Maybe [EnvironmentFile]
$sel:environmentFiles:ContainerOverride' :: ContainerOverride -> Maybe [EnvironmentFile]
environmentFiles} -> Maybe [EnvironmentFile]
environmentFiles) (\s :: ContainerOverride
s@ContainerOverride' {} Maybe [EnvironmentFile]
a -> ContainerOverride
s {$sel:environmentFiles:ContainerOverride' :: Maybe [EnvironmentFile]
environmentFiles = Maybe [EnvironmentFile]
a} :: ContainerOverride) ((Maybe [EnvironmentFile] -> f (Maybe [EnvironmentFile]))
 -> ContainerOverride -> f ContainerOverride)
-> ((Maybe [EnvironmentFile] -> f (Maybe [EnvironmentFile]))
    -> Maybe [EnvironmentFile] -> f (Maybe [EnvironmentFile]))
-> (Maybe [EnvironmentFile] -> f (Maybe [EnvironmentFile]))
-> ContainerOverride
-> f ContainerOverride
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EnvironmentFile]
  [EnvironmentFile]
  [EnvironmentFile]
  [EnvironmentFile]
-> Iso
     (Maybe [EnvironmentFile])
     (Maybe [EnvironmentFile])
     (Maybe [EnvironmentFile])
     (Maybe [EnvironmentFile])
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
  [EnvironmentFile]
  [EnvironmentFile]
  [EnvironmentFile]
  [EnvironmentFile]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type and amount of a resource to assign to a container, instead of
-- the default value from the task definition. The only supported resource
-- is a GPU.
containerOverride_resourceRequirements :: Lens.Lens' ContainerOverride (Prelude.Maybe [ResourceRequirement])
containerOverride_resourceRequirements :: (Maybe [ResourceRequirement] -> f (Maybe [ResourceRequirement]))
-> ContainerOverride -> f ContainerOverride
containerOverride_resourceRequirements = (ContainerOverride -> Maybe [ResourceRequirement])
-> (ContainerOverride
    -> Maybe [ResourceRequirement] -> ContainerOverride)
-> Lens
     ContainerOverride
     ContainerOverride
     (Maybe [ResourceRequirement])
     (Maybe [ResourceRequirement])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverride' {Maybe [ResourceRequirement]
resourceRequirements :: Maybe [ResourceRequirement]
$sel:resourceRequirements:ContainerOverride' :: ContainerOverride -> Maybe [ResourceRequirement]
resourceRequirements} -> Maybe [ResourceRequirement]
resourceRequirements) (\s :: ContainerOverride
s@ContainerOverride' {} Maybe [ResourceRequirement]
a -> ContainerOverride
s {$sel:resourceRequirements:ContainerOverride' :: Maybe [ResourceRequirement]
resourceRequirements = Maybe [ResourceRequirement]
a} :: ContainerOverride) ((Maybe [ResourceRequirement] -> f (Maybe [ResourceRequirement]))
 -> ContainerOverride -> f ContainerOverride)
-> ((Maybe [ResourceRequirement]
     -> f (Maybe [ResourceRequirement]))
    -> Maybe [ResourceRequirement] -> f (Maybe [ResourceRequirement]))
-> (Maybe [ResourceRequirement] -> f (Maybe [ResourceRequirement]))
-> ContainerOverride
-> f ContainerOverride
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourceRequirement]
  [ResourceRequirement]
  [ResourceRequirement]
  [ResourceRequirement]
-> Iso
     (Maybe [ResourceRequirement])
     (Maybe [ResourceRequirement])
     (Maybe [ResourceRequirement])
     (Maybe [ResourceRequirement])
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
  [ResourceRequirement]
  [ResourceRequirement]
  [ResourceRequirement]
  [ResourceRequirement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The hard limit (in MiB) of memory to present to the container, instead
-- of the default value from the task definition. If your container
-- attempts to exceed the memory specified here, the container is killed.
-- You must also specify a container name.
containerOverride_memory :: Lens.Lens' ContainerOverride (Prelude.Maybe Prelude.Int)
containerOverride_memory :: (Maybe Int -> f (Maybe Int))
-> ContainerOverride -> f ContainerOverride
containerOverride_memory = (ContainerOverride -> Maybe Int)
-> (ContainerOverride -> Maybe Int -> ContainerOverride)
-> Lens ContainerOverride ContainerOverride (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverride' {Maybe Int
memory :: Maybe Int
$sel:memory:ContainerOverride' :: ContainerOverride -> Maybe Int
memory} -> Maybe Int
memory) (\s :: ContainerOverride
s@ContainerOverride' {} Maybe Int
a -> ContainerOverride
s {$sel:memory:ContainerOverride' :: Maybe Int
memory = Maybe Int
a} :: ContainerOverride)

-- | The name of the container that receives the override. This parameter is
-- required if any override is specified.
containerOverride_name :: Lens.Lens' ContainerOverride (Prelude.Maybe Prelude.Text)
containerOverride_name :: (Maybe Text -> f (Maybe Text))
-> ContainerOverride -> f ContainerOverride
containerOverride_name = (ContainerOverride -> Maybe Text)
-> (ContainerOverride -> Maybe Text -> ContainerOverride)
-> Lens
     ContainerOverride ContainerOverride (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverride' {Maybe Text
name :: Maybe Text
$sel:name:ContainerOverride' :: ContainerOverride -> Maybe Text
name} -> Maybe Text
name) (\s :: ContainerOverride
s@ContainerOverride' {} Maybe Text
a -> ContainerOverride
s {$sel:name:ContainerOverride' :: Maybe Text
name = Maybe Text
a} :: ContainerOverride)

-- | The number of @cpu@ units reserved for the container, instead of the
-- default value from the task definition. You must also specify a
-- container name.
containerOverride_cpu :: Lens.Lens' ContainerOverride (Prelude.Maybe Prelude.Int)
containerOverride_cpu :: (Maybe Int -> f (Maybe Int))
-> ContainerOverride -> f ContainerOverride
containerOverride_cpu = (ContainerOverride -> Maybe Int)
-> (ContainerOverride -> Maybe Int -> ContainerOverride)
-> Lens ContainerOverride ContainerOverride (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverride' {Maybe Int
cpu :: Maybe Int
$sel:cpu:ContainerOverride' :: ContainerOverride -> Maybe Int
cpu} -> Maybe Int
cpu) (\s :: ContainerOverride
s@ContainerOverride' {} Maybe Int
a -> ContainerOverride
s {$sel:cpu:ContainerOverride' :: Maybe Int
cpu = Maybe Int
a} :: ContainerOverride)

-- | The soft limit (in MiB) of memory to reserve for the container, instead
-- of the default value from the task definition. You must also specify a
-- container name.
containerOverride_memoryReservation :: Lens.Lens' ContainerOverride (Prelude.Maybe Prelude.Int)
containerOverride_memoryReservation :: (Maybe Int -> f (Maybe Int))
-> ContainerOverride -> f ContainerOverride
containerOverride_memoryReservation = (ContainerOverride -> Maybe Int)
-> (ContainerOverride -> Maybe Int -> ContainerOverride)
-> Lens ContainerOverride ContainerOverride (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverride' {Maybe Int
memoryReservation :: Maybe Int
$sel:memoryReservation:ContainerOverride' :: ContainerOverride -> Maybe Int
memoryReservation} -> Maybe Int
memoryReservation) (\s :: ContainerOverride
s@ContainerOverride' {} Maybe Int
a -> ContainerOverride
s {$sel:memoryReservation:ContainerOverride' :: Maybe Int
memoryReservation = Maybe Int
a} :: ContainerOverride)

instance Core.FromJSON ContainerOverride where
  parseJSON :: Value -> Parser ContainerOverride
parseJSON =
    String
-> (Object -> Parser ContainerOverride)
-> Value
-> Parser ContainerOverride
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContainerOverride"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [KeyValuePair]
-> Maybe [EnvironmentFile]
-> Maybe [ResourceRequirement]
-> Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> ContainerOverride
ContainerOverride'
            (Maybe [Text]
 -> Maybe [KeyValuePair]
 -> Maybe [EnvironmentFile]
 -> Maybe [ResourceRequirement]
 -> Maybe Int
 -> Maybe Text
 -> Maybe Int
 -> Maybe Int
 -> ContainerOverride)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [KeyValuePair]
      -> Maybe [EnvironmentFile]
      -> Maybe [ResourceRequirement]
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> ContainerOverride)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"command" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [KeyValuePair]
   -> Maybe [EnvironmentFile]
   -> Maybe [ResourceRequirement]
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> ContainerOverride)
-> Parser (Maybe [KeyValuePair])
-> Parser
     (Maybe [EnvironmentFile]
      -> Maybe [ResourceRequirement]
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> ContainerOverride)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [KeyValuePair]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"environment" Parser (Maybe (Maybe [KeyValuePair]))
-> Maybe [KeyValuePair] -> Parser (Maybe [KeyValuePair])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [KeyValuePair]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [EnvironmentFile]
   -> Maybe [ResourceRequirement]
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> ContainerOverride)
-> Parser (Maybe [EnvironmentFile])
-> Parser
     (Maybe [ResourceRequirement]
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> ContainerOverride)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [EnvironmentFile]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"environmentFiles"
                            Parser (Maybe (Maybe [EnvironmentFile]))
-> Maybe [EnvironmentFile] -> Parser (Maybe [EnvironmentFile])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [EnvironmentFile]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [ResourceRequirement]
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> ContainerOverride)
-> Parser (Maybe [ResourceRequirement])
-> Parser
     (Maybe Int
      -> Maybe Text -> Maybe Int -> Maybe Int -> ContainerOverride)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ResourceRequirement]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceRequirements"
                            Parser (Maybe (Maybe [ResourceRequirement]))
-> Maybe [ResourceRequirement]
-> Parser (Maybe [ResourceRequirement])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ResourceRequirement]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Int
   -> Maybe Text -> Maybe Int -> Maybe Int -> ContainerOverride)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text -> Maybe Int -> Maybe Int -> ContainerOverride)
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
"memory")
            Parser (Maybe Text -> Maybe Int -> Maybe Int -> ContainerOverride)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Int -> ContainerOverride)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser (Maybe Int -> Maybe Int -> ContainerOverride)
-> Parser (Maybe Int) -> Parser (Maybe Int -> ContainerOverride)
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
"cpu")
            Parser (Maybe Int -> ContainerOverride)
-> Parser (Maybe Int) -> Parser ContainerOverride
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
"memoryReservation")
      )

instance Prelude.Hashable ContainerOverride

instance Prelude.NFData ContainerOverride

instance Core.ToJSON ContainerOverride where
  toJSON :: ContainerOverride -> Value
toJSON ContainerOverride' {Maybe Int
Maybe [Text]
Maybe [EnvironmentFile]
Maybe [KeyValuePair]
Maybe [ResourceRequirement]
Maybe Text
memoryReservation :: Maybe Int
cpu :: Maybe Int
name :: Maybe Text
memory :: Maybe Int
resourceRequirements :: Maybe [ResourceRequirement]
environmentFiles :: Maybe [EnvironmentFile]
environment :: Maybe [KeyValuePair]
command :: Maybe [Text]
$sel:memoryReservation:ContainerOverride' :: ContainerOverride -> Maybe Int
$sel:cpu:ContainerOverride' :: ContainerOverride -> Maybe Int
$sel:name:ContainerOverride' :: ContainerOverride -> Maybe Text
$sel:memory:ContainerOverride' :: ContainerOverride -> Maybe Int
$sel:resourceRequirements:ContainerOverride' :: ContainerOverride -> Maybe [ResourceRequirement]
$sel:environmentFiles:ContainerOverride' :: ContainerOverride -> Maybe [EnvironmentFile]
$sel:environment:ContainerOverride' :: ContainerOverride -> Maybe [KeyValuePair]
$sel:command:ContainerOverride' :: ContainerOverride -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"command" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
command,
            (Text
"environment" Text -> [KeyValuePair] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([KeyValuePair] -> Pair) -> Maybe [KeyValuePair] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [KeyValuePair]
environment,
            (Text
"environmentFiles" Text -> [EnvironmentFile] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([EnvironmentFile] -> Pair)
-> Maybe [EnvironmentFile] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EnvironmentFile]
environmentFiles,
            (Text
"resourceRequirements" Text -> [ResourceRequirement] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ResourceRequirement] -> Pair)
-> Maybe [ResourceRequirement] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ResourceRequirement]
resourceRequirements,
            (Text
"memory" 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
memory,
            (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Text
"cpu" 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
cpu,
            (Text
"memoryReservation" 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
memoryReservation
          ]
      )