{-# 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.SageMaker.Types.ContainerDefinition
-- 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.SageMaker.Types.ContainerDefinition where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.ContainerMode
import Amazonka.SageMaker.Types.ImageConfig
import Amazonka.SageMaker.Types.MultiModelConfig

-- | Describes the container, as part of model definition.
--
-- /See:/ 'newContainerDefinition' smart constructor.
data ContainerDefinition = ContainerDefinition'
  { -- | Specifies additional configuration for multi-model endpoints.
    ContainerDefinition -> Maybe MultiModelConfig
multiModelConfig :: Prelude.Maybe MultiModelConfig,
    -- | The S3 path where the model artifacts, which result from model training,
    -- are stored. This path must point to a single gzip compressed tar archive
    -- (.tar.gz suffix). The S3 path is required for Amazon SageMaker built-in
    -- algorithms, but not if you use your own algorithms. For more information
    -- on built-in algorithms, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-algo-docker-registry-paths.html Common Parameters>.
    --
    -- The model artifacts must be in an S3 bucket that is in the same region
    -- as the model or endpoint you are creating.
    --
    -- If you provide a value for this parameter, Amazon SageMaker uses Amazon
    -- Web Services Security Token Service to download model artifacts from the
    -- S3 path you provide. Amazon Web Services STS is activated in your IAM
    -- user account by default. If you previously deactivated Amazon Web
    -- Services STS for a region, you need to reactivate Amazon Web Services
    -- STS for that region. For more information, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html Activating and Deactivating Amazon Web Services STS in an Amazon Web Services Region>
    -- in the /Amazon Web Services Identity and Access Management User Guide/.
    --
    -- If you use a built-in algorithm to create a model, Amazon SageMaker
    -- requires that you provide a S3 path to the model artifacts in
    -- @ModelDataUrl@.
    ContainerDefinition -> Maybe Text
modelDataUrl :: Prelude.Maybe Prelude.Text,
    -- | The path where inference code is stored. This can be either in Amazon
    -- EC2 Container Registry or in a Docker registry that is accessible from
    -- the same VPC that you configure for your endpoint. If you are using your
    -- own custom algorithm instead of an algorithm provided by Amazon
    -- SageMaker, the inference code must meet Amazon SageMaker requirements.
    -- Amazon SageMaker supports both @registry\/repository[:tag]@ and
    -- @registry\/repository[\@digest]@ image path formats. For more
    -- information, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms.html Using Your Own Algorithms with Amazon SageMaker>
    ContainerDefinition -> Maybe Text
image :: Prelude.Maybe Prelude.Text,
    -- | The name or Amazon Resource Name (ARN) of the model package to use to
    -- create the model.
    ContainerDefinition -> Maybe Text
modelPackageName :: Prelude.Maybe Prelude.Text,
    -- | The environment variables to set in the Docker container. Each key and
    -- value in the @Environment@ string to string map can have length of up to
    -- 1024. We support up to 16 entries in the map.
    ContainerDefinition -> Maybe (HashMap Text Text)
environment :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Specifies whether the model container is in Amazon ECR or a private
    -- Docker registry accessible from your Amazon Virtual Private Cloud (VPC).
    -- For information about storing containers in a private Docker registry,
    -- see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-containers-inference-private.html Use a Private Docker Registry for Real-Time Inference Containers>
    ContainerDefinition -> Maybe ImageConfig
imageConfig :: Prelude.Maybe ImageConfig,
    -- | Whether the container hosts a single model or multiple models.
    ContainerDefinition -> Maybe ContainerMode
mode :: Prelude.Maybe ContainerMode,
    -- | This parameter is ignored for models that contain only a
    -- @PrimaryContainer@.
    --
    -- When a @ContainerDefinition@ is part of an inference pipeline, the value
    -- of the parameter uniquely identifies the container for the purposes of
    -- logging and metrics. For information, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/inference-pipeline-logs-metrics.html Use Logs and Metrics to Monitor an Inference Pipeline>.
    -- If you don\'t specify a value for this parameter for a
    -- @ContainerDefinition@ that is part of an inference pipeline, a unique
    -- name is automatically assigned based on the position of the
    -- @ContainerDefinition@ in the pipeline. If you specify a value for the
    -- @ContainerHostName@ for any @ContainerDefinition@ that is part of an
    -- inference pipeline, you must specify a value for the @ContainerHostName@
    -- parameter of every @ContainerDefinition@ in that pipeline.
    ContainerDefinition -> Maybe Text
containerHostname :: Prelude.Maybe Prelude.Text
  }
  deriving (ContainerDefinition -> ContainerDefinition -> Bool
(ContainerDefinition -> ContainerDefinition -> Bool)
-> (ContainerDefinition -> ContainerDefinition -> Bool)
-> Eq ContainerDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerDefinition -> ContainerDefinition -> Bool
$c/= :: ContainerDefinition -> ContainerDefinition -> Bool
== :: ContainerDefinition -> ContainerDefinition -> Bool
$c== :: ContainerDefinition -> ContainerDefinition -> Bool
Prelude.Eq, ReadPrec [ContainerDefinition]
ReadPrec ContainerDefinition
Int -> ReadS ContainerDefinition
ReadS [ContainerDefinition]
(Int -> ReadS ContainerDefinition)
-> ReadS [ContainerDefinition]
-> ReadPrec ContainerDefinition
-> ReadPrec [ContainerDefinition]
-> Read ContainerDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerDefinition]
$creadListPrec :: ReadPrec [ContainerDefinition]
readPrec :: ReadPrec ContainerDefinition
$creadPrec :: ReadPrec ContainerDefinition
readList :: ReadS [ContainerDefinition]
$creadList :: ReadS [ContainerDefinition]
readsPrec :: Int -> ReadS ContainerDefinition
$creadsPrec :: Int -> ReadS ContainerDefinition
Prelude.Read, Int -> ContainerDefinition -> ShowS
[ContainerDefinition] -> ShowS
ContainerDefinition -> String
(Int -> ContainerDefinition -> ShowS)
-> (ContainerDefinition -> String)
-> ([ContainerDefinition] -> ShowS)
-> Show ContainerDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerDefinition] -> ShowS
$cshowList :: [ContainerDefinition] -> ShowS
show :: ContainerDefinition -> String
$cshow :: ContainerDefinition -> String
showsPrec :: Int -> ContainerDefinition -> ShowS
$cshowsPrec :: Int -> ContainerDefinition -> ShowS
Prelude.Show, (forall x. ContainerDefinition -> Rep ContainerDefinition x)
-> (forall x. Rep ContainerDefinition x -> ContainerDefinition)
-> Generic ContainerDefinition
forall x. Rep ContainerDefinition x -> ContainerDefinition
forall x. ContainerDefinition -> Rep ContainerDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContainerDefinition x -> ContainerDefinition
$cfrom :: forall x. ContainerDefinition -> Rep ContainerDefinition x
Prelude.Generic)

-- |
-- Create a value of 'ContainerDefinition' 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:
--
-- 'multiModelConfig', 'containerDefinition_multiModelConfig' - Specifies additional configuration for multi-model endpoints.
--
-- 'modelDataUrl', 'containerDefinition_modelDataUrl' - The S3 path where the model artifacts, which result from model training,
-- are stored. This path must point to a single gzip compressed tar archive
-- (.tar.gz suffix). The S3 path is required for Amazon SageMaker built-in
-- algorithms, but not if you use your own algorithms. For more information
-- on built-in algorithms, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-algo-docker-registry-paths.html Common Parameters>.
--
-- The model artifacts must be in an S3 bucket that is in the same region
-- as the model or endpoint you are creating.
--
-- If you provide a value for this parameter, Amazon SageMaker uses Amazon
-- Web Services Security Token Service to download model artifacts from the
-- S3 path you provide. Amazon Web Services STS is activated in your IAM
-- user account by default. If you previously deactivated Amazon Web
-- Services STS for a region, you need to reactivate Amazon Web Services
-- STS for that region. For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html Activating and Deactivating Amazon Web Services STS in an Amazon Web Services Region>
-- in the /Amazon Web Services Identity and Access Management User Guide/.
--
-- If you use a built-in algorithm to create a model, Amazon SageMaker
-- requires that you provide a S3 path to the model artifacts in
-- @ModelDataUrl@.
--
-- 'image', 'containerDefinition_image' - The path where inference code is stored. This can be either in Amazon
-- EC2 Container Registry or in a Docker registry that is accessible from
-- the same VPC that you configure for your endpoint. If you are using your
-- own custom algorithm instead of an algorithm provided by Amazon
-- SageMaker, the inference code must meet Amazon SageMaker requirements.
-- Amazon SageMaker supports both @registry\/repository[:tag]@ and
-- @registry\/repository[\@digest]@ image path formats. For more
-- information, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms.html Using Your Own Algorithms with Amazon SageMaker>
--
-- 'modelPackageName', 'containerDefinition_modelPackageName' - The name or Amazon Resource Name (ARN) of the model package to use to
-- create the model.
--
-- 'environment', 'containerDefinition_environment' - The environment variables to set in the Docker container. Each key and
-- value in the @Environment@ string to string map can have length of up to
-- 1024. We support up to 16 entries in the map.
--
-- 'imageConfig', 'containerDefinition_imageConfig' - Specifies whether the model container is in Amazon ECR or a private
-- Docker registry accessible from your Amazon Virtual Private Cloud (VPC).
-- For information about storing containers in a private Docker registry,
-- see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-containers-inference-private.html Use a Private Docker Registry for Real-Time Inference Containers>
--
-- 'mode', 'containerDefinition_mode' - Whether the container hosts a single model or multiple models.
--
-- 'containerHostname', 'containerDefinition_containerHostname' - This parameter is ignored for models that contain only a
-- @PrimaryContainer@.
--
-- When a @ContainerDefinition@ is part of an inference pipeline, the value
-- of the parameter uniquely identifies the container for the purposes of
-- logging and metrics. For information, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/inference-pipeline-logs-metrics.html Use Logs and Metrics to Monitor an Inference Pipeline>.
-- If you don\'t specify a value for this parameter for a
-- @ContainerDefinition@ that is part of an inference pipeline, a unique
-- name is automatically assigned based on the position of the
-- @ContainerDefinition@ in the pipeline. If you specify a value for the
-- @ContainerHostName@ for any @ContainerDefinition@ that is part of an
-- inference pipeline, you must specify a value for the @ContainerHostName@
-- parameter of every @ContainerDefinition@ in that pipeline.
newContainerDefinition ::
  ContainerDefinition
newContainerDefinition :: ContainerDefinition
newContainerDefinition =
  ContainerDefinition' :: Maybe MultiModelConfig
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe ImageConfig
-> Maybe ContainerMode
-> Maybe Text
-> ContainerDefinition
ContainerDefinition'
    { $sel:multiModelConfig:ContainerDefinition' :: Maybe MultiModelConfig
multiModelConfig =
        Maybe MultiModelConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:modelDataUrl:ContainerDefinition' :: Maybe Text
modelDataUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:image:ContainerDefinition' :: Maybe Text
image = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:modelPackageName:ContainerDefinition' :: Maybe Text
modelPackageName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:environment:ContainerDefinition' :: Maybe (HashMap Text Text)
environment = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:imageConfig:ContainerDefinition' :: Maybe ImageConfig
imageConfig = Maybe ImageConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:mode:ContainerDefinition' :: Maybe ContainerMode
mode = Maybe ContainerMode
forall a. Maybe a
Prelude.Nothing,
      $sel:containerHostname:ContainerDefinition' :: Maybe Text
containerHostname = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies additional configuration for multi-model endpoints.
containerDefinition_multiModelConfig :: Lens.Lens' ContainerDefinition (Prelude.Maybe MultiModelConfig)
containerDefinition_multiModelConfig :: (Maybe MultiModelConfig -> f (Maybe MultiModelConfig))
-> ContainerDefinition -> f ContainerDefinition
containerDefinition_multiModelConfig = (ContainerDefinition -> Maybe MultiModelConfig)
-> (ContainerDefinition
    -> Maybe MultiModelConfig -> ContainerDefinition)
-> Lens
     ContainerDefinition
     ContainerDefinition
     (Maybe MultiModelConfig)
     (Maybe MultiModelConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerDefinition' {Maybe MultiModelConfig
multiModelConfig :: Maybe MultiModelConfig
$sel:multiModelConfig:ContainerDefinition' :: ContainerDefinition -> Maybe MultiModelConfig
multiModelConfig} -> Maybe MultiModelConfig
multiModelConfig) (\s :: ContainerDefinition
s@ContainerDefinition' {} Maybe MultiModelConfig
a -> ContainerDefinition
s {$sel:multiModelConfig:ContainerDefinition' :: Maybe MultiModelConfig
multiModelConfig = Maybe MultiModelConfig
a} :: ContainerDefinition)

-- | The S3 path where the model artifacts, which result from model training,
-- are stored. This path must point to a single gzip compressed tar archive
-- (.tar.gz suffix). The S3 path is required for Amazon SageMaker built-in
-- algorithms, but not if you use your own algorithms. For more information
-- on built-in algorithms, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-algo-docker-registry-paths.html Common Parameters>.
--
-- The model artifacts must be in an S3 bucket that is in the same region
-- as the model or endpoint you are creating.
--
-- If you provide a value for this parameter, Amazon SageMaker uses Amazon
-- Web Services Security Token Service to download model artifacts from the
-- S3 path you provide. Amazon Web Services STS is activated in your IAM
-- user account by default. If you previously deactivated Amazon Web
-- Services STS for a region, you need to reactivate Amazon Web Services
-- STS for that region. For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html Activating and Deactivating Amazon Web Services STS in an Amazon Web Services Region>
-- in the /Amazon Web Services Identity and Access Management User Guide/.
--
-- If you use a built-in algorithm to create a model, Amazon SageMaker
-- requires that you provide a S3 path to the model artifacts in
-- @ModelDataUrl@.
containerDefinition_modelDataUrl :: Lens.Lens' ContainerDefinition (Prelude.Maybe Prelude.Text)
containerDefinition_modelDataUrl :: (Maybe Text -> f (Maybe Text))
-> ContainerDefinition -> f ContainerDefinition
containerDefinition_modelDataUrl = (ContainerDefinition -> Maybe Text)
-> (ContainerDefinition -> Maybe Text -> ContainerDefinition)
-> Lens
     ContainerDefinition ContainerDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerDefinition' {Maybe Text
modelDataUrl :: Maybe Text
$sel:modelDataUrl:ContainerDefinition' :: ContainerDefinition -> Maybe Text
modelDataUrl} -> Maybe Text
modelDataUrl) (\s :: ContainerDefinition
s@ContainerDefinition' {} Maybe Text
a -> ContainerDefinition
s {$sel:modelDataUrl:ContainerDefinition' :: Maybe Text
modelDataUrl = Maybe Text
a} :: ContainerDefinition)

-- | The path where inference code is stored. This can be either in Amazon
-- EC2 Container Registry or in a Docker registry that is accessible from
-- the same VPC that you configure for your endpoint. If you are using your
-- own custom algorithm instead of an algorithm provided by Amazon
-- SageMaker, the inference code must meet Amazon SageMaker requirements.
-- Amazon SageMaker supports both @registry\/repository[:tag]@ and
-- @registry\/repository[\@digest]@ image path formats. For more
-- information, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms.html Using Your Own Algorithms with Amazon SageMaker>
containerDefinition_image :: Lens.Lens' ContainerDefinition (Prelude.Maybe Prelude.Text)
containerDefinition_image :: (Maybe Text -> f (Maybe Text))
-> ContainerDefinition -> f ContainerDefinition
containerDefinition_image = (ContainerDefinition -> Maybe Text)
-> (ContainerDefinition -> Maybe Text -> ContainerDefinition)
-> Lens
     ContainerDefinition ContainerDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerDefinition' {Maybe Text
image :: Maybe Text
$sel:image:ContainerDefinition' :: ContainerDefinition -> Maybe Text
image} -> Maybe Text
image) (\s :: ContainerDefinition
s@ContainerDefinition' {} Maybe Text
a -> ContainerDefinition
s {$sel:image:ContainerDefinition' :: Maybe Text
image = Maybe Text
a} :: ContainerDefinition)

-- | The name or Amazon Resource Name (ARN) of the model package to use to
-- create the model.
containerDefinition_modelPackageName :: Lens.Lens' ContainerDefinition (Prelude.Maybe Prelude.Text)
containerDefinition_modelPackageName :: (Maybe Text -> f (Maybe Text))
-> ContainerDefinition -> f ContainerDefinition
containerDefinition_modelPackageName = (ContainerDefinition -> Maybe Text)
-> (ContainerDefinition -> Maybe Text -> ContainerDefinition)
-> Lens
     ContainerDefinition ContainerDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerDefinition' {Maybe Text
modelPackageName :: Maybe Text
$sel:modelPackageName:ContainerDefinition' :: ContainerDefinition -> Maybe Text
modelPackageName} -> Maybe Text
modelPackageName) (\s :: ContainerDefinition
s@ContainerDefinition' {} Maybe Text
a -> ContainerDefinition
s {$sel:modelPackageName:ContainerDefinition' :: Maybe Text
modelPackageName = Maybe Text
a} :: ContainerDefinition)

-- | The environment variables to set in the Docker container. Each key and
-- value in the @Environment@ string to string map can have length of up to
-- 1024. We support up to 16 entries in the map.
containerDefinition_environment :: Lens.Lens' ContainerDefinition (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
containerDefinition_environment :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ContainerDefinition -> f ContainerDefinition
containerDefinition_environment = (ContainerDefinition -> Maybe (HashMap Text Text))
-> (ContainerDefinition
    -> Maybe (HashMap Text Text) -> ContainerDefinition)
-> Lens
     ContainerDefinition
     ContainerDefinition
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerDefinition' {Maybe (HashMap Text Text)
environment :: Maybe (HashMap Text Text)
$sel:environment:ContainerDefinition' :: ContainerDefinition -> Maybe (HashMap Text Text)
environment} -> Maybe (HashMap Text Text)
environment) (\s :: ContainerDefinition
s@ContainerDefinition' {} Maybe (HashMap Text Text)
a -> ContainerDefinition
s {$sel:environment:ContainerDefinition' :: Maybe (HashMap Text Text)
environment = Maybe (HashMap Text Text)
a} :: ContainerDefinition) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ContainerDefinition -> f ContainerDefinition)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ContainerDefinition
-> f ContainerDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies whether the model container is in Amazon ECR or a private
-- Docker registry accessible from your Amazon Virtual Private Cloud (VPC).
-- For information about storing containers in a private Docker registry,
-- see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-containers-inference-private.html Use a Private Docker Registry for Real-Time Inference Containers>
containerDefinition_imageConfig :: Lens.Lens' ContainerDefinition (Prelude.Maybe ImageConfig)
containerDefinition_imageConfig :: (Maybe ImageConfig -> f (Maybe ImageConfig))
-> ContainerDefinition -> f ContainerDefinition
containerDefinition_imageConfig = (ContainerDefinition -> Maybe ImageConfig)
-> (ContainerDefinition
    -> Maybe ImageConfig -> ContainerDefinition)
-> Lens
     ContainerDefinition
     ContainerDefinition
     (Maybe ImageConfig)
     (Maybe ImageConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerDefinition' {Maybe ImageConfig
imageConfig :: Maybe ImageConfig
$sel:imageConfig:ContainerDefinition' :: ContainerDefinition -> Maybe ImageConfig
imageConfig} -> Maybe ImageConfig
imageConfig) (\s :: ContainerDefinition
s@ContainerDefinition' {} Maybe ImageConfig
a -> ContainerDefinition
s {$sel:imageConfig:ContainerDefinition' :: Maybe ImageConfig
imageConfig = Maybe ImageConfig
a} :: ContainerDefinition)

-- | Whether the container hosts a single model or multiple models.
containerDefinition_mode :: Lens.Lens' ContainerDefinition (Prelude.Maybe ContainerMode)
containerDefinition_mode :: (Maybe ContainerMode -> f (Maybe ContainerMode))
-> ContainerDefinition -> f ContainerDefinition
containerDefinition_mode = (ContainerDefinition -> Maybe ContainerMode)
-> (ContainerDefinition
    -> Maybe ContainerMode -> ContainerDefinition)
-> Lens
     ContainerDefinition
     ContainerDefinition
     (Maybe ContainerMode)
     (Maybe ContainerMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerDefinition' {Maybe ContainerMode
mode :: Maybe ContainerMode
$sel:mode:ContainerDefinition' :: ContainerDefinition -> Maybe ContainerMode
mode} -> Maybe ContainerMode
mode) (\s :: ContainerDefinition
s@ContainerDefinition' {} Maybe ContainerMode
a -> ContainerDefinition
s {$sel:mode:ContainerDefinition' :: Maybe ContainerMode
mode = Maybe ContainerMode
a} :: ContainerDefinition)

-- | This parameter is ignored for models that contain only a
-- @PrimaryContainer@.
--
-- When a @ContainerDefinition@ is part of an inference pipeline, the value
-- of the parameter uniquely identifies the container for the purposes of
-- logging and metrics. For information, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/inference-pipeline-logs-metrics.html Use Logs and Metrics to Monitor an Inference Pipeline>.
-- If you don\'t specify a value for this parameter for a
-- @ContainerDefinition@ that is part of an inference pipeline, a unique
-- name is automatically assigned based on the position of the
-- @ContainerDefinition@ in the pipeline. If you specify a value for the
-- @ContainerHostName@ for any @ContainerDefinition@ that is part of an
-- inference pipeline, you must specify a value for the @ContainerHostName@
-- parameter of every @ContainerDefinition@ in that pipeline.
containerDefinition_containerHostname :: Lens.Lens' ContainerDefinition (Prelude.Maybe Prelude.Text)
containerDefinition_containerHostname :: (Maybe Text -> f (Maybe Text))
-> ContainerDefinition -> f ContainerDefinition
containerDefinition_containerHostname = (ContainerDefinition -> Maybe Text)
-> (ContainerDefinition -> Maybe Text -> ContainerDefinition)
-> Lens
     ContainerDefinition ContainerDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerDefinition' {Maybe Text
containerHostname :: Maybe Text
$sel:containerHostname:ContainerDefinition' :: ContainerDefinition -> Maybe Text
containerHostname} -> Maybe Text
containerHostname) (\s :: ContainerDefinition
s@ContainerDefinition' {} Maybe Text
a -> ContainerDefinition
s {$sel:containerHostname:ContainerDefinition' :: Maybe Text
containerHostname = Maybe Text
a} :: ContainerDefinition)

instance Core.FromJSON ContainerDefinition where
  parseJSON :: Value -> Parser ContainerDefinition
parseJSON =
    String
-> (Object -> Parser ContainerDefinition)
-> Value
-> Parser ContainerDefinition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContainerDefinition"
      ( \Object
x ->
          Maybe MultiModelConfig
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe ImageConfig
-> Maybe ContainerMode
-> Maybe Text
-> ContainerDefinition
ContainerDefinition'
            (Maybe MultiModelConfig
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe ImageConfig
 -> Maybe ContainerMode
 -> Maybe Text
 -> ContainerDefinition)
-> Parser (Maybe MultiModelConfig)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe ImageConfig
      -> Maybe ContainerMode
      -> Maybe Text
      -> ContainerDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MultiModelConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MultiModelConfig")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe ImageConfig
   -> Maybe ContainerMode
   -> Maybe Text
   -> ContainerDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe ImageConfig
      -> Maybe ContainerMode
      -> Maybe Text
      -> ContainerDefinition)
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
"ModelDataUrl")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe ImageConfig
   -> Maybe ContainerMode
   -> Maybe Text
   -> ContainerDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe ImageConfig
      -> Maybe ContainerMode
      -> Maybe Text
      -> ContainerDefinition)
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 (HashMap Text Text)
   -> Maybe ImageConfig
   -> Maybe ContainerMode
   -> Maybe Text
   -> ContainerDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe ImageConfig
      -> Maybe ContainerMode
      -> Maybe Text
      -> ContainerDefinition)
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
"ModelPackageName")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe ImageConfig
   -> Maybe ContainerMode
   -> Maybe Text
   -> ContainerDefinition)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe ImageConfig
      -> Maybe ContainerMode -> Maybe Text -> ContainerDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Environment" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe ImageConfig
   -> Maybe ContainerMode -> Maybe Text -> ContainerDefinition)
-> Parser (Maybe ImageConfig)
-> Parser
     (Maybe ContainerMode -> Maybe Text -> ContainerDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ImageConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ImageConfig")
            Parser (Maybe ContainerMode -> Maybe Text -> ContainerDefinition)
-> Parser (Maybe ContainerMode)
-> Parser (Maybe Text -> ContainerDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ContainerMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Mode")
            Parser (Maybe Text -> ContainerDefinition)
-> Parser (Maybe Text) -> Parser ContainerDefinition
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
"ContainerHostname")
      )

instance Prelude.Hashable ContainerDefinition

instance Prelude.NFData ContainerDefinition

instance Core.ToJSON ContainerDefinition where
  toJSON :: ContainerDefinition -> Value
toJSON ContainerDefinition' {Maybe Text
Maybe (HashMap Text Text)
Maybe ContainerMode
Maybe MultiModelConfig
Maybe ImageConfig
containerHostname :: Maybe Text
mode :: Maybe ContainerMode
imageConfig :: Maybe ImageConfig
environment :: Maybe (HashMap Text Text)
modelPackageName :: Maybe Text
image :: Maybe Text
modelDataUrl :: Maybe Text
multiModelConfig :: Maybe MultiModelConfig
$sel:containerHostname:ContainerDefinition' :: ContainerDefinition -> Maybe Text
$sel:mode:ContainerDefinition' :: ContainerDefinition -> Maybe ContainerMode
$sel:imageConfig:ContainerDefinition' :: ContainerDefinition -> Maybe ImageConfig
$sel:environment:ContainerDefinition' :: ContainerDefinition -> Maybe (HashMap Text Text)
$sel:modelPackageName:ContainerDefinition' :: ContainerDefinition -> Maybe Text
$sel:image:ContainerDefinition' :: ContainerDefinition -> Maybe Text
$sel:modelDataUrl:ContainerDefinition' :: ContainerDefinition -> Maybe Text
$sel:multiModelConfig:ContainerDefinition' :: ContainerDefinition -> Maybe MultiModelConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MultiModelConfig" Text -> MultiModelConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MultiModelConfig -> Pair) -> Maybe MultiModelConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MultiModelConfig
multiModelConfig,
            (Text
"ModelDataUrl" 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
modelDataUrl,
            (Text
"Image" 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
image,
            (Text
"ModelPackageName" 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
modelPackageName,
            (Text
"Environment" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
environment,
            (Text
"ImageConfig" Text -> ImageConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ImageConfig -> Pair) -> Maybe ImageConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImageConfig
imageConfig,
            (Text
"Mode" Text -> ContainerMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ContainerMode -> Pair) -> Maybe ContainerMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContainerMode
mode,
            (Text
"ContainerHostname" 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
containerHostname
          ]
      )