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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.TrainingJobDefinition
import Amazonka.SageMaker.Types.TransformJobDefinition

-- | Defines a training job and a batch transform job that Amazon SageMaker
-- runs to validate your algorithm.
--
-- The data provided in the validation profile is made available to your
-- buyers on Amazon Web Services Marketplace.
--
-- /See:/ 'newAlgorithmValidationProfile' smart constructor.
data AlgorithmValidationProfile = AlgorithmValidationProfile'
  { -- | The @TransformJobDefinition@ object that describes the transform job
    -- that Amazon SageMaker runs to validate your algorithm.
    AlgorithmValidationProfile -> Maybe TransformJobDefinition
transformJobDefinition :: Prelude.Maybe TransformJobDefinition,
    -- | The name of the profile for the algorithm. The name must have 1 to 63
    -- characters. Valid characters are a-z, A-Z, 0-9, and - (hyphen).
    AlgorithmValidationProfile -> Text
profileName :: Prelude.Text,
    -- | The @TrainingJobDefinition@ object that describes the training job that
    -- Amazon SageMaker runs to validate your algorithm.
    AlgorithmValidationProfile -> TrainingJobDefinition
trainingJobDefinition :: TrainingJobDefinition
  }
  deriving (AlgorithmValidationProfile -> AlgorithmValidationProfile -> Bool
(AlgorithmValidationProfile -> AlgorithmValidationProfile -> Bool)
-> (AlgorithmValidationProfile
    -> AlgorithmValidationProfile -> Bool)
-> Eq AlgorithmValidationProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlgorithmValidationProfile -> AlgorithmValidationProfile -> Bool
$c/= :: AlgorithmValidationProfile -> AlgorithmValidationProfile -> Bool
== :: AlgorithmValidationProfile -> AlgorithmValidationProfile -> Bool
$c== :: AlgorithmValidationProfile -> AlgorithmValidationProfile -> Bool
Prelude.Eq, ReadPrec [AlgorithmValidationProfile]
ReadPrec AlgorithmValidationProfile
Int -> ReadS AlgorithmValidationProfile
ReadS [AlgorithmValidationProfile]
(Int -> ReadS AlgorithmValidationProfile)
-> ReadS [AlgorithmValidationProfile]
-> ReadPrec AlgorithmValidationProfile
-> ReadPrec [AlgorithmValidationProfile]
-> Read AlgorithmValidationProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AlgorithmValidationProfile]
$creadListPrec :: ReadPrec [AlgorithmValidationProfile]
readPrec :: ReadPrec AlgorithmValidationProfile
$creadPrec :: ReadPrec AlgorithmValidationProfile
readList :: ReadS [AlgorithmValidationProfile]
$creadList :: ReadS [AlgorithmValidationProfile]
readsPrec :: Int -> ReadS AlgorithmValidationProfile
$creadsPrec :: Int -> ReadS AlgorithmValidationProfile
Prelude.Read, Int -> AlgorithmValidationProfile -> ShowS
[AlgorithmValidationProfile] -> ShowS
AlgorithmValidationProfile -> String
(Int -> AlgorithmValidationProfile -> ShowS)
-> (AlgorithmValidationProfile -> String)
-> ([AlgorithmValidationProfile] -> ShowS)
-> Show AlgorithmValidationProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlgorithmValidationProfile] -> ShowS
$cshowList :: [AlgorithmValidationProfile] -> ShowS
show :: AlgorithmValidationProfile -> String
$cshow :: AlgorithmValidationProfile -> String
showsPrec :: Int -> AlgorithmValidationProfile -> ShowS
$cshowsPrec :: Int -> AlgorithmValidationProfile -> ShowS
Prelude.Show, (forall x.
 AlgorithmValidationProfile -> Rep AlgorithmValidationProfile x)
-> (forall x.
    Rep AlgorithmValidationProfile x -> AlgorithmValidationProfile)
-> Generic AlgorithmValidationProfile
forall x.
Rep AlgorithmValidationProfile x -> AlgorithmValidationProfile
forall x.
AlgorithmValidationProfile -> Rep AlgorithmValidationProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AlgorithmValidationProfile x -> AlgorithmValidationProfile
$cfrom :: forall x.
AlgorithmValidationProfile -> Rep AlgorithmValidationProfile x
Prelude.Generic)

-- |
-- Create a value of 'AlgorithmValidationProfile' 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:
--
-- 'transformJobDefinition', 'algorithmValidationProfile_transformJobDefinition' - The @TransformJobDefinition@ object that describes the transform job
-- that Amazon SageMaker runs to validate your algorithm.
--
-- 'profileName', 'algorithmValidationProfile_profileName' - The name of the profile for the algorithm. The name must have 1 to 63
-- characters. Valid characters are a-z, A-Z, 0-9, and - (hyphen).
--
-- 'trainingJobDefinition', 'algorithmValidationProfile_trainingJobDefinition' - The @TrainingJobDefinition@ object that describes the training job that
-- Amazon SageMaker runs to validate your algorithm.
newAlgorithmValidationProfile ::
  -- | 'profileName'
  Prelude.Text ->
  -- | 'trainingJobDefinition'
  TrainingJobDefinition ->
  AlgorithmValidationProfile
newAlgorithmValidationProfile :: Text -> TrainingJobDefinition -> AlgorithmValidationProfile
newAlgorithmValidationProfile
  Text
pProfileName_
  TrainingJobDefinition
pTrainingJobDefinition_ =
    AlgorithmValidationProfile' :: Maybe TransformJobDefinition
-> Text -> TrainingJobDefinition -> AlgorithmValidationProfile
AlgorithmValidationProfile'
      { $sel:transformJobDefinition:AlgorithmValidationProfile' :: Maybe TransformJobDefinition
transformJobDefinition =
          Maybe TransformJobDefinition
forall a. Maybe a
Prelude.Nothing,
        $sel:profileName:AlgorithmValidationProfile' :: Text
profileName = Text
pProfileName_,
        $sel:trainingJobDefinition:AlgorithmValidationProfile' :: TrainingJobDefinition
trainingJobDefinition = TrainingJobDefinition
pTrainingJobDefinition_
      }

-- | The @TransformJobDefinition@ object that describes the transform job
-- that Amazon SageMaker runs to validate your algorithm.
algorithmValidationProfile_transformJobDefinition :: Lens.Lens' AlgorithmValidationProfile (Prelude.Maybe TransformJobDefinition)
algorithmValidationProfile_transformJobDefinition :: (Maybe TransformJobDefinition -> f (Maybe TransformJobDefinition))
-> AlgorithmValidationProfile -> f AlgorithmValidationProfile
algorithmValidationProfile_transformJobDefinition = (AlgorithmValidationProfile -> Maybe TransformJobDefinition)
-> (AlgorithmValidationProfile
    -> Maybe TransformJobDefinition -> AlgorithmValidationProfile)
-> Lens
     AlgorithmValidationProfile
     AlgorithmValidationProfile
     (Maybe TransformJobDefinition)
     (Maybe TransformJobDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmValidationProfile' {Maybe TransformJobDefinition
transformJobDefinition :: Maybe TransformJobDefinition
$sel:transformJobDefinition:AlgorithmValidationProfile' :: AlgorithmValidationProfile -> Maybe TransformJobDefinition
transformJobDefinition} -> Maybe TransformJobDefinition
transformJobDefinition) (\s :: AlgorithmValidationProfile
s@AlgorithmValidationProfile' {} Maybe TransformJobDefinition
a -> AlgorithmValidationProfile
s {$sel:transformJobDefinition:AlgorithmValidationProfile' :: Maybe TransformJobDefinition
transformJobDefinition = Maybe TransformJobDefinition
a} :: AlgorithmValidationProfile)

-- | The name of the profile for the algorithm. The name must have 1 to 63
-- characters. Valid characters are a-z, A-Z, 0-9, and - (hyphen).
algorithmValidationProfile_profileName :: Lens.Lens' AlgorithmValidationProfile Prelude.Text
algorithmValidationProfile_profileName :: (Text -> f Text)
-> AlgorithmValidationProfile -> f AlgorithmValidationProfile
algorithmValidationProfile_profileName = (AlgorithmValidationProfile -> Text)
-> (AlgorithmValidationProfile
    -> Text -> AlgorithmValidationProfile)
-> Lens
     AlgorithmValidationProfile AlgorithmValidationProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmValidationProfile' {Text
profileName :: Text
$sel:profileName:AlgorithmValidationProfile' :: AlgorithmValidationProfile -> Text
profileName} -> Text
profileName) (\s :: AlgorithmValidationProfile
s@AlgorithmValidationProfile' {} Text
a -> AlgorithmValidationProfile
s {$sel:profileName:AlgorithmValidationProfile' :: Text
profileName = Text
a} :: AlgorithmValidationProfile)

-- | The @TrainingJobDefinition@ object that describes the training job that
-- Amazon SageMaker runs to validate your algorithm.
algorithmValidationProfile_trainingJobDefinition :: Lens.Lens' AlgorithmValidationProfile TrainingJobDefinition
algorithmValidationProfile_trainingJobDefinition :: (TrainingJobDefinition -> f TrainingJobDefinition)
-> AlgorithmValidationProfile -> f AlgorithmValidationProfile
algorithmValidationProfile_trainingJobDefinition = (AlgorithmValidationProfile -> TrainingJobDefinition)
-> (AlgorithmValidationProfile
    -> TrainingJobDefinition -> AlgorithmValidationProfile)
-> Lens
     AlgorithmValidationProfile
     AlgorithmValidationProfile
     TrainingJobDefinition
     TrainingJobDefinition
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmValidationProfile' {TrainingJobDefinition
trainingJobDefinition :: TrainingJobDefinition
$sel:trainingJobDefinition:AlgorithmValidationProfile' :: AlgorithmValidationProfile -> TrainingJobDefinition
trainingJobDefinition} -> TrainingJobDefinition
trainingJobDefinition) (\s :: AlgorithmValidationProfile
s@AlgorithmValidationProfile' {} TrainingJobDefinition
a -> AlgorithmValidationProfile
s {$sel:trainingJobDefinition:AlgorithmValidationProfile' :: TrainingJobDefinition
trainingJobDefinition = TrainingJobDefinition
a} :: AlgorithmValidationProfile)

instance Core.FromJSON AlgorithmValidationProfile where
  parseJSON :: Value -> Parser AlgorithmValidationProfile
parseJSON =
    String
-> (Object -> Parser AlgorithmValidationProfile)
-> Value
-> Parser AlgorithmValidationProfile
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AlgorithmValidationProfile"
      ( \Object
x ->
          Maybe TransformJobDefinition
-> Text -> TrainingJobDefinition -> AlgorithmValidationProfile
AlgorithmValidationProfile'
            (Maybe TransformJobDefinition
 -> Text -> TrainingJobDefinition -> AlgorithmValidationProfile)
-> Parser (Maybe TransformJobDefinition)
-> Parser
     (Text -> TrainingJobDefinition -> AlgorithmValidationProfile)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TransformJobDefinition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TransformJobDefinition")
            Parser
  (Text -> TrainingJobDefinition -> AlgorithmValidationProfile)
-> Parser Text
-> Parser (TrainingJobDefinition -> AlgorithmValidationProfile)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ProfileName")
            Parser (TrainingJobDefinition -> AlgorithmValidationProfile)
-> Parser TrainingJobDefinition
-> Parser AlgorithmValidationProfile
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TrainingJobDefinition
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TrainingJobDefinition")
      )

instance Prelude.Hashable AlgorithmValidationProfile

instance Prelude.NFData AlgorithmValidationProfile

instance Core.ToJSON AlgorithmValidationProfile where
  toJSON :: AlgorithmValidationProfile -> Value
toJSON AlgorithmValidationProfile' {Maybe TransformJobDefinition
Text
TrainingJobDefinition
trainingJobDefinition :: TrainingJobDefinition
profileName :: Text
transformJobDefinition :: Maybe TransformJobDefinition
$sel:trainingJobDefinition:AlgorithmValidationProfile' :: AlgorithmValidationProfile -> TrainingJobDefinition
$sel:profileName:AlgorithmValidationProfile' :: AlgorithmValidationProfile -> Text
$sel:transformJobDefinition:AlgorithmValidationProfile' :: AlgorithmValidationProfile -> Maybe TransformJobDefinition
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TransformJobDefinition" Text -> TransformJobDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TransformJobDefinition -> Pair)
-> Maybe TransformJobDefinition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TransformJobDefinition
transformJobDefinition,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProfileName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
profileName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"TrainingJobDefinition"
                  Text -> TrainingJobDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TrainingJobDefinition
trainingJobDefinition
              )
          ]
      )