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

import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.ContainerOverride
import Amazonka.ECS.Types.EphemeralStorage
import Amazonka.ECS.Types.InferenceAcceleratorOverride
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The overrides associated with a task.
--
-- /See:/ 'newTaskOverride' smart constructor.
data TaskOverride = TaskOverride'
  { -- | One or more container overrides sent to a task.
    TaskOverride -> Maybe [ContainerOverride]
containerOverrides :: Prelude.Maybe [ContainerOverride],
    -- | The Amazon Resource Name (ARN) of the task execution IAM role override
    -- for the task. For more information, see
    -- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html Amazon ECS task execution IAM role>
    -- in the /Amazon Elastic Container Service Developer Guide/.
    TaskOverride -> Maybe Text
executionRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The ephemeral storage setting override for the task.
    --
    -- This parameter is only supported for tasks hosted on Fargate using
    -- platform version @1.4.0@ or later.
    TaskOverride -> Maybe EphemeralStorage
ephemeralStorage :: Prelude.Maybe EphemeralStorage,
    -- | The memory override for the task.
    TaskOverride -> Maybe Text
memory :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role that containers in this
    -- task can assume. All containers in this task are granted the permissions
    -- that are specified in this role. For more information, see
    -- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html IAM Role for Tasks>
    -- in the /Amazon Elastic Container Service Developer Guide/.
    TaskOverride -> Maybe Text
taskRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The Elastic Inference accelerator override for the task.
    TaskOverride -> Maybe [InferenceAcceleratorOverride]
inferenceAcceleratorOverrides :: Prelude.Maybe [InferenceAcceleratorOverride],
    -- | The cpu override for the task.
    TaskOverride -> Maybe Text
cpu :: Prelude.Maybe Prelude.Text
  }
  deriving (TaskOverride -> TaskOverride -> Bool
(TaskOverride -> TaskOverride -> Bool)
-> (TaskOverride -> TaskOverride -> Bool) -> Eq TaskOverride
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskOverride -> TaskOverride -> Bool
$c/= :: TaskOverride -> TaskOverride -> Bool
== :: TaskOverride -> TaskOverride -> Bool
$c== :: TaskOverride -> TaskOverride -> Bool
Prelude.Eq, ReadPrec [TaskOverride]
ReadPrec TaskOverride
Int -> ReadS TaskOverride
ReadS [TaskOverride]
(Int -> ReadS TaskOverride)
-> ReadS [TaskOverride]
-> ReadPrec TaskOverride
-> ReadPrec [TaskOverride]
-> Read TaskOverride
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TaskOverride]
$creadListPrec :: ReadPrec [TaskOverride]
readPrec :: ReadPrec TaskOverride
$creadPrec :: ReadPrec TaskOverride
readList :: ReadS [TaskOverride]
$creadList :: ReadS [TaskOverride]
readsPrec :: Int -> ReadS TaskOverride
$creadsPrec :: Int -> ReadS TaskOverride
Prelude.Read, Int -> TaskOverride -> ShowS
[TaskOverride] -> ShowS
TaskOverride -> String
(Int -> TaskOverride -> ShowS)
-> (TaskOverride -> String)
-> ([TaskOverride] -> ShowS)
-> Show TaskOverride
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskOverride] -> ShowS
$cshowList :: [TaskOverride] -> ShowS
show :: TaskOverride -> String
$cshow :: TaskOverride -> String
showsPrec :: Int -> TaskOverride -> ShowS
$cshowsPrec :: Int -> TaskOverride -> ShowS
Prelude.Show, (forall x. TaskOverride -> Rep TaskOverride x)
-> (forall x. Rep TaskOverride x -> TaskOverride)
-> Generic TaskOverride
forall x. Rep TaskOverride x -> TaskOverride
forall x. TaskOverride -> Rep TaskOverride x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TaskOverride x -> TaskOverride
$cfrom :: forall x. TaskOverride -> Rep TaskOverride x
Prelude.Generic)

-- |
-- Create a value of 'TaskOverride' 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:
--
-- 'containerOverrides', 'taskOverride_containerOverrides' - One or more container overrides sent to a task.
--
-- 'executionRoleArn', 'taskOverride_executionRoleArn' - The Amazon Resource Name (ARN) of the task execution IAM role override
-- for the task. For more information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html Amazon ECS task execution IAM role>
-- in the /Amazon Elastic Container Service Developer Guide/.
--
-- 'ephemeralStorage', 'taskOverride_ephemeralStorage' - The ephemeral storage setting override for the task.
--
-- This parameter is only supported for tasks hosted on Fargate using
-- platform version @1.4.0@ or later.
--
-- 'memory', 'taskOverride_memory' - The memory override for the task.
--
-- 'taskRoleArn', 'taskOverride_taskRoleArn' - The Amazon Resource Name (ARN) of the IAM role that containers in this
-- task can assume. All containers in this task are granted the permissions
-- that are specified in this role. For more information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html IAM Role for Tasks>
-- in the /Amazon Elastic Container Service Developer Guide/.
--
-- 'inferenceAcceleratorOverrides', 'taskOverride_inferenceAcceleratorOverrides' - The Elastic Inference accelerator override for the task.
--
-- 'cpu', 'taskOverride_cpu' - The cpu override for the task.
newTaskOverride ::
  TaskOverride
newTaskOverride :: TaskOverride
newTaskOverride =
  TaskOverride' :: Maybe [ContainerOverride]
-> Maybe Text
-> Maybe EphemeralStorage
-> Maybe Text
-> Maybe Text
-> Maybe [InferenceAcceleratorOverride]
-> Maybe Text
-> TaskOverride
TaskOverride'
    { $sel:containerOverrides:TaskOverride' :: Maybe [ContainerOverride]
containerOverrides = Maybe [ContainerOverride]
forall a. Maybe a
Prelude.Nothing,
      $sel:executionRoleArn:TaskOverride' :: Maybe Text
executionRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ephemeralStorage:TaskOverride' :: Maybe EphemeralStorage
ephemeralStorage = Maybe EphemeralStorage
forall a. Maybe a
Prelude.Nothing,
      $sel:memory:TaskOverride' :: Maybe Text
memory = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:taskRoleArn:TaskOverride' :: Maybe Text
taskRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inferenceAcceleratorOverrides:TaskOverride' :: Maybe [InferenceAcceleratorOverride]
inferenceAcceleratorOverrides = Maybe [InferenceAcceleratorOverride]
forall a. Maybe a
Prelude.Nothing,
      $sel:cpu:TaskOverride' :: Maybe Text
cpu = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | One or more container overrides sent to a task.
taskOverride_containerOverrides :: Lens.Lens' TaskOverride (Prelude.Maybe [ContainerOverride])
taskOverride_containerOverrides :: (Maybe [ContainerOverride] -> f (Maybe [ContainerOverride]))
-> TaskOverride -> f TaskOverride
taskOverride_containerOverrides = (TaskOverride -> Maybe [ContainerOverride])
-> (TaskOverride -> Maybe [ContainerOverride] -> TaskOverride)
-> Lens
     TaskOverride
     TaskOverride
     (Maybe [ContainerOverride])
     (Maybe [ContainerOverride])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskOverride' {Maybe [ContainerOverride]
containerOverrides :: Maybe [ContainerOverride]
$sel:containerOverrides:TaskOverride' :: TaskOverride -> Maybe [ContainerOverride]
containerOverrides} -> Maybe [ContainerOverride]
containerOverrides) (\s :: TaskOverride
s@TaskOverride' {} Maybe [ContainerOverride]
a -> TaskOverride
s {$sel:containerOverrides:TaskOverride' :: Maybe [ContainerOverride]
containerOverrides = Maybe [ContainerOverride]
a} :: TaskOverride) ((Maybe [ContainerOverride] -> f (Maybe [ContainerOverride]))
 -> TaskOverride -> f TaskOverride)
-> ((Maybe [ContainerOverride] -> f (Maybe [ContainerOverride]))
    -> Maybe [ContainerOverride] -> f (Maybe [ContainerOverride]))
-> (Maybe [ContainerOverride] -> f (Maybe [ContainerOverride]))
-> TaskOverride
-> f TaskOverride
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ContainerOverride]
  [ContainerOverride]
  [ContainerOverride]
  [ContainerOverride]
-> Iso
     (Maybe [ContainerOverride])
     (Maybe [ContainerOverride])
     (Maybe [ContainerOverride])
     (Maybe [ContainerOverride])
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
  [ContainerOverride]
  [ContainerOverride]
  [ContainerOverride]
  [ContainerOverride]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the task execution IAM role override
-- for the task. For more information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html Amazon ECS task execution IAM role>
-- in the /Amazon Elastic Container Service Developer Guide/.
taskOverride_executionRoleArn :: Lens.Lens' TaskOverride (Prelude.Maybe Prelude.Text)
taskOverride_executionRoleArn :: (Maybe Text -> f (Maybe Text)) -> TaskOverride -> f TaskOverride
taskOverride_executionRoleArn = (TaskOverride -> Maybe Text)
-> (TaskOverride -> Maybe Text -> TaskOverride)
-> Lens TaskOverride TaskOverride (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskOverride' {Maybe Text
executionRoleArn :: Maybe Text
$sel:executionRoleArn:TaskOverride' :: TaskOverride -> Maybe Text
executionRoleArn} -> Maybe Text
executionRoleArn) (\s :: TaskOverride
s@TaskOverride' {} Maybe Text
a -> TaskOverride
s {$sel:executionRoleArn:TaskOverride' :: Maybe Text
executionRoleArn = Maybe Text
a} :: TaskOverride)

-- | The ephemeral storage setting override for the task.
--
-- This parameter is only supported for tasks hosted on Fargate using
-- platform version @1.4.0@ or later.
taskOverride_ephemeralStorage :: Lens.Lens' TaskOverride (Prelude.Maybe EphemeralStorage)
taskOverride_ephemeralStorage :: (Maybe EphemeralStorage -> f (Maybe EphemeralStorage))
-> TaskOverride -> f TaskOverride
taskOverride_ephemeralStorage = (TaskOverride -> Maybe EphemeralStorage)
-> (TaskOverride -> Maybe EphemeralStorage -> TaskOverride)
-> Lens
     TaskOverride
     TaskOverride
     (Maybe EphemeralStorage)
     (Maybe EphemeralStorage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskOverride' {Maybe EphemeralStorage
ephemeralStorage :: Maybe EphemeralStorage
$sel:ephemeralStorage:TaskOverride' :: TaskOverride -> Maybe EphemeralStorage
ephemeralStorage} -> Maybe EphemeralStorage
ephemeralStorage) (\s :: TaskOverride
s@TaskOverride' {} Maybe EphemeralStorage
a -> TaskOverride
s {$sel:ephemeralStorage:TaskOverride' :: Maybe EphemeralStorage
ephemeralStorage = Maybe EphemeralStorage
a} :: TaskOverride)

-- | The memory override for the task.
taskOverride_memory :: Lens.Lens' TaskOverride (Prelude.Maybe Prelude.Text)
taskOverride_memory :: (Maybe Text -> f (Maybe Text)) -> TaskOverride -> f TaskOverride
taskOverride_memory = (TaskOverride -> Maybe Text)
-> (TaskOverride -> Maybe Text -> TaskOverride)
-> Lens TaskOverride TaskOverride (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskOverride' {Maybe Text
memory :: Maybe Text
$sel:memory:TaskOverride' :: TaskOverride -> Maybe Text
memory} -> Maybe Text
memory) (\s :: TaskOverride
s@TaskOverride' {} Maybe Text
a -> TaskOverride
s {$sel:memory:TaskOverride' :: Maybe Text
memory = Maybe Text
a} :: TaskOverride)

-- | The Amazon Resource Name (ARN) of the IAM role that containers in this
-- task can assume. All containers in this task are granted the permissions
-- that are specified in this role. For more information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html IAM Role for Tasks>
-- in the /Amazon Elastic Container Service Developer Guide/.
taskOverride_taskRoleArn :: Lens.Lens' TaskOverride (Prelude.Maybe Prelude.Text)
taskOverride_taskRoleArn :: (Maybe Text -> f (Maybe Text)) -> TaskOverride -> f TaskOverride
taskOverride_taskRoleArn = (TaskOverride -> Maybe Text)
-> (TaskOverride -> Maybe Text -> TaskOverride)
-> Lens TaskOverride TaskOverride (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskOverride' {Maybe Text
taskRoleArn :: Maybe Text
$sel:taskRoleArn:TaskOverride' :: TaskOverride -> Maybe Text
taskRoleArn} -> Maybe Text
taskRoleArn) (\s :: TaskOverride
s@TaskOverride' {} Maybe Text
a -> TaskOverride
s {$sel:taskRoleArn:TaskOverride' :: Maybe Text
taskRoleArn = Maybe Text
a} :: TaskOverride)

-- | The Elastic Inference accelerator override for the task.
taskOverride_inferenceAcceleratorOverrides :: Lens.Lens' TaskOverride (Prelude.Maybe [InferenceAcceleratorOverride])
taskOverride_inferenceAcceleratorOverrides :: (Maybe [InferenceAcceleratorOverride]
 -> f (Maybe [InferenceAcceleratorOverride]))
-> TaskOverride -> f TaskOverride
taskOverride_inferenceAcceleratorOverrides = (TaskOverride -> Maybe [InferenceAcceleratorOverride])
-> (TaskOverride
    -> Maybe [InferenceAcceleratorOverride] -> TaskOverride)
-> Lens
     TaskOverride
     TaskOverride
     (Maybe [InferenceAcceleratorOverride])
     (Maybe [InferenceAcceleratorOverride])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskOverride' {Maybe [InferenceAcceleratorOverride]
inferenceAcceleratorOverrides :: Maybe [InferenceAcceleratorOverride]
$sel:inferenceAcceleratorOverrides:TaskOverride' :: TaskOverride -> Maybe [InferenceAcceleratorOverride]
inferenceAcceleratorOverrides} -> Maybe [InferenceAcceleratorOverride]
inferenceAcceleratorOverrides) (\s :: TaskOverride
s@TaskOverride' {} Maybe [InferenceAcceleratorOverride]
a -> TaskOverride
s {$sel:inferenceAcceleratorOverrides:TaskOverride' :: Maybe [InferenceAcceleratorOverride]
inferenceAcceleratorOverrides = Maybe [InferenceAcceleratorOverride]
a} :: TaskOverride) ((Maybe [InferenceAcceleratorOverride]
  -> f (Maybe [InferenceAcceleratorOverride]))
 -> TaskOverride -> f TaskOverride)
-> ((Maybe [InferenceAcceleratorOverride]
     -> f (Maybe [InferenceAcceleratorOverride]))
    -> Maybe [InferenceAcceleratorOverride]
    -> f (Maybe [InferenceAcceleratorOverride]))
-> (Maybe [InferenceAcceleratorOverride]
    -> f (Maybe [InferenceAcceleratorOverride]))
-> TaskOverride
-> f TaskOverride
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InferenceAcceleratorOverride]
  [InferenceAcceleratorOverride]
  [InferenceAcceleratorOverride]
  [InferenceAcceleratorOverride]
-> Iso
     (Maybe [InferenceAcceleratorOverride])
     (Maybe [InferenceAcceleratorOverride])
     (Maybe [InferenceAcceleratorOverride])
     (Maybe [InferenceAcceleratorOverride])
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
  [InferenceAcceleratorOverride]
  [InferenceAcceleratorOverride]
  [InferenceAcceleratorOverride]
  [InferenceAcceleratorOverride]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The cpu override for the task.
taskOverride_cpu :: Lens.Lens' TaskOverride (Prelude.Maybe Prelude.Text)
taskOverride_cpu :: (Maybe Text -> f (Maybe Text)) -> TaskOverride -> f TaskOverride
taskOverride_cpu = (TaskOverride -> Maybe Text)
-> (TaskOverride -> Maybe Text -> TaskOverride)
-> Lens TaskOverride TaskOverride (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskOverride' {Maybe Text
cpu :: Maybe Text
$sel:cpu:TaskOverride' :: TaskOverride -> Maybe Text
cpu} -> Maybe Text
cpu) (\s :: TaskOverride
s@TaskOverride' {} Maybe Text
a -> TaskOverride
s {$sel:cpu:TaskOverride' :: Maybe Text
cpu = Maybe Text
a} :: TaskOverride)

instance Core.FromJSON TaskOverride where
  parseJSON :: Value -> Parser TaskOverride
parseJSON =
    String
-> (Object -> Parser TaskOverride) -> Value -> Parser TaskOverride
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TaskOverride"
      ( \Object
x ->
          Maybe [ContainerOverride]
-> Maybe Text
-> Maybe EphemeralStorage
-> Maybe Text
-> Maybe Text
-> Maybe [InferenceAcceleratorOverride]
-> Maybe Text
-> TaskOverride
TaskOverride'
            (Maybe [ContainerOverride]
 -> Maybe Text
 -> Maybe EphemeralStorage
 -> Maybe Text
 -> Maybe Text
 -> Maybe [InferenceAcceleratorOverride]
 -> Maybe Text
 -> TaskOverride)
-> Parser (Maybe [ContainerOverride])
-> Parser
     (Maybe Text
      -> Maybe EphemeralStorage
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InferenceAcceleratorOverride]
      -> Maybe Text
      -> TaskOverride)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ContainerOverride]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"containerOverrides"
                            Parser (Maybe (Maybe [ContainerOverride]))
-> Maybe [ContainerOverride] -> Parser (Maybe [ContainerOverride])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ContainerOverride]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe EphemeralStorage
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InferenceAcceleratorOverride]
   -> Maybe Text
   -> TaskOverride)
-> Parser (Maybe Text)
-> Parser
     (Maybe EphemeralStorage
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InferenceAcceleratorOverride]
      -> Maybe Text
      -> TaskOverride)
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
"executionRoleArn")
            Parser
  (Maybe EphemeralStorage
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InferenceAcceleratorOverride]
   -> Maybe Text
   -> TaskOverride)
-> Parser (Maybe EphemeralStorage)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [InferenceAcceleratorOverride]
      -> Maybe Text
      -> TaskOverride)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EphemeralStorage)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ephemeralStorage")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [InferenceAcceleratorOverride]
   -> Maybe Text
   -> TaskOverride)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [InferenceAcceleratorOverride]
      -> Maybe Text
      -> TaskOverride)
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
"memory")
            Parser
  (Maybe Text
   -> Maybe [InferenceAcceleratorOverride]
   -> Maybe Text
   -> TaskOverride)
-> Parser (Maybe Text)
-> Parser
     (Maybe [InferenceAcceleratorOverride]
      -> Maybe Text -> TaskOverride)
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
"taskRoleArn")
            Parser
  (Maybe [InferenceAcceleratorOverride]
   -> Maybe Text -> TaskOverride)
-> Parser (Maybe [InferenceAcceleratorOverride])
-> Parser (Maybe Text -> TaskOverride)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [InferenceAcceleratorOverride]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inferenceAcceleratorOverrides"
                            Parser (Maybe (Maybe [InferenceAcceleratorOverride]))
-> Maybe [InferenceAcceleratorOverride]
-> Parser (Maybe [InferenceAcceleratorOverride])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [InferenceAcceleratorOverride]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> TaskOverride)
-> Parser (Maybe Text) -> Parser TaskOverride
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
"cpu")
      )

instance Prelude.Hashable TaskOverride

instance Prelude.NFData TaskOverride

instance Core.ToJSON TaskOverride where
  toJSON :: TaskOverride -> Value
toJSON TaskOverride' {Maybe [InferenceAcceleratorOverride]
Maybe [ContainerOverride]
Maybe Text
Maybe EphemeralStorage
cpu :: Maybe Text
inferenceAcceleratorOverrides :: Maybe [InferenceAcceleratorOverride]
taskRoleArn :: Maybe Text
memory :: Maybe Text
ephemeralStorage :: Maybe EphemeralStorage
executionRoleArn :: Maybe Text
containerOverrides :: Maybe [ContainerOverride]
$sel:cpu:TaskOverride' :: TaskOverride -> Maybe Text
$sel:inferenceAcceleratorOverrides:TaskOverride' :: TaskOverride -> Maybe [InferenceAcceleratorOverride]
$sel:taskRoleArn:TaskOverride' :: TaskOverride -> Maybe Text
$sel:memory:TaskOverride' :: TaskOverride -> Maybe Text
$sel:ephemeralStorage:TaskOverride' :: TaskOverride -> Maybe EphemeralStorage
$sel:executionRoleArn:TaskOverride' :: TaskOverride -> Maybe Text
$sel:containerOverrides:TaskOverride' :: TaskOverride -> Maybe [ContainerOverride]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"containerOverrides" Text -> [ContainerOverride] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ContainerOverride] -> Pair)
-> Maybe [ContainerOverride] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ContainerOverride]
containerOverrides,
            (Text
"executionRoleArn" 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
executionRoleArn,
            (Text
"ephemeralStorage" Text -> EphemeralStorage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EphemeralStorage -> Pair) -> Maybe EphemeralStorage -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EphemeralStorage
ephemeralStorage,
            (Text
"memory" 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
memory,
            (Text
"taskRoleArn" 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
taskRoleArn,
            (Text
"inferenceAcceleratorOverrides" Text -> [InferenceAcceleratorOverride] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([InferenceAcceleratorOverride] -> Pair)
-> Maybe [InferenceAcceleratorOverride] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InferenceAcceleratorOverride]
inferenceAcceleratorOverrides,
            (Text
"cpu" 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
cpu
          ]
      )