{-# 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.AlgorithmSpecification
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.AlgorithmSpecification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.MetricDefinition
import Amazonka.SageMaker.Types.TrainingInputMode

-- | Specifies the training algorithm to use in a CreateTrainingJob request.
--
-- For more information about algorithms provided by SageMaker, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html Algorithms>.
-- For information about using your own algorithms, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms.html Using Your Own Algorithms with Amazon SageMaker>.
--
-- /See:/ 'newAlgorithmSpecification' smart constructor.
data AlgorithmSpecification = AlgorithmSpecification'
  { -- | The name of the algorithm resource to use for the training job. This
    -- must be an algorithm resource that you created or subscribe to on Amazon
    -- Web Services Marketplace.
    --
    -- You must specify either the algorithm name to the @AlgorithmName@
    -- parameter or the image URI of the algorithm container to the
    -- @TrainingImage@ parameter.
    --
    -- Note that the @AlgorithmName@ parameter is mutually exclusive with the
    -- @TrainingImage@ parameter. If you specify a value for the
    -- @AlgorithmName@ parameter, you can\'t specify a value for
    -- @TrainingImage@, and vice versa.
    --
    -- If you specify values for both parameters, the training job might break;
    -- if you don\'t specify any value for both parameters, the training job
    -- might raise a @null@ error.
    AlgorithmSpecification -> Maybe Text
algorithmName :: Prelude.Maybe Prelude.Text,
    -- | The arguments for a container used to run a training job. See
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo-dockerfile.html How Amazon SageMaker Runs Your Training Image>
    -- for additional information.
    AlgorithmSpecification -> Maybe (NonEmpty Text)
containerArguments :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The
    -- <https://docs.docker.com/engine/reference/builder/ entrypoint script for a Docker container>
    -- used to run a training job. This script takes precedence over the
    -- default train processing instructions. See
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo-dockerfile.html How Amazon SageMaker Runs Your Training Image>
    -- for more information.
    AlgorithmSpecification -> Maybe (NonEmpty Text)
containerEntrypoint :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | To generate and save time-series metrics during training, set to @true@.
    -- The default is @false@ and time-series metrics aren\'t generated except
    -- in the following cases:
    --
    -- -   You use one of the SageMaker built-in algorithms
    --
    -- -   You use one of the following
    --     <https://docs.aws.amazon.com/sagemaker/latest/dg/pre-built-containers-frameworks-deep-learning.html Prebuilt SageMaker Docker Images>:
    --
    --     -   Tensorflow (version >= 1.15)
    --
    --     -   MXNet (version >= 1.6)
    --
    --     -   PyTorch (version >= 1.3)
    --
    -- -   You specify at least one MetricDefinition
    AlgorithmSpecification -> Maybe Bool
enableSageMakerMetricsTimeSeries :: Prelude.Maybe Prelude.Bool,
    -- | A list of metric definition objects. Each object specifies the metric
    -- name and regular expressions used to parse algorithm logs. SageMaker
    -- publishes each metric to Amazon CloudWatch.
    AlgorithmSpecification -> Maybe [MetricDefinition]
metricDefinitions :: Prelude.Maybe [MetricDefinition],
    -- | The registry path of the Docker image that contains the training
    -- algorithm. For information about docker registry paths for SageMaker
    -- built-in algorithms, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-algo-docker-registry-paths.html Docker Registry Paths and Example Code>
    -- in the /Amazon SageMaker developer guide/. SageMaker supports both
    -- @registry\/repository[:tag]@ and @registry\/repository[\@digest]@ image
    -- path formats. For more information about using your custom training
    -- container, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms.html Using Your Own Algorithms with Amazon SageMaker>.
    --
    -- You must specify either the algorithm name to the @AlgorithmName@
    -- parameter or the image URI of the algorithm container to the
    -- @TrainingImage@ parameter.
    --
    -- For more information, see the note in the @AlgorithmName@ parameter
    -- description.
    AlgorithmSpecification -> Maybe Text
trainingImage :: Prelude.Maybe Prelude.Text,
    AlgorithmSpecification -> TrainingInputMode
trainingInputMode :: TrainingInputMode
  }
  deriving (AlgorithmSpecification -> AlgorithmSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlgorithmSpecification -> AlgorithmSpecification -> Bool
$c/= :: AlgorithmSpecification -> AlgorithmSpecification -> Bool
== :: AlgorithmSpecification -> AlgorithmSpecification -> Bool
$c== :: AlgorithmSpecification -> AlgorithmSpecification -> Bool
Prelude.Eq, ReadPrec [AlgorithmSpecification]
ReadPrec AlgorithmSpecification
Int -> ReadS AlgorithmSpecification
ReadS [AlgorithmSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AlgorithmSpecification]
$creadListPrec :: ReadPrec [AlgorithmSpecification]
readPrec :: ReadPrec AlgorithmSpecification
$creadPrec :: ReadPrec AlgorithmSpecification
readList :: ReadS [AlgorithmSpecification]
$creadList :: ReadS [AlgorithmSpecification]
readsPrec :: Int -> ReadS AlgorithmSpecification
$creadsPrec :: Int -> ReadS AlgorithmSpecification
Prelude.Read, Int -> AlgorithmSpecification -> ShowS
[AlgorithmSpecification] -> ShowS
AlgorithmSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlgorithmSpecification] -> ShowS
$cshowList :: [AlgorithmSpecification] -> ShowS
show :: AlgorithmSpecification -> String
$cshow :: AlgorithmSpecification -> String
showsPrec :: Int -> AlgorithmSpecification -> ShowS
$cshowsPrec :: Int -> AlgorithmSpecification -> ShowS
Prelude.Show, forall x. Rep AlgorithmSpecification x -> AlgorithmSpecification
forall x. AlgorithmSpecification -> Rep AlgorithmSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AlgorithmSpecification x -> AlgorithmSpecification
$cfrom :: forall x. AlgorithmSpecification -> Rep AlgorithmSpecification x
Prelude.Generic)

-- |
-- Create a value of 'AlgorithmSpecification' 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:
--
-- 'algorithmName', 'algorithmSpecification_algorithmName' - The name of the algorithm resource to use for the training job. This
-- must be an algorithm resource that you created or subscribe to on Amazon
-- Web Services Marketplace.
--
-- You must specify either the algorithm name to the @AlgorithmName@
-- parameter or the image URI of the algorithm container to the
-- @TrainingImage@ parameter.
--
-- Note that the @AlgorithmName@ parameter is mutually exclusive with the
-- @TrainingImage@ parameter. If you specify a value for the
-- @AlgorithmName@ parameter, you can\'t specify a value for
-- @TrainingImage@, and vice versa.
--
-- If you specify values for both parameters, the training job might break;
-- if you don\'t specify any value for both parameters, the training job
-- might raise a @null@ error.
--
-- 'containerArguments', 'algorithmSpecification_containerArguments' - The arguments for a container used to run a training job. See
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo-dockerfile.html How Amazon SageMaker Runs Your Training Image>
-- for additional information.
--
-- 'containerEntrypoint', 'algorithmSpecification_containerEntrypoint' - The
-- <https://docs.docker.com/engine/reference/builder/ entrypoint script for a Docker container>
-- used to run a training job. This script takes precedence over the
-- default train processing instructions. See
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo-dockerfile.html How Amazon SageMaker Runs Your Training Image>
-- for more information.
--
-- 'enableSageMakerMetricsTimeSeries', 'algorithmSpecification_enableSageMakerMetricsTimeSeries' - To generate and save time-series metrics during training, set to @true@.
-- The default is @false@ and time-series metrics aren\'t generated except
-- in the following cases:
--
-- -   You use one of the SageMaker built-in algorithms
--
-- -   You use one of the following
--     <https://docs.aws.amazon.com/sagemaker/latest/dg/pre-built-containers-frameworks-deep-learning.html Prebuilt SageMaker Docker Images>:
--
--     -   Tensorflow (version >= 1.15)
--
--     -   MXNet (version >= 1.6)
--
--     -   PyTorch (version >= 1.3)
--
-- -   You specify at least one MetricDefinition
--
-- 'metricDefinitions', 'algorithmSpecification_metricDefinitions' - A list of metric definition objects. Each object specifies the metric
-- name and regular expressions used to parse algorithm logs. SageMaker
-- publishes each metric to Amazon CloudWatch.
--
-- 'trainingImage', 'algorithmSpecification_trainingImage' - The registry path of the Docker image that contains the training
-- algorithm. For information about docker registry paths for SageMaker
-- built-in algorithms, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-algo-docker-registry-paths.html Docker Registry Paths and Example Code>
-- in the /Amazon SageMaker developer guide/. SageMaker supports both
-- @registry\/repository[:tag]@ and @registry\/repository[\@digest]@ image
-- path formats. For more information about using your custom training
-- container, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms.html Using Your Own Algorithms with Amazon SageMaker>.
--
-- You must specify either the algorithm name to the @AlgorithmName@
-- parameter or the image URI of the algorithm container to the
-- @TrainingImage@ parameter.
--
-- For more information, see the note in the @AlgorithmName@ parameter
-- description.
--
-- 'trainingInputMode', 'algorithmSpecification_trainingInputMode' - Undocumented member.
newAlgorithmSpecification ::
  -- | 'trainingInputMode'
  TrainingInputMode ->
  AlgorithmSpecification
newAlgorithmSpecification :: TrainingInputMode -> AlgorithmSpecification
newAlgorithmSpecification TrainingInputMode
pTrainingInputMode_ =
  AlgorithmSpecification'
    { $sel:algorithmName:AlgorithmSpecification' :: Maybe Text
algorithmName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:containerArguments:AlgorithmSpecification' :: Maybe (NonEmpty Text)
containerArguments = forall a. Maybe a
Prelude.Nothing,
      $sel:containerEntrypoint:AlgorithmSpecification' :: Maybe (NonEmpty Text)
containerEntrypoint = forall a. Maybe a
Prelude.Nothing,
      $sel:enableSageMakerMetricsTimeSeries:AlgorithmSpecification' :: Maybe Bool
enableSageMakerMetricsTimeSeries = forall a. Maybe a
Prelude.Nothing,
      $sel:metricDefinitions:AlgorithmSpecification' :: Maybe [MetricDefinition]
metricDefinitions = forall a. Maybe a
Prelude.Nothing,
      $sel:trainingImage:AlgorithmSpecification' :: Maybe Text
trainingImage = forall a. Maybe a
Prelude.Nothing,
      $sel:trainingInputMode:AlgorithmSpecification' :: TrainingInputMode
trainingInputMode = TrainingInputMode
pTrainingInputMode_
    }

-- | The name of the algorithm resource to use for the training job. This
-- must be an algorithm resource that you created or subscribe to on Amazon
-- Web Services Marketplace.
--
-- You must specify either the algorithm name to the @AlgorithmName@
-- parameter or the image URI of the algorithm container to the
-- @TrainingImage@ parameter.
--
-- Note that the @AlgorithmName@ parameter is mutually exclusive with the
-- @TrainingImage@ parameter. If you specify a value for the
-- @AlgorithmName@ parameter, you can\'t specify a value for
-- @TrainingImage@, and vice versa.
--
-- If you specify values for both parameters, the training job might break;
-- if you don\'t specify any value for both parameters, the training job
-- might raise a @null@ error.
algorithmSpecification_algorithmName :: Lens.Lens' AlgorithmSpecification (Prelude.Maybe Prelude.Text)
algorithmSpecification_algorithmName :: Lens' AlgorithmSpecification (Maybe Text)
algorithmSpecification_algorithmName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {Maybe Text
algorithmName :: Maybe Text
$sel:algorithmName:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
algorithmName} -> Maybe Text
algorithmName) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} Maybe Text
a -> AlgorithmSpecification
s {$sel:algorithmName:AlgorithmSpecification' :: Maybe Text
algorithmName = Maybe Text
a} :: AlgorithmSpecification)

-- | The arguments for a container used to run a training job. See
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo-dockerfile.html How Amazon SageMaker Runs Your Training Image>
-- for additional information.
algorithmSpecification_containerArguments :: Lens.Lens' AlgorithmSpecification (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
algorithmSpecification_containerArguments :: Lens' AlgorithmSpecification (Maybe (NonEmpty Text))
algorithmSpecification_containerArguments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {Maybe (NonEmpty Text)
containerArguments :: Maybe (NonEmpty Text)
$sel:containerArguments:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe (NonEmpty Text)
containerArguments} -> Maybe (NonEmpty Text)
containerArguments) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} Maybe (NonEmpty Text)
a -> AlgorithmSpecification
s {$sel:containerArguments:AlgorithmSpecification' :: Maybe (NonEmpty Text)
containerArguments = Maybe (NonEmpty Text)
a} :: AlgorithmSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The
-- <https://docs.docker.com/engine/reference/builder/ entrypoint script for a Docker container>
-- used to run a training job. This script takes precedence over the
-- default train processing instructions. See
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo-dockerfile.html How Amazon SageMaker Runs Your Training Image>
-- for more information.
algorithmSpecification_containerEntrypoint :: Lens.Lens' AlgorithmSpecification (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
algorithmSpecification_containerEntrypoint :: Lens' AlgorithmSpecification (Maybe (NonEmpty Text))
algorithmSpecification_containerEntrypoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {Maybe (NonEmpty Text)
containerEntrypoint :: Maybe (NonEmpty Text)
$sel:containerEntrypoint:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe (NonEmpty Text)
containerEntrypoint} -> Maybe (NonEmpty Text)
containerEntrypoint) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} Maybe (NonEmpty Text)
a -> AlgorithmSpecification
s {$sel:containerEntrypoint:AlgorithmSpecification' :: Maybe (NonEmpty Text)
containerEntrypoint = Maybe (NonEmpty Text)
a} :: AlgorithmSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | To generate and save time-series metrics during training, set to @true@.
-- The default is @false@ and time-series metrics aren\'t generated except
-- in the following cases:
--
-- -   You use one of the SageMaker built-in algorithms
--
-- -   You use one of the following
--     <https://docs.aws.amazon.com/sagemaker/latest/dg/pre-built-containers-frameworks-deep-learning.html Prebuilt SageMaker Docker Images>:
--
--     -   Tensorflow (version >= 1.15)
--
--     -   MXNet (version >= 1.6)
--
--     -   PyTorch (version >= 1.3)
--
-- -   You specify at least one MetricDefinition
algorithmSpecification_enableSageMakerMetricsTimeSeries :: Lens.Lens' AlgorithmSpecification (Prelude.Maybe Prelude.Bool)
algorithmSpecification_enableSageMakerMetricsTimeSeries :: Lens' AlgorithmSpecification (Maybe Bool)
algorithmSpecification_enableSageMakerMetricsTimeSeries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {Maybe Bool
enableSageMakerMetricsTimeSeries :: Maybe Bool
$sel:enableSageMakerMetricsTimeSeries:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Bool
enableSageMakerMetricsTimeSeries} -> Maybe Bool
enableSageMakerMetricsTimeSeries) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} Maybe Bool
a -> AlgorithmSpecification
s {$sel:enableSageMakerMetricsTimeSeries:AlgorithmSpecification' :: Maybe Bool
enableSageMakerMetricsTimeSeries = Maybe Bool
a} :: AlgorithmSpecification)

-- | A list of metric definition objects. Each object specifies the metric
-- name and regular expressions used to parse algorithm logs. SageMaker
-- publishes each metric to Amazon CloudWatch.
algorithmSpecification_metricDefinitions :: Lens.Lens' AlgorithmSpecification (Prelude.Maybe [MetricDefinition])
algorithmSpecification_metricDefinitions :: Lens' AlgorithmSpecification (Maybe [MetricDefinition])
algorithmSpecification_metricDefinitions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {Maybe [MetricDefinition]
metricDefinitions :: Maybe [MetricDefinition]
$sel:metricDefinitions:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe [MetricDefinition]
metricDefinitions} -> Maybe [MetricDefinition]
metricDefinitions) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} Maybe [MetricDefinition]
a -> AlgorithmSpecification
s {$sel:metricDefinitions:AlgorithmSpecification' :: Maybe [MetricDefinition]
metricDefinitions = Maybe [MetricDefinition]
a} :: AlgorithmSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The registry path of the Docker image that contains the training
-- algorithm. For information about docker registry paths for SageMaker
-- built-in algorithms, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-algo-docker-registry-paths.html Docker Registry Paths and Example Code>
-- in the /Amazon SageMaker developer guide/. SageMaker supports both
-- @registry\/repository[:tag]@ and @registry\/repository[\@digest]@ image
-- path formats. For more information about using your custom training
-- container, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms.html Using Your Own Algorithms with Amazon SageMaker>.
--
-- You must specify either the algorithm name to the @AlgorithmName@
-- parameter or the image URI of the algorithm container to the
-- @TrainingImage@ parameter.
--
-- For more information, see the note in the @AlgorithmName@ parameter
-- description.
algorithmSpecification_trainingImage :: Lens.Lens' AlgorithmSpecification (Prelude.Maybe Prelude.Text)
algorithmSpecification_trainingImage :: Lens' AlgorithmSpecification (Maybe Text)
algorithmSpecification_trainingImage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {Maybe Text
trainingImage :: Maybe Text
$sel:trainingImage:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
trainingImage} -> Maybe Text
trainingImage) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} Maybe Text
a -> AlgorithmSpecification
s {$sel:trainingImage:AlgorithmSpecification' :: Maybe Text
trainingImage = Maybe Text
a} :: AlgorithmSpecification)

-- | Undocumented member.
algorithmSpecification_trainingInputMode :: Lens.Lens' AlgorithmSpecification TrainingInputMode
algorithmSpecification_trainingInputMode :: Lens' AlgorithmSpecification TrainingInputMode
algorithmSpecification_trainingInputMode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {TrainingInputMode
trainingInputMode :: TrainingInputMode
$sel:trainingInputMode:AlgorithmSpecification' :: AlgorithmSpecification -> TrainingInputMode
trainingInputMode} -> TrainingInputMode
trainingInputMode) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} TrainingInputMode
a -> AlgorithmSpecification
s {$sel:trainingInputMode:AlgorithmSpecification' :: TrainingInputMode
trainingInputMode = TrainingInputMode
a} :: AlgorithmSpecification)

instance Data.FromJSON AlgorithmSpecification where
  parseJSON :: Value -> Parser AlgorithmSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AlgorithmSpecification"
      ( \Object
x ->
          Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe Bool
-> Maybe [MetricDefinition]
-> Maybe Text
-> TrainingInputMode
-> AlgorithmSpecification
AlgorithmSpecification'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AlgorithmName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ContainerArguments")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ContainerEntrypoint")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EnableSageMakerMetricsTimeSeries")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MetricDefinitions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TrainingImage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TrainingInputMode")
      )

instance Prelude.Hashable AlgorithmSpecification where
  hashWithSalt :: Int -> AlgorithmSpecification -> Int
hashWithSalt Int
_salt AlgorithmSpecification' {Maybe Bool
Maybe [MetricDefinition]
Maybe (NonEmpty Text)
Maybe Text
TrainingInputMode
trainingInputMode :: TrainingInputMode
trainingImage :: Maybe Text
metricDefinitions :: Maybe [MetricDefinition]
enableSageMakerMetricsTimeSeries :: Maybe Bool
containerEntrypoint :: Maybe (NonEmpty Text)
containerArguments :: Maybe (NonEmpty Text)
algorithmName :: Maybe Text
$sel:trainingInputMode:AlgorithmSpecification' :: AlgorithmSpecification -> TrainingInputMode
$sel:trainingImage:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
$sel:metricDefinitions:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe [MetricDefinition]
$sel:enableSageMakerMetricsTimeSeries:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Bool
$sel:containerEntrypoint:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe (NonEmpty Text)
$sel:containerArguments:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe (NonEmpty Text)
$sel:algorithmName:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
algorithmName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
containerArguments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
containerEntrypoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enableSageMakerMetricsTimeSeries
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MetricDefinition]
metricDefinitions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
trainingImage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TrainingInputMode
trainingInputMode

instance Prelude.NFData AlgorithmSpecification where
  rnf :: AlgorithmSpecification -> ()
rnf AlgorithmSpecification' {Maybe Bool
Maybe [MetricDefinition]
Maybe (NonEmpty Text)
Maybe Text
TrainingInputMode
trainingInputMode :: TrainingInputMode
trainingImage :: Maybe Text
metricDefinitions :: Maybe [MetricDefinition]
enableSageMakerMetricsTimeSeries :: Maybe Bool
containerEntrypoint :: Maybe (NonEmpty Text)
containerArguments :: Maybe (NonEmpty Text)
algorithmName :: Maybe Text
$sel:trainingInputMode:AlgorithmSpecification' :: AlgorithmSpecification -> TrainingInputMode
$sel:trainingImage:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
$sel:metricDefinitions:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe [MetricDefinition]
$sel:enableSageMakerMetricsTimeSeries:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Bool
$sel:containerEntrypoint:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe (NonEmpty Text)
$sel:containerArguments:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe (NonEmpty Text)
$sel:algorithmName:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
algorithmName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
containerArguments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
containerEntrypoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enableSageMakerMetricsTimeSeries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MetricDefinition]
metricDefinitions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
trainingImage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TrainingInputMode
trainingInputMode

instance Data.ToJSON AlgorithmSpecification where
  toJSON :: AlgorithmSpecification -> Value
toJSON AlgorithmSpecification' {Maybe Bool
Maybe [MetricDefinition]
Maybe (NonEmpty Text)
Maybe Text
TrainingInputMode
trainingInputMode :: TrainingInputMode
trainingImage :: Maybe Text
metricDefinitions :: Maybe [MetricDefinition]
enableSageMakerMetricsTimeSeries :: Maybe Bool
containerEntrypoint :: Maybe (NonEmpty Text)
containerArguments :: Maybe (NonEmpty Text)
algorithmName :: Maybe Text
$sel:trainingInputMode:AlgorithmSpecification' :: AlgorithmSpecification -> TrainingInputMode
$sel:trainingImage:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
$sel:metricDefinitions:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe [MetricDefinition]
$sel:enableSageMakerMetricsTimeSeries:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Bool
$sel:containerEntrypoint:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe (NonEmpty Text)
$sel:containerArguments:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe (NonEmpty Text)
$sel:algorithmName:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AlgorithmName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
algorithmName,
            (Key
"ContainerArguments" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
containerArguments,
            (Key
"ContainerEntrypoint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
containerEntrypoint,
            (Key
"EnableSageMakerMetricsTimeSeries" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableSageMakerMetricsTimeSeries,
            (Key
"MetricDefinitions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MetricDefinition]
metricDefinitions,
            (Key
"TrainingImage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
trainingImage,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"TrainingInputMode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= TrainingInputMode
trainingInputMode)
          ]
      )