{-# 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.ContainerOverrides
-- 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.Batch.Types.ContainerOverrides where

import Amazonka.Batch.Types.KeyValuePair
import Amazonka.Batch.Types.ResourceRequirement
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The overrides that should be sent to a container.
--
-- /See:/ 'newContainerOverrides' smart constructor.
data ContainerOverrides = ContainerOverrides'
  { -- | The command to send to the container that overrides the default command
    -- from the Docker image or the job definition.
    ContainerOverrides -> 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 must not start with @AWS_BATCH@; this naming
    -- convention is reserved for variables that are set by the Batch service.
    ContainerOverrides -> Maybe [KeyValuePair]
environment :: Prelude.Maybe [KeyValuePair],
    -- | The type and amount of resources to assign to a container. This
    -- overrides the settings in the job definition. The supported resources
    -- include @GPU@, @MEMORY@, and @VCPU@.
    ContainerOverrides -> Maybe [ResourceRequirement]
resourceRequirements :: Prelude.Maybe [ResourceRequirement],
    -- | The instance type to use for a multi-node parallel job.
    --
    -- This parameter isn\'t applicable to single-node container jobs or jobs
    -- that run on Fargate resources, and shouldn\'t be provided.
    ContainerOverrides -> Maybe Text
instanceType :: Prelude.Maybe Prelude.Text,
    -- | This parameter indicates the amount of memory (in MiB) that\'s reserved
    -- for the job. It overrides the @memory@ parameter set in the job
    -- definition, but doesn\'t override any memory requirement specified in
    -- the @ResourceRequirement@ structure in the job definition. To override
    -- memory requirements that are specified in the @ResourceRequirement@
    -- structure in the job definition, @ResourceRequirement@ must be specified
    -- in the @SubmitJob@ request, with @type@ set to @MEMORY@ and @value@ set
    -- to the new value.
    --
    -- This parameter is supported for jobs that run on EC2 resources, but
    -- isn\'t supported for jobs that run on Fargate resources. For these
    -- resources, use @resourceRequirement@ instead.
    ContainerOverrides -> Maybe Int
memory :: Prelude.Maybe Prelude.Int,
    -- | This parameter indicates the number of vCPUs reserved for the
    -- container.It overrides the @vcpus@ parameter that\'s set in the job
    -- definition, but doesn\'t override any vCPU requirement specified in the
    -- @resourceRequirement@ structure in the job definition. To override vCPU
    -- requirements that are specified in the @ResourceRequirement@ structure
    -- in the job definition, @ResourceRequirement@ must be specified in the
    -- @SubmitJob@ request, with @type@ set to @VCPU@ and @value@ set to the
    -- new value.
    --
    -- This parameter maps to @CpuShares@ 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
    -- @--cpu-shares@ option to
    -- <https://docs.docker.com/engine/reference/run/ docker run>. Each vCPU is
    -- equivalent to 1,024 CPU shares. You must specify at least one vCPU.
    --
    -- This parameter is supported for jobs that run on EC2 resources, but
    -- isn\'t supported for jobs that run on Fargate resources. For Fargate
    -- resources, you can only use @resourceRequirement@. For EC2 resources,
    -- you can use either this parameter or @resourceRequirement@ but not both.
    ContainerOverrides -> Maybe Int
vcpus :: Prelude.Maybe Prelude.Int
  }
  deriving (ContainerOverrides -> ContainerOverrides -> Bool
(ContainerOverrides -> ContainerOverrides -> Bool)
-> (ContainerOverrides -> ContainerOverrides -> Bool)
-> Eq ContainerOverrides
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerOverrides -> ContainerOverrides -> Bool
$c/= :: ContainerOverrides -> ContainerOverrides -> Bool
== :: ContainerOverrides -> ContainerOverrides -> Bool
$c== :: ContainerOverrides -> ContainerOverrides -> Bool
Prelude.Eq, ReadPrec [ContainerOverrides]
ReadPrec ContainerOverrides
Int -> ReadS ContainerOverrides
ReadS [ContainerOverrides]
(Int -> ReadS ContainerOverrides)
-> ReadS [ContainerOverrides]
-> ReadPrec ContainerOverrides
-> ReadPrec [ContainerOverrides]
-> Read ContainerOverrides
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerOverrides]
$creadListPrec :: ReadPrec [ContainerOverrides]
readPrec :: ReadPrec ContainerOverrides
$creadPrec :: ReadPrec ContainerOverrides
readList :: ReadS [ContainerOverrides]
$creadList :: ReadS [ContainerOverrides]
readsPrec :: Int -> ReadS ContainerOverrides
$creadsPrec :: Int -> ReadS ContainerOverrides
Prelude.Read, Int -> ContainerOverrides -> ShowS
[ContainerOverrides] -> ShowS
ContainerOverrides -> String
(Int -> ContainerOverrides -> ShowS)
-> (ContainerOverrides -> String)
-> ([ContainerOverrides] -> ShowS)
-> Show ContainerOverrides
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerOverrides] -> ShowS
$cshowList :: [ContainerOverrides] -> ShowS
show :: ContainerOverrides -> String
$cshow :: ContainerOverrides -> String
showsPrec :: Int -> ContainerOverrides -> ShowS
$cshowsPrec :: Int -> ContainerOverrides -> ShowS
Prelude.Show, (forall x. ContainerOverrides -> Rep ContainerOverrides x)
-> (forall x. Rep ContainerOverrides x -> ContainerOverrides)
-> Generic ContainerOverrides
forall x. Rep ContainerOverrides x -> ContainerOverrides
forall x. ContainerOverrides -> Rep ContainerOverrides x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContainerOverrides x -> ContainerOverrides
$cfrom :: forall x. ContainerOverrides -> Rep ContainerOverrides x
Prelude.Generic)

-- |
-- Create a value of 'ContainerOverrides' 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', 'containerOverrides_command' - The command to send to the container that overrides the default command
-- from the Docker image or the job definition.
--
-- 'environment', 'containerOverrides_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 job definition.
--
-- Environment variables must not start with @AWS_BATCH@; this naming
-- convention is reserved for variables that are set by the Batch service.
--
-- 'resourceRequirements', 'containerOverrides_resourceRequirements' - The type and amount of resources to assign to a container. This
-- overrides the settings in the job definition. The supported resources
-- include @GPU@, @MEMORY@, and @VCPU@.
--
-- 'instanceType', 'containerOverrides_instanceType' - The instance type to use for a multi-node parallel job.
--
-- This parameter isn\'t applicable to single-node container jobs or jobs
-- that run on Fargate resources, and shouldn\'t be provided.
--
-- 'memory', 'containerOverrides_memory' - This parameter indicates the amount of memory (in MiB) that\'s reserved
-- for the job. It overrides the @memory@ parameter set in the job
-- definition, but doesn\'t override any memory requirement specified in
-- the @ResourceRequirement@ structure in the job definition. To override
-- memory requirements that are specified in the @ResourceRequirement@
-- structure in the job definition, @ResourceRequirement@ must be specified
-- in the @SubmitJob@ request, with @type@ set to @MEMORY@ and @value@ set
-- to the new value.
--
-- This parameter is supported for jobs that run on EC2 resources, but
-- isn\'t supported for jobs that run on Fargate resources. For these
-- resources, use @resourceRequirement@ instead.
--
-- 'vcpus', 'containerOverrides_vcpus' - This parameter indicates the number of vCPUs reserved for the
-- container.It overrides the @vcpus@ parameter that\'s set in the job
-- definition, but doesn\'t override any vCPU requirement specified in the
-- @resourceRequirement@ structure in the job definition. To override vCPU
-- requirements that are specified in the @ResourceRequirement@ structure
-- in the job definition, @ResourceRequirement@ must be specified in the
-- @SubmitJob@ request, with @type@ set to @VCPU@ and @value@ set to the
-- new value.
--
-- This parameter maps to @CpuShares@ 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
-- @--cpu-shares@ option to
-- <https://docs.docker.com/engine/reference/run/ docker run>. Each vCPU is
-- equivalent to 1,024 CPU shares. You must specify at least one vCPU.
--
-- This parameter is supported for jobs that run on EC2 resources, but
-- isn\'t supported for jobs that run on Fargate resources. For Fargate
-- resources, you can only use @resourceRequirement@. For EC2 resources,
-- you can use either this parameter or @resourceRequirement@ but not both.
newContainerOverrides ::
  ContainerOverrides
newContainerOverrides :: ContainerOverrides
newContainerOverrides =
  ContainerOverrides' :: Maybe [Text]
-> Maybe [KeyValuePair]
-> Maybe [ResourceRequirement]
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> ContainerOverrides
ContainerOverrides'
    { $sel:command:ContainerOverrides' :: Maybe [Text]
command = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:environment:ContainerOverrides' :: Maybe [KeyValuePair]
environment = Maybe [KeyValuePair]
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceRequirements:ContainerOverrides' :: Maybe [ResourceRequirement]
resourceRequirements = Maybe [ResourceRequirement]
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:ContainerOverrides' :: Maybe Text
instanceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:memory:ContainerOverrides' :: Maybe Int
memory = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:vcpus:ContainerOverrides' :: Maybe Int
vcpus = 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 job definition.
containerOverrides_command :: Lens.Lens' ContainerOverrides (Prelude.Maybe [Prelude.Text])
containerOverrides_command :: (Maybe [Text] -> f (Maybe [Text]))
-> ContainerOverrides -> f ContainerOverrides
containerOverrides_command = (ContainerOverrides -> Maybe [Text])
-> (ContainerOverrides -> Maybe [Text] -> ContainerOverrides)
-> Lens
     ContainerOverrides ContainerOverrides (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverrides' {Maybe [Text]
command :: Maybe [Text]
$sel:command:ContainerOverrides' :: ContainerOverrides -> Maybe [Text]
command} -> Maybe [Text]
command) (\s :: ContainerOverrides
s@ContainerOverrides' {} Maybe [Text]
a -> ContainerOverrides
s {$sel:command:ContainerOverrides' :: Maybe [Text]
command = Maybe [Text]
a} :: ContainerOverrides) ((Maybe [Text] -> f (Maybe [Text]))
 -> ContainerOverrides -> f ContainerOverrides)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ContainerOverrides
-> f ContainerOverrides
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 job definition.
--
-- Environment variables must not start with @AWS_BATCH@; this naming
-- convention is reserved for variables that are set by the Batch service.
containerOverrides_environment :: Lens.Lens' ContainerOverrides (Prelude.Maybe [KeyValuePair])
containerOverrides_environment :: (Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> ContainerOverrides -> f ContainerOverrides
containerOverrides_environment = (ContainerOverrides -> Maybe [KeyValuePair])
-> (ContainerOverrides
    -> Maybe [KeyValuePair] -> ContainerOverrides)
-> Lens
     ContainerOverrides
     ContainerOverrides
     (Maybe [KeyValuePair])
     (Maybe [KeyValuePair])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverrides' {Maybe [KeyValuePair]
environment :: Maybe [KeyValuePair]
$sel:environment:ContainerOverrides' :: ContainerOverrides -> Maybe [KeyValuePair]
environment} -> Maybe [KeyValuePair]
environment) (\s :: ContainerOverrides
s@ContainerOverrides' {} Maybe [KeyValuePair]
a -> ContainerOverrides
s {$sel:environment:ContainerOverrides' :: Maybe [KeyValuePair]
environment = Maybe [KeyValuePair]
a} :: ContainerOverrides) ((Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
 -> ContainerOverrides -> f ContainerOverrides)
-> ((Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
    -> Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> (Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> ContainerOverrides
-> f ContainerOverrides
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

-- | The type and amount of resources to assign to a container. This
-- overrides the settings in the job definition. The supported resources
-- include @GPU@, @MEMORY@, and @VCPU@.
containerOverrides_resourceRequirements :: Lens.Lens' ContainerOverrides (Prelude.Maybe [ResourceRequirement])
containerOverrides_resourceRequirements :: (Maybe [ResourceRequirement] -> f (Maybe [ResourceRequirement]))
-> ContainerOverrides -> f ContainerOverrides
containerOverrides_resourceRequirements = (ContainerOverrides -> Maybe [ResourceRequirement])
-> (ContainerOverrides
    -> Maybe [ResourceRequirement] -> ContainerOverrides)
-> Lens
     ContainerOverrides
     ContainerOverrides
     (Maybe [ResourceRequirement])
     (Maybe [ResourceRequirement])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverrides' {Maybe [ResourceRequirement]
resourceRequirements :: Maybe [ResourceRequirement]
$sel:resourceRequirements:ContainerOverrides' :: ContainerOverrides -> Maybe [ResourceRequirement]
resourceRequirements} -> Maybe [ResourceRequirement]
resourceRequirements) (\s :: ContainerOverrides
s@ContainerOverrides' {} Maybe [ResourceRequirement]
a -> ContainerOverrides
s {$sel:resourceRequirements:ContainerOverrides' :: Maybe [ResourceRequirement]
resourceRequirements = Maybe [ResourceRequirement]
a} :: ContainerOverrides) ((Maybe [ResourceRequirement] -> f (Maybe [ResourceRequirement]))
 -> ContainerOverrides -> f ContainerOverrides)
-> ((Maybe [ResourceRequirement]
     -> f (Maybe [ResourceRequirement]))
    -> Maybe [ResourceRequirement] -> f (Maybe [ResourceRequirement]))
-> (Maybe [ResourceRequirement] -> f (Maybe [ResourceRequirement]))
-> ContainerOverrides
-> f ContainerOverrides
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 instance type to use for a multi-node parallel job.
--
-- This parameter isn\'t applicable to single-node container jobs or jobs
-- that run on Fargate resources, and shouldn\'t be provided.
containerOverrides_instanceType :: Lens.Lens' ContainerOverrides (Prelude.Maybe Prelude.Text)
containerOverrides_instanceType :: (Maybe Text -> f (Maybe Text))
-> ContainerOverrides -> f ContainerOverrides
containerOverrides_instanceType = (ContainerOverrides -> Maybe Text)
-> (ContainerOverrides -> Maybe Text -> ContainerOverrides)
-> Lens
     ContainerOverrides ContainerOverrides (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverrides' {Maybe Text
instanceType :: Maybe Text
$sel:instanceType:ContainerOverrides' :: ContainerOverrides -> Maybe Text
instanceType} -> Maybe Text
instanceType) (\s :: ContainerOverrides
s@ContainerOverrides' {} Maybe Text
a -> ContainerOverrides
s {$sel:instanceType:ContainerOverrides' :: Maybe Text
instanceType = Maybe Text
a} :: ContainerOverrides)

-- | This parameter indicates the amount of memory (in MiB) that\'s reserved
-- for the job. It overrides the @memory@ parameter set in the job
-- definition, but doesn\'t override any memory requirement specified in
-- the @ResourceRequirement@ structure in the job definition. To override
-- memory requirements that are specified in the @ResourceRequirement@
-- structure in the job definition, @ResourceRequirement@ must be specified
-- in the @SubmitJob@ request, with @type@ set to @MEMORY@ and @value@ set
-- to the new value.
--
-- This parameter is supported for jobs that run on EC2 resources, but
-- isn\'t supported for jobs that run on Fargate resources. For these
-- resources, use @resourceRequirement@ instead.
containerOverrides_memory :: Lens.Lens' ContainerOverrides (Prelude.Maybe Prelude.Int)
containerOverrides_memory :: (Maybe Int -> f (Maybe Int))
-> ContainerOverrides -> f ContainerOverrides
containerOverrides_memory = (ContainerOverrides -> Maybe Int)
-> (ContainerOverrides -> Maybe Int -> ContainerOverrides)
-> Lens
     ContainerOverrides ContainerOverrides (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverrides' {Maybe Int
memory :: Maybe Int
$sel:memory:ContainerOverrides' :: ContainerOverrides -> Maybe Int
memory} -> Maybe Int
memory) (\s :: ContainerOverrides
s@ContainerOverrides' {} Maybe Int
a -> ContainerOverrides
s {$sel:memory:ContainerOverrides' :: Maybe Int
memory = Maybe Int
a} :: ContainerOverrides)

-- | This parameter indicates the number of vCPUs reserved for the
-- container.It overrides the @vcpus@ parameter that\'s set in the job
-- definition, but doesn\'t override any vCPU requirement specified in the
-- @resourceRequirement@ structure in the job definition. To override vCPU
-- requirements that are specified in the @ResourceRequirement@ structure
-- in the job definition, @ResourceRequirement@ must be specified in the
-- @SubmitJob@ request, with @type@ set to @VCPU@ and @value@ set to the
-- new value.
--
-- This parameter maps to @CpuShares@ 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
-- @--cpu-shares@ option to
-- <https://docs.docker.com/engine/reference/run/ docker run>. Each vCPU is
-- equivalent to 1,024 CPU shares. You must specify at least one vCPU.
--
-- This parameter is supported for jobs that run on EC2 resources, but
-- isn\'t supported for jobs that run on Fargate resources. For Fargate
-- resources, you can only use @resourceRequirement@. For EC2 resources,
-- you can use either this parameter or @resourceRequirement@ but not both.
containerOverrides_vcpus :: Lens.Lens' ContainerOverrides (Prelude.Maybe Prelude.Int)
containerOverrides_vcpus :: (Maybe Int -> f (Maybe Int))
-> ContainerOverrides -> f ContainerOverrides
containerOverrides_vcpus = (ContainerOverrides -> Maybe Int)
-> (ContainerOverrides -> Maybe Int -> ContainerOverrides)
-> Lens
     ContainerOverrides ContainerOverrides (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerOverrides' {Maybe Int
vcpus :: Maybe Int
$sel:vcpus:ContainerOverrides' :: ContainerOverrides -> Maybe Int
vcpus} -> Maybe Int
vcpus) (\s :: ContainerOverrides
s@ContainerOverrides' {} Maybe Int
a -> ContainerOverrides
s {$sel:vcpus:ContainerOverrides' :: Maybe Int
vcpus = Maybe Int
a} :: ContainerOverrides)

instance Prelude.Hashable ContainerOverrides

instance Prelude.NFData ContainerOverrides

instance Core.ToJSON ContainerOverrides where
  toJSON :: ContainerOverrides -> Value
toJSON ContainerOverrides' {Maybe Int
Maybe [Text]
Maybe [KeyValuePair]
Maybe [ResourceRequirement]
Maybe Text
vcpus :: Maybe Int
memory :: Maybe Int
instanceType :: Maybe Text
resourceRequirements :: Maybe [ResourceRequirement]
environment :: Maybe [KeyValuePair]
command :: Maybe [Text]
$sel:vcpus:ContainerOverrides' :: ContainerOverrides -> Maybe Int
$sel:memory:ContainerOverrides' :: ContainerOverrides -> Maybe Int
$sel:instanceType:ContainerOverrides' :: ContainerOverrides -> Maybe Text
$sel:resourceRequirements:ContainerOverrides' :: ContainerOverrides -> Maybe [ResourceRequirement]
$sel:environment:ContainerOverrides' :: ContainerOverrides -> Maybe [KeyValuePair]
$sel:command:ContainerOverrides' :: ContainerOverrides -> 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
"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
"instanceType" 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
instanceType,
            (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
"vcpus" 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
vcpus
          ]
      )