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

import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.HealthStatus
import Amazonka.ECS.Types.ManagedAgent
import Amazonka.ECS.Types.NetworkBinding
import Amazonka.ECS.Types.NetworkInterface
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A Docker container that is part of a task.
--
-- /See:/ 'newContainer' smart constructor.
data Container = Container'
  { -- | The IDs of each GPU assigned to the container.
    Container -> Maybe [Text]
gpuIds :: Prelude.Maybe [Prelude.Text],
    -- | The network bindings associated with the container.
    Container -> Maybe [NetworkBinding]
networkBindings :: Prelude.Maybe [NetworkBinding],
    -- | The details of any Amazon ECS managed agents associated with the
    -- container.
    Container -> Maybe [ManagedAgent]
managedAgents :: Prelude.Maybe [ManagedAgent],
    -- | The image used for the container.
    Container -> Maybe Text
image :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the container.
    Container -> Maybe Text
containerArn :: Prelude.Maybe Prelude.Text,
    -- | The network interfaces associated with the container.
    Container -> Maybe [NetworkInterface]
networkInterfaces :: Prelude.Maybe [NetworkInterface],
    -- | The ARN of the task.
    Container -> Maybe Text
taskArn :: Prelude.Maybe Prelude.Text,
    -- | The last known status of the container.
    Container -> Maybe Text
lastStatus :: Prelude.Maybe Prelude.Text,
    -- | The hard limit (in MiB) of memory set for the container.
    Container -> Maybe Text
memory :: Prelude.Maybe Prelude.Text,
    -- | A short (255 max characters) human-readable string to provide additional
    -- details about a running or stopped container.
    Container -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | The name of the container.
    Container -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The container image manifest digest.
    --
    -- The @imageDigest@ is only returned if the container is using an image
    -- hosted in Amazon ECR, otherwise it is omitted.
    Container -> Maybe Text
imageDigest :: Prelude.Maybe Prelude.Text,
    -- | The exit code returned from the container.
    Container -> Maybe Int
exitCode :: Prelude.Maybe Prelude.Int,
    -- | The health status of the container. If health checks are not configured
    -- for this container in its task definition, then it reports the health
    -- status as @UNKNOWN@.
    Container -> Maybe HealthStatus
healthStatus :: Prelude.Maybe HealthStatus,
    -- | The number of CPU units set for the container. The value will be @0@ if
    -- no value was specified in the container definition when the task
    -- definition was registered.
    Container -> Maybe Text
cpu :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Docker container.
    Container -> Maybe Text
runtimeId :: Prelude.Maybe Prelude.Text,
    -- | The soft limit (in MiB) of memory set for the container.
    Container -> Maybe Text
memoryReservation :: Prelude.Maybe Prelude.Text
  }
  deriving (Container -> Container -> Bool
(Container -> Container -> Bool)
-> (Container -> Container -> Bool) -> Eq Container
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Container -> Container -> Bool
$c/= :: Container -> Container -> Bool
== :: Container -> Container -> Bool
$c== :: Container -> Container -> Bool
Prelude.Eq, ReadPrec [Container]
ReadPrec Container
Int -> ReadS Container
ReadS [Container]
(Int -> ReadS Container)
-> ReadS [Container]
-> ReadPrec Container
-> ReadPrec [Container]
-> Read Container
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Container]
$creadListPrec :: ReadPrec [Container]
readPrec :: ReadPrec Container
$creadPrec :: ReadPrec Container
readList :: ReadS [Container]
$creadList :: ReadS [Container]
readsPrec :: Int -> ReadS Container
$creadsPrec :: Int -> ReadS Container
Prelude.Read, Int -> Container -> ShowS
[Container] -> ShowS
Container -> String
(Int -> Container -> ShowS)
-> (Container -> String)
-> ([Container] -> ShowS)
-> Show Container
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Container] -> ShowS
$cshowList :: [Container] -> ShowS
show :: Container -> String
$cshow :: Container -> String
showsPrec :: Int -> Container -> ShowS
$cshowsPrec :: Int -> Container -> ShowS
Prelude.Show, (forall x. Container -> Rep Container x)
-> (forall x. Rep Container x -> Container) -> Generic Container
forall x. Rep Container x -> Container
forall x. Container -> Rep Container x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Container x -> Container
$cfrom :: forall x. Container -> Rep Container x
Prelude.Generic)

-- |
-- Create a value of 'Container' 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:
--
-- 'gpuIds', 'container_gpuIds' - The IDs of each GPU assigned to the container.
--
-- 'networkBindings', 'container_networkBindings' - The network bindings associated with the container.
--
-- 'managedAgents', 'container_managedAgents' - The details of any Amazon ECS managed agents associated with the
-- container.
--
-- 'image', 'container_image' - The image used for the container.
--
-- 'containerArn', 'container_containerArn' - The Amazon Resource Name (ARN) of the container.
--
-- 'networkInterfaces', 'container_networkInterfaces' - The network interfaces associated with the container.
--
-- 'taskArn', 'container_taskArn' - The ARN of the task.
--
-- 'lastStatus', 'container_lastStatus' - The last known status of the container.
--
-- 'memory', 'container_memory' - The hard limit (in MiB) of memory set for the container.
--
-- 'reason', 'container_reason' - A short (255 max characters) human-readable string to provide additional
-- details about a running or stopped container.
--
-- 'name', 'container_name' - The name of the container.
--
-- 'imageDigest', 'container_imageDigest' - The container image manifest digest.
--
-- The @imageDigest@ is only returned if the container is using an image
-- hosted in Amazon ECR, otherwise it is omitted.
--
-- 'exitCode', 'container_exitCode' - The exit code returned from the container.
--
-- 'healthStatus', 'container_healthStatus' - The health status of the container. If health checks are not configured
-- for this container in its task definition, then it reports the health
-- status as @UNKNOWN@.
--
-- 'cpu', 'container_cpu' - The number of CPU units set for the container. The value will be @0@ if
-- no value was specified in the container definition when the task
-- definition was registered.
--
-- 'runtimeId', 'container_runtimeId' - The ID of the Docker container.
--
-- 'memoryReservation', 'container_memoryReservation' - The soft limit (in MiB) of memory set for the container.
newContainer ::
  Container
newContainer :: Container
newContainer =
  Container' :: Maybe [Text]
-> Maybe [NetworkBinding]
-> Maybe [ManagedAgent]
-> Maybe Text
-> Maybe Text
-> Maybe [NetworkInterface]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe HealthStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Container
Container'
    { $sel:gpuIds:Container' :: Maybe [Text]
gpuIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:networkBindings:Container' :: Maybe [NetworkBinding]
networkBindings = Maybe [NetworkBinding]
forall a. Maybe a
Prelude.Nothing,
      $sel:managedAgents:Container' :: Maybe [ManagedAgent]
managedAgents = Maybe [ManagedAgent]
forall a. Maybe a
Prelude.Nothing,
      $sel:image:Container' :: Maybe Text
image = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:containerArn:Container' :: Maybe Text
containerArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:networkInterfaces:Container' :: Maybe [NetworkInterface]
networkInterfaces = Maybe [NetworkInterface]
forall a. Maybe a
Prelude.Nothing,
      $sel:taskArn:Container' :: Maybe Text
taskArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastStatus:Container' :: Maybe Text
lastStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:memory:Container' :: Maybe Text
memory = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reason:Container' :: Maybe Text
reason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Container' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageDigest:Container' :: Maybe Text
imageDigest = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:exitCode:Container' :: Maybe Int
exitCode = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:healthStatus:Container' :: Maybe HealthStatus
healthStatus = Maybe HealthStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:cpu:Container' :: Maybe Text
cpu = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:runtimeId:Container' :: Maybe Text
runtimeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:memoryReservation:Container' :: Maybe Text
memoryReservation = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The IDs of each GPU assigned to the container.
container_gpuIds :: Lens.Lens' Container (Prelude.Maybe [Prelude.Text])
container_gpuIds :: (Maybe [Text] -> f (Maybe [Text])) -> Container -> f Container
container_gpuIds = (Container -> Maybe [Text])
-> (Container -> Maybe [Text] -> Container)
-> Lens Container Container (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe [Text]
gpuIds :: Maybe [Text]
$sel:gpuIds:Container' :: Container -> Maybe [Text]
gpuIds} -> Maybe [Text]
gpuIds) (\s :: Container
s@Container' {} Maybe [Text]
a -> Container
s {$sel:gpuIds:Container' :: Maybe [Text]
gpuIds = Maybe [Text]
a} :: Container) ((Maybe [Text] -> f (Maybe [Text])) -> Container -> f Container)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Container
-> f Container
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 network bindings associated with the container.
container_networkBindings :: Lens.Lens' Container (Prelude.Maybe [NetworkBinding])
container_networkBindings :: (Maybe [NetworkBinding] -> f (Maybe [NetworkBinding]))
-> Container -> f Container
container_networkBindings = (Container -> Maybe [NetworkBinding])
-> (Container -> Maybe [NetworkBinding] -> Container)
-> Lens
     Container
     Container
     (Maybe [NetworkBinding])
     (Maybe [NetworkBinding])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe [NetworkBinding]
networkBindings :: Maybe [NetworkBinding]
$sel:networkBindings:Container' :: Container -> Maybe [NetworkBinding]
networkBindings} -> Maybe [NetworkBinding]
networkBindings) (\s :: Container
s@Container' {} Maybe [NetworkBinding]
a -> Container
s {$sel:networkBindings:Container' :: Maybe [NetworkBinding]
networkBindings = Maybe [NetworkBinding]
a} :: Container) ((Maybe [NetworkBinding] -> f (Maybe [NetworkBinding]))
 -> Container -> f Container)
-> ((Maybe [NetworkBinding] -> f (Maybe [NetworkBinding]))
    -> Maybe [NetworkBinding] -> f (Maybe [NetworkBinding]))
-> (Maybe [NetworkBinding] -> f (Maybe [NetworkBinding]))
-> Container
-> f Container
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NetworkBinding] [NetworkBinding] [NetworkBinding] [NetworkBinding]
-> Iso
     (Maybe [NetworkBinding])
     (Maybe [NetworkBinding])
     (Maybe [NetworkBinding])
     (Maybe [NetworkBinding])
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
  [NetworkBinding] [NetworkBinding] [NetworkBinding] [NetworkBinding]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The details of any Amazon ECS managed agents associated with the
-- container.
container_managedAgents :: Lens.Lens' Container (Prelude.Maybe [ManagedAgent])
container_managedAgents :: (Maybe [ManagedAgent] -> f (Maybe [ManagedAgent]))
-> Container -> f Container
container_managedAgents = (Container -> Maybe [ManagedAgent])
-> (Container -> Maybe [ManagedAgent] -> Container)
-> Lens
     Container Container (Maybe [ManagedAgent]) (Maybe [ManagedAgent])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe [ManagedAgent]
managedAgents :: Maybe [ManagedAgent]
$sel:managedAgents:Container' :: Container -> Maybe [ManagedAgent]
managedAgents} -> Maybe [ManagedAgent]
managedAgents) (\s :: Container
s@Container' {} Maybe [ManagedAgent]
a -> Container
s {$sel:managedAgents:Container' :: Maybe [ManagedAgent]
managedAgents = Maybe [ManagedAgent]
a} :: Container) ((Maybe [ManagedAgent] -> f (Maybe [ManagedAgent]))
 -> Container -> f Container)
-> ((Maybe [ManagedAgent] -> f (Maybe [ManagedAgent]))
    -> Maybe [ManagedAgent] -> f (Maybe [ManagedAgent]))
-> (Maybe [ManagedAgent] -> f (Maybe [ManagedAgent]))
-> Container
-> f Container
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ManagedAgent] [ManagedAgent] [ManagedAgent] [ManagedAgent]
-> Iso
     (Maybe [ManagedAgent])
     (Maybe [ManagedAgent])
     (Maybe [ManagedAgent])
     (Maybe [ManagedAgent])
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 [ManagedAgent] [ManagedAgent] [ManagedAgent] [ManagedAgent]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The image used for the container.
container_image :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_image :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_image = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
image :: Maybe Text
$sel:image:Container' :: Container -> Maybe Text
image} -> Maybe Text
image) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:image:Container' :: Maybe Text
image = Maybe Text
a} :: Container)

-- | The Amazon Resource Name (ARN) of the container.
container_containerArn :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_containerArn :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_containerArn = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
containerArn :: Maybe Text
$sel:containerArn:Container' :: Container -> Maybe Text
containerArn} -> Maybe Text
containerArn) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:containerArn:Container' :: Maybe Text
containerArn = Maybe Text
a} :: Container)

-- | The network interfaces associated with the container.
container_networkInterfaces :: Lens.Lens' Container (Prelude.Maybe [NetworkInterface])
container_networkInterfaces :: (Maybe [NetworkInterface] -> f (Maybe [NetworkInterface]))
-> Container -> f Container
container_networkInterfaces = (Container -> Maybe [NetworkInterface])
-> (Container -> Maybe [NetworkInterface] -> Container)
-> Lens
     Container
     Container
     (Maybe [NetworkInterface])
     (Maybe [NetworkInterface])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe [NetworkInterface]
networkInterfaces :: Maybe [NetworkInterface]
$sel:networkInterfaces:Container' :: Container -> Maybe [NetworkInterface]
networkInterfaces} -> Maybe [NetworkInterface]
networkInterfaces) (\s :: Container
s@Container' {} Maybe [NetworkInterface]
a -> Container
s {$sel:networkInterfaces:Container' :: Maybe [NetworkInterface]
networkInterfaces = Maybe [NetworkInterface]
a} :: Container) ((Maybe [NetworkInterface] -> f (Maybe [NetworkInterface]))
 -> Container -> f Container)
-> ((Maybe [NetworkInterface] -> f (Maybe [NetworkInterface]))
    -> Maybe [NetworkInterface] -> f (Maybe [NetworkInterface]))
-> (Maybe [NetworkInterface] -> f (Maybe [NetworkInterface]))
-> Container
-> f Container
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NetworkInterface]
  [NetworkInterface]
  [NetworkInterface]
  [NetworkInterface]
-> Iso
     (Maybe [NetworkInterface])
     (Maybe [NetworkInterface])
     (Maybe [NetworkInterface])
     (Maybe [NetworkInterface])
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
  [NetworkInterface]
  [NetworkInterface]
  [NetworkInterface]
  [NetworkInterface]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN of the task.
container_taskArn :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_taskArn :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_taskArn = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
taskArn :: Maybe Text
$sel:taskArn:Container' :: Container -> Maybe Text
taskArn} -> Maybe Text
taskArn) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:taskArn:Container' :: Maybe Text
taskArn = Maybe Text
a} :: Container)

-- | The last known status of the container.
container_lastStatus :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_lastStatus :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_lastStatus = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
lastStatus :: Maybe Text
$sel:lastStatus:Container' :: Container -> Maybe Text
lastStatus} -> Maybe Text
lastStatus) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:lastStatus:Container' :: Maybe Text
lastStatus = Maybe Text
a} :: Container)

-- | The hard limit (in MiB) of memory set for the container.
container_memory :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_memory :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_memory = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
memory :: Maybe Text
$sel:memory:Container' :: Container -> Maybe Text
memory} -> Maybe Text
memory) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:memory:Container' :: Maybe Text
memory = Maybe Text
a} :: Container)

-- | A short (255 max characters) human-readable string to provide additional
-- details about a running or stopped container.
container_reason :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_reason :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_reason = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
reason :: Maybe Text
$sel:reason:Container' :: Container -> Maybe Text
reason} -> Maybe Text
reason) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:reason:Container' :: Maybe Text
reason = Maybe Text
a} :: Container)

-- | The name of the container.
container_name :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_name :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_name = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
name :: Maybe Text
$sel:name:Container' :: Container -> Maybe Text
name} -> Maybe Text
name) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:name:Container' :: Maybe Text
name = Maybe Text
a} :: Container)

-- | The container image manifest digest.
--
-- The @imageDigest@ is only returned if the container is using an image
-- hosted in Amazon ECR, otherwise it is omitted.
container_imageDigest :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_imageDigest :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_imageDigest = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
imageDigest :: Maybe Text
$sel:imageDigest:Container' :: Container -> Maybe Text
imageDigest} -> Maybe Text
imageDigest) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:imageDigest:Container' :: Maybe Text
imageDigest = Maybe Text
a} :: Container)

-- | The exit code returned from the container.
container_exitCode :: Lens.Lens' Container (Prelude.Maybe Prelude.Int)
container_exitCode :: (Maybe Int -> f (Maybe Int)) -> Container -> f Container
container_exitCode = (Container -> Maybe Int)
-> (Container -> Maybe Int -> Container)
-> Lens Container Container (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Int
exitCode :: Maybe Int
$sel:exitCode:Container' :: Container -> Maybe Int
exitCode} -> Maybe Int
exitCode) (\s :: Container
s@Container' {} Maybe Int
a -> Container
s {$sel:exitCode:Container' :: Maybe Int
exitCode = Maybe Int
a} :: Container)

-- | The health status of the container. If health checks are not configured
-- for this container in its task definition, then it reports the health
-- status as @UNKNOWN@.
container_healthStatus :: Lens.Lens' Container (Prelude.Maybe HealthStatus)
container_healthStatus :: (Maybe HealthStatus -> f (Maybe HealthStatus))
-> Container -> f Container
container_healthStatus = (Container -> Maybe HealthStatus)
-> (Container -> Maybe HealthStatus -> Container)
-> Lens
     Container Container (Maybe HealthStatus) (Maybe HealthStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe HealthStatus
healthStatus :: Maybe HealthStatus
$sel:healthStatus:Container' :: Container -> Maybe HealthStatus
healthStatus} -> Maybe HealthStatus
healthStatus) (\s :: Container
s@Container' {} Maybe HealthStatus
a -> Container
s {$sel:healthStatus:Container' :: Maybe HealthStatus
healthStatus = Maybe HealthStatus
a} :: Container)

-- | The number of CPU units set for the container. The value will be @0@ if
-- no value was specified in the container definition when the task
-- definition was registered.
container_cpu :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_cpu :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_cpu = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
cpu :: Maybe Text
$sel:cpu:Container' :: Container -> Maybe Text
cpu} -> Maybe Text
cpu) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:cpu:Container' :: Maybe Text
cpu = Maybe Text
a} :: Container)

-- | The ID of the Docker container.
container_runtimeId :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_runtimeId :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_runtimeId = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
runtimeId :: Maybe Text
$sel:runtimeId:Container' :: Container -> Maybe Text
runtimeId} -> Maybe Text
runtimeId) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:runtimeId:Container' :: Maybe Text
runtimeId = Maybe Text
a} :: Container)

-- | The soft limit (in MiB) of memory set for the container.
container_memoryReservation :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_memoryReservation :: (Maybe Text -> f (Maybe Text)) -> Container -> f Container
container_memoryReservation = (Container -> Maybe Text)
-> (Container -> Maybe Text -> Container)
-> Lens Container Container (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
memoryReservation :: Maybe Text
$sel:memoryReservation:Container' :: Container -> Maybe Text
memoryReservation} -> Maybe Text
memoryReservation) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:memoryReservation:Container' :: Maybe Text
memoryReservation = Maybe Text
a} :: Container)

instance Core.FromJSON Container where
  parseJSON :: Value -> Parser Container
parseJSON =
    String -> (Object -> Parser Container) -> Value -> Parser Container
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Container"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [NetworkBinding]
-> Maybe [ManagedAgent]
-> Maybe Text
-> Maybe Text
-> Maybe [NetworkInterface]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe HealthStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Container
Container'
            (Maybe [Text]
 -> Maybe [NetworkBinding]
 -> Maybe [ManagedAgent]
 -> Maybe Text
 -> Maybe Text
 -> Maybe [NetworkInterface]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe HealthStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Container)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [NetworkBinding]
      -> Maybe [ManagedAgent]
      -> Maybe Text
      -> Maybe Text
      -> Maybe [NetworkInterface]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
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
"gpuIds" 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 [NetworkBinding]
   -> Maybe [ManagedAgent]
   -> Maybe Text
   -> Maybe Text
   -> Maybe [NetworkInterface]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe [NetworkBinding])
-> Parser
     (Maybe [ManagedAgent]
      -> Maybe Text
      -> Maybe Text
      -> Maybe [NetworkInterface]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [NetworkBinding]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"networkBindings"
                            Parser (Maybe (Maybe [NetworkBinding]))
-> Maybe [NetworkBinding] -> Parser (Maybe [NetworkBinding])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [NetworkBinding]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [ManagedAgent]
   -> Maybe Text
   -> Maybe Text
   -> Maybe [NetworkInterface]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe [ManagedAgent])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [NetworkInterface]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [ManagedAgent]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"managedAgents" Parser (Maybe (Maybe [ManagedAgent]))
-> Maybe [ManagedAgent] -> Parser (Maybe [ManagedAgent])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ManagedAgent]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [NetworkInterface]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [NetworkInterface]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
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
"image")
            Parser
  (Maybe Text
   -> Maybe [NetworkInterface]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe Text)
-> Parser
     (Maybe [NetworkInterface]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
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
"containerArn")
            Parser
  (Maybe [NetworkInterface]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe [NetworkInterface])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [NetworkInterface]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"networkInterfaces"
                            Parser (Maybe (Maybe [NetworkInterface]))
-> Maybe [NetworkInterface] -> Parser (Maybe [NetworkInterface])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [NetworkInterface]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
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
"taskArn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
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
"lastStatus")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
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 Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
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
"reason")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
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 Text
   -> Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe HealthStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Container)
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
"imageDigest")
            Parser
  (Maybe Int
   -> Maybe HealthStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Container)
-> Parser (Maybe Int)
-> Parser
     (Maybe HealthStatus
      -> Maybe Text -> Maybe Text -> Maybe Text -> Container)
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
"exitCode")
            Parser
  (Maybe HealthStatus
   -> Maybe Text -> Maybe Text -> Maybe Text -> Container)
-> Parser (Maybe HealthStatus)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Container)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HealthStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"healthStatus")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> Container)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Container)
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")
            Parser (Maybe Text -> Maybe Text -> Container)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Container)
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
"runtimeId")
            Parser (Maybe Text -> Container)
-> Parser (Maybe Text) -> Parser Container
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
"memoryReservation")
      )

instance Prelude.Hashable Container

instance Prelude.NFData Container