{-# 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-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.LabelingJobInputConfig 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.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
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]
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
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. 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'
    { $sel:dataAttributes:LabelingJobInputConfig' :: Maybe LabelingJobDataAttributes
dataAttributes =
        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 :: Lens' LabelingJobInputConfig (Maybe LabelingJobDataAttributes)
labelingJobInputConfig_dataAttributes = 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 :: Lens' LabelingJobInputConfig LabelingJobDataSource
labelingJobInputConfig_dataSource = 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 Data.FromJSON LabelingJobInputConfig where
  parseJSON :: Value -> Parser LabelingJobInputConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LabelingJobInputConfig"
      ( \Object
x ->
          Maybe LabelingJobDataAttributes
-> LabelingJobDataSource -> LabelingJobInputConfig
LabelingJobInputConfig'
            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
"DataAttributes")
            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
"DataSource")
      )

instance Prelude.Hashable LabelingJobInputConfig where
  hashWithSalt :: Int -> LabelingJobInputConfig -> Int
hashWithSalt Int
_salt LabelingJobInputConfig' {Maybe LabelingJobDataAttributes
LabelingJobDataSource
dataSource :: LabelingJobDataSource
dataAttributes :: Maybe LabelingJobDataAttributes
$sel:dataSource:LabelingJobInputConfig' :: LabelingJobInputConfig -> LabelingJobDataSource
$sel:dataAttributes:LabelingJobInputConfig' :: LabelingJobInputConfig -> Maybe LabelingJobDataAttributes
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LabelingJobDataAttributes
dataAttributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LabelingJobDataSource
dataSource

instance Prelude.NFData LabelingJobInputConfig where
  rnf :: LabelingJobInputConfig -> ()
rnf LabelingJobInputConfig' {Maybe LabelingJobDataAttributes
LabelingJobDataSource
dataSource :: LabelingJobDataSource
dataAttributes :: Maybe LabelingJobDataAttributes
$sel:dataSource:LabelingJobInputConfig' :: LabelingJobInputConfig -> LabelingJobDataSource
$sel:dataAttributes:LabelingJobInputConfig' :: LabelingJobInputConfig -> Maybe LabelingJobDataAttributes
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LabelingJobDataAttributes
dataAttributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LabelingJobDataSource
dataSource

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DataAttributes" 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 LabelingJobDataAttributes
dataAttributes,
            forall a. a -> Maybe a
Prelude.Just (Key
"DataSource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LabelingJobDataSource
dataSource)
          ]
      )