{-# 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.EksContainerOverride
-- 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.EksContainerOverride where

import Amazonka.Batch.Types.EksContainerEnvironmentVariable
import Amazonka.Batch.Types.EksContainerResourceRequirements
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

-- | Object representing any Kubernetes overrides to a job definition that\'s
-- used in a SubmitJob API operation.
--
-- /See:/ 'newEksContainerOverride' smart constructor.
data EksContainerOverride = EksContainerOverride'
  { -- | The arguments to the entrypoint to send to the container that overrides
    -- the default arguments from the Docker image or the job definition. For
    -- more information, see
    -- <https://docs.docker.com/engine/reference/builder/#cmd CMD> in the
    -- /Dockerfile reference/ and
    -- <https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/ Define a command an arguments for a pod>
    -- in the /Kubernetes documentation/.
    EksContainerOverride -> Maybe [Text]
args :: Prelude.Maybe [Prelude.Text],
    -- | The command to send to the container that overrides the default command
    -- from the Docker image or the job definition.
    EksContainerOverride -> 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 job definition.
    --
    -- Environment variables cannot start with \"@AWS_BATCH@\". This naming
    -- convention is reserved for variables that Batch sets.
    EksContainerOverride -> Maybe [EksContainerEnvironmentVariable]
env :: Prelude.Maybe [EksContainerEnvironmentVariable],
    -- | The override of the Docker image that\'s used to start the container.
    EksContainerOverride -> Maybe Text
image :: Prelude.Maybe Prelude.Text,
    -- | The type and amount of resources to assign to a container. These
    -- override the settings in the job definition. The supported resources
    -- include @memory@, @cpu@, and @nvidia.com\/gpu@. For more information,
    -- see
    -- <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ Resource management for pods and containers>
    -- in the /Kubernetes documentation/.
    EksContainerOverride -> Maybe EksContainerResourceRequirements
resources :: Prelude.Maybe EksContainerResourceRequirements
  }
  deriving (EksContainerOverride -> EksContainerOverride -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EksContainerOverride -> EksContainerOverride -> Bool
$c/= :: EksContainerOverride -> EksContainerOverride -> Bool
== :: EksContainerOverride -> EksContainerOverride -> Bool
$c== :: EksContainerOverride -> EksContainerOverride -> Bool
Prelude.Eq, ReadPrec [EksContainerOverride]
ReadPrec EksContainerOverride
Int -> ReadS EksContainerOverride
ReadS [EksContainerOverride]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EksContainerOverride]
$creadListPrec :: ReadPrec [EksContainerOverride]
readPrec :: ReadPrec EksContainerOverride
$creadPrec :: ReadPrec EksContainerOverride
readList :: ReadS [EksContainerOverride]
$creadList :: ReadS [EksContainerOverride]
readsPrec :: Int -> ReadS EksContainerOverride
$creadsPrec :: Int -> ReadS EksContainerOverride
Prelude.Read, Int -> EksContainerOverride -> ShowS
[EksContainerOverride] -> ShowS
EksContainerOverride -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EksContainerOverride] -> ShowS
$cshowList :: [EksContainerOverride] -> ShowS
show :: EksContainerOverride -> String
$cshow :: EksContainerOverride -> String
showsPrec :: Int -> EksContainerOverride -> ShowS
$cshowsPrec :: Int -> EksContainerOverride -> ShowS
Prelude.Show, forall x. Rep EksContainerOverride x -> EksContainerOverride
forall x. EksContainerOverride -> Rep EksContainerOverride x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EksContainerOverride x -> EksContainerOverride
$cfrom :: forall x. EksContainerOverride -> Rep EksContainerOverride x
Prelude.Generic)

-- |
-- Create a value of 'EksContainerOverride' 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:
--
-- 'args', 'eksContainerOverride_args' - The arguments to the entrypoint to send to the container that overrides
-- the default arguments from the Docker image or the job definition. For
-- more information, see
-- <https://docs.docker.com/engine/reference/builder/#cmd CMD> in the
-- /Dockerfile reference/ and
-- <https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/ Define a command an arguments for a pod>
-- in the /Kubernetes documentation/.
--
-- 'command', 'eksContainerOverride_command' - The command to send to the container that overrides the default command
-- from the Docker image or the job definition.
--
-- 'env', 'eksContainerOverride_env' - 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 job definition.
--
-- Environment variables cannot start with \"@AWS_BATCH@\". This naming
-- convention is reserved for variables that Batch sets.
--
-- 'image', 'eksContainerOverride_image' - The override of the Docker image that\'s used to start the container.
--
-- 'resources', 'eksContainerOverride_resources' - The type and amount of resources to assign to a container. These
-- override the settings in the job definition. The supported resources
-- include @memory@, @cpu@, and @nvidia.com\/gpu@. For more information,
-- see
-- <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ Resource management for pods and containers>
-- in the /Kubernetes documentation/.
newEksContainerOverride ::
  EksContainerOverride
newEksContainerOverride :: EksContainerOverride
newEksContainerOverride =
  EksContainerOverride'
    { $sel:args:EksContainerOverride' :: Maybe [Text]
args = forall a. Maybe a
Prelude.Nothing,
      $sel:command:EksContainerOverride' :: Maybe [Text]
command = forall a. Maybe a
Prelude.Nothing,
      $sel:env:EksContainerOverride' :: Maybe [EksContainerEnvironmentVariable]
env = forall a. Maybe a
Prelude.Nothing,
      $sel:image:EksContainerOverride' :: Maybe Text
image = forall a. Maybe a
Prelude.Nothing,
      $sel:resources:EksContainerOverride' :: Maybe EksContainerResourceRequirements
resources = forall a. Maybe a
Prelude.Nothing
    }

-- | The arguments to the entrypoint to send to the container that overrides
-- the default arguments from the Docker image or the job definition. For
-- more information, see
-- <https://docs.docker.com/engine/reference/builder/#cmd CMD> in the
-- /Dockerfile reference/ and
-- <https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/ Define a command an arguments for a pod>
-- in the /Kubernetes documentation/.
eksContainerOverride_args :: Lens.Lens' EksContainerOverride (Prelude.Maybe [Prelude.Text])
eksContainerOverride_args :: Lens' EksContainerOverride (Maybe [Text])
eksContainerOverride_args = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksContainerOverride' {Maybe [Text]
args :: Maybe [Text]
$sel:args:EksContainerOverride' :: EksContainerOverride -> Maybe [Text]
args} -> Maybe [Text]
args) (\s :: EksContainerOverride
s@EksContainerOverride' {} Maybe [Text]
a -> EksContainerOverride
s {$sel:args:EksContainerOverride' :: Maybe [Text]
args = Maybe [Text]
a} :: EksContainerOverride) 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

-- | The command to send to the container that overrides the default command
-- from the Docker image or the job definition.
eksContainerOverride_command :: Lens.Lens' EksContainerOverride (Prelude.Maybe [Prelude.Text])
eksContainerOverride_command :: Lens' EksContainerOverride (Maybe [Text])
eksContainerOverride_command = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksContainerOverride' {Maybe [Text]
command :: Maybe [Text]
$sel:command:EksContainerOverride' :: EksContainerOverride -> Maybe [Text]
command} -> Maybe [Text]
command) (\s :: EksContainerOverride
s@EksContainerOverride' {} Maybe [Text]
a -> EksContainerOverride
s {$sel:command:EksContainerOverride' :: Maybe [Text]
command = Maybe [Text]
a} :: EksContainerOverride) 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

-- | 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 job definition.
--
-- Environment variables cannot start with \"@AWS_BATCH@\". This naming
-- convention is reserved for variables that Batch sets.
eksContainerOverride_env :: Lens.Lens' EksContainerOverride (Prelude.Maybe [EksContainerEnvironmentVariable])
eksContainerOverride_env :: Lens'
  EksContainerOverride (Maybe [EksContainerEnvironmentVariable])
eksContainerOverride_env = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksContainerOverride' {Maybe [EksContainerEnvironmentVariable]
env :: Maybe [EksContainerEnvironmentVariable]
$sel:env:EksContainerOverride' :: EksContainerOverride -> Maybe [EksContainerEnvironmentVariable]
env} -> Maybe [EksContainerEnvironmentVariable]
env) (\s :: EksContainerOverride
s@EksContainerOverride' {} Maybe [EksContainerEnvironmentVariable]
a -> EksContainerOverride
s {$sel:env:EksContainerOverride' :: Maybe [EksContainerEnvironmentVariable]
env = Maybe [EksContainerEnvironmentVariable]
a} :: EksContainerOverride) 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

-- | The override of the Docker image that\'s used to start the container.
eksContainerOverride_image :: Lens.Lens' EksContainerOverride (Prelude.Maybe Prelude.Text)
eksContainerOverride_image :: Lens' EksContainerOverride (Maybe Text)
eksContainerOverride_image = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksContainerOverride' {Maybe Text
image :: Maybe Text
$sel:image:EksContainerOverride' :: EksContainerOverride -> Maybe Text
image} -> Maybe Text
image) (\s :: EksContainerOverride
s@EksContainerOverride' {} Maybe Text
a -> EksContainerOverride
s {$sel:image:EksContainerOverride' :: Maybe Text
image = Maybe Text
a} :: EksContainerOverride)

-- | The type and amount of resources to assign to a container. These
-- override the settings in the job definition. The supported resources
-- include @memory@, @cpu@, and @nvidia.com\/gpu@. For more information,
-- see
-- <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ Resource management for pods and containers>
-- in the /Kubernetes documentation/.
eksContainerOverride_resources :: Lens.Lens' EksContainerOverride (Prelude.Maybe EksContainerResourceRequirements)
eksContainerOverride_resources :: Lens' EksContainerOverride (Maybe EksContainerResourceRequirements)
eksContainerOverride_resources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksContainerOverride' {Maybe EksContainerResourceRequirements
resources :: Maybe EksContainerResourceRequirements
$sel:resources:EksContainerOverride' :: EksContainerOverride -> Maybe EksContainerResourceRequirements
resources} -> Maybe EksContainerResourceRequirements
resources) (\s :: EksContainerOverride
s@EksContainerOverride' {} Maybe EksContainerResourceRequirements
a -> EksContainerOverride
s {$sel:resources:EksContainerOverride' :: Maybe EksContainerResourceRequirements
resources = Maybe EksContainerResourceRequirements
a} :: EksContainerOverride)

instance Prelude.Hashable EksContainerOverride where
  hashWithSalt :: Int -> EksContainerOverride -> Int
hashWithSalt Int
_salt EksContainerOverride' {Maybe [Text]
Maybe [EksContainerEnvironmentVariable]
Maybe Text
Maybe EksContainerResourceRequirements
resources :: Maybe EksContainerResourceRequirements
image :: Maybe Text
env :: Maybe [EksContainerEnvironmentVariable]
command :: Maybe [Text]
args :: Maybe [Text]
$sel:resources:EksContainerOverride' :: EksContainerOverride -> Maybe EksContainerResourceRequirements
$sel:image:EksContainerOverride' :: EksContainerOverride -> Maybe Text
$sel:env:EksContainerOverride' :: EksContainerOverride -> Maybe [EksContainerEnvironmentVariable]
$sel:command:EksContainerOverride' :: EksContainerOverride -> Maybe [Text]
$sel:args:EksContainerOverride' :: EksContainerOverride -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
args
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
command
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EksContainerEnvironmentVariable]
env
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
image
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EksContainerResourceRequirements
resources

instance Prelude.NFData EksContainerOverride where
  rnf :: EksContainerOverride -> ()
rnf EksContainerOverride' {Maybe [Text]
Maybe [EksContainerEnvironmentVariable]
Maybe Text
Maybe EksContainerResourceRequirements
resources :: Maybe EksContainerResourceRequirements
image :: Maybe Text
env :: Maybe [EksContainerEnvironmentVariable]
command :: Maybe [Text]
args :: Maybe [Text]
$sel:resources:EksContainerOverride' :: EksContainerOverride -> Maybe EksContainerResourceRequirements
$sel:image:EksContainerOverride' :: EksContainerOverride -> Maybe Text
$sel:env:EksContainerOverride' :: EksContainerOverride -> Maybe [EksContainerEnvironmentVariable]
$sel:command:EksContainerOverride' :: EksContainerOverride -> Maybe [Text]
$sel:args:EksContainerOverride' :: EksContainerOverride -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
args
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
command
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [EksContainerEnvironmentVariable]
env
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
image
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EksContainerResourceRequirements
resources

instance Data.ToJSON EksContainerOverride where
  toJSON :: EksContainerOverride -> Value
toJSON EksContainerOverride' {Maybe [Text]
Maybe [EksContainerEnvironmentVariable]
Maybe Text
Maybe EksContainerResourceRequirements
resources :: Maybe EksContainerResourceRequirements
image :: Maybe Text
env :: Maybe [EksContainerEnvironmentVariable]
command :: Maybe [Text]
args :: Maybe [Text]
$sel:resources:EksContainerOverride' :: EksContainerOverride -> Maybe EksContainerResourceRequirements
$sel:image:EksContainerOverride' :: EksContainerOverride -> Maybe Text
$sel:env:EksContainerOverride' :: EksContainerOverride -> Maybe [EksContainerEnvironmentVariable]
$sel:command:EksContainerOverride' :: EksContainerOverride -> Maybe [Text]
$sel:args:EksContainerOverride' :: EksContainerOverride -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"args" 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 [Text]
args,
            (Key
"command" 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 [Text]
command,
            (Key
"env" 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 [EksContainerEnvironmentVariable]
env,
            (Key
"image" 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 Text
image,
            (Key
"resources" 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 EksContainerResourceRequirements
resources
          ]
      )