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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.LabelingJobResourceConfig

-- | Provides configuration information for auto-labeling of your data
-- objects. A @LabelingJobAlgorithmsConfig@ object must be supplied in
-- order to use auto-labeling.
--
-- /See:/ 'newLabelingJobAlgorithmsConfig' smart constructor.
data LabelingJobAlgorithmsConfig = LabelingJobAlgorithmsConfig'
  { -- | Provides configuration information for a labeling job.
    LabelingJobAlgorithmsConfig -> Maybe LabelingJobResourceConfig
labelingJobResourceConfig :: Prelude.Maybe LabelingJobResourceConfig,
    -- | At the end of an auto-label job Ground Truth sends the Amazon Resource
    -- Name (ARN) of the final model used for auto-labeling. You can use this
    -- model as the starting point for subsequent similar jobs by providing the
    -- ARN of the model here.
    LabelingJobAlgorithmsConfig -> Maybe Text
initialActiveLearningModelArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Amazon Resource Name (ARN) of the algorithm used for
    -- auto-labeling. You must select one of the following ARNs:
    --
    -- -   /Image classification/
    --
    --     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/image-classification@
    --
    -- -   /Text classification/
    --
    --     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/text-classification@
    --
    -- -   /Object detection/
    --
    --     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/object-detection@
    --
    -- -   /Semantic Segmentation/
    --
    --     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/semantic-segmentation@
    LabelingJobAlgorithmsConfig -> Text
labelingJobAlgorithmSpecificationArn :: Prelude.Text
  }
  deriving (LabelingJobAlgorithmsConfig -> LabelingJobAlgorithmsConfig -> Bool
(LabelingJobAlgorithmsConfig
 -> LabelingJobAlgorithmsConfig -> Bool)
-> (LabelingJobAlgorithmsConfig
    -> LabelingJobAlgorithmsConfig -> Bool)
-> Eq LabelingJobAlgorithmsConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LabelingJobAlgorithmsConfig -> LabelingJobAlgorithmsConfig -> Bool
$c/= :: LabelingJobAlgorithmsConfig -> LabelingJobAlgorithmsConfig -> Bool
== :: LabelingJobAlgorithmsConfig -> LabelingJobAlgorithmsConfig -> Bool
$c== :: LabelingJobAlgorithmsConfig -> LabelingJobAlgorithmsConfig -> Bool
Prelude.Eq, ReadPrec [LabelingJobAlgorithmsConfig]
ReadPrec LabelingJobAlgorithmsConfig
Int -> ReadS LabelingJobAlgorithmsConfig
ReadS [LabelingJobAlgorithmsConfig]
(Int -> ReadS LabelingJobAlgorithmsConfig)
-> ReadS [LabelingJobAlgorithmsConfig]
-> ReadPrec LabelingJobAlgorithmsConfig
-> ReadPrec [LabelingJobAlgorithmsConfig]
-> Read LabelingJobAlgorithmsConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LabelingJobAlgorithmsConfig]
$creadListPrec :: ReadPrec [LabelingJobAlgorithmsConfig]
readPrec :: ReadPrec LabelingJobAlgorithmsConfig
$creadPrec :: ReadPrec LabelingJobAlgorithmsConfig
readList :: ReadS [LabelingJobAlgorithmsConfig]
$creadList :: ReadS [LabelingJobAlgorithmsConfig]
readsPrec :: Int -> ReadS LabelingJobAlgorithmsConfig
$creadsPrec :: Int -> ReadS LabelingJobAlgorithmsConfig
Prelude.Read, Int -> LabelingJobAlgorithmsConfig -> ShowS
[LabelingJobAlgorithmsConfig] -> ShowS
LabelingJobAlgorithmsConfig -> String
(Int -> LabelingJobAlgorithmsConfig -> ShowS)
-> (LabelingJobAlgorithmsConfig -> String)
-> ([LabelingJobAlgorithmsConfig] -> ShowS)
-> Show LabelingJobAlgorithmsConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LabelingJobAlgorithmsConfig] -> ShowS
$cshowList :: [LabelingJobAlgorithmsConfig] -> ShowS
show :: LabelingJobAlgorithmsConfig -> String
$cshow :: LabelingJobAlgorithmsConfig -> String
showsPrec :: Int -> LabelingJobAlgorithmsConfig -> ShowS
$cshowsPrec :: Int -> LabelingJobAlgorithmsConfig -> ShowS
Prelude.Show, (forall x.
 LabelingJobAlgorithmsConfig -> Rep LabelingJobAlgorithmsConfig x)
-> (forall x.
    Rep LabelingJobAlgorithmsConfig x -> LabelingJobAlgorithmsConfig)
-> Generic LabelingJobAlgorithmsConfig
forall x.
Rep LabelingJobAlgorithmsConfig x -> LabelingJobAlgorithmsConfig
forall x.
LabelingJobAlgorithmsConfig -> Rep LabelingJobAlgorithmsConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LabelingJobAlgorithmsConfig x -> LabelingJobAlgorithmsConfig
$cfrom :: forall x.
LabelingJobAlgorithmsConfig -> Rep LabelingJobAlgorithmsConfig x
Prelude.Generic)

-- |
-- Create a value of 'LabelingJobAlgorithmsConfig' 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:
--
-- 'labelingJobResourceConfig', 'labelingJobAlgorithmsConfig_labelingJobResourceConfig' - Provides configuration information for a labeling job.
--
-- 'initialActiveLearningModelArn', 'labelingJobAlgorithmsConfig_initialActiveLearningModelArn' - At the end of an auto-label job Ground Truth sends the Amazon Resource
-- Name (ARN) of the final model used for auto-labeling. You can use this
-- model as the starting point for subsequent similar jobs by providing the
-- ARN of the model here.
--
-- 'labelingJobAlgorithmSpecificationArn', 'labelingJobAlgorithmsConfig_labelingJobAlgorithmSpecificationArn' - Specifies the Amazon Resource Name (ARN) of the algorithm used for
-- auto-labeling. You must select one of the following ARNs:
--
-- -   /Image classification/
--
--     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/image-classification@
--
-- -   /Text classification/
--
--     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/text-classification@
--
-- -   /Object detection/
--
--     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/object-detection@
--
-- -   /Semantic Segmentation/
--
--     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/semantic-segmentation@
newLabelingJobAlgorithmsConfig ::
  -- | 'labelingJobAlgorithmSpecificationArn'
  Prelude.Text ->
  LabelingJobAlgorithmsConfig
newLabelingJobAlgorithmsConfig :: Text -> LabelingJobAlgorithmsConfig
newLabelingJobAlgorithmsConfig
  Text
pLabelingJobAlgorithmSpecificationArn_ =
    LabelingJobAlgorithmsConfig' :: Maybe LabelingJobResourceConfig
-> Maybe Text -> Text -> LabelingJobAlgorithmsConfig
LabelingJobAlgorithmsConfig'
      { $sel:labelingJobResourceConfig:LabelingJobAlgorithmsConfig' :: Maybe LabelingJobResourceConfig
labelingJobResourceConfig =
          Maybe LabelingJobResourceConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:initialActiveLearningModelArn:LabelingJobAlgorithmsConfig' :: Maybe Text
initialActiveLearningModelArn =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:labelingJobAlgorithmSpecificationArn:LabelingJobAlgorithmsConfig' :: Text
labelingJobAlgorithmSpecificationArn =
          Text
pLabelingJobAlgorithmSpecificationArn_
      }

-- | Provides configuration information for a labeling job.
labelingJobAlgorithmsConfig_labelingJobResourceConfig :: Lens.Lens' LabelingJobAlgorithmsConfig (Prelude.Maybe LabelingJobResourceConfig)
labelingJobAlgorithmsConfig_labelingJobResourceConfig :: (Maybe LabelingJobResourceConfig
 -> f (Maybe LabelingJobResourceConfig))
-> LabelingJobAlgorithmsConfig -> f LabelingJobAlgorithmsConfig
labelingJobAlgorithmsConfig_labelingJobResourceConfig = (LabelingJobAlgorithmsConfig -> Maybe LabelingJobResourceConfig)
-> (LabelingJobAlgorithmsConfig
    -> Maybe LabelingJobResourceConfig -> LabelingJobAlgorithmsConfig)
-> Lens
     LabelingJobAlgorithmsConfig
     LabelingJobAlgorithmsConfig
     (Maybe LabelingJobResourceConfig)
     (Maybe LabelingJobResourceConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelingJobAlgorithmsConfig' {Maybe LabelingJobResourceConfig
labelingJobResourceConfig :: Maybe LabelingJobResourceConfig
$sel:labelingJobResourceConfig:LabelingJobAlgorithmsConfig' :: LabelingJobAlgorithmsConfig -> Maybe LabelingJobResourceConfig
labelingJobResourceConfig} -> Maybe LabelingJobResourceConfig
labelingJobResourceConfig) (\s :: LabelingJobAlgorithmsConfig
s@LabelingJobAlgorithmsConfig' {} Maybe LabelingJobResourceConfig
a -> LabelingJobAlgorithmsConfig
s {$sel:labelingJobResourceConfig:LabelingJobAlgorithmsConfig' :: Maybe LabelingJobResourceConfig
labelingJobResourceConfig = Maybe LabelingJobResourceConfig
a} :: LabelingJobAlgorithmsConfig)

-- | At the end of an auto-label job Ground Truth sends the Amazon Resource
-- Name (ARN) of the final model used for auto-labeling. You can use this
-- model as the starting point for subsequent similar jobs by providing the
-- ARN of the model here.
labelingJobAlgorithmsConfig_initialActiveLearningModelArn :: Lens.Lens' LabelingJobAlgorithmsConfig (Prelude.Maybe Prelude.Text)
labelingJobAlgorithmsConfig_initialActiveLearningModelArn :: (Maybe Text -> f (Maybe Text))
-> LabelingJobAlgorithmsConfig -> f LabelingJobAlgorithmsConfig
labelingJobAlgorithmsConfig_initialActiveLearningModelArn = (LabelingJobAlgorithmsConfig -> Maybe Text)
-> (LabelingJobAlgorithmsConfig
    -> Maybe Text -> LabelingJobAlgorithmsConfig)
-> Lens
     LabelingJobAlgorithmsConfig
     LabelingJobAlgorithmsConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelingJobAlgorithmsConfig' {Maybe Text
initialActiveLearningModelArn :: Maybe Text
$sel:initialActiveLearningModelArn:LabelingJobAlgorithmsConfig' :: LabelingJobAlgorithmsConfig -> Maybe Text
initialActiveLearningModelArn} -> Maybe Text
initialActiveLearningModelArn) (\s :: LabelingJobAlgorithmsConfig
s@LabelingJobAlgorithmsConfig' {} Maybe Text
a -> LabelingJobAlgorithmsConfig
s {$sel:initialActiveLearningModelArn:LabelingJobAlgorithmsConfig' :: Maybe Text
initialActiveLearningModelArn = Maybe Text
a} :: LabelingJobAlgorithmsConfig)

-- | Specifies the Amazon Resource Name (ARN) of the algorithm used for
-- auto-labeling. You must select one of the following ARNs:
--
-- -   /Image classification/
--
--     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/image-classification@
--
-- -   /Text classification/
--
--     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/text-classification@
--
-- -   /Object detection/
--
--     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/object-detection@
--
-- -   /Semantic Segmentation/
--
--     @arn:aws:sagemaker:region:027400017018:labeling-job-algorithm-specification\/semantic-segmentation@
labelingJobAlgorithmsConfig_labelingJobAlgorithmSpecificationArn :: Lens.Lens' LabelingJobAlgorithmsConfig Prelude.Text
labelingJobAlgorithmsConfig_labelingJobAlgorithmSpecificationArn :: (Text -> f Text)
-> LabelingJobAlgorithmsConfig -> f LabelingJobAlgorithmsConfig
labelingJobAlgorithmsConfig_labelingJobAlgorithmSpecificationArn = (LabelingJobAlgorithmsConfig -> Text)
-> (LabelingJobAlgorithmsConfig
    -> Text -> LabelingJobAlgorithmsConfig)
-> Lens
     LabelingJobAlgorithmsConfig LabelingJobAlgorithmsConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelingJobAlgorithmsConfig' {Text
labelingJobAlgorithmSpecificationArn :: Text
$sel:labelingJobAlgorithmSpecificationArn:LabelingJobAlgorithmsConfig' :: LabelingJobAlgorithmsConfig -> Text
labelingJobAlgorithmSpecificationArn} -> Text
labelingJobAlgorithmSpecificationArn) (\s :: LabelingJobAlgorithmsConfig
s@LabelingJobAlgorithmsConfig' {} Text
a -> LabelingJobAlgorithmsConfig
s {$sel:labelingJobAlgorithmSpecificationArn:LabelingJobAlgorithmsConfig' :: Text
labelingJobAlgorithmSpecificationArn = Text
a} :: LabelingJobAlgorithmsConfig)

instance Core.FromJSON LabelingJobAlgorithmsConfig where
  parseJSON :: Value -> Parser LabelingJobAlgorithmsConfig
parseJSON =
    String
-> (Object -> Parser LabelingJobAlgorithmsConfig)
-> Value
-> Parser LabelingJobAlgorithmsConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LabelingJobAlgorithmsConfig"
      ( \Object
x ->
          Maybe LabelingJobResourceConfig
-> Maybe Text -> Text -> LabelingJobAlgorithmsConfig
LabelingJobAlgorithmsConfig'
            (Maybe LabelingJobResourceConfig
 -> Maybe Text -> Text -> LabelingJobAlgorithmsConfig)
-> Parser (Maybe LabelingJobResourceConfig)
-> Parser (Maybe Text -> Text -> LabelingJobAlgorithmsConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LabelingJobResourceConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LabelingJobResourceConfig")
            Parser (Maybe Text -> Text -> LabelingJobAlgorithmsConfig)
-> Parser (Maybe Text)
-> Parser (Text -> LabelingJobAlgorithmsConfig)
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
"InitialActiveLearningModelArn")
            Parser (Text -> LabelingJobAlgorithmsConfig)
-> Parser Text -> Parser LabelingJobAlgorithmsConfig
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
"LabelingJobAlgorithmSpecificationArn")
      )

instance Prelude.Hashable LabelingJobAlgorithmsConfig

instance Prelude.NFData LabelingJobAlgorithmsConfig

instance Core.ToJSON LabelingJobAlgorithmsConfig where
  toJSON :: LabelingJobAlgorithmsConfig -> Value
toJSON LabelingJobAlgorithmsConfig' {Maybe Text
Maybe LabelingJobResourceConfig
Text
labelingJobAlgorithmSpecificationArn :: Text
initialActiveLearningModelArn :: Maybe Text
labelingJobResourceConfig :: Maybe LabelingJobResourceConfig
$sel:labelingJobAlgorithmSpecificationArn:LabelingJobAlgorithmsConfig' :: LabelingJobAlgorithmsConfig -> Text
$sel:initialActiveLearningModelArn:LabelingJobAlgorithmsConfig' :: LabelingJobAlgorithmsConfig -> Maybe Text
$sel:labelingJobResourceConfig:LabelingJobAlgorithmsConfig' :: LabelingJobAlgorithmsConfig -> Maybe LabelingJobResourceConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"LabelingJobResourceConfig" Text -> LabelingJobResourceConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (LabelingJobResourceConfig -> Pair)
-> Maybe LabelingJobResourceConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LabelingJobResourceConfig
labelingJobResourceConfig,
            (Text
"InitialActiveLearningModelArn" 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
initialActiveLearningModelArn,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"LabelingJobAlgorithmSpecificationArn"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
labelingJobAlgorithmSpecificationArn
              )
          ]
      )