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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.LabelingJobDataAttributes
import Amazonka.SageMaker.Types.LabelingJobDataSource

-- | Input configuration information for a labeling job.
--
-- /See:/ 'newLabelingJobInputConfig' smart constructor.
data LabelingJobInputConfig = LabelingJobInputConfig'
  { -- | Attributes of the data specified by the customer.
    LabelingJobInputConfig -> Maybe LabelingJobDataAttributes
dataAttributes :: Prelude.Maybe LabelingJobDataAttributes,
    -- | The location of the input data.
    LabelingJobInputConfig -> LabelingJobDataSource
dataSource :: LabelingJobDataSource
  }
  deriving (LabelingJobInputConfig -> LabelingJobInputConfig -> Bool
(LabelingJobInputConfig -> LabelingJobInputConfig -> Bool)
-> (LabelingJobInputConfig -> LabelingJobInputConfig -> Bool)
-> Eq LabelingJobInputConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LabelingJobInputConfig -> LabelingJobInputConfig -> Bool
$c/= :: LabelingJobInputConfig -> LabelingJobInputConfig -> Bool
== :: LabelingJobInputConfig -> LabelingJobInputConfig -> Bool
$c== :: LabelingJobInputConfig -> LabelingJobInputConfig -> Bool
Prelude.Eq, ReadPrec [LabelingJobInputConfig]
ReadPrec LabelingJobInputConfig
Int -> ReadS LabelingJobInputConfig
ReadS [LabelingJobInputConfig]
(Int -> ReadS LabelingJobInputConfig)
-> ReadS [LabelingJobInputConfig]
-> ReadPrec LabelingJobInputConfig
-> ReadPrec [LabelingJobInputConfig]
-> Read LabelingJobInputConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LabelingJobInputConfig]
$creadListPrec :: ReadPrec [LabelingJobInputConfig]
readPrec :: ReadPrec LabelingJobInputConfig
$creadPrec :: ReadPrec LabelingJobInputConfig
readList :: ReadS [LabelingJobInputConfig]
$creadList :: ReadS [LabelingJobInputConfig]
readsPrec :: Int -> ReadS LabelingJobInputConfig
$creadsPrec :: Int -> ReadS LabelingJobInputConfig
Prelude.Read, Int -> LabelingJobInputConfig -> ShowS
[LabelingJobInputConfig] -> ShowS
LabelingJobInputConfig -> String
(Int -> LabelingJobInputConfig -> ShowS)
-> (LabelingJobInputConfig -> String)
-> ([LabelingJobInputConfig] -> ShowS)
-> Show LabelingJobInputConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LabelingJobInputConfig] -> ShowS
$cshowList :: [LabelingJobInputConfig] -> ShowS
show :: LabelingJobInputConfig -> String
$cshow :: LabelingJobInputConfig -> String
showsPrec :: Int -> LabelingJobInputConfig -> ShowS
$cshowsPrec :: Int -> LabelingJobInputConfig -> ShowS
Prelude.Show, (forall x. LabelingJobInputConfig -> Rep LabelingJobInputConfig x)
-> (forall x.
    Rep LabelingJobInputConfig x -> LabelingJobInputConfig)
-> Generic LabelingJobInputConfig
forall x. Rep LabelingJobInputConfig x -> LabelingJobInputConfig
forall x. LabelingJobInputConfig -> Rep LabelingJobInputConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LabelingJobInputConfig x -> LabelingJobInputConfig
$cfrom :: forall x. LabelingJobInputConfig -> Rep LabelingJobInputConfig x
Prelude.Generic)

-- |
-- Create a value of 'LabelingJobInputConfig' 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:
--
-- 'dataAttributes', 'labelingJobInputConfig_dataAttributes' - Attributes of the data specified by the customer.
--
-- 'dataSource', 'labelingJobInputConfig_dataSource' - The location of the input data.
newLabelingJobInputConfig ::
  -- | 'dataSource'
  LabelingJobDataSource ->
  LabelingJobInputConfig
newLabelingJobInputConfig :: LabelingJobDataSource -> LabelingJobInputConfig
newLabelingJobInputConfig LabelingJobDataSource
pDataSource_ =
  LabelingJobInputConfig' :: Maybe LabelingJobDataAttributes
-> LabelingJobDataSource -> LabelingJobInputConfig
LabelingJobInputConfig'
    { $sel:dataAttributes:LabelingJobInputConfig' :: Maybe LabelingJobDataAttributes
dataAttributes =
        Maybe LabelingJobDataAttributes
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSource:LabelingJobInputConfig' :: LabelingJobDataSource
dataSource = LabelingJobDataSource
pDataSource_
    }

-- | Attributes of the data specified by the customer.
labelingJobInputConfig_dataAttributes :: Lens.Lens' LabelingJobInputConfig (Prelude.Maybe LabelingJobDataAttributes)
labelingJobInputConfig_dataAttributes :: (Maybe LabelingJobDataAttributes
 -> f (Maybe LabelingJobDataAttributes))
-> LabelingJobInputConfig -> f LabelingJobInputConfig
labelingJobInputConfig_dataAttributes = (LabelingJobInputConfig -> Maybe LabelingJobDataAttributes)
-> (LabelingJobInputConfig
    -> Maybe LabelingJobDataAttributes -> LabelingJobInputConfig)
-> Lens
     LabelingJobInputConfig
     LabelingJobInputConfig
     (Maybe LabelingJobDataAttributes)
     (Maybe LabelingJobDataAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelingJobInputConfig' {Maybe LabelingJobDataAttributes
dataAttributes :: Maybe LabelingJobDataAttributes
$sel:dataAttributes:LabelingJobInputConfig' :: LabelingJobInputConfig -> Maybe LabelingJobDataAttributes
dataAttributes} -> Maybe LabelingJobDataAttributes
dataAttributes) (\s :: LabelingJobInputConfig
s@LabelingJobInputConfig' {} Maybe LabelingJobDataAttributes
a -> LabelingJobInputConfig
s {$sel:dataAttributes:LabelingJobInputConfig' :: Maybe LabelingJobDataAttributes
dataAttributes = Maybe LabelingJobDataAttributes
a} :: LabelingJobInputConfig)

-- | The location of the input data.
labelingJobInputConfig_dataSource :: Lens.Lens' LabelingJobInputConfig LabelingJobDataSource
labelingJobInputConfig_dataSource :: (LabelingJobDataSource -> f LabelingJobDataSource)
-> LabelingJobInputConfig -> f LabelingJobInputConfig
labelingJobInputConfig_dataSource = (LabelingJobInputConfig -> LabelingJobDataSource)
-> (LabelingJobInputConfig
    -> LabelingJobDataSource -> LabelingJobInputConfig)
-> Lens
     LabelingJobInputConfig
     LabelingJobInputConfig
     LabelingJobDataSource
     LabelingJobDataSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelingJobInputConfig' {LabelingJobDataSource
dataSource :: LabelingJobDataSource
$sel:dataSource:LabelingJobInputConfig' :: LabelingJobInputConfig -> LabelingJobDataSource
dataSource} -> LabelingJobDataSource
dataSource) (\s :: LabelingJobInputConfig
s@LabelingJobInputConfig' {} LabelingJobDataSource
a -> LabelingJobInputConfig
s {$sel:dataSource:LabelingJobInputConfig' :: LabelingJobDataSource
dataSource = LabelingJobDataSource
a} :: LabelingJobInputConfig)

instance Core.FromJSON LabelingJobInputConfig where
  parseJSON :: Value -> Parser LabelingJobInputConfig
parseJSON =
    String
-> (Object -> Parser LabelingJobInputConfig)
-> Value
-> Parser LabelingJobInputConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LabelingJobInputConfig"
      ( \Object
x ->
          Maybe LabelingJobDataAttributes
-> LabelingJobDataSource -> LabelingJobInputConfig
LabelingJobInputConfig'
            (Maybe LabelingJobDataAttributes
 -> LabelingJobDataSource -> LabelingJobInputConfig)
-> Parser (Maybe LabelingJobDataAttributes)
-> Parser (LabelingJobDataSource -> LabelingJobInputConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LabelingJobDataAttributes)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataAttributes")
            Parser (LabelingJobDataSource -> LabelingJobInputConfig)
-> Parser LabelingJobDataSource -> Parser LabelingJobInputConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser LabelingJobDataSource
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DataSource")
      )

instance Prelude.Hashable LabelingJobInputConfig

instance Prelude.NFData LabelingJobInputConfig

instance Core.ToJSON LabelingJobInputConfig where
  toJSON :: LabelingJobInputConfig -> Value
toJSON LabelingJobInputConfig' {Maybe LabelingJobDataAttributes
LabelingJobDataSource
dataSource :: LabelingJobDataSource
dataAttributes :: Maybe LabelingJobDataAttributes
$sel:dataSource:LabelingJobInputConfig' :: LabelingJobInputConfig -> LabelingJobDataSource
$sel:dataAttributes:LabelingJobInputConfig' :: LabelingJobInputConfig -> Maybe LabelingJobDataAttributes
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DataAttributes" Text -> LabelingJobDataAttributes -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (LabelingJobDataAttributes -> Pair)
-> Maybe LabelingJobDataAttributes -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LabelingJobDataAttributes
dataAttributes,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DataSource" Text -> LabelingJobDataSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LabelingJobDataSource
dataSource)
          ]
      )